/-- Consider a parameterized integral `a ↦ ∫ x, L (g x) (f a x)` where `L` is bilinear,
`g` is locally integrable and `f` is continuous and uniformly compactly supported. Then the
integral depends continuously on `a`. -/
lemma continuousOn_integral_bilinear_of_locally_integrable_of_compact_support
    [NormedSpace 𝕜 E] (L : F →L[𝕜] G →L[𝕜] E)
    {f : α → β → G} {s : Set α} {k : Set β} {g : β → F}
    (hk : IsCompact k) (hf : ContinuousOn f.uncurry (s ×ˢ univ))
    (hfs : ∀ p, ∀ x, p ∈ s → x ∉ k → f p x = 0) (hg : IntegrableOn g k μ) :
    ContinuousOn (fun a ↦ ∫ x, L (g x) (f a x) ∂μ) s := by
  have A : ∀ p ∈ s, Continuous (f p) := fun p hp ↦ by
    refine hf.comp_continuous (continuous_const.prod_mk continuous_id') fun x => ?_
    simpa only [prod_mk_mem_set_prod_eq, mem_univ, and_true] using hp
  intro q hq
  apply Metric.continuousWithinAt_iff'.2 (fun ε εpos ↦ ?_)
  obtain ⟨δ, δpos, hδ⟩ : ∃ (δ : ℝ), 0 < δ ∧ ∫ x in k, ‖L‖ * ‖g x‖ * δ ∂μ < ε := by
    simpa [integral_mul_right] using exists_pos_mul_lt εpos _
  obtain ⟨v, v_mem, hv⟩ : ∃ v ∈ 𝓝[s] q, ∀ p ∈ v, ∀ x ∈ k, dist (f p x) (f q x) < δ :=
    hk.mem_uniformity_of_prod
      (hf.mono (Set.prod_mono_right (subset_univ k))) hq (dist_mem_uniformity δpos)
  simp_rw [dist_eq_norm] at hv ⊢
  have I : ∀ p ∈ s, IntegrableOn (fun x ↦ L (g x) (f p x)) k μ := by
    intro p hp
    obtain ⟨C, hC⟩ : ∃ C, ∀ x, ‖f p x‖ ≤ C := by
      have : ContinuousOn (f p) k := by
        have : ContinuousOn (fun x ↦ (p, x)) k := (Continuous.Prod.mk p).continuousOn
        exact hf.comp this (by simp [MapsTo, hp])
      rcases IsCompact.exists_bound_of_continuousOn hk this with ⟨C, hC⟩
      refine ⟨max C 0, fun x ↦ ?_⟩
      by_cases hx : x ∈ k
      · exact (hC x hx).trans (le_max_left _ _)
      · simp [hfs p x hp hx]
    have : IntegrableOn (fun x ↦ ‖L‖ * ‖g x‖ * C) k μ :=
      (hg.norm.const_mul _).mul_const _
    apply Integrable.mono' this ?_ ?_
    · borelize G
      apply L.aestronglyMeasurable_comp₂ hg.aestronglyMeasurable
      

Proof state:
α✝ : Type u_1
β✝ : Type u_2
E : Type u_3
F✝ : Type u_4
inst✝¹² : MeasurableSpace α✝
ι : Type u_5
inst✝¹¹ : NormedAddCommGroup E
α : Type u_6
β : Type u_7
F : Type u_8
G : Type u_9
𝕜 : Type u_10
inst✝¹⁰ : TopologicalSpace α
inst✝⁹ : TopologicalSpace β
inst✝⁸ : MeasurableSpace β
inst✝⁷ : OpensMeasurableSpace β
μ : Measure β
inst✝⁶ : NontriviallyNormedField 𝕜
inst✝⁵ : NormedSpace ℝ E
inst✝⁴ : NormedAddCommGroup F
inst✝³ : NormedSpace 𝕜 F
inst✝² : NormedAddCommGroup G
inst✝¹ : NormedSpace 𝕜 G
inst✝ : NormedSpace 𝕜 E
L : F →L[𝕜] G →L[𝕜] E
f : α → β → G
s : Set α
k : Set β
g : β → F
hk : IsCompact k
hf : ContinuousOn (uncurry f) (s ×ˢ univ)
hfs : ∀ (p : α) (x : β), p ∈ s → x ∉ k → f p x = 0
hg : IntegrableOn g k
A : ∀ p ∈ s, Continuous (f p)
q : α
hq : q ∈ s
ε : ℝ
εpos : ε > 0
δ : ℝ
δpos : 0 < δ
hδ : ∫ (x : β) in k, ‖L‖ * ‖g x‖ * δ ∂μ < ε
v : Set α
v_mem : v ∈ 𝓝[s] q
hv : ∀ p ∈ v, ∀ x ∈ k, ‖f p x - f q x‖ < δ
p : α
hp : p ∈ s
C : ℝ
hC : ∀ (x : β), ‖f p x‖ ≤ C
this : IntegrableOn (fun x => ‖L‖ * ‖g x‖ * C) k
this✝¹ : MeasurableSpace G := borel G
this✝ : BorelSpace G
⊢ AEStronglyMeasurable (fun x => f p x) (Measure.restrict μ k)

Next tactic:
apply StronglyMeasurable.aestronglyMeasurable