(** 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 sequences of functions and results about their convergence. *)
Open Scope R_scope.
(** * Sequence of functions *)
(** ** Definitions *)
Definition CVS_dom (fn : nat -> R -> R) (D : R -> Prop) :=
forall x : R, D x -> ex_finite_lim_seq (fun n => fn n x).
Definition CVU_dom (fn : nat -> R -> R) (D : R -> Prop) :=
forall eps : posreal, eventually (fun n => forall x : R,
D x -> Rabs ((fn n x) - real (Lim_seq (fun n => fn n x))) < eps).
Definition CVU_cauchy (fn : nat -> R -> R) (D : R -> Prop) :=
forall eps : posreal, exists N : nat,
forall (n m : nat) (x : R), D x -> (N <= n)%nat -> (N <= m)%nat
-> Rabs (fn n x - fn m x) < eps.
(** Equivalence with standard library *)
(** Various inclusions and equivalences between definitions *)
(** ** Limits, integrals and differentiability *)
Definition is_connected (D : R -> Prop) :=
forall a b x, D a -> D b -> a <= x <= b -> D x.

Lemma CVU_limits_open (fn : nat -> R -> R) (D : R -> Prop) :
open D
-> CVU_dom fn D
-> (forall x n, D x -> ex_finite_lim (fn n) x)
-> forall x, D x -> ex_finite_lim_seq (fun n => real (Lim (fn n) x))
/\ ex_finite_lim (fun y => real (Lim_seq (fun n => fn n y))) x
/\ real (Lim_seq (fun n => real (Lim (fn n) x)))
= real (Lim (fun y => real (Lim_seq (fun n => fn n y))) x).