(****************************************************************************  IEEE754  :  NDiv  Laurent Thery  ***************************************************************************** Definition of the quotient and divisibility for natural and relative numbers*)
Require Export Omega.
Require Export Paux.
Definition oZ1 (x : Option positive) :=
match x with
| None => 0%Z
| Some z => Zpos z
end.
(* We use the  function Pdiv function to build our Zquotient*)
Definition Zquotient (n m : Z) :=
match n, m with
| Z0, _ => 0%Z
| _, Z0 => 0%Z
| Zpos x, Zpos y => match Pdiv x y with
| (x, _) => oZ1 x
end
| Zneg x, Zneg y => match Pdiv x y with
| (x, _) => oZ1 x
end
| Zpos x, Zneg y => match Pdiv x y with
| (x, _) => (- oZ1 x)%Z
end
| Zneg x, Zpos y => match Pdiv x y with
| (x, _) => (- oZ1 x)%Z
end
end.
intros z; case z; simpl in |- *;
try (intros; apply sym_equal; apply inject_nat_convert; auto);
auto.
Qed.
intros z; case z; simpl in |- *; auto with arith.
Qed.
Hint Resolve Zero_le_oZ: arith.
(* It has the required property *)

Theorem ZquotientProp :
forall m n : Z,
n <> 0%Z ->
ex
(fun r : Z =>
m = (Zquotient m n * n + r)%Z /\
(Z.abs (Zquotient m n * n) <= Z.abs m)%Z /\ (Z.abs r < Z.abs n)%Z).