2014-11-28 15:20:52 +00:00
|
|
|
/-
|
|
|
|
Copyright (c) 2014 Microsoft Corporation. All rights reserved.
|
|
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
Author: Jeremy Avigad
|
|
|
|
|
|
|
|
Class instances for iff and eq.
|
|
|
|
-/
|
2014-08-05 00:07:59 +00:00
|
|
|
|
2014-12-12 21:20:27 +00:00
|
|
|
import logic.connectives algebra.relation
|
2014-08-05 00:07:59 +00:00
|
|
|
|
2014-08-20 02:32:44 +00:00
|
|
|
namespace relation
|
|
|
|
|
2014-11-28 15:20:52 +00:00
|
|
|
/- logical equivalence relations -/
|
|
|
|
|
|
|
|
theorem is_equivalence_eq [instance] (T : Type) : relation.is_equivalence (@eq T) :=
|
|
|
|
relation.is_equivalence.mk (@eq.refl T) (@eq.symm T) (@eq.trans T)
|
|
|
|
|
|
|
|
theorem is_equivalence_iff [instance] : relation.is_equivalence iff :=
|
|
|
|
relation.is_equivalence.mk @iff.refl @iff.symm @iff.trans
|
|
|
|
|
|
|
|
/- congruences for logic operations -/
|
2014-08-05 00:07:59 +00:00
|
|
|
|
2014-11-28 15:20:52 +00:00
|
|
|
theorem is_congruence_not : is_congruence iff iff not :=
|
2015-07-24 15:56:18 +00:00
|
|
|
is_congruence.mk @congr_not
|
2014-08-05 00:07:59 +00:00
|
|
|
|
2014-11-28 15:20:52 +00:00
|
|
|
theorem is_congruence_and : is_congruence2 iff iff iff and :=
|
2015-07-24 15:56:18 +00:00
|
|
|
is_congruence2.mk @congr_and
|
2014-08-05 00:07:59 +00:00
|
|
|
|
2014-11-28 15:20:52 +00:00
|
|
|
theorem is_congruence_or : is_congruence2 iff iff iff or :=
|
2015-07-24 15:56:18 +00:00
|
|
|
is_congruence2.mk @congr_or
|
2014-08-05 00:07:59 +00:00
|
|
|
|
2014-11-28 15:20:52 +00:00
|
|
|
theorem is_congruence_imp : is_congruence2 iff iff iff imp :=
|
2015-07-24 15:56:18 +00:00
|
|
|
is_congruence2.mk @congr_imp
|
2014-08-05 00:07:59 +00:00
|
|
|
|
2014-11-28 15:20:52 +00:00
|
|
|
theorem is_congruence_iff : is_congruence2 iff iff iff iff :=
|
2015-07-24 15:56:18 +00:00
|
|
|
is_congruence2.mk @congr_iff
|
2014-08-05 00:07:59 +00:00
|
|
|
|
2015-07-29 04:56:35 +00:00
|
|
|
reveal is_congruence_not is_congruence_and is_congruence_or is_congruence_imp is_congruence_iff
|
|
|
|
|
2014-11-28 15:20:52 +00:00
|
|
|
definition is_congruence_not_compose [instance] := is_congruence.compose is_congruence_not
|
|
|
|
definition is_congruence_and_compose [instance] := is_congruence.compose21 is_congruence_and
|
|
|
|
definition is_congruence_or_compose [instance] := is_congruence.compose21 is_congruence_or
|
|
|
|
definition is_congruence_implies_compose [instance] := is_congruence.compose21 is_congruence_imp
|
|
|
|
definition is_congruence_iff_compose [instance] := is_congruence.compose21 is_congruence_iff
|
2014-08-05 00:07:59 +00:00
|
|
|
|
2014-11-28 15:20:52 +00:00
|
|
|
/- a general substitution operation with respect to an arbitrary congruence -/
|
2014-08-05 00:07:59 +00:00
|
|
|
|
2014-11-28 15:20:52 +00:00
|
|
|
namespace general_subst
|
|
|
|
theorem subst {T : Type} (R : T → T → Prop) ⦃P : T → Prop⦄ [C : is_congruence R iff P]
|
|
|
|
{a b : T} (H : R a b) (H1 : P a) : P b := iff.elim_left (is_congruence.app C H) H1
|
|
|
|
end general_subst
|
2014-08-05 00:07:59 +00:00
|
|
|
|
2014-11-28 15:20:52 +00:00
|
|
|
/- iff can be coerced to implication -/
|
2014-08-05 00:07:59 +00:00
|
|
|
|
2014-11-28 15:20:52 +00:00
|
|
|
definition mp_like_iff [instance] : relation.mp_like iff :=
|
2015-07-24 15:56:18 +00:00
|
|
|
relation.mp_like.mk @iff.mp
|
2014-08-05 00:07:59 +00:00
|
|
|
|
2014-11-28 15:20:52 +00:00
|
|
|
/- support for calculations with iff -/
|
2014-08-05 00:07:59 +00:00
|
|
|
|
2014-09-05 04:25:21 +00:00
|
|
|
namespace iff
|
2014-12-15 20:05:44 +00:00
|
|
|
theorem subst {P : Prop → Prop} [C : is_congruence iff iff P] {a b : Prop}
|
|
|
|
(H : a ↔ b) (H1 : P a) : P b :=
|
2014-11-28 15:20:52 +00:00
|
|
|
@general_subst.subst Prop iff P C a b H H1
|
2014-09-05 04:25:21 +00:00
|
|
|
end iff
|
2014-08-20 22:49:44 +00:00
|
|
|
|
2015-05-02 22:15:35 +00:00
|
|
|
attribute iff.subst [subst]
|
2014-08-20 02:32:44 +00:00
|
|
|
|
|
|
|
namespace iff_ops
|
2014-10-21 21:08:07 +00:00
|
|
|
notation H ⁻¹ := iff.symm H
|
|
|
|
notation H1 ⬝ H2 := iff.trans H1 H2
|
|
|
|
notation H1 ▸ H2 := iff.subst H1 H2
|
2014-09-17 21:39:05 +00:00
|
|
|
definition refl := iff.refl
|
|
|
|
definition symm := @iff.symm
|
|
|
|
definition trans := @iff.trans
|
|
|
|
definition subst := @iff.subst
|
|
|
|
definition mp := @iff.mp
|
2014-08-20 02:32:44 +00:00
|
|
|
end iff_ops
|
2014-11-28 15:20:52 +00:00
|
|
|
|
2014-08-20 02:32:44 +00:00
|
|
|
end relation
|