l3lab/ntp-mathlib huggingface dataset:
theorem IndepSets.indep_aux {m₂ m : MeasurableSpace Ω}
    {κ : kernel α Ω} {μ : Measure α} [IsMarkovKernel κ] {p1 p2 : Set (Set Ω)} (h2 : m₂ ≤ m)
    (hp2 : IsPiSystem p2) (hpm2 : m₂ = generateFrom p2) (hyp : IndepSets p1 p2 κ μ) {t1 t2 : Set Ω}
    (ht1 : t1 ∈ p1) (ht1m : MeasurableSet[m] t1) (ht2m : MeasurableSet[m₂] t2) :
    ∀ᵐ a ∂μ, κ a (t1 ∩ t2) = κ a t1 * κ a t2 := by
  refine @induction_on_inter _ (fun t ↦ ∀ᵐ a ∂μ, κ a (t1 ∩ t) = κ a t1 * κ a t) _
    m₂ hpm2 hp2 ?_ ?_ ?_ ?_ t2 ht2m
  · simp only [Set.inter_empty, measure_empty, mul_zero, eq_self_iff_true,
      Filter.eventually_true]
  · exact fun t ht_mem_p2 ↦ hyp t1 t ht1 ht_mem_p2
  · intros t ht h
    filter_upwards [h] with a ha
    have : t1 ∩ tᶜ = t1 \ (t1 ∩ t) := by
      rw [Set.diff_self_inter, Set.diff_eq_compl_inter, Set.inter_comm]
    rw [this,
      measure_diff (Set.inter_subset_left _ _) (ht1m.inter (h2 _ ht)) (measure_ne_top (κ a) _),
      measure_compl (h2 _ ht) (measure_ne_top (κ a) t), measure_univ,
      ENNReal.mul_sub (fun _ _ ↦ measure_ne_top (κ a) _), mul_one, ha]
  · 

Proof state:
case refine_4
α : Type u_1
Ω : Type u_2
ι : Type u_3
_mα : MeasurableSpace α
m₂ m : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
inst✝ : IsMarkovKernel κ
p1 p2 : Set (Set Ω)
h2 : m₂ ≤ m
hp2 : IsPiSystem p2
hpm2 : m₂ = generateFrom p2
hyp : IndepSets p1 p2 κ
t1 t2 : Set Ω
ht1 : t1 ∈ p1
ht1m : MeasurableSet t1
ht2m : MeasurableSet t2
⊢ ∀ (f : ℕ → Set Ω),
    Pairwise (Disjoint on f) →
      (∀ (i : ℕ), MeasurableSet (f i)) →
        (∀ (i : ℕ), (fun t => ∀ᵐ (a : α) ∂μ, ↑↑(κ a) (t1 ∩ t) = ↑↑(κ a) t1 * ↑↑(κ a) t) (f i)) →
          (fun t => ∀ᵐ (a : α) ∂μ, ↑↑(κ a) (t1 ∩ t) = ↑↑(κ a) t1 * ↑↑(κ a) t) (⋃ i, f i)

Next tactic:
intros f hf_disj hf_meas h
theorem IndepSets.indep_aux {m₂ m : MeasurableSpace Ω}
    {κ : kernel α Ω} {μ : Measure α} [IsMarkovKernel κ] {p1 p2 : Set (Set Ω)} (h2 : m₂ ≤ m)
    (hp2 : IsPiSystem p2) (hpm2 : m₂ = generateFrom p2) (hyp : IndepSets p1 p2 κ μ) {t1 t2 : Set Ω}
    (ht1 : t1 ∈ p1) (ht1m : MeasurableSet[m] t1) (ht2m : MeasurableSet[m₂] t2) :
    ∀ᵐ a ∂μ, κ a (t1 ∩ t2) = κ a t1 * κ a t2 := by
  refine @induction_on_inter _ (fun t ↦ ∀ᵐ a ∂μ, κ a (t1 ∩ t) = κ a t1 * κ a t) _
    m₂ hpm2 hp2 ?_ ?_ ?_ ?_ t2 ht2m
  · simp only [Set.inter_empty, measure_empty, mul_zero, eq_self_iff_true,
      Filter.eventually_true]
  · exact fun t ht_mem_p2 ↦ hyp t1 t ht1 ht_mem_p2
  · intros t ht h
    filter_upwards [h] with a ha
    have : t1 ∩ tᶜ = t1 \ (t1 ∩ t) := by
      rw [Set.diff_self_inter, Set.diff_eq_compl_inter, Set.inter_comm]
    rw [this,
      measure_diff (Set.inter_subset_left _ _) (ht1m.inter (h2 _ ht)) (measure_ne_top (κ a) _),
      measure_compl (h2 _ ht) (measure_ne_top (κ a) t), measure_univ,
      ENNReal.mul_sub (fun _ _ ↦ measure_ne_top (κ a) _), mul_one, ha]
  · intros f hf_disj hf_meas h
    

