2014-08-01 18:15:35 +00:00
|
|
|
-- Copyright (c) 2014 Microsoft Corporation. All rights reserved.
|
2014-07-13 00:39:35 +00:00
|
|
|
-- Released under Apache 2.0 license as described in the file LICENSE.
|
2014-08-15 03:12:54 +00:00
|
|
|
-- Authors: Leonardo de Moura, Jeremy Avigad
|
2014-08-01 01:40:09 +00:00
|
|
|
|
2014-08-15 15:43:52 +00:00
|
|
|
import logic.connectives.eq logic.connectives.quantifiers
|
|
|
|
import logic.classes.inhabited logic.classes.nonempty
|
2014-08-15 03:12:54 +00:00
|
|
|
import data.subtype data.sum
|
2014-07-13 00:39:35 +00:00
|
|
|
|
2014-08-20 02:32:44 +00:00
|
|
|
using subtype inhabited nonempty
|
2014-08-15 03:12:54 +00:00
|
|
|
|
|
|
|
-- logic.axioms.hilbert
|
|
|
|
-- ====================
|
|
|
|
|
|
|
|
-- Follows Coq.Logic.ClassicalEpsilon (but our definition of "inhabited" is the
|
|
|
|
-- constructive one).
|
|
|
|
|
|
|
|
axiom strong_indefinite_description {A : Type} (P : A → Prop) (H : nonempty A) :
|
|
|
|
{x : A | (∃x : A, P x) → P x}
|
|
|
|
|
|
|
|
-- In the presence of classical logic, we could prove this from the weaker
|
|
|
|
-- axiom indefinite_description {A : Type} {P : A->Prop} (H : ∃x, P x) : { x : A | P x }
|
|
|
|
|
2014-08-15 15:43:52 +00:00
|
|
|
theorem nonempty_imp_exists_true {A : Type} (H : nonempty A) : ∃x : A, true :=
|
|
|
|
nonempty_elim H (take x, exists_intro x trivial)
|
|
|
|
|
2014-08-15 03:12:54 +00:00
|
|
|
theorem nonempty_imp_inhabited {A : Type} (H : nonempty A) : inhabited A :=
|
2014-08-15 15:43:52 +00:00
|
|
|
let u : {x : A | (∃x : A, true) → true} := strong_indefinite_description (λa, true) H in
|
2014-08-20 02:32:44 +00:00
|
|
|
inhabited_mk (elt_of u)
|
2014-08-15 03:12:54 +00:00
|
|
|
|
|
|
|
theorem inhabited_exists {A : Type} {P : A → Prop} (H : ∃x, P x) : inhabited A :=
|
2014-08-15 15:43:52 +00:00
|
|
|
nonempty_imp_inhabited (obtain w Hw, from H, nonempty_intro w)
|
2014-08-15 03:12:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
-- the Hilbert epsilon function
|
|
|
|
-- ----------------------------
|
|
|
|
|
2014-08-15 15:43:52 +00:00
|
|
|
definition epsilon {A : Type} {H : nonempty A} (P : A → Prop) : A :=
|
2014-08-15 03:12:54 +00:00
|
|
|
let u : {x : A | (∃y, P y) → P x} :=
|
2014-08-15 15:43:52 +00:00
|
|
|
strong_indefinite_description P H in
|
2014-08-15 03:12:54 +00:00
|
|
|
elt_of u
|
|
|
|
|
2014-08-15 15:43:52 +00:00
|
|
|
theorem epsilon_spec_aux {A : Type} (H : nonempty A) (P : A → Prop) (Hex : ∃y, P y) :
|
2014-08-15 03:12:54 +00:00
|
|
|
P (@epsilon A H P) :=
|
|
|
|
let u : {x : A | (∃y, P y) → P x} :=
|
2014-08-15 15:43:52 +00:00
|
|
|
strong_indefinite_description P H in
|
2014-08-15 03:12:54 +00:00
|
|
|
has_property u Hex
|
|
|
|
|
|
|
|
theorem epsilon_spec {A : Type} {P : A → Prop} (Hex : ∃y, P y) :
|
2014-08-15 15:43:52 +00:00
|
|
|
P (@epsilon A (exists_imp_nonempty Hex) P) :=
|
|
|
|
epsilon_spec_aux (exists_imp_nonempty Hex) P Hex
|
2014-07-13 00:39:35 +00:00
|
|
|
|
2014-08-15 15:43:52 +00:00
|
|
|
theorem epsilon_singleton {A : Type} (a : A) : @epsilon A (nonempty_intro a) (λx, x = a) = a :=
|
2014-08-15 03:12:54 +00:00
|
|
|
epsilon_spec (exists_intro a (refl a))
|
|
|
|
|
|
|
|
|
|
|
|
-- the axiom of choice
|
|
|
|
-- -------------------
|
2014-07-13 00:39:35 +00:00
|
|
|
|
2014-08-15 03:12:54 +00:00
|
|
|
theorem axiom_of_choice {A : Type} {B : A → Type} {R : Πx, B x → Prop} (H : ∀x, ∃y, R x y) :
|
|
|
|
∃f, ∀x, R x (f x) :=
|
2014-08-15 15:43:52 +00:00
|
|
|
let f [inline] := λx, @epsilon _ (exists_imp_nonempty (H x)) (λy, R x y),
|
2014-08-15 03:12:54 +00:00
|
|
|
H [inline] := take x, epsilon_spec (H x)
|
2014-07-29 02:58:57 +00:00
|
|
|
in exists_intro f H
|
2014-07-13 00:39:35 +00:00
|
|
|
|
2014-08-15 03:12:54 +00:00
|
|
|
theorem skolem {A : Type} {B : A → Type} {P : Πx, B x → Prop} :
|
|
|
|
(∀x, ∃y, P x y) ↔ ∃f, (∀x, P x (f x)) :=
|
2014-07-29 02:58:57 +00:00
|
|
|
iff_intro
|
2014-08-15 03:12:54 +00:00
|
|
|
(assume H : (∀x, ∃y, P x y), axiom_of_choice H)
|
|
|
|
(assume H : (∃f, (∀x, P x (f x))),
|
|
|
|
take x, obtain (fw : ∀x, B x) (Hw : ∀x, P x (fw x)), from H,
|
2014-07-29 02:58:57 +00:00
|
|
|
exists_intro (fw x) (Hw x))
|