l3lab/ntp-mathlib huggingface dataset:
lemma iCondIndepSets_iff (π : ι → Set (Set Ω)) (hπ : ∀ i s (_hs : s ∈ π i), MeasurableSet s)
    (μ : Measure Ω) [IsFiniteMeasure μ] :
    iCondIndepSets m' hm' π μ ↔ ∀ (s : Finset ι) {f : ι → Set Ω} (_H : ∀ i, i ∈ s → f i ∈ π i),
      μ⟦⋂ i ∈ s, f i | m'⟧ =ᵐ[μ] ∏ i in s, (μ⟦f i | m'⟧) := by
  simp only [iCondIndepSets, kernel.iIndepSets]
  have h_eq' : ∀ (s : Finset ι) (f : ι → Set Ω) (_H : ∀ i, i ∈ s → f i ∈ π i) i (_hi : i ∈ s),
      (fun ω ↦ ENNReal.toReal (condexpKernel μ m' ω (f i))) =ᵐ[μ] μ⟦f i | m'⟧ :=
    fun s f H i hi ↦ condexpKernel_ae_eq_condexp hm' (hπ i (f i) (H i hi))
  have h_eq : ∀ (s : Finset ι) (f : ι → Set Ω) (_H : ∀ i, i ∈ s → f i ∈ π i), ∀ᵐ ω ∂μ,
      ∀ i ∈ s, ENNReal.toReal (condexpKernel μ m' ω (f i)) = (μ⟦f i | m'⟧) ω := by
    intros s f H
    simp_rw [← Finset.mem_coe]
    rw [ae_ball_iff (Finset.countable_toSet s)]
    exact h_eq' s f H
  have h_inter_eq : ∀ (s : Finset ι) (f : ι → Set Ω) (_H : ∀ i, i ∈ s → f i ∈ π i),
      (fun ω ↦ ENNReal.toReal (condexpKernel μ m' ω (⋂ i ∈ s, f i)))
        =ᵐ[μ] μ⟦⋂ i ∈ s, f i | m'⟧ := by
    refine fun s f H ↦ condexpKernel_ae_eq_condexp hm' ?_
    exact MeasurableSet.biInter (Finset.countable_toSet _) (fun i hi ↦ hπ i _ (H i hi))
  refine ⟨fun h s f hf ↦ ?_, fun h s f hf ↦ ?_⟩ <;> specialize h s hf
  · have h' := ae_eq_of_ae_eq_trim h
    filter_upwards [h_eq s f hf, h_inter_eq s f hf, h'] with ω h_eq h_inter_eq h'
    rw [← h_inter_eq, h', ENNReal.toReal_prod, Finset.prod_apply]
    exact Finset.prod_congr rfl h_eq
  · refine (ae_eq_trim_iff hm' ?_ ?_).mpr ?_
    · refine stronglyMeasurable_condexpKernel ?_
      exact MeasurableSet.biInter (Finset.countable_toSet _) (fun i hi ↦ hπ i _ (hf i hi))
    · refine Measurable.stronglyMeasurable ?_
      exact Finset.measurable_prod s (fun i hi ↦ measurable_condexpKernel (hπ i _ (hf i hi)))
    

Proof state:
case refine_2.refine_3
Ω : Type u_1
ι : Type u_2
m' mΩ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
hm' : m' ≤ mΩ
π : ι → Set (Set Ω)
hπ : ∀ (i : ι), ∀ s ∈ π i, MeasurableSet s
μ : Measure Ω
inst✝ : IsFiniteMeasure μ
h_eq' :
  ∀ (s : Finset ι) (f : ι → Set Ω),
    (∀ i ∈ s, f i ∈ π i) →
      ∀ i ∈ s, (fun ω => ENNReal.toReal (↑↑((condexpKernel μ m') ω) (f i))) =ᵐ[μ] μ[Set.indicator (f i) fun ω => 1|m']
h_eq :
  ∀ (s : Finset ι) (f : ι → Set Ω),
    (∀ i ∈ s, f i ∈ π i) →
      ∀ᵐ (ω : Ω) ∂μ,
        ∀ i ∈ s, ENNReal.toReal (↑↑((condexpKernel μ m') ω) (f i)) = (μ[Set.indicator (f i) fun ω => 1|m']) ω
h_inter_eq :
  ∀ (s : Finset ι) (f : ι → Set Ω),
    (∀ i ∈ s, f i ∈ π i) →
      (fun ω => ENNReal.toReal (↑↑((condexpKernel μ m') ω) (⋂ i ∈ s, f i))) =ᵐ[μ]
        μ[Set.indicator (⋂ i ∈ s, f i) fun ω => 1|m']
s : Finset ι
f : ι → Set Ω
hf : ∀ i ∈ s, f i ∈ π i
h : μ[Set.indicator (⋂ i ∈ s, f i) fun ω => 1|m'] =ᵐ[μ] ∏ i in s, μ[Set.indicator (f i) fun ω => 1|m']
⊢ (fun a => ↑↑((condexpKernel μ m') a) (⋂ i ∈ s, f i)) =ᵐ[μ] fun a => ∏ i in s, ↑↑((condexpKernel μ m') a) (f i)

Next tactic:
filter_upwards [h_eq s f hf, h_inter_eq s f hf, h] with ω h_eq h_inter_eq h
lemma condIndepSets_iff (s1 s2 : Set (Set Ω)) (hs1 : ∀ s ∈ s1, MeasurableSet s)
    (hs2 : ∀ s ∈ s2, MeasurableSet s) (μ : Measure Ω) [IsFiniteMeasure μ] :
    CondIndepSets m' hm' s1 s2 μ ↔ ∀ (t1 t2 : Set Ω) (_ : t1 ∈ s1) (_ : t2 ∈ s2),
      (μ⟦t1 ∩ t2 | m'⟧) =ᵐ[μ] (μ⟦t1 | m'⟧) * (μ⟦t2 | m'⟧) := by
  

Proof state:
Ω : Type u_1
ι : Type u_2
m' mΩ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
hm' : m' ≤ mΩ
s1 s2 : Set (Set Ω)
hs1 : ∀ s ∈ s1, MeasurableSet s
hs2 : ∀ s ∈ s2, MeasurableSet s
μ : Measure Ω
inst✝ : IsFiniteMeasure μ
⊢ CondIndepSets m' hm' s1 s2 ↔
    ∀ (t1 t2 : Set Ω),
      t1 ∈ s1 →
        t2 ∈ s2 →
          μ[Set.indicator (t1 ∩ t2) fun ω => 1|m'] =ᵐ[μ]
            μ[Set.indicator t1 fun ω => 1|m'] * μ[Set.indicator t2 fun ω => 1|m']

Next tactic:
simp only [CondIndepSets, kernel.IndepSets]
lemma condIndepSets_iff (s1 s2 : Set (Set Ω)) (hs1 : ∀ s ∈ s1, MeasurableSet s)
    (hs2 : ∀ s ∈ s2, MeasurableSet s) (μ : Measure Ω) [IsFiniteMeasure μ] :
    CondIndepSets m' hm' s1 s2 μ ↔ ∀ (t1 t2 : Set Ω) (_ : t1 ∈ s1) (_ : t2 ∈ s2),
      (μ⟦t1 ∩ t2 | m'⟧) =ᵐ[μ] (μ⟦t1 | m'⟧) * (μ⟦t2 | m'⟧) := by
  simp only [CondIndepSets, kernel.IndepSets]
  

Proof state:
Ω : Type u_1
ι : Type u_2
m' mΩ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
hm' : m' ≤ mΩ
s1 s2 : Set (Set Ω)
hs1 : ∀ s ∈ s1, MeasurableSet s
hs2 : ∀ s ∈ s2, MeasurableSet s
μ : Measure Ω
inst✝ : IsFiniteMeasure μ
⊢ (∀ (t1 t2 : Set Ω),
      t1 ∈ s1 →
        t2 ∈ s2 →
          ∀ᵐ (a : Ω) ∂Measure.trim μ hm',
            ↑↑((condexpKernel μ m') a) (t1 ∩ t2) = ↑↑((condexpKernel μ m') a) t1 * ↑↑((condexpKernel μ m') a) t2) ↔
    ∀ (t1 t2 : Set Ω),
      t1 ∈ s1 →
        t2 ∈ s2 →
          μ[Set.indicator (t1 ∩ t2) fun ω => 1|m'] =ᵐ[μ]
            μ[Set.indicator t1 fun ω => 1|m'] * μ[Set.indicator t2 fun ω => 1|m']

Next tactic:
have hs1_eq : ∀ s ∈ s1, (fun ω ↦ ENNReal.toReal (condexpKernel μ m' ω s)) =ᵐ[μ] μ⟦s | m'⟧ :=
    fun s hs ↦ condexpKernel_ae_eq_condexp hm' (hs1 s hs)
lemma condIndepSets_iff (s1 s2 : Set (Set Ω)) (hs1 : ∀ s ∈ s1, MeasurableSet s)
    (hs2 : ∀ s ∈ s2, MeasurableSet s) (μ : Measure Ω) [IsFiniteMeasure μ] :
    CondIndepSets m' hm' s1 s2 μ ↔ ∀ (t1 t2 : Set Ω) (_ : t1 ∈ s1) (_ : t2 ∈ s2),
      (μ⟦t1 ∩ t2 | m'⟧) =ᵐ[μ] (μ⟦t1 | m'⟧) * (μ⟦t2 | m'⟧) := by
  simp only [CondIndepSets, kernel.IndepSets]
  have hs1_eq : ∀ s ∈ s1, (fun ω ↦ ENNReal.toReal (condexpKernel μ m' ω s)) =ᵐ[μ] μ⟦s | m'⟧ :=
    fun s hs ↦ condexpKernel_ae_eq_condexp hm' (hs1 s hs)
  

Proof state:
Ω : Type u_1
ι : Type u_2
m' mΩ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
hm' : m' ≤ mΩ
s1 s2 : Set (Set Ω)
hs1 : ∀ s ∈ s1, MeasurableSet s
hs2 : ∀ s ∈ s2, MeasurableSet s
μ : Measure Ω
inst✝ : IsFiniteMeasure μ
hs1_eq : ∀ s ∈ s1, (fun ω => ENNReal.toReal (↑↑((condexpKernel μ m') ω) s)) =ᵐ[μ] μ[Set.indicator s fun ω => 1|m']
⊢ (∀ (t1 t2 : Set Ω),
      t1 ∈ s1 →
        t2 ∈ s2 →
          ∀ᵐ (a : Ω) ∂Measure.trim μ hm',
            ↑↑((condexpKernel μ m') a) (t1 ∩ t2) = ↑↑((condexpKernel μ m') a) t1 * ↑↑((condexpKernel μ m') a) t2) ↔
    ∀ (t1 t2 : Set Ω),
      t1 ∈ s1 →
        t2 ∈ s2 →
          μ[Set.indicator (t1 ∩ t2) fun ω => 1|m'] =ᵐ[μ]
            μ[Set.indicator t1 fun ω => 1|m'] * μ[Set.indicator t2 fun ω => 1|m']

Next tactic:
have hs2_eq : ∀ s ∈ s2, (fun ω ↦ ENNReal.toReal (condexpKernel μ m' ω s)) =ᵐ[μ] μ⟦s | m'⟧ :=
    fun s hs ↦ condexpKernel_ae_eq_condexp hm' (hs2 s hs)
lemma condIndepSets_iff (s1 s2 : Set (Set Ω)) (hs1 : ∀ s ∈ s1, MeasurableSet s)
    (hs2 : ∀ s ∈ s2, MeasurableSet s) (μ : Measure Ω) [IsFiniteMeasure μ] :
    CondIndepSets m' hm' s1 s2 μ ↔ ∀ (t1 t2 : Set Ω) (_ : t1 ∈ s1) (_ : t2 ∈ s2),
      (μ⟦t1 ∩ t2 | m'⟧) =ᵐ[μ] (μ⟦t1 | m'⟧) * (μ⟦t2 | m'⟧) := by
  simp only [CondIndepSets, kernel.IndepSets]
  have hs1_eq : ∀ s ∈ s1, (fun ω ↦ ENNReal.toReal (condexpKernel μ m' ω s)) =ᵐ[μ] μ⟦s | m'⟧ :=
    fun s hs ↦ condexpKernel_ae_eq_condexp hm' (hs1 s hs)
  have hs2_eq : ∀ s ∈ s2, (fun ω ↦ ENNReal.toReal (condexpKernel μ m' ω s)) =ᵐ[μ] μ⟦s | m'⟧ :=
    fun s hs ↦ condexpKernel_ae_eq_condexp hm' (hs2 s hs)
  

Proof state:
Ω : Type u_1
ι : Type u_2
m' mΩ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
hm' : m' ≤ mΩ
s1 s2 : Set (Set Ω)
hs1 : ∀ s ∈ s1, MeasurableSet s
hs2 : ∀ s ∈ s2, MeasurableSet s
μ : Measure Ω
inst✝ : IsFiniteMeasure μ
hs1_eq : ∀ s ∈ s1, (fun ω => ENNReal.toReal (↑↑((condexpKernel μ m') ω) s)) =ᵐ[μ] μ[Set.indicator s fun ω => 1|m']
hs2_eq : ∀ s ∈ s2, (fun ω => ENNReal.toReal (↑↑((condexpKernel μ m') ω) s)) =ᵐ[μ] μ[Set.indicator s fun ω => 1|m']
⊢ (∀ (t1 t2 : Set Ω),
      t1 ∈ s1 →
        t2 ∈ s2 →
          ∀ᵐ (a : Ω) ∂Measure.trim μ hm',
            ↑↑((condexpKernel μ m') a) (t1 ∩ t2) = ↑↑((condexpKernel μ m') a) t1 * ↑↑((condexpKernel μ m') a) t2) ↔
    ∀ (t1 t2 : Set Ω),
      t1 ∈ s1 →
        t2 ∈ s2 →
          μ[Set.indicator (t1 ∩ t2) fun ω => 1|m'] =ᵐ[μ]
            μ[Set.indicator t1 fun ω => 1|m'] * μ[Set.indicator t2 fun ω => 1|m']

Next tactic:
have hs12_eq : ∀ s ∈ s1, ∀ t ∈ s2, (fun ω ↦ ENNReal.toReal (condexpKernel μ m' ω (s ∩ t)))
      =ᵐ[μ] μ⟦s ∩ t | m'⟧ :=
    fun s hs t ht ↦ condexpKernel_ae_eq_condexp hm' ((hs1 s hs).inter ((hs2 t ht)))
lemma condIndepSets_iff (s1 s2 : Set (Set Ω)) (hs1 : ∀ s ∈ s1, MeasurableSet s)
    (hs2 : ∀ s ∈ s2, MeasurableSet s) (μ : Measure Ω) [IsFiniteMeasure μ] :
    CondIndepSets m' hm' s1 s2 μ ↔ ∀ (t1 t2 : Set Ω) (_ : t1 ∈ s1) (_ : t2 ∈ s2),
      (μ⟦t1 ∩ t2 | m'⟧) =ᵐ[μ] (μ⟦t1 | m'⟧) * (μ⟦t2 | m'⟧) := by
  simp only [CondIndepSets, kernel.IndepSets]
  have hs1_eq : ∀ s ∈ s1, (fun ω ↦ ENNReal.toReal (condexpKernel μ m' ω s)) =ᵐ[μ] μ⟦s | m'⟧ :=
    fun s hs ↦ condexpKernel_ae_eq_condexp hm' (hs1 s hs)
  have hs2_eq : ∀ s ∈ s2, (fun ω ↦ ENNReal.toReal (condexpKernel μ m' ω s)) =ᵐ[μ] μ⟦s | m'⟧ :=
    fun s hs ↦ condexpKernel_ae_eq_condexp hm' (hs2 s hs)
  have hs12_eq : ∀ s ∈ s1, ∀ t ∈ s2, (fun ω ↦ ENNReal.toReal (condexpKernel μ m' ω (s ∩ t)))
      =ᵐ[μ] μ⟦s ∩ t | m'⟧ :=
    fun s hs t ht ↦ condexpKernel_ae_eq_condexp hm' ((hs1 s hs).inter ((hs2 t ht)))
  

Proof state:
Ω : Type u_1
ι : Type u_2
m' mΩ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
hm' : m' ≤ mΩ
s1 s2 : Set (Set Ω)
hs1 : ∀ s ∈ s1, MeasurableSet s
hs2 : ∀ s ∈ s2, MeasurableSet s
μ : Measure Ω
inst✝ : IsFiniteMeasure μ
hs1_eq : ∀ s ∈ s1, (fun ω => ENNReal.toReal (↑↑((condexpKernel μ m') ω) s)) =ᵐ[μ] μ[Set.indicator s fun ω => 1|m']
hs2_eq : ∀ s ∈ s2, (fun ω => ENNReal.toReal (↑↑((condexpKernel μ m') ω) s)) =ᵐ[μ] μ[Set.indicator s fun ω => 1|m']
hs12_eq :
  ∀ s ∈ s1,
    ∀ t ∈ s2,
      (fun ω => ENNReal.toReal (↑↑((condexpKernel μ m') ω) (s ∩ t))) =ᵐ[μ] μ[Set.indicator (s ∩ t) fun ω => 1|m']
⊢ (∀ (t1 t2 : Set Ω),
      t1 ∈ s1 →
        t2 ∈ s2 →
          ∀ᵐ (a : Ω) ∂Measure.trim μ hm',
            ↑↑((condexpKernel μ m') a) (t1 ∩ t2) = ↑↑((condexpKernel μ m') a) t1 * ↑↑((condexpKernel μ m') a) t2) ↔
    ∀ (t1 t2 : Set Ω),
      t1 ∈ s1 →
        t2 ∈ s2 →
          μ[Set.indicator (t1 ∩ t2) fun ω => 1|m'] =ᵐ[μ]
            μ[Set.indicator t1 fun ω => 1|m'] * μ[Set.indicator t2 fun ω => 1|m']

Next tactic:
refine ⟨fun h s t hs ht ↦ ?_, fun h s t hs ht ↦ ?_⟩
lemma condIndepSets_iff (s1 s2 : Set (Set Ω)) (hs1 : ∀ s ∈ s1, MeasurableSet s)
    (hs2 : ∀ s ∈ s2, MeasurableSet s) (μ : Measure Ω) [IsFiniteMeasure μ] :
    CondIndepSets m' hm' s1 s2 μ ↔ ∀ (t1 t2 : Set Ω) (_ : t1 ∈ s1) (_ : t2 ∈ s2),
      (μ⟦t1 ∩ t2 | m'⟧) =ᵐ[μ] (μ⟦t1 | m'⟧) * (μ⟦t2 | m'⟧) := by
  simp only [CondIndepSets, kernel.IndepSets]
  have hs1_eq : ∀ s ∈ s1, (fun ω ↦ ENNReal.toReal (condexpKernel μ m' ω s)) =ᵐ[μ] μ⟦s | m'⟧ :=
    fun s hs ↦ condexpKernel_ae_eq_condexp hm' (hs1 s hs)
  have hs2_eq : ∀ s ∈ s2, (fun ω ↦ ENNReal.toReal (condexpKernel μ m' ω s)) =ᵐ[μ] μ⟦s | m'⟧ :=
    fun s hs ↦ condexpKernel_ae_eq_condexp hm' (hs2 s hs)
  have hs12_eq : ∀ s ∈ s1, ∀ t ∈ s2, (fun ω ↦ ENNReal.toReal (condexpKernel μ m' ω (s ∩ t)))
      =ᵐ[μ] μ⟦s ∩ t | m'⟧ :=
    fun s hs t ht ↦ condexpKernel_ae_eq_condexp hm' ((hs1 s hs).inter ((hs2 t ht)))
  refine ⟨fun h s t hs ht ↦ ?_, fun h s t hs ht ↦ ?_⟩ <;> 

Proof state:
case refine_1
Ω : Type u_1
ι : Type u_2
m' mΩ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
hm' : m' ≤ mΩ
s1 s2 : Set (Set Ω)
hs1 : ∀ s ∈ s1, MeasurableSet s
hs2 : ∀ s ∈ s2, MeasurableSet s
μ : Measure Ω
inst✝ : IsFiniteMeasure μ
hs1_eq : ∀ s ∈ s1, (fun ω => ENNReal.toReal (↑↑((condexpKernel μ m') ω) s)) =ᵐ[μ] μ[Set.indicator s fun ω => 1|m']
hs2_eq : ∀ s ∈ s2, (fun ω => ENNReal.toReal (↑↑((condexpKernel μ m') ω) s)) =ᵐ[μ] μ[Set.indicator s fun ω => 1|m']
hs12_eq :
  ∀ s ∈ s1,
    ∀ t ∈ s2,
      (fun ω => ENNReal.toReal (↑↑((condexpKernel μ m') ω) (s ∩ t))) =ᵐ[μ] μ[Set.indicator (s ∩ t) fun ω => 1|m']
h :
  ∀ (t1 t2 : Set Ω),
    t1 ∈ s1 →
      t2 ∈ s2 →
        ∀ᵐ (a : Ω) ∂Measure.trim μ hm',
          ↑↑((condexpKernel μ m') a) (t1 ∩ t2) = ↑↑((condexpKernel μ m') a) t1 * ↑↑((condexpKernel μ m') a) t2
s t : Set Ω
hs : s ∈ s1
ht : t ∈ s2
⊢ μ[Set.indicator (s ∩ t) fun ω => 1|m'] =ᵐ[μ] μ[Set.indicator s fun ω => 1|m'] * μ[Set.indicator t fun ω => 1|m']

Next tactic:
specialize h s t hs ht
lemma condIndepSets_iff (s1 s2 : Set (Set Ω)) (hs1 : ∀ s ∈ s1, MeasurableSet s)
    (hs2 : ∀ s ∈ s2, MeasurableSet s) (μ : Measure Ω) [IsFiniteMeasure μ] :
    CondIndepSets m' hm' s1 s2 μ ↔ ∀ (t1 t2 : Set Ω) (_ : t1 ∈ s1) (_ : t2 ∈ s2),
      (μ⟦t1 ∩ t2 | m'⟧) =ᵐ[μ] (μ⟦t1 | m'⟧) * (μ⟦t2 | m'⟧) := by
  simp only [CondIndepSets, kernel.IndepSets]
  have hs1_eq : ∀ s ∈ s1, (fun ω ↦ ENNReal.toReal (condexpKernel μ m' ω s)) =ᵐ[μ] μ⟦s | m'⟧ :=
    fun s hs ↦ condexpKernel_ae_eq_condexp hm' (hs1 s hs)
  have hs2_eq : ∀ s ∈ s2, (fun ω ↦ ENNReal.toReal (condexpKernel μ m' ω s)) =ᵐ[μ] μ⟦s | m'⟧ :=
    fun s hs ↦ condexpKernel_ae_eq_condexp hm' (hs2 s hs)
  have hs12_eq : ∀ s ∈ s1, ∀ t ∈ s2, (fun ω ↦ ENNReal.toReal (condexpKernel μ m' ω (s ∩ t)))
      =ᵐ[μ] μ⟦s ∩ t | m'⟧ :=
    fun s hs t ht ↦ condexpKernel_ae_eq_condexp hm' ((hs1 s hs).inter ((hs2 t ht)))
  refine ⟨fun h s t hs ht ↦ ?_, fun h s t hs ht ↦ ?_⟩ <;> 

Proof state:
case refine_2
Ω : Type u_1
ι : Type u_2
m' mΩ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
hm' : m' ≤ mΩ
s1 s2 : Set (Set Ω)
hs1 : ∀ s ∈ s1, MeasurableSet s
hs2 : ∀ s ∈ s2, MeasurableSet s
μ : Measure Ω
inst✝ : IsFiniteMeasure μ
hs1_eq : ∀ s ∈ s1, (fun ω => ENNReal.toReal (↑↑((condexpKernel μ m') ω) s)) =ᵐ[μ] μ[Set.indicator s fun ω => 1|m']
hs2_eq : ∀ s ∈ s2, (fun ω => ENNReal.toReal (↑↑((condexpKernel μ m') ω) s)) =ᵐ[μ] μ[Set.indicator s fun ω => 1|m']
hs12_eq :
  ∀ s ∈ s1,
    ∀ t ∈ s2,
      (fun ω => ENNReal.toReal (↑↑((condexpKernel μ m') ω) (s ∩ t))) =ᵐ[μ] μ[Set.indicator (s ∩ t) fun ω => 1|m']
h :
  ∀ (t1 t2 : Set Ω),
    t1 ∈ s1 →
      t2 ∈ s2 →
        μ[Set.indicator (t1 ∩ t2) fun ω => 1|m'] =ᵐ[μ]
          μ[Set.indicator t1 fun ω => 1|m'] * μ[Set.indicator t2 fun ω => 1|m']
s t : Set Ω
hs : s ∈ s1
ht : t ∈ s2
⊢ ∀ᵐ (a : Ω) ∂Measure.trim μ hm',
    ↑↑((condexpKernel μ m') a) (s ∩ t) = ↑↑((condexpKernel μ m') a) s * ↑↑((condexpKernel μ m') a) t

Next tactic:
specialize h s t hs ht
lemma condIndepSets_iff (s1 s2 : Set (Set Ω)) (hs1 : ∀ s ∈ s1, MeasurableSet s)
    (hs2 : ∀ s ∈ s2, MeasurableSet s) (μ : Measure Ω) [IsFiniteMeasure μ] :
    CondIndepSets m' hm' s1 s2 μ ↔ ∀ (t1 t2 : Set Ω) (_ : t1 ∈ s1) (_ : t2 ∈ s2),
      (μ⟦t1 ∩ t2 | m'⟧) =ᵐ[μ] (μ⟦t1 | m'⟧) * (μ⟦t2 | m'⟧) := by
  simp only [CondIndepSets, kernel.IndepSets]
  have hs1_eq : ∀ s ∈ s1, (fun ω ↦ ENNReal.toReal (condexpKernel μ m' ω s)) =ᵐ[μ] μ⟦s | m'⟧ :=
    fun s hs ↦ condexpKernel_ae_eq_condexp hm' (hs1 s hs)
  have hs2_eq : ∀ s ∈ s2, (fun ω ↦ ENNReal.toReal (condexpKernel μ m' ω s)) =ᵐ[μ] μ⟦s | m'⟧ :=
    fun s hs ↦ condexpKernel_ae_eq_condexp hm' (hs2 s hs)
  have hs12_eq : ∀ s ∈ s1, ∀ t ∈ s2, (fun ω ↦ ENNReal.toReal (condexpKernel μ m' ω (s ∩ t)))
      =ᵐ[μ] μ⟦s ∩ t | m'⟧ :=
    fun s hs t ht ↦ condexpKernel_ae_eq_condexp hm' ((hs1 s hs).inter ((hs2 t ht)))
  refine ⟨fun h s t hs ht ↦ ?_, fun h s t hs ht ↦ ?_⟩ <;> specialize h s t hs ht
  · 

Proof state:
case refine_1
Ω : Type u_1
ι : Type u_2
m' mΩ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
hm' : m' ≤ mΩ
s1 s2 : Set (Set Ω)
hs1 : ∀ s ∈ s1, MeasurableSet s
hs2 : ∀ s ∈ s2, MeasurableSet s
μ : Measure Ω
inst✝ : IsFiniteMeasure μ
hs1_eq : ∀ s ∈ s1, (fun ω => ENNReal.toReal (↑↑((condexpKernel μ m') ω) s)) =ᵐ[μ] μ[Set.indicator s fun ω => 1|m']
hs2_eq : ∀ s ∈ s2, (fun ω => ENNReal.toReal (↑↑((condexpKernel μ m') ω) s)) =ᵐ[μ] μ[Set.indicator s fun ω => 1|m']
hs12_eq :
  ∀ s ∈ s1,
    ∀ t ∈ s2,
      (fun ω => ENNReal.toReal (↑↑((condexpKernel μ m') ω) (s ∩ t))) =ᵐ[μ] μ[Set.indicator (s ∩ t) fun ω => 1|m']
s t : Set Ω
hs : s ∈ s1
ht : t ∈ s2
h :
  ∀ᵐ (a : Ω) ∂Measure.trim μ hm',
    ↑↑((condexpKernel μ m') a) (s ∩ t) = ↑↑((condexpKernel μ m') a) s * ↑↑((condexpKernel μ m') a) t
⊢ μ[Set.indicator (s ∩ t) fun ω => 1|m'] =ᵐ[μ] μ[Set.indicator s fun ω => 1|m'] * μ[Set.indicator t fun ω => 1|m']

Next tactic:
have h' := ae_eq_of_ae_eq_trim h
lemma condIndepSets_iff (s1 s2 : Set (Set Ω)) (hs1 : ∀ s ∈ s1, MeasurableSet s)
    (hs2 : ∀ s ∈ s2, MeasurableSet s) (μ : Measure Ω) [IsFiniteMeasure μ] :
    CondIndepSets m' hm' s1 s2 μ ↔ ∀ (t1 t2 : Set Ω) (_ : t1 ∈ s1) (_ : t2 ∈ s2),
      (μ⟦t1 ∩ t2 | m'⟧) =ᵐ[μ] (μ⟦t1 | m'⟧) * (μ⟦t2 | m'⟧) := by
  simp only [CondIndepSets, kernel.IndepSets]
  have hs1_eq : ∀ s ∈ s1, (fun ω ↦ ENNReal.toReal (condexpKernel μ m' ω s)) =ᵐ[μ] μ⟦s | m'⟧ :=
    fun s hs ↦ condexpKernel_ae_eq_condexp hm' (hs1 s hs)
  have hs2_eq : ∀ s ∈ s2, (fun ω ↦ ENNReal.toReal (condexpKernel μ m' ω s)) =ᵐ[μ] μ⟦s | m'⟧ :=
    fun s hs ↦ condexpKernel_ae_eq_condexp hm' (hs2 s hs)
  have hs12_eq : ∀ s ∈ s1, ∀ t ∈ s2, (fun ω ↦ ENNReal.toReal (condexpKernel μ m' ω (s ∩ t)))
      =ᵐ[μ] μ⟦s ∩ t | m'⟧ :=
    fun s hs t ht ↦ condexpKernel_ae_eq_condexp hm' ((hs1 s hs).inter ((hs2 t ht)))
  refine ⟨fun h s t hs ht ↦ ?_, fun h s t hs ht ↦ ?_⟩ <;> specialize h s t hs ht
  · have h' := ae_eq_of_ae_eq_trim h
    

Proof state:
case refine_1
Ω : Type u_1
ι : Type u_2
m' mΩ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
hm' : m' ≤ mΩ
s1 s2 : Set (Set Ω)
hs1 : ∀ s ∈ s1, MeasurableSet s
hs2 : ∀ s ∈ s2, MeasurableSet s
μ : Measure Ω
inst✝ : IsFiniteMeasure μ
hs1_eq : ∀ s ∈ s1, (fun ω => ENNReal.toReal (↑↑((condexpKernel μ m') ω) s)) =ᵐ[μ] μ[Set.indicator s fun ω => 1|m']
hs2_eq : ∀ s ∈ s2, (fun ω => ENNReal.toReal (↑↑((condexpKernel μ m') ω) s)) =ᵐ[μ] μ[Set.indicator s fun ω => 1|m']
hs12_eq :
  ∀ s ∈ s1,
    ∀ t ∈ s2,
      (fun ω => ENNReal.toReal (↑↑((condexpKernel μ m') ω) (s ∩ t))) =ᵐ[μ] μ[Set.indicator (s ∩ t) fun ω => 1|m']
s t : Set Ω
hs : s ∈ s1
ht : t ∈ s2
h :
  ∀ᵐ (a : Ω) ∂Measure.trim μ hm',
    ↑↑((condexpKernel μ m') a) (s ∩ t) = ↑↑((condexpKernel μ m') a) s * ↑↑((condexpKernel μ m') a) t
h' :
  (fun x => ↑↑((condexpKernel μ m') x) (s ∩ t)) =ᵐ[μ] fun x =>
    ↑↑((condexpKernel μ m') x) s * ↑↑((condexpKernel μ m') x) t
⊢ μ[Set.indicator (s ∩ t) fun ω => 1|m'] =ᵐ[μ] μ[Set.indicator s fun ω => 1|m'] * μ[Set.indicator t fun ω => 1|m']

Next tactic:
filter_upwards [hs1_eq s hs, hs2_eq t ht, hs12_eq s hs t ht, h'] with ω hs_eq ht_eq hst_eq h'
lemma condIndepSets_iff (s1 s2 : Set (Set Ω)) (hs1 : ∀ s ∈ s1, MeasurableSet s)
    (hs2 : ∀ s ∈ s2, MeasurableSet s) (μ : Measure Ω) [IsFiniteMeasure μ] :
    CondIndepSets m' hm' s1 s2 μ ↔ ∀ (t1 t2 : Set Ω) (_ : t1 ∈ s1) (_ : t2 ∈ s2),
      (μ⟦t1 ∩ t2 | m'⟧) =ᵐ[μ] (μ⟦t1 | m'⟧) * (μ⟦t2 | m'⟧) := by
  simp only [CondIndepSets, kernel.IndepSets]
  have hs1_eq : ∀ s ∈ s1, (fun ω ↦ ENNReal.toReal (condexpKernel μ m' ω s)) =ᵐ[μ] μ⟦s | m'⟧ :=
    fun s hs ↦ condexpKernel_ae_eq_condexp hm' (hs1 s hs)
  have hs2_eq : ∀ s ∈ s2, (fun ω ↦ ENNReal.toReal (condexpKernel μ m' ω s)) =ᵐ[μ] μ⟦s | m'⟧ :=
    fun s hs ↦ condexpKernel_ae_eq_condexp hm' (hs2 s hs)
  have hs12_eq : ∀ s ∈ s1, ∀ t ∈ s2, (fun ω ↦ ENNReal.toReal (condexpKernel μ m' ω (s ∩ t)))
      =ᵐ[μ] μ⟦s ∩ t | m'⟧ :=
    fun s hs t ht ↦ condexpKernel_ae_eq_condexp hm' ((hs1 s hs).inter ((hs2 t ht)))
  refine ⟨fun h s t hs ht ↦ ?_, fun h s t hs ht ↦ ?_⟩ <;> specialize h s t hs ht
  · have h' := ae_eq_of_ae_eq_trim h
    filter_upwards [hs1_eq s hs, hs2_eq t ht, hs12_eq s hs t ht, h'] with ω hs_eq ht_eq hst_eq h'
    

Proof state:
case h
Ω : Type u_1
ι : Type u_2
m' mΩ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
hm' : m' ≤ mΩ
s1 s2 : Set (Set Ω)
hs1 : ∀ s ∈ s1, MeasurableSet s
hs2 : ∀ s ∈ s2, MeasurableSet s
μ : Measure Ω
inst✝ : IsFiniteMeasure μ
hs1_eq : ∀ s ∈ s1, (fun ω => ENNReal.toReal (↑↑((condexpKernel μ m') ω) s)) =ᵐ[μ] μ[Set.indicator s fun ω => 1|m']
hs2_eq : ∀ s ∈ s2, (fun ω => ENNReal.toReal (↑↑((condexpKernel μ m') ω) s)) =ᵐ[μ] μ[Set.indicator s fun ω => 1|m']
hs12_eq :
  ∀ s ∈ s1,
    ∀ t ∈ s2,
      (fun ω => ENNReal.toReal (↑↑((condexpKernel μ m') ω) (s ∩ t))) =ᵐ[μ] μ[Set.indicator (s ∩ t) fun ω => 1|m']
s t : Set Ω
hs : s ∈ s1
ht : t ∈ s2
h :
  ∀ᵐ (a : Ω) ∂Measure.trim μ hm',
    ↑↑((condexpKernel μ m') a) (s ∩ t) = ↑↑((condexpKernel μ m') a) s * ↑↑((condexpKernel μ m') a) t
h'✝ :
  (fun x => ↑↑((condexpKernel μ m') x) (s ∩ t)) =ᵐ[μ] fun x =>
    ↑↑((condexpKernel μ m') x) s * ↑↑((condexpKernel μ m') x) t
ω : Ω
hs_eq : ENNReal.toReal (↑↑((condexpKernel μ m') ω) s) = (μ[Set.indicator s fun ω => 1|m']) ω
ht_eq : ENNReal.toReal (↑↑((condexpKernel μ m') ω) t) = (μ[Set.indicator t fun ω => 1|m']) ω
hst_eq : ENNReal.toReal (↑↑((condexpKernel μ m') ω) (s ∩ t)) = (μ[Set.indicator (s ∩ t) fun ω => 1|m']) ω
h' : ↑↑((condexpKernel μ m') ω) (s ∩ t) = ↑↑((condexpKernel μ m') ω) s * ↑↑((condexpKernel μ m') ω) t
⊢ (μ[Set.indicator (s ∩ t) fun ω => 1|m']) ω = (μ[Set.indicator s fun ω => 1|m'] * μ[Set.indicator t fun ω => 1|m']) ω

Next tactic:
rw [← hst_eq, Pi.mul_apply, ← hs_eq, ← ht_eq, h', ENNReal.toReal_mul]
lemma condIndepSets_iff (s1 s2 : Set (Set Ω)) (hs1 : ∀ s ∈ s1, MeasurableSet s)
    (hs2 : ∀ s ∈ s2, MeasurableSet s) (μ : Measure Ω) [IsFiniteMeasure μ] :
    CondIndepSets m' hm' s1 s2 μ ↔ ∀ (t1 t2 : Set Ω) (_ : t1 ∈ s1) (_ : t2 ∈ s2),
      (μ⟦t1 ∩ t2 | m'⟧) =ᵐ[μ] (μ⟦t1 | m'⟧) * (μ⟦t2 | m'⟧) := by
  simp only [CondIndepSets, kernel.IndepSets]
  have hs1_eq : ∀ s ∈ s1, (fun ω ↦ ENNReal.toReal (condexpKernel μ m' ω s)) =ᵐ[μ] μ⟦s | m'⟧ :=
    fun s hs ↦ condexpKernel_ae_eq_condexp hm' (hs1 s hs)
  have hs2_eq : ∀ s ∈ s2, (fun ω ↦ ENNReal.toReal (condexpKernel μ m' ω s)) =ᵐ[μ] μ⟦s | m'⟧ :=
    fun s hs ↦ condexpKernel_ae_eq_condexp hm' (hs2 s hs)
  have hs12_eq : ∀ s ∈ s1, ∀ t ∈ s2, (fun ω ↦ ENNReal.toReal (condexpKernel μ m' ω (s ∩ t)))
      =ᵐ[μ] μ⟦s ∩ t | m'⟧ :=
    fun s hs t ht ↦ condexpKernel_ae_eq_condexp hm' ((hs1 s hs).inter ((hs2 t ht)))
  refine ⟨fun h s t hs ht ↦ ?_, fun h s t hs ht ↦ ?_⟩ <;> specialize h s t hs ht
  · have h' := ae_eq_of_ae_eq_trim h
    filter_upwards [hs1_eq s hs, hs2_eq t ht, hs12_eq s hs t ht, h'] with ω hs_eq ht_eq hst_eq h'
    rw [← hst_eq, Pi.mul_apply, ← hs_eq, ← ht_eq, h', ENNReal.toReal_mul]
  · 

Proof state:
case refine_2
Ω : Type u_1
ι : Type u_2
m' mΩ : MeasurableSpace Ω
inst✝² : StandardBorelSpace Ω
inst✝¹ : Nonempty Ω
hm' : m' ≤ mΩ
s1 s2 : Set (Set Ω)
hs1 : ∀ s ∈ s1, MeasurableSet s
hs2 : ∀ s ∈ s2, MeasurableSet s
μ : Measure Ω
inst✝ : IsFiniteMeasure μ
hs1_eq : ∀ s ∈ s1, (fun ω => ENNReal.toReal (↑↑((condexpKernel μ m') ω) s)) =ᵐ[μ] μ[Set.indicator s fun ω => 1|m']
hs2_eq : ∀ s ∈ s2, (fun ω => ENNReal.toReal (↑↑((condexpKernel μ m') ω) s)) =ᵐ[μ] μ[Set.indicator s fun ω => 1|m']
hs12_eq :
  ∀ s ∈ s1,
    ∀ t ∈ s2,
      (fun ω => ENNReal.toReal (↑↑((condexpKernel μ m') ω) (s ∩ t))) =ᵐ[μ] μ[Set.indicator (s ∩ t) fun ω => 1|m']
s t : Set Ω
hs : s ∈ s1
ht : t ∈ s2
h : μ[Set.indicator (s ∩ t) fun ω => 1|m'] =ᵐ[μ] μ[Set.indicator s fun ω => 1|m'] * μ[Set.indicator t fun ω => 1|m']
⊢ ∀ᵐ (a : Ω) ∂Measure.trim μ hm',
    ↑↑((condexpKernel μ m') a) (s ∩ t) = ↑↑((condexpKernel μ m') a) s * ↑↑((condexpKernel μ m') a) t

Next tactic:
refine (ae_eq_trim_iff hm' ?_ ?_).mpr ?_