(************************************************************************)
(*         *      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)         *)
(************************************************************************)
Attributes deprecated(since="8.20",
note="Use floor division or truncation division in BinInt instead.").
From Stdlib.Classes Require Import Morphisms.
From Stdlib.ZArith Require Import BinInt.
#[local]
Set Warnings "-deprecated-library-file".
From Stdlib.Numbers.Integer.Abstract Require Import ZDivEucl.
Local Open Scope Z_scope.
(** * Definitions of division for binary integers, Euclid convention. *)
(** In this convention, the remainder is always positive. For other conventions, see [Z.div] and [Z.quot] in file [BinIntDef]. To avoid collision with the other divisions, we place this one under a module. *)
Module ZEuclid.
Definition modulo a b := Z.modulo a (Z.abs b).
Definition div a b := (Z.sgn b) * (Z.div a (Z.abs b)).
#[global]
Instance mod_wd : Proper (eq==>eq==>eq) modulo.

Lemma mod_bound_pos a b : 0<=a -> 0<b -> 0 <= modulo a b < b.
Include ZEuclidProp Z Z Z.