/-- Auxiliary lemma proving that the composition of `C^n` functions on domains is `C^n` when all
spaces live in the same universe. Use instead `ContDiffOn.comp` which removes the universe
assumption (but is deduced from this one). -/
private theorem ContDiffOn.comp_same_univ {Eu : Type u} [NormedAddCommGroup Eu] [NormedSpace 𝕜 Eu]
    {Fu : Type u} [NormedAddCommGroup Fu] [NormedSpace 𝕜 Fu] {Gu : Type u} [NormedAddCommGroup Gu]
    [NormedSpace 𝕜 Gu] {s : Set Eu} {t : Set Fu} {g : Fu → Gu} {f : Eu → Fu}
    (hg : ContDiffOn 𝕜 n g t) (hf : ContDiffOn 𝕜 n f s) (st : s ⊆ f ⁻¹' t) :
    ContDiffOn 𝕜 n (g ∘ f) s := by
  induction' n using ENat.nat_induction with n IH Itop generalizing Eu Fu Gu
  · rw [contDiffOn_zero] at hf hg ⊢
    exact ContinuousOn.comp hg hf st
  · rw [contDiffOn_succ_iff_hasFDerivWithinAt] at hg ⊢
    intro x hx
    rcases (contDiffOn_succ_iff_hasFDerivWithinAt.1 hf) x hx with ⟨u, hu, f', hf', f'_diff⟩
    rcases hg (f x) (st hx) with ⟨v, hv, g', hg', g'_diff⟩
    rw [insert_eq_of_mem hx] at hu ⊢
    have xu : x ∈ u := mem_of_mem_nhdsWithin hx hu
    let w := s ∩ (u ∩ f ⁻¹' v)
    have wv : w ⊆ f ⁻¹' v := fun y hy => hy.2.2
    have wu : w ⊆ u := fun y hy => hy.2.1
    have ws : w ⊆ s := fun y hy => hy.1
    refine' ⟨w, _, fun y => (g' (f y)).comp (f' y), _, _⟩
    show w ∈ 𝓝[s] x
    · apply Filter.inter_mem self_mem_nhdsWithin
      

Proof state:
case hsuc.intro.intro.intro.intro.intro.intro.intro.intro.refine'_1
𝕜 : Type u_1
inst✝¹⁶ : NontriviallyNormedField 𝕜
D : Type uD
inst✝¹⁵ : NormedAddCommGroup D
inst✝¹⁴ : NormedSpace 𝕜 D
E : Type uE
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
F : Type uF
inst✝¹¹ : NormedAddCommGroup F
inst✝¹⁰ : NormedSpace 𝕜 F
G : Type uG
inst✝⁹ : NormedAddCommGroup G
inst✝⁸ : NormedSpace 𝕜 G
X : Type u_2
inst✝⁷ : NormedAddCommGroup X
inst✝⁶ : NormedSpace 𝕜 X
s✝ s₁ t✝ u✝ : Set E
f✝ f₁ : E → F
g✝ : F → G
x✝ x₀ : E
c : F
b : E × F → G
m n✝ : ℕ∞
p : E → FormalMultilinearSeries 𝕜 E F
n : ℕ
IH :
  ∀ {Eu : Type u} [inst : NormedAddCommGroup Eu] [inst_1 : NormedSpace 𝕜 Eu] {Fu : Type u}
    [inst_2 : NormedAddCommGroup Fu] [inst_3 : NormedSpace 𝕜 Fu] {Gu : Type u} [inst_4 : NormedAddCommGroup Gu]
    [inst_5 : NormedSpace 𝕜 Gu] {s : Set Eu} {t : Set Fu} {g : Fu → Gu} {f : Eu → Fu},
    ContDiffOn 𝕜 (↑n) g t → ContDiffOn 𝕜 (↑n) f s → s ⊆ f ⁻¹' t → ContDiffOn 𝕜 (↑n) (g ∘ f) s
Eu : Type u
inst✝⁵ : NormedAddCommGroup Eu
inst✝⁴ : NormedSpace 𝕜 Eu
Fu : Type u
inst✝³ : NormedAddCommGroup Fu
inst✝² : NormedSpace 𝕜 Fu
Gu : Type u
inst✝¹ : NormedAddCommGroup Gu
inst✝ : NormedSpace 𝕜 Gu
s : Set Eu
t : Set Fu
g : Fu → Gu
f : Eu → Fu
hg : ∀ x ∈ t, ∃ u ∈ 𝓝[insert x t] x, ∃ f', (∀ x ∈ u, HasFDerivWithinAt g (f' x) u x) ∧ ContDiffOn 𝕜 (↑n) f' u
hf : ContDiffOn 𝕜 (↑(Nat.succ n)) f s
st : s ⊆ f ⁻¹' t
x : Eu
hx : x ∈ s
u : Set Eu
hu : u ∈ 𝓝[s] x
f' : Eu → Eu →L[𝕜] Fu
hf' : ∀ x ∈ u, HasFDerivWithinAt f (f' x) u x
f'_diff : ContDiffOn 𝕜 (↑n) f' u
v : Set Fu
hv : v ∈ 𝓝[insert (f x) t] f x
g' : Fu → Fu →L[𝕜] Gu
hg' : ∀ x ∈ v, HasFDerivWithinAt g (g' x) v x
g'_diff : ContDiffOn 𝕜 (↑n) g' v
xu : x ∈ u
w : Set Eu := s ∩ (u ∩ f ⁻¹' v)
wv : w ⊆ f ⁻¹' v
wu : w ⊆ u
ws : w ⊆ s
⊢ u ∩ f ⁻¹' v ∈ 𝓝[s] x

Next tactic:
apply Filter.inter_mem hu