]> matita.cs.unibo.it Git - helm.git/blob - helm/matita/library/logic/equality.ma
New version of the library, a bit more structured.
[helm.git] / helm / matita / library / logic / equality.ma
1 (**************************************************************************)
2 (*       ___                                                                *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||       A.Asperti, C.Sacerdoti Coen,                          *)
8 (*      ||A||       E.Tassi, S.Zacchiroli                                 *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU Lesser General Public License Version 2.1         *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 set "baseuri" "cic:/matita/logic/equality/".
16
17 include "higher_order_defs/relations.ma".
18
19 inductive eq (A:Type) (x:A) : A \to Prop \def
20     refl_eq : eq A x x.
21     
22 theorem reflexive_eq : \forall A:Type. reflexive A (eq A).
23 simplify.intros.apply refl_eq.
24 qed.
25     
26 theorem symmetric_eq: \forall A:Type. symmetric A (eq A).
27 simplify.intros.elim H. apply refl_eq.
28 qed.
29
30 theorem sym_eq : \forall A:Type.\forall x,y:A. eq A x y  \to eq A y x
31 \def symmetric_eq.
32
33 theorem transitive_eq : \forall A:Type. transitive A (eq A).
34 simplify.intros.elim H1.assumption.
35 qed.
36
37 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
38 \def transitive_eq.
39
40 theorem eq_elim_r:
41  \forall A:Type.\forall x:A. \forall P: A \to Prop.
42    P x \to \forall y:A. eq A y x \to P y.
43 intros. elim sym_eq ? ? ? H1.assumption.
44 qed.
45
46 default "equality"
47  cic:/matita/logic/equality/eq.ind
48  cic:/matita/logic/equality/sym_eq.con
49  cic:/matita/logic/equality/trans_eq.con
50  cic:/matita/logic/equality/eq_ind.con
51  cic:/matita/logic/equality/eq_elim_r.con. 
52  
53 theorem eq_f: \forall  A,B:Type.\forall f:A\to B.
54 \forall x,y:A. eq A x y \to eq B (f x) (f y).
55 intros.elim H.reflexivity.
56 qed.
57
58 theorem eq_f2: \forall  A,B,C:Type.\forall f:A\to B \to C.
59 \forall x1,x2:A. \forall y1,y2:B.
60 eq A x1 x2\to eq B y1 y2\to eq C (f x1 y1) (f x2 y2).
61 intros.elim H1.elim H.reflexivity.
62 qed.