Section nat_hsOrd.
#[local]
Instance nat_isProset : isProset nat :=
{ leProp := Nat.le
; Proset_isSetoid := mkSetoid_from_eq
; leProp_PreOrder := Nat.le_preorder
; leProp_PartialOrder := Nat.le_partialorder
}.
Fixpoint nat_compare (x : nat) (y : nat) {struct x} : comparison :=
match x, y with
| O, O => Eq
| O, S y' => Lt
| S x', O => Gt
| S x', S y' => nat_compare x' y'
end.
Proof with eauto with *.
revert x y hyp_lt. induction x as [ | x IH], y as [ | y]; simpl; ii.
- inversion hyp_lt.
- split; lia.
- inversion hyp_lt.
- pose proof (IH y hyp_lt) as [x_le_y x_ne_y]. split; lia.
Qed.

Lemma nat_compare_eq (x : nat) (y : nat)
(hyp_eq : nat_compare x y = Eq)
: x = y.