Require Export misc.
Require Export Zstruct.
Require Export ZArith.
Unset Standard Proposition Elimination Names.

(* Specifications: *)
Lemma gcd_unicity_apart_sign :
forall a b c d : Z,
is_gcd Z IdZ Zmult 0%Z a b c ->
is_gcd Z IdZ Zmult 0%Z a b d -> d = c \/ d = (- c)%Z.
Lemma gcd_OZ_absZ : forall b : Z, is_gcd Z IdZ Zmult 0%Z 0%Z b (Zabs b).
Inductive is_gcdZ : Z -> Z -> Z -> Prop :=
| gcd_OZ : forall b : Z, is_gcdZ 0%Z b (Zabs b)
| gcd_mod :
forall b a d q r : Z,
b <> 0%Z ->
(0 <= r < Zabs b)%Z ->
a = (b * q + r)%Z -> is_gcdZ r b d -> is_gcdZ b a d.