(** ** Limits, integrals and differentiability *)

Definition is_connected (D : R -> Prop) :=
  forall a b x, D a -> D b -> a <= x <= b -> D x.

(* Specifications: *)
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).
Lemma CVU_cont_open (fn : nat -> R -> R) (D : R -> Prop) : open D -> CVU_dom fn D -> (forall n, forall x, D x -> continuity_pt (fn n) x) -> forall x, D x -> continuity_pt (fun y => real (Lim_seq (fun n => fn n y))) x.
Lemma CVU_Derive (fn : nat -> R -> R) (D : R -> Prop) : open D -> is_connected D -> CVU_dom fn D -> (forall n x, D x -> ex_derive (fn n) x) -> (forall n x, D x -> continuity_pt (Derive (fn n)) x) -> CVU_dom (fun n x => Derive (fn n) x) D -> (forall x , D x -> (is_derive (fun y => real (Lim_seq (fun n => fn n y))) x (real (Lim_seq (fun n => Derive (fn n) x))))).
Lemma Dini (fn : nat -> R -> R) (a b : R) : a < b -> CVS_dom fn (fun x => a <= x <= b) -> (forall (n : nat) (x : R), a <= x <= b -> continuity_pt (fn n) x) -> (forall (x : R), a <= x <= b -> continuity_pt (fun y => Lim_seq (fun n => fn n y)) x) -> (forall (n : nat) (x y : R), a <= x -> x <= y -> y <= b -> fn n x <= fn n y) -> CVU_dom fn (fun x => a <= x <= b).
Lemma CVN_CVU_r (fn : nat -> R -> R) (r : posreal) : CVN_r fn r -> forall x, (Rabs x < r) -> exists e : posreal, CVU (fun n => SP fn n) (fun x => Series (fun n => fn n x)) x e.