(************************************************************************)
(*         *      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)         *)
(************************************************************************)
Local Open Scope Z_scope.
(** * [Z.div_mod_to_equations], [Z.quot_rem_to_equations], [Z.to_euclidean_division_equations]: the tactics for preprocessing [Z.div] and [Z.modulo], [Z.quot] and [Z.rem] *)
(** These tactics use the complete specification of [Z.div] and [Z.modulo] ([Z.quot] and [Z.rem], respectively) to remove these functions from the goal without losing information.  The [Z.euclidean_division_equations_find_duplicate_quotients] tactic poses facts of the form [q₁ = q₂ \/ q₁ <> q₂] for quotients that are likely to be the same, which allows tactics like [nia] to prove more goals, including those relating [Z.div]/[Z.mod] to [Z.quot]/[Z.rem].  The [Z.euclidean_division_equations_cleanup] tactic removes needless hypotheses, which makes tactics like [nia] run faster.  The tactic [Z.to_euclidean_division_equations] combines the handling of both variants of division/quotient and modulo/remainder. *)
Module Z.

Lemma mod_0_r_ext x y : y = 0 -> x mod y = x.