-- Mathlib/Analysis/Complex/AbelLimit.lean
theorem tendsto_tsum_powerSeries_nhdsWithin_lt
    (h : Tendsto (fun n ↦ ∑ i ∈ range n, f i) atTop (𝓝 l)) :
    Tendsto (fun x ↦ ∑' n, f n * x ^ n) (𝓝[<] 1) (𝓝 l)

Proof state:
f : ℕ → ℝ
l : ℝ
m : Filter.map ofReal (𝓝 l) ≤ 𝓝 ↑l
h : Tendsto (ofReal ∘ fun n => ∑ i ∈ range n, f i) atTop (𝓝 ↑l)
⊢ Tendsto (fun x => ∑' (n : ℕ), f n * x ^ n) (𝓝[<] 1) (𝓝 l)

Tactic:
rw [Function.comp_def] at h

Result:
f : ℕ → ℝ
l : ℝ
m : Filter.map ofReal (𝓝 l) ≤ 𝓝 ↑l
h : Tendsto (fun x => ↑(∑ i ∈ range x, f i)) atTop (𝓝 ↑l)
⊢ Tendsto (fun x => ∑' (n : ℕ), f n * x ^ n) (𝓝[<] 1) (𝓝 l)

Proof state:
f : ℕ → ℝ
l : ℝ
h : Tendsto (fun n => ∑ i ∈ range n, f i) atTop (𝓝 l)
m : Filter.map ofReal (𝓝 l) ≤ 𝓝 ↑l
⊢ Tendsto (fun x => ∑' (n : ℕ), f n * x ^ n) (𝓝[<] 1) (𝓝 l)

Tactic:
replace h := (tendsto_map.comp h).mono_right m

Result:
f : ℕ → ℝ
l : ℝ
m : Filter.map ofReal (𝓝 l) ≤ 𝓝 ↑l
h : Tendsto (ofReal ∘ fun n => ∑ i ∈ range n, f i) atTop (𝓝 ↑l)
⊢ Tendsto (fun x => ∑' (n : ℕ), f n * x ^ n) (𝓝[<] 1) (𝓝 l)

Proof state:
f : ℕ → ℝ
l : ℝ
m : Filter.map ofReal (𝓝 l) ≤ 𝓝 ↑l
h : Tendsto (fun z => ∑' (n : ℕ), ↑(f n) * z ^ n) (Filter.map ofReal (𝓝[<] 1)) (𝓝 ↑l)
⊢ Tendsto (fun x => ∑' (n : ℕ), f n * x ^ n) (𝓝[<] 1) (𝓝 l)

Tactic:
rw [tendsto_map'_iff] at h

Result:
f : ℕ → ℝ
l : ℝ
m : Filter.map ofReal (𝓝 l) ≤ 𝓝 ↑l
h : Tendsto ((fun z => ∑' (n : ℕ), ↑(f n) * z ^ n) ∘ ofReal) (𝓝[<] 1) (𝓝 ↑l)
⊢ Tendsto (fun x => ∑' (n : ℕ), f n * x ^ n) (𝓝[<] 1) (𝓝 l)

Proof state:
f : ℕ → ℝ
l : ℝ
m : Filter.map ofReal (𝓝 l) ≤ 𝓝 ↑l
h : Tendsto ((fun z => ∑' (n : ℕ), ↑(f n) * z ^ n) ∘ ofReal) (𝓝[<] 1) (𝓝 ↑l)
⊢ Tendsto (fun x => ∑' (n : ℕ), f n * x ^ n) (𝓝[<] 1) (𝓝 l)

Tactic:
rw [Metric.tendsto_nhdsWithin_nhds] at h ⊢

Result:
f : ℕ → ℝ
l : ℝ
m : Filter.map ofReal (𝓝 l) ≤ 𝓝 ↑l
h :
  ∀ ε > 0,
    ∃ δ > 0, ∀ ⦃x : ℝ⦄, x ∈ Set.Iio 1 → dist x 1 < δ → dist (((fun z => ∑' (n : ℕ), ↑(f n) * z ^ n) ∘ ofReal) x) ↑l < ε
⊢ ∀ ε > 0, ∃ δ > 0, ∀ ⦃x : ℝ⦄, x ∈ Set.Iio 1 → dist x 1 < δ → dist (∑' (n : ℕ), f n * x ^ n) l < ε

Proof state:
f : ℕ → ℝ
l : ℝ
m : Filter.map ofReal (𝓝 l) ≤ 𝓝 ↑l
h : Tendsto (fun x => ↑(∑ i ∈ range x, f i)) atTop (𝓝 ↑l)
⊢ Tendsto (fun x => ∑' (n : ℕ), f n * x ^ n) (𝓝[<] 1) (𝓝 l)

Tactic:
push_cast at h

Result:
f : ℕ → ℝ
l : ℝ
m : Filter.map ofReal (𝓝 l) ≤ 𝓝 ↑l
h : Tendsto (fun x => ∑ i ∈ range x, ↑(f i)) atTop (𝓝 ↑l)
⊢ Tendsto (fun x => ∑' (n : ℕ), f n * x ^ n) (𝓝[<] 1) (𝓝 l)

Proof state:
f : ℕ → ℝ
l : ℝ
h : Tendsto (fun n => ∑ i ∈ range n, f i) atTop (𝓝 l)
⊢ Tendsto (fun x => ∑' (n : ℕ), f n * x ^ n) (𝓝[<] 1) (𝓝 l)

Tactic:
have m : (𝓝 l).map ofReal ≤ 𝓝 ↑l := ofRealCLM.continuous.tendsto l

Result:
f : ℕ → ℝ
l : ℝ
h : Tendsto (fun n => ∑ i ∈ range n, f i) atTop (𝓝 l)
m : Filter.map ofReal (𝓝 l) ≤ 𝓝 ↑l
⊢ Tendsto (fun x => ∑' (n : ℕ), f n * x ^ n) (𝓝[<] 1) (𝓝 l)

Proof state:
f : ℕ → ℝ
l : ℝ
m : Filter.map ofReal (𝓝 l) ≤ 𝓝 ↑l
h : Tendsto (fun x => ∑ i ∈ range x, ↑(f i)) atTop (𝓝 ↑l)
⊢ Tendsto (fun x => ∑' (n : ℕ), f n * x ^ n) (𝓝[<] 1) (𝓝 l)

Tactic:
replace h := Complex.tendsto_tsum_powerSeries_nhdsWithin_lt h

Result:
f : ℕ → ℝ
l : ℝ
m : Filter.map ofReal (𝓝 l) ≤ 𝓝 ↑l
h : Tendsto (fun z => ∑' (n : ℕ), ↑(f n) * z ^ n) (Filter.map ofReal (𝓝[<] 1)) (𝓝 ↑l)
⊢ Tendsto (fun x => ∑' (n : ℕ), f n * x ^ n) (𝓝[<] 1) (𝓝 l)

Proof state:
f : ℕ → ℝ
l : ℝ
m : Filter.map ofReal (𝓝 l) ≤ 𝓝 ↑l
h :
  ∀ ε > 0,
    ∃ δ > 0, ∀ ⦃x : ℝ⦄, x ∈ Set.Iio 1 → dist x 1 < δ → dist (((fun z => ∑' (n : ℕ), ↑(f n) * z ^ n) ∘ ofReal) x) ↑l < ε
⊢ ∀ ε > 0, ∃ δ > 0, ∀ ⦃x : ℝ⦄, x ∈ Set.Iio 1 → dist x 1 < δ → dist (∑' (n : ℕ), f n * x ^ n) l < ε

Tactic:
convert h

Result:
case h.h'.h.e'_2.h.h.e'_2.h.h'.h'.h.e'_3
f : ℕ → ℝ
l : ℝ
m : Filter.map ofReal (𝓝 l) ≤ 𝓝 ↑l
h :
  ∀ ε > 0,
    ∃ δ > 0, ∀ ⦃x : ℝ⦄, x ∈ Set.Iio 1 → dist x 1 < δ → dist (((fun z => ∑' (n : ℕ), ↑(f n) * z ^ n) ∘ ofReal) x) ↑l < ε
a✝⁴ : ℝ
a✝³ : a✝⁴ > 0
x✝ a✝² : ℝ
a✝¹ : a✝² ∈ Set.Iio 1
a✝ : dist a✝² 1 < x✝
⊢ dist (∑' (n : ℕ), f n * a✝² ^ n) l = dist (((fun z => ∑' (n : ℕ), ↑(f n) * z ^ n) ∘ ofReal) a✝²) ↑l

Proof state:
case h.h'.h.e'_2.h.h.e'_2.h.h'.h'.h.e'_3
f : ℕ → ℝ
l : ℝ
m : Filter.map ofReal (𝓝 l) ≤ 𝓝 ↑l
h :
  ∀ ε > 0,
    ∃ δ > 0, ∀ ⦃x : ℝ⦄, x ∈ Set.Iio 1 → dist x 1 < δ → dist (((fun z => ∑' (n : ℕ), ↑(f n) * z ^ n) ∘ ofReal) x) ↑l < ε
a✝⁴ : ℝ
a✝³ : a✝⁴ > 0
x✝ a✝² : ℝ
a✝¹ : a✝² ∈ Set.Iio 1
a✝ : dist a✝² 1 < x✝
⊢ ‖∑' (n : ℕ), f n * a✝² ^ n - l‖ = ‖∑' (n : ℕ), ↑(f n) * ↑a✝² ^ n - ↑l‖

Tactic:
norm_cast

Result:
no goals

Proof state:
case h.h'.h.e'_2.h.h.e'_2.h.h'.h'.h.e'_3
f : ℕ → ℝ
l : ℝ
m : Filter.map ofReal (𝓝 l) ≤ 𝓝 ↑l
h :
  ∀ ε > 0,
    ∃ δ > 0, ∀ ⦃x : ℝ⦄, x ∈ Set.Iio 1 → dist x 1 < δ → dist (((fun z => ∑' (n : ℕ), ↑(f n) * z ^ n) ∘ ofReal) x) ↑l < ε
a✝⁴ : ℝ
a✝³ : a✝⁴ > 0
x✝ a✝² : ℝ
a✝¹ : a✝² ∈ Set.Iio 1
a✝ : dist a✝² 1 < x✝
⊢ dist (∑' (n : ℕ), f n * a✝² ^ n) l = dist (((fun z => ∑' (n : ℕ), ↑(f n) * z ^ n) ∘ ofReal) a✝²) ↑l

Tactic:
simp_rw [Function.comp_apply, dist_eq_norm]

Result:
case h.h'.h.e'_2.h.h.e'_2.h.h'.h'.h.e'_3
f : ℕ → ℝ
l : ℝ
m : Filter.map ofReal (𝓝 l) ≤ 𝓝 ↑l
h :
  ∀ ε > 0,
    ∃ δ > 0, ∀ ⦃x : ℝ⦄, x ∈ Set.Iio 1 → dist x 1 < δ → dist (((fun z => ∑' (n : ℕ), ↑(f n) * z ^ n) ∘ ofReal) x) ↑l < ε
a✝⁴ : ℝ
a✝³ : a✝⁴ > 0
x✝ a✝² : ℝ
a✝¹ : a✝² ∈ Set.Iio 1
a✝ : dist a✝² 1 < x✝
⊢ ‖∑' (n : ℕ), f n * a✝² ^ n - l‖ = ‖∑' (n : ℕ), ↑(f n) * ↑a✝² ^ n - ↑l‖