(* Maximum *)

Definition CRmax {R : ConstructiveReals} (x y : CRcarrier R) : CRcarrier R
  := (x + y + CRabs _ (y - x)) * CR_of_Q _ (1#2).Add Parametric Morphism {R : ConstructiveReals} : CRmax
    with signature (CReq R) ==> (CReq R) ==> (CReq R)
      as CRmax_morph.#[global]
Instance CRmax_morphT
  : forall {R : ConstructiveReals},
    CMorphisms.Proper
      (CMorphisms.respectful (CReq R) (CMorphisms.respectful (CReq R) (CReq R))) (@CRmax R).

Lemma CRmorph_min : forall {R1 R2 : ConstructiveReals} (f : @ConstructiveRealsMorphism R1 R2) (a b : CRcarrier R1), CRmorph f (CRmin a b) == CRmin (CRmorph f a) (CRmorph f b).