(** ** Remaining constants not defined in Stdlib.Init.Nat *)
(** NB: Aliasing [le] is mandatory, since only a Definition can implement an interface Parameter... *)
Definition eq := @Logic.eq nat.
Definition le := Peano.le.
Definition lt := Peano.lt.
(** ** Basic specifications : pred add sub mul *)

(* Specifications: *)
Lemma pred_succ n : pred (S n) = n.
Lemma mul_0_l n : 0 * n = 0.
Lemma lt_succ_r n m : n < S m <-> n <= m.
(** ** Boolean comparisons *)
Lemma eqb_eq n m : eqb n m = true <-> n = m.
#[global]
Instance Decidable_eq_nat : forall (x y : nat), Decidable (eq x y) := {
Decidable_spec := Nat.eqb_eq x y
}.
Lemma leb_le n m : (n <=? m) = true <-> n <= m.
#[global]
Instance Decidable_le_nat : forall (x y : nat), Decidable (x <= y) := {
Decidable_spec := Nat.leb_le x y
}.
Lemma ltb_lt n m : (n <? m) = true <-> n < m.
Lemma compare_lt_iff n m : (n ?= m) = Lt <-> n < m.
Lemma compare_le_iff n m : (n ?= m) <> Gt <-> n <= m.
Lemma compare_antisym n m : (m ?= n) = CompOpp (n ?= m).
Lemma Even_2 n : Even n <-> Even (S (S n)).
Lemma Odd_0 : ~ Odd 0.
End Private_Parity.
Lemma even_spec : forall n, even n = true <-> Even n.
Lemma odd_spec : forall n, odd n = true <-> Odd n.
(** ** Division *)
Lemma divmod_spec : forall x y q u, u <= y ->
let (q',u') := divmod x y q u in
x + (S y)*q + (y-u) = (S y)*q' + (y-u') /\ u' <= y.
Lemma div_mod_eq x y : x = y*(x/y) + x mod y.
(** The [y <> 0] hypothesis is needed to fit in [NAxiomsSig]. *)
Lemma div_mod x y : y <> 0 -> x = y*(x/y) + x mod y.
Lemma mod_bound_pos x y : 0<=x -> 0<y -> 0 <= x mod y < y.
(** ** Square root *)
Lemma sqrt_iter_spec : forall k p q r,
q = p+p -> r<=q ->
let s := sqrt_iter k p q r in
s*s <= k + p*p + (q - r) < (S s)*(S s).
Lemma sqrt_specif n : (sqrt n)*(sqrt n) <= n < S (sqrt n) * S (sqrt n).
Definition sqrt_spec a (Ha:0<=a) := sqrt_specif a.
Lemma sqrt_neg a : a<0 -> sqrt a = 0.
Lemma log2_spec n : 0<n ->
2^(log2 n) <= n < 2^(S (log2 n)).
Lemma log2_nonpos n : n<=0 -> log2 n = 0.
Lemma iter_swap :
forall n (A:Type) (f:A -> A) (x:A),
iter n f (f x) = f (iter n f x).
Lemma iter_succ :
forall n (A:Type) (f:A -> A) (x:A),
iter (S n) f x = f (iter n f x).
Lemma iter_succ_r :
forall n (A:Type) (f:A -> A) (x:A),
iter (S n) f x = iter n f (f x).
Lemma iter_add :
forall p q (A:Type) (f:A -> A) (x:A),
iter (p+q) f x = iter p f (iter q f x).
Lemma iter_ind (A:Type) (f:A -> A) (a:A) (P:nat -> A -> Prop) :
P 0 a ->
(forall n a', P n a' -> P (S n) (f a')) ->
forall n, P n (iter n f a).
Lemma iter_rect (A:Type) (f:A -> A) (a:A) (P:nat -> A -> Type) :
P 0 a ->
(forall n a', P n a' -> P (S n) (f a')) ->
forall n, P n (iter n f a).