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 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));
92 coercion cic:/matita/group/feq_plusr.con nocomposites.
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;
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;
102 coercion cic:/matita/group/feq_plusl_sym_.con nocomposites.
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;]]]
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 ??));
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;
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;
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_trans ?? 0 ? (opp_inverse ??));
146 apply (eq_trans ?? (-x + -y + x + y)); [2: apply (eq_sym ??? (plus_assoc ????))]
147 apply (eq_trans ?? (-y + -x + x + y)); [2: repeat apply feq_plusr; apply plus_comm]
148 apply (eq_trans ?? (-y + (-x + x) + y)); [2: apply feq_plusr; apply plus_assoc;]
149 apply (eq_trans ?? (-y + 0 + y));
150 [2: apply feq_plusr; apply feq_plusl; apply eq_sym; apply opp_inverse]
151 apply (eq_trans ?? (-y + y));
152 [2: apply feq_plusr; apply eq_sym;
153 apply (eq_trans ?? (0+-y)); [apply plus_comm|apply zero_neutral]]
154 apply eq_sym; apply opp_inverse.
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_trans ?? (--x + -x)); [apply plus_comm]
160 apply (eq_trans ?? 0); [apply opp_inverse]
161 apply eq_sym; apply opp_inverse;
164 theorem eq_zero_opp_zero: ∀G:abelian_group.0 ≈ -0. [assumption]
165 intro G; apply (plus_cancr ??? 0);
166 apply (eq_trans ?? 0); [apply zero_neutral;]
167 apply eq_sym; apply opp_inverse;
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 ?z));
173 apply (eq_trans ?? (-y + z) ? H2);
174 apply (eq_trans ?? (-y + y) ? H1);
175 apply (eq_trans ?? 0 ? (opp_inverse ??));
179 lemma feq_oppl: ∀G:abelian_group.∀x,y,z:G. y ≈ z → -y ≈ x → -z ≈ x.
180 intros (G x y z H1 H2); apply eq_sym; apply (feq_oppr ??y);
181 [2:apply eq_sym] assumption;
184 lemma feq_opp: ∀G:abelian_group.∀x,y:G. x ≈ y → -x ≈ -y.
185 intros (G x y H); apply (feq_oppl ??y ? H); apply eq_reflexive;
188 coercion cic:/matita/group/feq_opp.con nocomposites.
190 lemma eq_opp_sym: ∀G:abelian_group.∀x,y:G. y ≈ x → -x ≈ -y.
191 compose feq_opp with eq_sym (H); apply H; assumption;
194 coercion cic:/matita/group/eq_opp_sym.con nocomposites.
196 lemma eq_opp_plusr: ∀G:abelian_group.∀x,y,z:G. x ≈ y → -(x + z) ≈ -(y + z).
197 compose feq_plusr with feq_opp(H); apply H; assumption;
200 coercion cic:/matita/group/eq_opp_plusr.con nocomposites.
202 lemma eq_opp_plusl: ∀G:abelian_group.∀x,y,z:G. x ≈ y → -(z + x) ≈ -(z + y).
203 compose feq_plusl with feq_opp(H); apply H; assumption;
206 coercion cic:/matita/group/eq_opp_plusl.con nocomposites.
208 lemma plus_cancr_ap: ∀G:abelian_group.∀x,y,z:G. x+z # y+z → x # y.
209 intros (G x y z H); lapply (fap_plusr ? (-z) ?? H) as H1; clear H;
210 lapply (ap_rewl ? (x + (z + -z)) ?? (plus_assoc ? x z (-z)) H1) as H2; clear H1;
211 lapply (ap_rewl ? (x + (-z + z)) ?? (plus_comm ?z (-z)) H2) as H1; clear H2;
212 lapply (ap_rewl ? (x + 0) ?? (opp_inverse ?z) H1) as H2; clear H1;
213 lapply (ap_rewl ? (0+x) ?? (plus_comm ?x 0) H2) as H1; clear H2;
214 lapply (ap_rewl ? x ?? (zero_neutral ?x) H1) as H2; clear H1;
215 lapply (ap_rewr ? (y + (z + -z)) ?? (plus_assoc ? y z (-z)) H2) as H3;
216 lapply (ap_rewr ? (y + (-z + z)) ?? (plus_comm ?z (-z)) H3) as H4;
217 lapply (ap_rewr ? (y + 0) ?? (opp_inverse ?z) H4) as H5;
218 lapply (ap_rewr ? (0+y) ?? (plus_comm ?y 0) H5) as H6;
219 lapply (ap_rewr ? y ?? (zero_neutral ?y) H6);
223 lemma pluc_cancl_ap: ∀G:abelian_group.∀x,y,z:G. z+x # z+y → x # y.
224 intros (G x y z H); apply (plus_cancr_ap ??? z);
225 apply (ap_rewl ???? (plus_comm ???));
226 apply (ap_rewr ???? (plus_comm ???));