Module Import Private_NZDiv := Nop <+ NZDivProp A D B.
(** Another formulation of the main equation *)
Ltac pos_or_neg a :=
let LT := fresh "LT" in
let LE := fresh "LE" in
destruct (le_gt_cases 0 a) as [LE|LT]; [|rewrite <- opp_pos_neg in LT].
(** Uniqueness theorems *)
(** Sign rules *)
(** 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 when divisor is positive, and Rounding-Toward-Top otherwise.  Since we cannot speak of rational values here, we express this fact by multiplying back by [b], and this leads to a nice unique statement. *)
(** Giving a reversed bound is slightly more complex *)
(** NB: The three 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. *)
(** With the current convention, the following isn't always true when [c<0]: [-3*-1 / -2*-1 = 3/2 = 1] while [-3/-2 = 2] *)
(** Operations modulo. *)

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