-- 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:
α : 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
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
⊢ ∀ i ∈ S, MeasurableSet (sets_s' i)

Tactic:
intro i hi

Result:
α : 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
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
i : ι
hi : i ∈ S
⊢ MeasurableSet (sets_s' i)

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
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
i : ι
hi : i ∈ S
⊢ MeasurableSet (sets_s' i)

Tactic:
rw [h_sets_s'_eq hi]

Result:
α : 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
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
i : ι
hi : i ∈ S
⊢ MeasurableSet (sets_s ⟨i, hi⟩)