Module Type HasMinMax (E:EqLe) := HasMax E <+ HasMin E.(** ** Any [OrderedTypeFull] can be equipped by [max] and [min]
    based on the compare function. *)

Definition gmax {A} (cmp : A->A->comparison) x y :=
 match cmp x y with Lt => y | _ => x end.Definition gmin {A} (cmp : A->A->comparison) x y :=
 match cmp x y with Gt => y | _ => x end.Definition max := gmax O.compare.Definition min := gmin O.compare.

Lemma max_r x y : x<=y -> max x y == y.