(************************************************************************)
(*         *   The Coq Proof Assistant / The Coq Development Team       *)
(*  v      *   INRIA, CNRS and contributors - Copyright 1999-2018       *)
(* <O___,, *       (see CREDITS file for the list of authors)           *)
(*   \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)         *)
(************************************************************************)
Hint Resolve Qopp_lt_compat : qarith.
(************)
Local Coercion inject_Z : Z >-> Q.
Definition Qfloor (x:Q) := let (n,d) := x in Z.div n (Zpos d).
Definition Qceiling (x:Q) := (-(Qfloor (-x)))%Z.
Hint Resolve Qfloor_le : qarith.
Hint Resolve Qle_ceiling : qarith.
Hint Resolve Qlt_floor : qarith.
Hint Resolve Qceiling_lt : qarith.
Hint Resolve Qfloor_resp_le : qarith.
Hint Resolve Qceiling_resp_le : qarith.
Add Morphism Qfloor with signature Qeq ==> eq as Qfloor_comp.
Add Morphism Qceiling with signature Qeq ==> eq as Qceiling_comp.

Lemma Zdiv_Qdiv (n m: Z): (n / m)%Z = Qfloor (n / m).