-- Mathlib/Probability/Kernel/Composition/CompProd.lean
theorem compProdFun_iUnion (κ : Kernel α β) (η : Kernel (α × β) γ) [IsSFiniteKernel η] (a : α)
    (f : ℕ → Set (β × γ)) (hf_meas : ∀ i, MeasurableSet (f i))
    (hf_disj : Pairwise (Disjoint on f)) :
    compProdFun κ η a (⋃ i, f i) = ∑' i, compProdFun κ η a (f i)

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
mγ : MeasurableSpace γ
κ : Kernel α β
η : Kernel (α × β) γ
inst✝ : IsSFiniteKernel η
a : α
f : ℕ → Set (β × γ)
hf_meas : ∀ (i : ℕ), MeasurableSet (f i)
hf_disj : Pairwise (Disjoint on f)
h_Union : (fun b => (η (a, b)) {c | (b, c) ∈ ⋃ i, f i}) = fun b => (η (a, b)) (⋃ i, {c | (b, c) ∈ f i})
⊢ (fun b => (η (a, b)) (⋃ i, {c | (b, c) ∈ f i})) = fun b => ∑' (i : ℕ), (η (a, b)) {c | (b, c) ∈ f i}

Tactic:
ext1 b

Result:
case h
α : Type u_1
β : Type u_2
γ : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
mγ : MeasurableSpace γ
κ : Kernel α β
η : Kernel (α × β) γ
inst✝ : IsSFiniteKernel η
a : α
f : ℕ → Set (β × γ)
hf_meas : ∀ (i : ℕ), MeasurableSet (f i)
hf_disj : Pairwise (Disjoint on f)
h_Union : (fun b => (η (a, b)) {c | (b, c) ∈ ⋃ i, f i}) = fun b => (η (a, b)) (⋃ i, {c | (b, c) ∈ f i})
b : β
⊢ (η (a, b)) (⋃ i, {c | (b, c) ∈ f i}) = ∑' (i : ℕ), (η (a, b)) {c | (b, c) ∈ f i}

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
mγ : MeasurableSpace γ
κ : Kernel α β
η : Kernel (α × β) γ
inst✝ : IsSFiniteKernel η
a : α
f : ℕ → Set (β × γ)
hf_meas : ∀ (i : ℕ), MeasurableSet (f i)
hf_disj : Pairwise (Disjoint on f)
h_Union : (fun b => (η (a, b)) {c | (b, c) ∈ ⋃ i, f i}) = fun b => (η (a, b)) (⋃ i, {c | (b, c) ∈ f i})
b : β
i j : ℕ
hij : i ≠ j
s : Set γ
hsi : s ≤ (fun i => {c | (b, c) ∈ f i}) i
hsj : s ≤ (fun i => {c | (b, c) ∈ f i}) j
c : γ
hcs : c ∈ s
hbci : {(b, c)} ⊆ f i
⊢ (b, c) ∈ f j

Tactic:
exact hsj hcs

Result:
no goals

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
mγ : MeasurableSpace γ
κ : Kernel α β
η : Kernel (α × β) γ
inst✝ : IsSFiniteKernel η
a : α
f : ℕ → Set (β × γ)
hf_meas : ∀ (i : ℕ), MeasurableSet (f i)
hf_disj : Pairwise (Disjoint on f)
⊢ κ.compProdFun η a (⋃ i, f i) = ∑' (i : ℕ), κ.compProdFun η a (f i)

Tactic:
have h_Union : (fun b ↦ η (a, b) {c : γ | (b, c) ∈ ⋃ i, f i})
    = fun b ↦ η (a, b) (⋃ i, {c : γ | (b, c) ∈ f i}) := by
  ext1 b
  congr with c
  simp only [Set.mem_iUnion, Set.iSup_eq_iUnion, Set.mem_setOf_eq]

Result:
α : Type u_1
β : Type u_2
γ : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
mγ : MeasurableSpace γ
κ : Kernel α β
η : Kernel (α × β) γ
inst✝ : IsSFiniteKernel η
a : α
f : ℕ → Set (β × γ)
hf_meas : ∀ (i : ℕ), MeasurableSet (f i)
hf_disj : Pairwise (Disjoint on f)
h_Union : (fun b => (η (a, b)) {c | (b, c) ∈ ⋃ i, f i}) = fun b => (η (a, b)) (⋃ i, {c | (b, c) ∈ f i})
⊢ κ.compProdFun η a (⋃ i, f i) = ∑' (i : ℕ), κ.compProdFun η a (f i)

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
mγ : MeasurableSpace γ
κ : Kernel α β
η : Kernel (α × β) γ
inst✝ : IsSFiniteKernel η
a : α
f : ℕ → Set (β × γ)
hf_meas : ∀ (i : ℕ), MeasurableSet (f i)
hf_disj : Pairwise (Disjoint on f)
h_Union : (fun b => (η (a, b)) {c | (b, c) ∈ ⋃ i, f i}) = fun b => (η (a, b)) (⋃ i, {c | (b, c) ∈ f i})
⊢ κ.compProdFun η a (⋃ i, f i) = ∑' (i : ℕ), κ.compProdFun η a (f i)

