l3lab/ntp-mathlib huggingface dataset:
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)),
        ∀ᵐ a ∂μ, κ a (⋂ i ∈ S, (f i) ⁻¹' (sets i)) = ∏ i in S, κ a ((f i) ⁻¹' (sets i)) := by
  refine' ⟨fun h S sets h_meas => h _ fun i hi_mem => ⟨sets i, h_meas i hi_mem, rfl⟩, _⟩
  intro h S setsΩ h_meas
  classical
  let setsβ : ∀ i : ι, Set (β i) := fun i =>
    dite (i ∈ S) (fun hi_mem => (h_meas i hi_mem).choose) fun _ => Set.univ
  have h_measβ : ∀ i ∈ S, MeasurableSet[m i] (setsβ i) := by
    intro i hi_mem
    simp_rw [dif_pos hi_mem]
    exact (h_meas i hi_mem).choose_spec.1
  have h_preim : ∀ i ∈ S, setsΩ i = f i ⁻¹' setsβ i := by
    intro i hi_mem
    simp_rw [dif_pos hi_mem]
    exact (h_meas i hi_mem).choose_spec.2.symm
  have h_left_eq : ∀ a, κ a (⋂ i ∈ S, setsΩ i) = κ a (⋂ i ∈ S, (f i) ⁻¹' (setsβ i)) := by
    intro a
    congr with x
    simp_rw [Set.mem_iInter]
    constructor <;> intro h i hi_mem <;> specialize h i hi_mem
    · rwa [h_preim i hi_mem] at h
    · rwa [h_preim i hi_mem]
  have h_right_eq : ∀ a, (∏ i in S, κ a (setsΩ i)) = ∏ i in S, κ a ((f i) ⁻¹' (setsβ i)) := by
    refine' fun a ↦ Finset.prod_congr rfl fun i hi_mem => _
    rw [h_preim i hi_mem]
  filter_upwards [h S h_measβ] with a ha
  

Proof state:
case h
α : Type u_1
Ω : Type u_2
ι✝ : Type u_3
β✝ : Type u_4
β' : Type u_5
γ : Type u_6
γ' : Type u_7
_mα : MeasurableSpace α
_mΩ : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
f✝ : Ω → β✝
g : Ω → β'
ι : Type u_8
β : ι → Type u_9
m : (x : ι) → MeasurableSpace (β x)
f : (i : ι) → Ω → β i
h :
  ∀ (S : Finset ι) {sets : (i : ι) → Set (β i)},
    (∀ i ∈ S, MeasurableSet (sets i)) →
      ∀ᵐ (a : α) ∂μ, ↑↑(κ a) (⋂ i ∈ S, f i ⁻¹' sets i) = ∏ i in S, ↑↑(κ a) (f i ⁻¹' sets i)
S : Finset ι
setsΩ : ι → Set Ω
h_meas : ∀ i ∈ S, setsΩ i ∈ (fun x => {s | MeasurableSet s}) i
setsβ : (i : ι) → Set (β i) :=
  fun i => if hi_mem : i ∈ S then Exists.choose (_ : setsΩ i ∈ (fun x => {s | MeasurableSet s}) i) else Set.univ
h_measβ : ∀ i ∈ S, MeasurableSet (setsβ i)
h_preim : ∀ i ∈ S, setsΩ i = f i ⁻¹' setsβ i
h_left_eq : ∀ (a : α), ↑↑(κ a) (⋂ i ∈ S, setsΩ i) = ↑↑(κ a) (⋂ i ∈ S, f i ⁻¹' setsβ i)
h_right_eq : ∀ (a : α), ∏ i in S, ↑↑(κ a) (setsΩ i) = ∏ i in S, ↑↑(κ a) (f i ⁻¹' setsβ i)
a : α
ha : ↑↑(κ a) (⋂ i ∈ S, f i ⁻¹' setsβ i) = ∏ i in S, ↑↑(κ a) (f i ⁻¹' setsβ i)
⊢ ↑↑(κ a) (⋂ i ∈ S, setsΩ i) = ∏ i in S, ↑↑(κ a) (setsΩ i)

Next tactic:
rw [h_left_eq a, h_right_eq a, ha]
theorem indepFun_iff_indepSet_preimage {mβ : MeasurableSpace β} {mβ' : MeasurableSpace β'}
    [IsMarkovKernel κ] (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
_mα : MeasurableSpace α
_mΩ : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
f : Ω → β
g : Ω → β'
mβ : MeasurableSpace β
mβ' : MeasurableSpace β'
inst✝ : IsMarkovKernel κ
hf : Measurable f
hg : Measurable g
⊢ IndepFun f g κ ↔ ∀ (s : Set β) (t : Set β'), MeasurableSet s → MeasurableSet t → IndepSet (f ⁻¹' s) (g ⁻¹' t) κ

Next tactic:
refine' indepFun_iff_measure_inter_preimage_eq_mul.trans _
theorem indepFun_iff_indepSet_preimage {mβ : MeasurableSpace β} {mβ' : MeasurableSpace β'}
    [IsMarkovKernel κ] (hf : Measurable f) (hg : Measurable g) :
    IndepFun f g κ μ ↔
      ∀ s t, MeasurableSet s → MeasurableSet t → IndepSet (f ⁻¹' s) (g ⁻¹' t) κ μ := by
  refine' indepFun_iff_measure_inter_preimage_eq_mul.trans _
  

Proof state:
α : Type u_1
Ω : Type u_2
ι : Type u_3
β : Type u_4
β' : Type u_5
γ : Type u_6
γ' : Type u_7
_mα : MeasurableSpace α
_mΩ : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
f : Ω → β
g : Ω → β'
mβ : MeasurableSpace β
mβ' : MeasurableSpace β'
inst✝ : IsMarkovKernel κ
hf : Measurable f
hg : Measurable g
⊢ (∀ (s : Set β) (t : Set β'),
      MeasurableSet s →
        MeasurableSet t → ∀ᵐ (a : α) ∂μ, ↑↑(κ a) (f ⁻¹' s ∩ g ⁻¹' t) = ↑↑(κ a) (f ⁻¹' s) * ↑↑(κ a) (g ⁻¹' t)) ↔
    ∀ (s : Set β) (t : Set β'), MeasurableSet s → MeasurableSet t → IndepSet (f ⁻¹' s) (g ⁻¹' t) κ

Next tactic:
constructor
theorem indepFun_iff_indepSet_preimage {mβ : MeasurableSpace β} {mβ' : MeasurableSpace β'}
    [IsMarkovKernel κ] (hf : Measurable f) (hg : Measurable g) :
    IndepFun f g κ μ ↔
      ∀ s t, MeasurableSet s → MeasurableSet t → IndepSet (f ⁻¹' s) (g ⁻¹' t) κ μ := by
  refine' indepFun_iff_measure_inter_preimage_eq_mul.trans _
  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
_mα : MeasurableSpace α
_mΩ : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
f : Ω → β
g : Ω → β'
mβ : MeasurableSpace β
mβ' : MeasurableSpace β'
inst✝ : IsMarkovKernel κ
hf : Measurable f
hg : Measurable g
⊢ (∀ (s : Set β) (t : Set β'),
      MeasurableSet s →
        MeasurableSet t → ∀ᵐ (a : α) ∂μ, ↑↑(κ a) (f ⁻¹' s ∩ g ⁻¹' t) = ↑↑(κ a) (f ⁻¹' s) * ↑↑(κ a) (g ⁻¹' t)) →
    ∀ (s : Set β) (t : Set β'), MeasurableSet s → MeasurableSet t → IndepSet (f ⁻¹' s) (g ⁻¹' t) κ

Next tactic:
intro h s t hs ht
theorem indepFun_iff_indepSet_preimage {mβ : MeasurableSpace β} {mβ' : MeasurableSpace β'}
    [IsMarkovKernel κ] (hf : Measurable f) (hg : Measurable g) :
    IndepFun f g κ μ ↔
      ∀ s t, MeasurableSet s → MeasurableSet t → IndepSet (f ⁻¹' s) (g ⁻¹' t) κ μ := by
  refine' indepFun_iff_measure_inter_preimage_eq_mul.trans _
  constructor <;> 

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
_mα : MeasurableSpace α
_mΩ : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
f : Ω → β
g : Ω → β'
mβ : MeasurableSpace β
mβ' : MeasurableSpace β'
inst✝ : IsMarkovKernel κ
hf : Measurable f
hg : Measurable g
⊢ (∀ (s : Set β) (t : Set β'), MeasurableSet s → MeasurableSet t → IndepSet (f ⁻¹' s) (g ⁻¹' t) κ) →
    ∀ (s : Set β) (t : Set β'),
      MeasurableSet s →
        MeasurableSet t → ∀ᵐ (a : α) ∂μ, ↑↑(κ a) (f ⁻¹' s ∩ g ⁻¹' t) = ↑↑(κ a) (f ⁻¹' s) * ↑↑(κ a) (g ⁻¹' t)

Next tactic:
intro h s t hs ht
theorem indepFun_iff_indepSet_preimage {mβ : MeasurableSpace β} {mβ' : MeasurableSpace β'}
    [IsMarkovKernel κ] (hf : Measurable f) (hg : Measurable g) :
    IndepFun f g κ μ ↔
      ∀ s t, MeasurableSet s → MeasurableSet t → IndepSet (f ⁻¹' s) (g ⁻¹' t) κ μ := by
  refine' indepFun_iff_measure_inter_preimage_eq_mul.trans _
  constructor <;> intro h s t hs ht <;> 

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
_mα : MeasurableSpace α
_mΩ : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
f : Ω → β
g : Ω → β'
mβ : MeasurableSpace β
mβ' : MeasurableSpace β'
inst✝ : IsMarkovKernel κ
hf : Measurable f
hg : Measurable g
h :
  ∀ (s : Set β) (t : Set β'),
    MeasurableSet s →
      MeasurableSet t → ∀ᵐ (a : α) ∂μ, ↑↑(κ a) (f ⁻¹' s ∩ g ⁻¹' t) = ↑↑(κ a) (f ⁻¹' s) * ↑↑(κ a) (g ⁻¹' t)
s : Set β
t : Set β'
hs : MeasurableSet s
ht : MeasurableSet t
⊢ IndepSet (f ⁻¹' s) (g ⁻¹' t) κ

Next tactic:
specialize h s t hs ht
theorem indepFun_iff_indepSet_preimage {mβ : MeasurableSpace β} {mβ' : MeasurableSpace β'}
    [IsMarkovKernel κ] (hf : Measurable f) (hg : Measurable g) :
    IndepFun f g κ μ ↔
      ∀ s t, MeasurableSet s → MeasurableSet t → IndepSet (f ⁻¹' s) (g ⁻¹' t) κ μ := by
  refine' indepFun_iff_measure_inter_preimage_eq_mul.trans _
  constructor <;> 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
_mα : MeasurableSpace α
_mΩ : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
f : Ω → β
g : Ω → β'
mβ : MeasurableSpace β
mβ' : MeasurableSpace β'
inst✝ : IsMarkovKernel κ
hf : Measurable f
hg : Measurable g
h : ∀ (s : Set β) (t : Set β'), MeasurableSet s → MeasurableSet t → IndepSet (f ⁻¹' s) (g ⁻¹' t) κ
s : Set β
t : Set β'
hs : MeasurableSet s
ht : MeasurableSet t
⊢ ∀ᵐ (a : α) ∂μ, ↑↑(κ a) (f ⁻¹' s ∩ g ⁻¹' t) = ↑↑(κ a) (f ⁻¹' s) * ↑↑(κ a) (g ⁻¹' t)

Next tactic:
specialize h s t hs ht
theorem indepFun_iff_indepSet_preimage {mβ : MeasurableSpace β} {mβ' : MeasurableSpace β'}
    [IsMarkovKernel κ] (hf : Measurable f) (hg : Measurable g) :
    IndepFun f g κ μ ↔
      ∀ s t, MeasurableSet s → MeasurableSet t → IndepSet (f ⁻¹' s) (g ⁻¹' t) κ μ := by
  refine' indepFun_iff_measure_inter_preimage_eq_mul.trans _
  constructor <;> intro h s t hs ht <;> specialize h s t hs ht
  · 

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
_mα : MeasurableSpace α
_mΩ : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
f : Ω → β
g : Ω → β'
mβ : MeasurableSpace β
mβ' : MeasurableSpace β'
inst✝ : IsMarkovKernel κ
hf : Measurable f
hg : Measurable g
s : Set β
t : Set β'
hs : MeasurableSet s
ht : MeasurableSet t
h : ∀ᵐ (a : α) ∂μ, ↑↑(κ a) (f ⁻¹' s ∩ g ⁻¹' t) = ↑↑(κ a) (f ⁻¹' s) * ↑↑(κ a) (g ⁻¹' t)
⊢ IndepSet (f ⁻¹' s) (g ⁻¹' t) κ

Next tactic:
rwa [indepSet_iff_measure_inter_eq_mul (hf hs) (hg ht) κ μ]
theorem indepFun_iff_indepSet_preimage {mβ : MeasurableSpace β} {mβ' : MeasurableSpace β'}
    [IsMarkovKernel κ] (hf : Measurable f) (hg : Measurable g) :
    IndepFun f g κ μ ↔
      ∀ s t, MeasurableSet s → MeasurableSet t → IndepSet (f ⁻¹' s) (g ⁻¹' t) κ μ := by
  refine' indepFun_iff_measure_inter_preimage_eq_mul.trans _
  constructor <;> intro h s t hs ht <;> specialize h s t hs ht
  · rwa [indepSet_iff_measure_inter_eq_mul (hf hs) (hg 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
_mα : MeasurableSpace α
_mΩ : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
f : Ω → β
g : Ω → β'
mβ : MeasurableSpace β
mβ' : MeasurableSpace β'
inst✝ : IsMarkovKernel κ
hf : Measurable f
hg : Measurable g
s : Set β
t : Set β'
hs : MeasurableSet s
ht : MeasurableSet t
h : IndepSet (f ⁻¹' s) (g ⁻¹' t) κ
⊢ ∀ᵐ (a : α) ∂μ, ↑↑(κ a) (f ⁻¹' s ∩ g ⁻¹' t) = ↑↑(κ a) (f ⁻¹' s) * ↑↑(κ a) (g ⁻¹' t)

Next tactic:
rwa [← indepSet_iff_measure_inter_eq_mul (hf hs) (hg ht) κ μ]
theorem IndepFun.ae_eq {mβ : MeasurableSpace β} {f g f' g' : Ω → β} (hfg : IndepFun f g κ μ)
    (hf : ∀ᵐ a ∂μ, f =ᵐ[κ a] f') (hg : ∀ᵐ a ∂μ, g =ᵐ[κ a] 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
_mα : MeasurableSpace α
_mΩ : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
f✝ : Ω → β
g✝ : Ω → β'
mβ : MeasurableSpace β
f g f' g' : Ω → β
hfg : IndepFun f g κ
hf : ∀ᵐ (a : α) ∂μ, f =ᵐ[κ a] f'
hg : ∀ᵐ (a : α) ∂μ, g =ᵐ[κ a] g'
⊢ IndepFun f' g' κ

Next tactic:
rintro _ _ ⟨A, hA, rfl⟩ ⟨B, hB, rfl⟩
theorem IndepFun.ae_eq {mβ : MeasurableSpace β} {f g f' g' : Ω → β} (hfg : IndepFun f g κ μ)
    (hf : ∀ᵐ a ∂μ, f =ᵐ[κ a] f') (hg : ∀ᵐ a ∂μ, g =ᵐ[κ a] g') :
    IndepFun f' g' κ μ := by
  rintro _ _ ⟨A, hA, rfl⟩ ⟨B, hB, rfl⟩
  

Proof state:
case intro.intro.intro.intro
α : Type u_1
Ω : Type u_2
ι : Type u_3
β : Type u_4
β' : Type u_5
γ : Type u_6
γ' : Type u_7
_mα : MeasurableSpace α
_mΩ : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
f✝ : Ω → β
g✝ : Ω → β'
mβ : MeasurableSpace β
f g f' g' : Ω → β
hfg : IndepFun f g κ
hf : ∀ᵐ (a : α) ∂μ, f =ᵐ[κ a] f'
hg : ∀ᵐ (a : α) ∂μ, g =ᵐ[κ a] g'
A : Set β
hA : MeasurableSet A
B : Set β
hB : MeasurableSet B
⊢ ∀ᵐ (a : α) ∂μ, ↑↑(κ a) (f' ⁻¹' A ∩ g' ⁻¹' B) = ↑↑(κ a) (f' ⁻¹' A) * ↑↑(κ a) (g' ⁻¹' B)

Next tactic:
filter_upwards [hf, hg, hfg _ _ ⟨_, hA, rfl⟩ ⟨_, hB, rfl⟩] with a hf' hg' hfg'
theorem IndepFun.ae_eq {mβ : MeasurableSpace β} {f g f' g' : Ω → β} (hfg : IndepFun f g κ μ)
    (hf : ∀ᵐ a ∂μ, f =ᵐ[κ a] f') (hg : ∀ᵐ a ∂μ, g =ᵐ[κ a] g') :
    IndepFun f' g' κ μ := by
  rintro _ _ ⟨A, hA, rfl⟩ ⟨B, hB, rfl⟩
  filter_upwards [hf, hg, hfg _ _ ⟨_, hA, rfl⟩ ⟨_, hB, rfl⟩] with a hf' hg' hfg'
  

Proof state:
case h
α : Type u_1
Ω : Type u_2
ι : Type u_3
β : Type u_4
β' : Type u_5
γ : Type u_6
γ' : Type u_7
_mα : MeasurableSpace α
_mΩ : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
f✝ : Ω → β
g✝ : Ω → β'
mβ : MeasurableSpace β
f g f' g' : Ω → β
hfg : IndepFun f g κ
hf : ∀ᵐ (a : α) ∂μ, f =ᵐ[κ a] f'
hg : ∀ᵐ (a : α) ∂μ, g =ᵐ[κ a] g'
A : Set β
hA : MeasurableSet A
B : Set β
hB : MeasurableSet B
a : α
hf' : f =ᵐ[κ a] f'
hg' : g =ᵐ[κ a] g'
hfg' : ↑↑(κ a) (f ⁻¹' A ∩ g ⁻¹' B) = ↑↑(κ a) (f ⁻¹' A) * ↑↑(κ a) (g ⁻¹' B)
⊢ ↑↑(κ a) (f' ⁻¹' A ∩ g' ⁻¹' B) = ↑↑(κ a) (f' ⁻¹' A) * ↑↑(κ a) (g' ⁻¹' B)

Next tactic:
have h1 : f ⁻¹' A =ᵐ[κ a] f' ⁻¹' A := hf'.fun_comp A
theorem IndepFun.ae_eq {mβ : MeasurableSpace β} {f g f' g' : Ω → β} (hfg : IndepFun f g κ μ)
    (hf : ∀ᵐ a ∂μ, f =ᵐ[κ a] f') (hg : ∀ᵐ a ∂μ, g =ᵐ[κ a] g') :
    IndepFun f' g' κ μ := by
  rintro _ _ ⟨A, hA, rfl⟩ ⟨B, hB, rfl⟩
  filter_upwards [hf, hg, hfg _ _ ⟨_, hA, rfl⟩ ⟨_, hB, rfl⟩] with a hf' hg' hfg'
  have h1 : f ⁻¹' A =ᵐ[κ a] f' ⁻¹' A := hf'.fun_comp A
  

Proof state:
case h
α : Type u_1
Ω : Type u_2
ι : Type u_3
β : Type u_4
β' : Type u_5
γ : Type u_6
γ' : Type u_7
_mα : MeasurableSpace α
_mΩ : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
f✝ : Ω → β
g✝ : Ω → β'
mβ : MeasurableSpace β
f g f' g' : Ω → β
hfg : IndepFun f g κ
hf : ∀ᵐ (a : α) ∂μ, f =ᵐ[κ a] f'
hg : ∀ᵐ (a : α) ∂μ, g =ᵐ[κ a] g'
A : Set β
hA : MeasurableSet A
B : Set β
hB : MeasurableSet B
a : α
hf' : f =ᵐ[κ a] f'
hg' : g =ᵐ[κ a] g'
hfg' : ↑↑(κ a) (f ⁻¹' A ∩ g ⁻¹' B) = ↑↑(κ a) (f ⁻¹' A) * ↑↑(κ a) (g ⁻¹' B)
h1 : f ⁻¹' A =ᵐ[κ a] f' ⁻¹' A
⊢ ↑↑(κ a) (f' ⁻¹' A ∩ g' ⁻¹' B) = ↑↑(κ a) (f' ⁻¹' A) * ↑↑(κ a) (g' ⁻¹' B)

Next tactic:
have h2 : g ⁻¹' B =ᵐ[κ a] g' ⁻¹' B := hg'.fun_comp B
theorem IndepFun.ae_eq {mβ : MeasurableSpace β} {f g f' g' : Ω → β} (hfg : IndepFun f g κ μ)
    (hf : ∀ᵐ a ∂μ, f =ᵐ[κ a] f') (hg : ∀ᵐ a ∂μ, g =ᵐ[κ a] g') :
    IndepFun f' g' κ μ := by
  rintro _ _ ⟨A, hA, rfl⟩ ⟨B, hB, rfl⟩
  filter_upwards [hf, hg, hfg _ _ ⟨_, hA, rfl⟩ ⟨_, hB, rfl⟩] with a hf' hg' hfg'
  have h1 : f ⁻¹' A =ᵐ[κ a] f' ⁻¹' A := hf'.fun_comp A
  have h2 : g ⁻¹' B =ᵐ[κ a] g' ⁻¹' B := hg'.fun_comp B
  

Proof state:
case h
α : Type u_1
Ω : Type u_2
ι : Type u_3
β : Type u_4
β' : Type u_5
γ : Type u_6
γ' : Type u_7
_mα : MeasurableSpace α
_mΩ : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
f✝ : Ω → β
g✝ : Ω → β'
mβ : MeasurableSpace β
f g f' g' : Ω → β
hfg : IndepFun f g κ
hf : ∀ᵐ (a : α) ∂μ, f =ᵐ[κ a] f'
hg : ∀ᵐ (a : α) ∂μ, g =ᵐ[κ a] g'
A : Set β
hA : MeasurableSet A
B : Set β
hB : MeasurableSet B
a : α
hf' : f =ᵐ[κ a] f'
hg' : g =ᵐ[κ a] g'
hfg' : ↑↑(κ a) (f ⁻¹' A ∩ g ⁻¹' B) = ↑↑(κ a) (f ⁻¹' A) * ↑↑(κ a) (g ⁻¹' B)
h1 : f ⁻¹' A =ᵐ[κ a] f' ⁻¹' A
h2 : g ⁻¹' B =ᵐ[κ a] g' ⁻¹' B
⊢ ↑↑(κ a) (f' ⁻¹' A ∩ g' ⁻¹' B) = ↑↑(κ a) (f' ⁻¹' A) * ↑↑(κ a) (g' ⁻¹' B)

Next tactic:
rwa [← measure_congr h1, ← measure_congr h2, ← measure_congr (h1.inter h2)]
theorem IndepFun.comp {mβ : MeasurableSpace β} {mβ' : MeasurableSpace β'}
    {mγ : MeasurableSpace γ} {mγ' : MeasurableSpace γ'} {φ : β → γ} {ψ : β' → γ'}
    (hfg : IndepFun f g κ μ) (hφ : Measurable φ) (hψ : Measurable ψ) :
    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
_mα : MeasurableSpace α
_mΩ : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
f : Ω → β
g : Ω → β'
mβ : MeasurableSpace β
mβ' : MeasurableSpace β'
mγ : MeasurableSpace γ
mγ' : MeasurableSpace γ'
φ : β → γ
ψ : β' → γ'
hfg : IndepFun f g κ
hφ : Measurable φ
hψ : Measurable ψ
⊢ IndepFun (φ ∘ f) (ψ ∘ g) κ

Next tactic:
rintro _ _ ⟨A, hA, rfl⟩ ⟨B, hB, rfl⟩
theorem IndepFun.comp {mβ : MeasurableSpace β} {mβ' : MeasurableSpace β'}
    {mγ : MeasurableSpace γ} {mγ' : MeasurableSpace γ'} {φ : β → γ} {ψ : β' → γ'}
    (hfg : IndepFun f g κ μ) (hφ : Measurable φ) (hψ : Measurable ψ) :
    IndepFun (φ ∘ f) (ψ ∘ g) κ μ := by
  rintro _ _ ⟨A, hA, rfl⟩ ⟨B, hB, rfl⟩
  

Proof state:
case intro.intro.intro.intro
α : Type u_1
Ω : Type u_2
ι : Type u_3
β : Type u_4
β' : Type u_5
γ : Type u_6
γ' : Type u_7
_mα : MeasurableSpace α
_mΩ : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
f : Ω → β
g : Ω → β'
mβ : MeasurableSpace β
mβ' : MeasurableSpace β'
mγ : MeasurableSpace γ
mγ' : MeasurableSpace γ'
φ : β → γ
ψ : β' → γ'
hfg : IndepFun f g κ
hφ : Measurable φ
hψ : Measurable ψ
A : Set γ
hA : MeasurableSet A
B : Set γ'
hB : MeasurableSet B
⊢ ∀ᵐ (a : α) ∂μ, ↑↑(κ a) (φ ∘ f ⁻¹' A ∩ ψ ∘ g ⁻¹' B) = ↑↑(κ a) (φ ∘ f ⁻¹' A) * ↑↑(κ a) (ψ ∘ g ⁻¹' B)

Next tactic:
apply hfg
theorem IndepFun.comp {mβ : MeasurableSpace β} {mβ' : MeasurableSpace β'}
    {mγ : MeasurableSpace γ} {mγ' : MeasurableSpace γ'} {φ : β → γ} {ψ : β' → γ'}
    (hfg : IndepFun f g κ μ) (hφ : Measurable φ) (hψ : Measurable ψ) :
    IndepFun (φ ∘ f) (ψ ∘ g) κ μ := by
  rintro _ _ ⟨A, hA, rfl⟩ ⟨B, hB, rfl⟩
  apply hfg
  · 

Proof state:
case intro.intro.intro.intro.a
α : Type u_1
Ω : Type u_2
ι : Type u_3
β : Type u_4
β' : Type u_5
γ : Type u_6
γ' : Type u_7
_mα : MeasurableSpace α
_mΩ : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
f : Ω → β
g : Ω → β'
mβ : MeasurableSpace β
mβ' : MeasurableSpace β'
mγ : MeasurableSpace γ
mγ' : MeasurableSpace γ'
φ : β → γ
ψ : β' → γ'
hfg : IndepFun f g κ
hφ : Measurable φ
hψ : Measurable ψ
A : Set γ
hA : MeasurableSet A
B : Set γ'
hB : MeasurableSet B
⊢ φ ∘ f ⁻¹' A ∈ {s | MeasurableSet s}

Next tactic:
exact ⟨φ ⁻¹' A, hφ hA, Set.preimage_comp.symm⟩
theorem IndepFun.comp {mβ : MeasurableSpace β} {mβ' : MeasurableSpace β'}
    {mγ : MeasurableSpace γ} {mγ' : MeasurableSpace γ'} {φ : β → γ} {ψ : β' → γ'}
    (hfg : IndepFun f g κ μ) (hφ : Measurable φ) (hψ : Measurable ψ) :
    IndepFun (φ ∘ f) (ψ ∘ g) κ μ := by
  rintro _ _ ⟨A, hA, rfl⟩ ⟨B, hB, rfl⟩
  apply hfg
  · exact ⟨φ ⁻¹' A, hφ hA, Set.preimage_comp.symm⟩
  · 

Proof state:
case intro.intro.intro.intro.a
α : Type u_1
Ω : Type u_2
ι : Type u_3
β : Type u_4
β' : Type u_5
γ : Type u_6
γ' : Type u_7
_mα : MeasurableSpace α
_mΩ : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
f : Ω → β
g : Ω → β'
mβ : MeasurableSpace β
mβ' : MeasurableSpace β'
mγ : MeasurableSpace γ
mγ' : MeasurableSpace γ'
φ : β → γ
ψ : β' → γ'
hfg : IndepFun f g κ
hφ : Measurable φ
hψ : Measurable ψ
A : Set γ
hA : MeasurableSet A
B : Set γ'
hB : MeasurableSet B
⊢ ψ ∘ g ⁻¹' B ∈ {s | MeasurableSet s}

Next tactic:
exact ⟨ψ ⁻¹' B, hψ hB, Set.preimage_comp.symm⟩
@[nontriviality]
lemma iIndepFun.of_subsingleton [IsMarkovKernel κ] [Subsingleton ι] : iIndepFun m f κ μ := by
  

Proof state:
α : Type u_1
Ω : Type u_2
ι : Type u_3
β✝ : Type u_4
β' : Type u_5
γ : Type u_6
γ' : Type u_7
_mα : MeasurableSpace α
_mΩ : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
f✝ : Ω → β✝
g : Ω → β'
β : ι → Type u_8
m : (i : ι) → MeasurableSpace (β i)
f : (i : ι) → Ω → β i
inst✝¹ : IsMarkovKernel κ
inst✝ : Subsingleton ι
⊢ iIndepFun m f κ

Next tactic:
refine (iIndepFun_iff_measure_inter_preimage_eq_mul ..).2 fun s f' hf' ↦ ?_
@[nontriviality]
lemma iIndepFun.of_subsingleton [IsMarkovKernel κ] [Subsingleton ι] : iIndepFun m f κ μ := by
  refine (iIndepFun_iff_measure_inter_preimage_eq_mul ..).2 fun s f' hf' ↦ ?_
  

Proof state:
α : Type u_1
Ω : Type u_2
ι : Type u_3
β✝ : Type u_4
β' : Type u_5
γ : Type u_6
γ' : Type u_7
_mα : MeasurableSpace α
_mΩ : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
f✝ : Ω → β✝
g : Ω → β'
β : ι → Type u_8
m : (i : ι) → MeasurableSpace (β i)
f : (i : ι) → Ω → β i
inst✝¹ : IsMarkovKernel κ
inst✝ : Subsingleton ι
s : Finset ι
f' : (i : ι) → Set (β i)
hf' : ∀ i ∈ s, MeasurableSet (f' i)
⊢ ∀ᵐ (a : α) ∂μ, ↑↑(κ a) (⋂ i ∈ s, f i ⁻¹' f' i) = ∏ i in s, ↑↑(κ a) (f i ⁻¹' f' i)

Next tactic:
obtain rfl | ⟨x, hx⟩ := s.eq_empty_or_nonempty
@[nontriviality]
lemma iIndepFun.of_subsingleton [IsMarkovKernel κ] [Subsingleton ι] : iIndepFun m f κ μ := by
  refine (iIndepFun_iff_measure_inter_preimage_eq_mul ..).2 fun s f' hf' ↦ ?_
  obtain rfl | ⟨x, hx⟩ := s.eq_empty_or_nonempty
  · 

Proof state:
case inl
α : Type u_1
Ω : Type u_2
ι : Type u_3
β✝ : Type u_4
β' : Type u_5
γ : Type u_6
γ' : Type u_7
_mα : MeasurableSpace α
_mΩ : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
f✝ : Ω → β✝
g : Ω → β'
β : ι → Type u_8
m : (i : ι) → MeasurableSpace (β i)
f : (i : ι) → Ω → β i
inst✝¹ : IsMarkovKernel κ
inst✝ : Subsingleton ι
f' : (i : ι) → Set (β i)
hf' : ∀ i ∈ ∅, MeasurableSet (f' i)
⊢ ∀ᵐ (a : α) ∂μ, ↑↑(κ a) (⋂ i ∈ ∅, f i ⁻¹' f' i) = ∏ i in ∅, ↑↑(κ a) (f i ⁻¹' f' i)

Next tactic:
simp
@[nontriviality]
lemma iIndepFun.of_subsingleton [IsMarkovKernel κ] [Subsingleton ι] : iIndepFun m f κ μ := by
  refine (iIndepFun_iff_measure_inter_preimage_eq_mul ..).2 fun s f' hf' ↦ ?_
  obtain rfl | ⟨x, hx⟩ := s.eq_empty_or_nonempty
  · simp
  · 

Proof state:
case inr.intro
α : Type u_1
Ω : Type u_2
ι : Type u_3
β✝ : Type u_4
β' : Type u_5
γ : Type u_6
γ' : Type u_7
_mα : MeasurableSpace α
_mΩ : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
f✝ : Ω → β✝
g : Ω → β'
β : ι → Type u_8
m : (i : ι) → MeasurableSpace (β i)
f : (i : ι) → Ω → β i
inst✝¹ : IsMarkovKernel κ
inst✝ : Subsingleton ι
s : Finset ι
f' : (i : ι) → Set (β i)
hf' : ∀ i ∈ s, MeasurableSet (f' i)
x : ι
hx : x ∈ s
⊢ ∀ᵐ (a : α) ∂μ, ↑↑(κ a) (⋂ i ∈ s, f i ⁻¹' f' i) = ∏ i in s, ↑↑(κ a) (f i ⁻¹' f' i)

Next tactic:
have : s = {x} := by ext y; simp [Subsingleton.elim y x, hx]
@[nontriviality]
lemma iIndepFun.of_subsingleton [IsMarkovKernel κ] [Subsingleton ι] : iIndepFun m f κ μ := by
  refine (iIndepFun_iff_measure_inter_preimage_eq_mul ..).2 fun s f' hf' ↦ ?_
  obtain rfl | ⟨x, hx⟩ := s.eq_empty_or_nonempty
  · simp
  · have : s = {x} := by 

Proof state:
α : Type u_1
Ω : Type u_2
ι : Type u_3
β✝ : Type u_4
β' : Type u_5
γ : Type u_6
γ' : Type u_7
_mα : MeasurableSpace α
_mΩ : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
f✝ : Ω → β✝
g : Ω → β'
β : ι → Type u_8
m : (i : ι) → MeasurableSpace (β i)
f : (i : ι) → Ω → β i
inst✝¹ : IsMarkovKernel κ
inst✝ : Subsingleton ι
s : Finset ι
f' : (i : ι) → Set (β i)
hf' : ∀ i ∈ s, MeasurableSet (f' i)
x : ι
hx : x ∈ s
⊢ s = {x}

Next tactic:
ext y
@[nontriviality]
lemma iIndepFun.of_subsingleton [IsMarkovKernel κ] [Subsingleton ι] : iIndepFun m f κ μ := by
  refine (iIndepFun_iff_measure_inter_preimage_eq_mul ..).2 fun s f' hf' ↦ ?_
  obtain rfl | ⟨x, hx⟩ := s.eq_empty_or_nonempty
  · simp
  · have : s = {x} := by ext y; 

Proof state:
case a
α : Type u_1
Ω : Type u_2
ι : Type u_3
β✝ : Type u_4
β' : Type u_5
γ : Type u_6
γ' : Type u_7
_mα : MeasurableSpace α
_mΩ : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
f✝ : Ω → β✝
g : Ω → β'
β : ι → Type u_8
m : (i : ι) → MeasurableSpace (β i)
f : (i : ι) → Ω → β i
inst✝¹ : IsMarkovKernel κ
inst✝ : Subsingleton ι
s : Finset ι
f' : (i : ι) → Set (β i)
hf' : ∀ i ∈ s, MeasurableSet (f' i)
x : ι
hx : x ∈ s
y : ι
⊢ y ∈ s ↔ y ∈ {x}

Next tactic:
simp [Subsingleton.elim y x, hx]
@[nontriviality]
lemma iIndepFun.of_subsingleton [IsMarkovKernel κ] [Subsingleton ι] : iIndepFun m f κ μ := by
  refine (iIndepFun_iff_measure_inter_preimage_eq_mul ..).2 fun s f' hf' ↦ ?_
  obtain rfl | ⟨x, hx⟩ := s.eq_empty_or_nonempty
  · simp
  · have : s = {x} := by ext y; simp [Subsingleton.elim y x, hx]
    

Proof state:
case inr.intro
α : Type u_1
Ω : Type u_2
ι : Type u_3
β✝ : Type u_4
β' : Type u_5
γ : Type u_6
γ' : Type u_7
_mα : MeasurableSpace α
_mΩ : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
f✝ : Ω → β✝
g : Ω → β'
β : ι → Type u_8
m : (i : ι) → MeasurableSpace (β i)
f : (i : ι) → Ω → β i
inst✝¹ : IsMarkovKernel κ
inst✝ : Subsingleton ι
s : Finset ι
f' : (i : ι) → Set (β i)
hf' : ∀ i ∈ s, MeasurableSet (f' i)
x : ι
hx : x ∈ s
this : s = {x}
⊢ ∀ᵐ (a : α) ∂μ, ↑↑(κ a) (⋂ i ∈ s, f i ⁻¹' f' i) = ∏ i in s, ↑↑(κ a) (f i ⁻¹' f' i)

Next tactic:
simp [this]
lemma iIndepFun.ae_isProbabilityMeasure (h : iIndepFun m f κ μ) :
    ∀ᵐ a ∂μ, IsProbabilityMeasure (κ 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
_mα : MeasurableSpace α
_mΩ : MeasurableSpace Ω
κ : ↥(kernel α Ω)
μ : Measure α
f✝ : Ω → β✝
g : Ω → β'
β : ι → Type u_8
m : (i : ι) → MeasurableSpace (β i)
f : (i : ι) → Ω → β i
h : iIndepFun m f κ
⊢ ∀ᵐ (a : α) ∂μ, IsProbabilityMeasure (κ a)

Next tactic:
simpa [isProbabilityMeasure_iff] using h.meas_biInter (S := ∅) (s := fun _ ↦ Set.univ)