Proof state:
case refine_4
α : Type u_1
Ω : Type u_2
ι : Type u_3
_mα : MeasurableSpace α
m₂ m : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
inst✝ : IsMarkovKernel κ
p1 p2 : Set (Set Ω)
h2 : m₂ ≤ m
hp2 : IsPiSystem p2
hpm2 : m₂ = generateFrom p2
hyp : IndepSets p1 p2 κ
t1 t2 : Set Ω
ht1 : t1 ∈ p1
ht1m : MeasurableSet t1
ht2m : MeasurableSet t2
f : ℕ → Set Ω
hf_disj : Pairwise (Disjoint on f)
hf_meas : ∀ (i : ℕ), MeasurableSet (f i)
h : ∀ (i : ℕ), (fun t => ∀ᵐ (a : α) ∂μ, ↑↑(κ a) (t1 ∩ t) = ↑↑(κ a) t1 * ↑↑(κ a) t) (f i)
⊢ ∀ᵐ (a : α) ∂μ, ↑↑(κ a) (t1 ∩ ⋃ i, f i) = ↑↑(κ a) t1 * ↑↑(κ a) (⋃ i, f i)

Next tactic:
rw [← ae_all_iff] at h
theorem IndepSets.indep_aux {m₂ m : MeasurableSpace Ω}
    {κ : kernel α Ω} {μ : Measure α} [IsMarkovKernel κ] {p1 p2 : Set (Set Ω)} (h2 : m₂ ≤ m)
    (hp2 : IsPiSystem p2) (hpm2 : m₂ = generateFrom p2) (hyp : IndepSets p1 p2 κ μ) {t1 t2 : Set Ω}
    (ht1 : t1 ∈ p1) (ht1m : MeasurableSet[m] t1) (ht2m : MeasurableSet[m₂] t2) :
    ∀ᵐ a ∂μ, κ a (t1 ∩ t2) = κ a t1 * κ a t2 := by
  refine @induction_on_inter _ (fun t ↦ ∀ᵐ a ∂μ, κ a (t1 ∩ t) = κ a t1 * κ a t) _
    m₂ hpm2 hp2 ?_ ?_ ?_ ?_ t2 ht2m
  · simp only [Set.inter_empty, measure_empty, mul_zero, eq_self_iff_true,
      Filter.eventually_true]
  · exact fun t ht_mem_p2 ↦ hyp t1 t ht1 ht_mem_p2
  · intros t ht h
    filter_upwards [h] with a ha
    have : t1 ∩ tᶜ = t1 \ (t1 ∩ t) := by
      rw [Set.diff_self_inter, Set.diff_eq_compl_inter, Set.inter_comm]
    rw [this,
      measure_diff (Set.inter_subset_left _ _) (ht1m.inter (h2 _ ht)) (measure_ne_top (κ a) _),
      measure_compl (h2 _ ht) (measure_ne_top (κ a) t), measure_univ,
      ENNReal.mul_sub (fun _ _ ↦ measure_ne_top (κ a) _), mul_one, ha]
  · intros f hf_disj hf_meas h
    rw [← ae_all_iff] at h
    

Proof state:
case refine_4
α : Type u_1
Ω : Type u_2
ι : Type u_3
_mα : MeasurableSpace α
m₂ m : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
inst✝ : IsMarkovKernel κ
p1 p2 : Set (Set Ω)
h2 : m₂ ≤ m
hp2 : IsPiSystem p2
hpm2 : m₂ = generateFrom p2
hyp : IndepSets p1 p2 κ
t1 t2 : Set Ω
ht1 : t1 ∈ p1
ht1m : MeasurableSet t1
ht2m : MeasurableSet t2
f : ℕ → Set Ω
hf_disj : Pairwise (Disjoint on f)
hf_meas : ∀ (i : ℕ), MeasurableSet (f i)
h : ∀ᵐ (a : α) ∂μ, ∀ (i : ℕ), ↑↑(κ a) (t1 ∩ f i) = ↑↑(κ a) t1 * ↑↑(κ a) (f i)
⊢ ∀ᵐ (a : α) ∂μ, ↑↑(κ a) (t1 ∩ ⋃ i, f i) = ↑↑(κ a) t1 * ↑↑(κ a) (⋃ i, f i)

Next tactic:
filter_upwards [h] with a ha
theorem IndepSets.indep_aux {m₂ m : MeasurableSpace Ω}
    {κ : kernel α Ω} {μ : Measure α} [IsMarkovKernel κ] {p1 p2 : Set (Set Ω)} (h2 : m₂ ≤ m)
    (hp2 : IsPiSystem p2) (hpm2 : m₂ = generateFrom p2) (hyp : IndepSets p1 p2 κ μ) {t1 t2 : Set Ω}
    (ht1 : t1 ∈ p1) (ht1m : MeasurableSet[m] t1) (ht2m : MeasurableSet[m₂] t2) :
    ∀ᵐ a ∂μ, κ a (t1 ∩ t2) = κ a t1 * κ a t2 := by
  refine @induction_on_inter _ (fun t ↦ ∀ᵐ a ∂μ, κ a (t1 ∩ t) = κ a t1 * κ a t) _
    m₂ hpm2 hp2 ?_ ?_ ?_ ?_ t2 ht2m
  · simp only [Set.inter_empty, measure_empty, mul_zero, eq_self_iff_true,
      Filter.eventually_true]
  · exact fun t ht_mem_p2 ↦ hyp t1 t ht1 ht_mem_p2
  · intros t ht h
    filter_upwards [h] with a ha
    have : t1 ∩ tᶜ = t1 \ (t1 ∩ t) := by
      rw [Set.diff_self_inter, Set.diff_eq_compl_inter, Set.inter_comm]
    rw [this,
      measure_diff (Set.inter_subset_left _ _) (ht1m.inter (h2 _ ht)) (measure_ne_top (κ a) _),
      measure_compl (h2 _ ht) (measure_ne_top (κ a) t), measure_univ,
      ENNReal.mul_sub (fun _ _ ↦ measure_ne_top (κ a) _), mul_one, ha]
  · intros f hf_disj hf_meas h
    rw [← ae_all_iff] at h
    filter_upwards [h] with a ha
    

