-- Mathlib/Analysis/Analytic/Composition.lean
theorem HasFPowerSeriesWithinAt.comp {g : F → G} {f : E → F} {q : FormalMultilinearSeries 𝕜 F G}
    {p : FormalMultilinearSeries 𝕜 E F} {x : E} {t : Set F} {s : Set E}
    (hg : HasFPowerSeriesWithinAt g q t (f x)) (hf : HasFPowerSeriesWithinAt f p s x)
    (hs : Set.MapsTo f s t) : HasFPowerSeriesWithinAt (g ∘ f) (q.comp p) s x

Proof state:
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁶ : NontriviallyNormedField 𝕜
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace 𝕜 E
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace 𝕜 F
inst✝¹ : NormedAddCommGroup G
inst✝ : NormedSpace 𝕜 G
g : F → G
f : E → F
q : FormalMultilinearSeries 𝕜 F G
p : FormalMultilinearSeries 𝕜 E F
x : E
t : Set F
s : Set E
hs : Set.MapsTo f s t
rg : ℝ≥0∞
Hg : HasFPowerSeriesWithinOnBall g q t (f x) rg
rf : ℝ≥0∞
Hf : HasFPowerSeriesWithinOnBall f p s x rf
r : ℝ≥0
r_pos : 0 < r
hr : Summable fun i => ‖q.compAlongComposition p i.snd‖₊ * r ^ i.fst
δ : ℝ≥0∞
δpos : 0 < δ
hδ : ∀ {z : E}, z ∈ insert x s ∩ EMetric.ball x δ → f z ∈ insert (f x) t ∩ EMetric.ball (f x) rg
rf' : ℝ≥0∞ := rf ⊓ δ
min_pos : 0 < rf' ⊓ ↑r
y : E
h'y : x + y ∈ insert x s
hy : y ∈ EMetric.ball 0 (rf' ⊓ ↑r)
y_mem : y ∈ EMetric.ball 0 rf
fy_mem : f (x + y) ∈ insert (f x) t ∩ EMetric.ball (f x) rg
n : ℕ
hn : n ≥ 1
⊢ (∑ a ∈ Finset.Ico 1 n, (p a) fun _b => y) = (∑ a ∈ Finset.range n, (p a) fun _b => y) - f x

Tactic:
rw [eq_sub_iff_add_eq', Finset.range_eq_Ico, ← Hf.coeff_zero fun _i => y,
  Finset.sum_eq_sum_Ico_succ_bot hn]

Result:
no goals

Proof state:
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁶ : NontriviallyNormedField 𝕜
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace 𝕜 E
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace 𝕜 F
inst✝¹ : NormedAddCommGroup G
inst✝ : NormedSpace 𝕜 G
g : F → G
f : E → F
q : FormalMultilinearSeries 𝕜 F G
p : FormalMultilinearSeries 𝕜 E F
x : E
t : Set F
s : Set E
hs : Set.MapsTo f s t
rg : ℝ≥0∞
Hg : HasFPowerSeriesWithinOnBall g q t (f x) rg
rf : ℝ≥0∞
Hf : HasFPowerSeriesWithinOnBall f p s x rf
r : ℝ≥0
r_pos : 0 < r
hr : Summable fun i => ‖q.compAlongComposition p i.snd‖₊ * r ^ i.fst
δ : ℝ≥0∞
δpos : 0 < δ
hδ : ∀ {z : E}, z ∈ insert x s ∩ EMetric.ball x δ → f z ∈ insert (f x) t ∩ EMetric.ball (f x) rg
rf' : ℝ≥0∞ := rf ⊓ δ
min_pos : 0 < rf' ⊓ ↑r
y : E
h'y : x + y ∈ insert x s
hy : y ∈ EMetric.ball 0 (rf' ⊓ ↑r)
y_mem : y ∈ EMetric.ball 0 rf
fy_mem : f (x + y) ∈ insert (f x) t ∩ EMetric.ball (f x) rg
A : Tendsto (fun n => (n, ∑ a ∈ Finset.Ico 1 n, (p a) fun x => y)) atTop (atTop ×ˢ 𝓝 (f (x + y) - f x))
B : Tendsto (fun n => q.partialSum n (∑ a ∈ Finset.Ico 1 n, (p a) fun _b => y)) atTop (𝓝 (g (f (x + y))))
C :
  Tendsto (fun n => ∑ i ∈ compPartialSumTarget 0 n n, (q.compAlongComposition p i.snd) fun _j => y) atTop
    (𝓝 (g (f (x + y))))
⊢ ∀ (i : (n : ℕ) × Composition n),
    ‖(q.compAlongComposition p i.snd) fun _j => y‖ ≤ ↑(‖q.compAlongComposition p i.snd‖₊ * r ^ i.fst)

Tactic:
simp only [coe_nnnorm, NNReal.coe_mul, NNReal.coe_pow]

Result:
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁶ : NontriviallyNormedField 𝕜
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace 𝕜 E
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace 𝕜 F
inst✝¹ : NormedAddCommGroup G
inst✝ : NormedSpace 𝕜 G
g : F → G
f : E → F
q : FormalMultilinearSeries 𝕜 F G
p : FormalMultilinearSeries 𝕜 E F
x : E
t : Set F
s : Set E
hs : Set.MapsTo f s t
rg : ℝ≥0∞
Hg : HasFPowerSeriesWithinOnBall g q t (f x) rg
rf : ℝ≥0∞
Hf : HasFPowerSeriesWithinOnBall f p s x rf
r : ℝ≥0
r_pos : 0 < r
hr : Summable fun i => ‖q.compAlongComposition p i.snd‖₊ * r ^ i.fst
δ : ℝ≥0∞
δpos : 0 < δ
hδ : ∀ {z : E}, z ∈ insert x s ∩ EMetric.ball x δ → f z ∈ insert (f x) t ∩ EMetric.ball (f x) rg
rf' : ℝ≥0∞ := rf ⊓ δ
min_pos : 0 < rf' ⊓ ↑r
y : E
h'y : x + y ∈ insert x s
hy : y ∈ EMetric.ball 0 (rf' ⊓ ↑r)
y_mem : y ∈ EMetric.ball 0 rf
fy_mem : f (x + y) ∈ insert (f x) t ∩ EMetric.ball (f x) rg
A : Tendsto (fun n => (n, ∑ a ∈ Finset.Ico 1 n, (p a) fun x => y)) atTop (atTop ×ˢ 𝓝 (f (x + y) - f x))
B : Tendsto (fun n => q.partialSum n (∑ a ∈ Finset.Ico 1 n, (p a) fun _b => y)) atTop (𝓝 (g (f (x + y))))
C :
  Tendsto (fun n => ∑ i ∈ compPartialSumTarget 0 n n, (q.compAlongComposition p i.snd) fun _j => y) atTop
    (𝓝 (g (f (x + y))))
⊢ ∀ (i : (n : ℕ) × Composition n),
    ‖(q.compAlongComposition p i.snd) fun _j => y‖ ≤ ‖q.compAlongComposition p i.snd‖ * ↑r ^ i.fst

Proof state:
case intro.intro.intro.intro.intro.intro
𝕜 : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
inst✝⁶ : NontriviallyNormedField 𝕜
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace 𝕜 E
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace 𝕜 F
inst✝¹ : NormedAddCommGroup G
inst✝ : NormedSpace 𝕜 G
g : F → G
f : E → F
q : FormalMultilinearSeries 𝕜 F G
p : FormalMultilinearSeries 𝕜 E F
x : E
t : Set F
s : Set E
hs : Set.MapsTo f s t
rg : ℝ≥0∞
Hg : HasFPowerSeriesWithinOnBall g q t (f x) rg
rf : ℝ≥0∞
Hf : HasFPowerSeriesWithinOnBall f p s x rf
r : ℝ≥0
r_pos : 0 < r
hr : Summable fun i => ‖q.compAlongComposition p i.snd‖₊ * r ^ i.fst
δ : ℝ≥0∞
δpos : 0 < δ
hδ : ∀ {z : E}, z ∈ insert x s ∩ EMetric.ball x δ → f z ∈ insert (f x) t ∩ EMetric.ball (f x) rg
rf' : ℝ≥0∞ := rf ⊓ δ
min_pos : 0 < rf' ⊓ ↑r
y : E
h'y : x + y ∈ insert x s
hy : y ∈ EMetric.ball 0 (rf' ⊓ ↑r)
y_mem : y ∈ EMetric.ball 0 rf
fy_mem : f (x + y) ∈ insert (f x) t ∩ EMetric.ball (f x) rg
A : Tendsto (fun n => (n, ∑ a ∈ Finset.Ico 1 n, (p a) fun x => y)) atTop (atTop ×ˢ 𝓝 (f (x + y) - f x))
B : Tendsto (fun n => q.partialSum n (∑ a ∈ Finset.Ico 1 n, (p a) fun _b => y)) atTop (𝓝 (g (f (x + y))))
C :
  Tendsto (fun n => ∑ i ∈ compPartialSumTarget 0 n n, (q.compAlongComposition p i.snd) fun _j => y) atTop
    (𝓝 (g (f (x + y))))
D : HasSum (fun i => (q.compAlongComposition p i.snd) fun _j => y) (g (f (x + y)))
⊢ HasSum (fun n => (q.comp p n) fun x => y) ((g ∘ f) (x + y))

Tactic:
have E : HasSum (fun n => (q.comp p) n fun _j => y) (g (f (x + y))) := by
  apply D.sigma
  intro n
  simp only [compAlongComposition_apply, FormalMultilinearSeries.comp,
    ContinuousMultilinearMap.sum_apply]
  exact hasSum_fintype _

Result:
case intro.intro.intro.intro.intro.intro
𝕜 : Type u_1
E✝ : Type u_2
F : Type u_3
G : Type u_4
inst✝⁶ : NontriviallyNormedField 𝕜
inst✝⁵ : NormedAddCommGroup E✝
inst✝⁴ : NormedSpace 𝕜 E✝
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace 𝕜 F
inst✝¹ : NormedAddCommGroup G
inst✝ : NormedSpace 𝕜 G
g : F → G
f : E✝ → F
q : FormalMultilinearSeries 𝕜 F G
p : FormalMultilinearSeries 𝕜 E✝ F
x : E✝
t : Set F
s : Set E✝
hs : Set.MapsTo f s t
rg : ℝ≥0∞
Hg : HasFPowerSeriesWithinOnBall g q t (f x) rg
rf : ℝ≥0∞
Hf : HasFPowerSeriesWithinOnBall f p s x rf
r : ℝ≥0
r_pos : 0 < r
hr : Summable fun i => ‖q.compAlongComposition p i.snd‖₊ * r ^ i.fst
δ : ℝ≥0∞
δpos : 0 < δ
hδ : ∀ {z : E✝}, z ∈ insert x s ∩ EMetric.ball x δ → f z ∈ insert (f x) t ∩ EMetric.ball (f x) rg
rf' : ℝ≥0∞ := rf ⊓ δ
min_pos : 0 < rf' ⊓ ↑r
y : E✝
h'y : x + y ∈ insert x s
hy : y ∈ EMetric.ball 0 (rf' ⊓ ↑r)
y_mem : y ∈ EMetric.ball 0 rf
fy_mem : f (x + y) ∈ insert (f x) t ∩ EMetric.ball (f x) rg
A : Tendsto (fun n => (n, ∑ a ∈ Finset.Ico 1 n, (p a) fun x => y)) atTop (atTop ×ˢ 𝓝 (f (x + y) - f x))
B : Tendsto (fun n => q.partialSum n (∑ a ∈ Finset.Ico 1 n, (p a) fun _b => y)) atTop (𝓝 (g (f (x + y))))
C :
  Tendsto (fun n => ∑ i ∈ compPartialSumTarget 0 n n, (q.compAlongComposition p i.snd) fun _j => y) atTop
    (𝓝 (g (f (x + y))))
D : HasSum (fun i => (q.compAlongComposition p i.snd) fun _j => y) (g (f (x + y)))
E : HasSum (fun n => (q.comp p n) fun _j => y) (g (f (x + y)))
⊢ HasSum (fun n => (q.comp p n) fun x => y) ((g ∘ f) (x + y))