Section Zup1.
Variable G : GROUP.
Variable r : G.
Fixpoint nat_to_group (n : nat) : G :=
match n with
| O => monoid_unit G
| S n' => sgroup_law G (nat_to_group n') r
end.
Definition pos_abs : forall x : Z, (x > 0)%Z -> positive.
intros x; try assumption.
case x.
intros H'; red in H'.
simpl in H'.
inversion H'.
intros p H'.
exact p.
intros p H'; red in H'.
simpl in H'.
inversion H'.
Defined.
intros x; try assumption.
elim x.
intros px; red in px.
simpl in px.
inversion px.
simpl in |- *.
auto with *.
intros p px; red in px.
simpl in px.
inversion px.
Qed.
intros a b c; try assumption.
unfold Z.lt, not in |- *.
intros H'; try assumption.
rewrite <- H'.
apply Zcompare_plus_compat; assumption.
Qed.
intros x H'; try assumption.
apply Z.lt_gt.
replace (- x)%Z with (- x + 0)%Z.
pattern 0%Z at 1 in |- *.
replace 0%Z with (- x + x)%Z.
apply Zlt_reg_l.
auto with *.
apply Zplus_opp_l.
apply Zplus_0_r.
Qed.
Comments "The powers of" r ".".
Definition Z_to_group_nat_fun : ZZ -> G.
intros x.
case (Z_gt_le_dec x 0); intros z.
exact (nat_to_group (nat_of_P (pos_abs z))).
case (Z_le_lt_eq_dec _ _ z); intros.
cut (- x > 0)%Z.
intros H'.
exact (group_inverse G (nat_to_group (nat_of_P (pos_abs H')))).
apply Zlemma1.
auto with *.
exact (monoid_unit G).
Defined.
simple induction n; simpl in |- *; auto with *.
apply Trans with r; auto with *.
intros n0 H'; try assumption.
apply Trans with (sgroup_law G (sgroup_law G r (nat_to_group n0)) r);
auto with *.
Qed.
Hint Resolve nat_to_group_com: algebra.
simple induction n; simpl in |- *.
auto with *.
intros n0 H' m; try assumption.
apply
Trans
with (sgroup_law G (nat_to_group n0) (sgroup_law G r (nat_to_group m)));
auto with *.
apply
Trans
with (sgroup_law G (nat_to_group n0) (sgroup_law G (nat_to_group m) r));
auto with *.
apply
Trans
with (sgroup_law G (sgroup_law G (nat_to_group n0) (nat_to_group m)) r);
auto with *.
Qed.
Hint Resolve nat_to_group_add: algebra.
red in |- *.
intros H'; try assumption.
red in H'.
simpl in H'.
inversion H'.
Qed.
Hint Resolve ax1: algebra.
red in |- *.
intros H'; try assumption.
red in H'.
simpl in H'.
inversion H'.
Qed.
Hint Resolve ax2: algebra.
unfold Z_to_group_nat_fun in |- *.
case (Z_gt_le_dec 0 0).
intros z; try assumption.
absurd (0 > 0)%Z; auto with *.
intros z; try assumption.
case (Z_le_lt_eq_dec 0 0 z).
intros z0; try assumption.
absurd (0 < 0)%Z; auto with *.
auto with *.
Qed.
Hint Resolve Zl1: algebra.
intros p; try assumption.
red in |- *.
simpl in |- *.
auto with *.
Qed.
Hint Resolve ax3: algebra.
intros p; try assumption.
unfold Z_to_group_nat_fun in |- *.
case (Z_gt_le_dec (Zpos p) 0); intros z.
simpl in |- *; auto with *.
case (Z_le_lt_eq_dec (Zpos p) 0 z); intros.
absurd (Zpos p < 0)%Z; auto with *.
inversion e.
Qed.
Hint Resolve Zl2: algebra.
intros p; red in |- *.
intros H'; try assumption.
red in H'.
simpl in H'.
inversion H'.
Qed.
Hint Resolve ax4: algebra.
intros p; try assumption.
unfold Z_to_group_nat_fun in |- *.
case (Z_gt_le_dec (Zneg p) 0); intros z.
absurd (Zneg p > 0)%Z; auto with *.
case (Z_le_lt_eq_dec (Zneg p) 0 z); intros.
simpl in |- *; auto with *.
inversion e.
Qed.
Hint Resolve Zl3: algebra.
intros p q H'; red in H'.
simpl in H'.
simpl in |- *.
rewrite Z.pos_sub_spec.
rewrite H'.
auto with *.
Qed.
intros p q H'; red in H'.
simpl in H'.
simpl in |- *.
rewrite Z.pos_sub_spec.
rewrite H'.
auto with *.
Qed.
intros p; try assumption.
simpl in |- *.
rewrite Z.pos_sub_spec; unfold Pos.compare.
replace (Pcompare p p Datatypes.Eq) with Datatypes.Eq.
auto with *.
elim p.
intros p0; simpl in |- *.
auto with *.
intros p0; simpl in |- *.
auto with *.
simpl in |- *.
auto with *.
Qed.
Hint Resolve ax7 ax6 ax5: algebra.
simple induction n; simpl in |- *; auto with *.
intros m; try assumption.
apply Trans with (nat_to_group m); auto with *.
intros n0 H' m; try assumption.
apply
Trans
with (sgroup_law G (nat_to_group n0) (sgroup_law G r (nat_to_group m)));
auto with *.
apply
Trans
with (sgroup_law G (nat_to_group n0) (sgroup_law G (nat_to_group m) r));
auto with *.
apply
Trans
with (sgroup_law G (sgroup_law G (nat_to_group n0) (nat_to_group m)) r);
auto with *.
apply
Trans
with (sgroup_law G (sgroup_law G (nat_to_group m) (nat_to_group n0)) r);
auto with *.
Qed.
Hint Resolve nat_to_group_com2: algebra.
intros n m H'; try assumption.
replace n with (m + (n - m)).
rewrite minus_plus.
apply
Trans
with
(sgroup_law G (sgroup_law G (nat_to_group m) (nat_to_group (n - m)))
(group_inverse G (nat_to_group m))); auto with *.
apply GROUP_reg_right with (nat_to_group m); auto with *.
apply
Trans
with
(sgroup_law G (sgroup_law G (nat_to_group m) (nat_to_group (n - m)))
(sgroup_law G (group_inverse G (nat_to_group m)) (nat_to_group m)));
auto with *.
apply
Trans
with
(sgroup_law G (sgroup_law G (nat_to_group m) (nat_to_group (n - m)))
(monoid_unit G)); auto with *.
apply Trans with (sgroup_law G (nat_to_group m) (nat_to_group (n - m)));
auto with *.
auto with *.
Qed.
Hint Resolve nat_to_group_minus: algebra.
intros p q H'; try assumption.
apply nat_of_P_gt_Gt_compare_complement_morphism.
red in |- *.
apply nat_of_P_lt_Lt_compare_morphism; auto with *.
Qed.
Hint Resolve ax8: algebra.
intros p p0; try assumption.
case (Z_gt_le_dec (Zpos p) (Zpos p0)); intros z.
rewrite ax5; auto with *.
apply Trans with (nat_to_group (nat_of_P (pos_abs (ax3 (p - p0)))));
auto with *.
simpl in |- *.
rewrite nat_of_P_minus_morphism; auto with *.
apply nat_to_group_minus.
apply nat_of_P_gt_Gt_compare_morphism.
auto with *.
case (Z_le_lt_eq_dec _ _ z); intros.
rewrite ax6; auto with *.
apply
Trans
with (group_inverse G (nat_to_group (nat_of_P (pos_abs (ax3 (p0 - p))))));
auto with *.
simpl in |- *.
rewrite nat_of_P_minus_morphism; auto with *.
apply
Trans
with
(group_inverse G
(sgroup_law G (nat_to_group (nat_of_P p0))
(group_inverse G (nat_to_group (nat_of_P p)))));
auto with *.
apply GROUP_comp.
apply nat_to_group_minus.
apply nat_of_P_gt_Gt_compare_morphism.
auto with *.
apply
Trans
with
(sgroup_law G
(group_inverse G (group_inverse G (nat_to_group (nat_of_P p))))
(group_inverse G (nat_to_group (nat_of_P p0))));
auto with *.
injection e.
intros H'; try assumption.
rewrite <- H'.
rewrite ax7.
apply Trans with (monoid_unit G); auto with *.
Qed.
Hint Resolve Zl4: algebra.
simple induction n; simpl in |- *; auto with *.
apply Trans with (group_inverse G r); auto with *.
intros n0 H'; try assumption.
apply
Trans
with (sgroup_law G (nat_to_group n0) (sgroup_law G r (group_inverse G r)));
auto with *.
apply Trans with (sgroup_law G (nat_to_group n0) (monoid_unit G));
auto with *.
apply Trans with (nat_to_group n0); auto with *.
apply
Trans
with (sgroup_law G (group_inverse G r) (sgroup_law G r (nat_to_group n0)));
auto with *.
apply
Trans
with (sgroup_law G (sgroup_law G (group_inverse G r) r) (nat_to_group n0));
auto with *.
apply Trans with (sgroup_law G (monoid_unit G) (nat_to_group n0));
auto with *.
Qed.
Hint Resolve nat_to_group_com3: algebra.
unfold Z_to_group_nat_fun in |- *.
case (Z_gt_le_dec (ring_unit ZZ) 0).
intros z; try assumption.
simpl in |- *.
auto with *.
intros z; try assumption.
case (Z_le_lt_eq_dec (ring_unit ZZ) 0 z).
intros z0; try assumption.
absurd (ring_unit ZZ < 0)%Z; auto with *.
intros H'; try assumption.
inversion H'.
Qed.
Hint Resolve Zl5: algebra.

Lemma nat_to_group_com4 :
forall n m : nat,
Equal (sgroup_law G (nat_to_group m) (group_inverse G (nat_to_group n)))
(sgroup_law G (group_inverse G (nat_to_group n)) (nat_to_group m)).