(** The specification of Euclid's algorithm is the existence of
    [u], [v] and [d] such that [ua+vb=d] and [(gcd a b d)]. *)

Inductive Euclid : Set :=
    Euclid_intro :
      forall u v d : Z, (u * a + v * b)%Z = d -> gcd a b d -> Euclid.(** The specification of Euclid's algorithm is the existence of
    [u], [v] and [d] such that [ua+vb=d] and [(gcd a b d)]. *)

Inductive Euclid : Set :=
    Euclid_intro :
      forall u v d : Z, (u * a + v * b)%Z = d -> gcd a b d -> Euclid.

(* Specifications: *)
Lemma euclid_rec : forall v3 : Z, (0 <= v3)%Z -> forall u1 u2 u3 v1 v2 : Z, (u1 * a + u2 * b)%Z = u3 -> (v1 * a + v2 * b)%Z = v3 -> (forall d : Z, gcd u3 v3 d -> gcd a b d) -> Euclid.
Lemma euclid : Euclid.
Theorem gcd_uniqueness_apart_sign : forall a b d d' : Z, gcd a b d -> gcd a b d' -> d = d' \/ d = (- d')%Z.