]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/contribs/dama/dama_duality/group.ma
Preparing for 0.5.9 release.
[helm.git] / helm / software / matita / contribs / dama / dama_duality / 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
16
17 include "excess.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 = (zero ?).
48
49 interpretation "Abelian group plus" 'plus a b = (plus ? a b).
50
51 interpretation "Abelian group opp" 'uminus a = (opp ? a).
52
53 definition minus ≝
54  λG:abelian_group.λa,b:G. a + -b.
55
56 interpretation "Abelian group minus" 'minus a b = (minus ? a b).
57
58 lemma plus_assoc: ∀G:abelian_group.∀x,y,z:G.x+(y+z)≈x+y+z ≝ plus_assoc_. 
59 lemma plus_comm: ∀G:abelian_group.∀x,y:G.x+y≈y+x ≝ plus_comm_. 
60 lemma zero_neutral: ∀G:abelian_group.∀x:G.0+x≈x ≝ zero_neutral_. 
61 lemma opp_inverse: ∀G:abelian_group.∀x:G.-x+x≈0 ≝ opp_inverse_.
62
63 definition ext ≝ λA:apartness.λop:A→A. ∀x,y. x ≈ y → op x ≈ op y.
64
65 lemma strong_ext_to_ext: ∀A:apartness.∀op:A→A. strong_ext ? op → ext ? op.
66 intros 6 (A op SEop x y Exy); intro Axy; apply Exy; apply SEop; assumption;
67 qed. 
68
69 lemma feq_plusl: ∀G:abelian_group.∀x,y,z:G. y ≈ z →  x+y ≈ x+z.
70 intros (G x y z Eyz); apply (strong_ext_to_ext ?? (plus_strong_ext ? x));
71 assumption;
72 qed.  
73
74 coercion cic:/matita/group/feq_plusl.con nocomposites.
75    
76 lemma plus_strong_extr: ∀G:abelian_group.∀z:G.strong_ext ? (λx.x + z).
77 intros 5 (G z x y A); simplify in A;
78 lapply (plus_comm ? z x) as E1; lapply (plus_comm ? z y) as E2;
79 lapply (Ap≪ ? E1 A) as A1; lapply (Ap≫ ? E2 A1) as A2;
80 apply (plus_strong_ext ???? A2);
81 qed.
82
83 lemma plus_cancl_ap: ∀G:abelian_group.∀x,y,z:G.z+x # z + y → x # y.
84 intros; apply plus_strong_ext; assumption;
85 qed.
86
87 lemma plus_cancr_ap: ∀G:abelian_group.∀x,y,z:G.x+z # y+z → x # y.
88 intros; apply plus_strong_extr; assumption;
89 qed.
90    
91 lemma feq_plusr: ∀G:abelian_group.∀x,y,z:G. y ≈ z →  y+x ≈ z+x.
92 intros (G x y z Eyz); apply (strong_ext_to_ext ?? (plus_strong_extr ? x));
93 assumption;
94 qed.   
95    
96 coercion cic:/matita/group/feq_plusr.con nocomposites.
97
98 (* generation of coercions to make *_rew[lr] easier *)
99 lemma feq_plusr_sym_: ∀G:abelian_group.∀x,y,z:G.z ≈ y →  y+x ≈ z+x.
100 compose feq_plusr with eq_sym (H); apply H; assumption;
101 qed.
102 coercion cic:/matita/group/feq_plusr_sym_.con nocomposites.
103 lemma feq_plusl_sym_: ∀G:abelian_group.∀x,y,z:G.z ≈ y →  x+y ≈ x+z.
104 compose feq_plusl with eq_sym (H); apply H; assumption;
105 qed.
106 coercion cic:/matita/group/feq_plusl_sym_.con nocomposites.
107       
108 lemma fap_plusl: ∀G:abelian_group.∀x,y,z:G. y # z →  x+y # x+z. 
109 intros (G x y z Ayz); apply (plus_strong_ext ? (-x));
110 apply (Ap≪ ((-x + x) + y));
111 [1: apply plus_assoc; 
112 |2: apply (Ap≫ ((-x +x) +z));
113     [1: apply plus_assoc; 
114     |2: apply (Ap≪ (0 + y));
115         [1: apply (feq_plusr ???? (opp_inverse ??)); 
116         |2: apply (Ap≪ ? (zero_neutral ? y)); 
117             apply (Ap≫ (0 + z) (opp_inverse ??)); 
118             apply (Ap≫ ? (zero_neutral ??)); assumption;]]]
119 qed.
120
121 lemma fap_plusr: ∀G:abelian_group.∀x,y,z:G. y # z →  y+x # z+x. 
122 intros (G x y z Ayz); apply (plus_strong_extr ? (-x));
123 apply (Ap≪ (y + (x + -x)));
124 [1: apply (eq_sym ??? (plus_assoc ????)); 
125 |2: apply (Ap≫ (z + (x + -x)));
126     [1: apply (eq_sym ??? (plus_assoc ????)); 
127     |2: apply (Ap≪ (y + (-x+x)) (plus_comm ? x (-x)));
128         apply (Ap≪ (y + 0) (opp_inverse ??));
129         apply (Ap≪ (0 + y) (plus_comm ???));
130         apply (Ap≪ y (zero_neutral ??));
131         apply (Ap≫ (z + (-x+x)) (plus_comm ? x (-x)));
132         apply (Ap≫ (z + 0) (opp_inverse ??));
133         apply (Ap≫ (0 + z) (plus_comm ???));
134         apply (Ap≫ z (zero_neutral ??));
135         assumption]]
136 qed.
137
138 lemma applus: ∀E:abelian_group.∀x,a,y,b:E.x + a # y + b → x # y ∨ a # b.
139 intros; cases (ap_cotransitive ??? (y+a) a1); [left|right]
140 [apply (plus_cancr_ap ??? a)|apply (plus_cancl_ap ??? y)]
141 assumption;
142 qed.
143     
144 lemma plus_cancl: ∀G:abelian_group.∀y,z,x:G. x+y ≈ x+z → y ≈ z. 
145 intros 6 (G y z x E Ayz); apply E; apply fap_plusl; assumption;
146 qed.
147
148 lemma plus_cancr: ∀G:abelian_group.∀y,z,x:G. y+x ≈ z+x → y ≈ z. 
149 intros 6 (G y z x E Ayz); apply E; apply fap_plusr; assumption;
150 qed.
151
152 theorem eq_opp_plus_plus_opp_opp: 
153   ∀G:abelian_group.∀x,y:G. -(x+y) ≈ -x + -y.
154 intros (G x y); apply (plus_cancr ??? (x+y));
155 apply (Eq≈ 0 (opp_inverse ??));
156 apply (Eq≈ (-x + -y + x + y)); [2: apply (eq_sym ??? (plus_assoc ????))]
157 apply (Eq≈ (-y + -x + x + y)); [2: repeat apply feq_plusr; apply plus_comm]
158 apply (Eq≈ (-y + (-x + x) + y)); [2: apply feq_plusr; apply plus_assoc;]
159 apply (Eq≈ (-y + 0 + y)); 
160   [2: apply feq_plusr; apply feq_plusl; apply eq_sym; apply opp_inverse]
161 apply (Eq≈ (-y + y)); 
162   [2: apply feq_plusr; apply eq_sym; 
163       apply (Eq≈ (0+-y)); [apply plus_comm|apply zero_neutral]]
164 apply eq_sym; apply opp_inverse.
165 qed.
166
167 theorem eq_opp_opp_x_x: ∀G:abelian_group.∀x:G.--x ≈ x.
168 intros (G x); apply (plus_cancl ??? (-x));
169 apply (Eq≈ (--x + -x) (plus_comm ???));
170 apply (Eq≈ 0 (opp_inverse ??));
171 apply eq_sym; apply opp_inverse;
172 qed.
173
174 theorem eq_zero_opp_zero: ∀G:abelian_group.0 ≈ -0. [assumption]
175 intro G; apply (plus_cancr ??? 0);
176 apply (Eq≈ 0); [apply zero_neutral;]
177 apply eq_sym; apply opp_inverse;
178 qed.
179
180 lemma feq_oppr: ∀G:abelian_group.∀x,y,z:G. y ≈ z → x ≈ -y → x ≈ -z.
181 intros (G x y z H1 H2); apply (plus_cancr ??? z);
182 apply (Eq≈ 0 ? (opp_inverse ??));
183 apply (Eq≈ (-y + z) H2);
184 apply (Eq≈ (-y + y) H1);
185 apply (Eq≈ 0 (opp_inverse ??));
186 apply eq_reflexive;
187 qed.
188
189 lemma feq_oppl: ∀G:abelian_group.∀x,y,z:G. y ≈ z → -y ≈ x → -z ≈ x.
190 intros (G x y z H1 H2); apply eq_sym; apply (feq_oppr ??y);
191 [2:apply eq_sym] assumption;
192 qed.
193
194 lemma feq_opp: ∀G:abelian_group.∀x,y:G. x ≈ y → -x ≈ -y.
195 intros (G x y H); apply (feq_oppl ??y ? H); apply eq_reflexive;
196 qed.
197
198 coercion cic:/matita/group/feq_opp.con nocomposites.
199
200 lemma eq_opp_sym: ∀G:abelian_group.∀x,y:G. y ≈ x → -x ≈ -y.
201 compose feq_opp with eq_sym (H); apply H; assumption;
202 qed.
203
204 coercion cic:/matita/group/eq_opp_sym.con nocomposites.
205
206 lemma eq_opp_plusr: ∀G:abelian_group.∀x,y,z:G. x ≈ y → -(x + z) ≈ -(y + z).
207 compose feq_plusr with feq_opp(H); apply H; assumption;
208 qed.
209
210 coercion cic:/matita/group/eq_opp_plusr.con nocomposites.
211
212 lemma eq_opp_plusl: ∀G:abelian_group.∀x,y,z:G. x ≈ y → -(z + x) ≈ -(z + y).
213 compose feq_plusl with feq_opp(H); apply H; assumption;
214 qed.
215
216 coercion cic:/matita/group/eq_opp_plusl.con nocomposites.