Proof state:
case h
α : Type u_1
Ω : Type u_2
ι : Type u_3
_mα : MeasurableSpace α
m₂ m : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
inst✝ : IsMarkovKernel κ
p1 p2 : Set (Set Ω)
h2 : m₂ ≤ m
hp2 : IsPiSystem p2
hpm2 : m₂ = generateFrom p2
hyp : IndepSets p1 p2 κ
t1 t2 : Set Ω
ht1 : t1 ∈ p1
ht1m : MeasurableSet t1
ht2m : MeasurableSet t2
f : ℕ → Set Ω
hf_disj : Pairwise (Disjoint on f)
hf_meas : ∀ (i : ℕ), MeasurableSet (f i)
h : ∀ᵐ (a : α) ∂μ, ∀ (i : ℕ), ↑↑(κ a) (t1 ∩ f i) = ↑↑(κ a) t1 * ↑↑(κ a) (f i)
a : α
ha : ∀ (i : ℕ), ↑↑(κ a) (t1 ∩ f i) = ↑↑(κ a) t1 * ↑↑(κ a) (f i)
⊢ ↑↑(κ a) (t1 ∩ ⋃ i, f i) = ↑↑(κ a) t1 * ↑↑(κ a) (⋃ i, f i)

Next tactic:
rw [Set.inter_iUnion, measure_iUnion]
theorem IndepSets.indep_aux {m₂ m : MeasurableSpace Ω}
    {κ : kernel α Ω} {μ : Measure α} [IsMarkovKernel κ] {p1 p2 : Set (Set Ω)} (h2 : m₂ ≤ m)
    (hp2 : IsPiSystem p2) (hpm2 : m₂ = generateFrom p2) (hyp : IndepSets p1 p2 κ μ) {t1 t2 : Set Ω}
    (ht1 : t1 ∈ p1) (ht1m : MeasurableSet[m] t1) (ht2m : MeasurableSet[m₂] t2) :
    ∀ᵐ a ∂μ, κ a (t1 ∩ t2) = κ a t1 * κ a t2 := by
  refine @induction_on_inter _ (fun t ↦ ∀ᵐ a ∂μ, κ a (t1 ∩ t) = κ a t1 * κ a t) _
    m₂ hpm2 hp2 ?_ ?_ ?_ ?_ t2 ht2m
  · simp only [Set.inter_empty, measure_empty, mul_zero, eq_self_iff_true,
      Filter.eventually_true]
  · exact fun t ht_mem_p2 ↦ hyp t1 t ht1 ht_mem_p2
  · intros t ht h
    filter_upwards [h] with a ha
    have : t1 ∩ tᶜ = t1 \ (t1 ∩ t) := by
      rw [Set.diff_self_inter, Set.diff_eq_compl_inter, Set.inter_comm]
    rw [this,
      measure_diff (Set.inter_subset_left _ _) (ht1m.inter (h2 _ ht)) (measure_ne_top (κ a) _),
      measure_compl (h2 _ ht) (measure_ne_top (κ a) t), measure_univ,
      ENNReal.mul_sub (fun _ _ ↦ measure_ne_top (κ a) _), mul_one, ha]
  · intros f hf_disj hf_meas h
    rw [← ae_all_iff] at h
    filter_upwards [h] with a ha
    rw [Set.inter_iUnion, measure_iUnion]
    · 

Proof state:
case h
α : Type u_1
Ω : Type u_2
ι : Type u_3
_mα : MeasurableSpace α
m₂ m : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
inst✝ : IsMarkovKernel κ
p1 p2 : Set (Set Ω)
h2 : m₂ ≤ m
hp2 : IsPiSystem p2
hpm2 : m₂ = generateFrom p2
hyp : IndepSets p1 p2 κ
t1 t2 : Set Ω
ht1 : t1 ∈ p1
ht1m : MeasurableSet t1
ht2m : MeasurableSet t2
f : ℕ → Set Ω
hf_disj : Pairwise (Disjoint on f)
hf_meas : ∀ (i : ℕ), MeasurableSet (f i)
h : ∀ᵐ (a : α) ∂μ, ∀ (i : ℕ), ↑↑(κ a) (t1 ∩ f i) = ↑↑(κ a) t1 * ↑↑(κ a) (f i)
a : α
ha : ∀ (i : ℕ), ↑↑(κ a) (t1 ∩ f i) = ↑↑(κ a) t1 * ↑↑(κ a) (f i)
⊢ ∑' (i : ℕ), ↑↑(κ a) (t1 ∩ f i) = ↑↑(κ a) t1 * ↑↑(κ a) (⋃ i, f i)

