feat(library/standard): add forall and exists theorems
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
614d8a768b
commit
638bdd5e12
2 changed files with 21 additions and 0 deletions
|
@ -143,3 +143,14 @@ theorem a_eq_false (a : Bool) : (a = false) = (¬ a)
|
||||||
:= boolext
|
:= boolext
|
||||||
(assume H, eqf_elim H)
|
(assume H, eqf_elim H)
|
||||||
(assume H, eqf_intro H)
|
(assume H, eqf_intro H)
|
||||||
|
|
||||||
|
theorem not_exists_forall {A : Type} {P : A → Bool} (H : ¬ ∃ x, P x) : ∀ x, ¬ P x
|
||||||
|
:= take x, or_elim (em (P x))
|
||||||
|
(assume Hp : P x, absurd_elim (¬ P x) (exists_intro x Hp) H)
|
||||||
|
(assume Hn : ¬ P x, Hn)
|
||||||
|
|
||||||
|
theorem not_forall_exists {A : Type} {P : A → Bool} (H : ¬ ∀ x, P x) : ∃ x, ¬ P x
|
||||||
|
:= by_contradiction (assume H1 : ¬ ∃ x, ¬ P x,
|
||||||
|
have H2 : ∀ x, ¬ ¬ P x, from not_exists_forall H1,
|
||||||
|
have H3 : ∀ x, P x, from take x, not_not_elim (H2 x),
|
||||||
|
absurd H3 H)
|
||||||
|
|
|
@ -196,6 +196,16 @@ notation `∃` binders `,` r:(scoped P, Exists P) := r
|
||||||
theorem exists_elim {A : Type} {P : A → Bool} {B : Bool} (H1 : ∃ x : A, P x) (H2 : ∀ (a : A) (H : P a), B) : B
|
theorem exists_elim {A : Type} {P : A → Bool} {B : Bool} (H1 : ∃ x : A, P x) (H2 : ∀ (a : A) (H : P a), B) : B
|
||||||
:= Exists_rec H2 H1
|
:= Exists_rec H2 H1
|
||||||
|
|
||||||
|
theorem exists_not_forall {A : Type} {P : A → Bool} (H : ∃ x, P x) : ¬ ∀ x, ¬ P x
|
||||||
|
:= assume H1 : ∀ x, ¬ P x,
|
||||||
|
obtain (w : A) (Hw : P w), from H,
|
||||||
|
absurd Hw (H1 w)
|
||||||
|
|
||||||
|
theorem forall_not_exists {A : Type} {P : A → Bool} (H2 : ∀ x, P x) : ¬ ∃ x, ¬ P x
|
||||||
|
:= assume H1 : ∃ x, ¬ P x,
|
||||||
|
obtain (w : A) (Hw : ¬ P w), from H1,
|
||||||
|
absurd (H2 w) Hw
|
||||||
|
|
||||||
definition exists_unique {A : Type} (p : A → Bool) := ∃ x, p x ∧ ∀ y, y ≠ x → ¬ p y
|
definition exists_unique {A : Type} (p : A → Bool) := ∃ x, p x ∧ ∀ y, y ≠ x → ¬ p y
|
||||||
|
|
||||||
notation `∃!` binders `,` r:(scoped P, exists_unique P) := r
|
notation `∃!` binders `,` r:(scoped P, exists_unique P) := r
|
||||||
|
|
Loading…
Reference in a new issue