#[global]
Instance le_partorder : PartialOrder Logic.eq le.
(** ** Comparison and addition *)

(* Specifications: *)
Lemma add_compare_mono_l p q r : (p+q ?= p+r) = (q ?= r).
Lemma add_compare_mono_r p q r : (q+p ?= r+p) = (q ?= r).
(** ** Order and addition *)
Lemma lt_add_diag_r p q : p < p + q.
Lemma add_lt_mono_l p q r : q<r <-> p+q < p+r.
Lemma add_lt_mono_r p q r : q<r <-> q+p < r+p.
Lemma add_lt_mono p q r s : p<q -> r<s -> p+r<q+s.
Lemma add_le_mono_l p q r : q<=r <-> p+q<=p+r.
Lemma add_le_mono_r p q r : q<=r <-> q+p<=r+p.
Lemma add_le_mono p q r s : p<=q -> r<=s -> p+r <= q+s.
(** ** Comparison and multiplication *)
Lemma mul_compare_mono_l p q r : (p*q ?= p*r) = (q ?= r).
Lemma mul_compare_mono_r p q r : (q*p ?= r*p) = (q ?= r).
(** ** Order and multiplication *)
Lemma mul_lt_mono_l p q r : q<r <-> p*q < p*r.
Lemma mul_lt_mono_r p q r : q<r <-> q*p < r*p.
Lemma mul_lt_mono p q r s : p<q -> r<s -> p*r < q*s.
Lemma mul_le_mono_l p q r : q<=r <-> p*q<=p*r.
Lemma mul_le_mono_r p q r : q<=r <-> q*p<=r*p.
Lemma mul_le_mono p q r s : p<=q -> r<=s -> p*r <= q*s.
Lemma lt_add_r p q : p < p+q.
Lemma lt_not_add_l p q : ~ p+q < p.
Lemma pow_gt_1 n p : 1<n -> 1<n^p.
(**********************************************************************)
(** * Properties of subtraction on binary positive numbers *)
Lemma sub_1_r p : sub p 1 = pred p.
Lemma pred_sub p : pred p = sub p 1.
Theorem sub_succ_r p q : p - (succ q) = pred (p - q).
(** ** Properties of subtraction without underflow *)
Lemma sub_mask_pos' p q :
q < p -> exists r, sub_mask p q = IsPos r /\ q + r = p.
Lemma sub_mask_pos p q :
q < p -> exists r, sub_mask p q = IsPos r.
Theorem sub_add p q : q < p -> (p-q)+q = p.
Lemma add_sub p q : (p+q)-q = p.
Lemma mul_sub_distr_l p q r : r<q -> p*(q-r) = p*q-p*r.
Lemma mul_sub_distr_r p q r : q<p -> (p-q)*r = p*r-q*r.
Lemma sub_lt_mono_l p q r: q<p -> p<r -> r-p < r-q.
Lemma sub_compare_mono_l p q r :
q<p -> r<p -> (p-q ?= p-r) = (r ?= q).
Lemma sub_compare_mono_r p q r :
p<q -> p<r -> (q-p ?= r-p) = (q ?= r).
Lemma sub_lt_mono_r p q r : q<p -> r<q -> q-r < p-r.
Lemma sub_decr n m : m<n -> n-m < n.
Lemma add_sub_assoc p q r : r<q -> p+(q-r) = p+q-r.
Lemma sub_add_distr p q r : q+r < p -> p-(q+r) = p-q-r.
Lemma sub_sub_distr p q r : r<q -> q-r < p -> p-(q-r) = p+r-q.
(** Recursive equations for [sub] *)
Lemma sub_xO_xO n m : m<n -> n~0 - m~0 = (n-m)~0.
Lemma sub_xI_xI n m : m<n -> n~1 - m~1 = (n-m)~0.
Lemma sub_xI_xO n m : m<n -> n~1 - m~0 = (n-m)~1.
Lemma sub_xO_xI n m : n~0 - m~1 = pred_double (n-m).
(** Properties of subtraction with underflow *)
Lemma sub_mask_neg_iff' p q : sub_mask p q = IsNeg <-> p < q.
Lemma sub_mask_neg p q : p<q -> sub_mask p q = IsNeg.
Lemma sub_le p q : p<=q -> p-q = 1.
Lemma sub_lt p q : p<q -> p-q = 1.
Lemma sub_diag p : p-p = 1.
(** ** Results concerning [size] and [size_nat] *)
Lemma size_nat_monotone p q : p<q -> (size_nat p <= size_nat q)%nat.
Lemma size_gt p : p < 2^(size p).
Lemma size_le p : 2^(size p) <= p~0.
(** ** Properties of [min] and [max] *)
(** First, the specification *)
Lemma max_l : forall x y, y<=x -> max x y = x.
Lemma max_r : forall x y, x<=y -> max x y = y.
Lemma min_l : forall x y, x<=y -> min x y = x.
Lemma min_r : forall x y, y<=x -> min x y = y.
Include UsualMinMaxLogicalProperties <+ UsualMinMaxDecProperties.