(**
   The constructive formulation of the absolute value on the real numbers.
   This is followed by the constructive definitions of minimum and maximum,
   as min x y := (x + y - |x-y|) / 2.

   WARNING: this file is experimental and likely to change in future releases.
*)


(* If a rational sequence is Cauchy, then so is its absolute value.
   This is how the constructive absolute value is defined.
   A more abstract way to put it is the real numbers are the metric completion
   of the rational numbers, so the uniformly continuous function
   Qabs : Q -> Q
   uniquely extends to a uniformly continuous function
   CReal_abs : CReal -> CReal
*)

Definition CReal_abs_seq (x : CReal) (n : Z) := Qabs (seq x n).Definition CReal_abs_scale (x : CReal) := scale x.

(* Specifications: *)
Lemma CReal_abs_cauchy: forall (x : CReal), QCauchySeq (CReal_abs_seq x).
Lemma CReal_abs_bound : forall (x : CReal), QBound (CReal_abs_seq x) (CReal_abs_scale x).