2014-06-30 18:44:47 +00:00
|
|
|
|
-- Copyright (c) 2014 Microsoft Corporation. All rights reserved.
|
|
|
|
|
-- Released under Apache 2.0 license as described in the file LICENSE.
|
2014-07-19 08:29:04 +00:00
|
|
|
|
-- Authors: Leonardo de Moura, Jeremy Avigad
|
2014-07-22 16:43:18 +00:00
|
|
|
|
definition Prop [inline] := Type.{0}
|
2014-06-16 22:50:27 +00:00
|
|
|
|
|
2014-07-25 18:24:01 +00:00
|
|
|
|
inductive false : Prop
|
2014-06-28 07:29:42 +00:00
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem false_elim (c : Prop) (H : false) : c
|
2014-06-28 20:57:36 +00:00
|
|
|
|
:= false_rec c H
|
2014-06-28 07:29:42 +00:00
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
inductive true : Prop :=
|
2014-06-28 07:29:42 +00:00
|
|
|
|
| trivial : true
|
|
|
|
|
|
2014-07-25 05:14:15 +00:00
|
|
|
|
abbreviation not (a : Prop) := a → false
|
2014-07-04 04:37:56 +00:00
|
|
|
|
prefix `¬`:40 := not
|
2014-06-28 07:29:42 +00:00
|
|
|
|
|
2014-06-30 02:30:38 +00:00
|
|
|
|
notation `assume` binders `,` r:(scoped f, f) := r
|
|
|
|
|
notation `take` binders `,` r:(scoped f, f) := r
|
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem not_intro {a : Prop} (H : a → false) : ¬a
|
2014-06-28 07:29:42 +00:00
|
|
|
|
:= H
|
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem not_elim {a : Prop} (H1 : ¬a) (H2 : a) : false
|
2014-06-28 07:29:42 +00:00
|
|
|
|
:= H1 H2
|
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem absurd {a : Prop} (H1 : a) (H2 : ¬a) : false
|
2014-06-28 07:29:42 +00:00
|
|
|
|
:= H2 H1
|
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem not_not_intro {a : Prop} (Ha : a) : ¬¬a
|
2014-07-19 19:09:47 +00:00
|
|
|
|
:= assume Hna : ¬a, absurd Ha Hna
|
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem mt {a b : Prop} (H1 : a → b) (H2 : ¬b) : ¬a
|
2014-06-30 02:30:38 +00:00
|
|
|
|
:= assume Ha : a, absurd (H1 Ha) H2
|
2014-06-28 07:29:42 +00:00
|
|
|
|
|
2014-07-25 18:36:28 +00:00
|
|
|
|
theorem contrapos {a b : Prop} (H : a → b) : ¬b → ¬a
|
2014-07-19 08:29:04 +00:00
|
|
|
|
:= assume Hnb : ¬b, mt H Hnb
|
2014-06-28 07:29:42 +00:00
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem absurd_elim {a : Prop} (b : Prop) (H1 : a) (H2 : ¬a) : b
|
2014-06-28 07:29:42 +00:00
|
|
|
|
:= false_elim b (absurd H1 H2)
|
|
|
|
|
|
2014-07-19 08:29:04 +00:00
|
|
|
|
theorem absurd_not_true (H : ¬true) : false
|
2014-07-05 05:22:26 +00:00
|
|
|
|
:= absurd trivial H
|
|
|
|
|
|
2014-07-19 08:29:04 +00:00
|
|
|
|
theorem not_false_trivial : ¬false
|
2014-07-05 05:22:26 +00:00
|
|
|
|
:= assume H : false, H
|
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem not_implies_left {a b : Prop} (H : ¬(a → b)) : ¬¬a
|
2014-07-19 08:29:04 +00:00
|
|
|
|
:= assume Hna : ¬a, absurd (assume Ha : a, absurd_elim b Ha Hna) H
|
2014-07-13 02:05:17 +00:00
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem not_implies_right {a b : Prop} (H : ¬(a → b)) : ¬b
|
2014-07-13 02:05:17 +00:00
|
|
|
|
:= assume Hb : b, absurd (assume Ha : a, Hb) H
|
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
inductive and (a b : Prop) : Prop :=
|
2014-06-28 07:29:42 +00:00
|
|
|
|
| and_intro : a → b → and a b
|
|
|
|
|
|
2014-07-01 23:55:41 +00:00
|
|
|
|
infixr `/\`:35 := and
|
|
|
|
|
infixr `∧`:35 := and
|
2014-06-28 07:29:42 +00:00
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem and_elim {a b c : Prop} (H1 : a → b → c) (H2 : a ∧ b) : c
|
2014-07-01 01:01:31 +00:00
|
|
|
|
:= and_rec H1 H2
|
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem and_elim_left {a b : Prop} (H : a ∧ b) : a
|
2014-07-19 08:29:04 +00:00
|
|
|
|
:= and_rec (λa b, a) H
|
2014-06-28 07:29:42 +00:00
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem and_elim_right {a b : Prop} (H : a ∧ b) : b
|
2014-07-19 08:29:04 +00:00
|
|
|
|
:= and_rec (λa b, b) H
|
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem and_swap {a b : Prop} (H : a ∧ b) : b ∧ a
|
2014-07-19 08:29:04 +00:00
|
|
|
|
:= and_intro (and_elim_right H) (and_elim_left H)
|
2014-06-28 07:29:42 +00:00
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem and_not_left {a : Prop} (b : Prop) (Hna : ¬a) : ¬(a ∧ b)
|
2014-07-19 19:09:47 +00:00
|
|
|
|
:= assume H : a ∧ b, absurd (and_elim_left H) Hna
|
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem and_not_right (a : Prop) {b : Prop} (Hnb : ¬b) : ¬(a ∧ b)
|
2014-07-19 19:09:47 +00:00
|
|
|
|
:= assume H : a ∧ b, absurd (and_elim_right H) Hnb
|
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
inductive or (a b : Prop) : Prop :=
|
2014-06-28 07:29:42 +00:00
|
|
|
|
| or_intro_left : a → or a b
|
|
|
|
|
| or_intro_right : b → or a b
|
|
|
|
|
|
2014-07-01 23:55:41 +00:00
|
|
|
|
infixr `\/`:30 := or
|
|
|
|
|
infixr `∨`:30 := or
|
2014-06-28 07:29:42 +00:00
|
|
|
|
|
2014-07-28 00:25:57 +00:00
|
|
|
|
theorem or_inl {a b : Prop} (Ha : a) : a ∨ b := or_intro_left b Ha
|
|
|
|
|
theorem or_inr {a b : Prop} (Hb : b) : a ∨ b := or_intro_right a Hb
|
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem or_elim {a b c : Prop} (H1 : a ∨ b) (H2 : a → c) (H3 : b → c) : c
|
2014-06-28 07:29:42 +00:00
|
|
|
|
:= or_rec H2 H3 H1
|
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem resolve_right {a b : Prop} (H1 : a ∨ b) (H2 : ¬a) : b
|
2014-07-01 01:01:31 +00:00
|
|
|
|
:= or_elim H1 (assume Ha, absurd_elim b Ha H2) (assume Hb, Hb)
|
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem resolve_left {a b : Prop} (H1 : a ∨ b) (H2 : ¬b) : a
|
2014-07-01 01:01:31 +00:00
|
|
|
|
:= or_elim H1 (assume Ha, Ha) (assume Hb, absurd_elim a Hb H2)
|
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem or_swap {a b : Prop} (H : a ∨ b) : b ∨ a
|
2014-07-28 00:25:57 +00:00
|
|
|
|
:= or_elim H (assume Ha, or_inr Ha) (assume Hb, or_inl Hb)
|
2014-07-01 01:01:31 +00:00
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem or_not_intro {a b : Prop} (Hna : ¬a) (Hnb : ¬b) : ¬(a ∨ b)
|
2014-07-19 19:09:47 +00:00
|
|
|
|
:= assume H : a ∨ b, or_elim H
|
|
|
|
|
(assume Ha, absurd_elim _ Ha Hna)
|
|
|
|
|
(assume Hb, absurd_elim _ Hb Hnb)
|
|
|
|
|
|
2014-07-24 19:29:23 +00:00
|
|
|
|
theorem or_imp_or {a b c d : Prop} (H1 : a ∨ b) (H2 : a → c) (H3 : b → d) : c ∨ d
|
|
|
|
|
:= or_elim H1
|
2014-07-28 00:25:57 +00:00
|
|
|
|
(assume Ha : a, or_inl (H2 Ha))
|
|
|
|
|
(assume Hb : b, or_inr (H3 Hb))
|
2014-07-24 19:29:23 +00:00
|
|
|
|
|
|
|
|
|
theorem imp_or_left {a b c : Prop} (H1 : a ∨ c) (H : a → b) : b ∨ c
|
|
|
|
|
:= or_elim H1
|
2014-07-28 00:25:57 +00:00
|
|
|
|
(assume H2 : a, or_inl (H H2))
|
|
|
|
|
(assume H2 : c, or_inr H2)
|
2014-07-24 19:29:23 +00:00
|
|
|
|
|
|
|
|
|
theorem imp_or_right {a b c : Prop} (H1 : c ∨ a) (H : a → b) : c ∨ b
|
|
|
|
|
:= or_elim H1
|
2014-07-28 00:25:57 +00:00
|
|
|
|
(assume H2 : c, or_inl H2)
|
|
|
|
|
(assume H2 : a, or_inr (H H2))
|
2014-07-24 19:29:23 +00:00
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
inductive eq {A : Type} (a : A) : A → Prop :=
|
2014-06-28 22:33:56 +00:00
|
|
|
|
| refl : eq a a
|
2014-06-28 07:29:42 +00:00
|
|
|
|
|
2014-07-01 23:55:41 +00:00
|
|
|
|
infix `=`:50 := eq
|
2014-06-28 07:29:42 +00:00
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem subst {A : Type} {a b : A} {P : A → Prop} (H1 : a = b) (H2 : P a) : P b
|
2014-06-28 07:29:42 +00:00
|
|
|
|
:= eq_rec H2 H1
|
|
|
|
|
|
|
|
|
|
theorem trans {A : Type} {a b c : A} (H1 : a = b) (H2 : b = c) : a = c
|
|
|
|
|
:= subst H2 H1
|
|
|
|
|
|
2014-06-30 21:35:33 +00:00
|
|
|
|
calc_subst subst
|
|
|
|
|
calc_refl refl
|
|
|
|
|
calc_trans trans
|
|
|
|
|
|
2014-07-19 08:29:04 +00:00
|
|
|
|
theorem true_ne_false : ¬true = false
|
2014-07-05 05:22:26 +00:00
|
|
|
|
:= assume H : true = false,
|
|
|
|
|
subst H trivial
|
|
|
|
|
|
2014-06-28 07:29:42 +00:00
|
|
|
|
theorem symm {A : Type} {a b : A} (H : a = b) : b = a
|
|
|
|
|
:= subst H (refl a)
|
|
|
|
|
|
2014-07-25 05:49:12 +00:00
|
|
|
|
namespace eq_proofs
|
|
|
|
|
postfix `⁻¹`:100 := symm
|
|
|
|
|
infixr `⬝`:75 := trans
|
|
|
|
|
infixr `▸`:75 := subst
|
|
|
|
|
end
|
|
|
|
|
using eq_proofs
|
|
|
|
|
|
2014-06-30 19:00:47 +00:00
|
|
|
|
theorem congr1 {A : Type} {B : A → Type} {f g : Π x, B x} (H : f = g) (a : A) : f a = g a
|
2014-07-25 05:49:12 +00:00
|
|
|
|
:= H ▸ (refl (f a))
|
2014-06-28 07:29:42 +00:00
|
|
|
|
|
2014-07-03 23:25:14 +00:00
|
|
|
|
theorem congr2 {A : Type} {B : Type} {a b : A} (f : A → B) (H : a = b) : f a = f b
|
2014-07-25 05:49:12 +00:00
|
|
|
|
:= H ▸ (refl (f a))
|
2014-06-30 02:30:38 +00:00
|
|
|
|
|
2014-07-03 23:25:14 +00:00
|
|
|
|
theorem congr {A : Type} {B : Type} {f g : A → B} {a b : A} (H1 : f = g) (H2 : a = b) : f a = g b
|
2014-07-25 05:49:12 +00:00
|
|
|
|
:= H1 ▸ H2 ▸ (refl (f a))
|
2014-07-03 16:44:36 +00:00
|
|
|
|
|
2014-07-19 08:29:04 +00:00
|
|
|
|
theorem equal_f {A : Type} {B : A → Type} {f g : Π x, B x} (H : f = g) : ∀x, f x = g x
|
2014-06-30 19:00:47 +00:00
|
|
|
|
:= take x, congr1 H x
|
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem not_congr {a b : Prop} (H : a = b) : (¬a) = (¬b)
|
2014-07-01 01:01:31 +00:00
|
|
|
|
:= congr2 not H
|
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem eqmp {a b : Prop} (H1 : a = b) (H2 : a) : b
|
2014-07-25 05:49:12 +00:00
|
|
|
|
:= H1 ▸ H2
|
2014-07-01 01:01:31 +00:00
|
|
|
|
|
2014-07-01 23:55:41 +00:00
|
|
|
|
infixl `<|`:100 := eqmp
|
|
|
|
|
infixl `◂`:100 := eqmp
|
2014-07-01 01:01:31 +00:00
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem eqmpr {a b : Prop} (H1 : a = b) (H2 : b) : a
|
2014-07-25 05:49:12 +00:00
|
|
|
|
:= H1⁻¹ ◂ H2
|
2014-07-01 01:01:31 +00:00
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem eqt_elim {a : Prop} (H : a = true) : a
|
2014-07-25 05:49:12 +00:00
|
|
|
|
:= H⁻¹ ◂ trivial
|
2014-07-01 01:01:31 +00:00
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem eqf_elim {a : Prop} (H : a = false) : ¬a
|
2014-07-25 05:14:15 +00:00
|
|
|
|
:= assume Ha : a, H ◂ Ha
|
2014-07-01 01:01:31 +00:00
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem imp_trans {a b c : Prop} (H1 : a → b) (H2 : b → c) : a → c
|
2014-07-01 01:01:31 +00:00
|
|
|
|
:= assume Ha, H2 (H1 Ha)
|
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem imp_eq_trans {a b c : Prop} (H1 : a → b) (H2 : b = c) : a → c
|
2014-07-01 01:01:31 +00:00
|
|
|
|
:= assume Ha, H2 ◂ (H1 Ha)
|
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem eq_imp_trans {a b c : Prop} (H1 : a = b) (H2 : b → c) : a → c
|
2014-07-01 01:01:31 +00:00
|
|
|
|
:= assume Ha, H2 (H1 ◂ Ha)
|
|
|
|
|
|
2014-07-24 19:01:09 +00:00
|
|
|
|
definition ne [inline] {A : Type} (a b : A) := ¬(a = b)
|
2014-07-01 23:55:41 +00:00
|
|
|
|
infix `≠`:50 := ne
|
2014-07-01 01:01:31 +00:00
|
|
|
|
|
|
|
|
|
theorem ne_intro {A : Type} {a b : A} (H : a = b → false) : a ≠ b
|
|
|
|
|
:= H
|
|
|
|
|
|
|
|
|
|
theorem ne_elim {A : Type} {a b : A} (H1 : a ≠ b) (H2 : a = b) : false
|
|
|
|
|
:= H1 H2
|
|
|
|
|
|
2014-07-05 05:22:26 +00:00
|
|
|
|
theorem a_neq_a_elim {A : Type} {a : A} (H : a ≠ a) : false
|
|
|
|
|
:= H (refl a)
|
|
|
|
|
|
2014-07-01 01:01:31 +00:00
|
|
|
|
theorem ne_irrefl {A : Type} {a : A} (H : a ≠ a) : false
|
|
|
|
|
:= H (refl a)
|
|
|
|
|
|
2014-07-19 19:09:47 +00:00
|
|
|
|
theorem ne_symm {A : Type} {a b : A} (H : a ≠ b) : b ≠ a
|
2014-07-25 18:36:28 +00:00
|
|
|
|
:= assume H1 : b = a, H (H1⁻¹)
|
2014-07-19 19:09:47 +00:00
|
|
|
|
|
2014-07-01 01:01:31 +00:00
|
|
|
|
theorem eq_ne_trans {A : Type} {a b c : A} (H1 : a = b) (H2 : b ≠ c) : a ≠ c
|
2014-07-25 05:49:12 +00:00
|
|
|
|
:= H1⁻¹ ▸ H2
|
2014-07-01 01:01:31 +00:00
|
|
|
|
|
|
|
|
|
theorem ne_eq_trans {A : Type} {a b c : A} (H1 : a ≠ b) (H2 : b = c) : a ≠ c
|
2014-07-25 05:49:12 +00:00
|
|
|
|
:= H2 ▸ H1
|
2014-07-01 01:01:31 +00:00
|
|
|
|
|
|
|
|
|
calc_trans eq_ne_trans
|
|
|
|
|
calc_trans ne_eq_trans
|
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
definition iff (a b : Prop) := (a → b) ∧ (b → a)
|
2014-07-28 15:48:26 +00:00
|
|
|
|
infix `<->`:25 := iff
|
2014-07-19 08:29:04 +00:00
|
|
|
|
infix `↔`:25 := iff
|
2014-06-30 05:56:38 +00:00
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem iff_intro {a b : Prop} (H1 : a → b) (H2 : b → a) : a ↔ b
|
2014-06-30 05:56:38 +00:00
|
|
|
|
:= and_intro H1 H2
|
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem iff_elim {a b c : Prop} (H1 : (a → b) → (b → a) → c) (H2 : a ↔ b) : c
|
2014-06-30 05:56:38 +00:00
|
|
|
|
:= and_rec H1 H2
|
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem iff_elim_left {a b : Prop} (H : a ↔ b) : a → b
|
2014-06-30 05:56:38 +00:00
|
|
|
|
:= iff_elim (assume H1 H2, H1) H
|
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem iff_elim_right {a b : Prop} (H : a ↔ b) : b → a
|
2014-06-30 05:56:38 +00:00
|
|
|
|
:= iff_elim (assume H1 H2, H2) H
|
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem iff_mp_left {a b : Prop} (H1 : a ↔ b) (H2 : a) : b
|
2014-06-30 07:29:42 +00:00
|
|
|
|
:= (iff_elim_left H1) H2
|
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem iff_mp_right {a b : Prop} (H1 : a ↔ b) (H2 : b) : a
|
2014-06-30 07:29:42 +00:00
|
|
|
|
:= (iff_elim_right H1) H2
|
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem iff_flip_sign {a b : Prop} (H1 : a ↔ b) : ¬a ↔ ¬b
|
2014-07-19 19:09:47 +00:00
|
|
|
|
:= iff_intro
|
|
|
|
|
(assume Hna, mt (iff_elim_right H1) Hna)
|
|
|
|
|
(assume Hnb, mt (iff_elim_left H1) Hnb)
|
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem iff_refl (a : Prop) : a ↔ a
|
2014-07-21 04:10:30 +00:00
|
|
|
|
:= iff_intro (assume H, H) (assume H, H)
|
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem iff_trans {a b c : Prop} (H1 : a ↔ b) (H2 : b ↔ c) : a ↔ c
|
2014-07-21 04:10:30 +00:00
|
|
|
|
:= iff_intro
|
|
|
|
|
(assume Ha, iff_mp_left H2 (iff_mp_left H1 Ha))
|
|
|
|
|
(assume Hc, iff_mp_right H1 (iff_mp_right H2 Hc))
|
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem iff_symm {a b : Prop} (H : a ↔ b) : b ↔ a
|
2014-07-21 04:10:30 +00:00
|
|
|
|
:= iff_intro
|
|
|
|
|
(assume Hb, iff_mp_right H Hb)
|
|
|
|
|
(assume Ha, iff_mp_left H Ha)
|
|
|
|
|
|
|
|
|
|
calc_trans iff_trans
|
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem eq_to_iff {a b : Prop} (H : a = b) : a ↔ b
|
2014-07-25 05:49:12 +00:00
|
|
|
|
:= iff_intro (λ Ha, H ▸ Ha) (λ Hb, H⁻¹ ▸ Hb)
|
2014-07-05 05:22:26 +00:00
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem and_comm (a b : Prop) : a ∧ b ↔ b ∧ a
|
2014-07-19 08:29:04 +00:00
|
|
|
|
:= iff_intro (λH, and_swap H) (λH, and_swap H)
|
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem and_assoc (a b c : Prop) : (a ∧ b) ∧ c ↔ a ∧ (b ∧ c)
|
2014-07-19 08:29:04 +00:00
|
|
|
|
:= iff_intro
|
|
|
|
|
(assume H, and_intro
|
|
|
|
|
(and_elim_left (and_elim_left H))
|
|
|
|
|
(and_intro (and_elim_right (and_elim_left H)) (and_elim_right H)))
|
|
|
|
|
(assume H, and_intro
|
|
|
|
|
(and_intro (and_elim_left H) (and_elim_left (and_elim_right H)))
|
|
|
|
|
(and_elim_right (and_elim_right H)))
|
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem or_comm (a b : Prop) : a ∨ b ↔ b ∨ a
|
2014-07-19 08:29:04 +00:00
|
|
|
|
:= iff_intro (λH, or_swap H) (λH, or_swap H)
|
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem or_assoc (a b c : Prop) : (a ∨ b) ∨ c ↔ a ∨ (b ∨ c)
|
2014-07-19 08:29:04 +00:00
|
|
|
|
:= iff_intro
|
|
|
|
|
(assume H, or_elim H
|
|
|
|
|
(assume H1, or_elim H1
|
2014-07-28 00:25:57 +00:00
|
|
|
|
(assume Ha, or_inl Ha)
|
|
|
|
|
(assume Hb, or_inr (or_inl Hb)))
|
|
|
|
|
(assume Hc, or_inr (or_inr Hc)))
|
2014-07-19 08:29:04 +00:00
|
|
|
|
(assume H, or_elim H
|
2014-07-28 00:25:57 +00:00
|
|
|
|
(assume Ha, (or_inl (or_inl Ha)))
|
2014-07-19 08:29:04 +00:00
|
|
|
|
(assume H1, or_elim H1
|
2014-07-28 00:25:57 +00:00
|
|
|
|
(assume Hb, or_inl (or_inr Hb))
|
|
|
|
|
(assume Hc, or_inr Hc)))
|
2014-07-19 08:29:04 +00:00
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
inductive Exists {A : Type} (P : A → Prop) : Prop :=
|
2014-06-30 02:30:38 +00:00
|
|
|
|
| exists_intro : ∀ (a : A), P a → Exists P
|
|
|
|
|
|
2014-07-28 15:48:26 +00:00
|
|
|
|
notation `exists` binders `,` r:(scoped P, Exists P) := r
|
2014-06-30 02:30:38 +00:00
|
|
|
|
notation `∃` binders `,` r:(scoped P, Exists P) := r
|
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem exists_elim {A : Type} {p : A → Prop} {B : Prop} (H1 : ∃x, p x) (H2 : ∀ (a : A) (H : p a), B) : B
|
2014-06-30 02:30:38 +00:00
|
|
|
|
:= Exists_rec H2 H1
|
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem exists_not_forall {A : Type} {p : A → Prop} (H : ∃x, p x) : ¬∀x, ¬p x
|
2014-07-19 08:29:04 +00:00
|
|
|
|
:= assume H1 : ∀x, ¬p x,
|
|
|
|
|
obtain (w : A) (Hw : p w), from H,
|
2014-07-13 01:48:00 +00:00
|
|
|
|
absurd Hw (H1 w)
|
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem forall_not_exists {A : Type} {p : A → Prop} (H2 : ∀x, p x) : ¬∃x, ¬p x
|
2014-07-19 08:29:04 +00:00
|
|
|
|
:= assume H1 : ∃x, ¬p x,
|
|
|
|
|
obtain (w : A) (Hw : ¬p w), from H1,
|
2014-07-13 01:48:00 +00:00
|
|
|
|
absurd (H2 w) Hw
|
|
|
|
|
|
2014-07-25 18:36:28 +00:00
|
|
|
|
definition exists_unique {A : Type} (p : A → Prop) := ∃x, p x ∧ ∀y, y ≠ x → ¬p y
|
2014-07-01 01:22:28 +00:00
|
|
|
|
|
|
|
|
|
notation `∃!` binders `,` r:(scoped P, exists_unique P) := r
|
|
|
|
|
|
2014-07-25 18:36:28 +00:00
|
|
|
|
theorem exists_unique_intro {A : Type} {p : A → Prop} (w : A) (H1 : p w) (H2 : ∀y, y ≠ w → ¬p y) : ∃!x, p x
|
2014-07-01 01:22:28 +00:00
|
|
|
|
:= exists_intro w (and_intro H1 H2)
|
|
|
|
|
|
2014-07-25 18:36:28 +00:00
|
|
|
|
theorem exists_unique_elim {A : Type} {p : A → Prop} {b : Prop} (H2 : ∃!x, p x) (H1 : ∀x, p x → (∀y, y ≠ x → ¬p y) → b) : b
|
2014-07-12 05:35:24 +00:00
|
|
|
|
:= obtain w Hw, from H2,
|
2014-07-19 08:29:04 +00:00
|
|
|
|
H1 w (and_elim_left Hw) (and_elim_right Hw)
|
2014-07-01 01:22:28 +00:00
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
inductive inhabited (A : Type) : Prop :=
|
2014-07-03 22:05:19 +00:00
|
|
|
|
| inhabited_intro : A → inhabited A
|
2014-06-30 02:30:38 +00:00
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem inhabited_elim {A : Type} {B : Prop} (H1 : inhabited A) (H2 : A → B) : B
|
2014-07-03 22:05:19 +00:00
|
|
|
|
:= inhabited_rec H2 H1
|
2014-06-30 02:30:38 +00:00
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem inhabited_Prop [instance] : inhabited Prop
|
2014-06-30 02:30:38 +00:00
|
|
|
|
:= inhabited_intro true
|
|
|
|
|
|
2014-07-04 21:25:44 +00:00
|
|
|
|
theorem inhabited_fun [instance] (A : Type) {B : Type} (H : inhabited B) : inhabited (A → B)
|
2014-07-19 08:29:04 +00:00
|
|
|
|
:= inhabited_elim H (take b, inhabited_intro (λa, b))
|
2014-07-12 23:24:58 +00:00
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
|
theorem inhabited_exists {A : Type} {p : A → Prop} (H : ∃x, p x) : inhabited A
|
2014-07-12 23:24:58 +00:00
|
|
|
|
:= obtain w Hw, from H, inhabited_intro w
|