(************************************************************************)
(*         *      The Rocq Prover / The Rocq Development Team           *)
(*  v      *         Copyright INRIA, CNRS and contributors             *)
(* <O___,, * (see version control and CREDITS file for authors & dates) *)
(*   \VV/  **************************************************************)
(*    //   *    This file is distributed under the terms of the         *)
(*         *     GNU Lesser General Public License Version 2.1          *)
(*         *     (see LICENSE file for the text of the license)         *)
(************************************************************************)
(** Properties of Euclidean Division *)
Module Type NDivProp (Import N : NAxiomsSig')(Import NP : NSubProp N).
(** We benefit from what already exists for NZ *)
Module Import Private_NZDiv := Nop <+ NZDivProp N N NP.
Ltac auto' := try rewrite <- neq_0_lt_0; auto using le_0_l.
(** Let's now state again theorems, but without useless hypothesis. *)

(* Specifications: *)
Lemma mod_upper_bound : forall a b, b ~= 0 -> a mod b < b.
(** Uniqueness theorems *)
Theorem div_mod_unique :
forall b q1 q2 r1 r2, r1<b -> r2<b ->
b*q1+r1 == b*q2+r2 -> q1 == q2 /\ r1 == r2.
Lemma add_mul_mod_distr_r : forall a b c d, b~=0 -> 0<=d<c ->
(a*c+d) mod (b*c) == (a mod b)*c+d.