l3lab/ntp-mathlib huggingface dataset:
theorem compProdFun_eq_tsum (κ : kernel α β) [IsSFiniteKernel κ] (η : kernel (α × β) γ)
    [IsSFiniteKernel η] (a : α) (hs : MeasurableSet s) :
    compProdFun κ η a s = ∑' (n) (m), compProdFun (seq κ n) (seq η m) a s := by
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
γ : Type u_4
mγ : MeasurableSpace γ
s : Set (β × γ)
κ : ↥(kernel α β)
inst✝¹ : IsSFiniteKernel κ
η : ↥(kernel (α × β) γ)
inst✝ : IsSFiniteKernel η
a : α
hs : MeasurableSet s
⊢ compProdFun κ η a s = ∑' (n : ℕ) (m : ℕ), compProdFun (seq κ n) (seq η m) a s

Next tactic:
simp_rw [compProdFun_tsum_left κ η a s, compProdFun_tsum_right _ η a hs]
/-- Auxiliary lemma for `measurable_compProdFun`. -/
theorem measurable_compProdFun_of_finite (κ : kernel α β) [IsFiniteKernel κ] (η : kernel (α × β) γ)
    [IsFiniteKernel η] (hs : MeasurableSet s) : Measurable fun a => compProdFun κ η a s := by
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
γ : Type u_4
mγ : MeasurableSpace γ
s : Set (β × γ)
κ : ↥(kernel α β)
inst✝¹ : IsFiniteKernel κ
η : ↥(kernel (α × β) γ)
inst✝ : IsFiniteKernel η
hs : MeasurableSet s
⊢ Measurable fun a => compProdFun κ η a s

Next tactic:
simp only [compProdFun]
/-- Auxiliary lemma for `measurable_compProdFun`. -/
theorem measurable_compProdFun_of_finite (κ : kernel α β) [IsFiniteKernel κ] (η : kernel (α × β) γ)
    [IsFiniteKernel η] (hs : MeasurableSet s) : Measurable fun a => compProdFun κ η a s := by
  simp only [compProdFun]
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
γ : Type u_4
mγ : MeasurableSpace γ
s : Set (β × γ)
κ : ↥(kernel α β)
inst✝¹ : IsFiniteKernel κ
η : ↥(kernel (α × β) γ)
inst✝ : IsFiniteKernel η
hs : MeasurableSet s
⊢ Measurable fun a => ∫⁻ (b : β), ↑↑(η (a, b)) {c | (b, c) ∈ s} ∂κ a

Next tactic:
have h_meas : Measurable (Function.uncurry fun a b => η (a, b) {c : γ | (b, c) ∈ s}) := by
    have :
      (Function.uncurry fun a b => η (a, b) {c : γ | (b, c) ∈ s}) = fun p =>
        η p {c : γ | (p.2, c) ∈ s} := by
      ext1 p
      rw [Function.uncurry_apply_pair]
    rw [this]
    exact measurable_kernel_prod_mk_left (measurable_fst.snd.prod_mk measurable_snd hs)
/-- Auxiliary lemma for `measurable_compProdFun`. -/
theorem measurable_compProdFun_of_finite (κ : kernel α β) [IsFiniteKernel κ] (η : kernel (α × β) γ)
    [IsFiniteKernel η] (hs : MeasurableSet s) : Measurable fun a => compProdFun κ η a s := by
  simp only [compProdFun]
  have h_meas : Measurable (Function.uncurry fun a b => η (a, b) {c : γ | (b, c) ∈ s}) := by
    

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
γ : Type u_4
mγ : MeasurableSpace γ
s : Set (β × γ)
κ : ↥(kernel α β)
inst✝¹ : IsFiniteKernel κ
η : ↥(kernel (α × β) γ)
inst✝ : IsFiniteKernel η
hs : MeasurableSet s
⊢ Measurable (Function.uncurry fun a b => ↑↑(η (a, b)) {c | (b, c) ∈ s})

