(** This file is part of the Coquelicot formalization of real analysis in Coq: http://coquelicot.saclay.inria.fr/  Copyright (C) 2011-2015 Sylvie Boldo #<br /># Copyright (C) 2011-2015 Catherine Lelay #<br /># Copyright (C) 2011-2015 Guillaume Melquiond  This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the COPYING file for more details. *)
(** This file describes properties and definitions about limits of real sequences. This includes properties about the predicates [is_lim_seq] and [ex_lim_seq]. This file also defines several total functions using the Limited Principle of Omniscience. These total functions on [R] sequences are [Sup_seq], [Inf_seq], [LimSup_seq], [LimInf_seq] and of course [Lim_seq]. *)
Open Scope R_scope.
(** * Sup and Inf of sequences in Rbar *)
(** ** Definitions *)
Definition is_sup_seq (u : nat -> Rbar) (l : Rbar) :=
match l with
| Finite l => forall (eps : posreal), (forall n, Rbar_lt (u n) (l+eps))
/\ (exists n, Rbar_lt (l-eps) (u n))
| p_infty => forall M : R, exists n, Rbar_lt M (u n)
| m_infty => forall M : R, forall n, Rbar_lt (u n) M
end.
Definition is_inf_seq (u : nat -> Rbar) (l : Rbar) :=
match l with
| Finite l => forall (eps : posreal), (forall n, Rbar_lt (Finite (l-eps)) (u n))
/\ (exists n, Rbar_lt (u n) (Finite (l+eps)))
| p_infty => forall M : R, forall n, Rbar_lt (Finite M) (u n)
| m_infty => forall M : R, exists n, Rbar_lt (u n) (Finite M)
end.
(** Equivalent forms *)
(** Extensionality *)
(** Existence *)
(** Notations *)
Definition Sup_seq (u : nat -> Rbar) := proj1_sig (ex_sup_seq u).
Definition Inf_seq (u : nat -> Rbar) := proj1_sig (ex_inf_seq u).

Lemma Inf_seq_ext (u v : nat -> Rbar) :
(forall n, (u n) = (v n)) -> Inf_seq u = Inf_seq v.