-- Mathlib/Probability/Independence/Kernel.lean
theorem iIndepSets.indepSets {s : ι → Set (Set Ω)} {_mΩ : MeasurableSpace Ω}
    {κ : Kernel α Ω} {μ : Measure α} (h_indep : iIndepSets s κ μ) {i j : ι} (hij : i ≠ j) :
    IndepSets (s i) (s j) κ μ

Proof state:
α : Type u_1
Ω : Type u_2
ι : Type u_3
_mα : MeasurableSpace α
s : ι → Set (Set Ω)
_mΩ : MeasurableSpace Ω
κ : Kernel α Ω
μ : Measure α
h_indep : iIndepSets s κ μ
i j : ι
hij : i ≠ j
t₁ t₂ : Set Ω
ht₁ : t₁ ∈ s i
ht₂ : t₂ ∈ s j
x : ι
hx : x ∈ {i, j}
⊢ (if x = i then t₁ else t₂) ∈ s x

Tactic:
rcases Finset.mem_insert.mp hx with hx | hx

Result:
case inl
α : Type u_1
Ω : Type u_2
ι : Type u_3
_mα : MeasurableSpace α
s : ι → Set (Set Ω)
_mΩ : MeasurableSpace Ω
κ : Kernel α Ω
μ : Measure α
h_indep : iIndepSets s κ μ
i j : ι
hij : i ≠ j
t₁ t₂ : Set Ω
ht₁ : t₁ ∈ s i
ht₂ : t₂ ∈ s j
x : ι
hx✝ : x ∈ {i, j}
hx : x = i
⊢ (if x = i then t₁ else t₂) ∈ s x

case inr
α : Type u_1
Ω : Type u_2
ι : Type u_3
_mα : MeasurableSpace α
s : ι → Set (Set Ω)
_mΩ : MeasurableSpace Ω
κ : Kernel α Ω
μ : Measure α
h_indep : iIndepSets s κ μ
i j : ι
hij : i ≠ j
t₁ t₂ : Set Ω
ht₁ : t₁ ∈ s i
ht₂ : t₂ ∈ s j
x : ι
hx✝ : x ∈ {i, j}
hx : x ∈ {j}
⊢ (if x = i then t₁ else t₂) ∈ s x

Proof state:
case h
α : Type u_1
Ω : Type u_2
ι : Type u_3
_mα : MeasurableSpace α
s : ι → Set (Set Ω)
_mΩ : MeasurableSpace Ω
κ : Kernel α Ω
μ : Measure α
h_indep : iIndepSets s κ μ
i j : ι
hij : i ≠ j
t₁ t₂ : Set Ω
ht₁ : t₁ ∈ s i
ht₂ : t₂ ∈ s j
hf_m : ∀ x ∈ {i, j}, (if x = i then t₁ else t₂) ∈ s x
h1 : t₁ = if i = i then t₁ else t₂
h2 : t₂ = if j = i then t₁ else t₂
h_inter : (⋂ t ∈ {i, j}, if t = i then t₁ else t₂) = (if i = i then t₁ else t₂) ∩ if j = i then t₁ else t₂
a : α
h_indep' : (κ a) (⋂ i_1 ∈ {i, j}, if i_1 = i then t₁ else t₂) = ∏ i_1 ∈ {i, j}, (κ a) (if i_1 = i then t₁ else t₂)
h_prod :
  ∏ t ∈ {i, j}, (κ a) (if t = i then t₁ else t₂) = (κ a) (if i = i then t₁ else t₂) * (κ a) (if j = i then t₁ else t₂)
⊢ (κ a) ((if i = i then t₁ else t₂) ∩ if j = i then t₁ else t₂) =
    (κ a) (if i = i then t₁ else t₂) * (κ a) (if j = i then t₁ else t₂)