Next tactic:
have :
      (Function.uncurry fun a b => η (a, b) {c : γ | (b, c) ∈ s}) = fun p =>
        η p {c : γ | (p.2, c) ∈ s} := by
      ext1 p
      rw [Function.uncurry_apply_pair]
/-- Auxiliary lemma for `measurable_compProdFun`. -/
theorem measurable_compProdFun_of_finite (κ : kernel α β) [IsFiniteKernel κ] (η : kernel (α × β) γ)
    [IsFiniteKernel η] (hs : MeasurableSet s) : Measurable fun a => compProdFun κ η a s := by
  simp only [compProdFun]
  have h_meas : Measurable (Function.uncurry fun a b => η (a, b) {c : γ | (b, c) ∈ s}) := by
    have :
      (Function.uncurry fun a b => η (a, b) {c : γ | (b, c) ∈ s}) = fun p =>
        η p {c : γ | (p.2, c) ∈ s} := by
      

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
γ : Type u_4
mγ : MeasurableSpace γ
s : Set (β × γ)
κ : ↥(kernel α β)
inst✝¹ : IsFiniteKernel κ
η : ↥(kernel (α × β) γ)
inst✝ : IsFiniteKernel η
hs : MeasurableSet s
⊢ (Function.uncurry fun a b => ↑↑(η (a, b)) {c | (b, c) ∈ s}) = fun p => ↑↑(η p) {c | (p.2, c) ∈ s}

Next tactic:
ext1 p
/-- Auxiliary lemma for `measurable_compProdFun`. -/
theorem measurable_compProdFun_of_finite (κ : kernel α β) [IsFiniteKernel κ] (η : kernel (α × β) γ)
    [IsFiniteKernel η] (hs : MeasurableSet s) : Measurable fun a => compProdFun κ η a s := by
  simp only [compProdFun]
  have h_meas : Measurable (Function.uncurry fun a b => η (a, b) {c : γ | (b, c) ∈ s}) := by
    have :
      (Function.uncurry fun a b => η (a, b) {c : γ | (b, c) ∈ s}) = fun p =>
        η p {c : γ | (p.2, c) ∈ s} := by
      ext1 p
      

Proof state:
case h
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
γ : Type u_4
mγ : MeasurableSpace γ
s : Set (β × γ)
κ : ↥(kernel α β)
inst✝¹ : IsFiniteKernel κ
η : ↥(kernel (α × β) γ)
inst✝ : IsFiniteKernel η
hs : MeasurableSet s
p : α × β
⊢ Function.uncurry (fun a b => ↑↑(η (a, b)) {c | (b, c) ∈ s}) p = ↑↑(η p) {c | (p.2, c) ∈ s}

Next tactic:
rw [Function.uncurry_apply_pair]
/-- Auxiliary lemma for `measurable_compProdFun`. -/
theorem measurable_compProdFun_of_finite (κ : kernel α β) [IsFiniteKernel κ] (η : kernel (α × β) γ)
    [IsFiniteKernel η] (hs : MeasurableSet s) : Measurable fun a => compProdFun κ η a s := by
  simp only [compProdFun]
  have h_meas : Measurable (Function.uncurry fun a b => η (a, b) {c : γ | (b, c) ∈ s}) := by
    have :
      (Function.uncurry fun a b => η (a, b) {c : γ | (b, c) ∈ s}) = fun p =>
        η p {c : γ | (p.2, c) ∈ s} := by
      ext1 p
      rw [Function.uncurry_apply_pair]
    

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
γ : Type u_4
mγ : MeasurableSpace γ
s : Set (β × γ)
κ : ↥(kernel α β)
inst✝¹ : IsFiniteKernel κ
η : ↥(kernel (α × β) γ)
inst✝ : IsFiniteKernel η
hs : MeasurableSet s
this : (Function.uncurry fun a b => ↑↑(η (a, b)) {c | (b, c) ∈ s}) = fun p => ↑↑(η p) {c | (p.2, c) ∈ s}
⊢ Measurable (Function.uncurry fun a b => ↑↑(η (a, b)) {c | (b, c) ∈ s})

