]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/dama/group.ma
cleanup of the eq_trans burdain
[helm.git] / helm / software / matita / dama / group.ma
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.cs.unibo.it                             *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 set "baseuri" "cic:/matita/group/".
16
17 include "excedence.ma".
18
19 definition left_neutral ≝ λC:apartness.λop.λe:C. ∀x:C. op e x ≈ x.
20 definition right_neutral ≝ λC:apartness.λop. λe:C. ∀x:C. op x e ≈ x.
21 definition left_inverse ≝ λC:apartness.λop.λe:C.λinv:C→C. ∀x:C. op (inv x) x ≈ e.
22 definition right_inverse ≝ λC:apartness.λop.λe:C.λ inv: C→ C. ∀x:C. op x (inv x) ≈ e. 
23 (* ALLOW DEFINITION WITH SOME METAS *)
24
25 definition distributive_left ≝
26  λA:apartness.λf:A→A→A.λg:A→A→A.
27   ∀x,y,z. f x (g y z) ≈ g (f x y) (f x z).
28
29 definition distributive_right ≝
30  λA:apartness.λf:A→A→A.λg:A→A→A.
31   ∀x,y,z. f (g x y) z ≈ g (f x z) (f y z).
32
33 record abelian_group : Type ≝
34  { carr:> apartness;
35    plus: carr → carr → carr;
36    zero: carr;
37    opp: carr → carr;
38    plus_assoc_: associative ? plus (eq carr);
39    plus_comm_: commutative ? plus (eq carr);
40    zero_neutral_: left_neutral ? plus zero;
41    opp_inverse_: left_inverse ? plus zero opp;
42    plus_strong_ext: ∀z.strong_ext ? (plus z)  
43 }.
44
45 notation "0" with precedence 89 for @{ 'zero }.
46
47 interpretation "Abelian group zero" 'zero =
48  (cic:/matita/group/zero.con _).
49
50 interpretation "Abelian group plus" 'plus a b =
51  (cic:/matita/group/plus.con _ a b).
52
53 interpretation "Abelian group opp" 'uminus a =
54  (cic:/matita/group/opp.con _ a).
55
56 definition minus ≝
57  λG:abelian_group.λa,b:G. a + -b.
58
59 interpretation "Abelian group minus" 'minus a b =
60  (cic:/matita/group/minus.con _ a b).
61
62 lemma plus_assoc: ∀G:abelian_group.∀x,y,z:G.x+(y+z)≈x+y+z ≝ plus_assoc_. 
63 lemma plus_comm: ∀G:abelian_group.∀x,y:G.x+y≈y+x ≝ plus_comm_. 
64 lemma zero_neutral: ∀G:abelian_group.∀x:G.0+x≈x ≝ zero_neutral_. 
65 lemma opp_inverse: ∀G:abelian_group.∀x:G.-x+x≈0 ≝ opp_inverse_.
66
67 definition ext ≝ λA:apartness.λop:A→A. ∀x,y. x ≈ y → op x ≈ op y.
68
69 lemma strong_ext_to_ext: ∀A:apartness.∀op:A→A. strong_ext ? op → ext ? op.
70 intros 6 (A op SEop x y Exy); intro Axy; apply Exy; apply SEop; assumption;
71 qed. 
72
73 lemma feq_plusl: ∀G:abelian_group.∀x,y,z:G. y ≈ z →  x+y ≈ x+z.
74 intros (G x y z Eyz); apply (strong_ext_to_ext ?? (plus_strong_ext ? x));
75 assumption;
76 qed.  
77
78 coercion cic:/matita/group/feq_plusl.con nocomposites.
79    
80 lemma plus_strong_extr: ∀G:abelian_group.∀z:G.strong_ext ? (λx.x + z).
81 intros 5 (G z x y A); simplify in A;
82 lapply (plus_comm ? z x) as E1; lapply (plus_comm ? z y) as E2;
83 lapply (ap_rewl ???? E1 A) as A1; lapply (ap_rewr ???? E2 A1) as A2;
84 apply (plus_strong_ext ???? A2);
85 qed.
86    
87 lemma feq_plusr: ∀G:abelian_group.∀x,y,z:G. y ≈ z →  y+x ≈ z+x.
88 intros (G x y z Eyz); apply (strong_ext_to_ext ?? (plus_strong_extr ? x));
89 assumption;
90 qed.   
91    
92 coercion cic:/matita/group/feq_plusr.con nocomposites.
93
94 (* generation of coercions to make *_rew[lr] easier *)
95 lemma feq_plusr_sym_: ∀G:abelian_group.∀x,y,z:G.z ≈ y →  y+x ≈ z+x.
96 compose feq_plusr with eq_sym (H); apply H; assumption;
97 qed.
98 coercion cic:/matita/group/feq_plusr_sym_.con nocomposites.
99 lemma feq_plusl_sym_: ∀G:abelian_group.∀x,y,z:G.z ≈ y →  x+y ≈ x+z.
100 compose feq_plusl with eq_sym (H); apply H; assumption;
101 qed.
102 coercion cic:/matita/group/feq_plusl_sym_.con nocomposites.
103       
104 lemma fap_plusl: ∀G:abelian_group.∀x,y,z:G. y # z →  x+y # x+z. 
105 intros (G x y z Ayz); apply (plus_strong_ext ? (-x));
106 apply (ap_rewl ??? ((-x + x) + y));
107 [1: apply plus_assoc; 
108 |2: apply (ap_rewr ??? ((-x +x) +z));
109     [1: apply plus_assoc; 
110     |2: apply (ap_rewl ??? (0 + y));
111         [1: apply (feq_plusr ???? (opp_inverse ??)); 
112         |2: apply (ap_rewl ???? (zero_neutral ? y)); 
113             apply (ap_rewr ??? (0 + z) (opp_inverse ??)); 
114             apply (ap_rewr ???? (zero_neutral ??)); assumption;]]]
115 qed.
116
117 lemma fap_plusr: ∀G:abelian_group.∀x,y,z:G. y # z →  y+x # z+x. 
118 intros (G x y z Ayz); apply (plus_strong_extr ? (-x));
119 apply (ap_rewl ??? (y + (x + -x)));
120 [1: apply (eq_sym ??? (plus_assoc ????)); 
121 |2: apply (ap_rewr ??? (z + (x + -x)));
122     [1: apply (eq_sym ??? (plus_assoc ????)); 
123     |2: apply (ap_rewl ??? (y + (-x+x)) (plus_comm ? x (-x)));
124         apply (ap_rewl ??? (y + 0) (opp_inverse ??));
125         apply (ap_rewl ??? (0 + y) (plus_comm ???));
126         apply (ap_rewl ??? y (zero_neutral ??));
127         apply (ap_rewr ??? (z + (-x+x)) (plus_comm ? x (-x)));
128         apply (ap_rewr ??? (z + 0) (opp_inverse ??));
129         apply (ap_rewr ??? (0 + z) (plus_comm ???));
130         apply (ap_rewr ??? z (zero_neutral ??));
131         assumption]]
132 qed.
133     
134 lemma plus_cancl: ∀G:abelian_group.∀y,z,x:G. x+y ≈ x+z → y ≈ z. 
135 intros 6 (G y z x E Ayz); apply E; apply fap_plusl; assumption;
136 qed.
137
138 lemma plus_cancr: ∀G:abelian_group.∀y,z,x:G. y+x ≈ z+x → y ≈ z. 
139 intros 6 (G y z x E Ayz); apply E; apply fap_plusr; assumption;
140 qed.
141
142 theorem eq_opp_plus_plus_opp_opp: 
143   ∀G:abelian_group.∀x,y:G. -(x+y) ≈ -x + -y.
144 intros (G x y); apply (plus_cancr ??? (x+y));
145 apply (Eq≈ 0 (opp_inverse ??));
146 apply (Eq≈ (-x + -y + x + y)); [2: apply (eq_sym ??? (plus_assoc ????))]
147 apply (Eq≈ (-y + -x + x + y)); [2: repeat apply feq_plusr; apply plus_comm]
148 apply (Eq≈ (-y + (-x + x) + y)); [2: apply feq_plusr; apply plus_assoc;]
149 apply (Eq≈ (-y + 0 + y)); 
150   [2: apply feq_plusr; apply feq_plusl; apply eq_sym; apply opp_inverse]
151 apply (Eq≈ (-y + y)); 
152   [2: apply feq_plusr; apply eq_sym; 
153       apply (Eq≈ (0+-y)); [apply plus_comm|apply zero_neutral]]
154 apply eq_sym; apply opp_inverse.
155 qed.
156
157 theorem eq_opp_opp_x_x: ∀G:abelian_group.∀x:G.--x ≈ x.
158 intros (G x); apply (plus_cancl ??? (-x));
159 apply (Eq≈ (--x + -x) (plus_comm ???));
160 apply (Eq≈ 0 (opp_inverse ??));
161 apply eq_sym; apply opp_inverse;
162 qed.
163
164 theorem eq_zero_opp_zero: ∀G:abelian_group.0 ≈ -0. [assumption]
165 intro G; apply (plus_cancr ??? 0);
166 apply (Eq≈ 0); [apply zero_neutral;]
167 apply eq_sym; apply opp_inverse;
168 qed.
169
170 lemma feq_oppr: ∀G:abelian_group.∀x,y,z:G. y ≈ z → x ≈ -y → x ≈ -z.
171 intros (G x y z H1 H2); apply (plus_cancr ??? z);
172 (* apply (eq_trans ??? 0 ? (opp_inverse ??)); *)
173 apply (Eq≈ 0 ? (opp_inverse ??));
174 apply (Eq≈ (-y + z) H2);
175 apply (Eq≈ (-y + y) H1);
176 apply (Eq≈ 0 (opp_inverse ??));
177 apply eq_reflexive;
178 qed.
179
180 lemma feq_oppl: ∀G:abelian_group.∀x,y,z:G. y ≈ z → -y ≈ x → -z ≈ x.
181 intros (G x y z H1 H2); apply eq_sym; apply (feq_oppr ??y);
182 [2:apply eq_sym] assumption;
183 qed.
184
185 lemma feq_opp: ∀G:abelian_group.∀x,y:G. x ≈ y → -x ≈ -y.
186 intros (G x y H); apply (feq_oppl ??y ? H); apply eq_reflexive;
187 qed.
188
189 coercion cic:/matita/group/feq_opp.con nocomposites.
190
191 lemma eq_opp_sym: ∀G:abelian_group.∀x,y:G. y ≈ x → -x ≈ -y.
192 compose feq_opp with eq_sym (H); apply H; assumption;
193 qed.
194
195 coercion cic:/matita/group/eq_opp_sym.con nocomposites.
196
197 lemma eq_opp_plusr: ∀G:abelian_group.∀x,y,z:G. x ≈ y → -(x + z) ≈ -(y + z).
198 compose feq_plusr with feq_opp(H); apply H; assumption;
199 qed.
200
201 coercion cic:/matita/group/eq_opp_plusr.con nocomposites.
202
203 lemma eq_opp_plusl: ∀G:abelian_group.∀x,y,z:G. x ≈ y → -(z + x) ≈ -(z + y).
204 compose feq_plusl with feq_opp(H); apply H; assumption;
205 qed.
206
207 coercion cic:/matita/group/eq_opp_plusl.con nocomposites.
208
209 lemma plus_cancr_ap: ∀G:abelian_group.∀x,y,z:G. x+z # y+z → x # y.
210 intros (G x y z H); lapply (fap_plusr ? (-z) ?? H) as H1; clear H;
211 lapply (ap_rewl ? (x + (z + -z)) ?? (plus_assoc ? x z (-z)) H1) as H2; clear H1;
212 lapply (ap_rewl ? (x + (-z + z)) ?? (plus_comm ?z (-z)) H2) as H1; clear H2;
213 lapply (ap_rewl ? (x + 0) ?? (opp_inverse ?z) H1) as H2; clear H1;
214 lapply (ap_rewl ? (0+x) ?? (plus_comm ?x 0) H2) as H1; clear H2;
215 lapply (ap_rewl ? x ?? (zero_neutral ?x) H1) as H2; clear H1;
216 lapply (ap_rewr ? (y + (z + -z)) ?? (plus_assoc ? y z (-z)) H2) as H3;
217 lapply (ap_rewr ? (y + (-z + z)) ?? (plus_comm ?z (-z)) H3) as H4;
218 lapply (ap_rewr ? (y + 0) ?? (opp_inverse ?z) H4) as H5;
219 lapply (ap_rewr ? (0+y) ?? (plus_comm ?y 0) H5) as H6;
220 lapply (ap_rewr ? y ?? (zero_neutral ?y) H6);
221 assumption;
222 qed.
223
224 lemma pluc_cancl_ap: ∀G:abelian_group.∀x,y,z:G. z+x # z+y → x # y.
225 intros (G x y z H); apply (plus_cancr_ap ??? z);
226 apply (ap_rewl ???? (plus_comm ???)); 
227 apply (ap_rewr ???? (plus_comm ???));
228 assumption;
229 qed.