(** ** Specification of successor and predecessor *)

(* Specifications: *)
Lemma succ_pred n : succ (pred n) = n.
Lemma pred_succ n : pred (succ n) = n.
(** ** Specification of subtraction *)
Lemma sub_0_r n : n - 0 = n.
Lemma sub_succ_r n m : n - succ m = pred (n - m).
(** ** Specification of multiplication *)
Lemma mul_0_l n : 0 * n = 0.
Lemma mul_succ_l n m : succ n * m = n * m + m.
(** ** Specification of comparisons and order *)
Lemma eqb_eq n m : (n =? m) = true <-> n = m.
#[global]
Instance Decidable_eq_Z : forall (x y : Z), Decidable (eq x y) := {
Decidable_spec := Z.eqb_eq x y
}.
Lemma ltb_lt n m : (n <? m) = true <-> n < m.
#[global]
Instance Decidable_lt_Z : forall (x y : Z), DecidableClass.Decidable (x < y)%Z := {
Decidable_spec := Z.ltb_lt x y
}.
Lemma leb_le n m : (n <=? m) = true <-> n <= m.
#[global]
Instance Decidable_le_Z : forall (x y : Z), DecidableClass.Decidable (x <= y)%Z := {
Decidable_spec := Z.leb_le x y
}.
Lemma gtb_gt n m : (n >? m) = true <-> n > m.
#[global]
Instance Decidable_gt_Z : forall (x y : Z), DecidableClass.Decidable (x > y)%Z := {
Decidable_spec := Z.gtb_gt x y
}.
Lemma geb_ge n m : (n >=? m) = true <-> n >= m.
#[global]
Instance Decidable_ge_Z : forall (x y : Z), DecidableClass.Decidable (x >= y)%Z := {
Decidable_spec := Z.geb_ge x y
}.
Lemma compare_eq_iff n m : (n ?= m) = Eq <-> n = m.
Lemma compare_sub n m : (n ?= m) = (n - m ?= 0).
Lemma compare_antisym n m : (m ?= n) = CompOpp (n ?= m).
Lemma compare_lt_iff n m : (n ?= m) = Lt <-> n < m.
(** ** Specification of minimum and maximum *)
Lemma max_l n m : m<=n -> max n m = n.
Lemma max_r n m :  n<=m -> max n m = m.
Lemma min_l n m : n<=m -> min n m = n.
Lemma min_r n m : m<=n -> min n m = m.
(** ** Induction principles based on successor / predecessor *)
Lemma peano_ind (P : Z -> Prop) :
P 0 ->
(forall x, P x -> P (succ x)) ->
(forall x, P x -> P (pred x)) ->
forall z, P z.
Lemma bi_induction (P : Z -> Prop) :
Proper (eq ==> iff) P ->
P 0 ->
(forall x, P x <-> P (succ x)) ->
forall z, P z.