(** * Greatest common divisor. *)

Definition common_div (x y : Z) (d : nat) :=
  Divides d (Zabs_nat x) /\ Divides d (Zabs_nat y).Definition gcd (x y : Z) (d : nat) :=
  common_div x y d /\ (forall e : nat, common_div x y e -> e <= d).

Theorem euclid_gcd : forall (d1 d2 : nat) (x y q r : Z), x = (q * y + r)%Z -> gcd x y d1 -> gcd r y d2 -> d1 = d2.