(** This file contains some notions of number theory upon Z numbers:
     - a divisibility predicate [Z.divide]
     - a gcd predicate [gcd]
     - Euclid algorithm [extgcd]
     - a relatively prime predicate [rel_prime]
     - a prime predicate [prime]
     - properties of the efficient [Z.gcd] function
*)

(** The former specialized inductive predicate [Z.divide] is now
    a generic existential predicate. *)

(** Its former constructor is now a pseudo-constructor. *)

Definition Zdivide_intro a b q (H:b=q*a) : Z.divide a b := ex_intro _ q H.(** Results concerning divisibility*)

Notation Zone_divide := Z.divide_1_l (only parsing).Notation Zdivide_0 := Z.divide_0_r (only parsing).Notation Zmult_divide_compat_l := Z.mul_divide_mono_l (only parsing).Notation Zmult_divide_compat_r := Z.mul_divide_mono_r (only parsing).Notation Zdivide_plus_r := Z.divide_add_r (only parsing).Notation Zdivide_minus_l := Z.divide_sub_r (only parsing).Notation Zdivide_mult_l := Z.divide_mul_l (only parsing).Notation Zdivide_mult_r := Z.divide_mul_r (only parsing).Notation Zdivide_factor_r := Z.divide_factor_l (only parsing).Notation Zdivide_factor_l := Z.divide_factor_r (only parsing).

(* Specifications: *)
Lemma Zdivide_opp_r a b : (a | b) -> (a | - b).
Lemma Zdivide_opp_r_rev a b : (a | - b) -> (a | b).
Lemma Zdivide_opp_l a b : (a | b) -> (- a | b).
Lemma Zdivide_opp_l_rev a b : (- a | b) -> (a | b).
Theorem Zdivide_Zabs_l a b : (Z.abs a | b) -> (a | b).
Theorem Zdivide_Zabs_inv_l a b : (a | b) -> (Z.abs a | b).
Lemma Zmult_one x y : x >= 0 -> x * y = 1 -> x = 1.