(** Properties of Euclidean division and modulus. *)

(* Specifications: *)
Lemma Zdiv_small:
forall x y, 0 <= x < y -> x / y = 0.
Lemma Zmod_small:
forall x y, 0 <= x < y -> x mod y = x.
Lemma Zmod_unique:
forall x y a b,
x = a * y + b -> 0 <= b < y -> x mod y = b.
Lemma Zdiv_unique:
forall x y a b,
x = a * y + b -> 0 <= b < y -> x / y = a.
Lemma Zdiv_Zdiv:
forall a b c,
b > 0 -> c > 0 -> (a / b) / c = a / (b * c).
Lemma Zmult_le_compat_l_neg :
forall n m p:Z, n >= m -> p <= 0 -> p * n <= p * m.
Lemma Zdiv_interval_1:
forall lo hi a b,
lo <= 0 -> hi > 0 -> b > 0 ->
lo * b <= a < hi * b ->
lo <= a/b < hi.
Lemma Zdiv_interval_2:
forall lo hi a b,
lo <= a <= hi -> lo <= 0 -> hi >= 0 -> b > 0 ->
lo <= a/b <= hi.
Lemma Zmod_recombine:
forall x a b,
a > 0 -> b > 0 ->
x mod (a * b) = ((x/b) mod a) * b + (x mod b).
Lemma Zdiv_small:
forall x y, 0 <= x < y -> x / y = 0.
Lemma Zmod_small:
forall x y, 0 <= x < y -> x mod y = x.
Lemma Zmod_unique:
forall x y a b,
x = a * y + b -> 0 <= b < y -> x mod y = b.
Lemma Zdiv_unique:
forall x y a b,
x = a * y + b -> 0 <= b < y -> x / y = a.
Lemma Zdiv_Zdiv:
forall a b c,
b > 0 -> c > 0 -> (a / b) / c = a / (b * c).
Lemma Zmult_le_compat_l_neg :
forall n m p:Z, n >= m -> p <= 0 -> p * n <= p * m.
Lemma Zdiv_interval_1:
forall lo hi a b,
lo <= 0 -> hi > 0 -> b > 0 ->
lo * b <= a < hi * b ->
lo <= a/b < hi.
Lemma Zdiv_interval_2:
forall lo hi a b,
lo <= a <= hi -> lo <= 0 -> hi >= 0 -> b > 0 ->
lo <= a/b <= hi.
Lemma Zmod_recombine:
forall x a b,
a > 0 -> b > 0 ->
x mod (a * b) = ((x/b) mod a) * b + (x mod b).