Theorem: ProbabilityTheory.iIndepFun.indepFun_finset_prod_of_not_mem
File: Mathlib/Probability/Independence/Basic.lean

tactic: classical
  have h_right : f i =
    (fun p : ∀ _j : ({i} : Finset ι), β => p ⟨i, Finset.mem_singleton_self i⟩) ∘
    fun a (j : ({i} : Finset ι)) => f j a := rfl
  have h_meas_right : Measurable fun p : ∀ _j : ({i} : Finset ι), β
    => p ⟨i, Finset.mem_singleton_self i⟩ := measurable_pi_apply ⟨i, Finset.mem_singleton_self i⟩
  have h_left : (∏ j in s, f j) = (fun p : ∀ _j : s, β => ∏ j, p j) ∘ fun a (j : s) => f j a := by
    ext1 a
    simp only [Function.comp_apply]
    have : (∏ j : ↥s, f (↑j) a) = (∏ j : ↥s, f ↑j) a := by rw [Finset.prod_apply]
    rw [this, Finset.prod_coe_sort]
  have h_meas_left : Measurable fun p : ∀ _j : s, β => ∏ j, p j :=
    Finset.univ.measurable_prod fun (j : ↥s) (_H : j ∈ Finset.univ) => measurable_pi_apply j
  rw [h_left, h_right]
  exact
    (hf_Indep.indepFun_finset s {i} (Finset.disjoint_singleton_left.mpr hi).symm hf_meas).comp
      h_meas_left h_meas_right
state_before: Ω : Type u_1
ι✝ : Type ?u.3559955
β✝ : Type ?u.3559958
β' : Type ?u.3559961
γ : Type ?u.3559964
γ' : Type ?u.3559967
mΩ : MeasurableSpace Ω
μ : MeasureTheory.Measure Ω
f✝ : Ω → β✝
g : Ω → β'
inst✝² : IsProbabilityMeasure μ
ι : Type u_2
β : Type u_3
m : MeasurableSpace β
inst✝¹ : CommMonoid β
inst✝ : MeasurableMul₂ β
f : ι → Ω → β
hf_Indep : iIndepFun (fun x => m) f
hf_meas : ∀ (i : ι), Measurable (f i)
s : Finset ι
i : ι
hi : ¬i ∈ s
⊢ IndepFun (∏ j in s, f j) (f i)

tactic: have h_right : f i =
  (fun p : ∀ _j : ({i} : Finset ι), β => p ⟨i, Finset.mem_singleton_self i⟩) ∘
  fun a (j : ({i} : Finset ι)) => f j a := rfl
state_before: Ω : Type u_1
ι✝ : Type ?u.3559955
β✝ : Type ?u.3559958
β' : Type ?u.3559961
γ : Type ?u.3559964
γ' : Type ?u.3559967
mΩ : MeasurableSpace Ω
μ : MeasureTheory.Measure Ω
f✝ : Ω → β✝
g : Ω → β'
inst✝² : IsProbabilityMeasure μ
ι : Type u_2
β : Type u_3
m : MeasurableSpace β
inst✝¹ : CommMonoid β
inst✝ : MeasurableMul₂ β
f : ι → Ω → β
hf_Indep : iIndepFun (fun x => m) f
hf_meas : ∀ (i : ι), Measurable (f i)
s : Finset ι
i : ι
hi : ¬i ∈ s
⊢ IndepFun (∏ j in s, f j) (f i)

tactic: have h_meas_right : Measurable fun p : ∀ _j : ({i} : Finset ι), β
  => p ⟨i, Finset.mem_singleton_self i⟩ := measurable_pi_apply ⟨i, Finset.mem_singleton_self i⟩
state_before: Ω : Type u_1
ι✝ : Type ?u.3559955
β✝ : Type ?u.3559958
β' : Type ?u.3559961
γ : Type ?u.3559964
γ' : Type ?u.3559967
mΩ : MeasurableSpace Ω
μ : MeasureTheory.Measure Ω
f✝ : Ω → β✝
g : Ω → β'
inst✝² : IsProbabilityMeasure μ
ι : Type u_2
β : Type u_3
m : MeasurableSpace β
inst✝¹ : CommMonoid β
inst✝ : MeasurableMul₂ β
f : ι → Ω → β
hf_Indep : iIndepFun (fun x => m) f
hf_meas : ∀ (i : ι), Measurable (f i)
s : Finset ι
i : ι
hi : ¬i ∈ s
h_right : f i = (fun p => p { val := i, property := (_ : i ∈ {i}) }) ∘ fun a j => f (↑j) a
⊢ IndepFun (∏ j in s, f j) (f i)