Next tactic:
rw [measure_iUnion hf_disj (fun i ↦ h2 _ (hf_meas i))]
theorem IndepSets.indep_aux {m₂ m : MeasurableSpace Ω}
    {κ : kernel α Ω} {μ : Measure α} [IsMarkovKernel κ] {p1 p2 : Set (Set Ω)} (h2 : m₂ ≤ m)
    (hp2 : IsPiSystem p2) (hpm2 : m₂ = generateFrom p2) (hyp : IndepSets p1 p2 κ μ) {t1 t2 : Set Ω}
    (ht1 : t1 ∈ p1) (ht1m : MeasurableSet[m] t1) (ht2m : MeasurableSet[m₂] t2) :
    ∀ᵐ a ∂μ, κ a (t1 ∩ t2) = κ a t1 * κ a t2 := by
  refine @induction_on_inter _ (fun t ↦ ∀ᵐ a ∂μ, κ a (t1 ∩ t) = κ a t1 * κ a t) _
    m₂ hpm2 hp2 ?_ ?_ ?_ ?_ t2 ht2m
  · simp only [Set.inter_empty, measure_empty, mul_zero, eq_self_iff_true,
      Filter.eventually_true]
  · exact fun t ht_mem_p2 ↦ hyp t1 t ht1 ht_mem_p2
  · intros t ht h
    filter_upwards [h] with a ha
    have : t1 ∩ tᶜ = t1 \ (t1 ∩ t) := by
      rw [Set.diff_self_inter, Set.diff_eq_compl_inter, Set.inter_comm]
    rw [this,
      measure_diff (Set.inter_subset_left _ _) (ht1m.inter (h2 _ ht)) (measure_ne_top (κ a) _),
      measure_compl (h2 _ ht) (measure_ne_top (κ a) t), measure_univ,
      ENNReal.mul_sub (fun _ _ ↦ measure_ne_top (κ a) _), mul_one, ha]
  · intros f hf_disj hf_meas h
    rw [← ae_all_iff] at h
    filter_upwards [h] with a ha
    rw [Set.inter_iUnion, measure_iUnion]
    · rw [measure_iUnion hf_disj (fun i ↦ h2 _ (hf_meas i))]
      

Proof state:
case h
α : Type u_1
Ω : Type u_2
ι : Type u_3
_mα : MeasurableSpace α
m₂ m : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
inst✝ : IsMarkovKernel κ
p1 p2 : Set (Set Ω)
h2 : m₂ ≤ m
hp2 : IsPiSystem p2
hpm2 : m₂ = generateFrom p2
hyp : IndepSets p1 p2 κ
t1 t2 : Set Ω
ht1 : t1 ∈ p1
ht1m : MeasurableSet t1
ht2m : MeasurableSet t2
f : ℕ → Set Ω
hf_disj : Pairwise (Disjoint on f)
hf_meas : ∀ (i : ℕ), MeasurableSet (f i)
h : ∀ᵐ (a : α) ∂μ, ∀ (i : ℕ), ↑↑(κ a) (t1 ∩ f i) = ↑↑(κ a) t1 * ↑↑(κ a) (f i)
a : α
ha : ∀ (i : ℕ), ↑↑(κ a) (t1 ∩ f i) = ↑↑(κ a) t1 * ↑↑(κ a) (f i)
⊢ ∑' (i : ℕ), ↑↑(κ a) (t1 ∩ f i) = ↑↑(κ a) t1 * ∑' (i : ℕ), ↑↑(κ a) (f i)

Next tactic:
rw [← ENNReal.tsum_mul_left]
theorem IndepSets.indep_aux {m₂ m : MeasurableSpace Ω}
    {κ : kernel α Ω} {μ : Measure α} [IsMarkovKernel κ] {p1 p2 : Set (Set Ω)} (h2 : m₂ ≤ m)
    (hp2 : IsPiSystem p2) (hpm2 : m₂ = generateFrom p2) (hyp : IndepSets p1 p2 κ μ) {t1 t2 : Set Ω}
    (ht1 : t1 ∈ p1) (ht1m : MeasurableSet[m] t1) (ht2m : MeasurableSet[m₂] t2) :
    ∀ᵐ a ∂μ, κ a (t1 ∩ t2) = κ a t1 * κ a t2 := by
  refine @induction_on_inter _ (fun t ↦ ∀ᵐ a ∂μ, κ a (t1 ∩ t) = κ a t1 * κ a t) _
    m₂ hpm2 hp2 ?_ ?_ ?_ ?_ t2 ht2m
  · simp only [Set.inter_empty, measure_empty, mul_zero, eq_self_iff_true,
      Filter.eventually_true]
  · exact fun t ht_mem_p2 ↦ hyp t1 t ht1 ht_mem_p2
  · intros t ht h
    filter_upwards [h] with a ha
    have : t1 ∩ tᶜ = t1 \ (t1 ∩ t) := by
      rw [Set.diff_self_inter, Set.diff_eq_compl_inter, Set.inter_comm]
    rw [this,
      measure_diff (Set.inter_subset_left _ _) (ht1m.inter (h2 _ ht)) (measure_ne_top (κ a) _),
      measure_compl (h2 _ ht) (measure_ne_top (κ a) t), measure_univ,
      ENNReal.mul_sub (fun _ _ ↦ measure_ne_top (κ a) _), mul_one, ha]
  · intros f hf_disj hf_meas h
    rw [← ae_all_iff] at h
    filter_upwards [h] with a ha
    rw [Set.inter_iUnion, measure_iUnion]
    · rw [measure_iUnion hf_disj (fun i ↦ h2 _ (hf_meas i))]
      rw [← ENNReal.tsum_mul_left]
      

