(** * Greatest common divisor (gcd). *)
   
(** There is no unicity of the gcd; hence we define the
    predicate [gcd a b d] expressing that [d] is a gcd of 
    [a] and [b]. (We show later that the [gcd] is actually
    unique if we discard its sign.) *)

Inductive gcd (a b d : Z) : Prop :=
    gcd_intro :
      (d | a)%Z ->
      (d | b)%Z ->
      (forall x : Z, (x | a)%Z -> (x | b)%Z -> (x | d)%Z) -> gcd a b d.(** * Greatest common divisor (gcd). *)
   
(** There is no unicity of the gcd; hence we define the
    predicate [gcd a b d] expressing that [d] is a gcd of 
    [a] and [b]. (We show later that the [gcd] is actually
    unique if we discard its sign.) *)

Inductive gcd (a b d : Z) : Prop :=
    gcd_intro :
      (d | a)%Z ->
      (d | b)%Z ->
      (forall x : Z, (x | a)%Z -> (x | b)%Z -> (x | d)%Z) -> gcd a b d.

Lemma gcd_for_euclid : forall a b d q : Z, gcd b (a - q * b) d -> gcd a b d.