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 (**************************************************************************)
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≪ ? E1 A) as A1; lapply (Ap≫ ? 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≪ ((-x + x) + y));
115 [1: apply plus_assoc;
116 |2: apply (Ap≫ ((-x +x) +z));
117 [1: apply plus_assoc;
118 |2: apply (Ap≪ (0 + y));
119 [1: apply (feq_plusr ???? (opp_inverse ??));
120 |2: apply (Ap≪ ? (zero_neutral ? y));
121 apply (Ap≫ (0 + z) (opp_inverse ??));
122 apply (Ap≫ ? (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≪ (y + (x + -x)));
128 [1: apply (eq_sym ??? (plus_assoc ????));
129 |2: apply (Ap≫ (z + (x + -x)));
130 [1: apply (eq_sym ??? (plus_assoc ????));
131 |2: apply (Ap≪ (y + (-x+x)) (plus_comm ? x (-x)));
132 apply (Ap≪ (y + 0) (opp_inverse ??));
133 apply (Ap≪ (0 + y) (plus_comm ???));
134 apply (Ap≪ y (zero_neutral ??));
135 apply (Ap≫ (z + (-x+x)) (plus_comm ? x (-x)));
136 apply (Ap≫ (z + 0) (opp_inverse ??));
137 apply (Ap≫ (0 + z) (plus_comm ???));
138 apply (Ap≫ z (zero_neutral ??));
142 lemma applus: ∀E:abelian_group.∀x,a,y,b:E.x + a # y + b → x # y ∨ a # b.
143 intros; cases (ap_cotransitive ??? (y+a) a1); [left|right]
144 [apply (plus_cancr_ap ??? a)|apply (plus_cancl_ap ??? y)]
148 lemma plus_cancl: ∀G:abelian_group.∀y,z,x:G. x+y ≈ x+z → y ≈ z.
149 intros 6 (G y z x E Ayz); apply E; apply fap_plusl; assumption;
152 lemma plus_cancr: ∀G:abelian_group.∀y,z,x:G. y+x ≈ z+x → y ≈ z.
153 intros 6 (G y z x E Ayz); apply E; apply fap_plusr; assumption;
156 theorem eq_opp_plus_plus_opp_opp:
157 ∀G:abelian_group.∀x,y:G. -(x+y) ≈ -x + -y.
158 intros (G x y); apply (plus_cancr ??? (x+y));
159 apply (Eq≈ 0 (opp_inverse ??));
160 apply (Eq≈ (-x + -y + x + y)); [2: apply (eq_sym ??? (plus_assoc ????))]
161 apply (Eq≈ (-y + -x + x + y)); [2: repeat apply feq_plusr; apply plus_comm]
162 apply (Eq≈ (-y + (-x + x) + y)); [2: apply feq_plusr; apply plus_assoc;]
163 apply (Eq≈ (-y + 0 + y));
164 [2: apply feq_plusr; apply feq_plusl; apply eq_sym; apply opp_inverse]
165 apply (Eq≈ (-y + y));
166 [2: apply feq_plusr; apply eq_sym;
167 apply (Eq≈ (0+-y)); [apply plus_comm|apply zero_neutral]]
168 apply eq_sym; apply opp_inverse.
171 theorem eq_opp_opp_x_x: ∀G:abelian_group.∀x:G.--x ≈ x.
172 intros (G x); apply (plus_cancl ??? (-x));
173 apply (Eq≈ (--x + -x) (plus_comm ???));
174 apply (Eq≈ 0 (opp_inverse ??));
175 apply eq_sym; apply opp_inverse;
178 theorem eq_zero_opp_zero: ∀G:abelian_group.0 ≈ -0. [assumption]
179 intro G; apply (plus_cancr ??? 0);
180 apply (Eq≈ 0); [apply zero_neutral;]
181 apply eq_sym; apply opp_inverse;
184 lemma feq_oppr: ∀G:abelian_group.∀x,y,z:G. y ≈ z → x ≈ -y → x ≈ -z.
185 intros (G x y z H1 H2); apply (plus_cancr ??? z);
186 apply (Eq≈ 0 ? (opp_inverse ??));
187 apply (Eq≈ (-y + z) H2);
188 apply (Eq≈ (-y + y) H1);
189 apply (Eq≈ 0 (opp_inverse ??));
193 lemma feq_oppl: ∀G:abelian_group.∀x,y,z:G. y ≈ z → -y ≈ x → -z ≈ x.
194 intros (G x y z H1 H2); apply eq_sym; apply (feq_oppr ??y);
195 [2:apply eq_sym] assumption;
198 lemma feq_opp: ∀G:abelian_group.∀x,y:G. x ≈ y → -x ≈ -y.
199 intros (G x y H); apply (feq_oppl ??y ? H); apply eq_reflexive;
202 coercion cic:/matita/group/feq_opp.con nocomposites.
204 lemma eq_opp_sym: ∀G:abelian_group.∀x,y:G. y ≈ x → -x ≈ -y.
205 compose feq_opp with eq_sym (H); apply H; assumption;
208 coercion cic:/matita/group/eq_opp_sym.con nocomposites.
210 lemma eq_opp_plusr: ∀G:abelian_group.∀x,y,z:G. x ≈ y → -(x + z) ≈ -(y + z).
211 compose feq_plusr with feq_opp(H); apply H; assumption;
214 coercion cic:/matita/group/eq_opp_plusr.con nocomposites.
216 lemma eq_opp_plusl: ∀G:abelian_group.∀x,y,z:G. x ≈ y → -(z + x) ≈ -(z + y).
217 compose feq_plusl with feq_opp(H); apply H; assumption;
220 coercion cic:/matita/group/eq_opp_plusl.con nocomposites.