(************************************************************************)
(*         *      The Rocq Prover / The Rocq Development Team           *)
(*  v      *   INRIA, CNRS and contributors - Copyright 1999-2019       *)
(* <O___,, *       (see CREDITS file for the list of authors)           *)
(*   \VV/  **************************************************************)
(*    //   *    This file is distributed under the terms of the         *)
(*         *     GNU Lesser General Public License Version 2.1          *)
(*         *     (see LICENSE file for the text of the license)         *)
(************************************************************************)
Local Open Scope CReal_scope.
Local Ltac simplify_Qabs :=
match goal with |- context [(Qabs ?a)%Q] => ring_simplify a end.
Local Ltac simplify_Qlt :=
match goal with |- (?l < ?r)%Q => ring_simplify l; ring_simplify r end.
Local Lemma Qopp_mult_mone : forall q : Q,
(-1 * q == -q)%Q.
Local Lemma Qabs_involutive: forall q : Q,
(Qabs (Qabs q) == Qabs q)%Q.
(** 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.

Lemma CReal_abs_bound : forall (x : CReal),
QBound (CReal_abs_seq x) (CReal_abs_scale x).