l3lab/ntp-mathlib huggingface dataset:
lemma IndepFun_iff_Indep [MeasurableSpace Ω] [mβ : MeasurableSpace β]
    [mγ : MeasurableSpace γ] (f : Ω → β) (g : Ω → γ) (μ : Measure Ω) :
    IndepFun f g μ ↔ Indep (MeasurableSpace.comap f mβ) (MeasurableSpace.comap g mγ) μ := by
  

Proof state:
Ω : Type u_1
ι : Type u_2
β : Type u_3
γ : Type u_4
κ : ι → Type u_5
π : ι → Set (Set Ω)
m : ι → MeasurableSpace Ω
x✝ : MeasurableSpace Ω
μ✝ : Measure Ω
S : Finset ι
s : ι → Set Ω
inst✝ : MeasurableSpace Ω
mβ : MeasurableSpace β
mγ : MeasurableSpace γ
f : Ω → β
g : Ω → γ
μ : Measure Ω
⊢ IndepFun f g ↔ Indep (MeasurableSpace.comap f mβ) (MeasurableSpace.comap g mγ)

Next tactic:
simp only [IndepFun, Indep, kernel.IndepFun]
lemma IndepFun_iff {β γ} [MeasurableSpace Ω] [mβ : MeasurableSpace β] [mγ : MeasurableSpace γ]
    (f : Ω → β) (g : Ω → γ) (μ : Measure Ω) :
    IndepFun f g μ ↔ ∀ t1 t2, MeasurableSet[MeasurableSpace.comap f mβ] t1
      → MeasurableSet[MeasurableSpace.comap g mγ] t2 → μ (t1 ∩ t2) = μ t1 * μ t2 := by
  

Proof state:
Ω : Type u_1
ι : Type u_2
β✝ : Type u_3
γ✝ : Type u_4
κ : ι → Type u_5
π : ι → Set (Set Ω)
m : ι → MeasurableSpace Ω
x✝ : MeasurableSpace Ω
μ✝ : Measure Ω
S : Finset ι
s : ι → Set Ω
β : Type u_6
γ : Type u_7
inst✝ : MeasurableSpace Ω
mβ : MeasurableSpace β
mγ : MeasurableSpace γ
f : Ω → β
g : Ω → γ
μ : Measure Ω
⊢ IndepFun f g ↔ ∀ (t1 t2 : Set Ω), MeasurableSet t1 → MeasurableSet t2 → ↑↑μ (t1 ∩ t2) = ↑↑μ t1 * ↑↑μ t2

Next tactic:
rw [IndepFun_iff_Indep, Indep_iff]
theorem indepSets_singleton_iff [MeasurableSpace Ω] {s t : Set Ω} {μ : Measure Ω} :
    IndepSets {s} {t} μ ↔ μ (s ∩ t) = μ s * μ t := by
  

Proof state:
Ω : Type u_1
ι : Type u_2
β : Type u_3
γ : Type u_4
κ : ι → Type u_5
inst✝ : MeasurableSpace Ω
s t : Set Ω
μ : Measure Ω
⊢ IndepSets {s} {t} ↔ ↑↑μ (s ∩ t) = ↑↑μ s * ↑↑μ t

Next tactic:
simp only [IndepSets, kernel.indepSets_singleton_iff, ae_dirac_eq, Filter.eventually_pure,
    kernel.const_apply]
theorem iIndepSets_singleton_iff {s : ι → Set Ω} :
    iIndepSets (fun i ↦ {s i}) μ ↔ ∀ t, μ (⋂ i ∈ t, s i) = ∏ i in t, μ (s i) := by
  

Proof state:
Ω : Type u_1
ι : Type u_2
β : Type u_3
γ : Type u_4
κ : ι → Type u_5
x✝ : MeasurableSpace Ω
μ : Measure Ω
s✝ t : Set Ω
S T : Set (Set Ω)
s : ι → Set Ω
⊢ (iIndepSets fun i => {s i}) ↔ ∀ (t : Finset ι), ↑↑μ (⋂ i ∈ t, s i) = ∏ i in t, ↑↑μ (s i)

Next tactic:
simp_rw [iIndepSets, kernel.iIndepSets_singleton_iff, ae_dirac_eq, Filter.eventually_pure,
    kernel.const_apply]
theorem iIndepSet_iff_meas_biInter {f : ι → Set Ω} (hf : ∀ i, MeasurableSet (f i)) :
    iIndepSet f μ ↔ ∀ s, μ (⋂ i ∈ s, f i) = ∏ i in s, μ (f i) := by
  

Proof state:
Ω : Type u_1
ι : Type u_2
β : Type u_3
γ : Type u_4
κ : ι → Type u_5
x✝ : MeasurableSpace Ω
μ : Measure Ω
s t : Set Ω
S T : Set (Set Ω)
inst✝ : IsProbabilityMeasure μ
f : ι → Set Ω
hf : ∀ (i : ι), MeasurableSet (f i)
⊢ iIndepSet f ↔ ∀ (s : Finset ι), ↑↑μ (⋂ i ∈ s, f i) = ∏ i in s, ↑↑μ (f i)

Next tactic:
simp_rw [iIndepSet, kernel.iIndepSet_iff_meas_biInter hf, ae_dirac_eq, Filter.eventually_pure,
    kernel.const_apply]
