intros.
elim H;intros.
elim H0;intros.
split.
elim H2;intro q;intro.
elim H3;intro q';intro.
rewrite H4;rewrite mult_assoc.
rewrite H5;rewrite mult_assoc.
split;[exists q;trivial | exists q';trivial].
intros.
elim H4;intros.
elim (bezout d a b);try (unfold is_gcd;unfold is_cd;trivial).
intro u;intro.
elim H7;intro v;intro.
elim H5;intro q;intro.
elim H6;intro q';intro.
case H8;intro;[exists (q*u-q'*v) | exists (q'*v-q*u)];rewrite mult_minus_lemma2;rewrite mult_assoc;rewrite mult_assoc;rewrite <- H9;rewrite <- H10;rewrite H11;rewrite mult_minus_lemma2;rewrite mult_assoc;rewrite mult_assoc;trivial.
Qed.

(** Gauss' theorem (use Bezout) *)
Theorem gauss : forall (d a b:nat),(rel_prime a d)->(divides (a*b) d)->(divides b d).
unfold rel_prime.