-- Mathlib/Probability/Independence/Kernel.lean
theorem iIndepFun.indepFun_finset (S T : Finset ι) (hST : Disjoint S T)
    (hf_Indep : iIndepFun m f κ μ) (hf_meas : ∀ i, Measurable (f i)) :
    IndepFun (fun a (i : S) => f i a) (fun a (i : T) => f i a) κ μ

Proof state:
case inr.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro
α : Type u_1
Ω : Type u_2
ι : Type u_3
_mα : MeasurableSpace α
_mΩ : MeasurableSpace Ω
κ : Kernel α Ω
μ : Measure α
β : ι → Type u_8
m : (i : ι) → MeasurableSpace (β i)
f : (i : ι) → Ω → β i
S T : Finset ι
hST : Disjoint S T
hf_Indep : iIndepFun m f κ μ
hf_meas : ∀ (i : ι), Measurable (f i)
hμ : μ ≠ 0
η : Kernel α Ω
η_eq : ⇑κ =ᶠ[ae μ] ⇑η
hη : IsMarkovKernel η
πSβ : Set (Set ((i : { x // x ∈ S }) → β ↑i)) := univ.pi '' univ.pi fun i => {s | MeasurableSet s}
πS : Set (Set Ω) := {s | ∃ t ∈ πSβ, (fun a i => f (↑i) a) ⁻¹' t = s}
hπS_pi : IsPiSystem πS
hπS_gen : MeasurableSpace.comap (fun a i => f (↑i) a) MeasurableSpace.pi = generateFrom πS
πTβ : Set (Set ((i : { x // x ∈ T }) → β ↑i)) := univ.pi '' univ.pi fun i => {s | MeasurableSet s}
πT : Set (Set Ω) := {s | ∃ t ∈ πTβ, (fun a i => f (↑i) a) ⁻¹' t = s}
hπT_pi : IsPiSystem πT
hπT_gen : MeasurableSpace.comap (fun a i => f (↑i) a) MeasurableSpace.pi = generateFrom πT
s : Set ((i : { x // x ∈ S }) → β ↑i)
sets_s : (i : { x // x ∈ S }) → Set (β ↑i)
hs2 : univ.pi sets_s = s
t : Set ((i : { x // x ∈ T }) → β ↑i)
sets_t : (i : { x // x ∈ T }) → Set (β ↑i)
ht2 : univ.pi sets_t = t
hs1 : ∀ (i : { x // x ∈ S }), MeasurableSet (sets_s i)
ht1 : ∀ (i : { x // x ∈ T }), MeasurableSet (sets_t i)
⊢ ∀ᵐ (a : α) ∂μ,
    (η a) ((fun a i => f (↑i) a) ⁻¹' univ.pi sets_s ∩ (fun a i => f (↑i) a) ⁻¹' univ.pi sets_t) =
      (η a) ((fun a i => f (↑i) a) ⁻¹' univ.pi sets_s) * (η a) ((fun a i => f (↑i) a) ⁻¹' univ.pi sets_t)

Tactic:
let sets_s' : ∀ i : ι, Set (β i) := fun i =>
  dite (i ∈ S) (fun hi => sets_s ⟨i, hi⟩) fun _ => Set.univ

Result:
case inr.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro
α : Type u_1
Ω : Type u_2
ι : Type u_3
_mα : MeasurableSpace α
_mΩ : MeasurableSpace Ω
κ : Kernel α Ω
μ : Measure α
β : ι → Type u_8
m : (i : ι) → MeasurableSpace (β i)
f : (i : ι) → Ω → β i
S T : Finset ι
hST : Disjoint S T
hf_Indep : iIndepFun m f κ μ
hf_meas : ∀ (i : ι), Measurable (f i)
hμ : μ ≠ 0
η : Kernel α Ω
η_eq : ⇑κ =ᶠ[ae μ] ⇑η
hη : IsMarkovKernel η
πSβ : Set (Set ((i : { x // x ∈ S }) → β ↑i)) := univ.pi '' univ.pi fun i => {s | MeasurableSet s}
πS : Set (Set Ω) := {s | ∃ t ∈ πSβ, (fun a i => f (↑i) a) ⁻¹' t = s}
hπS_pi : IsPiSystem πS
hπS_gen : MeasurableSpace.comap (fun a i => f (↑i) a) MeasurableSpace.pi = generateFrom πS
πTβ : Set (Set ((i : { x // x ∈ T }) → β ↑i)) := univ.pi '' univ.pi fun i => {s | MeasurableSet s}
πT : Set (Set Ω) := {s | ∃ t ∈ πTβ, (fun a i => f (↑i) a) ⁻¹' t = s}
hπT_pi : IsPiSystem πT
hπT_gen : MeasurableSpace.comap (fun a i => f (↑i) a) MeasurableSpace.pi = generateFrom πT
s : Set ((i : { x // x ∈ S }) → β ↑i)
sets_s : (i : { x // x ∈ S }) → Set (β ↑i)
hs2 : univ.pi sets_s = s
t : Set ((i : { x // x ∈ T }) → β ↑i)
sets_t : (i : { x // x ∈ T }) → Set (β ↑i)
ht2 : univ.pi sets_t = t
hs1 : ∀ (i : { x // x ∈ S }), MeasurableSet (sets_s i)
ht1 : ∀ (i : { x // x ∈ T }), MeasurableSet (sets_t i)
sets_s' : (i : ι) → Set (β i) := fun i => if hi : i ∈ S then sets_s ⟨i, hi⟩ else univ
⊢ ∀ᵐ (a : α) ∂μ,
    (η a) ((fun a i => f (↑i) a) ⁻¹' univ.pi sets_s ∩ (fun a i => f (↑i) a) ⁻¹' univ.pi sets_t) =
      (η a) ((fun a i => f (↑i) a) ⁻¹' univ.pi sets_s) * (η a) ((fun a i => f (↑i) a) ⁻¹' univ.pi sets_t)

Proof state:
α : Type u_1
Ω : Type u_2
ι : Type u_3
_mα : MeasurableSpace α
_mΩ : MeasurableSpace Ω
κ : Kernel α Ω
μ : Measure α
β : ι → Type u_8
m : (i : ι) → MeasurableSpace (β i)
f : (i : ι) → Ω → β i
S T : Finset ι
hST : Disjoint S T
hf_meas : ∀ (i : ι), Measurable (f i)
hμ : μ ≠ 0
η : Kernel α Ω
η_eq : ⇑κ =ᶠ[ae μ] ⇑η
hη : IsMarkovKernel η
πSβ : Set (Set ((i : { x // x ∈ S }) → β ↑i)) := univ.pi '' univ.pi fun i => {s | MeasurableSet s}
πS : Set (Set Ω) := {s | ∃ t ∈ πSβ, (fun a i => f (↑i) a) ⁻¹' t = s}
hπS_pi : IsPiSystem πS
hπS_gen : MeasurableSpace.comap (fun a i => f (↑i) a) MeasurableSpace.pi = generateFrom πS
πTβ : Set (Set ((i : { x // x ∈ T }) → β ↑i)) := univ.pi '' univ.pi fun i => {s | MeasurableSet s}
πT : Set (Set Ω) := {s | ∃ t ∈ πTβ, (fun a i => f (↑i) a) ⁻¹' t = s}
hπT_pi : IsPiSystem πT
hπT_gen : MeasurableSpace.comap (fun a i => f (↑i) a) MeasurableSpace.pi = generateFrom πT
s : Set ((i : { x // x ∈ S }) → β ↑i)
sets_s : (i : { x // x ∈ S }) → Set (β ↑i)
hs2 : univ.pi sets_s = s
t : Set ((i : { x // x ∈ T }) → β ↑i)
sets_t : (i : { x // x ∈ T }) → Set (β ↑i)
ht2 : univ.pi sets_t = t
hs1 : ∀ (i : { x // x ∈ S }), MeasurableSet (sets_s i)
ht1 : ∀ (i : { x // x ∈ T }), MeasurableSet (sets_t i)
sets_s' : (i : ι) → Set (β i) := fun i => if hi : i ∈ S then sets_s ⟨i, hi⟩ else univ
h_sets_s'_eq : ∀ {i : ι} (hi : i ∈ S), sets_s' i = sets_s ⟨i, hi⟩
h_sets_s'_univ : ∀ {i : ι}, i ∈ T → sets_s' i = univ
sets_t' : (i : ι) → Set (β i) := fun i => if hi : i ∈ T then sets_t ⟨i, hi⟩ else univ
h_sets_t'_univ : ∀ {i : ι}, i ∈ S → sets_t' i = univ
h_meas_s' : ∀ i ∈ S, MeasurableSet (sets_s' i)
h_meas_t' : ∀ i ∈ T, MeasurableSet (sets_t' i)
h_eq_inter_S : (fun ω i => f (↑i) ω) ⁻¹' univ.pi sets_s = ⋂ i ∈ S, f i ⁻¹' sets_s' i
h_eq_inter_T : (fun ω i => f (↑i) ω) ⁻¹' univ.pi sets_t = ⋂ i ∈ T, f i ⁻¹' sets_t' i
hf_Indep :
  ∀ (S : Finset ι) {sets : (i : ι) → Set (β i)},
    (∀ i ∈ S, MeasurableSet (sets i)) → ∀ᵐ (a : α) ∂μ, (η a) (⋂ i ∈ S, f i ⁻¹' sets i) = ∏ i ∈ S, (η a) (f i ⁻¹' sets i)
x : Ω
i : ι
hiT : i ∈ T
h : f i x ∈ if hi : i ∈ T then sets_t ⟨i, hi⟩ else univ
⊢ f i x ∈ sets_t ⟨i, hiT⟩

Tactic:
rwa [dif_pos hiT] at h

Result:
no goals

Proof state:
α : Type u_1
Ω : Type u_2
ι : Type u_3
_mα : MeasurableSpace α
_mΩ : MeasurableSpace Ω
κ : Kernel α Ω
μ : Measure α
β : ι → Type u_8
m : (i : ι) → MeasurableSpace (β i)
f : (i : ι) → Ω → β i
S T : Finset ι
hST : Disjoint S T
hf_Indep : iIndepFun m f κ μ
hf_meas : ∀ (i : ι), Measurable (f i)
hμ : μ ≠ 0
η : Kernel α Ω
η_eq : ⇑κ =ᶠ[ae μ] ⇑η
hη : IsMarkovKernel η
πSβ : Set (Set ((i : { x // x ∈ S }) → β ↑i)) := univ.pi '' univ.pi fun i => {s | MeasurableSet s}
πS : Set (Set Ω) := {s | ∃ t ∈ πSβ, (fun a i => f (↑i) a) ⁻¹' t = s}
hπS_pi : IsPiSystem πS
⊢ generateFrom ((preimage fun a i => f (↑i) a) '' (univ.pi '' univ.pi fun i => {s | MeasurableSet s})) = generateFrom πS

Tactic:
congr

Result:
no goals

Proof state:
α : Type u_1
Ω : Type u_2
ι : Type u_3
_mα : MeasurableSpace α
_mΩ : MeasurableSpace Ω
κ : Kernel α Ω
μ : Measure α
β : ι → Type u_8
m : (i : ι) → MeasurableSpace (β i)
f : (i : ι) → Ω → β i
S T : Finset ι
hST : Disjoint S T
hf_Indep : iIndepFun m f κ μ
hf_meas : ∀ (i : ι), Measurable (f i)
⊢ IndepFun (fun a i => f (↑i) a) (fun a i => f (↑i) a) κ μ

Tactic:
rcases eq_or_ne μ 0 with rfl | hμ

Result:
case inl
α : Type u_1
Ω : Type u_2
ι : Type u_3
_mα : MeasurableSpace α
_mΩ : MeasurableSpace Ω
κ : Kernel α Ω
β : ι → Type u_8
m : (i : ι) → MeasurableSpace (β i)
f : (i : ι) → Ω → β i
S T : Finset ι
hST : Disjoint S T
hf_meas : ∀ (i : ι), Measurable (f i)
hf_Indep : iIndepFun m f κ 0
⊢ IndepFun (fun a i => f (↑i) a) (fun a i => f (↑i) a) κ 0

case inr
α : Type u_1
Ω : Type u_2
ι : Type u_3
_mα : MeasurableSpace α
_mΩ : MeasurableSpace Ω
κ : Kernel α Ω
μ : Measure α
β : ι → Type u_8
m : (i : ι) → MeasurableSpace (β i)
f : (i : ι) → Ω → β i
S T : Finset ι
hST : Disjoint S T
hf_Indep : iIndepFun m f κ μ
hf_meas : ∀ (i : ι), Measurable (f i)
hμ : μ ≠ 0
⊢ IndepFun (fun a i => f (↑i) a) (fun a i => f (↑i) a) κ μ