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.

Lemma Zl2 :
forall p : positive,
Equal (Z_to_group_nat_fun (Zpos p))
(nat_to_group (nat_of_P (pos_abs (ax3 p)))).