2014-12-15 20:05:44 +00:00
|
|
|
|
/-
|
|
|
|
|
Copyright (c) 2014 Microsoft Corporation. All rights reserved.
|
|
|
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
2015-06-04 03:41:52 +00:00
|
|
|
|
Authors: Jeremy Avigad, Leonardo de Moura, Haitao Zhang
|
2014-12-15 20:05:44 +00:00
|
|
|
|
|
2014-12-15 21:13:04 +00:00
|
|
|
|
The propositional connectives. See also init.datatypes and init.logic.
|
2014-12-15 20:05:44 +00:00
|
|
|
|
-/
|
2015-05-08 01:26:17 +00:00
|
|
|
|
open eq.ops
|
2014-12-12 21:20:27 +00:00
|
|
|
|
|
|
|
|
|
variables {a b c d : Prop}
|
|
|
|
|
|
2015-04-05 16:15:21 +00:00
|
|
|
|
/- false -/
|
|
|
|
|
|
|
|
|
|
theorem false.elim {c : Prop} (H : false) : c :=
|
|
|
|
|
false.rec c H
|
|
|
|
|
|
2014-12-15 20:05:44 +00:00
|
|
|
|
/- implies -/
|
|
|
|
|
|
|
|
|
|
definition imp (a b : Prop) : Prop := a → b
|
|
|
|
|
|
2014-12-12 21:20:27 +00:00
|
|
|
|
theorem mt (H1 : a → b) (H2 : ¬b) : ¬a :=
|
|
|
|
|
assume Ha : a, absurd (H1 Ha) H2
|
|
|
|
|
|
2015-07-24 15:56:18 +00:00
|
|
|
|
theorem imp.id (H : a) : a := H
|
|
|
|
|
|
|
|
|
|
theorem imp.intro (H : a) (H₂ : b) : a := H
|
|
|
|
|
|
|
|
|
|
theorem imp.mp (H : a) (H₂ : a → b) : b :=
|
|
|
|
|
H₂ H
|
|
|
|
|
|
|
|
|
|
theorem imp.syl (H : a → b) (H₂ : c → a) (Hc : c) : b :=
|
|
|
|
|
H (H₂ Hc)
|
|
|
|
|
|
|
|
|
|
theorem imp.left (H : a → b) (H₂ : b → c) (Ha : a) : c :=
|
|
|
|
|
H₂ (H Ha)
|
|
|
|
|
|
2015-04-05 16:15:21 +00:00
|
|
|
|
theorem imp_true (a : Prop) : (a → true) ↔ true :=
|
2015-07-24 15:56:18 +00:00
|
|
|
|
iff_true_intro (imp.intro trivial)
|
2014-12-15 20:05:44 +00:00
|
|
|
|
|
2015-04-05 16:15:21 +00:00
|
|
|
|
theorem true_imp (a : Prop) : (true → a) ↔ a :=
|
2015-07-24 15:56:18 +00:00
|
|
|
|
iff.intro (assume H, H trivial) imp.intro
|
2015-04-05 16:15:21 +00:00
|
|
|
|
|
|
|
|
|
theorem imp_false (a : Prop) : (a → false) ↔ ¬ a := iff.rfl
|
|
|
|
|
|
|
|
|
|
theorem false_imp (a : Prop) : (false → a) ↔ true :=
|
2015-07-24 15:56:18 +00:00
|
|
|
|
iff_true_intro false.elim
|
2014-12-12 21:20:27 +00:00
|
|
|
|
|
2015-06-04 23:57:56 +00:00
|
|
|
|
theorem imp_iff_imp (H1 : a ↔ c) (H2 : b ↔ d) : (a → b) ↔ (c → d) :=
|
|
|
|
|
iff.intro
|
2015-07-24 15:56:18 +00:00
|
|
|
|
(λHab Hc, iff.mp H2 (Hab (iff.mpr H1 Hc)))
|
|
|
|
|
(λHcd Ha, iff.mpr H2 (Hcd (iff.mp H1 Ha)))
|
2015-06-04 23:57:56 +00:00
|
|
|
|
|
2014-12-15 20:05:44 +00:00
|
|
|
|
/- not -/
|
2014-12-12 21:20:27 +00:00
|
|
|
|
|
2015-07-24 15:56:18 +00:00
|
|
|
|
theorem not.elim {A : Type} (H1 : ¬a) (H2 : a) : A := absurd H2 H1
|
2014-12-12 21:20:27 +00:00
|
|
|
|
|
2014-12-15 20:05:44 +00:00
|
|
|
|
theorem not.intro (H : a → false) : ¬a := H
|
2014-12-12 21:20:27 +00:00
|
|
|
|
|
|
|
|
|
theorem not_not_intro (Ha : a) : ¬¬a :=
|
2015-07-24 15:56:18 +00:00
|
|
|
|
assume Hna : ¬a, Hna Ha
|
|
|
|
|
|
|
|
|
|
theorem not.mto {a b : Prop} : (a → b) → ¬b → ¬a := imp.left
|
2014-12-12 21:20:27 +00:00
|
|
|
|
|
2015-07-24 15:56:18 +00:00
|
|
|
|
theorem not_imp_not_of_imp {a b : Prop} : (a → b) → ¬b → ¬a := not.mto
|
2015-06-04 03:41:52 +00:00
|
|
|
|
|
2015-07-24 15:56:18 +00:00
|
|
|
|
theorem not_not_of_not_implies : ¬(a → b) → ¬¬a :=
|
|
|
|
|
not.mto not.elim
|
2014-12-12 21:20:27 +00:00
|
|
|
|
|
2015-07-24 15:56:18 +00:00
|
|
|
|
theorem not_of_not_implies : ¬(a → b) → ¬b :=
|
|
|
|
|
not.mto imp.intro
|
2014-12-12 21:20:27 +00:00
|
|
|
|
|
|
|
|
|
theorem not_not_em : ¬¬(a ∨ ¬a) :=
|
|
|
|
|
assume not_em : ¬(a ∨ ¬a),
|
2015-07-24 15:56:18 +00:00
|
|
|
|
not_em (or.inr (not.mto or.inl not_em))
|
2014-12-15 20:05:44 +00:00
|
|
|
|
|
2015-07-22 16:01:42 +00:00
|
|
|
|
theorem not_true [simp] : ¬ true ↔ false :=
|
2015-07-24 15:56:18 +00:00
|
|
|
|
iff_false_intro (not_not_intro trivial)
|
2015-04-05 16:15:21 +00:00
|
|
|
|
|
2015-07-22 16:01:42 +00:00
|
|
|
|
theorem not_false_iff [simp] : ¬ false ↔ true :=
|
2015-07-24 15:56:18 +00:00
|
|
|
|
iff_true_intro not_false
|
2015-04-05 16:15:21 +00:00
|
|
|
|
|
2015-06-04 23:57:56 +00:00
|
|
|
|
theorem not_iff_not (H : a ↔ b) : ¬a ↔ ¬b :=
|
2015-07-24 15:56:18 +00:00
|
|
|
|
iff.intro (not.mto (iff.mpr H)) (not.mto (iff.mp H))
|
2015-06-04 23:57:56 +00:00
|
|
|
|
|
|
|
|
|
|
2014-12-15 20:05:44 +00:00
|
|
|
|
/- and -/
|
|
|
|
|
|
2015-07-24 15:56:18 +00:00
|
|
|
|
definition not_and_of_not_left (b : Prop) : ¬a → ¬(a ∧ b) :=
|
|
|
|
|
not.mto and.left
|
|
|
|
|
|
|
|
|
|
definition not_and_of_not_right (a : Prop) {b : Prop} : ¬b → ¬(a ∧ b) :=
|
|
|
|
|
not.mto and.right
|
|
|
|
|
|
|
|
|
|
theorem and.swap : a ∧ b → b ∧ a :=
|
|
|
|
|
and.rec (λHa Hb, and.intro Hb Ha)
|
2014-12-15 20:05:44 +00:00
|
|
|
|
|
2015-07-24 15:56:18 +00:00
|
|
|
|
theorem and.imp (H₂ : a → c) (H₃ : b → d) : a ∧ b → c ∧ d :=
|
|
|
|
|
and.rec (λHa Hb, and.intro (H₂ Ha) (H₃ Hb))
|
2014-12-15 20:05:44 +00:00
|
|
|
|
|
2015-07-24 15:56:18 +00:00
|
|
|
|
theorem and.imp_left (H : a → b) : a ∧ c → b ∧ c :=
|
|
|
|
|
and.imp H imp.id
|
|
|
|
|
|
|
|
|
|
theorem and.imp_right (H : a → b) : c ∧ a → c ∧ b :=
|
|
|
|
|
and.imp imp.id H
|
2014-12-15 20:05:44 +00:00
|
|
|
|
|
|
|
|
|
theorem and_of_and_of_imp_of_imp (H₁ : a ∧ b) (H₂ : a → c) (H₃ : b → d) : c ∧ d :=
|
2015-07-24 15:56:18 +00:00
|
|
|
|
and.imp H₂ H₃ H₁
|
2014-12-15 20:05:44 +00:00
|
|
|
|
|
|
|
|
|
theorem and_of_and_of_imp_left (H₁ : a ∧ c) (H : a → b) : b ∧ c :=
|
2015-07-24 15:56:18 +00:00
|
|
|
|
and.imp_left H H₁
|
2014-12-15 20:05:44 +00:00
|
|
|
|
|
|
|
|
|
theorem and_of_and_of_imp_right (H₁ : c ∧ a) (H : a → b) : c ∧ b :=
|
2015-07-24 15:56:18 +00:00
|
|
|
|
and.imp_right H H₁
|
2014-12-15 20:05:44 +00:00
|
|
|
|
|
2015-07-23 00:21:47 +00:00
|
|
|
|
theorem and.comm [simp] : a ∧ b ↔ b ∧ a :=
|
2015-07-24 15:56:18 +00:00
|
|
|
|
iff.intro and.swap and.swap
|
2014-12-15 20:05:44 +00:00
|
|
|
|
|
2015-07-23 00:21:47 +00:00
|
|
|
|
theorem and.assoc [simp] : (a ∧ b) ∧ c ↔ a ∧ (b ∧ c) :=
|
2014-12-15 20:05:44 +00:00
|
|
|
|
iff.intro
|
2015-05-06 01:26:12 +00:00
|
|
|
|
(assume H,
|
|
|
|
|
obtain [Ha Hb] Hc, from H,
|
|
|
|
|
and.intro Ha (and.intro Hb Hc))
|
|
|
|
|
(assume H,
|
|
|
|
|
obtain Ha Hb Hc, from H,
|
|
|
|
|
and.intro (and.intro Ha Hb) Hc)
|
2014-12-15 20:05:44 +00:00
|
|
|
|
|
2015-07-24 15:56:18 +00:00
|
|
|
|
theorem and_iff_right {a b : Prop} (Ha : a) : (a ∧ b) ↔ b :=
|
|
|
|
|
iff.intro and.right (and.intro Ha)
|
|
|
|
|
|
|
|
|
|
theorem and_iff_left {a b : Prop} (Hb : b) : (a ∧ b) ↔ a :=
|
|
|
|
|
iff.intro and.left (λHa, and.intro Ha Hb)
|
|
|
|
|
|
2015-07-22 16:01:42 +00:00
|
|
|
|
theorem and_true [simp] (a : Prop) : a ∧ true ↔ a :=
|
2015-07-24 15:56:18 +00:00
|
|
|
|
and_iff_left trivial
|
2015-04-05 16:15:21 +00:00
|
|
|
|
|
2015-07-22 16:01:42 +00:00
|
|
|
|
theorem true_and [simp] (a : Prop) : true ∧ a ↔ a :=
|
2015-07-24 15:56:18 +00:00
|
|
|
|
and_iff_right trivial
|
2015-04-05 16:15:21 +00:00
|
|
|
|
|
2015-07-22 16:01:42 +00:00
|
|
|
|
theorem and_false [simp] (a : Prop) : a ∧ false ↔ false :=
|
2015-07-24 15:56:18 +00:00
|
|
|
|
iff_false_intro and.right
|
2015-04-05 16:15:21 +00:00
|
|
|
|
|
2015-07-22 16:01:42 +00:00
|
|
|
|
theorem false_and [simp] (a : Prop) : false ∧ a ↔ false :=
|
2015-07-24 15:56:18 +00:00
|
|
|
|
iff_false_intro and.left
|
2015-04-05 16:15:21 +00:00
|
|
|
|
|
2015-07-22 16:01:42 +00:00
|
|
|
|
theorem and_self [simp] (a : Prop) : a ∧ a ↔ a :=
|
2015-07-24 15:56:18 +00:00
|
|
|
|
iff.intro and.left (assume H, and.intro H H)
|
2015-06-04 03:41:52 +00:00
|
|
|
|
|
2015-07-24 15:56:18 +00:00
|
|
|
|
theorem and_imp_iff (a b c : Prop) : (a ∧ b → c) ↔ (a → b → c) :=
|
|
|
|
|
iff.intro (λH a b, H (and.intro a b)) and.rec
|
2015-06-04 03:41:52 +00:00
|
|
|
|
|
2015-07-24 15:56:18 +00:00
|
|
|
|
theorem and_imp_eq (a b c : Prop) : (a ∧ b → c) = (a → b → c) :=
|
|
|
|
|
propext !and_imp_iff
|
2015-06-04 03:41:52 +00:00
|
|
|
|
|
2015-06-04 23:57:56 +00:00
|
|
|
|
theorem and_iff_and (H1 : a ↔ c) (H2 : b ↔ d) : (a ∧ b) ↔ (c ∧ d) :=
|
2015-07-24 15:56:18 +00:00
|
|
|
|
iff.intro (and.imp (iff.mp H1) (iff.mp H2)) (and.imp (iff.mpr H1) (iff.mpr H2))
|
2015-06-04 23:57:56 +00:00
|
|
|
|
|
2014-12-15 20:05:44 +00:00
|
|
|
|
/- or -/
|
|
|
|
|
|
2015-07-24 15:56:18 +00:00
|
|
|
|
definition not_or : ¬a → ¬b → ¬(a ∨ b) := or.rec
|
|
|
|
|
|
|
|
|
|
theorem or.imp (H₂ : a → c) (H₃ : b → d) : a ∨ b → c ∨ d :=
|
|
|
|
|
or.rec (imp.syl or.inl H₂) (imp.syl or.inr H₃)
|
|
|
|
|
|
|
|
|
|
theorem or.imp_left (H : a → b) : a ∨ c → b ∨ c :=
|
|
|
|
|
or.imp H imp.id
|
|
|
|
|
|
|
|
|
|
theorem or.imp_right (H : a → b) : c ∨ a → c ∨ b :=
|
|
|
|
|
or.imp imp.id H
|
2014-12-15 20:05:44 +00:00
|
|
|
|
|
|
|
|
|
theorem or_of_or_of_imp_of_imp (H₁ : a ∨ b) (H₂ : a → c) (H₃ : b → d) : c ∨ d :=
|
2015-07-24 15:56:18 +00:00
|
|
|
|
or.imp H₂ H₃ H₁
|
2014-12-15 20:05:44 +00:00
|
|
|
|
|
|
|
|
|
theorem or_of_or_of_imp_left (H₁ : a ∨ c) (H : a → b) : b ∨ c :=
|
2015-07-24 15:56:18 +00:00
|
|
|
|
or.imp_left H H₁
|
2014-12-15 20:05:44 +00:00
|
|
|
|
|
|
|
|
|
theorem or_of_or_of_imp_right (H₁ : c ∨ a) (H : a → b) : c ∨ b :=
|
2015-07-24 15:56:18 +00:00
|
|
|
|
or.imp_right H H₁
|
2014-12-15 20:05:44 +00:00
|
|
|
|
|
|
|
|
|
theorem or.elim3 (H : a ∨ b ∨ c) (Ha : a → d) (Hb : b → d) (Hc : c → d) : d :=
|
|
|
|
|
or.elim H Ha (assume H₂, or.elim H₂ Hb Hc)
|
|
|
|
|
|
2015-07-24 15:56:18 +00:00
|
|
|
|
theorem or.swap : a ∨ b → b ∨ a := or.rec or.inr or.inl
|
2014-12-15 20:05:44 +00:00
|
|
|
|
|
2015-07-24 15:56:18 +00:00
|
|
|
|
theorem or_resolve_right (H₁ : a ∨ b) (H₂ : ¬a) : b :=
|
|
|
|
|
or.elim H₁ (not.elim H₂) imp.id
|
2014-12-15 20:05:44 +00:00
|
|
|
|
|
2015-07-24 15:56:18 +00:00
|
|
|
|
theorem or_resolve_left (H₁ : a ∨ b) : ¬b → a :=
|
|
|
|
|
or_resolve_right (or.swap H₁)
|
2014-12-15 20:05:44 +00:00
|
|
|
|
|
2015-07-24 15:56:18 +00:00
|
|
|
|
theorem or.comm [simp] : a ∨ b ↔ b ∨ a := iff.intro or.swap or.swap
|
2014-12-15 20:05:44 +00:00
|
|
|
|
|
2015-07-23 00:21:47 +00:00
|
|
|
|
theorem or.assoc [simp] : (a ∨ b) ∨ c ↔ a ∨ (b ∨ c) :=
|
2014-12-15 20:05:44 +00:00
|
|
|
|
iff.intro
|
2015-07-24 15:56:18 +00:00
|
|
|
|
(or.rec (or.imp_right or.inl) (imp.syl or.inr or.inr))
|
|
|
|
|
(or.rec (imp.syl or.inl or.inl) (or.imp_left or.inr))
|
|
|
|
|
|
|
|
|
|
theorem or.imp_distrib : ((a ∨ b) → c) ↔ ((a → c) ∧ (b → c)) :=
|
|
|
|
|
iff.intro
|
|
|
|
|
(λH, and.intro (imp.syl H or.inl) (imp.syl H or.inr))
|
|
|
|
|
(and.rec or.rec)
|
|
|
|
|
|
|
|
|
|
theorem or_iff_right_of_imp {a b : Prop} (Ha : a → b) : (a ∨ b) ↔ b :=
|
|
|
|
|
iff.intro (or.rec Ha imp.id) or.inr
|
|
|
|
|
|
|
|
|
|
theorem or_iff_left_of_imp {a b : Prop} (Hb : b → a) : (a ∨ b) ↔ a :=
|
|
|
|
|
iff.intro (or.rec imp.id Hb) or.inl
|
2014-12-15 20:05:44 +00:00
|
|
|
|
|
2015-07-22 16:01:42 +00:00
|
|
|
|
theorem or_true [simp] (a : Prop) : a ∨ true ↔ true :=
|
2015-07-24 15:56:18 +00:00
|
|
|
|
iff_true_intro (or.inr trivial)
|
2015-04-05 16:15:21 +00:00
|
|
|
|
|
2015-07-22 16:01:42 +00:00
|
|
|
|
theorem true_or [simp] (a : Prop) : true ∨ a ↔ true :=
|
2015-07-24 15:56:18 +00:00
|
|
|
|
iff_true_intro (or.inl trivial)
|
2015-04-05 16:15:21 +00:00
|
|
|
|
|
2015-07-22 16:01:42 +00:00
|
|
|
|
theorem or_false [simp] (a : Prop) : a ∨ false ↔ a :=
|
2015-07-24 15:56:18 +00:00
|
|
|
|
iff.intro (or.rec imp.id false.elim) or.inl
|
2015-04-05 16:15:21 +00:00
|
|
|
|
|
2015-07-22 16:01:42 +00:00
|
|
|
|
theorem false_or [simp] (a : Prop) : false ∨ a ↔ a :=
|
2015-07-24 15:56:18 +00:00
|
|
|
|
iff.trans or.comm !or_false
|
2015-04-05 16:15:21 +00:00
|
|
|
|
|
|
|
|
|
theorem or_self (a : Prop) : a ∨ a ↔ a :=
|
2015-07-24 15:56:18 +00:00
|
|
|
|
iff.intro (or.rec imp.id imp.id) or.inl
|
2015-04-05 16:15:21 +00:00
|
|
|
|
|
2015-06-04 23:57:56 +00:00
|
|
|
|
theorem or_iff_or (H1 : a ↔ c) (H2 : b ↔ d) : (a ∨ b) ↔ (c ∨ d) :=
|
2015-07-24 15:56:18 +00:00
|
|
|
|
iff.intro (or.imp (iff.mp H1) (iff.mp H2)) (or.imp (iff.mpr H1) (iff.mpr H2))
|
2015-06-04 23:57:56 +00:00
|
|
|
|
|
2015-05-08 01:26:17 +00:00
|
|
|
|
/- distributivity -/
|
|
|
|
|
|
|
|
|
|
theorem and.distrib_left (a b c : Prop) : a ∧ (b ∨ c) ↔ (a ∧ b) ∨ (a ∧ c) :=
|
|
|
|
|
iff.intro
|
2015-07-24 15:56:18 +00:00
|
|
|
|
(and.rec (λH, or.imp (and.intro H) (and.intro H)))
|
|
|
|
|
(or.rec (and.imp_right or.inl) (and.imp_right or.inr))
|
2015-05-08 01:26:17 +00:00
|
|
|
|
|
|
|
|
|
theorem and.distrib_right (a b c : Prop) : (a ∨ b) ∧ c ↔ (a ∧ c) ∨ (b ∧ c) :=
|
2015-07-24 15:56:18 +00:00
|
|
|
|
iff.trans (iff.trans !and.comm !and.distrib_left) (or_iff_or !and.comm !and.comm)
|
2015-05-08 01:26:17 +00:00
|
|
|
|
|
|
|
|
|
theorem or.distrib_left (a b c : Prop) : a ∨ (b ∧ c) ↔ (a ∨ b) ∧ (a ∨ c) :=
|
|
|
|
|
iff.intro
|
2015-07-24 15:56:18 +00:00
|
|
|
|
(or.rec (λH, and.intro (or.inl H) (or.inl H)) (and.imp or.inr or.inr))
|
|
|
|
|
(and.rec (or.rec (imp.syl imp.intro or.inl) (imp.syl or.imp_right and.intro)))
|
2015-05-08 01:26:17 +00:00
|
|
|
|
|
|
|
|
|
theorem or.distrib_right (a b c : Prop) : (a ∧ b) ∨ c ↔ (a ∨ c) ∧ (b ∨ c) :=
|
2015-07-24 15:56:18 +00:00
|
|
|
|
iff.trans (iff.trans !or.comm !or.distrib_left) (and_iff_and !or.comm !or.comm)
|
2015-05-08 01:26:17 +00:00
|
|
|
|
|
2014-12-15 20:05:44 +00:00
|
|
|
|
/- iff -/
|
|
|
|
|
|
2015-07-24 15:56:18 +00:00
|
|
|
|
definition iff.def : (a ↔ b) = ((a → b) ∧ (b → a)) := rfl
|
2014-12-15 20:05:44 +00:00
|
|
|
|
|
2015-07-22 16:01:42 +00:00
|
|
|
|
theorem iff_true [simp] (a : Prop) : (a ↔ true) ↔ a :=
|
2015-07-24 15:56:18 +00:00
|
|
|
|
iff.intro (assume H, iff.mpr H trivial) iff_true_intro
|
2014-12-12 21:20:27 +00:00
|
|
|
|
|
2015-07-22 16:01:42 +00:00
|
|
|
|
theorem true_iff [simp] (a : Prop) : (true ↔ a) ↔ a :=
|
2015-07-24 15:56:18 +00:00
|
|
|
|
iff.trans iff.comm !iff_true
|
2014-12-12 21:20:27 +00:00
|
|
|
|
|
2015-07-22 16:01:42 +00:00
|
|
|
|
theorem iff_false [simp] (a : Prop) : (a ↔ false) ↔ ¬ a :=
|
2015-07-24 15:56:18 +00:00
|
|
|
|
iff.intro and.left iff_false_intro
|
2015-04-05 16:15:21 +00:00
|
|
|
|
|
2015-07-22 16:01:42 +00:00
|
|
|
|
theorem false_iff [simp] (a : Prop) : (false ↔ a) ↔ ¬ a :=
|
2015-07-24 15:56:18 +00:00
|
|
|
|
iff.trans iff.comm !iff_false
|
2014-12-12 21:20:27 +00:00
|
|
|
|
|
2015-07-22 16:01:42 +00:00
|
|
|
|
theorem iff_self [simp] (a : Prop) : (a ↔ a) ↔ true :=
|
2015-07-24 15:56:18 +00:00
|
|
|
|
iff_true_intro iff.rfl
|
|
|
|
|
|
|
|
|
|
theorem forall_imp_forall {A : Type} {P Q : A → Prop} (H : ∀a, (P a → Q a)) (p : ∀a, P a) (a : A) : Q a :=
|
|
|
|
|
(H a) (p a)
|
2014-12-12 21:50:53 +00:00
|
|
|
|
|
2015-06-04 01:41:21 +00:00
|
|
|
|
theorem forall_iff_forall {A : Type} {P Q : A → Prop} (H : ∀a, (P a ↔ Q a)) : (∀a, P a) ↔ ∀a, Q a :=
|
2015-07-24 15:56:18 +00:00
|
|
|
|
iff.intro (λp a, iff.mp (H a) (p a)) (λq a, iff.mpr (H a) (q a))
|
|
|
|
|
|
|
|
|
|
theorem exists_imp_exists {A : Type} {P Q : A → Prop} (H : ∀a, (P a → Q a)) (p : ∃a, P a) : ∃a, Q a :=
|
|
|
|
|
exists.elim p (λa Hp, exists.intro a (H a Hp))
|
|
|
|
|
|
|
|
|
|
theorem exists_iff_exists {A : Type} {P Q : A → Prop} (H : ∀a, (P a ↔ Q a)) : (∃a, P a) ↔ ∃a, Q a :=
|
|
|
|
|
iff.intro
|
|
|
|
|
(exists_imp_exists (λa, iff.mp (H a)))
|
|
|
|
|
(exists_imp_exists (λa, iff.mpr (H a)))
|
2015-06-04 01:41:21 +00:00
|
|
|
|
|
|
|
|
|
theorem imp_iff {P : Prop} (Q : Prop) (p : P) : (P → Q) ↔ Q :=
|
2015-07-24 15:56:18 +00:00
|
|
|
|
iff.intro (λf, f p) imp.intro
|
2015-06-04 01:41:21 +00:00
|
|
|
|
|
2015-06-04 23:57:56 +00:00
|
|
|
|
theorem iff_iff_iff (H1 : a ↔ c) (H2 : b ↔ d) : (a ↔ b) ↔ (c ↔ d) :=
|
|
|
|
|
and_iff_and (imp_iff_imp H1 H2) (imp_iff_imp H2 H1)
|
2015-06-04 01:41:21 +00:00
|
|
|
|
|
2014-12-15 20:05:44 +00:00
|
|
|
|
/- if-then-else -/
|
|
|
|
|
|
2014-12-12 21:50:53 +00:00
|
|
|
|
section
|
|
|
|
|
open eq.ops
|
|
|
|
|
|
|
|
|
|
variables {A : Type} {c₁ c₂ : Prop}
|
|
|
|
|
|
2015-07-22 16:01:42 +00:00
|
|
|
|
definition if_true [simp] (t e : A) : (if true then t else e) = t :=
|
2014-12-12 21:50:53 +00:00
|
|
|
|
if_pos trivial
|
|
|
|
|
|
2015-07-22 16:01:42 +00:00
|
|
|
|
definition if_false [simp] (t e : A) : (if false then t else e) = e :=
|
2014-12-12 21:50:53 +00:00
|
|
|
|
if_neg not_false
|
|
|
|
|
end
|
2015-06-08 06:58:08 +00:00
|
|
|
|
|
|
|
|
|
/- congruences -/
|
|
|
|
|
|
2015-07-24 15:56:18 +00:00
|
|
|
|
theorem congr_not [congr] {a b : Prop} (H : a ↔ b) : ¬a ↔ ¬b :=
|
|
|
|
|
not_iff_not H
|
2015-06-08 06:58:08 +00:00
|
|
|
|
|
|
|
|
|
section
|
|
|
|
|
variables {a₁ b₁ a₂ b₂ : Prop}
|
|
|
|
|
variables (H₁ : a₁ ↔ b₁) (H₂ : a₂ ↔ b₂)
|
|
|
|
|
|
2015-07-23 00:21:47 +00:00
|
|
|
|
theorem congr_and [congr] : a₁ ∧ a₂ ↔ b₁ ∧ b₂ :=
|
|
|
|
|
and_iff_and H₁ H₂
|
|
|
|
|
|
|
|
|
|
theorem congr_or [congr] : a₁ ∨ a₂ ↔ b₁ ∨ b₂ :=
|
|
|
|
|
or_iff_or H₁ H₂
|
|
|
|
|
|
|
|
|
|
theorem congr_imp [congr] : (a₁ → a₂) ↔ (b₁ → b₂) :=
|
|
|
|
|
imp_iff_imp H₁ H₂
|
|
|
|
|
|
|
|
|
|
theorem congr_iff [congr] : (a₁ ↔ a₂) ↔ (b₁ ↔ b₂) :=
|
|
|
|
|
iff_iff_iff H₁ H₂
|
2015-06-08 06:58:08 +00:00
|
|
|
|
end
|