Section FiniteCyclicGroupProperties.
Context`{FCG : FiniteCyclicGroup}.
induction c1; intuition; simpl in *.
rewrite <- plus_assoc.
rewrite (groupExp_plus order).
rewrite groupOrder; trivial.
rewrite groupIdent; trivial.
rewrite left_identity.
rewrite IHc1;
trivial.
Qed.
intuition.
destruct (modNat_correct x order).
destruct (modNat_correct y order).
rewrite H1.
rewrite H2.
rewrite H0.
repeat rewrite groupExp_eq_h; eauto using modNat_lt.
Qed.
intuition.
rewrite <- (group_cyclic g x).
rewrite <- (group_cyclic g y).
repeat rewrite <- groupExp_plus.
f_equal.
omega.
apply g_generator.
apply g_generator.
Qed.
induction n; intuition; simpl in *.
rewrite left_identity.
trivial.
rewrite IHn.
repeat rewrite associativity.
f_equal.
rewrite commutativity.
repeat rewrite associativity.
f_equal.
apply commutativity.
Qed.
intuition.
erewrite <- groupLog_correct; eauto.
erewrite <- (groupLog_correct _ y); eauto.
f_equal.
f_equal.
trivial.
Qed.
intuition.
rewrite <- (group_cyclic g x).
rewrite <- (@groupIdent _ groupOp ident _ G _ _ _ FCG g).
eapply groupExp_eq_if; trivial.
apply g_generator.
rewrite <- (group_cyclic g y) in H; eauto.
rewrite <- (group_cyclic g x) in H; eauto.
rewrite <- groupExp_plus in H.
apply groupExp_eq in H; trivial.
eapply modNat_add_same_r.
eauto.
apply g_generator.
apply g_generator.
apply g_generator.
apply g_generator.
apply g_generator.
Qed.

Theorem groupExp_mod : forall g n,
generator g ->
g^n = g^(modNat n order).