(************************************************************************)
(*         *      The Rocq Prover / The Rocq Development Team           *)
(*  v      *         Copyright INRIA, CNRS and contributors             *)
(* <O___,, * (see version control and CREDITS file for authors & dates) *)
(*   \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 R_scope.
Local Ltac Tauto.intuition_solver ::= auto with rorders real arith.
(*********************************************************)
(** * Preliminaries                                      *)
(*********************************************************)
(** ** Various generic lemmas which probably should go somewhere else *)

(* Specifications: *)
Lemma Boule_half_to_interval : forall x,
Boule (/2) posreal_half x -> 0 <= x <= 1.
Lemma Boule_lt : forall c r x,
Boule c r x -> Rabs x < Rabs c + r.
(* The following lemma does not belong here. *)
Lemma Un_cv_ext : forall un vn,
(forall n, un n = vn n) ->
forall l, Un_cv un l ->
Un_cv vn l.
(* The following two lemmas are general purposes about alternated series. They do not belong here. *)
Lemma Alt_first_term_bound : forall f l N n,
Un_decreasing f -> Un_cv f 0 ->
Un_cv (sum_f_R0 (tg_alt f)) l ->
(N <= n)%nat ->
Rdist (sum_f_R0 (tg_alt f) n) l <= f N.
Lemma Alt_CVU : forall (f : nat -> R -> R) g h c r,
(forall x, Boule c r x ->Un_decreasing (fun n => f n x)) ->
(forall x, Boule c r x -> Un_cv (fun n => f n x) 0) ->
(forall x, Boule c r x ->
Un_cv (sum_f_R0 (tg_alt  (fun i => f i x))) (g x)) ->
(forall x n, Boule c r x -> f n x <= h n) ->
(Un_cv h 0) ->
CVU (fun N x => sum_f_R0 (tg_alt (fun i => f i x)) N) g c r.