]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/matita/library/logic/equality.ma
New version of the library, a bit more structured.
[helm.git] / helm / matita / library / logic / equality.ma
diff --git a/helm/matita/library/logic/equality.ma b/helm/matita/library/logic/equality.ma
new file mode 100644 (file)
index 0000000..fb7e66e
--- /dev/null
@@ -0,0 +1,62 @@
+(**************************************************************************)
+(*       ___                                                               *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||       A.Asperti, C.Sacerdoti Coen,                          *)
+(*      ||A||       E.Tassi, S.Zacchiroli                                 *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU Lesser General Public License Version 2.1         *)
+(*                                                                        *)
+(**************************************************************************)
+
+set "baseuri" "cic:/matita/logic/equality/".
+
+include "higher_order_defs/relations.ma".
+
+inductive eq (A:Type) (x:A) : A \to Prop \def
+    refl_eq : eq A x x.
+    
+theorem reflexive_eq : \forall A:Type. reflexive A (eq A).
+simplify.intros.apply refl_eq.
+qed.
+    
+theorem symmetric_eq: \forall A:Type. symmetric A (eq A).
+simplify.intros.elim H. apply refl_eq.
+qed.
+
+theorem sym_eq : \forall A:Type.\forall x,y:A. eq A x y  \to eq A y x
+\def symmetric_eq.
+
+theorem transitive_eq : \forall A:Type. transitive A (eq A).
+simplify.intros.elim H1.assumption.
+qed.
+
+theorem trans_eq : \forall A:Type.\forall x,y,z:A. eq A x y  \to eq A y z \to eq A x z
+\def transitive_eq.
+
+theorem eq_elim_r:
+ \forall A:Type.\forall x:A. \forall P: A \to Prop.
+   P x \to \forall y:A. eq A y x \to P y.
+intros. elim sym_eq ? ? ? H1.assumption.
+qed.
+
+default "equality"
+ cic:/matita/logic/equality/eq.ind
+ cic:/matita/logic/equality/sym_eq.con
+ cic:/matita/logic/equality/trans_eq.con
+ cic:/matita/logic/equality/eq_ind.con
+ cic:/matita/logic/equality/eq_elim_r.con. 
+theorem eq_f: \forall  A,B:Type.\forall f:A\to B.
+\forall x,y:A. eq A x y \to eq B (f x) (f y).
+intros.elim H.reflexivity.
+qed.
+
+theorem eq_f2: \forall  A,B,C:Type.\forall f:A\to B \to C.
+\forall x1,x2:A. \forall y1,y2:B.
+eq A x1 x2\to eq B y1 y2\to eq C (f x1 y1) (f x2 y2).
+intros.elim H1.elim H.reflexivity.
+qed.
\ No newline at end of file