-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathZ_group_facts.v
365 lines (345 loc) · 11.4 KB
/
Z_group_facts.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
(* This program is free software; you can redistribute it and/or *)
(* modify it under the terms of the GNU Lesser General Public License *)
(* as published by the Free Software Foundation; either version 2.1 *)
(* of the License, or (at your option) any later version. *)
(* *)
(* This program is distributed in the hope that it will be useful, *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)
(* GNU General Public License for more details. *)
(* *)
(* You should have received a copy of the GNU Lesser General Public *)
(* License along with this program; if not, write to the Free *)
(* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *)
(* 02110-1301 USA *)
Set Automatic Coercions Import.
Set Implicit Arguments.
Unset Strict Implicit.
Require Export Z_group.
(** Title "Facts about powers." *)
Section Lemmas.
Variable G : GROUP.
Lemma Z_to_group_nat_eq_pos :
forall (n : Z) (g : G), Equal (Z_to_group_nat_fun g n) (Z_to_group_fun g n).
intros n g; try assumption.
apply Trans with (Ap (sgroup_map (monoid_sgroup_hom (Z_to_group_nat g))) n);
auto with algebra.
apply Sym.
apply Z_to_group_fun_eq.
Qed.
Hint Resolve Z_to_group_nat_eq_pos: algebra.
Lemma Zopp1 : forall n : Z, (n < 0)%Z -> (- n > 0)%Z.
simple induction n.
intros H'; try assumption.
inversion H'.
intros p H'; try assumption.
replace 0%Z with (- (0))%Z.
apply Zlt_gt; auto with algebra.
auto with algebra.
intros p H'; try assumption.
replace 0%Z with (- (0))%Z.
apply Zlt_gt; auto with algebra.
auto with algebra.
Qed.
Hint Resolve Zopp1: algebra.
Lemma Zopp2 : forall n : Z, (n > 0)%Z -> (- n < 0)%Z.
simple induction n.
intros H'; try assumption.
inversion H'.
intros p H'; try assumption.
replace 0%Z with (- (0))%Z.
apply Zgt_lt; auto with algebra.
auto with algebra.
intros p H'; try assumption.
replace 0%Z with (- (0))%Z.
apply Zgt_lt; auto with algebra.
auto with algebra.
Qed.
Hint Resolve Zopp2: algebra.
Lemma pos_abs_comp :
forall (x : Z) (p p' : (x > 0)%Z), pos_abs p = pos_abs p'.
intros x; try assumption.
elim x.
intros p p'; try assumption.
red in p'.
inversion p.
intros p p0 p'; simpl in |- *.
auto with algebra.
intros p p0 p'; try assumption.
red in p'.
simpl in p'.
inversion p'.
Qed.
Hint Resolve Zl2 Zl1 Zl3 nat_to_group_inverse: algebra.
Lemma nat_to_group_comp :
forall (r r' : G) (n : nat),
Equal r r' -> Equal (nat_to_group r n) (nat_to_group r' n).
simple induction n; simpl in |- *; auto with algebra.
Qed.
Hint Resolve nat_to_group_comp: algebra.
Lemma Z_to_group_nat_fun_comp :
forall (r r' : G) (n : Z),
Equal r r' -> Equal (Z_to_group_nat_fun r n) (Z_to_group_nat_fun r' n).
intros r r' n H'; try assumption.
elim n.
apply Trans with (monoid_unit G); auto with algebra.
intros p; try assumption.
apply Trans with (nat_to_group r (nat_of_P (pos_abs (ax3 p))));
auto with algebra.
apply Trans with (nat_to_group r' (nat_of_P (pos_abs (ax3 p))));
auto with algebra.
intros p; try assumption.
apply
Trans with (group_inverse G (nat_to_group r (nat_of_P (pos_abs (ax3 p)))));
auto with algebra.
apply
Trans with (group_inverse G (nat_to_group r' (nat_of_P (pos_abs (ax3 p)))));
auto with algebra.
Qed.
Hint Resolve Z_to_group_nat_fun_comp: algebra.
Lemma Z_to_group_nat_neg :
forall (p : positive) (r : G),
Equal (Z_to_group_nat_fun r (Zneg p))
(Z_to_group_nat_fun (group_inverse G r) (Zpos p)).
intros p r; try assumption.
apply
Trans with (group_inverse G (nat_to_group r (nat_of_P (pos_abs (ax3 p)))));
auto with algebra.
apply
Trans with (nat_to_group (group_inverse G r) (nat_of_P (pos_abs (ax3 p))));
auto with algebra.
Qed.
Hint Resolve Z_to_group_nat_neg: algebra.
Lemma Z_to_group_nat_inv :
forall (n : Z) (r : G),
Equal (Z_to_group_nat_fun r (- n)%Z)
(Z_to_group_nat_fun (group_inverse G r) n).
simple induction n; simpl in |- *.
intros r; try assumption.
apply Trans with (monoid_unit G); auto with algebra.
auto with algebra.
intros p r; try assumption.
apply
Trans
with (Z_to_group_nat_fun (group_inverse G (group_inverse G r)) (Zpos p));
auto with algebra.
Qed.
Hint Resolve Z_to_group_nat_inv: algebra.
Lemma nat_to_group_mult :
forall (r : G) (n m : nat),
Equal (nat_to_group r (n * m)) (nat_to_group (nat_to_group r n) m).
simple induction m; simpl in |- *.
rewrite mult_comm; simpl in |- *; auto with algebra.
intros n0 H'; try assumption.
rewrite mult_comm; simpl in |- *; auto with algebra.
simpl in |- *.
apply Trans with (sgroup_law G (nat_to_group r n) (nat_to_group r (n0 * n)));
auto with algebra.
apply Trans with (sgroup_law G (nat_to_group r (n0 * n)) (nat_to_group r n));
auto with algebra.
apply SGROUP_comp; auto with algebra.
rewrite mult_comm; simpl in |- *; auto with algebra.
Qed.
Hint Resolve nat_to_group_mult: algebra.
Lemma nat_to_group_unit :
forall n : nat, Equal (nat_to_group (monoid_unit G) n) (monoid_unit G).
simple induction n; simpl in |- *; auto with algebra.
intros n0 H'; try assumption.
apply Trans with (sgroup_law G (monoid_unit G) (monoid_unit G));
auto with algebra.
Qed.
Hint Resolve nat_to_group_unit: algebra.
Lemma Z_to_group_nat_unit :
forall n : Z, Equal (Z_to_group_nat_fun (monoid_unit G) n) (monoid_unit G).
simple induction n; simpl in |- *; auto with algebra.
intros p; try assumption.
apply Trans with (nat_to_group (monoid_unit G) (nat_of_P (pos_abs (ax3 p))));
auto with algebra.
intros p; try assumption.
apply
Trans
with
(group_inverse G
(nat_to_group (monoid_unit G) (nat_of_P (pos_abs (ax3 p)))));
auto with algebra.
apply Trans with (group_inverse G (monoid_unit G)); auto with algebra.
Qed.
Hint Resolve Z_to_group_nat_unit: algebra.
Lemma group_power_plus :
forall (g : G) (n m : ZZ),
Equal (group_power G g (sgroup_law ZZ n m))
(sgroup_law G (group_power G g n) (group_power G g m)).
unfold group_power in |- *; auto with algebra.
Qed.
Hint Resolve group_power_plus: algebra.
Lemma group_power_S :
forall (g : G) (n : ZZ),
Equal (group_power G g (sgroup_law ZZ n (ring_unit ZZ)))
(sgroup_law G (group_power G g n) g).
unfold group_power in |- *.
simpl in |- *.
intros g n; try assumption.
apply
Trans
with (sgroup_law G (Z_to_group_fun g n) (Z_to_group_fun g (ring_unit Zr)));
auto with algebra.
Qed.
Hint Resolve group_power_S: algebra.
Lemma group_power_0 :
forall g : G, Equal (group_power G g (monoid_unit ZZ)) (monoid_unit G).
unfold group_power in |- *.
simpl in |- *.
intros g; try assumption.
apply Trans with (Z_to_group_nat_fun g 0%Z); auto with algebra.
Qed.
Hint Resolve group_power_0: algebra.
Lemma group_power_1 : forall g : G, Equal (group_power G g (ring_unit ZZ)) g.
intros g; try assumption.
apply
Trans with (group_power G g (sgroup_law ZZ (monoid_unit ZZ) (ring_unit ZZ)));
auto with algebra.
Qed.
Hint Resolve group_power_1: algebra.
Lemma group_power_inv :
forall (g : G) (n : ZZ),
Equal (group_power G g (group_inverse ZZ n))
(group_power G (group_inverse G g) n).
unfold group_power in |- *.
intros g n; try assumption.
simpl in |- *.
apply Trans with (Z_to_group_nat_fun g (group_inverse ZZ n));
auto with algebra.
apply Trans with (Z_to_group_nat_fun (group_inverse G g) n);
auto with algebra.
Qed.
Hint Resolve group_power_inv: algebra.
Lemma Z_group_nat_fun_mult_pos :
forall (p q : positive) (g : G),
Equal (Z_to_group_nat_fun g (Zpos p * Zpos q)%Z)
(Z_to_group_nat_fun (Z_to_group_nat_fun g (Zpos p)) (Zpos q)).
simpl in |- *.
intros p q g; try assumption.
apply
Trans
with
(nat_to_group g
(nat_of_P
(pos_abs
(ax3
((fun (x : positive) (_ : positive -> positive)
(y : positive) => (x * y)%positive) p
(fun y : positive => y) q)))));
auto with algebra.
apply
Trans
with
(nat_to_group (Z_to_group_nat_fun g (Zpos p))
(nat_of_P (pos_abs (ax3 q)))); auto with algebra.
simpl in |- *.
rewrite
(fun (x y : positive) (_ : positive -> positive) =>
nat_of_P_mult_morphism x y).
apply Trans with (nat_to_group (nat_to_group g (nat_of_P p)) (nat_of_P q));
auto with algebra.
Qed.
Hint Resolve Z_group_nat_fun_mult_pos: algebra.
Lemma group_power_mult :
forall (g : G) (n m : ZZ),
Equal (group_power G g (ring_mult n m))
(group_power G (group_power G g n) m).
unfold group_power in |- *.
intros g n m; try assumption.
simpl in |- *.
apply Trans with (Z_to_group_nat_fun g (ring_mult n m)); auto with algebra.
apply Trans with (Z_to_group_nat_fun (Z_to_group_nat_fun g n) m);
auto with algebra.
unfold ring_mult in |- *; simpl in |- *.
elim m.
rewrite Zmult_0_r.
apply Trans with (monoid_unit G); auto with algebra.
elim n.
intros p; try assumption.
rewrite Zmult_0_l.
apply Trans with (Z_to_group_nat_fun (monoid_unit G) (Zpos p));
auto with algebra.
auto with algebra.
intros p p0; try assumption.
replace (Zneg p * Zpos p0)%Z with (- (Zpos p * Zpos p0))%Z.
apply
Trans with (Z_to_group_nat_fun (group_inverse G g) (Zpos p * Zpos p0)%Z);
auto with algebra.
apply
Trans
with
(Z_to_group_nat_fun (Z_to_group_nat_fun (group_inverse G g) (Zpos p))
(Zpos p0)); auto with algebra.
rewrite <- Zopp_mult_distr_l_reverse.
auto with algebra.
elim n.
intros p; try assumption.
rewrite Zmult_0_l.
apply Trans with (Z_to_group_nat_fun (monoid_unit G) (Zneg p));
auto with algebra.
intros p p0; try assumption.
replace (Zpos p * Zneg p0)%Z with (- (Zpos p * Zpos p0))%Z.
apply
Trans with (Z_to_group_nat_fun (group_inverse G g) (Zpos p * Zpos p0)%Z);
auto with algebra.
apply
Trans
with
(Z_to_group_nat_fun (group_inverse G (Z_to_group_nat_fun g (Zpos p)))
(Zpos p0)); auto with algebra.
apply
Trans
with
(Z_to_group_nat_fun (Z_to_group_nat_fun (group_inverse G g) (Zpos p))
(Zpos p0)); auto with algebra.
apply Z_to_group_nat_fun_comp; auto with algebra.
apply Trans with (Z_to_group_nat_fun g (Zneg p)); auto with algebra.
replace (Zpos p) with (- Zneg p)%Z.
auto with algebra.
auto with algebra.
intros p p0; try assumption.
replace (Zneg p * Zneg p0)%Z with (- (Zpos p * Zneg p0))%Z.
replace (Zpos p * Zneg p0)%Z with (- (Zpos p * Zpos p0))%Z.
replace (- - (Zpos p * Zpos p0))%Z with (Zpos p * Zpos p0)%Z.
apply
Trans with (Z_to_group_nat_fun (Z_to_group_nat_fun g (Zpos p)) (Zpos p0));
auto with algebra.
apply
Trans
with
(Z_to_group_nat_fun (group_inverse G (Z_to_group_nat_fun g (Zneg p)))
(Zpos p0)); auto with algebra.
apply Z_to_group_nat_fun_comp; auto with algebra.
apply Trans with (group_power G g (Zpos p)); auto with algebra.
apply Trans with (group_inverse G (group_power G g (Zneg p)));
auto with algebra.
apply Sym.
apply GROUP_law_inverse.
apply Trans with (group_power G g (Zneg p + Zpos p)%Z); auto with algebra.
replace (Zneg p) with (- Zpos p)%Z.
rewrite Zplus_opp_l.
auto with algebra.
auto with algebra.
rewrite Zopp_involutive; auto with algebra.
replace (Zneg p0) with (- Zpos p0)%Z.
replace (Zpos p * - Zpos p0)%Z with (- Zpos p0 * Zpos p)%Z.
rewrite Zopp_mult_distr_l_reverse.
rewrite Zmult_comm.
auto with algebra.
rewrite Zmult_comm.
auto with algebra.
auto with algebra.
replace (Zneg p) with (- Zpos p)%Z.
rewrite Zopp_mult_distr_l_reverse.
auto with algebra.
auto with algebra.
apply Trans with (Z_to_group_nat_fun (Z_to_group_fun g n) m);
auto with algebra.
Qed.
Hint Resolve group_power_mult: algebra.
End Lemmas.
Hint Resolve group_power_plus group_power_S group_power_0 group_power_1
group_power_inv group_power_mult: algebra.