Definition modz (m d : int) : int := m - divz m d * d.Notation "m <> n %[mod d ]" := (modz m d <> modz n d) : int_scope.(** Divisibility **)

Fact dvdz_key d : pred_key (dvdz d).Canonical dvdz_keyed d := KeyedPred (dvdz_key d).Fact dvdz_zmod_closed d : zmod_closed (dvdz d).Canonical dvdz_addPred d := AddrPred (dvdz_zmod_closed d).Canonical dvdz_oppPred d := OpprPred (dvdz_zmod_closed d).Canonical dvdz_zmodPred d := ZmodPred (dvdz_zmod_closed d).

(* Specifications: *)
Lemma gcdzC : commutative gcdz.
Lemma gcd1z : left_zero 1 gcdz.
Lemma gcdz1 : right_zero 1 gcdz.
Lemma gcdNz m n : gcdz (- m) n = gcdz m n.
Lemma gcdzN m n : gcdz m (- n) = gcdz m n.
Lemma gcdzMDl q m n : gcdz m (q * m + n) = gcdz m n.
Lemma gcdzDl m n : gcdz m (m + n) = gcdz m n.
Lemma gcdzDr m n : gcdz m (n + m) = gcdz m n.
Lemma gcdzAC : right_commutative gcdz.
Lemma gcdzA : associative gcdz.
Lemma gcdzCA : left_commutative gcdz.
Lemma gcdzACA : interchange gcdz gcdz.
Lemma coprimez_sym : symmetric coprimez.
Lemma coprimeNz m n : coprimez (- m) n = coprimez m n.
Lemma coprimezN m n : coprimez m (- n) = coprimez m n.
Lemma egcdzP m n : egcdz_spec m n (egcdz m n).
Lemma Bezoutz m n : {u : int & {v : int | u * m + v * n = gcdz m n}}.
Lemma Gauss_gcdzr p m n : coprimez p m -> gcdz p (m * n) = gcdz p n.
Lemma Gauss_gcdzl p m n : coprimez p n -> gcdz p (m * n) = gcdz p m.
Lemma coprimez_mulr p m n : coprimez p (m * n) = coprimez p m && coprimez p n.
Lemma coprimez_mull p m n : coprimez (m * n) p = coprimez m p && coprimez n p.
Lemma sgz_contents p : sgz (zcontents p) = sgz (lead_coef p).
Lemma zcontents0 : zcontents 0 = 0.