2014-08-16 20:50:59 +00:00
|
|
|
import logic struc.relation
|
|
|
|
using relation
|
|
|
|
|
|
|
|
namespace is_equivalence
|
|
|
|
|
|
|
|
inductive class {T : Type} (R : T → T → Type) : Prop :=
|
2014-08-20 22:49:44 +00:00
|
|
|
| mk : is_reflexive R → is_symmetric R → is_transitive R → class R
|
2014-08-16 20:50:59 +00:00
|
|
|
|
2014-08-20 22:49:44 +00:00
|
|
|
theorem is_reflexive {T : Type} {R : T → T → Type} {C : class R} : is_reflexive R :=
|
2014-08-16 20:50:59 +00:00
|
|
|
class_rec (λx y z, x) C
|
|
|
|
|
2014-08-20 22:49:44 +00:00
|
|
|
theorem is_symmetric {T : Type} {R : T → T → Type} {C : class R} : is_symmetric R :=
|
2014-08-16 20:50:59 +00:00
|
|
|
class_rec (λx y z, y) C
|
|
|
|
|
2014-08-20 22:49:44 +00:00
|
|
|
theorem is_transitive {T : Type} {R : T → T → Type} {C : class R} : is_transitive R :=
|
2014-08-16 20:50:59 +00:00
|
|
|
class_rec (λx y z, z) C
|
|
|
|
|
|
|
|
end is_equivalence
|
|
|
|
|
|
|
|
instance is_equivalence.is_reflexive
|
|
|
|
instance is_equivalence.is_symmetric
|
|
|
|
instance is_equivalence.is_transitive
|
|
|
|
|
|
|
|
theorem and_inhabited_left {a : Prop} (b : Prop) (Ha : a) : a ∧ b ↔ b :=
|
|
|
|
iff_intro (take Hab, and_elim_right Hab) (take Hb, and_intro Ha Hb)
|
|
|
|
|
|
|
|
theorem test (a b c : Prop) (P : Prop → Prop) (H1 : a ↔ b) (H2 : c ∧ a) : c ∧ b :=
|
2014-08-20 22:49:44 +00:00
|
|
|
subst_iff H1 H2
|
2014-08-16 20:50:59 +00:00
|
|
|
|
|
|
|
theorem test2 (Q R S : Prop) (H3 : R ↔ Q) (H1 : S) : Q ↔ (S ∧ Q) :=
|
2014-08-20 22:49:44 +00:00
|
|
|
iff_symm (and_inhabited_left Q H1)
|
2014-08-16 20:50:59 +00:00
|
|
|
|
|
|
|
theorem test3 (Q R S : Prop) (H3 : R ↔ Q) (H1 : S) : R ↔ (S ∧ Q) :=
|
2014-08-20 22:49:44 +00:00
|
|
|
subst_iff (test2 Q R S H3 H1) H3
|
2014-08-16 20:50:59 +00:00
|
|
|
|
|
|
|
theorem test4 (Q R S : Prop) (H3 : R ↔ Q) (H1 : S) : R ↔ (S ∧ Q) :=
|
2014-08-20 22:49:44 +00:00
|
|
|
subst_iff (iff_symm (and_inhabited_left Q H1)) H3
|