(************************************************************************)
(*         *      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)         *)
(************************************************************************)
(*                      Evgeny Makarov, INRIA, 2007                     *)
(************************************************************************)
(** * Lemmas about orders for modules implementing [NZOrdSig']  This file defines the [NZOrderProp] functor type, meant to be [Include]d in a module implementing the [NZOrdSig'] module type.  It contains lemmas and tactics about [le], [lt] and [eq].  The firt part contains important basic lemmas about [le] and [lt], for instance - [succ_lt_mono], [succ_le_mono], [lt_succ_diag_r], [le_succ_diag_r], ... - [le_refl], [le_antisymm], [lt_asymm], [le_trans], [lt_trans], ... - decidability lemmas like [le_gt_cases], [eq_decidable], ... It also adds the following tactics: - [le_elim H] to reason by cases on an hypothesis [(H) : n <= m] - the domain-agnostic [order] (see [Stdlib.Structures.OrdersTac]) and [order'] which knows that [0 < 1 < 2]  The second part proves many induction principles involving the orders and defines the tactic notation [nzord_induct]. *)
From Stdlib.Numbers.NatInt Require Import NZAxioms NZBase.
From Stdlib.Logic Require Import Decidable.
From Stdlib.Structures Require Import OrdersTac.
Module Type NZOrderProp
(Import NZ : NZOrdSig')(Import NZBase : NZBaseProp NZ).
(** ** Basic facts about [le], [lt], [eq] and [succ] *)
(** *** Direct consequences of the specifications of [lt] and [le] *)
#[global]
Instance le_wd : Proper (eq==>eq==>iff) le.
Ltac le_elim H := rewrite lt_eq_cases in H; destruct H as [H | H].

(* Specifications: *)
Theorem lt_le_incl : forall n m, n < m -> n <= m.
Theorem le_refl : forall n, n <= n.
Theorem lt_succ_diag_r : forall n, n < S n.
Theorem le_succ_diag_r : forall n, n <= S n.
Theorem neq_succ_diag_l : forall n, S n ~= n.
Theorem neq_succ_diag_r : forall n, n ~= S n.
Theorem nlt_succ_diag_l : forall n, ~ S n < n.
Theorem nle_succ_diag_l : forall n, ~ S n <= n.
Theorem le_succ_l : forall n m, S n <= m <-> n < m.
(** Trichotomy *)
Theorem le_gt_cases : forall n m, n <= m \/ n > m.
Theorem lt_trichotomy : forall n m,  n < m \/ n == m \/ m < n.
Notation lt_eq_gt_cases := lt_trichotomy (only parsing).