Next tactic:
rw [this]
/-- Auxiliary lemma for `measurable_compProdFun`. -/
theorem measurable_compProdFun_of_finite (κ : kernel α β) [IsFiniteKernel κ] (η : kernel (α × β) γ)
    [IsFiniteKernel η] (hs : MeasurableSet s) : Measurable fun a => compProdFun κ η a s := by
  simp only [compProdFun]
  have h_meas : Measurable (Function.uncurry fun a b => η (a, b) {c : γ | (b, c) ∈ s}) := by
    have :
      (Function.uncurry fun a b => η (a, b) {c : γ | (b, c) ∈ s}) = fun p =>
        η p {c : γ | (p.2, c) ∈ s} := by
      ext1 p
      rw [Function.uncurry_apply_pair]
    rw [this]
    

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
γ : Type u_4
mγ : MeasurableSpace γ
s : Set (β × γ)
κ : ↥(kernel α β)
inst✝¹ : IsFiniteKernel κ
η : ↥(kernel (α × β) γ)
inst✝ : IsFiniteKernel η
hs : MeasurableSet s
this : (Function.uncurry fun a b => ↑↑(η (a, b)) {c | (b, c) ∈ s}) = fun p => ↑↑(η p) {c | (p.2, c) ∈ s}
⊢ Measurable fun p => ↑↑(η p) {c | (p.2, c) ∈ s}

Next tactic:
exact measurable_kernel_prod_mk_left (measurable_fst.snd.prod_mk measurable_snd hs)
/-- Auxiliary lemma for `measurable_compProdFun`. -/
theorem measurable_compProdFun_of_finite (κ : kernel α β) [IsFiniteKernel κ] (η : kernel (α × β) γ)
    [IsFiniteKernel η] (hs : MeasurableSet s) : Measurable fun a => compProdFun κ η a s := by
  simp only [compProdFun]
  have h_meas : Measurable (Function.uncurry fun a b => η (a, b) {c : γ | (b, c) ∈ s}) := by
    have :
      (Function.uncurry fun a b => η (a, b) {c : γ | (b, c) ∈ s}) = fun p =>
        η p {c : γ | (p.2, c) ∈ s} := by
      ext1 p
      rw [Function.uncurry_apply_pair]
    rw [this]
    exact measurable_kernel_prod_mk_left (measurable_fst.snd.prod_mk measurable_snd hs)
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
γ : Type u_4
mγ : MeasurableSpace γ
s : Set (β × γ)
κ : ↥(kernel α β)
inst✝¹ : IsFiniteKernel κ
η : ↥(kernel (α × β) γ)
inst✝ : IsFiniteKernel η
hs : MeasurableSet s
h_meas : Measurable (Function.uncurry fun a b => ↑↑(η (a, b)) {c | (b, c) ∈ s})
⊢ Measurable fun a => ∫⁻ (b : β), ↑↑(η (a, b)) {c | (b, c) ∈ s} ∂κ a

Next tactic:
exact h_meas.lintegral_kernel_prod_right
theorem measurable_compProdFun (κ : kernel α β) [IsSFiniteKernel κ] (η : kernel (α × β) γ)
    [IsSFiniteKernel η] (hs : MeasurableSet s) : Measurable fun a => compProdFun κ η a s := by
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
γ : Type u_4
mγ : MeasurableSpace γ
s : Set (β × γ)
κ : ↥(kernel α β)
inst✝¹ : IsSFiniteKernel κ
η : ↥(kernel (α × β) γ)
inst✝ : IsSFiniteKernel η
hs : MeasurableSet s
⊢ Measurable fun a => compProdFun κ η a s

