Module Type NGcdProp
(Import A : NAxiomsSig')
(Import B : NSubProp A).
Include NZGcdProp A A B.
(** Results concerning divisibility*)
Definition divide_1_r n : (n | 1) -> n == 1
:= divide_1_r_nonneg n (le_0_l n).
Definition divide_antisym n m : (n | m) -> (m | n) -> n == m
:= divide_antisym_nonneg n m (le_0_l n) (le_0_l m).
(** Properties of gcd *)
Definition gcd_0_l n : gcd 0 n == n := gcd_0_l_nonneg n (le_0_l n).
Definition gcd_0_r n : gcd n 0 == n := gcd_0_r_nonneg n (le_0_l n).
Definition gcd_diag n : gcd n n == n := gcd_diag_nonneg n (le_0_l n).
Definition gcd_unique' n m p := gcd_unique n m p (le_0_l p).
Definition gcd_unique_alt' n m p := gcd_unique_alt n m p (le_0_l p).
Definition divide_gcd_iff' n m := divide_gcd_iff n m (le_0_l n).
(** On natural numbers, we should use a particular form for the Bezout identity, since we don't have full subtraction. *)
Definition Bezout n m p := exists a b, a*n == p + b*m.
Instance Bezout_wd : Proper (eq==>eq==>eq==>iff) Bezout.
(** For strictly positive numbers, we have Bezout in the two directions. *)
(** For arbitrary natural numbers, we could only say that at least one of the Bezout identities holds. *)

Lemma divide_mul_split : forall n m p, n ~= 0 -> (n | m * p) ->
exists q r, n == q*r /\ (q | m) /\ (r | p).