Register dec_lt as num.nat.dec_lt.
Register dec_ge as num.nat.dec_ge.
Register dec_gt as num.nat.dec_gt.
Register not_eq as num.nat.not_eq.
Register not_le as num.nat.not_le.
Register not_lt as num.nat.not_lt.
Register not_ge as num.nat.not_ge.
Register not_gt as num.nat.not_gt.
(** A ternary comparison function in the spirit of [Z.compare]. See now [Nat.compare] and its properties. In scope [nat_scope], the notation for [Nat.compare] is "?=" *)
Notation nat_compare_S := Nat.compare_succ (only parsing).

(* Specifications: *)
Lemma nat_compare_lt n m : n<m <-> (n ?= m) = Lt.
Lemma nat_compare_gt n m : n>m <-> (n ?= m) = Gt.
Lemma nat_compare_le n m : n<=m <-> (n ?= m) <> Gt.
Lemma nat_compare_ge n m : n>=m <-> (n ?= m) <> Lt.
(** Some projections of the above equivalences. *)
Lemma nat_compare_eq n m : (n ?= m) = Eq -> n = m.
Lemma nat_compare_Lt_lt n m : (n ?= m) = Lt -> n<m.
Lemma nat_compare_Gt_gt n m : (n ?= m) = Gt -> n>m.
Definition nat_compare_alt (n m:nat) :=
match lt_eq_lt_dec n m with
| inleft (left _) => Lt
| inleft (right _) => Eq
| inright _ => Gt
end.