Next tactic:
simp_rw [compProdFun_tsum_right κ η _ hs]
theorem measurable_compProdFun (κ : kernel α β) [IsSFiniteKernel κ] (η : kernel (α × β) γ)
    [IsSFiniteKernel η] (hs : MeasurableSet s) : Measurable fun a => compProdFun κ η a s := by
  simp_rw [compProdFun_tsum_right κ η _ hs]
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
γ : Type u_4
mγ : MeasurableSpace γ
s : Set (β × γ)
κ : ↥(kernel α β)
inst✝¹ : IsSFiniteKernel κ
η : ↥(kernel (α × β) γ)
inst✝ : IsSFiniteKernel η
hs : MeasurableSet s
⊢ Measurable fun a => ∑' (n : ℕ), compProdFun κ (seq η n) a s

Next tactic:
refine' Measurable.ennreal_tsum fun n => _
theorem measurable_compProdFun (κ : kernel α β) [IsSFiniteKernel κ] (η : kernel (α × β) γ)
    [IsSFiniteKernel η] (hs : MeasurableSet s) : Measurable fun a => compProdFun κ η a s := by
  simp_rw [compProdFun_tsum_right κ η _ hs]
  refine' Measurable.ennreal_tsum fun n => _
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
γ : Type u_4
mγ : MeasurableSpace γ
s : Set (β × γ)
κ : ↥(kernel α β)
inst✝¹ : IsSFiniteKernel κ
η : ↥(kernel (α × β) γ)
inst✝ : IsSFiniteKernel η
hs : MeasurableSet s
n : ℕ
⊢ Measurable fun a => compProdFun κ (seq η n) a s

Next tactic:
simp only [compProdFun]
theorem measurable_compProdFun (κ : kernel α β) [IsSFiniteKernel κ] (η : kernel (α × β) γ)
    [IsSFiniteKernel η] (hs : MeasurableSet s) : Measurable fun a => compProdFun κ η a s := by
  simp_rw [compProdFun_tsum_right κ η _ hs]
  refine' Measurable.ennreal_tsum fun n => _
  simp only [compProdFun]
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
γ : Type u_4
mγ : MeasurableSpace γ
s : Set (β × γ)
κ : ↥(kernel α β)
inst✝¹ : IsSFiniteKernel κ
η : ↥(kernel (α × β) γ)
inst✝ : IsSFiniteKernel η
hs : MeasurableSet s
n : ℕ
⊢ Measurable fun a => ∫⁻ (b : β), ↑↑((seq η n) (a, b)) {c | (b, c) ∈ s} ∂κ a

Next tactic:
have h_meas : Measurable (Function.uncurry fun a b => seq η n (a, b) {c : γ | (b, c) ∈ s}) := by
    have :
      (Function.uncurry fun a b => seq η n (a, b) {c : γ | (b, c) ∈ s}) = fun p =>
        seq η n p {c : γ | (p.2, c) ∈ s} := by
      ext1 p
      rw [Function.uncurry_apply_pair]
    rw [this]
    exact measurable_kernel_prod_mk_left (measurable_fst.snd.prod_mk measurable_snd hs)
theorem measurable_compProdFun (κ : kernel α β) [IsSFiniteKernel κ] (η : kernel (α × β) γ)
    [IsSFiniteKernel η] (hs : MeasurableSet s) : Measurable fun a => compProdFun κ η a s := by
  simp_rw [compProdFun_tsum_right κ η _ hs]
  refine' Measurable.ennreal_tsum fun n => _
  simp only [compProdFun]
  have h_meas : Measurable (Function.uncurry fun a b => seq η n (a, b) {c : γ | (b, c) ∈ s}) := by
    

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
γ : Type u_4
mγ : MeasurableSpace γ
s : Set (β × γ)
κ : ↥(kernel α β)
inst✝¹ : IsSFiniteKernel κ
η : ↥(kernel (α × β) γ)
inst✝ : IsSFiniteKernel η
hs : MeasurableSet s
n : ℕ
⊢ Measurable (Function.uncurry fun a b => ↑↑((seq η n) (a, b)) {c | (b, c) ∈ s})

