Module OT := OTF_to_TotalOrder O.Definition max_l := max_l.Definition max_r := max_r.Definition min_l := min_l.Definition min_r := min_r.Definition compare x y :=
  if eq_dec x y then Eq
  else if eq_dec (M.max x y) y then Lt else Gt.

(* Specifications: *)
Lemma compare_spec x y : CompSpec eq lt x y (compare x y).