]> matita.cs.unibo.it Git - helm.git/blob - matita/dama/groups.ma
3e30e04748e84eb9dc937f180db580c21b3524db
[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 ap_rewl: ∀A:apartness.∀x,z,y:A. x ≈ y → y # z → x # z.
64 intros (A x z y Exy Ayz); cases (ap_cotransitive ???x Ayz); [2:assumption]
65 cases (Exy (ap_symmetric ??? a));
66 qed.
67   
68 lemma ap_rewr: ∀A:apartness.∀x,z,y:A. x ≈ y → z # y → z # x.
69 intros (A x z y Exy Azy); apply ap_symmetric; apply (ap_rewl ???? Exy);
70 apply ap_symmetric; assumption;
71 qed.
72
73 definition ext ≝ λA:apartness.λop:A→A. ∀x,y. x ≈ y → op x ≈ op y.
74
75 lemma strong_ext_to_ext: ∀A:apartness.∀op:A→A. strong_ext ? op → ext ? op.
76 intros 6 (A op SEop x y Exy); intro Axy; apply Exy; apply SEop; assumption;
77 qed. 
78
79 lemma feq_plusl: ∀G:abelian_group.∀x,y,z:G. y ≈ z →  x+y ≈ x+z.
80 intros (G x y z Eyz); apply (strong_ext_to_ext ?? (plus_strong_ext ? x));
81 assumption;
82 qed.  
83    
84 lemma plus_strong_extr: ∀G:abelian_group.∀z:G.strong_ext ? (λx.x + z).
85 intros 5 (G z x y A); simplify in A;
86 lapply (plus_comm ? z x) as E1; lapply (plus_comm ? z y) as E2;
87 lapply (ap_rewl ???? E1 A) as A1; lapply (ap_rewr ???? E2 A1) as A2;
88 apply (plus_strong_ext ???? A2);
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 lemma fap_plusl: ∀G:abelian_group.∀x,y,z:G. y # z →  x+y # x+z. 
97 intros (G x y z Ayz); apply (plus_strong_ext ? (-x));
98 apply (ap_rewl ??? ((-x + x) + y));
99 [1: apply plus_assoc; 
100 |2: apply (ap_rewr ??? ((-x +x) +z));
101     [1: apply plus_assoc; 
102     |2: apply (ap_rewl ??? (0 + y));
103         [1: apply (feq_plusr ???? (opp_inverse ??)); 
104         |2: apply (ap_rewl ???? (zero_neutral ? y)); apply (ap_rewr ??? (0 + z));
105             [1: apply (feq_plusr ???? (opp_inverse ??)); 
106             |2: apply (ap_rewr ???? (zero_neutral ??)); assumption;]]]]
107 qed.
108
109 lemma fap_plusr: ∀G:abelian_group.∀x,y,z:G. y # z →  y+x # z+x. 
110 intros (G x y z Ayz); apply (plus_strong_extr ? (-x));
111 apply (ap_rewl ??? (y + (x + -x)));
112 [1: apply (eq_symmetric ??? (plus_assoc ????)); 
113 |2: apply (ap_rewr ??? (z + (x + -x)));
114     [1: apply (eq_symmetric ??? (plus_assoc ????)); 
115     |2: apply (ap_rewl ??? (y + (-x+x)) (feq_plusl ???? (plus_comm ???)));
116         apply (ap_rewl ??? (y + 0) (feq_plusl ???? (opp_inverse ??)));
117         apply (ap_rewl ??? (0 + y) (plus_comm ???));
118         apply (ap_rewl ??? y (zero_neutral ??));
119         apply (ap_rewr ??? (z + (-x+x)) (feq_plusl ???? (plus_comm ???)));
120         apply (ap_rewr ??? (z + 0) (feq_plusl ???? (opp_inverse ??)));
121         apply (ap_rewr ??? (0 + z) (plus_comm ???));
122         apply (ap_rewr ??? z (zero_neutral ??));
123         assumption]]
124 qed.
125     
126 lemma plus_cancl: ∀G:abelian_group.∀y,z,x:G. x+y ≈ x+z → y ≈ z. 
127 intros 6 (G y z x E Ayz); apply E; apply fap_plusl; assumption;
128 qed.
129
130 lemma plus_cancr: ∀G:abelian_group.∀y,z,x:G. y+x ≈ z+x → y ≈ z. 
131 intros 6 (G y z x E Ayz); apply E; apply fap_plusr; assumption;
132 qed.
133
134 theorem eq_opp_plus_plus_opp_opp: 
135   ∀G:abelian_group.∀x,y:G. -(x+y) ≈ -x + -y.
136 intros (G x y); apply (plus_cancr ??? (x+y));
137 apply (eq_transitive ?? 0); [apply (opp_inverse ??)]
138 apply (eq_transitive ?? (-x + -y + x + y)); [2: apply (eq_symmetric ??? (plus_assoc ????))]
139 apply (eq_transitive ?? (-y + -x + x + y)); [2: repeat apply feq_plusr; apply plus_comm]
140 apply (eq_transitive ?? (-y + (-x + x) + y)); [2: apply feq_plusr; apply plus_assoc;]
141 apply (eq_transitive ?? (-y + 0 + y)); 
142   [2: apply feq_plusr; apply feq_plusl; apply eq_symmetric; apply opp_inverse]
143 apply (eq_transitive ?? (-y + y)); 
144   [2: apply feq_plusr; apply eq_symmetric; 
145       apply (eq_transitive ?? (0+-y)); [apply plus_comm|apply zero_neutral]]
146 apply eq_symmetric; apply opp_inverse.
147 qed.
148
149 theorem eq_opp_opp_x_x: ∀G:abelian_group.∀x:G.--x ≈ x.
150 intros (G x); apply (plus_cancl ??? (-x));
151 apply (eq_transitive ?? (--x + -x)); [apply plus_comm]
152 apply (eq_transitive (carr G) (plus G (opp G (opp G x)) (opp G x)) (zero G) (plus G (opp G x) x) ? ?);
153   [apply (opp_inverse G (opp G x)).
154   |apply (eq_symmetric (carr G) (plus G (opp G x) x) (zero G) ?).
155    apply (opp_inverse G x).
156   ]
157 qed.
158
159 theorem eq_zero_opp_zero: ∀G:abelian_group.0 ≈ -0.
160  [ assumption
161  | intros;
162 apply (eq_transitive (carr G) (zero G) (plus G (opp G (zero G)) (zero G)) (opp G (zero G)) ? ?);
163   [apply (eq_symmetric (carr G) (plus G (opp G (zero G)) (zero G)) (zero G) ?).
164    apply (opp_inverse G (zero G)).
165   |apply (eq_transitive (carr G) (plus G (opp G (zero G)) (zero G)) (plus G (zero G) (opp G (zero G))) (opp G (zero G)) ? ?);
166     [apply (plus_comm G (opp G (zero G)) (zero G)).
167     |apply (zero_neutral G (opp G (zero G))).
168     ]
169   ]]
170 qed.