Proof state:
case h
α : Type u_1
Ω : Type u_2
ι : Type u_3
_mα : MeasurableSpace α
m₂ m : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
inst✝ : IsMarkovKernel κ
p1 p2 : Set (Set Ω)
h2 : m₂ ≤ m
hp2 : IsPiSystem p2
hpm2 : m₂ = generateFrom p2
hyp : IndepSets p1 p2 κ
t1 t2 : Set Ω
ht1 : t1 ∈ p1
ht1m : MeasurableSet t1
ht2m : MeasurableSet t2
f : ℕ → Set Ω
hf_disj : Pairwise (Disjoint on f)
hf_meas : ∀ (i : ℕ), MeasurableSet (f i)
h : ∀ᵐ (a : α) ∂μ, ∀ (i : ℕ), ↑↑(κ a) (t1 ∩ f i) = ↑↑(κ a) t1 * ↑↑(κ a) (f i)
a : α
ha : ∀ (i : ℕ), ↑↑(κ a) (t1 ∩ f i) = ↑↑(κ a) t1 * ↑↑(κ a) (f i)
⊢ ∑' (i : ℕ), ↑↑(κ a) (t1 ∩ f i) = ∑' (i : ℕ), ↑↑(κ a) t1 * ↑↑(κ a) (f i)

Next tactic:
congr with i
theorem IndepSets.indep_aux {m₂ m : MeasurableSpace Ω}
    {κ : kernel α Ω} {μ : Measure α} [IsMarkovKernel κ] {p1 p2 : Set (Set Ω)} (h2 : m₂ ≤ m)
    (hp2 : IsPiSystem p2) (hpm2 : m₂ = generateFrom p2) (hyp : IndepSets p1 p2 κ μ) {t1 t2 : Set Ω}
    (ht1 : t1 ∈ p1) (ht1m : MeasurableSet[m] t1) (ht2m : MeasurableSet[m₂] t2) :
    ∀ᵐ a ∂μ, κ a (t1 ∩ t2) = κ a t1 * κ a t2 := by
  refine @induction_on_inter _ (fun t ↦ ∀ᵐ a ∂μ, κ a (t1 ∩ t) = κ a t1 * κ a t) _
    m₂ hpm2 hp2 ?_ ?_ ?_ ?_ t2 ht2m
  · simp only [Set.inter_empty, measure_empty, mul_zero, eq_self_iff_true,
      Filter.eventually_true]
  · exact fun t ht_mem_p2 ↦ hyp t1 t ht1 ht_mem_p2
  · intros t ht h
    filter_upwards [h] with a ha
    have : t1 ∩ tᶜ = t1 \ (t1 ∩ t) := by
      rw [Set.diff_self_inter, Set.diff_eq_compl_inter, Set.inter_comm]
    rw [this,
      measure_diff (Set.inter_subset_left _ _) (ht1m.inter (h2 _ ht)) (measure_ne_top (κ a) _),
      measure_compl (h2 _ ht) (measure_ne_top (κ a) t), measure_univ,
      ENNReal.mul_sub (fun _ _ ↦ measure_ne_top (κ a) _), mul_one, ha]
  · intros f hf_disj hf_meas h
    rw [← ae_all_iff] at h
    filter_upwards [h] with a ha
    rw [Set.inter_iUnion, measure_iUnion]
    · rw [measure_iUnion hf_disj (fun i ↦ h2 _ (hf_meas i))]
      rw [← ENNReal.tsum_mul_left]
      congr with i
      

Proof state:
case h.e_f.h
α : Type u_1
Ω : Type u_2
ι : Type u_3
_mα : MeasurableSpace α
m₂ m : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
inst✝ : IsMarkovKernel κ
p1 p2 : Set (Set Ω)
h2 : m₂ ≤ m
hp2 : IsPiSystem p2
hpm2 : m₂ = generateFrom p2
hyp : IndepSets p1 p2 κ
t1 t2 : Set Ω
ht1 : t1 ∈ p1
ht1m : MeasurableSet t1
ht2m : MeasurableSet t2
f : ℕ → Set Ω
hf_disj : Pairwise (Disjoint on f)
hf_meas : ∀ (i : ℕ), MeasurableSet (f i)
h : ∀ᵐ (a : α) ∂μ, ∀ (i : ℕ), ↑↑(κ a) (t1 ∩ f i) = ↑↑(κ a) t1 * ↑↑(κ a) (f i)
a : α
ha : ∀ (i : ℕ), ↑↑(κ a) (t1 ∩ f i) = ↑↑(κ a) t1 * ↑↑(κ a) (f i)
i : ℕ
⊢ ↑↑(κ a) (t1 ∩ f i) = ↑↑(κ a) t1 * ↑↑(κ a) (f i)

