/-- The convolution `f * g` is `C^n` when `f` is locally integrable and `g` is `C^n` and compactly
supported. Version where `g` depends on an additional parameter in an open subset `s` of a
parameter space `P` (and the compact support `k` is independent of the parameter in `s`).
In this version, all the types belong to the same universe (to get an induction working in the
proof). Use instead `contDiffOn_convolution_right_with_param`, which removes this restriction. -/
theorem contDiffOn_convolution_right_with_param_aux {G : Type uP} {E' : Type uP} {F : Type uP}
    {P : Type uP} [NormedAddCommGroup E'] [NormedAddCommGroup F] [NormedSpace 𝕜 E']
    [NormedSpace ℝ F] [NormedSpace 𝕜 F] [CompleteSpace F] [MeasurableSpace G]
    {μ : MeasureTheory.Measure G}
    [NormedAddCommGroup G] [BorelSpace G] [NormedSpace 𝕜 G] [NormedAddCommGroup P] [NormedSpace 𝕜 P]
    {f : G → E} {n : ℕ∞} (L : E →L[𝕜] E' →L[𝕜] F) {g : P → G → E'} {s : Set P} {k : Set G}
    (hs : IsOpen s) (hk : IsCompact k) (hgs : ∀ p, ∀ x, p ∈ s → x ∉ k → g p x = 0)
    (hf : LocallyIntegrable f μ) (hg : ContDiffOn 𝕜 n (↿g) (s ×ˢ univ)) :
    ContDiffOn 𝕜 n (fun q : P × G => (f ⋆[L, μ] g q.1) q.2) (s ×ˢ univ) := by
  /- We have a formula for the derivation of `f * g`, which is of the same form, thanks to
    `hasFDerivAt_convolution_right_with_param`. Therefore, we can prove the result by induction on
    `n` (but for this we need the spaces at the different steps of the induction to live in the same
    universe, which is why we make the assumption in the lemma that all the relevant spaces
    come from the same universe). -/
  induction' n using ENat.nat_induction with n ih ih generalizing g E' F
  · rw [contDiffOn_zero] at hg ⊢
    exact continuousOn_convolution_right_with_param L hk hgs hf hg
  · let f' : P → G → P × G →L[𝕜] F := fun p a =>
      (f ⋆[L.precompR (P × G), μ] fun x : G => fderiv 𝕜 (uncurry g) (p, x)) a
    have A : ∀ q₀ : P × G, q₀.1 ∈ s →
        HasFDerivAt (fun q : P × G => (f ⋆[L, μ] g q.1) q.2) (f' q₀.1 q₀.2) q₀ :=
      hasFDerivAt_convolution_right_with_param L hs hk hgs hf hg.one_of_succ
    rw [contDiffOn_succ_iff_fderiv_of_isOpen (hs.prod (@isOpen_univ G _))] at hg ⊢
    constructor
    · rintro ⟨p, x⟩ ⟨hp, -⟩
      exact (A (p, x) hp).differentiableAt.differentiableWithinAt
    · suffices H : ContDiffOn 𝕜 n (↿f') (s ×ˢ univ)
      · apply H.congr
        rintro ⟨p, x⟩ ⟨hp, -⟩
        exact (A (p, x) hp).fderiv
      have B : ∀ (p : P) (x : G), p ∈ s → x ∉ k → fderiv 𝕜 (uncurry g) (p, x) = 0 := by
        intro p x hp hx
        apply (hasFDerivAt_zero_of_eventually_const (0 : E') _).fderiv
        have M2 : kᶜ ∈ 𝓝 x := IsOpen.mem_nhds hk.isClosed.isOpen_compl hx
        have M1 : s ∈ 𝓝 p := hs.mem_nhds hp
        rw [nhds_prod_eq]
        filter_upwards [prod_mem_prod M1 M2]
        

Proof state:
case h
𝕜 : Type u𝕜
G✝ : Type uG
E : Type uE
E'✝ : Type uE'
E'' : Type uE''
F✝ : Type uF
F' : Type uF'
F'' : Type uF''
P✝ : Type uP
inst✝²⁸ : NormedAddCommGroup E
inst✝²⁷ : NormedAddCommGroup E'✝
inst✝²⁶ : NormedAddCommGroup E''
inst✝²⁵ : NormedAddCommGroup F✝
f✝ f'✝ : G✝ → E
g✝ g' : G✝ → E'✝
x✝ x' : G✝
y y' : E
inst✝²⁴ : IsROrC 𝕜
inst✝²³ : NormedSpace 𝕜 E
inst✝²² : NormedSpace 𝕜 E'✝
inst✝²¹ : NormedSpace 𝕜 E''
inst✝²⁰ : NormedSpace ℝ F✝
inst✝¹⁹ : NormedSpace 𝕜 F✝
inst✝¹⁸ : CompleteSpace F✝
inst✝¹⁷ : MeasurableSpace G✝
inst✝¹⁶ : NormedAddCommGroup G✝
inst✝¹⁵ : BorelSpace G✝
inst✝¹⁴ : NormedSpace 𝕜 G✝
inst✝¹³ : NormedAddCommGroup P✝
inst✝¹² : NormedSpace 𝕜 P✝
μ✝ : Measure G✝
L✝ : E →L[𝕜] E'✝ →L[𝕜] F✝
G P : Type uP
inst✝¹¹ : MeasurableSpace G
μ : Measure G
inst✝¹⁰ : NormedAddCommGroup G
inst✝⁹ : BorelSpace G
inst✝⁸ : NormedSpace 𝕜 G
inst✝⁷ : NormedAddCommGroup P
inst✝⁶ : NormedSpace 𝕜 P
f : G → E
s : Set P
k : Set G
hs : IsOpen s
hk : IsCompact k
hf : LocallyIntegrable f
n : ℕ
ih :
  ∀ {E' F : Type uP} [inst : NormedAddCommGroup E'] [inst_1 : NormedAddCommGroup F] [inst_2 : NormedSpace 𝕜 E']
    [inst_3 : NormedSpace ℝ F] [inst_4 : NormedSpace 𝕜 F] [inst_5 : CompleteSpace F] (L : E →L[𝕜] E' →L[𝕜] F)
    {g : P → G → E'},
    (∀ (p : P) (x : G), p ∈ s → x ∉ k → g p x = 0) →
      ContDiffOn 𝕜 (↑n) (↿g) (s ×ˢ univ) → ContDiffOn 𝕜 (↑n) (fun q => f ⋆[L, q.2] g q.1) (s ×ˢ univ)
E' F : Type uP
inst✝⁵ : NormedAddCommGroup E'
inst✝⁴ : NormedAddCommGroup F
inst✝³ : NormedSpace 𝕜 E'
inst✝² : NormedSpace ℝ F
inst✝¹ : NormedSpace 𝕜 F
inst✝ : CompleteSpace F
L : E →L[𝕜] E' →L[𝕜] F
g : P → G → E'
hgs : ∀ (p : P) (x : G), p ∈ s → x ∉ k → g p x = 0
hg : DifferentiableOn 𝕜 (↿g) (s ×ˢ univ) ∧ ContDiffOn 𝕜 (↑n) (fun y => fderiv 𝕜 (↿g) y) (s ×ˢ univ)
f' : P → G → P × G →L[𝕜] F := fun p a => f ⋆[precompR (P × G) L, a] fun x => fderiv 𝕜 (uncurry g) (p, x)
A : ∀ (q₀ : P × G), q₀.1 ∈ s → HasFDerivAt (fun q => f ⋆[L, q.2] g q.1) (f' q₀.1 q₀.2) q₀
p : P
x : G
hp : p ∈ s
hx : x ∉ k
M2 : kᶜ ∈ 𝓝 x
M1 : s ∈ 𝓝 p
⊢ ∀ a ∈ s ×ˢ kᶜ, uncurry g a = 0

Next tactic:
rintro ⟨p, y⟩ ⟨hp, hy⟩