tactic: have h_left : (∏ j in s, f j) = (fun p : ∀ _j : s, β => ∏ j, p j) ∘ fun a (j : s) => f j a := by
  ext1 a
  simp only [Function.comp_apply]
  have : (∏ j : ↥s, f (↑j) a) = (∏ j : ↥s, f ↑j) a := by rw [Finset.prod_apply]
  rw [this, Finset.prod_coe_sort]
state_before: Ω : Type u_1
ι✝ : Type ?u.3559955
β✝ : Type ?u.3559958
β' : Type ?u.3559961
γ : Type ?u.3559964
γ' : Type ?u.3559967
mΩ : MeasurableSpace Ω
μ : MeasureTheory.Measure Ω
f✝ : Ω → β✝
g : Ω → β'
inst✝² : IsProbabilityMeasure μ
ι : Type u_2
β : Type u_3
m : MeasurableSpace β
inst✝¹ : CommMonoid β
inst✝ : MeasurableMul₂ β
f : ι → Ω → β
hf_Indep : iIndepFun (fun x => m) f
hf_meas : ∀ (i : ι), Measurable (f i)
s : Finset ι
i : ι
hi : ¬i ∈ s
h_right : f i = (fun p => p { val := i, property := (_ : i ∈ {i}) }) ∘ fun a j => f (↑j) a
h_meas_right : Measurable fun p => p { val := i, property := (_ : i ∈ {i}) }
⊢ IndepFun (∏ j in s, f j) (f i)

tactic: have h_meas_left : Measurable fun p : ∀ _j : s, β => ∏ j, p j :=
  Finset.univ.measurable_prod fun (j : ↥s) (_H : j ∈ Finset.univ) => measurable_pi_apply j
