]> matita.cs.unibo.it Git - helm.git/blob - matita/dama/groups.ma
snapshot
[helm.git] / matita / dama / groups.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/groups/".
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 definition strong_ext ≝ λA:apartness.λop:A→A.∀x,y. op x # op y → x # y.
24 (* ALLOW DEFINITION WITH SOME METAS *)
25
26 definition distributive_left ≝
27  λA:apartness.λf:A→A→A.λg:A→A→A.
28   ∀x,y,z. f x (g y z) ≈ g (f x y) (f x z).
29
30 definition distributive_right ≝
31  λA:apartness.λf:A→A→A.λg:A→A→A.
32   ∀x,y,z. f (g x y) z ≈ g (f x z) (f y z).
33
34 record abelian_group : Type ≝
35  { carr:> apartness;
36    plus: carr → carr → carr;
37    zero: carr;
38    opp: carr → carr;
39    plus_assoc_: associative ? plus (eq carr);
40    plus_comm_: commutative ? plus (eq carr);
41    zero_neutral_: left_neutral ? plus zero;
42    opp_inverse_: left_inverse ? plus zero opp;
43    plus_strong_ext: ∀z.strong_ext ? (plus z)  
44 }.
45
46 notation "0" with precedence 89 for @{ 'zero }.
47
48 interpretation "Abelian group zero" 'zero =
49  (cic:/matita/groups/zero.con _).
50
51 interpretation "Abelian group plus" 'plus a b =
52  (cic:/matita/groups/plus.con _ a b).
53
54 interpretation "Abelian group opp" 'uminus a =
55  (cic:/matita/groups/opp.con _ a).
56
57 definition minus ≝
58  λG:abelian_group.λa,b:G. a + -b.
59
60 interpretation "Abelian group minus" 'minus a b =
61  (cic:/matita/groups/minus.con _ a b).
62
63 lemma plus_assoc: ∀G:abelian_group.∀x,y,z:G.x+(y+z)≈x+y+z ≝ plus_assoc_. 
64 lemma plus_comm: ∀G:abelian_group.∀x,y:G.x+y≈y+x ≝ plus_comm_. 
65 lemma zero_neutral: ∀G:abelian_group.∀x:G.0+x≈x ≝ zero_neutral_. 
66 lemma opp_inverse: ∀G:abelian_group.∀x:G.-x+x≈0 ≝ opp_inverse_.
67
68 definition ext ≝ λA:apartness.λop:A→A. ∀x,y. x ≈ y → op x ≈ op y.
69
70 lemma strong_ext_to_ext: ∀A:apartness.∀op:A→A. strong_ext ? op → ext ? op.
71 intros 6 (A op SEop x y Exy); intro Axy; apply Exy; apply SEop; assumption;
72 qed. 
73
74 lemma feq_plusl: ∀G:abelian_group.∀x,y,z:G. y ≈ z →  x+y ≈ x+z.
75 intros (G x y z Eyz); apply (strong_ext_to_ext ?? (plus_strong_ext ? x));
76 assumption;
77 qed.  
78
79 coercion cic:/matita/groups/feq_plusl.con nocomposites.
80    
81 lemma plus_strong_extr: ∀G:abelian_group.∀z:G.strong_ext ? (λx.x + z).
82 intros 5 (G z x y A); simplify in A;
83 lapply (plus_comm ? z x) as E1; lapply (plus_comm ? z y) as E2;
84 lapply (ap_rewl ???? E1 A) as A1; lapply (ap_rewr ???? E2 A1) as A2;
85 apply (plus_strong_ext ???? A2);
86 qed.
87    
88 lemma feq_plusr: ∀G:abelian_group.∀x,y,z:G. y ≈ z →  y+x ≈ z+x.
89 intros (G x y z Eyz); apply (strong_ext_to_ext ?? (plus_strong_extr ? x));
90 assumption;
91 qed.   
92    
93 coercion cic:/matita/groups/feq_plusr.con nocomposites.
94
95 (* generation of coercions to make *_rew[lr] easier *)
96 lemma feq_plusr_sym_: ∀G:abelian_group.∀x,y,z:G.z ≈ y →  y+x ≈ z+x.
97 compose feq_plusr with eq_sym (H); apply H; assumption;
98 qed.
99 coercion cic:/matita/groups/feq_plusr_sym_.con nocomposites.
100 lemma feq_plusl_sym_: ∀G:abelian_group.∀x,y,z:G.z ≈ y →  x+y ≈ x+z.
101 compose feq_plusl with eq_sym (H); apply H; assumption;
102 qed.
103 coercion cic:/matita/groups/feq_plusl_sym_.con nocomposites.
104       
105 lemma fap_plusl: ∀G:abelian_group.∀x,y,z:G. y # z →  x+y # x+z. 
106 intros (G x y z Ayz); apply (plus_strong_ext ? (-x));
107 apply (ap_rewl ??? ((-x + x) + y));
108 [1: apply plus_assoc; 
109 |2: apply (ap_rewr ??? ((-x +x) +z));
110     [1: apply plus_assoc; 
111     |2: apply (ap_rewl ??? (0 + y));
112         [1: apply (feq_plusr ???? (opp_inverse ??)); 
113         |2: apply (ap_rewl ???? (zero_neutral ? y)); 
114             apply (ap_rewr ??? (0 + z) (opp_inverse ??)); 
115             apply (ap_rewr ???? (zero_neutral ??)); assumption;]]]
116 qed.
117
118 lemma fap_plusr: ∀G:abelian_group.∀x,y,z:G. y # z →  y+x # z+x. 
119 intros (G x y z Ayz); apply (plus_strong_extr ? (-x));
120 apply (ap_rewl ??? (y + (x + -x)));
121 [1: apply (eq_sym ??? (plus_assoc ????)); 
122 |2: apply (ap_rewr ??? (z + (x + -x)));
123     [1: apply (eq_sym ??? (plus_assoc ????)); 
124     |2: apply (ap_rewl ??? (y + (-x+x)) (plus_comm ? x (-x)));
125         apply (ap_rewl ??? (y + 0) (opp_inverse ??));
126         apply (ap_rewl ??? (0 + y) (plus_comm ???));
127         apply (ap_rewl ??? y (zero_neutral ??));
128         apply (ap_rewr ??? (z + (-x+x)) (plus_comm ? x (-x)));
129         apply (ap_rewr ??? (z + 0) (opp_inverse ??));
130         apply (ap_rewr ??? (0 + z) (plus_comm ???));
131         apply (ap_rewr ??? z (zero_neutral ??));
132         assumption]]
133 qed.
134     
135 lemma plus_cancl: ∀G:abelian_group.∀y,z,x:G. x+y ≈ x+z → y ≈ z. 
136 intros 6 (G y z x E Ayz); apply E; apply fap_plusl; assumption;
137 qed.
138
139 lemma plus_cancr: ∀G:abelian_group.∀y,z,x:G. y+x ≈ z+x → y ≈ z. 
140 intros 6 (G y z x E Ayz); apply E; apply fap_plusr; assumption;
141 qed.
142
143 theorem eq_opp_plus_plus_opp_opp: 
144   ∀G:abelian_group.∀x,y:G. -(x+y) ≈ -x + -y.
145 intros (G x y); apply (plus_cancr ??? (x+y));
146 apply (eq_trans ?? 0 ? (opp_inverse ??));
147 apply (eq_trans ?? (-x + -y + x + y)); [2: apply (eq_sym ??? (plus_assoc ????))]
148 apply (eq_trans ?? (-y + -x + x + y)); [2: repeat apply feq_plusr; apply plus_comm]
149 apply (eq_trans ?? (-y + (-x + x) + y)); [2: apply feq_plusr; apply plus_assoc;]
150 apply (eq_trans ?? (-y + 0 + y)); 
151   [2: apply feq_plusr; apply feq_plusl; apply eq_sym; apply opp_inverse]
152 apply (eq_trans ?? (-y + y)); 
153   [2: apply feq_plusr; apply eq_sym; 
154       apply (eq_trans ?? (0+-y)); [apply plus_comm|apply zero_neutral]]
155 apply eq_sym; apply opp_inverse.
156 qed.
157
158 theorem eq_opp_opp_x_x: ∀G:abelian_group.∀x:G.--x ≈ x.
159 intros (G x); apply (plus_cancl ??? (-x));
160 apply (eq_trans ?? (--x + -x)); [apply plus_comm]
161 apply (eq_trans ?? 0); [apply opp_inverse]
162 apply eq_sym; apply opp_inverse;
163 qed.
164
165 theorem eq_zero_opp_zero: ∀G:abelian_group.0 ≈ -0. [assumption]
166 intro G; apply (plus_cancr ??? 0);
167 apply (eq_trans ?? 0); [apply zero_neutral;]
168 apply eq_sym; apply opp_inverse;
169 qed.
170
171 lemma feq_oppr: ∀G:abelian_group.∀x,y,z:G. y ≈ z → x ≈ -y → x ≈ -z.
172 intros (G x y z H1 H2); apply (plus_cancr ??? z);
173 apply (eq_trans ?? 0 ?? (opp_inverse ?z));
174 apply (eq_trans ?? (-y + z) ? H2);
175 apply (eq_trans ?? (-y + y) ? H1);
176 apply (eq_trans ?? 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/groups/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/groups/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/groups/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/groups/eq_opp_plusl.con nocomposites.