Module Import Private_NZDiv := Nop <+ NZDivProp A A B.
(** Another formulation of the main equation *)
(** We have a general bound for absolute values *)
(** Uniqueness theorems *)
Fact opp_mod_bound_or : forall a b, b~=0 ->
0 <= -(a mod b) < -b \/ -b < -(a mod b) <= 0.
(** With the current conventions, the other sign rules are rather complex. *)
(** The sign of [a mod b] is the one of [b] (when it isn't null) *)
(** A division by itself returns 1 *)
(** A division of a small number by a bigger one yields zero. *)
(** * Order results about mod and div *)
(** A modulo cannot grow beyond its starting point. *)
(** As soon as the divisor is strictly greater than 1, the division is strictly decreasing. *)
(** In this convention, [div] performs Rounding-Toward-Bottom.  Since we cannot speak of rational values here, we express this fact by multiplying back by [b], and this leads to separates statements according to the sign of [b].  First, [a/b] is below the exact fraction ... *)
(** ... and moreover it is the larger such integer, since [S(a/b)] is strictly above the exact fraction. *)
(** NB: The four previous properties could be used as specifications for [div]. *)
(** Inequality [mul_div_le] is exact iff the modulo is zero. *)
(** Some additional inequalities about div. *)
(** A division respects opposite monotonicity for the divisor *)
(** Cancellations. *)
(** Operations modulo. *)

Lemma add_mod_idemp_l : forall a b n, n~=0 ->
((a mod n)+b) mod n == (a+b) mod n.