Tactic:
rw [← h_inter, ← h_prod, h_indep']

Result:
no goals

Proof state:
α : Type u_1
Ω : Type u_2
ι : Type u_3
_mα : MeasurableSpace α
s : ι → Set (Set Ω)
_mΩ : MeasurableSpace Ω
κ : Kernel α Ω
μ : Measure α
h_indep : iIndepSets s κ μ
i j : ι
hij : i ≠ j
⊢ IndepSets (s i) (s j) κ μ

Tactic:
intro t₁ t₂ ht₁ ht₂

Result:
α : Type u_1
Ω : Type u_2
ι : Type u_3
_mα : MeasurableSpace α
s : ι → Set (Set Ω)
_mΩ : MeasurableSpace Ω
κ : Kernel α Ω
μ : Measure α
h_indep : iIndepSets s κ μ
i j : ι
hij : i ≠ j
t₁ t₂ : Set Ω
ht₁ : t₁ ∈ s i
ht₂ : t₂ ∈ s j
⊢ ∀ᵐ (a : α) ∂μ, (κ a) (t₁ ∩ t₂) = (κ a) t₁ * (κ a) t₂

Proof state:
case inr
α : Type u_1
Ω : Type u_2
ι : Type u_3
_mα : MeasurableSpace α
s : ι → Set (Set Ω)
_mΩ : MeasurableSpace Ω
κ : Kernel α Ω
μ : Measure α
h_indep : iIndepSets s κ μ
i j : ι
hij : i ≠ j
t₁ t₂ : Set Ω
ht₁ : t₁ ∈ s i
ht₂ : t₂ ∈ s j
x : ι
hx✝ : x ∈ {i, j}
hx : x ∈ {j}
⊢ (if x = i then t₁ else t₂) ∈ s x

Tactic:
simp [Finset.mem_singleton.mp hx, hij.symm, ht₂]

Result:
no goals

Proof state:
case h
α : Type u_1
Ω : Type u_2
ι : Type u_3
_mα : MeasurableSpace α
s : ι → Set (Set Ω)
_mΩ : MeasurableSpace Ω
κ : Kernel α Ω
μ : Measure α
h_indep : iIndepSets s κ μ
i j : ι
hij : i ≠ j
t₁ t₂ : Set Ω
ht₁ : t₁ ∈ s i
ht₂ : t₂ ∈ s j
hf_m : ∀ x ∈ {i, j}, (if x = i then t₁ else t₂) ∈ s x
h1 : t₁ = if i = i then t₁ else t₂
h2 : t₂ = if j = i then t₁ else t₂
h_inter : (⋂ t ∈ {i, j}, if t = i then t₁ else t₂) = (if i = i then t₁ else t₂) ∩ if j = i then t₁ else t₂
a : α
h_indep' : (κ a) (⋂ i_1 ∈ {i, j}, if i_1 = i then t₁ else t₂) = ∏ i_1 ∈ {i, j}, (κ a) (if i_1 = i then t₁ else t₂)
h_prod :
  ∏ t ∈ {i, j}, (κ a) (if t = i then t₁ else t₂) = (κ a) (if i = i then t₁ else t₂) * (κ a) (if j = i then t₁ else t₂)
⊢ (κ a) ((if i = i then t₁ else t₂) ∩ if j = i then t₁ else t₂) = (κ a) (if i = i then t₁ else t₂) * (κ a) t₂

Tactic:
nth_rw 4 [h2]

Result:
case h
α : Type u_1
Ω : Type u_2
ι : Type u_3
_mα : MeasurableSpace α
s : ι → Set (Set Ω)
_mΩ : MeasurableSpace Ω
κ : Kernel α Ω
μ : Measure α
h_indep : iIndepSets s κ μ
i j : ι
hij : i ≠ j
t₁ t₂ : Set Ω
ht₁ : t₁ ∈ s i
ht₂ : t₂ ∈ s j
hf_m : ∀ x ∈ {i, j}, (if x = i then t₁ else t₂) ∈ s x
h1 : t₁ = if i = i then t₁ else t₂
h2 : t₂ = if j = i then t₁ else t₂
h_inter : (⋂ t ∈ {i, j}, if t = i then t₁ else t₂) = (if i = i then t₁ else t₂) ∩ if j = i then t₁ else t₂
a : α
h_indep' : (κ a) (⋂ i_1 ∈ {i, j}, if i_1 = i then t₁ else t₂) = ∏ i_1 ∈ {i, j}, (κ a) (if i_1 = i then t₁ else t₂)
h_prod :
  ∏ t ∈ {i, j}, (κ a) (if t = i then t₁ else t₂) = (κ a) (if i = i then t₁ else t₂) * (κ a) (if j = i then t₁ else t₂)
⊢ (κ a) ((if i = i then t₁ else t₂) ∩ if j = i then t₁ else t₂) =
    (κ a) (if i = i then t₁ else t₂) * (κ a) (if j = i then t₁ else t₂)

Proof state:
α : Type u_1
Ω : Type u_2
ι : Type u_3
_mα : MeasurableSpace α
s : ι → Set (Set Ω)
_mΩ : MeasurableSpace Ω
κ : Kernel α Ω
μ : Measure α
h_indep : iIndepSets s κ μ
i j : ι
hij : i ≠ j
t₁ t₂ : Set Ω
ht₁ : t₁ ∈ s i
ht₂ : t₂ ∈ s j
hf_m : ∀ x ∈ {i, j}, (if x = i then t₁ else t₂) ∈ s x
⊢ t₁ = if i = i then t₁ else t₂

Tactic:
simp only [if_true, eq_self_iff_true]

Result:
no goals

Proof state:
α : Type u_1
Ω : Type u_2
ι : Type u_3
_mα : MeasurableSpace α
s : ι → Set (Set Ω)
_mΩ : MeasurableSpace Ω
κ : Kernel α Ω
μ : Measure α
h_indep : iIndepSets s κ μ
i j : ι
hij : i ≠ j
t₁ t₂ : Set Ω
ht₁ : t₁ ∈ s i
ht₂ : t₂ ∈ s j
hf_m : ∀ x ∈ {i, j}, (if x = i then t₁ else t₂) ∈ s x
h1 : t₁ = if i = i then t₁ else t₂
h2 : t₂ = if j = i then t₁ else t₂
h_inter : (⋂ t ∈ {i, j}, if t = i then t₁ else t₂) = (if i = i then t₁ else t₂) ∩ if j = i then t₁ else t₂
a : α
h_indep' : (κ a) (⋂ i_1 ∈ {i, j}, if i_1 = i then t₁ else t₂) = ∏ i_1 ∈ {i, j}, (κ a) (if i_1 = i then t₁ else t₂)
⊢ ∏ t ∈ {i, j}, (κ a) (if t = i then t₁ else t₂) = (κ a) (if i = i then t₁ else t₂) * (κ a) (if j = i then t₁ else t₂)

Tactic:
simp only [hij, Finset.prod_singleton, Finset.prod_insert, not_false_iff,
  Finset.mem_singleton]

Result:
no goals

Proof state:
case h
α : Type u_1
Ω : Type u_2
ι : Type u_3
_mα : MeasurableSpace α
s : ι → Set (Set Ω)
_mΩ : MeasurableSpace Ω
κ : Kernel α Ω
μ : Measure α
h_indep : iIndepSets s κ μ
i j : ι
hij : i ≠ j
t₁ t₂ : Set Ω
ht₁ : t₁ ∈ s i
ht₂ : t₂ ∈ s j
hf_m : ∀ x ∈ {i, j}, (if x = i then t₁ else t₂) ∈ s x
h1 : t₁ = if i = i then t₁ else t₂
h2 : t₂ = if j = i then t₁ else t₂
h_inter : (⋂ t ∈ {i, j}, if t = i then t₁ else t₂) = (if i = i then t₁ else t₂) ∩ if j = i then t₁ else t₂
a : α
h_indep' : (κ a) (⋂ i_1 ∈ {i, j}, if i_1 = i then t₁ else t₂) = ∏ i_1 ∈ {i, j}, (κ a) (if i_1 = i then t₁ else t₂)
h_prod :
  ∏ t ∈ {i, j}, (κ a) (if t = i then t₁ else t₂) = (κ a) (if i = i then t₁ else t₂) * (κ a) (if j = i then t₁ else t₂)
⊢ (κ a) (t₁ ∩ t₂) = (κ a) t₁ * (κ a) t₂

Tactic:
rw [h1]

Result:
case h
α : Type u_1
Ω : Type u_2
ι : Type u_3
_mα : MeasurableSpace α
s : ι → Set (Set Ω)
_mΩ : MeasurableSpace Ω
κ : Kernel α Ω
μ : Measure α
h_indep : iIndepSets s κ μ
i j : ι
hij : i ≠ j
t₁ t₂ : Set Ω
ht₁ : t₁ ∈ s i
ht₂ : t₂ ∈ s j
hf_m : ∀ x ∈ {i, j}, (if x = i then t₁ else t₂) ∈ s x
h1 : t₁ = if i = i then t₁ else t₂
h2 : t₂ = if j = i then t₁ else t₂
h_inter : (⋂ t ∈ {i, j}, if t = i then t₁ else t₂) = (if i = i then t₁ else t₂) ∩ if j = i then t₁ else t₂
a : α
h_indep' : (κ a) (⋂ i_1 ∈ {i, j}, if i_1 = i then t₁ else t₂) = ∏ i_1 ∈ {i, j}, (κ a) (if i_1 = i then t₁ else t₂)
h_prod :
  ∏ t ∈ {i, j}, (κ a) (if t = i then t₁ else t₂) = (κ a) (if i = i then t₁ else t₂) * (κ a) (if j = i then t₁ else t₂)
⊢ (κ a) ((if i = i then t₁ else t₂) ∩ t₂) = (κ a) (if i = i then t₁ else t₂) * (κ a) t₂