theorem indepFun_iff_measure_inter_preimage_eq_mul {mβ : MeasurableSpace β}
    {mβ' : MeasurableSpace β'} :
    IndepFun f g μ ↔
      ∀ s t, MeasurableSet s → MeasurableSet t
        → μ (f ⁻¹' s ∩ g ⁻¹' t) = μ (f ⁻¹' s) * μ (g ⁻¹' t) := by
  

Proof state:
Ω : Type u_1
ι : Type u_2
β✝ : Type u_3
γ✝ : Type u_4
κ : ι → Type u_5
β : Type u_6
β' : Type u_7
γ : Type u_8
γ' : Type u_9
mΩ : MeasurableSpace Ω
μ : Measure Ω
f : Ω → β
g : Ω → β'
mβ : MeasurableSpace β
mβ' : MeasurableSpace β'
⊢ IndepFun f g ↔
    ∀ (s : Set β) (t : Set β'),
      MeasurableSet s → MeasurableSet t → ↑↑μ (f ⁻¹' s ∩ g ⁻¹' t) = ↑↑μ (f ⁻¹' s) * ↑↑μ (g ⁻¹' t)

Next tactic:
simp only [IndepFun, kernel.indepFun_iff_measure_inter_preimage_eq_mul, ae_dirac_eq,
    Filter.eventually_pure, kernel.const_apply]
theorem iIndepFun_iff_measure_inter_preimage_eq_mul {ι : Type*} {β : ι → Type*}
    (m : ∀ x, MeasurableSpace (β x)) (f : ∀ i, Ω → β i) :
    iIndepFun m f μ ↔
      ∀ (S : Finset ι) {sets : ∀ i : ι, Set (β i)} (_H : ∀ i, i ∈ S → MeasurableSet[m i] (sets i)),
        μ (⋂ i ∈ S, f i ⁻¹' sets i) = ∏ i in S, μ (f i ⁻¹' sets i) := by
  

Proof state:
Ω : Type u_1
ι✝ : Type u_2
β✝¹ : Type u_3
γ✝ : Type u_4
κ : ι✝ → Type u_5
β✝ : Type u_6
β' : Type u_7
γ : Type u_8
γ' : Type u_9
mΩ : MeasurableSpace Ω
μ : Measure Ω
f✝ : Ω → β✝
g : Ω → β'
ι : Type u_10
β : ι → Type u_11
m : (x : ι) → MeasurableSpace (β x)
f : (i : ι) → Ω → β i
⊢ iIndepFun m f ↔
    ∀ (S : Finset ι) {sets : (i : ι) → Set (β i)},
      (∀ i ∈ S, MeasurableSet (sets i)) → ↑↑μ (⋂ i ∈ S, f i ⁻¹' sets i) = ∏ i in S, ↑↑μ (f i ⁻¹' sets i)

Next tactic:
simp only [iIndepFun, kernel.iIndepFun_iff_measure_inter_preimage_eq_mul, ae_dirac_eq,
    Filter.eventually_pure, kernel.const_apply]
theorem indepFun_iff_indepSet_preimage {mβ : MeasurableSpace β} {mβ' : MeasurableSpace β'}
    [IsProbabilityMeasure μ] (hf : Measurable f) (hg : Measurable g) :
    IndepFun f g μ ↔
      ∀ s t, MeasurableSet s → MeasurableSet t → IndepSet (f ⁻¹' s) (g ⁻¹' t) μ := by
  

Proof state:
Ω : Type u_1
ι : Type u_2
β✝ : Type u_3
γ✝ : Type u_4
κ : ι → Type u_5
β : Type u_6
β' : Type u_7
γ : Type u_8
γ' : Type u_9
mΩ : MeasurableSpace Ω
μ : Measure Ω
f : Ω → β
g : Ω → β'
mβ : MeasurableSpace β
mβ' : MeasurableSpace β'
inst✝ : IsProbabilityMeasure μ
hf : Measurable f
hg : Measurable g
⊢ IndepFun f g ↔ ∀ (s : Set β) (t : Set β'), MeasurableSet s → MeasurableSet t → IndepSet (f ⁻¹' s) (g ⁻¹' t)

Next tactic:
simp only [IndepFun, IndepSet, kernel.indepFun_iff_indepSet_preimage hf hg, ae_dirac_eq,
    Filter.eventually_pure, kernel.const_apply]
theorem indepFun_iff_map_prod_eq_prod_map_map {mβ : MeasurableSpace β} {mβ' : MeasurableSpace β'}
    [IsFiniteMeasure μ] (hf : AEMeasurable f μ) (hg : AEMeasurable g μ) :
    IndepFun f g μ ↔ μ.map (fun ω ↦ (f ω, g ω)) = (μ.map f).prod (μ.map g) := by
  

Proof state:
Ω : Type u_1
ι : Type u_2
β✝ : Type u_3
γ✝ : Type u_4
κ : ι → Type u_5
β : Type u_6
β' : Type u_7
γ : Type u_8
γ' : Type u_9
mΩ : MeasurableSpace Ω
μ : Measure Ω
f : Ω → β
g : Ω → β'
mβ : MeasurableSpace β
mβ' : MeasurableSpace β'
inst✝ : IsFiniteMeasure μ
hf : AEMeasurable f
hg : AEMeasurable g
⊢ IndepFun f g ↔ Measure.map (fun ω => (f ω, g ω)) μ = Measure.prod (Measure.map f μ) (Measure.map g μ)

Next tactic:
rw [indepFun_iff_measure_inter_preimage_eq_mul]
theorem indepFun_iff_map_prod_eq_prod_map_map {mβ : MeasurableSpace β} {mβ' : MeasurableSpace β'}
    [IsFiniteMeasure μ] (hf : AEMeasurable f μ) (hg : AEMeasurable g μ) :
    IndepFun f g μ ↔ μ.map (fun ω ↦ (f ω, g ω)) = (μ.map f).prod (μ.map g) := by
  rw [indepFun_iff_measure_inter_preimage_eq_mul]
  

Proof state:
Ω : Type u_1
ι : Type u_2
β✝ : Type u_3
γ✝ : Type u_4
κ : ι → Type u_5
β : Type u_6
β' : Type u_7
γ : Type u_8
γ' : Type u_9
mΩ : MeasurableSpace Ω
μ : Measure Ω
f : Ω → β
g : Ω → β'
mβ : MeasurableSpace β
mβ' : MeasurableSpace β'
inst✝ : IsFiniteMeasure μ
hf : AEMeasurable f
hg : AEMeasurable g
⊢ (∀ (s : Set β) (t : Set β'),
      MeasurableSet s → MeasurableSet t → ↑↑μ (f ⁻¹' s ∩ g ⁻¹' t) = ↑↑μ (f ⁻¹' s) * ↑↑μ (g ⁻¹' t)) ↔
    Measure.map (fun ω => (f ω, g ω)) μ = Measure.prod (Measure.map f μ) (Measure.map g μ)

Next tactic:
have h₀ {s : Set β} {t : Set β'} (hs : MeasurableSet s) (ht : MeasurableSet t) :
      μ (f ⁻¹' s) * μ (g ⁻¹' t) = μ.map f s * μ.map g t ∧
      μ (f ⁻¹' s ∩ g ⁻¹' t) = μ.map (fun ω ↦ (f ω, g ω)) (s ×ˢ t) :=
    ⟨by rw [Measure.map_apply_of_aemeasurable hf hs, Measure.map_apply_of_aemeasurable hg ht],
      (Measure.map_apply_of_aemeasurable (hf.prod_mk hg) (hs.prod ht)).symm⟩
theorem indepFun_iff_map_prod_eq_prod_map_map {mβ : MeasurableSpace β} {mβ' : MeasurableSpace β'}
    [IsFiniteMeasure μ] (hf : AEMeasurable f μ) (hg : AEMeasurable g μ) :
    IndepFun f g μ ↔ μ.map (fun ω ↦ (f ω, g ω)) = (μ.map f).prod (μ.map g) := by
  rw [indepFun_iff_measure_inter_preimage_eq_mul]
  have h₀ {s : Set β} {t : Set β'} (hs : MeasurableSet s) (ht : MeasurableSet t) :
      μ (f ⁻¹' s) * μ (g ⁻¹' t) = μ.map f s * μ.map g t ∧
      μ (f ⁻¹' s ∩ g ⁻¹' t) = μ.map (fun ω ↦ (f ω, g ω)) (s ×ˢ t) :=
    ⟨by 

Proof state:
Ω : Type u_1
ι : Type u_2
β✝ : Type u_3
γ✝ : Type u_4
κ : ι → Type u_5
β : Type u_6
β' : Type u_7
γ : Type u_8
γ' : Type u_9
mΩ : MeasurableSpace Ω
μ : Measure Ω
f : Ω → β
g : Ω → β'
mβ : MeasurableSpace β
mβ' : MeasurableSpace β'
inst✝ : IsFiniteMeasure μ
hf : AEMeasurable f
hg : AEMeasurable g
s : Set β
t : Set β'
hs : MeasurableSet s
ht : MeasurableSet t
⊢ ↑↑μ (f ⁻¹' s) * ↑↑μ (g ⁻¹' t) = ↑↑(Measure.map f μ) s * ↑↑(Measure.map g μ) t

Next tactic:
rw [Measure.map_apply_of_aemeasurable hf hs, Measure.map_apply_of_aemeasurable hg ht]
theorem indepFun_iff_map_prod_eq_prod_map_map {mβ : MeasurableSpace β} {mβ' : MeasurableSpace β'}
    [IsFiniteMeasure μ] (hf : AEMeasurable f μ) (hg : AEMeasurable g μ) :
    IndepFun f g μ ↔ μ.map (fun ω ↦ (f ω, g ω)) = (μ.map f).prod (μ.map g) := by
  rw [indepFun_iff_measure_inter_preimage_eq_mul]
  have h₀ {s : Set β} {t : Set β'} (hs : MeasurableSet s) (ht : MeasurableSet t) :
      μ (f ⁻¹' s) * μ (g ⁻¹' t) = μ.map f s * μ.map g t ∧
      μ (f ⁻¹' s ∩ g ⁻¹' t) = μ.map (fun ω ↦ (f ω, g ω)) (s ×ˢ t) :=
    ⟨by rw [Measure.map_apply_of_aemeasurable hf hs, Measure.map_apply_of_aemeasurable hg ht],
      (Measure.map_apply_of_aemeasurable (hf.prod_mk hg) (hs.prod ht)).symm⟩
  

Proof state:
Ω : Type u_1
ι : Type u_2
β✝ : Type u_3
γ✝ : Type u_4
κ : ι → Type u_5
β : Type u_6
β' : Type u_7
γ : Type u_8
γ' : Type u_9
mΩ : MeasurableSpace Ω
μ : Measure Ω
f : Ω → β
g : Ω → β'
mβ : MeasurableSpace β
mβ' : MeasurableSpace β'
inst✝ : IsFiniteMeasure μ
hf : AEMeasurable f
hg : AEMeasurable g
h₀ :
  ∀ {s : Set β} {t : Set β'},
    MeasurableSet s →
      MeasurableSet t →
        ↑↑μ (f ⁻¹' s) * ↑↑μ (g ⁻¹' t) = ↑↑(Measure.map f μ) s * ↑↑(Measure.map g μ) t ∧
          ↑↑μ (f ⁻¹' s ∩ g ⁻¹' t) = ↑↑(Measure.map (fun ω => (f ω, g ω)) μ) (s ×ˢ t)
⊢ (∀ (s : Set β) (t : Set β'),
      MeasurableSet s → MeasurableSet t → ↑↑μ (f ⁻¹' s ∩ g ⁻¹' t) = ↑↑μ (f ⁻¹' s) * ↑↑μ (g ⁻¹' t)) ↔
    Measure.map (fun ω => (f ω, g ω)) μ = Measure.prod (Measure.map f μ) (Measure.map g μ)

Next tactic:
constructor
theorem indepFun_iff_map_prod_eq_prod_map_map {mβ : MeasurableSpace β} {mβ' : MeasurableSpace β'}
    [IsFiniteMeasure μ] (hf : AEMeasurable f μ) (hg : AEMeasurable g μ) :
    IndepFun f g μ ↔ μ.map (fun ω ↦ (f ω, g ω)) = (μ.map f).prod (μ.map g) := by
  rw [indepFun_iff_measure_inter_preimage_eq_mul]
  have h₀ {s : Set β} {t : Set β'} (hs : MeasurableSet s) (ht : MeasurableSet t) :
      μ (f ⁻¹' s) * μ (g ⁻¹' t) = μ.map f s * μ.map g t ∧
      μ (f ⁻¹' s ∩ g ⁻¹' t) = μ.map (fun ω ↦ (f ω, g ω)) (s ×ˢ t) :=
    ⟨by rw [Measure.map_apply_of_aemeasurable hf hs, Measure.map_apply_of_aemeasurable hg ht],
      (Measure.map_apply_of_aemeasurable (hf.prod_mk hg) (hs.prod ht)).symm⟩
  constructor
  · 

Proof state:
case mp
Ω : Type u_1
ι : Type u_2
β✝ : Type u_3
γ✝ : Type u_4
κ : ι → Type u_5
β : Type u_6
β' : Type u_7
γ : Type u_8
γ' : Type u_9
mΩ : MeasurableSpace Ω
μ : Measure Ω
f : Ω → β
g : Ω → β'
mβ : MeasurableSpace β
mβ' : MeasurableSpace β'
inst✝ : IsFiniteMeasure μ
hf : AEMeasurable f
hg : AEMeasurable g
h₀ :
  ∀ {s : Set β} {t : Set β'},
    MeasurableSet s →
      MeasurableSet t →
        ↑↑μ (f ⁻¹' s) * ↑↑μ (g ⁻¹' t) = ↑↑(Measure.map f μ) s * ↑↑(Measure.map g μ) t ∧
          ↑↑μ (f ⁻¹' s ∩ g ⁻¹' t) = ↑↑(Measure.map (fun ω => (f ω, g ω)) μ) (s ×ˢ t)
⊢ (∀ (s : Set β) (t : Set β'),
      MeasurableSet s → MeasurableSet t → ↑↑μ (f ⁻¹' s ∩ g ⁻¹' t) = ↑↑μ (f ⁻¹' s) * ↑↑μ (g ⁻¹' t)) →
    Measure.map (fun ω => (f ω, g ω)) μ = Measure.prod (Measure.map f μ) (Measure.map g μ)

Next tactic:
refine fun h ↦ (Measure.prod_eq fun s t hs ht ↦ ?_).symm
theorem indepFun_iff_map_prod_eq_prod_map_map {mβ : MeasurableSpace β} {mβ' : MeasurableSpace β'}
    [IsFiniteMeasure μ] (hf : AEMeasurable f μ) (hg : AEMeasurable g μ) :
    IndepFun f g μ ↔ μ.map (fun ω ↦ (f ω, g ω)) = (μ.map f).prod (μ.map g) := by
  rw [indepFun_iff_measure_inter_preimage_eq_mul]
  have h₀ {s : Set β} {t : Set β'} (hs : MeasurableSet s) (ht : MeasurableSet t) :
      μ (f ⁻¹' s) * μ (g ⁻¹' t) = μ.map f s * μ.map g t ∧
      μ (f ⁻¹' s ∩ g ⁻¹' t) = μ.map (fun ω ↦ (f ω, g ω)) (s ×ˢ t) :=
    ⟨by rw [Measure.map_apply_of_aemeasurable hf hs, Measure.map_apply_of_aemeasurable hg ht],
      (Measure.map_apply_of_aemeasurable (hf.prod_mk hg) (hs.prod ht)).symm⟩
  constructor
  · refine fun h ↦ (Measure.prod_eq fun s t hs ht ↦ ?_).symm
    

Proof state:
case mp
Ω : Type u_1
ι : Type u_2
β✝ : Type u_3
γ✝ : Type u_4
κ : ι → Type u_5
β : Type u_6
β' : Type u_7
γ : Type u_8
γ' : Type u_9
mΩ : MeasurableSpace Ω
μ : Measure Ω
f : Ω → β
g : Ω → β'
mβ : MeasurableSpace β
mβ' : MeasurableSpace β'
inst✝ : IsFiniteMeasure μ
hf : AEMeasurable f
hg : AEMeasurable g
h₀ :
  ∀ {s : Set β} {t : Set β'},
    MeasurableSet s →
      MeasurableSet t →
        ↑↑μ (f ⁻¹' s) * ↑↑μ (g ⁻¹' t) = ↑↑(Measure.map f μ) s * ↑↑(Measure.map g μ) t ∧
          ↑↑μ (f ⁻¹' s ∩ g ⁻¹' t) = ↑↑(Measure.map (fun ω => (f ω, g ω)) μ) (s ×ˢ t)
h :
  ∀ (s : Set β) (t : Set β'),
    MeasurableSet s → MeasurableSet t → ↑↑μ (f ⁻¹' s ∩ g ⁻¹' t) = ↑↑μ (f ⁻¹' s) * ↑↑μ (g ⁻¹' t)
s : Set β
t : Set β'
hs : MeasurableSet s
ht : MeasurableSet t
⊢ ↑↑(Measure.map (fun ω => (f ω, g ω)) μ) (s ×ˢ t) = ↑↑(Measure.map f μ) s * ↑↑(Measure.map g μ) t

Next tactic:
rw [← (h₀ hs ht).1, ← (h₀ hs ht).2, h s t hs ht]
theorem indepFun_iff_map_prod_eq_prod_map_map {mβ : MeasurableSpace β} {mβ' : MeasurableSpace β'}
    [IsFiniteMeasure μ] (hf : AEMeasurable f μ) (hg : AEMeasurable g μ) :
    IndepFun f g μ ↔ μ.map (fun ω ↦ (f ω, g ω)) = (μ.map f).prod (μ.map g) := by
  rw [indepFun_iff_measure_inter_preimage_eq_mul]
  have h₀ {s : Set β} {t : Set β'} (hs : MeasurableSet s) (ht : MeasurableSet t) :
      μ (f ⁻¹' s) * μ (g ⁻¹' t) = μ.map f s * μ.map g t ∧
      μ (f ⁻¹' s ∩ g ⁻¹' t) = μ.map (fun ω ↦ (f ω, g ω)) (s ×ˢ t) :=
    ⟨by rw [Measure.map_apply_of_aemeasurable hf hs, Measure.map_apply_of_aemeasurable hg ht],
      (Measure.map_apply_of_aemeasurable (hf.prod_mk hg) (hs.prod ht)).symm⟩
  constructor
  · refine fun h ↦ (Measure.prod_eq fun s t hs ht ↦ ?_).symm
    rw [← (h₀ hs ht).1, ← (h₀ hs ht).2, h s t hs ht]
  · 

Proof state:
case mpr
Ω : Type u_1
ι : Type u_2
β✝ : Type u_3
γ✝ : Type u_4
κ : ι → Type u_5
β : Type u_6
β' : Type u_7
γ : Type u_8
γ' : Type u_9
mΩ : MeasurableSpace Ω
μ : Measure Ω
f : Ω → β
g : Ω → β'
mβ : MeasurableSpace β
mβ' : MeasurableSpace β'
inst✝ : IsFiniteMeasure μ
hf : AEMeasurable f
hg : AEMeasurable g
h₀ :
  ∀ {s : Set β} {t : Set β'},
    MeasurableSet s →
      MeasurableSet t →
        ↑↑μ (f ⁻¹' s) * ↑↑μ (g ⁻¹' t) = ↑↑(Measure.map f μ) s * ↑↑(Measure.map g μ) t ∧
          ↑↑μ (f ⁻¹' s ∩ g ⁻¹' t) = ↑↑(Measure.map (fun ω => (f ω, g ω)) μ) (s ×ˢ t)
⊢ Measure.map (fun ω => (f ω, g ω)) μ = Measure.prod (Measure.map f μ) (Measure.map g μ) →
    ∀ (s : Set β) (t : Set β'),
      MeasurableSet s → MeasurableSet t → ↑↑μ (f ⁻¹' s ∩ g ⁻¹' t) = ↑↑μ (f ⁻¹' s) * ↑↑μ (g ⁻¹' t)

Next tactic:
intro h s t hs ht
theorem indepFun_iff_map_prod_eq_prod_map_map {mβ : MeasurableSpace β} {mβ' : MeasurableSpace β'}
    [IsFiniteMeasure μ] (hf : AEMeasurable f μ) (hg : AEMeasurable g μ) :
    IndepFun f g μ ↔ μ.map (fun ω ↦ (f ω, g ω)) = (μ.map f).prod (μ.map g) := by
  rw [indepFun_iff_measure_inter_preimage_eq_mul]
  have h₀ {s : Set β} {t : Set β'} (hs : MeasurableSet s) (ht : MeasurableSet t) :
      μ (f ⁻¹' s) * μ (g ⁻¹' t) = μ.map f s * μ.map g t ∧
      μ (f ⁻¹' s ∩ g ⁻¹' t) = μ.map (fun ω ↦ (f ω, g ω)) (s ×ˢ t) :=
    ⟨by rw [Measure.map_apply_of_aemeasurable hf hs, Measure.map_apply_of_aemeasurable hg ht],
      (Measure.map_apply_of_aemeasurable (hf.prod_mk hg) (hs.prod ht)).symm⟩
  constructor
  · refine fun h ↦ (Measure.prod_eq fun s t hs ht ↦ ?_).symm
    rw [← (h₀ hs ht).1, ← (h₀ hs ht).2, h s t hs ht]
  · intro h s t hs ht
    

Proof state:
case mpr
Ω : Type u_1
ι : Type u_2
β✝ : Type u_3
γ✝ : Type u_4
κ : ι → Type u_5
β : Type u_6
β' : Type u_7
γ : Type u_8
γ' : Type u_9
mΩ : MeasurableSpace Ω
μ : Measure Ω
f : Ω → β
g : Ω → β'
mβ : MeasurableSpace β
mβ' : MeasurableSpace β'
inst✝ : IsFiniteMeasure μ
hf : AEMeasurable f
hg : AEMeasurable g
h₀ :
  ∀ {s : Set β} {t : Set β'},
    MeasurableSet s →
      MeasurableSet t →
        ↑↑μ (f ⁻¹' s) * ↑↑μ (g ⁻¹' t) = ↑↑(Measure.map f μ) s * ↑↑(Measure.map g μ) t ∧
          ↑↑μ (f ⁻¹' s ∩ g ⁻¹' t) = ↑↑(Measure.map (fun ω => (f ω, g ω)) μ) (s ×ˢ t)
h : Measure.map (fun ω => (f ω, g ω)) μ = Measure.prod (Measure.map f μ) (Measure.map g μ)
s : Set β
t : Set β'
hs : MeasurableSet s
ht : MeasurableSet t
⊢ ↑↑μ (f ⁻¹' s ∩ g ⁻¹' t) = ↑↑μ (f ⁻¹' s) * ↑↑μ (g ⁻¹' t)

Next tactic:
rw [(h₀ hs ht).1, (h₀ hs ht).2, h, Measure.prod_prod]
theorem IndepFun.ae_eq {mβ : MeasurableSpace β} {f g f' g' : Ω → β} (hfg : IndepFun f g μ)
    (hf : f =ᵐ[μ] f') (hg : g =ᵐ[μ] g') : IndepFun f' g' μ := by
  

Proof state:
Ω : Type u_1
ι : Type u_2
β✝ : Type u_3
γ✝ : Type u_4
κ : ι → Type u_5
β : Type u_6
β' : Type u_7
γ : Type u_8
γ' : Type u_9
mΩ : MeasurableSpace Ω
μ : Measure Ω
f✝ : Ω → β
g✝ : Ω → β'
mβ : MeasurableSpace β
f g f' g' : Ω → β
hfg : IndepFun f g
hf : f =ᵐ[μ] f'
hg : g =ᵐ[μ] g'
⊢ IndepFun f' g'

Next tactic:
refine kernel.IndepFun.ae_eq hfg ?_ ?_
theorem IndepFun.ae_eq {mβ : MeasurableSpace β} {f g f' g' : Ω → β} (hfg : IndepFun f g μ)
    (hf : f =ᵐ[μ] f') (hg : g =ᵐ[μ] g') : IndepFun f' g' μ := by
  refine kernel.IndepFun.ae_eq hfg ?_ ?_ <;>
    

Proof state:
case refine_1
Ω : Type u_1
ι : Type u_2
β✝ : Type u_3
γ✝ : Type u_4
κ : ι → Type u_5
β : Type u_6
β' : Type u_7
γ : Type u_8
γ' : Type u_9
mΩ : MeasurableSpace Ω
μ : Measure Ω
f✝ : Ω → β
g✝ : Ω → β'
mβ : MeasurableSpace β
f g f' g' : Ω → β
hfg : IndepFun f g
hf : f =ᵐ[μ] f'
hg : g =ᵐ[μ] g'
⊢ ∀ᵐ (a : Unit) ∂Measure.dirac (), f =ᵐ[(kernel.const Unit μ) a] f'

Next tactic:
simp only [ae_dirac_eq, Filter.eventually_pure, kernel.const_apply]
theorem IndepFun.ae_eq {mβ : MeasurableSpace β} {f g f' g' : Ω → β} (hfg : IndepFun f g μ)
    (hf : f =ᵐ[μ] f') (hg : g =ᵐ[μ] g') : IndepFun f' g' μ := by
  refine kernel.IndepFun.ae_eq hfg ?_ ?_ <;>
    

Proof state:
case refine_2
Ω : Type u_1
ι : Type u_2
β✝ : Type u_3
γ✝ : Type u_4
κ : ι → Type u_5
β : Type u_6
β' : Type u_7
γ : Type u_8
γ' : Type u_9
mΩ : MeasurableSpace Ω
μ : Measure Ω
f✝ : Ω → β
g✝ : Ω → β'
mβ : MeasurableSpace β
f g f' g' : Ω → β
hfg : IndepFun f g
hf : f =ᵐ[μ] f'
hg : g =ᵐ[μ] g'
⊢ ∀ᵐ (a : Unit) ∂Measure.dirac (), g =ᵐ[(kernel.const Unit μ) a] g'

Next tactic:
simp only [ae_dirac_eq, Filter.eventually_pure, kernel.const_apply]
theorem IndepFun.ae_eq {mβ : MeasurableSpace β} {f g f' g' : Ω → β} (hfg : IndepFun f g μ)
    (hf : f =ᵐ[μ] f') (hg : g =ᵐ[μ] g') : IndepFun f' g' μ := by
  refine kernel.IndepFun.ae_eq hfg ?_ ?_ <;>
    simp only [ae_dirac_eq, Filter.eventually_pure, kernel.const_apply]
  

Proof state:
case refine_1
Ω : Type u_1
ι : Type u_2
β✝ : Type u_3
γ✝ : Type u_4
κ : ι → Type u_5
β : Type u_6
β' : Type u_7
γ : Type u_8
γ' : Type u_9
mΩ : MeasurableSpace Ω
μ : Measure Ω
f✝ : Ω → β
g✝ : Ω → β'
mβ : MeasurableSpace β
f g f' g' : Ω → β
hfg : IndepFun f g
hf : f =ᵐ[μ] f'
hg : g =ᵐ[μ] g'
⊢ f =ᵐ[μ] f'
case refine_2
Ω : Type u_1
ι : Type u_2
β✝ : Type u_3
γ✝ : Type u_4
κ : ι → Type u_5
β : Type u_6
β' : Type u_7
γ : Type u_8
γ' : Type u_9
mΩ : MeasurableSpace Ω
μ : Measure Ω
f✝ : Ω → β
g✝ : Ω → β'
mβ : MeasurableSpace β
f g f' g' : Ω → β
hfg : IndepFun f g
hf : f =ᵐ[μ] f'
hg : g =ᵐ[μ] g'
⊢ g =ᵐ[μ] g'

Next tactic:
exacts [hf, hg]
lemma iIndepFun.isProbabilityMeasure (h : iIndepFun m f μ) : IsProbabilityMeasure μ :=
  ⟨by 

Proof state:
Ω : Type u_1
ι : Type u_2
β✝¹ : Type u_3
γ✝ : Type u_4
κ : ι → Type u_5
β✝ : Type u_6
β' : Type u_7
γ : Type u_8
γ' : Type u_9
mΩ : MeasurableSpace Ω
μ : Measure Ω
f✝ : Ω → β✝
g : Ω → β'
β : ι → Type u_10
m : (i : ι) → MeasurableSpace (β i)
f : (i : ι) → Ω → β i
h : iIndepFun m f
⊢ ↑↑μ univ = 1

Next tactic:
simpa using h.meas_biInter (S := ∅) (s := fun _ ↦ univ)
open Finset in
lemma iIndepFun.indepFun_prod_mk_prod_mk (h_indep : iIndepFun m f μ) (hf : ∀ i, Measurable (f i))
    (i j k l : ι) (hik : i ≠ k) (hil : i ≠ l) (hjk : j ≠ k) (hjl : j ≠ l) :
    IndepFun (fun a ↦ (f i a, f j a)) (fun a ↦ (f k a, f l a)) μ := by
  

Proof state:
Ω : Type u_1
ι : Type u_2
β✝¹ : Type u_3
γ✝ : Type u_4
κ : ι → Type u_5
β✝ : Type u_6
β' : Type u_7
γ : Type u_8
γ' : Type u_9
mΩ : MeasurableSpace Ω
μ : Measure Ω
f✝ : Ω → β✝
g : Ω → β'
β : ι → Type u_10
m : (i : ι) → MeasurableSpace (β i)
f : (i : ι) → Ω → β i
h_indep : iIndepFun m f
hf : ∀ (i : ι), Measurable (f i)
i j k l : ι
hik : i ≠ k
hil : i ≠ l
hjk : j ≠ k
hjl : j ≠ l
⊢ IndepFun (fun a => (f i a, f j a)) fun a => (f k a, f l a)

Next tactic:
classical
  let g (i j : ι) (v : Π x : ({i, j} : Finset ι), β x) : β i × β j :=
    ⟨v ⟨i, mem_insert_self _ _⟩, v ⟨j, mem_insert_of_mem $ mem_singleton_self _⟩⟩
  have hg (i j : ι) : Measurable (g i j) := by measurability
  exact (h_indep.indepFun_finset {i, j} {k, l} (by aesop) hf).comp (hg i j) (hg k l)
open Finset in
lemma iIndepFun.indepFun_prod_mk_prod_mk (h_indep : iIndepFun m f μ) (hf : ∀ i, Measurable (f i))
    (i j k l : ι) (hik : i ≠ k) (hil : i ≠ l) (hjk : j ≠ k) (hjl : j ≠ l) :
    IndepFun (fun a ↦ (f i a, f j a)) (fun a ↦ (f k a, f l a)) μ := by
  classical
  

Proof state:
Ω : Type u_1
ι : Type u_2
β✝¹ : Type u_3
γ✝ : Type u_4
κ : ι → Type u_5
β✝ : Type u_6
β' : Type u_7
γ : Type u_8
γ' : Type u_9
mΩ : MeasurableSpace Ω
μ : Measure Ω
f✝ : Ω → β✝
g : Ω → β'
β : ι → Type u_10
m : (i : ι) → MeasurableSpace (β i)
f : (i : ι) → Ω → β i
h_indep : iIndepFun m f
hf : ∀ (i : ι), Measurable (f i)
i j k l : ι
hik : i ≠ k
hil : i ≠ l
hjk : j ≠ k
hjl : j ≠ l
⊢ IndepFun (fun a => (f i a, f j a)) fun a => (f k a, f l a)

Next tactic:
let g (i j : ι) (v : Π x : ({i, j} : Finset ι), β x) : β i × β j :=
    ⟨v ⟨i, mem_insert_self _ _⟩, v ⟨j, mem_insert_of_mem $ mem_singleton_self _⟩⟩
open Finset in
lemma iIndepFun.indepFun_prod_mk_prod_mk (h_indep : iIndepFun m f μ) (hf : ∀ i, Measurable (f i))
    (i j k l : ι) (hik : i ≠ k) (hil : i ≠ l) (hjk : j ≠ k) (hjl : j ≠ l) :
    IndepFun (fun a ↦ (f i a, f j a)) (fun a ↦ (f k a, f l a)) μ := by
  classical
  let g (i j : ι) (v : Π x : ({i, j} : Finset ι), β x) : β i × β j :=
    ⟨v ⟨i, mem_insert_self _ _⟩, v ⟨j, mem_insert_of_mem $ mem_singleton_self _⟩⟩
  

Proof state:
Ω : Type u_1
ι : Type u_2
β✝¹ : Type u_3
γ✝ : Type u_4
κ : ι → Type u_5
β✝ : Type u_6
β' : Type u_7
γ : Type u_8
γ' : Type u_9
mΩ : MeasurableSpace Ω
μ : Measure Ω
f✝ : Ω → β✝
g✝ : Ω → β'
β : ι → Type u_10
m : (i : ι) → MeasurableSpace (β i)
f : (i : ι) → Ω → β i
h_indep : iIndepFun m f
hf : ∀ (i : ι), Measurable (f i)
i j k l : ι
hik : i ≠ k
hil : i ≠ l
hjk : j ≠ k
hjl : j ≠ l
g : (i j : ι) → ((x : { x // x ∈ {i, j} }) → β ↑x) → β i × β j :=
  fun i j v => (v { val := i, property := (_ : i ∈ {i, j}) }, v { val := j, property := (_ : j ∈ {i, j}) })
⊢ IndepFun (fun a => (f i a, f j a)) fun a => (f k a, f l a)

Next tactic:
have hg (i j : ι) : Measurable (g i j) := by measurability
open Finset in
lemma iIndepFun.indepFun_prod_mk_prod_mk (h_indep : iIndepFun m f μ) (hf : ∀ i, Measurable (f i))
    (i j k l : ι) (hik : i ≠ k) (hil : i ≠ l) (hjk : j ≠ k) (hjl : j ≠ l) :
    IndepFun (fun a ↦ (f i a, f j a)) (fun a ↦ (f k a, f l a)) μ := by
  classical
  let g (i j : ι) (v : Π x : ({i, j} : Finset ι), β x) : β i × β j :=
    ⟨v ⟨i, mem_insert_self _ _⟩, v ⟨j, mem_insert_of_mem $ mem_singleton_self _⟩⟩
  have hg (i j : ι) : Measurable (g i j) := by 

Proof state:
Ω : Type u_1
ι : Type u_2
β✝¹ : Type u_3
γ✝ : Type u_4
κ : ι → Type u_5
β✝ : Type u_6
β' : Type u_7
γ : Type u_8
γ' : Type u_9
mΩ : MeasurableSpace Ω
μ : Measure Ω
f✝ : Ω → β✝
g✝ : Ω → β'
β : ι → Type u_10
m : (i : ι) → MeasurableSpace (β i)
f : (i : ι) → Ω → β i
h_indep : iIndepFun m f
hf : ∀ (i : ι), Measurable (f i)
i✝ j✝ k l : ι
hik : i✝ ≠ k
hil : i✝ ≠ l
hjk : j✝ ≠ k
hjl : j✝ ≠ l
g : (i j : ι) → ((x : { x // x ∈ {i, j} }) → β ↑x) → β i × β j :=
  fun i j v => (v { val := i, property := (_ : i ∈ {i, j}) }, v { val := j, property := (_ : j ∈ {i, j}) })
i j : ι
⊢ Measurable (g i j)

Next tactic:
measurability