(* -*- coding: utf-8 -*- *)
(************************************************************************)
(*         *   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)         *)
(************************************************************************)
(** Binary Integers : results about order predicates *)
(** Initial author : Pierre Crégut (CNET, Lannion, France) *)
(** THIS FILE IS DEPRECATED. It is now almost entirely made of compatibility formulations for results already present in BinInt.Z. *)
Local Open Scope Z_scope.
(*********************************************************)
(** Properties of the order relations on binary integers *)
(** * Trichotomy *)
(**********************************************************************)
(** * Decidability of equality and order on Z *)
Notation dec_eq := Z.eq_decidable (only parsing).
Notation dec_Zle := Z.le_decidable (only parsing).
Notation dec_Zlt := Z.lt_decidable (only parsing).
Register dec_Zne as plugins.omega.dec_Zne.
Register dec_Zgt as plugins.omega.dec_Zgt.
Register dec_Zge as plugins.omega.dec_Zge.
Register not_Zeq as plugins.omega.not_Zeq.
(** * Relating strict and large orders *)
Notation Zgt_iff_lt := Z.gt_lt_iff (only parsing).
Notation Zge_iff_le := Z.ge_le_iff (only parsing).
Register Znot_le_gt as plugins.omega.Znot_le_gt.
Register Znot_lt_ge as plugins.omega.Znot_lt_ge.
Register Znot_ge_lt as plugins.omega.Znot_ge_lt.
Register Znot_gt_le as plugins.omega.Znot_gt_le.
Register not_Zne as plugins.omega.not_Zne.
(** * Equivalence and order properties *)
(** Reflexivity *)
Notation Zeq_le := Z.eq_le_incl (only parsing).
Hint Resolve Z.le_refl: zarith.
(** Antisymmetry *)
Notation Zle_antisym := Z.le_antisymm (only parsing).
(** Asymmetry *)
Notation Zlt_asym := Z.lt_asymm (only parsing).
(** Irreflexivity *)
Notation Zlt_not_eq := Z.lt_neq (only parsing).
(** Large = strict or equal *)
Notation Zlt_le_weak := Z.lt_le_incl (only parsing).
Notation Zle_lt_or_eq_iff := Z.lt_eq_cases (only parsing).
(** Dichotomy *)
Notation Zle_or_lt := Z.le_gt_cases (only parsing).
(** Transitivity of strict orders *)
(** Mixed transitivity *)
(** Transitivity of large orders *)
Hint Resolve Z.le_trans: zarith.
(** * Compatibility of order and operations on Z *)
(** ** Successor *)
(** Compatibility of successor wrt to order *)
Hint Resolve Zsucc_le_compat: zarith.
(** Simplification of successor wrt to order *)
(** Special base instances of order *)
Notation Zlt_succ := Z.lt_succ_diag_r (only parsing).
Notation Zlt_pred := Z.lt_pred_l (only parsing).
(** Relating strict and large order using successor or predecessor *)
(** Weakening order *)
Notation Zle_succ := Z.le_succ_diag_r (only parsing).
Notation Zle_pred := Z.le_pred_l (only parsing).
Notation Zlt_lt_succ := Z.lt_lt_succ_r (only parsing).
Notation Zle_le_succ := Z.le_le_succ_r (only parsing).
Hint Resolve Z.le_succ_diag_r: zarith.
Hint Resolve Z.le_le_succ_r: zarith.
(** Relating order wrt successor and order wrt predecessor *)
(** Relating strict order and large order on positive *)
(** Special cases of ordered integers *)
Hint Immediate Z.eq_le_incl: zarith.
(** Derived lemma *)
(** ** Addition *)
(** Compatibility of addition wrt to order *)
Notation Zplus_lt_le_compat := Z.add_lt_le_mono (only parsing).
Notation Zplus_le_lt_compat := Z.add_le_lt_mono (only parsing).
Notation Zplus_le_compat := Z.add_le_mono (only parsing).
Notation Zplus_lt_compat := Z.add_lt_mono (only parsing).
(** Compatibility of addition wrt to being positive *)
Notation Zplus_le_0_compat := Z.add_nonneg_nonneg (only parsing).
(** Simplification of addition wrt to order *)
(** ** Multiplication *)
(** Compatibility of multiplication by a positive wrt to order *)
(** Simplification of multiplication by a positive wrt to being positive *)
(** Compatibility of multiplication by a positive wrt to being positive *)
Notation Zmult_le_0_compat := Z.mul_nonneg_nonneg (only parsing).
Notation Zmult_lt_0_compat := Z.mul_pos_pos (only parsing).
Notation Zmult_lt_O_compat := Z.mul_pos_pos (only parsing).
(* To remove someday ... *)
(** Simplification of multiplication by a positive wrt to being positive *)
(** ** Square *)
(** Simplification of square wrt order *)
(** * Equivalence between inequalities *)
Notation Zle_plus_swap := Z.le_add_le_sub_r (only parsing).
Notation Zlt_plus_swap := Z.lt_add_lt_sub_r (only parsing).
Notation Zlt_minus_simpl_swap := Z.lt_sub_pos (only parsing).

Lemma Zle_minus_le_0 n m : m <= n -> 0 <= n - m.