l3lab/ntp-mathlib huggingface dataset:
/-- Lebesgue integral against the composition-product of two kernels. -/
theorem lintegral_compProd (κ : kernel α β) [IsSFiniteKernel κ] (η : kernel (α × β) γ)
    [IsSFiniteKernel η] (a : α) {f : β × γ → ℝ≥0∞} (hf : Measurable f) :
    ∫⁻ bc, f bc ∂(κ ⊗ₖ η) a = ∫⁻ b, ∫⁻ c, f (b, c) ∂η (a, b) ∂κ a := by
  let g := Function.curry f
  change ∫⁻ bc, f bc ∂(κ ⊗ₖ η) a = ∫⁻ b, ∫⁻ c, g b c ∂η (a, b) ∂κ a
  rw [← lintegral_compProd']
  · simp_rw [Function.curry_apply]
  · simp_rw [Function.uncurry_curry]; 

Proof state:
case hf
α : 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 : α
f : β × γ → ℝ≥0∞
hf : Measurable f
g : β → γ → ℝ≥0∞ := Function.curry f
⊢ Measurable f

Next tactic:
exact hf
/-- Lebesgue integral against the composition-product of two kernels. -/
theorem lintegral_compProd₀ (κ : kernel α β) [IsSFiniteKernel κ] (η : kernel (α × β) γ)
    [IsSFiniteKernel η] (a : α) {f : β × γ → ℝ≥0∞} (hf : AEMeasurable f ((κ ⊗ₖ η) a)) :
    ∫⁻ z, f z ∂(κ ⊗ₖ η) a = ∫⁻ x, ∫⁻ y, f (x, y) ∂η (a, x) ∂κ a := 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 : α
f : β × γ → ℝ≥0∞
hf : AEMeasurable f
⊢ ∫⁻ (z : β × γ), f z ∂(κ ⊗ₖ η) a = ∫⁻ (x : β), ∫⁻ (y : γ), f (x, y) ∂η (a, x) ∂κ a

Next tactic:
have A : ∫⁻ z, f z ∂(κ ⊗ₖ η) a = ∫⁻ z, hf.mk f z ∂(κ ⊗ₖ η) a := lintegral_congr_ae hf.ae_eq_mk
/-- Lebesgue integral against the composition-product of two kernels. -/
theorem lintegral_compProd₀ (κ : kernel α β) [IsSFiniteKernel κ] (η : kernel (α × β) γ)
    [IsSFiniteKernel η] (a : α) {f : β × γ → ℝ≥0∞} (hf : AEMeasurable f ((κ ⊗ₖ η) a)) :
    ∫⁻ z, f z ∂(κ ⊗ₖ η) a = ∫⁻ x, ∫⁻ y, f (x, y) ∂η (a, x) ∂κ a := by
  have A : ∫⁻ z, f z ∂(κ ⊗ₖ η) a = ∫⁻ z, hf.mk f z ∂(κ ⊗ₖ η) a := lintegral_congr_ae hf.ae_eq_mk
  

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 : α
f : β × γ → ℝ≥0∞
hf : AEMeasurable f
A : ∫⁻ (z : β × γ), f z ∂(κ ⊗ₖ η) a = ∫⁻ (z : β × γ), AEMeasurable.mk f hf z ∂(κ ⊗ₖ η) a
⊢ ∫⁻ (z : β × γ), f z ∂(κ ⊗ₖ η) a = ∫⁻ (x : β), ∫⁻ (y : γ), f (x, y) ∂η (a, x) ∂κ a

Next tactic:
have B : ∫⁻ x, ∫⁻ y, f (x, y) ∂η (a, x) ∂κ a = ∫⁻ x, ∫⁻ y, hf.mk f (x, y) ∂η (a, x) ∂κ a := by
    apply lintegral_congr_ae
    filter_upwards [ae_ae_of_ae_compProd hf.ae_eq_mk] with _ ha using lintegral_congr_ae ha
/-- Lebesgue integral against the composition-product of two kernels. -/
theorem lintegral_compProd₀ (κ : kernel α β) [IsSFiniteKernel κ] (η : kernel (α × β) γ)
    [IsSFiniteKernel η] (a : α) {f : β × γ → ℝ≥0∞} (hf : AEMeasurable f ((κ ⊗ₖ η) a)) :
    ∫⁻ z, f z ∂(κ ⊗ₖ η) a = ∫⁻ x, ∫⁻ y, f (x, y) ∂η (a, x) ∂κ a := by
  have A : ∫⁻ z, f z ∂(κ ⊗ₖ η) a = ∫⁻ z, hf.mk f z ∂(κ ⊗ₖ η) a := lintegral_congr_ae hf.ae_eq_mk
  have B : ∫⁻ x, ∫⁻ y, f (x, y) ∂η (a, x) ∂κ a = ∫⁻ x, ∫⁻ y, hf.mk f (x, y) ∂η (a, x) ∂κ a := 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 : α
f : β × γ → ℝ≥0∞
hf : AEMeasurable f
A : ∫⁻ (z : β × γ), f z ∂(κ ⊗ₖ η) a = ∫⁻ (z : β × γ), AEMeasurable.mk f hf z ∂(κ ⊗ₖ η) a
⊢ ∫⁻ (x : β), ∫⁻ (y : γ), f (x, y) ∂η (a, x) ∂κ a = ∫⁻ (x : β), ∫⁻ (y : γ), AEMeasurable.mk f hf (x, y) ∂η (a, x) ∂κ a

Next tactic:
apply lintegral_congr_ae
/-- Lebesgue integral against the composition-product of two kernels. -/
theorem lintegral_compProd₀ (κ : kernel α β) [IsSFiniteKernel κ] (η : kernel (α × β) γ)
    [IsSFiniteKernel η] (a : α) {f : β × γ → ℝ≥0∞} (hf : AEMeasurable f ((κ ⊗ₖ η) a)) :
    ∫⁻ z, f z ∂(κ ⊗ₖ η) a = ∫⁻ x, ∫⁻ y, f (x, y) ∂η (a, x) ∂κ a := by
  have A : ∫⁻ z, f z ∂(κ ⊗ₖ η) a = ∫⁻ z, hf.mk f z ∂(κ ⊗ₖ η) a := lintegral_congr_ae hf.ae_eq_mk
  have B : ∫⁻ x, ∫⁻ y, f (x, y) ∂η (a, x) ∂κ a = ∫⁻ x, ∫⁻ y, hf.mk f (x, y) ∂η (a, x) ∂κ a := by
    apply lintegral_congr_ae
    

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 η
a : α
f : β × γ → ℝ≥0∞
hf : AEMeasurable f
A : ∫⁻ (z : β × γ), f z ∂(κ ⊗ₖ η) a = ∫⁻ (z : β × γ), AEMeasurable.mk f hf z ∂(κ ⊗ₖ η) a
⊢ (fun a_1 => ∫⁻ (y : γ), f (a_1, y) ∂η (a, a_1)) =ᵐ[κ a] fun a_1 =>
    ∫⁻ (y : γ), AEMeasurable.mk f hf (a_1, y) ∂η (a, a_1)

Next tactic:
filter_upwards [ae_ae_of_ae_compProd hf.ae_eq_mk] with _ ha using lintegral_congr_ae ha
/-- Lebesgue integral against the composition-product of two kernels. -/
theorem lintegral_compProd₀ (κ : kernel α β) [IsSFiniteKernel κ] (η : kernel (α × β) γ)
    [IsSFiniteKernel η] (a : α) {f : β × γ → ℝ≥0∞} (hf : AEMeasurable f ((κ ⊗ₖ η) a)) :
    ∫⁻ z, f z ∂(κ ⊗ₖ η) a = ∫⁻ x, ∫⁻ y, f (x, y) ∂η (a, x) ∂κ a := by
  have A : ∫⁻ z, f z ∂(κ ⊗ₖ η) a = ∫⁻ z, hf.mk f z ∂(κ ⊗ₖ η) a := lintegral_congr_ae hf.ae_eq_mk
  have B : ∫⁻ x, ∫⁻ y, f (x, y) ∂η (a, x) ∂κ a = ∫⁻ x, ∫⁻ y, hf.mk f (x, y) ∂η (a, x) ∂κ a := by
    apply lintegral_congr_ae
    filter_upwards [ae_ae_of_ae_compProd hf.ae_eq_mk] with _ ha using lintegral_congr_ae ha
  

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 : α
f : β × γ → ℝ≥0∞
hf : AEMeasurable f
A : ∫⁻ (z : β × γ), f z ∂(κ ⊗ₖ η) a = ∫⁻ (z : β × γ), AEMeasurable.mk f hf z ∂(κ ⊗ₖ η) a
B : ∫⁻ (x : β), ∫⁻ (y : γ), f (x, y) ∂η (a, x) ∂κ a = ∫⁻ (x : β), ∫⁻ (y : γ), AEMeasurable.mk f hf (x, y) ∂η (a, x) ∂κ a
⊢ ∫⁻ (z : β × γ), f z ∂(κ ⊗ₖ η) a = ∫⁻ (x : β), ∫⁻ (y : γ), f (x, y) ∂η (a, x) ∂κ a

Next tactic:
rw [A, B, lintegral_compProd]
/-- Lebesgue integral against the composition-product of two kernels. -/
theorem lintegral_compProd₀ (κ : kernel α β) [IsSFiniteKernel κ] (η : kernel (α × β) γ)
    [IsSFiniteKernel η] (a : α) {f : β × γ → ℝ≥0∞} (hf : AEMeasurable f ((κ ⊗ₖ η) a)) :
    ∫⁻ z, f z ∂(κ ⊗ₖ η) a = ∫⁻ x, ∫⁻ y, f (x, y) ∂η (a, x) ∂κ a := by
  have A : ∫⁻ z, f z ∂(κ ⊗ₖ η) a = ∫⁻ z, hf.mk f z ∂(κ ⊗ₖ η) a := lintegral_congr_ae hf.ae_eq_mk
  have B : ∫⁻ x, ∫⁻ y, f (x, y) ∂η (a, x) ∂κ a = ∫⁻ x, ∫⁻ y, hf.mk f (x, y) ∂η (a, x) ∂κ a := by
    apply lintegral_congr_ae
    filter_upwards [ae_ae_of_ae_compProd hf.ae_eq_mk] with _ ha using lintegral_congr_ae ha
  rw [A, B, lintegral_compProd]
  

Proof state:
case hf
α : 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 : α
f : β × γ → ℝ≥0∞
hf : AEMeasurable f
A : ∫⁻ (z : β × γ), f z ∂(κ ⊗ₖ η) a = ∫⁻ (z : β × γ), AEMeasurable.mk f hf z ∂(κ ⊗ₖ η) a
B : ∫⁻ (x : β), ∫⁻ (y : γ), f (x, y) ∂η (a, x) ∂κ a = ∫⁻ (x : β), ∫⁻ (y : γ), AEMeasurable.mk f hf (x, y) ∂η (a, x) ∂κ a
⊢ Measurable fun z => AEMeasurable.mk f hf z

Next tactic:
exact hf.measurable_mk
theorem set_lintegral_compProd (κ : kernel α β) [IsSFiniteKernel κ] (η : kernel (α × β) γ)
    [IsSFiniteKernel η] (a : α) {f : β × γ → ℝ≥0∞} (hf : Measurable f) {s : Set β} {t : Set γ}
    (hs : MeasurableSet s) (ht : MeasurableSet t) :
    ∫⁻ z in s ×ˢ t, f z ∂(κ ⊗ₖ η) a = ∫⁻ x in s, ∫⁻ y in t, f (x, y) ∂η (a, x) ∂κ a := 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 : α
f : β × γ → ℝ≥0∞
hf : Measurable f
s : Set β
t : Set γ
hs : MeasurableSet s
ht : MeasurableSet t
⊢ ∫⁻ (z : β × γ) in s ×ˢ t, f z ∂(κ ⊗ₖ η) a = ∫⁻ (x : β) in s, ∫⁻ (y : γ) in t, f (x, y) ∂η (a, x) ∂κ a

Next tactic:
simp_rw [← kernel.restrict_apply (κ ⊗ₖ η) (hs.prod ht), ← compProd_restrict hs ht,
    lintegral_compProd _ _ _ hf, kernel.restrict_apply]
theorem set_lintegral_compProd_univ_right (κ : kernel α β) [IsSFiniteKernel κ]
    (η : kernel (α × β) γ) [IsSFiniteKernel η] (a : α) {f : β × γ → ℝ≥0∞} (hf : Measurable f)
    {s : Set β} (hs : MeasurableSet s) :
    ∫⁻ z in s ×ˢ Set.univ, f z ∂(κ ⊗ₖ η) a = ∫⁻ x in s, ∫⁻ y, f (x, y) ∂η (a, x) ∂κ a := 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 : α
f : β × γ → ℝ≥0∞
hf : Measurable f
s : Set β
hs : MeasurableSet s
⊢ ∫⁻ (z : β × γ) in s ×ˢ Set.univ, f z ∂(κ ⊗ₖ η) a = ∫⁻ (x : β) in s, ∫⁻ (y : γ), f (x, y) ∂η (a, x) ∂κ a

Next tactic:
simp_rw [set_lintegral_compProd κ η a hf hs MeasurableSet.univ, Measure.restrict_univ]
theorem set_lintegral_compProd_univ_left (κ : kernel α β) [IsSFiniteKernel κ] (η : kernel (α × β) γ)
    [IsSFiniteKernel η] (a : α) {f : β × γ → ℝ≥0∞} (hf : Measurable f) {t : Set γ}
    (ht : MeasurableSet t) :
    ∫⁻ z in Set.univ ×ˢ t, f z ∂(κ ⊗ₖ η) a = ∫⁻ x, ∫⁻ y in t, f (x, y) ∂η (a, x) ∂κ a := 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 : α
f : β × γ → ℝ≥0∞
hf : Measurable f
t : Set γ
ht : MeasurableSet t
⊢ ∫⁻ (z : β × γ) in Set.univ ×ˢ t, f z ∂(κ ⊗ₖ η) a = ∫⁻ (x : β), ∫⁻ (y : γ) in t, f (x, y) ∂η (a, x) ∂κ a

Next tactic:
simp_rw [set_lintegral_compProd κ η a hf MeasurableSet.univ ht, Measure.restrict_univ]
theorem compProd_eq_tsum_compProd (κ : kernel α β) [IsSFiniteKernel κ] (η : kernel (α × β) γ)
    [IsSFiniteKernel η] (a : α) (hs : MeasurableSet s) :
    (κ ⊗ₖ η) a s = ∑' (n : ℕ) (m : ℕ), (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
⊢ ↑↑((κ ⊗ₖ η) a) s = ∑' (n : ℕ) (m : ℕ), ↑↑((seq κ n ⊗ₖ seq η m) a) s

Next tactic:
simp_rw [compProd_apply_eq_compProdFun _ _ _ hs]
theorem compProd_eq_tsum_compProd (κ : kernel α β) [IsSFiniteKernel κ] (η : kernel (α × β) γ)
    [IsSFiniteKernel η] (a : α) (hs : MeasurableSet s) :
    (κ ⊗ₖ η) a s = ∑' (n : ℕ) (m : ℕ), (seq κ n ⊗ₖ seq η m) a s := by
  simp_rw [compProd_apply_eq_compProdFun _ _ _ 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 η
a : α
hs : MeasurableSet s
⊢ compProdFun κ η a s = ∑' (n : ℕ) (m : ℕ), compProdFun (seq κ n) (seq η m) a s

Next tactic:
exact compProdFun_eq_tsum κ η a hs
theorem compProd_eq_sum_compProd (κ : kernel α β) [IsSFiniteKernel κ] (η : kernel (α × β) γ)
    [IsSFiniteKernel η] : κ ⊗ₖ η = kernel.sum fun n => kernel.sum fun m => seq κ n ⊗ₖ seq η m := 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 η
⊢ κ ⊗ₖ η = kernel.sum fun n => kernel.sum fun m => seq κ n ⊗ₖ seq η m

Next tactic:
ext a s hs
theorem compProd_eq_sum_compProd (κ : kernel α β) [IsSFiniteKernel κ] (η : kernel (α × β) γ)
    [IsSFiniteKernel η] : κ ⊗ₖ η = kernel.sum fun n => kernel.sum fun m => seq κ n ⊗ₖ seq η m := by
  ext a s hs; 

Proof state:
case h.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 η
a : α
s : Set (β × γ)
hs : MeasurableSet s
⊢ ↑↑((κ ⊗ₖ η) a) s = ↑↑((kernel.sum fun n => kernel.sum fun m => seq κ n ⊗ₖ seq η m) a) s

Next tactic:
simp_rw [kernel.sum_apply' _ a hs]
theorem compProd_eq_sum_compProd (κ : kernel α β) [IsSFiniteKernel κ] (η : kernel (α × β) γ)
    [IsSFiniteKernel η] : κ ⊗ₖ η = kernel.sum fun n => kernel.sum fun m => seq κ n ⊗ₖ seq η m := by
  ext a s hs; simp_rw [kernel.sum_apply' _ a hs]; 

Proof state:
case h.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 η
a : α
s : Set (β × γ)
hs : MeasurableSet s
⊢ ↑↑((κ ⊗ₖ η) a) s = ∑' (n : ℕ) (n_1 : ℕ), ↑↑((seq κ n ⊗ₖ seq η n_1) a) s

Next tactic:
rw [compProd_eq_tsum_compProd κ η a hs]
theorem compProd_eq_sum_compProd_left (κ : kernel α β) [IsSFiniteKernel κ] (η : kernel (α × β) γ) :
    κ ⊗ₖ η = kernel.sum fun n => seq κ n ⊗ₖ η := 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 (α × β) γ)
⊢ κ ⊗ₖ η = kernel.sum fun n => seq κ n ⊗ₖ η

Next tactic:
by_cases h : IsSFiniteKernel η
theorem compProd_eq_sum_compProd_left (κ : kernel α β) [IsSFiniteKernel κ] (η : kernel (α × β) γ) :
    κ ⊗ₖ η = kernel.sum fun n => seq κ n ⊗ₖ η := by
  by_cases h : IsSFiniteKernel η
  

Proof state:
case pos
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
γ : Type u_4
mγ : MeasurableSpace γ
s : Set (β × γ)
κ : ↥(kernel α β)
inst✝ : IsSFiniteKernel κ
η : ↥(kernel (α × β) γ)
h : IsSFiniteKernel η
⊢ κ ⊗ₖ η = kernel.sum fun n => seq κ n ⊗ₖ η
case neg
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
γ : Type u_4
mγ : MeasurableSpace γ
s : Set (β × γ)
κ : ↥(kernel α β)
inst✝ : IsSFiniteKernel κ
η : ↥(kernel (α × β) γ)
h : ¬IsSFiniteKernel η
⊢ κ ⊗ₖ η = kernel.sum fun n => seq κ n ⊗ₖ η

Next tactic:
swap
theorem compProd_eq_sum_compProd_left (κ : kernel α β) [IsSFiniteKernel κ] (η : kernel (α × β) γ) :
    κ ⊗ₖ η = kernel.sum fun n => seq κ n ⊗ₖ η := by
  by_cases h : IsSFiniteKernel η
  swap
  · 

Proof state:
case neg
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
γ : Type u_4
mγ : MeasurableSpace γ
s : Set (β × γ)
κ : ↥(kernel α β)
inst✝ : IsSFiniteKernel κ
η : ↥(kernel (α × β) γ)
h : ¬IsSFiniteKernel η
⊢ κ ⊗ₖ η = kernel.sum fun n => seq κ n ⊗ₖ η

Next tactic:
simp_rw [compProd_of_not_isSFiniteKernel_right _ _ h]
theorem compProd_eq_sum_compProd_left (κ : kernel α β) [IsSFiniteKernel κ] (η : kernel (α × β) γ) :
    κ ⊗ₖ η = kernel.sum fun n => seq κ n ⊗ₖ η := by
  by_cases h : IsSFiniteKernel η
  swap
  · simp_rw [compProd_of_not_isSFiniteKernel_right _ _ h]
    

Proof state:
case neg
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
γ : Type u_4
mγ : MeasurableSpace γ
s : Set (β × γ)
κ : ↥(kernel α β)
inst✝ : IsSFiniteKernel κ
η : ↥(kernel (α × β) γ)
h : ¬IsSFiniteKernel η
⊢ 0 = kernel.sum fun n => 0

Next tactic:
simp
theorem compProd_eq_sum_compProd_left (κ : kernel α β) [IsSFiniteKernel κ] (η : kernel (α × β) γ) :
    κ ⊗ₖ η = kernel.sum fun n => seq κ n ⊗ₖ η := by
  by_cases h : IsSFiniteKernel η
  swap
  · simp_rw [compProd_of_not_isSFiniteKernel_right _ _ h]
    simp
  

Proof state:
case pos
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
γ : Type u_4
mγ : MeasurableSpace γ
s : Set (β × γ)
κ : ↥(kernel α β)
inst✝ : IsSFiniteKernel κ
η : ↥(kernel (α × β) γ)
h : IsSFiniteKernel η
⊢ κ ⊗ₖ η = kernel.sum fun n => seq κ n ⊗ₖ η

Next tactic:
rw [compProd_eq_sum_compProd]
theorem compProd_eq_sum_compProd_left (κ : kernel α β) [IsSFiniteKernel κ] (η : kernel (α × β) γ) :
    κ ⊗ₖ η = kernel.sum fun n => seq κ n ⊗ₖ η := by
  by_cases h : IsSFiniteKernel η
  swap
  · simp_rw [compProd_of_not_isSFiniteKernel_right _ _ h]
    simp
  rw [compProd_eq_sum_compProd]
  

Proof state:
case pos
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
γ : Type u_4
mγ : MeasurableSpace γ
s : Set (β × γ)
κ : ↥(kernel α β)
inst✝ : IsSFiniteKernel κ
η : ↥(kernel (α × β) γ)
h : IsSFiniteKernel η
⊢ (kernel.sum fun n => kernel.sum fun m => seq κ n ⊗ₖ seq η m) = kernel.sum fun n => seq κ n ⊗ₖ η

Next tactic:
congr with n a s hs
theorem compProd_eq_sum_compProd_left (κ : kernel α β) [IsSFiniteKernel κ] (η : kernel (α × β) γ) :
    κ ⊗ₖ η = kernel.sum fun n => seq κ n ⊗ₖ η := by
  by_cases h : IsSFiniteKernel η
  swap
  · simp_rw [compProd_of_not_isSFiniteKernel_right _ _ h]
    simp
  rw [compProd_eq_sum_compProd]
  congr with n a s hs
  

Proof state:
case pos.e_κ.h.h.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 (α × β) γ)
h : IsSFiniteKernel η
n : ℕ
a : α
s : Set (β × γ)
hs : MeasurableSet s
⊢ ↑↑((kernel.sum fun m => seq κ n ⊗ₖ seq η m) a) s = ↑↑((seq κ n ⊗ₖ η) a) s

Next tactic:
simp_rw [kernel.sum_apply' _ _ hs, compProd_apply_eq_compProdFun _ _ _ hs,
    compProdFun_tsum_right _ η a hs]
theorem compProd_eq_sum_compProd_right (κ : kernel α β) (η : kernel (α × β) γ)
    [IsSFiniteKernel η] : κ ⊗ₖ η = kernel.sum fun n => κ ⊗ₖ seq η n := 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 (α × β) γ)
inst✝ : IsSFiniteKernel η
⊢ κ ⊗ₖ η = kernel.sum fun n => κ ⊗ₖ seq η n

Next tactic:
by_cases hκ : IsSFiniteKernel κ
theorem compProd_eq_sum_compProd_right (κ : kernel α β) (η : kernel (α × β) γ)
    [IsSFiniteKernel η] : κ ⊗ₖ η = kernel.sum fun n => κ ⊗ₖ seq η n := by
  by_cases hκ : IsSFiniteKernel κ
  

Proof state:
case pos
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
γ : Type u_4
mγ : MeasurableSpace γ
s : Set (β × γ)
κ : ↥(kernel α β)
η : ↥(kernel (α × β) γ)
inst✝ : IsSFiniteKernel η
hκ : IsSFiniteKernel κ
⊢ κ ⊗ₖ η = kernel.sum fun n => κ ⊗ₖ seq η n
case neg
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
γ : Type u_4
mγ : MeasurableSpace γ
s : Set (β × γ)
κ : ↥(kernel α β)
η : ↥(kernel (α × β) γ)
inst✝ : IsSFiniteKernel η
hκ : ¬IsSFiniteKernel κ
⊢ κ ⊗ₖ η = kernel.sum fun n => κ ⊗ₖ seq η n

Next tactic:
swap
theorem compProd_eq_sum_compProd_right (κ : kernel α β) (η : kernel (α × β) γ)
    [IsSFiniteKernel η] : κ ⊗ₖ η = kernel.sum fun n => κ ⊗ₖ seq η n := by
  by_cases hκ : IsSFiniteKernel κ
  swap
  · 

Proof state:
case neg
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
γ : Type u_4
mγ : MeasurableSpace γ
s : Set (β × γ)
κ : ↥(kernel α β)
η : ↥(kernel (α × β) γ)
inst✝ : IsSFiniteKernel η
hκ : ¬IsSFiniteKernel κ
⊢ κ ⊗ₖ η = kernel.sum fun n => κ ⊗ₖ seq η n

Next tactic:
simp_rw [compProd_of_not_isSFiniteKernel_left _ _ hκ]
theorem compProd_eq_sum_compProd_right (κ : kernel α β) (η : kernel (α × β) γ)
    [IsSFiniteKernel η] : κ ⊗ₖ η = kernel.sum fun n => κ ⊗ₖ seq η n := by
  by_cases hκ : IsSFiniteKernel κ
  swap
  · simp_rw [compProd_of_not_isSFiniteKernel_left _ _ hκ]
    

Proof state:
case neg
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
γ : Type u_4
mγ : MeasurableSpace γ
s : Set (β × γ)
κ : ↥(kernel α β)
η : ↥(kernel (α × β) γ)
inst✝ : IsSFiniteKernel η
hκ : ¬IsSFiniteKernel κ
⊢ 0 = kernel.sum fun n => 0

Next tactic:
simp
theorem compProd_eq_sum_compProd_right (κ : kernel α β) (η : kernel (α × β) γ)
    [IsSFiniteKernel η] : κ ⊗ₖ η = kernel.sum fun n => κ ⊗ₖ seq η n := by
  by_cases hκ : IsSFiniteKernel κ
  swap
  · simp_rw [compProd_of_not_isSFiniteKernel_left _ _ hκ]
    simp
  

Proof state:
case pos
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
γ : Type u_4
mγ : MeasurableSpace γ
s : Set (β × γ)
κ : ↥(kernel α β)
η : ↥(kernel (α × β) γ)
inst✝ : IsSFiniteKernel η
hκ : IsSFiniteKernel κ
⊢ κ ⊗ₖ η = kernel.sum fun n => κ ⊗ₖ seq η n

Next tactic:
rw [compProd_eq_sum_compProd]
theorem compProd_eq_sum_compProd_right (κ : kernel α β) (η : kernel (α × β) γ)
    [IsSFiniteKernel η] : κ ⊗ₖ η = kernel.sum fun n => κ ⊗ₖ seq η n := by
  by_cases hκ : IsSFiniteKernel κ
  swap
  · simp_rw [compProd_of_not_isSFiniteKernel_left _ _ hκ]
    simp
  rw [compProd_eq_sum_compProd]
  

Proof state:
case pos
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
γ : Type u_4
mγ : MeasurableSpace γ
s : Set (β × γ)
κ : ↥(kernel α β)
η : ↥(kernel (α × β) γ)
inst✝ : IsSFiniteKernel η
hκ : IsSFiniteKernel κ
⊢ (kernel.sum fun n => kernel.sum fun m => seq κ n ⊗ₖ seq η m) = kernel.sum fun n => κ ⊗ₖ seq η n

Next tactic:
simp_rw [compProd_eq_sum_compProd_left κ _]
theorem compProd_eq_sum_compProd_right (κ : kernel α β) (η : kernel (α × β) γ)
    [IsSFiniteKernel η] : κ ⊗ₖ η = kernel.sum fun n => κ ⊗ₖ seq η n := by
  by_cases hκ : IsSFiniteKernel κ
  swap
  · simp_rw [compProd_of_not_isSFiniteKernel_left _ _ hκ]
    simp
  rw [compProd_eq_sum_compProd]
  simp_rw [compProd_eq_sum_compProd_left κ _]
  

Proof state:
case pos
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
γ : Type u_4
mγ : MeasurableSpace γ
s : Set (β × γ)
κ : ↥(kernel α β)
η : ↥(kernel (α × β) γ)
inst✝ : IsSFiniteKernel η
hκ : IsSFiniteKernel κ
⊢ (kernel.sum fun n => kernel.sum fun m => seq κ n ⊗ₖ seq η m) =
    kernel.sum fun n => kernel.sum fun n_1 => seq κ n_1 ⊗ₖ seq η n

Next tactic:
rw [kernel.sum_comm]
instance IsMarkovKernel.compProd (κ : kernel α β) [IsMarkovKernel κ] (η : kernel (α × β) γ)
    [IsMarkovKernel η] : IsMarkovKernel (κ ⊗ₖ η) :=
  ⟨fun a =>
    ⟨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✝¹ : IsMarkovKernel κ
η : ↥(kernel (α × β) γ)
inst✝ : IsMarkovKernel η
a : α
⊢ ↑↑((κ ⊗ₖ η) a) Set.univ = 1

Next tactic:
rw [compProd_apply κ η a MeasurableSet.univ]
instance IsMarkovKernel.compProd (κ : kernel α β) [IsMarkovKernel κ] (η : kernel (α × β) γ)
    [IsMarkovKernel η] : IsMarkovKernel (κ ⊗ₖ η) :=
  ⟨fun a =>
    ⟨by
      rw [compProd_apply κ η a MeasurableSet.univ]
      

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

Next tactic:
simp only [Set.mem_univ, Set.setOf_true, measure_univ, lintegral_one]
theorem compProd_apply_univ_le (κ : kernel α β) (η : kernel (α × β) γ) [IsFiniteKernel η] (a : α) :
    (κ ⊗ₖ η) a Set.univ ≤ κ a Set.univ * IsFiniteKernel.bound η := 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 (α × β) γ)
inst✝ : IsFiniteKernel η
a : α
⊢ ↑↑((κ ⊗ₖ η) a) Set.univ ≤ ↑↑(κ a) Set.univ * IsFiniteKernel.bound η

Next tactic:
by_cases hκ : IsSFiniteKernel κ