Section pos_def.
Variable r : G.
Fixpoint pos_to_group (p : positive) : G :=
match p with
| xH => r
| xO p' => group_square G (pos_to_group p')
| xI p' => sgroup_law G (group_square G (pos_to_group p')) r
end.
simple induction p; simpl in |- *.
intros p0 H'; try assumption.
rewrite ZL6.
unfold group_square in |- *.
apply
Trans
with
(sgroup_law G
(sgroup_law G (nat_to_group r (nat_of_P p0))
(nat_to_group r (nat_of_P p0))) r); auto with *.
unfold group_square in |- *.
intros p0 H'; try assumption.
unfold nat_of_P in |- *.
simpl in |- *.
rewrite ZL6.
apply
Trans
with
(sgroup_law G (nat_to_group r (nat_of_P p0))
(nat_to_group r (nat_of_P p0))); auto with *.
auto with *.
Qed.
End pos_def.
Hint Resolve pos_nat_group: algebra.
Variable r : G.
Definition Z_to_group_fun : ZZ -> G.
intros x.
case (Z_gt_le_dec x 0); intros z.
exact (pos_to_group r (pos_abs z)).
case (Z_le_lt_eq_dec _ _ z); intros.
cut (- x > 0)%Z.
intros H'.
exact (pos_to_group (group_inverse G r) (pos_abs H')).
apply Zlemma1.
auto with *.
exact (monoid_unit G).
Defined.
simple induction n; simpl in |- *; auto with *.
intros n0 H' r0; try assumption.
apply
Trans
with
(sgroup_law G (group_inverse G r0) (group_inverse G (nat_to_group r0 n0)));
auto with *.
apply
Trans
with
(sgroup_law G (group_inverse G r0) (nat_to_group (group_inverse G r0) n0));
auto with *.
Qed.
Hint Resolve nat_to_group_inverse: algebra.

Lemma Z_to_group_fun_eq :
forall z : ZZ, Equal (Z_to_group_fun z) (Z_to_group_nat r z).