state_before: Ω : Type u_1
ι✝ : Type ?u.3559955
β✝ : Type ?u.3559958
β' : Type ?u.3559961
γ : Type ?u.3559964
γ' : Type ?u.3559967
mΩ : MeasurableSpace Ω
μ : MeasureTheory.Measure Ω
f✝ : Ω → β✝
g : Ω → β'
inst✝² : IsProbabilityMeasure μ
ι : Type u_2
β : Type u_3
m : MeasurableSpace β
inst✝¹ : CommMonoid β
inst✝ : MeasurableMul₂ β
f : ι → Ω → β
hf_Indep : iIndepFun (fun x => m) f
hf_meas : ∀ (i : ι), Measurable (f i)
s : Finset ι
i : ι
hi : ¬i ∈ s
h_right : f i = (fun p => p { val := i, property := (_ : i ∈ {i}) }) ∘ fun a j => f (↑j) a
h_meas_right : Measurable fun p => p { val := i, property := (_ : i ∈ {i}) }
h_left : ∏ j in s, f j = (fun p => ∏ j : { x // x ∈ s }, p j) ∘ fun a j => f (↑j) a
⊢ IndepFun (∏ j in s, f j) (f i)

tactic: rw [h_left, h_right]
state_before: Ω : Type u_1
ι✝ : Type ?u.3559955
β✝ : Type ?u.3559958
β' : Type ?u.3559961
γ : Type ?u.3559964
γ' : Type ?u.3559967
mΩ : MeasurableSpace Ω
μ : MeasureTheory.Measure Ω
f✝ : Ω → β✝
g : Ω → β'
inst✝² : IsProbabilityMeasure μ
ι : Type u_2
β : Type u_3
m : MeasurableSpace β
inst✝¹ : CommMonoid β
inst✝ : MeasurableMul₂ β
f : ι → Ω → β
hf_Indep : iIndepFun (fun x => m) f
hf_meas : ∀ (i : ι), Measurable (f i)
s : Finset ι
i : ι
hi : ¬i ∈ s
h_right : f i = (fun p => p { val := i, property := (_ : i ∈ {i}) }) ∘ fun a j => f (↑j) a
h_meas_right : Measurable fun p => p { val := i, property := (_ : i ∈ {i}) }
h_left : ∏ j in s, f j = (fun p => ∏ j : { x // x ∈ s }, p j) ∘ fun a j => f (↑j) a
h_meas_left : Measurable fun p => ∏ j : { x // x ∈ s }, p j
⊢ IndepFun (∏ j in s, f j) (f i)

tactic: exact
  (hf_Indep.indepFun_finset s {i} (Finset.disjoint_singleton_left.mpr hi).symm hf_meas).comp
    h_meas_left h_meas_right
state_before: Ω : Type u_1
ι✝ : Type ?u.3559955
β✝ : Type ?u.3559958
β' : Type ?u.3559961
γ : Type ?u.3559964
γ' : Type ?u.3559967
mΩ : MeasurableSpace Ω
μ : MeasureTheory.Measure Ω
f✝ : Ω → β✝
g : Ω → β'
inst✝² : IsProbabilityMeasure μ
ι : Type u_2
β : Type u_3
m : MeasurableSpace β
inst✝¹ : CommMonoid β
inst✝ : MeasurableMul₂ β
f : ι → Ω → β
hf_Indep : iIndepFun (fun x => m) f
hf_meas : ∀ (i : ι), Measurable (f i)
s : Finset ι
i : ι
hi : ¬i ∈ s
h_right : f i = (fun p => p { val := i, property := (_ : i ∈ {i}) }) ∘ fun a j => f (↑j) a
h_meas_right : Measurable fun p => p { val := i, property := (_ : i ∈ {i}) }
h_left : ∏ j in s, f j = (fun p => ∏ j : { x // x ∈ s }, p j) ∘ fun a j => f (↑j) a
h_meas_left : Measurable fun p => ∏ j : { x // x ∈ s }, p j
⊢ IndepFun ((fun p => ∏ j : { x // x ∈ s }, p j) ∘ fun a j => f (↑j) a)
    ((fun p => p { val := i, property := (_ : i ∈ {i}) }) ∘ fun a j => f (↑j) a)

tactic: ext1 a
state_before: Ω : Type u_1
ι✝ : Type ?u.3559955
β✝ : Type ?u.3559958
β' : Type ?u.3559961
γ : Type ?u.3559964
γ' : Type ?u.3559967
mΩ : MeasurableSpace Ω
μ : MeasureTheory.Measure Ω
f✝ : Ω → β✝
g : Ω → β'
inst✝² : IsProbabilityMeasure μ
ι : Type u_2
β : Type u_3
m : MeasurableSpace β
inst✝¹ : CommMonoid β
inst✝ : MeasurableMul₂ β
f : ι → Ω → β
hf_Indep : iIndepFun (fun x => m) f
hf_meas : ∀ (i : ι), Measurable (f i)
s : Finset ι
i : ι
hi : ¬i ∈ s
h_right : f i = (fun p => p { val := i, property := (_ : i ∈ {i}) }) ∘ fun a j => f (↑j) a
h_meas_right : Measurable fun p => p { val := i, property := (_ : i ∈ {i}) }
⊢ ∏ j in s, f j = (fun p => ∏ j : { x // x ∈ s }, p j) ∘ fun a j => f (↑j) a

tactic: simp only [Function.comp_apply]
state_before: case h
Ω : Type u_1
ι✝ : Type ?u.3559955
β✝ : Type ?u.3559958
β' : Type ?u.3559961
γ : Type ?u.3559964
γ' : Type ?u.3559967
mΩ : MeasurableSpace Ω
μ : MeasureTheory.Measure Ω
f✝ : Ω → β✝
g : Ω → β'
inst✝² : IsProbabilityMeasure μ
ι : Type u_2
β : Type u_3
m : MeasurableSpace β
inst✝¹ : CommMonoid β
inst✝ : MeasurableMul₂ β
f : ι → Ω → β
hf_Indep : iIndepFun (fun x => m) f
hf_meas : ∀ (i : ι), Measurable (f i)
s : Finset ι
i : ι
hi : ¬i ∈ s
h_right : f i = (fun p => p { val := i, property := (_ : i ∈ {i}) }) ∘ fun a j => f (↑j) a
h_meas_right : Measurable fun p => p { val := i, property := (_ : i ∈ {i}) }
a : Ω
⊢ Finset.prod s (fun j => f j) a = ((fun p => ∏ j : { x // x ∈ s }, p j) ∘ fun a j => f (↑j) a) a

tactic: have : (∏ j : ↥s, f (↑j) a) = (∏ j : ↥s, f ↑j) a := by rw [Finset.prod_apply]
state_before: case h
Ω : Type u_1
ι✝ : Type ?u.3559955
β✝ : Type ?u.3559958
β' : Type ?u.3559961
γ : Type ?u.3559964
γ' : Type ?u.3559967
mΩ : MeasurableSpace Ω
μ : MeasureTheory.Measure Ω
f✝ : Ω → β✝
g : Ω → β'
inst✝² : IsProbabilityMeasure μ
ι : Type u_2
β : Type u_3
m : MeasurableSpace β
inst✝¹ : CommMonoid β
inst✝ : MeasurableMul₂ β
f : ι → Ω → β
hf_Indep : iIndepFun (fun x => m) f
hf_meas : ∀ (i : ι), Measurable (f i)
s : Finset ι
i : ι
hi : ¬i ∈ s
h_right : f i = (fun p => p { val := i, property := (_ : i ∈ {i}) }) ∘ fun a j => f (↑j) a
h_meas_right : Measurable fun p => p { val := i, property := (_ : i ∈ {i}) }
a : Ω
⊢ Finset.prod s (fun j => f j) a = ∏ j : { x // x ∈ s }, f (↑j) a

tactic: rw [this, Finset.prod_coe_sort]
state_before: case h
Ω : Type u_1
ι✝ : Type ?u.3559955
β✝ : Type ?u.3559958
β' : Type ?u.3559961
γ : Type ?u.3559964
γ' : Type ?u.3559967
mΩ : MeasurableSpace Ω
μ : MeasureTheory.Measure Ω
f✝ : Ω → β✝
g : Ω → β'
inst✝² : IsProbabilityMeasure μ
ι : Type u_2
β : Type u_3
m : MeasurableSpace β
inst✝¹ : CommMonoid β
inst✝ : MeasurableMul₂ β
f : ι → Ω → β
hf_Indep : iIndepFun (fun x => m) f
hf_meas : ∀ (i : ι), Measurable (f i)
s : Finset ι
i : ι
hi : ¬i ∈ s
h_right : f i = (fun p => p { val := i, property := (_ : i ∈ {i}) }) ∘ fun a j => f (↑j) a
h_meas_right : Measurable fun p => p { val := i, property := (_ : i ∈ {i}) }
a : Ω
this : ∏ j : { x // x ∈ s }, f (↑j) a = Finset.prod Finset.univ (fun j => f ↑j) a
⊢ Finset.prod s (fun j => f j) a = ∏ j : { x // x ∈ s }, f (↑j) a

tactic: rw [Finset.prod_apply]
state_before: Ω : Type u_1
ι✝ : Type ?u.3559955
β✝ : Type ?u.3559958
β' : Type ?u.3559961
γ : Type ?u.3559964
γ' : Type ?u.3559967
mΩ : MeasurableSpace Ω
μ : MeasureTheory.Measure Ω
f✝ : Ω → β✝
g : Ω → β'
inst✝² : IsProbabilityMeasure μ
ι : Type u_2
β : Type u_3
m : MeasurableSpace β
inst✝¹ : CommMonoid β
inst✝ : MeasurableMul₂ β
f : ι → Ω → β
hf_Indep : iIndepFun (fun x => m) f
hf_meas : ∀ (i : ι), Measurable (f i)
s : Finset ι
i : ι
hi : ¬i ∈ s
h_right : f i = (fun p => p { val := i, property := (_ : i ∈ {i}) }) ∘ fun a j => f (↑j) a
h_meas_right : Measurable fun p => p { val := i, property := (_ : i ∈ {i}) }
a : Ω
⊢ ∏ j : { x // x ∈ s }, f (↑j) a = Finset.prod Finset.univ (fun j => f ↑j) a