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.

Lemma nat_to_group_minus :
forall n m : nat,
n > m ->
Equal (nat_to_group (n - m))
(sgroup_law G (nat_to_group n) (group_inverse G (nat_to_group m))).