Tactic:
rw [compProdFun, h_Union]

Result:
α : Type u_1
β : Type u_2
γ : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
mγ : MeasurableSpace γ
κ : Kernel α β
η : Kernel (α × β) γ
inst✝ : IsSFiniteKernel η
a : α
f : ℕ → Set (β × γ)
hf_meas : ∀ (i : ℕ), MeasurableSet (f i)
hf_disj : Pairwise (Disjoint on f)
h_Union : (fun b => (η (a, b)) {c | (b, c) ∈ ⋃ i, f i}) = fun b => (η (a, b)) (⋃ i, {c | (b, c) ∈ f i})
⊢ ∫⁻ (b : β), (η (a, b)) (⋃ i, {c | (b, c) ∈ f i}) ∂κ a = ∑' (i : ℕ), κ.compProdFun η a (f i)

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
mγ : MeasurableSpace γ
κ : Kernel α β
η : Kernel (α × β) γ
inst✝ : IsSFiniteKernel η
a : α
f : ℕ → Set (β × γ)
hf_meas : ∀ (i : ℕ), MeasurableSet (f i)
hf_disj : Pairwise (Disjoint on f)
h_Union : (fun b => (η (a, b)) {c | (b, c) ∈ ⋃ i, f i}) = fun b => (η (a, b)) (⋃ i, {c | (b, c) ∈ f i})
h_tsum : (fun b => (η (a, b)) (⋃ i, {c | (b, c) ∈ f i})) = fun b => ∑' (i : ℕ), (η (a, b)) {c | (b, c) ∈ f i}
i : ℕ
⊢ AEMeasurable (fun b => (η (a, b)) {c | (b, c) ∈ f i}) (κ a)

Tactic:
have hm : MeasurableSet {p : (α × β) × γ | (p.1.2, p.2) ∈ f i} :=
  (hf_meas i).preimage (by fun_prop)

Result:
α : Type u_1
β : Type u_2
γ : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
mγ : MeasurableSpace γ
κ : Kernel α β
η : Kernel (α × β) γ
inst✝ : IsSFiniteKernel η
a : α
f : ℕ → Set (β × γ)
hf_meas : ∀ (i : ℕ), MeasurableSet (f i)
hf_disj : Pairwise (Disjoint on f)
h_Union : (fun b => (η (a, b)) {c | (b, c) ∈ ⋃ i, f i}) = fun b => (η (a, b)) (⋃ i, {c | (b, c) ∈ f i})
h_tsum : (fun b => (η (a, b)) (⋃ i, {c | (b, c) ∈ f i})) = fun b => ∑' (i : ℕ), (η (a, b)) {c | (b, c) ∈ f i}
i : ℕ
hm : MeasurableSet {p | (p.1.2, p.2) ∈ f i}
⊢ AEMeasurable (fun b => (η (a, b)) {c | (b, c) ∈ f i}) (κ a)

Proof state:
case h.hn
α : Type u_1
β : Type u_2
γ : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
mγ : MeasurableSpace γ
κ : Kernel α β
η : Kernel (α × β) γ
inst✝ : IsSFiniteKernel η
a : α
f : ℕ → Set (β × γ)
hf_meas : ∀ (i : ℕ), MeasurableSet (f i)
hf_disj : Pairwise (Disjoint on f)
h_Union : (fun b => (η (a, b)) {c | (b, c) ∈ ⋃ i, f i}) = fun b => (η (a, b)) (⋃ i, {c | (b, c) ∈ f i})
b : β
⊢ Pairwise (Disjoint on fun i => {c | (b, c) ∈ f i})

Tactic:
intro i j hij s hsi hsj c hcs

Result:
case h.hn
α : Type u_1
β : Type u_2
γ : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
mγ : MeasurableSpace γ
κ : Kernel α β
η : Kernel (α × β) γ
inst✝ : IsSFiniteKernel η
a : α
f : ℕ → Set (β × γ)
hf_meas : ∀ (i : ℕ), MeasurableSet (f i)
hf_disj : Pairwise (Disjoint on f)
h_Union : (fun b => (η (a, b)) {c | (b, c) ∈ ⋃ i, f i}) = fun b => (η (a, b)) (⋃ i, {c | (b, c) ∈ f i})
b : β
i j : ℕ
hij : i ≠ j
s : Set γ
hsi : s ≤ (fun i => {c | (b, c) ∈ f i}) i
hsj : s ≤ (fun i => {c | (b, c) ∈ f i}) j
c : γ
hcs : c ∈ s
⊢ c ∈ ⊥