1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 set "baseuri" "cic:/matita/group/".
17 include "excedence.ma".
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 *)
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).
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).
33 record abelian_group : Type ≝
35 plus: carr → 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)
45 notation "0" with precedence 89 for @{ 'zero }.
47 interpretation "Abelian group zero" 'zero =
48 (cic:/matita/group/zero.con _).
50 interpretation "Abelian group plus" 'plus a b =
51 (cic:/matita/group/plus.con _ a b).
53 interpretation "Abelian group opp" 'uminus a =
54 (cic:/matita/group/opp.con _ a).
57 λG:abelian_group.λa,b:G. a + -b.
59 interpretation "Abelian group minus" 'minus a b =
60 (cic:/matita/group/minus.con _ a b).
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_.
67 definition ext ≝ λA:apartness.λop:A→A. ∀x,y. x ≈ y → op x ≈ op y.
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;
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));
78 coercion cic:/matita/group/feq_plusl.con nocomposites.
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);
87 lemma plus_cancl_ap: ∀G:abelian_group.∀x,y,z:G.z+x # z + y → x # y.
88 intros; apply plus_strong_ext; assumption;
91 lemma plus_cancr_ap: ∀G:abelian_group.∀x,y,z:G.x+z # y+z → x # y.
92 intros; apply plus_strong_extr; assumption;
95 lemma feq_plusr: ∀G:abelian_group.∀x,y,z:G. y ≈ z → y+x ≈ z+x.
96 intros (G x y z Eyz); apply (strong_ext_to_ext ?? (plus_strong_extr ? x));
100 coercion cic:/matita/group/feq_plusr.con nocomposites.
102 (* generation of coercions to make *_rew[lr] easier *)
103 lemma feq_plusr_sym_: ∀G:abelian_group.∀x,y,z:G.z ≈ y → y+x ≈ z+x.
104 compose feq_plusr with eq_sym (H); apply H; assumption;
106 coercion cic:/matita/group/feq_plusr_sym_.con nocomposites.
107 lemma feq_plusl_sym_: ∀G:abelian_group.∀x,y,z:G.z ≈ y → x+y ≈ x+z.
108 compose feq_plusl with eq_sym (H); apply H; assumption;
110 coercion cic:/matita/group/feq_plusl_sym_.con nocomposites.
112 lemma fap_plusl: ∀G:abelian_group.∀x,y,z:G. y # z → x+y # x+z.
113 intros (G x y z Ayz); apply (plus_strong_ext ? (-x));
114 apply (ap_rewl ??? ((-x + x) + y));
115 [1: apply plus_assoc;
116 |2: apply (ap_rewr ??? ((-x +x) +z));
117 [1: apply plus_assoc;
118 |2: apply (ap_rewl ??? (0 + y));
119 [1: apply (feq_plusr ???? (opp_inverse ??));
120 |2: apply (ap_rewl ???? (zero_neutral ? y));
121 apply (ap_rewr ??? (0 + z) (opp_inverse ??));
122 apply (ap_rewr ???? (zero_neutral ??)); assumption;]]]
125 lemma fap_plusr: ∀G:abelian_group.∀x,y,z:G. y # z → y+x # z+x.
126 intros (G x y z Ayz); apply (plus_strong_extr ? (-x));
127 apply (ap_rewl ??? (y + (x + -x)));
128 [1: apply (eq_sym ??? (plus_assoc ????));
129 |2: apply (ap_rewr ??? (z + (x + -x)));
130 [1: apply (eq_sym ??? (plus_assoc ????));
131 |2: apply (ap_rewl ??? (y + (-x+x)) (plus_comm ? x (-x)));
132 apply (ap_rewl ??? (y + 0) (opp_inverse ??));
133 apply (ap_rewl ??? (0 + y) (plus_comm ???));
134 apply (ap_rewl ??? y (zero_neutral ??));
135 apply (ap_rewr ??? (z + (-x+x)) (plus_comm ? x (-x)));
136 apply (ap_rewr ??? (z + 0) (opp_inverse ??));
137 apply (ap_rewr ??? (0 + z) (plus_comm ???));
138 apply (ap_rewr ??? z (zero_neutral ??));
142 lemma plus_cancl: ∀G:abelian_group.∀y,z,x:G. x+y ≈ x+z → y ≈ z.
143 intros 6 (G y z x E Ayz); apply E; apply fap_plusl; assumption;
146 lemma plus_cancr: ∀G:abelian_group.∀y,z,x:G. y+x ≈ z+x → y ≈ z.
147 intros 6 (G y z x E Ayz); apply E; apply fap_plusr; assumption;
150 theorem eq_opp_plus_plus_opp_opp:
151 ∀G:abelian_group.∀x,y:G. -(x+y) ≈ -x + -y.
152 intros (G x y); apply (plus_cancr ??? (x+y));
153 apply (Eq≈ 0 (opp_inverse ??));
154 apply (Eq≈ (-x + -y + x + y)); [2: apply (eq_sym ??? (plus_assoc ????))]
155 apply (Eq≈ (-y + -x + x + y)); [2: repeat apply feq_plusr; apply plus_comm]
156 apply (Eq≈ (-y + (-x + x) + y)); [2: apply feq_plusr; apply plus_assoc;]
157 apply (Eq≈ (-y + 0 + y));
158 [2: apply feq_plusr; apply feq_plusl; apply eq_sym; apply opp_inverse]
159 apply (Eq≈ (-y + y));
160 [2: apply feq_plusr; apply eq_sym;
161 apply (Eq≈ (0+-y)); [apply plus_comm|apply zero_neutral]]
162 apply eq_sym; apply opp_inverse.
165 theorem eq_opp_opp_x_x: ∀G:abelian_group.∀x:G.--x ≈ x.
166 intros (G x); apply (plus_cancl ??? (-x));
167 apply (Eq≈ (--x + -x) (plus_comm ???));
168 apply (Eq≈ 0 (opp_inverse ??));
169 apply eq_sym; apply opp_inverse;
172 theorem eq_zero_opp_zero: ∀G:abelian_group.0 ≈ -0. [assumption]
173 intro G; apply (plus_cancr ??? 0);
174 apply (Eq≈ 0); [apply zero_neutral;]
175 apply eq_sym; apply opp_inverse;
178 lemma feq_oppr: ∀G:abelian_group.∀x,y,z:G. y ≈ z → x ≈ -y → x ≈ -z.
179 intros (G x y z H1 H2); apply (plus_cancr ??? z);
180 (* apply (eq_trans ??? 0 ? (opp_inverse ??)); *)
181 apply (Eq≈ 0 ? (opp_inverse ??));
182 apply (Eq≈ (-y + z) H2);
183 apply (Eq≈ (-y + y) H1);
184 apply (Eq≈ 0 (opp_inverse ??));
188 lemma feq_oppl: ∀G:abelian_group.∀x,y,z:G. y ≈ z → -y ≈ x → -z ≈ x.
189 intros (G x y z H1 H2); apply eq_sym; apply (feq_oppr ??y);
190 [2:apply eq_sym] assumption;
193 lemma feq_opp: ∀G:abelian_group.∀x,y:G. x ≈ y → -x ≈ -y.
194 intros (G x y H); apply (feq_oppl ??y ? H); apply eq_reflexive;
197 coercion cic:/matita/group/feq_opp.con nocomposites.
199 lemma eq_opp_sym: ∀G:abelian_group.∀x,y:G. y ≈ x → -x ≈ -y.
200 compose feq_opp with eq_sym (H); apply H; assumption;
203 coercion cic:/matita/group/eq_opp_sym.con nocomposites.
205 lemma eq_opp_plusr: ∀G:abelian_group.∀x,y,z:G. x ≈ y → -(x + z) ≈ -(y + z).
206 compose feq_plusr with feq_opp(H); apply H; assumption;
209 coercion cic:/matita/group/eq_opp_plusr.con nocomposites.
211 lemma eq_opp_plusl: ∀G:abelian_group.∀x,y,z:G. x ≈ y → -(z + x) ≈ -(z + y).
212 compose feq_plusl with feq_opp(H); apply H; assumption;
215 coercion cic:/matita/group/eq_opp_plusl.con nocomposites.