Theorem: MeasureTheory.lmarginal_union
File: Mathlib/MeasureTheory/Integral/Marginal.lean

Proof steps:
state_before: δ : Type u_1
δ' : Type u_2
π : δ → Type u_3
inst✝² : (x : δ) → MeasurableSpace (π x)
μ : (i : δ) → Measure (π i)
inst✝¹ : ∀ (i : δ), SigmaFinite (μ i)
inst✝ : DecidableEq δ
s t : Finset δ
f✝ g : ((i : δ) → π i) → ℝ≥0∞
x y : (i : δ) → π i
i : δ
f : ((i : δ) → π i) → ℝ≥0∞
hf : Measurable f
hst : Disjoint s t
⊢ ∫⋯∫⁻_s ∪ t, f ∂μ = ∫⋯∫⁻_s, ∫⋯∫⁻_t, f ∂μ ∂μ
state_after: case h
δ : Type u_1
δ' : Type u_2
π : δ → Type u_3
inst✝² : (x : δ) → MeasurableSpace (π x)
μ : (i : δ) → Measure (π i)
inst✝¹ : ∀ (i : δ), SigmaFinite (μ i)
inst✝ : DecidableEq δ
s t : Finset δ
f✝ g : ((i : δ) → π i) → ℝ≥0∞
x✝ y : (i : δ) → π i
i : δ
f : ((i : δ) → π i) → ℝ≥0∞
hf : Measurable f
hst : Disjoint s t
x : (i : δ) → π i
⊢ (∫⋯∫⁻_s ∪ t, f ∂μ) x = (∫⋯∫⁻_s, ∫⋯∫⁻_t, f ∂μ ∂μ) x
tactic: ext1 x
state_before: case h
δ : Type u_1
δ' : Type u_2
π : δ → Type u_3
inst✝² : (x : δ) → MeasurableSpace (π x)
μ : (i : δ) → Measure (π i)
inst✝¹ : ∀ (i : δ), SigmaFinite (μ i)
inst✝ : DecidableEq δ
s t : Finset δ
f✝ g : ((i : δ) → π i) → ℝ≥0∞
x✝ y : (i : δ) → π i
i : δ
f : ((i : δ) → π i) → ℝ≥0∞
hf : Measurable f
hst : Disjoint s t
x : (i : δ) → π i
⊢ (∫⋯∫⁻_s ∪ t, f ∂μ) x = (∫⋯∫⁻_s, ∫⋯∫⁻_t, f ∂μ ∂μ) x
state_after: case h
δ : Type u_1
δ' : Type u_2
π : δ → Type u_3
inst✝² : (x : δ) → MeasurableSpace (π x)
μ : (i : δ) → Measure (π i)
inst✝¹ : ∀ (i : δ), SigmaFinite (μ i)
inst✝ : DecidableEq δ
s t : Finset δ
f✝ g : ((i : δ) → π i) → ℝ≥0∞
x✝ y : (i : δ) → π i
i : δ
f : ((i : δ) → π i) → ℝ≥0∞
hf : Measurable f
hst : Disjoint s t
x : (i : δ) → π i
e : ((i : { x // x ∈ s }) → π ↑i) × ((i : { x // x ∈ t }) → π ↑i) ≃ᵐ ((i : { x // x ∈ s ∪ t }) → π ↑i) :=
  MeasurableEquiv.piFinsetUnion π hst
⊢ (∫⋯∫⁻_s ∪ t, f ∂μ) x = (∫⋯∫⁻_s, ∫⋯∫⁻_t, f ∂μ ∂μ) x
tactic: let e := MeasurableEquiv.piFinsetUnion π hst
state_before: case h
δ : Type u_1
δ' : Type u_2
π : δ → Type u_3
inst✝² : (x : δ) → MeasurableSpace (π x)
μ : (i : δ) → Measure (π i)
inst✝¹ : ∀ (i : δ), SigmaFinite (μ i)
inst✝ : DecidableEq δ
s t : Finset δ
f✝ g : ((i : δ) → π i) → ℝ≥0∞
x✝ y : (i : δ) → π i
i : δ
f : ((i : δ) → π i) → ℝ≥0∞
hf : Measurable f
hst : Disjoint s t
x : (i : δ) → π i
e : ((i : { x // x ∈ s }) → π ↑i) × ((i : { x // x ∈ t }) → π ↑i) ≃ᵐ ((i : { x // x ∈ s ∪ t }) → π ↑i) :=
  MeasurableEquiv.piFinsetUnion π hst
⊢ (∫⋯∫⁻_s ∪ t, f ∂μ) x = (∫⋯∫⁻_s, ∫⋯∫⁻_t, f ∂μ ∂μ) x
state_after: no goals
tactic: calc (∫⋯∫⁻_s ∪ t, f ∂μ) x
      = ∫⁻ (y : (i : ↥(s ∪ t)) → π i), f (updateFinset x (s ∪ t) y)
          ∂.pi fun i' : ↥(s ∪ t) ↦ μ i' := rfl
    _ = ∫⁻ (y : ((i : s) → π i) × ((j : t) → π j)), f (updateFinset x (s ∪ t) _)
          ∂(Measure.pi fun i : s ↦ μ i).prod (.pi fun j : t ↦ μ j) := by
        rw [measurePreserving_piFinsetUnion hst μ |>.lintegral_map_equiv]
    _ = ∫⁻ (y : (i : s) → π i), ∫⁻ (z : (j : t) → π j), f (updateFinset x (s ∪ t) (e (y, z)))
          ∂.pi fun j : t ↦ μ j ∂.pi fun i : s ↦ μ i := by
        apply lintegral_prod
        apply Measurable.aemeasurable
        exact hf.comp <| measurable_updateFinset.comp e.measurable
    _ = (∫⋯∫⁻_s, ∫⋯∫⁻_t, f ∂μ ∂μ) x := by
        simp_rw [lmarginal, updateFinset_updateFinset hst]
        rfl