-- Mathlib/Analysis/Normed/Group/Completeness.lean
/-- A normed additive group is complete if any absolutely convergent series converges in the
space. -/
lemma NormedAddCommGroup.completeSpace_of_summable_imp_tendsto
    (h : ∀ u : ℕ → E,
      Summable (‖u ·‖) → ∃ a, Tendsto (fun n => ∑ i ∈ range n, u i) atTop (𝓝 a)) :
    CompleteSpace E

Proof state:
case h
E : Type u_1
inst✝ : NormedAddCommGroup E
h : ∀ (u : ℕ → E), (Summable fun x => ‖u x‖) → ∃ a, Tendsto (fun n => ∑ i ∈ range n, u i) atTop (𝓝 a)
u : ℕ → E
hu : CauchySeq u
f : ℕ → ℕ
hf₁ : StrictMono f
hf₂ : Summable fun i => ‖u (f (i + 1)) - u (f i)‖
v : ℕ → E := fun n => u (f (n + 1)) - u (f n)
n : ℕ
⊢ ∑ i ∈ range n, v i = u (f n) - u (f 0)

Tactic:
exact sum_range_sub (u ∘ f) n

Result:
no goals

Proof state:
case a.intro.intro
E : Type u_1
inst✝ : NormedAddCommGroup E
h : ∀ (u : ℕ → E), (Summable fun x => ‖u x‖) → ∃ a, Tendsto (fun n => ∑ i ∈ range n, u i) atTop (𝓝 a)
u : ℕ → E
hu : CauchySeq u
f : ℕ → ℕ
hf₁ : StrictMono f
hf₂ : Summable fun i => ‖u (f (i + 1)) - u (f i)‖
v : ℕ → E := fun n => u (f (n + 1)) - u (f n)
⊢ ∃ a, Tendsto u atTop (𝓝 a)

Tactic:
have hv_sum : (fun n => (∑ i ∈ range n, v i)) = fun n => u (f n) - u (f 0) := by
  ext n
  exact sum_range_sub (u ∘ f) n

Result:
case a.intro.intro
E : Type u_1
inst✝ : NormedAddCommGroup E
h : ∀ (u : ℕ → E), (Summable fun x => ‖u x‖) → ∃ a, Tendsto (fun n => ∑ i ∈ range n, u i) atTop (𝓝 a)
u : ℕ → E
hu : CauchySeq u
f : ℕ → ℕ
hf₁ : StrictMono f
hf₂ : Summable fun i => ‖u (f (i + 1)) - u (f i)‖
v : ℕ → E := fun n => u (f (n + 1)) - u (f n)
hv_sum : (fun n => ∑ i ∈ range n, v i) = fun n => u (f n) - u (f 0)
⊢ ∃ a, Tendsto u atTop (𝓝 a)

Proof state:
E : Type u_1
inst✝ : NormedAddCommGroup E
h : ∀ (u : ℕ → E), (Summable fun x => ‖u x‖) → ∃ a, Tendsto (fun n => ∑ i ∈ range n, u i) atTop (𝓝 a)
⊢ CompleteSpace E

Tactic:
apply Metric.complete_of_cauchySeq_tendsto

Result:
case a
E : Type u_1
inst✝ : NormedAddCommGroup E
h : ∀ (u : ℕ → E), (Summable fun x => ‖u x‖) → ∃ a, Tendsto (fun n => ∑ i ∈ range n, u i) atTop (𝓝 a)
⊢ ∀ (u : ℕ → E), CauchySeq u → ∃ a, Tendsto u atTop (𝓝 a)

Proof state:
case a
E : Type u_1
inst✝ : NormedAddCommGroup E
h : ∀ (u : ℕ → E), (Summable fun x => ‖u x‖) → ∃ a, Tendsto (fun n => ∑ i ∈ range n, u i) atTop (𝓝 a)
⊢ ∀ (u : ℕ → E), CauchySeq u → ∃ a, Tendsto u atTop (𝓝 a)

Tactic:
intro u hu

Result:
case a
E : Type u_1
inst✝ : NormedAddCommGroup E
h : ∀ (u : ℕ → E), (Summable fun x => ‖u x‖) → ∃ a, Tendsto (fun n => ∑ i ∈ range n, u i) atTop (𝓝 a)
u : ℕ → E
hu : CauchySeq u
⊢ ∃ a, Tendsto u atTop (𝓝 a)

Proof state:
case a.intro.intro.intro
E : Type u_1
inst✝ : NormedAddCommGroup E
h : ∀ (u : ℕ → E), (Summable fun x => ‖u x‖) → ∃ a, Tendsto (fun n => ∑ i ∈ range n, u i) atTop (𝓝 a)
u : ℕ → E
hu : CauchySeq u
f : ℕ → ℕ
hf₁ : StrictMono f
hf₂ : Summable fun i => ‖u (f (i + 1)) - u (f i)‖
v : ℕ → E := fun n => u (f (n + 1)) - u (f n)
hv_sum : (fun n => ∑ i ∈ range n, v i) = fun n => u (f n) - u (f 0)
a : E
ha : Tendsto (fun n => ∑ i ∈ range n, v i) atTop (𝓝 a)
⊢ Tendsto u atTop (𝓝 (a + u (f 0)))

Tactic:
refine tendsto_nhds_of_cauchySeq_of_subseq hu hf₁.tendsto_atTop ?_

Result:
case a.intro.intro.intro
E : Type u_1
inst✝ : NormedAddCommGroup E
h : ∀ (u : ℕ → E), (Summable fun x => ‖u x‖) → ∃ a, Tendsto (fun n => ∑ i ∈ range n, u i) atTop (𝓝 a)
u : ℕ → E
hu : CauchySeq u
f : ℕ → ℕ
hf₁ : StrictMono f
hf₂ : Summable fun i => ‖u (f (i + 1)) - u (f i)‖
v : ℕ → E := fun n => u (f (n + 1)) - u (f n)
hv_sum : (fun n => ∑ i ∈ range n, v i) = fun n => u (f n) - u (f 0)
a : E
ha : Tendsto (fun n => ∑ i ∈ range n, v i) atTop (𝓝 a)
⊢ Tendsto (u ∘ f) atTop (𝓝 (a + u (f 0)))