intros a b c d H' H'0; inversion_clear H'; inversion_clear H'0.
apply
congruentDef
with (u := u0 * a + u * u0 * n + u * c) (v := v0 * b + v * v0 * n + v * d).
repeat rewrite mult_plus_distr_r.
repeat rewrite plus_assoc.
rewrite (mult_comm u0); rewrite (mult_comm v0).
repeat rewrite mult_assoc_reverse.
repeat rewrite (mult_comm a); repeat rewrite (mult_comm b).
repeat rewrite <- mult_plus_distr_r.
repeat rewrite mult_assoc.
repeat rewrite mult_comm with (m := n).
rewrite (mult_assoc n u); rewrite (mult_assoc n v).
repeat rewrite mult_assoc.
repeat rewrite (mult_assoc_reverse n n).
rewrite mult_comm with (m := n * u); rewrite mult_comm with (m := n * v).
repeat rewrite mult_assoc_reverse with (m := n).
repeat rewrite (mult_comm (n * u)); repeat rewrite (mult_comm (n * v)).
repeat rewrite plus_assoc_reverse; repeat rewrite <- mult_plus_distr_r.
rewrite plus_comm with (m := c); rewrite plus_comm with (m := d).
repeat rewrite (mult_comm (c + n * u0));
repeat rewrite (mult_comm (d + n * v0)).
repeat rewrite (mult_comm (c + n * u0));
repeat rewrite (mult_comm (d + n * v0)).
repeat rewrite <- mult_plus_distr_r.
repeat rewrite (mult_comm n); rewrite H; auto.
Qed.

Lemma cong_pow :
forall a b c : nat, congruent a b -> congruent (power a c) (power b c).