Next tactic:
rw [ha i]
theorem IndepSets.indep_aux {m₂ m : MeasurableSpace Ω}
    {κ : kernel α Ω} {μ : Measure α} [IsMarkovKernel κ] {p1 p2 : Set (Set Ω)} (h2 : m₂ ≤ m)
    (hp2 : IsPiSystem p2) (hpm2 : m₂ = generateFrom p2) (hyp : IndepSets p1 p2 κ μ) {t1 t2 : Set Ω}
    (ht1 : t1 ∈ p1) (ht1m : MeasurableSet[m] t1) (ht2m : MeasurableSet[m₂] t2) :
    ∀ᵐ a ∂μ, κ a (t1 ∩ t2) = κ a t1 * κ a t2 := by
  refine @induction_on_inter _ (fun t ↦ ∀ᵐ a ∂μ, κ a (t1 ∩ t) = κ a t1 * κ a t) _
    m₂ hpm2 hp2 ?_ ?_ ?_ ?_ t2 ht2m
  · simp only [Set.inter_empty, measure_empty, mul_zero, eq_self_iff_true,
      Filter.eventually_true]
  · exact fun t ht_mem_p2 ↦ hyp t1 t ht1 ht_mem_p2
  · intros t ht h
    filter_upwards [h] with a ha
    have : t1 ∩ tᶜ = t1 \ (t1 ∩ t) := by
      rw [Set.diff_self_inter, Set.diff_eq_compl_inter, Set.inter_comm]
    rw [this,
      measure_diff (Set.inter_subset_left _ _) (ht1m.inter (h2 _ ht)) (measure_ne_top (κ a) _),
      measure_compl (h2 _ ht) (measure_ne_top (κ a) t), measure_univ,
      ENNReal.mul_sub (fun _ _ ↦ measure_ne_top (κ a) _), mul_one, ha]
  · intros f hf_disj hf_meas h
    rw [← ae_all_iff] at h
    filter_upwards [h] with a ha
    rw [Set.inter_iUnion, measure_iUnion]
    · rw [measure_iUnion hf_disj (fun i ↦ h2 _ (hf_meas i))]
      rw [← ENNReal.tsum_mul_left]
      congr with i
      rw [ha i]
    · 

Proof state:
case h.hn
α : Type u_1
Ω : Type u_2
ι : Type u_3
_mα : MeasurableSpace α
m₂ m : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
inst✝ : IsMarkovKernel κ
p1 p2 : Set (Set Ω)
h2 : m₂ ≤ m
hp2 : IsPiSystem p2
hpm2 : m₂ = generateFrom p2
hyp : IndepSets p1 p2 κ
t1 t2 : Set Ω
ht1 : t1 ∈ p1
ht1m : MeasurableSet t1
ht2m : MeasurableSet t2
f : ℕ → Set Ω
hf_disj : Pairwise (Disjoint on f)
hf_meas : ∀ (i : ℕ), MeasurableSet (f i)
h : ∀ᵐ (a : α) ∂μ, ∀ (i : ℕ), ↑↑(κ a) (t1 ∩ f i) = ↑↑(κ a) t1 * ↑↑(κ a) (f i)
a : α
ha : ∀ (i : ℕ), ↑↑(κ a) (t1 ∩ f i) = ↑↑(κ a) t1 * ↑↑(κ a) (f i)
⊢ Pairwise (Disjoint on fun i => t1 ∩ f i)

Next tactic:
intros i j hij
theorem IndepSets.indep_aux {m₂ m : MeasurableSpace Ω}
    {κ : kernel α Ω} {μ : Measure α} [IsMarkovKernel κ] {p1 p2 : Set (Set Ω)} (h2 : m₂ ≤ m)
    (hp2 : IsPiSystem p2) (hpm2 : m₂ = generateFrom p2) (hyp : IndepSets p1 p2 κ μ) {t1 t2 : Set Ω}
    (ht1 : t1 ∈ p1) (ht1m : MeasurableSet[m] t1) (ht2m : MeasurableSet[m₂] t2) :
    ∀ᵐ a ∂μ, κ a (t1 ∩ t2) = κ a t1 * κ a t2 := by
  refine @induction_on_inter _ (fun t ↦ ∀ᵐ a ∂μ, κ a (t1 ∩ t) = κ a t1 * κ a t) _
    m₂ hpm2 hp2 ?_ ?_ ?_ ?_ t2 ht2m
  · simp only [Set.inter_empty, measure_empty, mul_zero, eq_self_iff_true,
      Filter.eventually_true]
  · exact fun t ht_mem_p2 ↦ hyp t1 t ht1 ht_mem_p2
  · intros t ht h
    filter_upwards [h] with a ha
    have : t1 ∩ tᶜ = t1 \ (t1 ∩ t) := by
      rw [Set.diff_self_inter, Set.diff_eq_compl_inter, Set.inter_comm]
    rw [this,
      measure_diff (Set.inter_subset_left _ _) (ht1m.inter (h2 _ ht)) (measure_ne_top (κ a) _),
      measure_compl (h2 _ ht) (measure_ne_top (κ a) t), measure_univ,
      ENNReal.mul_sub (fun _ _ ↦ measure_ne_top (κ a) _), mul_one, ha]
  · intros f hf_disj hf_meas h
    rw [← ae_all_iff] at h
    filter_upwards [h] with a ha
    rw [Set.inter_iUnion, measure_iUnion]
    · rw [measure_iUnion hf_disj (fun i ↦ h2 _ (hf_meas i))]
      rw [← ENNReal.tsum_mul_left]
      congr with i
      rw [ha i]
    · intros i j hij
      