Next tactic:
have :
      (Function.uncurry fun a b => seq η n (a, b) {c : γ | (b, c) ∈ s}) = fun p =>
        seq η n p {c : γ | (p.2, c) ∈ s} := by
      ext1 p
      rw [Function.uncurry_apply_pair]
theorem measurable_compProdFun (κ : kernel α β) [IsSFiniteKernel κ] (η : kernel (α × β) γ)
    [IsSFiniteKernel η] (hs : MeasurableSet s) : Measurable fun a => compProdFun κ η a s := by
  simp_rw [compProdFun_tsum_right κ η _ hs]
  refine' Measurable.ennreal_tsum fun n => _
  simp only [compProdFun]
  have h_meas : Measurable (Function.uncurry fun a b => seq η n (a, b) {c : γ | (b, c) ∈ s}) := by
    have :
      (Function.uncurry fun a b => seq η n (a, b) {c : γ | (b, c) ∈ s}) = fun p =>
        seq η n p {c : γ | (p.2, c) ∈ s} := by
      

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
γ : Type u_4
mγ : MeasurableSpace γ
s : Set (β × γ)
κ : ↥(kernel α β)
inst✝¹ : IsSFiniteKernel κ
η : ↥(kernel (α × β) γ)
inst✝ : IsSFiniteKernel η
hs : MeasurableSet s
n : ℕ
⊢ (Function.uncurry fun a b => ↑↑((seq η n) (a, b)) {c | (b, c) ∈ s}) = fun p => ↑↑((seq η n) p) {c | (p.2, c) ∈ s}

Next tactic:
ext1 p
theorem measurable_compProdFun (κ : kernel α β) [IsSFiniteKernel κ] (η : kernel (α × β) γ)
    [IsSFiniteKernel η] (hs : MeasurableSet s) : Measurable fun a => compProdFun κ η a s := by
  simp_rw [compProdFun_tsum_right κ η _ hs]
  refine' Measurable.ennreal_tsum fun n => _
  simp only [compProdFun]
  have h_meas : Measurable (Function.uncurry fun a b => seq η n (a, b) {c : γ | (b, c) ∈ s}) := by
    have :
      (Function.uncurry fun a b => seq η n (a, b) {c : γ | (b, c) ∈ s}) = fun p =>
        seq η n p {c : γ | (p.2, c) ∈ s} := by
      ext1 p
      

Proof state:
case h
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
γ : Type u_4
mγ : MeasurableSpace γ
s : Set (β × γ)
κ : ↥(kernel α β)
inst✝¹ : IsSFiniteKernel κ
η : ↥(kernel (α × β) γ)
inst✝ : IsSFiniteKernel η
hs : MeasurableSet s
n : ℕ
p : α × β
⊢ Function.uncurry (fun a b => ↑↑((seq η n) (a, b)) {c | (b, c) ∈ s}) p = ↑↑((seq η n) p) {c | (p.2, c) ∈ s}

