Module NZQuot := Nop <+ NZDivProp A Quot2Div B.
End Private_Div.
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].
(** Another formulation of the main equation *)
(** A few sign rules (simple ones) *)
(** A division of a small number by a bigger one yields zero. *)
(** The sign of [a rem b] is the one of [a] (when it's not null) *)
(** Operations and absolute value *)
(** We have a general bound for absolute values *)
(** * Order results about rem and quot *)
(** A modulo cannot grow beyond its starting point. *)
(** As soon as the divisor is strictly greater than 1, the division is strictly decreasing. *)
(** With this choice of division, rounding of quot is always done toward zero: *)
(** For positive numbers, considering [S (a÷b)] leads to an upper bound for [a] *)
(** Inequality [mul_quot_le] is exact iff the modulo is zero. *)
(** Some additional inequalities about quot. *)
(** A division respects opposite monotonicity for the divisor *)
(** Cancellations. *)
(** Operations modulo. *)
(** addition and modulo  Generally speaking, unlike with other conventions, we don't have [(a+b) rem n = (a rem n + b rem n) rem n] for any a and b. For instance, take (8 + (-10)) rem 3 = -2 whereas (8 rem 3 + (-10 rem 3)) rem 3 = 1. *)

Lemma add_rem_idemp_r : forall a b n, n~=0 -> 0 <= a*b ->
(a+(b rem n)) rem n == (a+b) rem n.