Proof state:
case h.hn
α : Type u_1
Ω : Type u_2
ι : Type u_3
_mα : MeasurableSpace α
m₂ m : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
inst✝ : IsMarkovKernel κ
p1 p2 : Set (Set Ω)
h2 : m₂ ≤ m
hp2 : IsPiSystem p2
hpm2 : m₂ = generateFrom p2
hyp : IndepSets p1 p2 κ
t1 t2 : Set Ω
ht1 : t1 ∈ p1
ht1m : MeasurableSet t1
ht2m : MeasurableSet t2
f : ℕ → Set Ω
hf_disj : Pairwise (Disjoint on f)
hf_meas : ∀ (i : ℕ), MeasurableSet (f i)
h : ∀ᵐ (a : α) ∂μ, ∀ (i : ℕ), ↑↑(κ a) (t1 ∩ f i) = ↑↑(κ a) t1 * ↑↑(κ a) (f i)
a : α
ha : ∀ (i : ℕ), ↑↑(κ a) (t1 ∩ f i) = ↑↑(κ a) t1 * ↑↑(κ a) (f i)
i j : ℕ
hij : i ≠ j
⊢ (Disjoint on fun i => t1 ∩ f i) i j

Next tactic:
rw [Function.onFun, Set.inter_comm t1, Set.inter_comm t1]
theorem IndepSets.indep_aux {m₂ m : MeasurableSpace Ω}
    {κ : kernel α Ω} {μ : Measure α} [IsMarkovKernel κ] {p1 p2 : Set (Set Ω)} (h2 : m₂ ≤ m)
    (hp2 : IsPiSystem p2) (hpm2 : m₂ = generateFrom p2) (hyp : IndepSets p1 p2 κ μ) {t1 t2 : Set Ω}
    (ht1 : t1 ∈ p1) (ht1m : MeasurableSet[m] t1) (ht2m : MeasurableSet[m₂] t2) :
    ∀ᵐ a ∂μ, κ a (t1 ∩ t2) = κ a t1 * κ a t2 := by
  refine @induction_on_inter _ (fun t ↦ ∀ᵐ a ∂μ, κ a (t1 ∩ t) = κ a t1 * κ a t) _
    m₂ hpm2 hp2 ?_ ?_ ?_ ?_ t2 ht2m
  · simp only [Set.inter_empty, measure_empty, mul_zero, eq_self_iff_true,
      Filter.eventually_true]
  · exact fun t ht_mem_p2 ↦ hyp t1 t ht1 ht_mem_p2
  · intros t ht h
    filter_upwards [h] with a ha
    have : t1 ∩ tᶜ = t1 \ (t1 ∩ t) := by
      rw [Set.diff_self_inter, Set.diff_eq_compl_inter, Set.inter_comm]
    rw [this,
      measure_diff (Set.inter_subset_left _ _) (ht1m.inter (h2 _ ht)) (measure_ne_top (κ a) _),
      measure_compl (h2 _ ht) (measure_ne_top (κ a) t), measure_univ,
      ENNReal.mul_sub (fun _ _ ↦ measure_ne_top (κ a) _), mul_one, ha]
  · intros f hf_disj hf_meas h
    rw [← ae_all_iff] at h
    filter_upwards [h] with a ha
    rw [Set.inter_iUnion, measure_iUnion]
    · rw [measure_iUnion hf_disj (fun i ↦ h2 _ (hf_meas i))]
      rw [← ENNReal.tsum_mul_left]
      congr with i
      rw [ha i]
    · intros i j hij
      rw [Function.onFun, Set.inter_comm t1, Set.inter_comm t1]
      

Proof state:
case h.hn
α : Type u_1
Ω : Type u_2
ι : Type u_3
_mα : MeasurableSpace α
m₂ m : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
inst✝ : IsMarkovKernel κ
p1 p2 : Set (Set Ω)
h2 : m₂ ≤ m
hp2 : IsPiSystem p2
hpm2 : m₂ = generateFrom p2
hyp : IndepSets p1 p2 κ
t1 t2 : Set Ω
ht1 : t1 ∈ p1
ht1m : MeasurableSet t1
ht2m : MeasurableSet t2
f : ℕ → Set Ω
hf_disj : Pairwise (Disjoint on f)
hf_meas : ∀ (i : ℕ), MeasurableSet (f i)
h : ∀ᵐ (a : α) ∂μ, ∀ (i : ℕ), ↑↑(κ a) (t1 ∩ f i) = ↑↑(κ a) t1 * ↑↑(κ a) (f i)
a : α
ha : ∀ (i : ℕ), ↑↑(κ a) (t1 ∩ f i) = ↑↑(κ a) t1 * ↑↑(κ a) (f i)
i j : ℕ
hij : i ≠ j
⊢ Disjoint (f i ∩ t1) (f j ∩ t1)

