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 min_r x y : y<=x -> min x y == y.