2014-12-22 19:54:01 +00:00
|
|
|
/-
|
|
|
|
Copyright (c) 2014 Microsoft Corporation. All rights reserved.
|
|
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
Authors: Leonardo de Moura, Jeremy Avigad
|
|
|
|
|
|
|
|
Follows Coq.Logic.ClassicalEpsilon (but our definition of "inhabited" is the constructive one).
|
|
|
|
-/
|
2014-10-05 17:50:13 +00:00
|
|
|
import logic.quantifiers
|
2014-08-15 03:12:54 +00:00
|
|
|
import data.subtype data.sum
|
2014-09-03 23:00:38 +00:00
|
|
|
open subtype inhabited nonempty
|
2014-08-15 03:12:54 +00:00
|
|
|
|
2014-12-22 19:54:01 +00:00
|
|
|
/- the axiom -/
|
2014-08-15 03:12:54 +00:00
|
|
|
|
2014-12-22 19:54:01 +00:00
|
|
|
-- In the presence of classical logic, we could prove this from a weaker statement:
|
|
|
|
-- axiom indefinite_description {A : Type} {P : A->Prop} (H : ∃x, P x) : {x : A, P x}
|
2014-08-15 03:12:54 +00:00
|
|
|
axiom strong_indefinite_description {A : Type} (P : A → Prop) (H : nonempty A) :
|
2014-11-16 22:19:35 +00:00
|
|
|
{ x | (∃y : A, P y) → P x}
|
2014-08-15 03:12:54 +00:00
|
|
|
|
2014-12-22 19:54:01 +00:00
|
|
|
theorem exists_true_of_nonempty {A : Type} (H : nonempty A) : ∃x : A, true :=
|
2014-12-16 03:05:03 +00:00
|
|
|
nonempty.elim H (take x, exists.intro x trivial)
|
2014-08-15 15:43:52 +00:00
|
|
|
|
2014-12-22 19:54:01 +00:00
|
|
|
theorem inhabited_of_nonempty {A : Type} (H : nonempty A) : inhabited A :=
|
2014-11-16 22:19:35 +00:00
|
|
|
let u : {x | (∃y : A, true) → true} := strong_indefinite_description (λa, true) H in
|
2014-09-04 23:36:06 +00:00
|
|
|
inhabited.mk (elt_of u)
|
2014-08-15 03:12:54 +00:00
|
|
|
|
2014-12-22 19:54:01 +00:00
|
|
|
theorem inhabited_of_exists {A : Type} {P : A → Prop} (H : ∃x, P x) : inhabited A :=
|
|
|
|
inhabited_of_nonempty (obtain w Hw, from H, nonempty.intro w)
|
2014-08-15 03:12:54 +00:00
|
|
|
|
2014-12-22 19:54:01 +00:00
|
|
|
/- the Hilbert epsilon function -/
|
2014-08-15 03:12:54 +00:00
|
|
|
|
2015-05-08 21:36:38 +00:00
|
|
|
definition epsilon {A : Type} [H : nonempty A] (P : A → Prop) : A :=
|
2014-11-16 22:19:35 +00:00
|
|
|
let u : {x | (∃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) :=
|
2014-11-16 22:19:35 +00:00
|
|
|
let u : {x | (∃y, P y) → P x} :=
|
2014-08-15 15:43:52 +00:00
|
|
|
strong_indefinite_description P H in
|
2015-05-08 21:36:38 +00:00
|
|
|
have aux : (∃y, P y) → P (elt_of (strong_indefinite_description P H)), from has_property u,
|
|
|
|
aux Hex
|
2014-08-15 03:12:54 +00:00
|
|
|
|
|
|
|
theorem epsilon_spec {A : Type} {P : A → Prop} (Hex : ∃y, P y) :
|
2014-12-15 21:13:04 +00:00
|
|
|
P (@epsilon A (nonempty_of_exists Hex) P) :=
|
|
|
|
epsilon_spec_aux (nonempty_of_exists Hex) P Hex
|
2014-07-13 00:39:35 +00:00
|
|
|
|
2014-09-04 23:36:06 +00:00
|
|
|
theorem epsilon_singleton {A : Type} (a : A) : @epsilon A (nonempty.intro a) (λx, x = a) = a :=
|
2014-12-16 03:05:03 +00:00
|
|
|
epsilon_spec (exists.intro a (eq.refl a))
|
2014-08-15 03:12:54 +00:00
|
|
|
|
2015-03-25 21:15:12 +00:00
|
|
|
definition some {A : Type} {P : A → Prop} (H : ∃x, P x) : A :=
|
|
|
|
@epsilon A (nonempty_of_exists H) P
|
|
|
|
|
|
|
|
theorem some_spec {A : Type} {P : A → Prop} (H : ∃x, P x) : P (some H) :=
|
|
|
|
epsilon_spec H
|
|
|
|
|
2014-12-22 19:54:01 +00:00
|
|
|
/- 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) :=
|
2015-03-25 21:15:12 +00:00
|
|
|
have H : ∀x, R x (some (H x)), from take x, some_spec (H x),
|
|
|
|
exists.intro _ 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-09-05 04:25:21 +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-12-16 03:05:03 +00:00
|
|
|
exists.intro (fw x) (Hw x))
|