Next tactic:
rw [Function.uncurry_apply_pair]
theorem measurable_compProdFun (κ : kernel α β) [IsSFiniteKernel κ] (η : kernel (α × β) γ)
    [IsSFiniteKernel η] (hs : MeasurableSet s) : Measurable fun a => compProdFun κ η a s := by
  simp_rw [compProdFun_tsum_right κ η _ hs]
  refine' Measurable.ennreal_tsum fun n => _
  simp only [compProdFun]
  have h_meas : Measurable (Function.uncurry fun a b => seq η n (a, b) {c : γ | (b, c) ∈ s}) := by
    have :
      (Function.uncurry fun a b => seq η n (a, b) {c : γ | (b, c) ∈ s}) = fun p =>
        seq η n p {c : γ | (p.2, c) ∈ s} := by
      ext1 p
      rw [Function.uncurry_apply_pair]
    

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
γ : Type u_4
mγ : MeasurableSpace γ
s : Set (β × γ)
κ : ↥(kernel α β)
inst✝¹ : IsSFiniteKernel κ
η : ↥(kernel (α × β) γ)
inst✝ : IsSFiniteKernel η
hs : MeasurableSet s
n : ℕ
this : (Function.uncurry fun a b => ↑↑((seq η n) (a, b)) {c | (b, c) ∈ s}) = fun p => ↑↑((seq η n) p) {c | (p.2, c) ∈ s}
⊢ Measurable (Function.uncurry fun a b => ↑↑((seq η n) (a, b)) {c | (b, c) ∈ s})

Next tactic:
rw [this]
theorem measurable_compProdFun (κ : kernel α β) [IsSFiniteKernel κ] (η : kernel (α × β) γ)
    [IsSFiniteKernel η] (hs : MeasurableSet s) : Measurable fun a => compProdFun κ η a s := by
  simp_rw [compProdFun_tsum_right κ η _ hs]
  refine' Measurable.ennreal_tsum fun n => _
  simp only [compProdFun]
  have h_meas : Measurable (Function.uncurry fun a b => seq η n (a, b) {c : γ | (b, c) ∈ s}) := by
    have :
      (Function.uncurry fun a b => seq η n (a, b) {c : γ | (b, c) ∈ s}) = fun p =>
        seq η n p {c : γ | (p.2, c) ∈ s} := by
      ext1 p
      rw [Function.uncurry_apply_pair]
    rw [this]
    

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
γ : Type u_4
mγ : MeasurableSpace γ
s : Set (β × γ)
κ : ↥(kernel α β)
inst✝¹ : IsSFiniteKernel κ
η : ↥(kernel (α × β) γ)
inst✝ : IsSFiniteKernel η
hs : MeasurableSet s
n : ℕ
this : (Function.uncurry fun a b => ↑↑((seq η n) (a, b)) {c | (b, c) ∈ s}) = fun p => ↑↑((seq η n) p) {c | (p.2, c) ∈ s}
⊢ Measurable fun p => ↑↑((seq η n) p) {c | (p.2, c) ∈ s}

Next tactic:
exact measurable_kernel_prod_mk_left (measurable_fst.snd.prod_mk measurable_snd hs)
theorem measurable_compProdFun (κ : kernel α β) [IsSFiniteKernel κ] (η : kernel (α × β) γ)
    [IsSFiniteKernel η] (hs : MeasurableSet s) : Measurable fun a => compProdFun κ η a s := by
  simp_rw [compProdFun_tsum_right κ η _ hs]
  refine' Measurable.ennreal_tsum fun n => _
  simp only [compProdFun]
  have h_meas : Measurable (Function.uncurry fun a b => seq η n (a, b) {c : γ | (b, c) ∈ s}) := by
    have :
      (Function.uncurry fun a b => seq η n (a, b) {c : γ | (b, c) ∈ s}) = fun p =>
        seq η n p {c : γ | (p.2, c) ∈ s} := by
      ext1 p
      rw [Function.uncurry_apply_pair]
    rw [this]
    exact measurable_kernel_prod_mk_left (measurable_fst.snd.prod_mk measurable_snd hs)
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
γ : Type u_4
mγ : MeasurableSpace γ
s : Set (β × γ)
κ : ↥(kernel α β)
inst✝¹ : IsSFiniteKernel κ
η : ↥(kernel (α × β) γ)
inst✝ : IsSFiniteKernel η
hs : MeasurableSet s
n : ℕ
h_meas : Measurable (Function.uncurry fun a b => ↑↑((seq η n) (a, b)) {c | (b, c) ∈ s})
⊢ Measurable fun a => ∫⁻ (b : β), ↑↑((seq η n) (a, b)) {c | (b, c) ∈ s} ∂κ a