Next tactic:
exact Disjoint.inter_left _ (Disjoint.inter_right _ (hf_disj hij))
theorem IndepSets.indep_aux {m₂ m : MeasurableSpace Ω}
    {κ : kernel α Ω} {μ : Measure α} [IsMarkovKernel κ] {p1 p2 : Set (Set Ω)} (h2 : m₂ ≤ m)
    (hp2 : IsPiSystem p2) (hpm2 : m₂ = generateFrom p2) (hyp : IndepSets p1 p2 κ μ) {t1 t2 : Set Ω}
    (ht1 : t1 ∈ p1) (ht1m : MeasurableSet[m] t1) (ht2m : MeasurableSet[m₂] t2) :
    ∀ᵐ a ∂μ, κ a (t1 ∩ t2) = κ a t1 * κ a t2 := by
  refine @induction_on_inter _ (fun t ↦ ∀ᵐ a ∂μ, κ a (t1 ∩ t) = κ a t1 * κ a t) _
    m₂ hpm2 hp2 ?_ ?_ ?_ ?_ t2 ht2m
  · simp only [Set.inter_empty, measure_empty, mul_zero, eq_self_iff_true,
      Filter.eventually_true]
  · exact fun t ht_mem_p2 ↦ hyp t1 t ht1 ht_mem_p2
  · intros t ht h
    filter_upwards [h] with a ha
    have : t1 ∩ tᶜ = t1 \ (t1 ∩ t) := by
      rw [Set.diff_self_inter, Set.diff_eq_compl_inter, Set.inter_comm]
    rw [this,
      measure_diff (Set.inter_subset_left _ _) (ht1m.inter (h2 _ ht)) (measure_ne_top (κ a) _),
      measure_compl (h2 _ ht) (measure_ne_top (κ a) t), measure_univ,
      ENNReal.mul_sub (fun _ _ ↦ measure_ne_top (κ a) _), mul_one, ha]
  · intros f hf_disj hf_meas h
    rw [← ae_all_iff] at h
    filter_upwards [h] with a ha
    rw [Set.inter_iUnion, measure_iUnion]
    · rw [measure_iUnion hf_disj (fun i ↦ h2 _ (hf_meas i))]
      rw [← ENNReal.tsum_mul_left]
      congr with i
      rw [ha i]
    · intros i j hij
      rw [Function.onFun, Set.inter_comm t1, Set.inter_comm t1]
      exact Disjoint.inter_left _ (Disjoint.inter_right _ (hf_disj hij))
    · 

Proof state:
case h.h
α : Type u_1
Ω : Type u_2
ι : Type u_3
_mα : MeasurableSpace α
m₂ m : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
inst✝ : IsMarkovKernel κ
p1 p2 : Set (Set Ω)
h2 : m₂ ≤ m
hp2 : IsPiSystem p2
hpm2 : m₂ = generateFrom p2
hyp : IndepSets p1 p2 κ
t1 t2 : Set Ω
ht1 : t1 ∈ p1
ht1m : MeasurableSet t1
ht2m : MeasurableSet t2
f : ℕ → Set Ω
hf_disj : Pairwise (Disjoint on f)
hf_meas : ∀ (i : ℕ), MeasurableSet (f i)
h : ∀ᵐ (a : α) ∂μ, ∀ (i : ℕ), ↑↑(κ a) (t1 ∩ f i) = ↑↑(κ a) t1 * ↑↑(κ a) (f i)
a : α
ha : ∀ (i : ℕ), ↑↑(κ a) (t1 ∩ f i) = ↑↑(κ a) t1 * ↑↑(κ a) (f i)
⊢ ∀ (i : ℕ), MeasurableSet (t1 ∩ f i)

Next tactic:
exact fun i ↦ ht1m.inter (h2 _ (hf_meas i))
/-- The measurable space structures generated by independent pi-systems are independent. -/
theorem IndepSets.indep {m1 m2 m : MeasurableSpace Ω} {κ : kernel α Ω} {μ : Measure α}
    [IsMarkovKernel κ] {p1 p2 : Set (Set Ω)} (h1 : m1 ≤ m) (h2 : m2 ≤ m) (hp1 : IsPiSystem p1)
    (hp2 : IsPiSystem p2) (hpm1 : m1 = generateFrom p1) (hpm2 : m2 = generateFrom p2)
    (hyp : IndepSets p1 p2 κ μ) :
    Indep m1 m2 κ μ := by
  

Proof state:
α : Type u_1
Ω : Type u_2
ι : Type u_3
_mα : MeasurableSpace α
m1 m2 m : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
inst✝ : IsMarkovKernel κ
p1 p2 : Set (Set Ω)
h1 : m1 ≤ m
h2 : m2 ≤ m
hp1 : IsPiSystem p1
hp2 : IsPiSystem p2
hpm1 : m1 = generateFrom p1
hpm2 : m2 = generateFrom p2
hyp : IndepSets p1 p2 κ
⊢ Indep m1 m2 κ

Next tactic:
intros t1 t2 ht1 ht2