(************************************************************************)
(*         *   The Coq Proof Assistant / The Coq Development Team       *)
(*  v      *   INRIA, CNRS and contributors - Copyright 1999-2018       *)
(* <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 R_scope.
(*****************************************************************)
(**           Convergence properties of sequences                *)
(*****************************************************************)
Definition Un_decreasing (Un:nat -> R) : Prop :=
forall n:nat, Un (S n) <= Un n.
Definition opp_seq (Un:nat -> R) (n:nat) : R := - Un n.
Definition has_ub (Un:nat -> R) : Prop := bound (EUn Un).
Definition has_lb (Un:nat -> R) : Prop := bound (EUn (opp_seq Un)).
Definition lub (Un:nat -> R) (pr:has_ub Un) : R :=
let (a,_) := ub_to_lub Un pr in a.
Definition glb (Un:nat -> R) (pr:has_lb Un) : R :=
let (a,_) := lb_to_glb Un pr in - a.
(* Compatibility with previous unappropriate terminology *)
Notation maj_sup := ub_to_lub (only parsing).
Notation min_inf := lb_to_glb (only parsing).
Notation majorant := lub (only parsing).
Notation minorant := glb (only parsing).
Definition sequence_ub (Un:nat -> R) (pr:has_ub Un)
(i:nat) : R := lub (fun k:nat => Un (i + k)%nat) (maj_ss Un i pr).
Definition sequence_lb (Un:nat -> R) (pr:has_lb Un)
(i:nat) : R := glb (fun k:nat => Un (i + k)%nat) (min_ss Un i pr).
(* Compatibility *)
Notation sequence_majorant := sequence_ub (only parsing).
Notation sequence_minorant := sequence_lb (only parsing).

Lemma cond_eq :
forall x y:R, (forall eps:R, 0 < eps -> Rabs (x - y) < eps) -> x = y.