Next tactic:
exact h_meas.lintegral_kernel_prod_right
/-- Composition-Product of kernels. For s-finite kernels, it satisfies
`∫⁻ bc, f bc ∂(compProd κ η a) = ∫⁻ b, ∫⁻ c, f (b, c) ∂(η (a, b)) ∂(κ a)`
(see `ProbabilityTheory.kernel.lintegral_compProd`).
If either of the kernels is not s-finite, `compProd` is given the junk value 0. -/
noncomputable def compProd (κ : kernel α β) (η : kernel (α × β) γ) : kernel α (β × γ) :=
if h : IsSFiniteKernel κ ∧ IsSFiniteKernel η then
{ val := λ a ↦
    Measure.ofMeasurable (fun s _ => compProdFun κ η a s) (compProdFun_empty κ η a)
      (@compProdFun_iUnion _ _ _ _ _ _ κ η h.2 a)
  property := by
    

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
γ : Type u_4
mγ : MeasurableSpace γ
s : Set (β × γ)
κ : ↥(kernel α β)
η : ↥(kernel (α × β) γ)
h : IsSFiniteKernel κ ∧ IsSFiniteKernel η
⊢ (fun a =>
      Measure.ofMeasurable (fun s x => compProdFun κ η a s) (_ : compProdFun κ η a ∅ = 0)
        (_ :
          ∀ (f : ℕ → Set (β × γ)),
            (∀ (i : ℕ), MeasurableSet (f i)) →
              Pairwise (Disjoint on f) → compProdFun κ η a (⋃ i, f i) = ∑' (i : ℕ), compProdFun κ η a (f i))) ∈
    kernel α (β × γ)

Next tactic:
have : IsSFiniteKernel κ := h.1
/-- Composition-Product of kernels. For s-finite kernels, it satisfies
`∫⁻ bc, f bc ∂(compProd κ η a) = ∫⁻ b, ∫⁻ c, f (b, c) ∂(η (a, b)) ∂(κ a)`
(see `ProbabilityTheory.kernel.lintegral_compProd`).
If either of the kernels is not s-finite, `compProd` is given the junk value 0. -/
noncomputable def compProd (κ : kernel α β) (η : kernel (α × β) γ) : kernel α (β × γ) :=
if h : IsSFiniteKernel κ ∧ IsSFiniteKernel η then
{ val := λ a ↦
    Measure.ofMeasurable (fun s _ => compProdFun κ η a s) (compProdFun_empty κ η a)
      (@compProdFun_iUnion _ _ _ _ _ _ κ η h.2 a)
  property := by
    have : IsSFiniteKernel κ := h.1
    

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
γ : Type u_4
mγ : MeasurableSpace γ
s : Set (β × γ)
κ : ↥(kernel α β)
η : ↥(kernel (α × β) γ)
h : IsSFiniteKernel κ ∧ IsSFiniteKernel η
this : IsSFiniteKernel κ
⊢ (fun a =>
      Measure.ofMeasurable (fun s x => compProdFun κ η a s) (_ : compProdFun κ η a ∅ = 0)
        (_ :
          ∀ (f : ℕ → Set (β × γ)),
            (∀ (i : ℕ), MeasurableSet (f i)) →
              Pairwise (Disjoint on f) → compProdFun κ η a (⋃ i, f i) = ∑' (i : ℕ), compProdFun κ η a (f i))) ∈
    kernel α (β × γ)

Next tactic:
have : IsSFiniteKernel η := h.2
/-- Composition-Product of kernels. For s-finite kernels, it satisfies
`∫⁻ bc, f bc ∂(compProd κ η a) = ∫⁻ b, ∫⁻ c, f (b, c) ∂(η (a, b)) ∂(κ a)`
(see `ProbabilityTheory.kernel.lintegral_compProd`).
If either of the kernels is not s-finite, `compProd` is given the junk value 0. -/
noncomputable def compProd (κ : kernel α β) (η : kernel (α × β) γ) : kernel α (β × γ) :=
if h : IsSFiniteKernel κ ∧ IsSFiniteKernel η then
{ val := λ a ↦
    Measure.ofMeasurable (fun s _ => compProdFun κ η a s) (compProdFun_empty κ η a)
      (@compProdFun_iUnion _ _ _ _ _ _ κ η h.2 a)
  property := by
    have : IsSFiniteKernel κ := h.1
    have : IsSFiniteKernel η := h.2
    

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
γ : Type u_4
mγ : MeasurableSpace γ
s : Set (β × γ)
κ : ↥(kernel α β)
η : ↥(kernel (α × β) γ)
h : IsSFiniteKernel κ ∧ IsSFiniteKernel η
this✝ : IsSFiniteKernel κ
this : IsSFiniteKernel η
⊢ (fun a =>
      Measure.ofMeasurable (fun s x => compProdFun κ η a s) (_ : compProdFun κ η a ∅ = 0)
        (_ :
          ∀ (f : ℕ → Set (β × γ)),
            (∀ (i : ℕ), MeasurableSet (f i)) →
              Pairwise (Disjoint on f) → compProdFun κ η a (⋃ i, f i) = ∑' (i : ℕ), compProdFun κ η a (f i))) ∈
    kernel α (β × γ)

Next tactic:
refine' Measure.measurable_of_measurable_coe _ fun s hs => _
/-- Composition-Product of kernels. For s-finite kernels, it satisfies
`∫⁻ bc, f bc ∂(compProd κ η a) = ∫⁻ b, ∫⁻ c, f (b, c) ∂(η (a, b)) ∂(κ a)`
(see `ProbabilityTheory.kernel.lintegral_compProd`).
If either of the kernels is not s-finite, `compProd` is given the junk value 0. -/
noncomputable def compProd (κ : kernel α β) (η : kernel (α × β) γ) : kernel α (β × γ) :=
if h : IsSFiniteKernel κ ∧ IsSFiniteKernel η then
{ val := λ a ↦
    Measure.ofMeasurable (fun s _ => compProdFun κ η a s) (compProdFun_empty κ η a)
      (@compProdFun_iUnion _ _ _ _ _ _ κ η h.2 a)
  property := by
    have : IsSFiniteKernel κ := h.1
    have : IsSFiniteKernel η := h.2
    refine' Measure.measurable_of_measurable_coe _ fun s hs => _
    

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
γ : Type u_4
mγ : MeasurableSpace γ
s✝ : Set (β × γ)
κ : ↥(kernel α β)
η : ↥(kernel (α × β) γ)
h : IsSFiniteKernel κ ∧ IsSFiniteKernel η
this✝ : IsSFiniteKernel κ
this : IsSFiniteKernel η
s : Set (β × γ)
hs : MeasurableSet s
⊢ Measurable fun b =>
    ↑↑(Measure.ofMeasurable (fun s x => compProdFun κ η b s) (_ : compProdFun κ η b ∅ = 0)
            (_ :
              ∀ (f : ℕ → Set (β × γ)),
                (∀ (i : ℕ), MeasurableSet (f i)) →
                  Pairwise (Disjoint on f) → compProdFun κ η b (⋃ i, f i) = ∑' (i : ℕ), compProdFun κ η b (f i)))
      s

Next tactic:
have :
      (fun a =>
          Measure.ofMeasurable (fun s _ => compProdFun κ η a s) (compProdFun_empty κ η a)
            (compProdFun_iUnion κ η a) s) =
        fun a => compProdFun κ η a s :=
      by ext1 a; rwa [Measure.ofMeasurable_apply]