l3lab/ntp-mathlib huggingface dataset:
theorem StronglyMeasurable.integral_kernel_prod_right ⦃f : α → β → E⦄
    (hf : StronglyMeasurable (uncurry f)) : StronglyMeasurable fun x => ∫ y, f x y ∂κ x := by
  classical
  borelize E
  haveI : TopologicalSpace.SeparableSpace (range (uncurry f) ∪ {0} : Set E) :=
    hf.separableSpace_range_union_singleton
  let s : ℕ → SimpleFunc (α × β) E :=
    SimpleFunc.approxOn _ hf.measurable (range (uncurry f) ∪ {0}) 0 (by simp)
  let s' : ℕ → α → SimpleFunc β E := fun n x => (s n).comp (Prod.mk x) measurable_prod_mk_left
  let f' : ℕ → α → E := fun n =>
    {x | Integrable (f x) (κ x)}.indicator fun x => (s' n x).integral (κ x)
  have hf' : ∀ n, StronglyMeasurable (f' n) := by
    intro n; refine' StronglyMeasurable.indicator _ (measurableSet_kernel_integrable hf)
    have : ∀ x, ((s' n x).range.filter fun x => x ≠ 0) ⊆ (s n).range := by
      intro x; refine' Finset.Subset.trans (Finset.filter_subset _ _) _; intro y
      simp_rw [SimpleFunc.mem_range]; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
mγ : MeasurableSpace γ
κ : ↥(kernel α β)
η : ↥(kernel (α × β) γ)
a : α
E : Type u_4
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedSpace ℝ E
inst✝² : CompleteSpace E
inst✝¹ : IsSFiniteKernel κ
inst✝ : IsSFiniteKernel η
f : α → β → E
hf : StronglyMeasurable (uncurry f)
this✝¹ : MeasurableSpace E := borel E
this✝ : BorelSpace E
this : TopologicalSpace.SeparableSpace ↑(range (uncurry f) ∪ {0})
s : ℕ → SimpleFunc (α × β) E :=
  SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0
    (_ : 0 ∈ range (uncurry f) ∪ {0})
s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x))
f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral (κ x) (s' n x)
n : ℕ
x : α
y : E
⊢ y ∈
      range
        ↑(SimpleFunc.comp
            (SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0
              (_ : 0 ∈ range (uncurry f) ∪ {0}) n)
            (Prod.mk x) (_ : Measurable (Prod.mk x))) →
    y ∈
      range
        ↑(SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0
            (_ : 0 ∈ range (uncurry f) ∪ {0}) n)

Next tactic:
rintro ⟨z, rfl⟩
theorem StronglyMeasurable.integral_kernel_prod_right ⦃f : α → β → E⦄
    (hf : StronglyMeasurable (uncurry f)) : StronglyMeasurable fun x => ∫ y, f x y ∂κ x := by
  classical
  borelize E
  haveI : TopologicalSpace.SeparableSpace (range (uncurry f) ∪ {0} : Set E) :=
    hf.separableSpace_range_union_singleton
  let s : ℕ → SimpleFunc (α × β) E :=
    SimpleFunc.approxOn _ hf.measurable (range (uncurry f) ∪ {0}) 0 (by simp)
  let s' : ℕ → α → SimpleFunc β E := fun n x => (s n).comp (Prod.mk x) measurable_prod_mk_left
  let f' : ℕ → α → E := fun n =>
    {x | Integrable (f x) (κ x)}.indicator fun x => (s' n x).integral (κ x)
  have hf' : ∀ n, StronglyMeasurable (f' n) := by
    intro n; refine' StronglyMeasurable.indicator _ (measurableSet_kernel_integrable hf)
    have : ∀ x, ((s' n x).range.filter fun x => x ≠ 0) ⊆ (s n).range := by
      intro x; refine' Finset.Subset.trans (Finset.filter_subset _ _) _; intro y
      simp_rw [SimpleFunc.mem_range]; rintro ⟨z, rfl⟩; 

Proof state:
case intro
α : Type u_1
β : Type u_2
γ : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
mγ : MeasurableSpace γ
κ : ↥(kernel α β)
η : ↥(kernel (α × β) γ)
a : α
E : Type u_4
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedSpace ℝ E
inst✝² : CompleteSpace E
inst✝¹ : IsSFiniteKernel κ
inst✝ : IsSFiniteKernel η
f : α → β → E
hf : StronglyMeasurable (uncurry f)
this✝¹ : MeasurableSpace E := borel E
this✝ : BorelSpace E
this : TopologicalSpace.SeparableSpace ↑(range (uncurry f) ∪ {0})
s : ℕ → SimpleFunc (α × β) E :=
  SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0
    (_ : 0 ∈ range (uncurry f) ∪ {0})
s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x))
f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral (κ x) (s' n x)
n : ℕ
x : α
z : β
⊢ ↑(SimpleFunc.comp
          (SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0
            (_ : 0 ∈ range (uncurry f) ∪ {0}) n)
          (Prod.mk x) (_ : Measurable (Prod.mk x)))
      z ∈
    range
      ↑(SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0
          (_ : 0 ∈ range (uncurry f) ∪ {0}) n)

Next tactic:
exact ⟨(x, z), rfl⟩
theorem StronglyMeasurable.integral_kernel_prod_right ⦃f : α → β → E⦄
    (hf : StronglyMeasurable (uncurry f)) : StronglyMeasurable fun x => ∫ y, f x y ∂κ x := by
  classical
  borelize E
  haveI : TopologicalSpace.SeparableSpace (range (uncurry f) ∪ {0} : Set E) :=
    hf.separableSpace_range_union_singleton
  let s : ℕ → SimpleFunc (α × β) E :=
    SimpleFunc.approxOn _ hf.measurable (range (uncurry f) ∪ {0}) 0 (by simp)
  let s' : ℕ → α → SimpleFunc β E := fun n x => (s n).comp (Prod.mk x) measurable_prod_mk_left
  let f' : ℕ → α → E := fun n =>
    {x | Integrable (f x) (κ x)}.indicator fun x => (s' n x).integral (κ x)
  have hf' : ∀ n, StronglyMeasurable (f' n) := by
    intro n; refine' StronglyMeasurable.indicator _ (measurableSet_kernel_integrable hf)
    have : ∀ x, ((s' n x).range.filter fun x => x ≠ 0) ⊆ (s n).range := by
      intro x; refine' Finset.Subset.trans (Finset.filter_subset _ _) _; intro y
      simp_rw [SimpleFunc.mem_range]; rintro ⟨z, rfl⟩; exact ⟨(x, z), rfl⟩
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
mγ : MeasurableSpace γ
κ : ↥(kernel α β)
η : ↥(kernel (α × β) γ)
a : α
E : Type u_4
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedSpace ℝ E
inst✝² : CompleteSpace E
inst✝¹ : IsSFiniteKernel κ
inst✝ : IsSFiniteKernel η
f : α → β → E
hf : StronglyMeasurable (uncurry f)
this✝² : MeasurableSpace E := borel E
this✝¹ : BorelSpace E
this✝ : TopologicalSpace.SeparableSpace ↑(range (uncurry f) ∪ {0})
s : ℕ → SimpleFunc (α × β) E :=
  SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0
    (_ : 0 ∈ range (uncurry f) ∪ {0})
s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x))
f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral (κ x) (s' n x)
n : ℕ
this : ∀ (x : α), Finset.filter (fun x => x ≠ 0) (SimpleFunc.range (s' n x)) ⊆ SimpleFunc.range (s n)
⊢ StronglyMeasurable fun x => SimpleFunc.integral (κ x) (s' n x)

Next tactic:
simp only [SimpleFunc.integral_eq_sum_of_subset (this _)]
theorem StronglyMeasurable.integral_kernel_prod_right ⦃f : α → β → E⦄
    (hf : StronglyMeasurable (uncurry f)) : StronglyMeasurable fun x => ∫ y, f x y ∂κ x := by
  classical
  borelize E
  haveI : TopologicalSpace.SeparableSpace (range (uncurry f) ∪ {0} : Set E) :=
    hf.separableSpace_range_union_singleton
  let s : ℕ → SimpleFunc (α × β) E :=
    SimpleFunc.approxOn _ hf.measurable (range (uncurry f) ∪ {0}) 0 (by simp)
  let s' : ℕ → α → SimpleFunc β E := fun n x => (s n).comp (Prod.mk x) measurable_prod_mk_left
  let f' : ℕ → α → E := fun n =>
    {x | Integrable (f x) (κ x)}.indicator fun x => (s' n x).integral (κ x)
  have hf' : ∀ n, StronglyMeasurable (f' n) := by
    intro n; refine' StronglyMeasurable.indicator _ (measurableSet_kernel_integrable hf)
    have : ∀ x, ((s' n x).range.filter fun x => x ≠ 0) ⊆ (s n).range := by
      intro x; refine' Finset.Subset.trans (Finset.filter_subset _ _) _; intro y
      simp_rw [SimpleFunc.mem_range]; rintro ⟨z, rfl⟩; exact ⟨(x, z), rfl⟩
    simp only [SimpleFunc.integral_eq_sum_of_subset (this _)]
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
mγ : MeasurableSpace γ
κ : ↥(kernel α β)
η : ↥(kernel (α × β) γ)
a : α
E : Type u_4
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedSpace ℝ E
inst✝² : CompleteSpace E
inst✝¹ : IsSFiniteKernel κ
inst✝ : IsSFiniteKernel η
f : α → β → E
hf : StronglyMeasurable (uncurry f)
this✝² : MeasurableSpace E := borel E
this✝¹ : BorelSpace E
this✝ : TopologicalSpace.SeparableSpace ↑(range (uncurry f) ∪ {0})
s : ℕ → SimpleFunc (α × β) E :=
  SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0
    (_ : 0 ∈ range (uncurry f) ∪ {0})
s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x))
f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral (κ x) (s' n x)
n : ℕ
this : ∀ (x : α), Finset.filter (fun x => x ≠ 0) (SimpleFunc.range (s' n x)) ⊆ SimpleFunc.range (s n)
⊢ StronglyMeasurable fun x =>
    Finset.sum
      (SimpleFunc.range
        (SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0
          (_ : 0 ∈ range (uncurry f) ∪ {0}) n))
      fun x_1 =>
      ENNReal.toReal
          (↑↑(κ x)
            (↑(SimpleFunc.comp
                  (SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0
                    (_ : 0 ∈ range (uncurry f) ∪ {0}) n)
                  (Prod.mk x) (_ : Measurable (Prod.mk x))) ⁻¹'
              {x_1})) •
        x_1

Next tactic:
refine' Finset.stronglyMeasurable_sum _ fun x _ => _
theorem StronglyMeasurable.integral_kernel_prod_right ⦃f : α → β → E⦄
    (hf : StronglyMeasurable (uncurry f)) : StronglyMeasurable fun x => ∫ y, f x y ∂κ x := by
  classical
  borelize E
  haveI : TopologicalSpace.SeparableSpace (range (uncurry f) ∪ {0} : Set E) :=
    hf.separableSpace_range_union_singleton
  let s : ℕ → SimpleFunc (α × β) E :=
    SimpleFunc.approxOn _ hf.measurable (range (uncurry f) ∪ {0}) 0 (by simp)
  let s' : ℕ → α → SimpleFunc β E := fun n x => (s n).comp (Prod.mk x) measurable_prod_mk_left
  let f' : ℕ → α → E := fun n =>
    {x | Integrable (f x) (κ x)}.indicator fun x => (s' n x).integral (κ x)
  have hf' : ∀ n, StronglyMeasurable (f' n) := by
    intro n; refine' StronglyMeasurable.indicator _ (measurableSet_kernel_integrable hf)
    have : ∀ x, ((s' n x).range.filter fun x => x ≠ 0) ⊆ (s n).range := by
      intro x; refine' Finset.Subset.trans (Finset.filter_subset _ _) _; intro y
      simp_rw [SimpleFunc.mem_range]; rintro ⟨z, rfl⟩; exact ⟨(x, z), rfl⟩
    simp only [SimpleFunc.integral_eq_sum_of_subset (this _)]
    refine' Finset.stronglyMeasurable_sum _ fun x _ => _
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
mγ : MeasurableSpace γ
κ : ↥(kernel α β)
η : ↥(kernel (α × β) γ)
a : α
E : Type u_4
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedSpace ℝ E
inst✝² : CompleteSpace E
inst✝¹ : IsSFiniteKernel κ
inst✝ : IsSFiniteKernel η
f : α → β → E
hf : StronglyMeasurable (uncurry f)
this✝² : MeasurableSpace E := borel E
this✝¹ : BorelSpace E
this✝ : TopologicalSpace.SeparableSpace ↑(range (uncurry f) ∪ {0})
s : ℕ → SimpleFunc (α × β) E :=
  SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0
    (_ : 0 ∈ range (uncurry f) ∪ {0})
s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x))
f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral (κ x) (s' n x)
n : ℕ
this : ∀ (x : α), Finset.filter (fun x => x ≠ 0) (SimpleFunc.range (s' n x)) ⊆ SimpleFunc.range (s n)
x : E
x✝ :
  x ∈
    SimpleFunc.range
      (SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0
        (_ : 0 ∈ range (uncurry f) ∪ {0}) n)
⊢ StronglyMeasurable fun x_1 =>
    ENNReal.toReal
        (↑↑(κ x_1)
          (↑(SimpleFunc.comp
                (SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0
                  (_ : 0 ∈ range (uncurry f) ∪ {0}) n)
                (Prod.mk x_1) (_ : Measurable (Prod.mk x_1))) ⁻¹'
            {x})) •
      x

Next tactic:
refine' (Measurable.ennreal_toReal _).stronglyMeasurable.smul_const _
theorem StronglyMeasurable.integral_kernel_prod_right ⦃f : α → β → E⦄
    (hf : StronglyMeasurable (uncurry f)) : StronglyMeasurable fun x => ∫ y, f x y ∂κ x := by
  classical
  borelize E
  haveI : TopologicalSpace.SeparableSpace (range (uncurry f) ∪ {0} : Set E) :=
    hf.separableSpace_range_union_singleton
  let s : ℕ → SimpleFunc (α × β) E :=
    SimpleFunc.approxOn _ hf.measurable (range (uncurry f) ∪ {0}) 0 (by simp)
  let s' : ℕ → α → SimpleFunc β E := fun n x => (s n).comp (Prod.mk x) measurable_prod_mk_left
  let f' : ℕ → α → E := fun n =>
    {x | Integrable (f x) (κ x)}.indicator fun x => (s' n x).integral (κ x)
  have hf' : ∀ n, StronglyMeasurable (f' n) := by
    intro n; refine' StronglyMeasurable.indicator _ (measurableSet_kernel_integrable hf)
    have : ∀ x, ((s' n x).range.filter fun x => x ≠ 0) ⊆ (s n).range := by
      intro x; refine' Finset.Subset.trans (Finset.filter_subset _ _) _; intro y
      simp_rw [SimpleFunc.mem_range]; rintro ⟨z, rfl⟩; exact ⟨(x, z), rfl⟩
    simp only [SimpleFunc.integral_eq_sum_of_subset (this _)]
    refine' Finset.stronglyMeasurable_sum _ fun x _ => _
    refine' (Measurable.ennreal_toReal _).stronglyMeasurable.smul_const _
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
mγ : MeasurableSpace γ
κ : ↥(kernel α β)
η : ↥(kernel (α × β) γ)
a : α
E : Type u_4
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedSpace ℝ E
inst✝² : CompleteSpace E
inst✝¹ : IsSFiniteKernel κ
inst✝ : IsSFiniteKernel η
f : α → β → E
hf : StronglyMeasurable (uncurry f)
this✝² : MeasurableSpace E := borel E
this✝¹ : BorelSpace E
this✝ : TopologicalSpace.SeparableSpace ↑(range (uncurry f) ∪ {0})
s : ℕ → SimpleFunc (α × β) E :=
  SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0
    (_ : 0 ∈ range (uncurry f) ∪ {0})
s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x))
f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral (κ x) (s' n x)
n : ℕ
this : ∀ (x : α), Finset.filter (fun x => x ≠ 0) (SimpleFunc.range (s' n x)) ⊆ SimpleFunc.range (s n)
x : E
x✝ :
  x ∈
    SimpleFunc.range
      (SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0
        (_ : 0 ∈ range (uncurry f) ∪ {0}) n)
⊢ Measurable fun x_1 =>
    ↑↑(κ x_1)
      (↑(SimpleFunc.comp
            (SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0
              (_ : 0 ∈ range (uncurry f) ∪ {0}) n)
            (Prod.mk x_1) (_ : Measurable (Prod.mk x_1))) ⁻¹'
        {x})

Next tactic:
simp (config := { singlePass := true }) only [SimpleFunc.coe_comp, preimage_comp]
theorem StronglyMeasurable.integral_kernel_prod_right ⦃f : α → β → E⦄
    (hf : StronglyMeasurable (uncurry f)) : StronglyMeasurable fun x => ∫ y, f x y ∂κ x := by
  classical
  borelize E
  haveI : TopologicalSpace.SeparableSpace (range (uncurry f) ∪ {0} : Set E) :=
    hf.separableSpace_range_union_singleton
  let s : ℕ → SimpleFunc (α × β) E :=
    SimpleFunc.approxOn _ hf.measurable (range (uncurry f) ∪ {0}) 0 (by simp)
  let s' : ℕ → α → SimpleFunc β E := fun n x => (s n).comp (Prod.mk x) measurable_prod_mk_left
  let f' : ℕ → α → E := fun n =>
    {x | Integrable (f x) (κ x)}.indicator fun x => (s' n x).integral (κ x)
  have hf' : ∀ n, StronglyMeasurable (f' n) := by
    intro n; refine' StronglyMeasurable.indicator _ (measurableSet_kernel_integrable hf)
    have : ∀ x, ((s' n x).range.filter fun x => x ≠ 0) ⊆ (s n).range := by
      intro x; refine' Finset.Subset.trans (Finset.filter_subset _ _) _; intro y
      simp_rw [SimpleFunc.mem_range]; rintro ⟨z, rfl⟩; exact ⟨(x, z), rfl⟩
    simp only [SimpleFunc.integral_eq_sum_of_subset (this _)]
    refine' Finset.stronglyMeasurable_sum _ fun x _ => _
    refine' (Measurable.ennreal_toReal _).stronglyMeasurable.smul_const _
    simp (config := { singlePass := true }) only [SimpleFunc.coe_comp, preimage_comp]
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
mγ : MeasurableSpace γ
κ : ↥(kernel α β)
η : ↥(kernel (α × β) γ)
a : α
E : Type u_4
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedSpace ℝ E
inst✝² : CompleteSpace E
inst✝¹ : IsSFiniteKernel κ
inst✝ : IsSFiniteKernel η
f : α → β → E
hf : StronglyMeasurable (uncurry f)
this✝² : MeasurableSpace E := borel E
this✝¹ : BorelSpace E
this✝ : TopologicalSpace.SeparableSpace ↑(range (uncurry f) ∪ {0})
s : ℕ → SimpleFunc (α × β) E :=
  SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0
    (_ : 0 ∈ range (uncurry f) ∪ {0})
s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x))
f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral (κ x) (s' n x)
n : ℕ
this : ∀ (x : α), Finset.filter (fun x => x ≠ 0) (SimpleFunc.range (s' n x)) ⊆ SimpleFunc.range (s n)
x : E
x✝ :
  x ∈
    SimpleFunc.range
      (SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0
        (_ : 0 ∈ range (uncurry f) ∪ {0}) n)
⊢ Measurable fun x_1 =>
    ↑↑(κ x_1)
      (Prod.mk x_1 ⁻¹'
        (↑(SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0
              (_ : 0 ∈ range (uncurry f) ∪ {0}) n) ⁻¹'
          {x}))

Next tactic:
apply kernel.measurable_kernel_prod_mk_left
theorem StronglyMeasurable.integral_kernel_prod_right ⦃f : α → β → E⦄
    (hf : StronglyMeasurable (uncurry f)) : StronglyMeasurable fun x => ∫ y, f x y ∂κ x := by
  classical
  borelize E
  haveI : TopologicalSpace.SeparableSpace (range (uncurry f) ∪ {0} : Set E) :=
    hf.separableSpace_range_union_singleton
  let s : ℕ → SimpleFunc (α × β) E :=
    SimpleFunc.approxOn _ hf.measurable (range (uncurry f) ∪ {0}) 0 (by simp)
  let s' : ℕ → α → SimpleFunc β E := fun n x => (s n).comp (Prod.mk x) measurable_prod_mk_left
  let f' : ℕ → α → E := fun n =>
    {x | Integrable (f x) (κ x)}.indicator fun x => (s' n x).integral (κ x)
  have hf' : ∀ n, StronglyMeasurable (f' n) := by
    intro n; refine' StronglyMeasurable.indicator _ (measurableSet_kernel_integrable hf)
    have : ∀ x, ((s' n x).range.filter fun x => x ≠ 0) ⊆ (s n).range := by
      intro x; refine' Finset.Subset.trans (Finset.filter_subset _ _) _; intro y
      simp_rw [SimpleFunc.mem_range]; rintro ⟨z, rfl⟩; exact ⟨(x, z), rfl⟩
    simp only [SimpleFunc.integral_eq_sum_of_subset (this _)]
    refine' Finset.stronglyMeasurable_sum _ fun x _ => _
    refine' (Measurable.ennreal_toReal _).stronglyMeasurable.smul_const _
    simp (config := { singlePass := true }) only [SimpleFunc.coe_comp, preimage_comp]
    apply kernel.measurable_kernel_prod_mk_left
    

Proof state:
case ht
α : Type u_1
β : Type u_2
γ : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
mγ : MeasurableSpace γ
κ : ↥(kernel α β)
η : ↥(kernel (α × β) γ)
a : α
E : Type u_4
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedSpace ℝ E
inst✝² : CompleteSpace E
inst✝¹ : IsSFiniteKernel κ
inst✝ : IsSFiniteKernel η
f : α → β → E
hf : StronglyMeasurable (uncurry f)
this✝² : MeasurableSpace E := borel E
this✝¹ : BorelSpace E
this✝ : TopologicalSpace.SeparableSpace ↑(range (uncurry f) ∪ {0})
s : ℕ → SimpleFunc (α × β) E :=
  SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0
    (_ : 0 ∈ range (uncurry f) ∪ {0})
s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x))
f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral (κ x) (s' n x)
n : ℕ
this : ∀ (x : α), Finset.filter (fun x => x ≠ 0) (SimpleFunc.range (s' n x)) ⊆ SimpleFunc.range (s n)
x : E
x✝ :
  x ∈
    SimpleFunc.range
      (SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0
        (_ : 0 ∈ range (uncurry f) ∪ {0}) n)
⊢ MeasurableSet
    (↑(SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0
          (_ : 0 ∈ range (uncurry f) ∪ {0}) n) ⁻¹'
      {x})

Next tactic:
exact (s n).measurableSet_fiber x
theorem StronglyMeasurable.integral_kernel_prod_right ⦃f : α → β → E⦄
    (hf : StronglyMeasurable (uncurry f)) : StronglyMeasurable fun x => ∫ y, f x y ∂κ x := by
  classical
  borelize E
  haveI : TopologicalSpace.SeparableSpace (range (uncurry f) ∪ {0} : Set E) :=
    hf.separableSpace_range_union_singleton
  let s : ℕ → SimpleFunc (α × β) E :=
    SimpleFunc.approxOn _ hf.measurable (range (uncurry f) ∪ {0}) 0 (by simp)
  let s' : ℕ → α → SimpleFunc β E := fun n x => (s n).comp (Prod.mk x) measurable_prod_mk_left
  let f' : ℕ → α → E := fun n =>
    {x | Integrable (f x) (κ x)}.indicator fun x => (s' n x).integral (κ x)
  have hf' : ∀ n, StronglyMeasurable (f' n) := by
    intro n; refine' StronglyMeasurable.indicator _ (measurableSet_kernel_integrable hf)
    have : ∀ x, ((s' n x).range.filter fun x => x ≠ 0) ⊆ (s n).range := by
      intro x; refine' Finset.Subset.trans (Finset.filter_subset _ _) _; intro y
      simp_rw [SimpleFunc.mem_range]; rintro ⟨z, rfl⟩; exact ⟨(x, z), rfl⟩
    simp only [SimpleFunc.integral_eq_sum_of_subset (this _)]
    refine' Finset.stronglyMeasurable_sum _ fun x _ => _
    refine' (Measurable.ennreal_toReal _).stronglyMeasurable.smul_const _
    simp (config := { singlePass := true }) only [SimpleFunc.coe_comp, preimage_comp]
    apply kernel.measurable_kernel_prod_mk_left
    exact (s n).measurableSet_fiber x
  have h2f' : Tendsto f' atTop (𝓝 fun x : α => ∫ y : β, f x y ∂κ x) := by
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
mγ : MeasurableSpace γ
κ : ↥(kernel α β)
η : ↥(kernel (α × β) γ)
a : α
E : Type u_4
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedSpace ℝ E
inst✝² : CompleteSpace E
inst✝¹ : IsSFiniteKernel κ
inst✝ : IsSFiniteKernel η
f : α → β → E
hf : StronglyMeasurable (uncurry f)
this✝¹ : MeasurableSpace E := borel E
this✝ : BorelSpace E
this : TopologicalSpace.SeparableSpace ↑(range (uncurry f) ∪ {0})
s : ℕ → SimpleFunc (α × β) E :=
  SimpleFunc.approxOn (uncurry f) (_ : Measurable (uncurry f)) (range (uncurry f) ∪ {0}) 0
    (_ : 0 ∈ range (uncurry f) ∪ {0})
s' : ℕ → α → SimpleFunc β E := fun n x => SimpleFunc.comp (s n) (Prod.mk x) (_ : Measurable (Prod.mk x))
f' : ℕ → α → E := fun n => indicator {x | Integrable (f x)} fun x => SimpleFunc.integral (κ x) (s' n x)
hf' : ∀ (n : ℕ), StronglyMeasurable (f' n)
⊢ Tendsto f' atTop (𝓝 fun x => ∫ (y : β), f x y ∂κ x)

Next tactic:
rw [tendsto_pi_nhds]