(* Copyright 2001, 2009 Luc Rutten  This file is part of ModRed.  ModRed is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.  ModRed is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.  You should have received a copy of the GNU Lesser General Public License along with ModRed.  If not, see <http://www.gnu.org/licenses/>. *)
(* Preparations for fast modular reduction lemmas. *)
(* Coq 8.2 *)
Open Scope Z_scope.
Definition in_Z_ (m x : Z) := 0 <= x < m.
Definition Z_ (m : Z) := sig (in_Z_ m).
Coercion Z_from_Z_ (m : Z) (x : Z_ m) := proj1_sig (P := in_Z_ m) x.
Notation _Z := (Z_from_Z_ _).
Definition in_Zpls (x : Z) := 0 < x.
Definition Zpls := sig in_Zpls.
Coercion Zpls_ (x : Zpls) := proj1_sig (P := in_Zpls) x.
intros n i. case i. unfold in_Z_. simpl. tauto. Qed.
intros n i. case i. unfold in_Z_. simpl. tauto. Qed.
intros x m H. elim (Z_mod_lt x m); omega. Qed.
intros x m H. elim (Z_mod_lt x m); omega. Qed.

Lemma Zdiv_small_0 : forall x m : Z, 0 <= x -> x < m -> x / m = 0.