l3lab/ntp-mathlib huggingface dataset:
theorem lmarginal_update_of_mem {i : δ} (hi : i ∈ s)
    (f : (∀ i, π i) → ℝ≥0∞) (x : ∀ i, π i) (y : π i) :
    (∫⋯∫⁻_s, f ∂μ) (Function.update x i y) = (∫⋯∫⁻_s, f ∂μ) x := by
  apply lmarginal_congr
  intro j hj
  have : j ≠ i := by rintro rfl; 

Proof state:
δ : 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∞
x : (i : δ) → π i
j : δ
hj : j ∉ s
hi : j ∈ s
y : π j
⊢ False

Next tactic:
exact hj hi
theorem lmarginal_update_of_mem {i : δ} (hi : i ∈ s)
    (f : (∀ i, π i) → ℝ≥0∞) (x : ∀ i, π i) (y : π i) :
    (∫⋯∫⁻_s, f ∂μ) (Function.update x i y) = (∫⋯∫⁻_s, f ∂μ) x := by
  apply lmarginal_congr
  intro j hj
  have : j ≠ i := by rintro rfl; exact hj hi
  

Proof state:
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✝ i : δ
hi : i ∈ s
f : ((i : δ) → π i) → ℝ≥0∞
x : (i : δ) → π i
y : π i
j : δ
hj : j ∉ s
this : j ≠ i
⊢ update x i y j = x j

Next tactic:
apply update_noteq this
theorem lmarginal_union (f : (∀ i, π i) → ℝ≥0∞) (hf : Measurable f)
    (hst : Disjoint s t) : ∫⋯∫⁻_s ∪ t, f ∂μ = ∫⋯∫⁻_s, ∫⋯∫⁻_t, f ∂μ ∂μ := by
  

Proof state:
δ : 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 ∂μ ∂μ

Next tactic:
ext1 x
theorem lmarginal_union (f : (∀ i, π i) → ℝ≥0∞) (hf : Measurable f)
    (hst : Disjoint s t) : ∫⋯∫⁻_s ∪ t, f ∂μ = ∫⋯∫⁻_s, ∫⋯∫⁻_t, f ∂μ ∂μ := by
  ext1 x
  

Proof state:
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

Next tactic:
let e := MeasurableEquiv.piFinsetUnion π hst
theorem lmarginal_union (f : (∀ i, π i) → ℝ≥0∞) (hf : Measurable f)
    (hst : Disjoint s t) : ∫⋯∫⁻_s ∪ t, f ∂μ = ∫⋯∫⁻_s, ∫⋯∫⁻_t, f ∂μ ∂μ := by
  ext1 x
  let e := MeasurableEquiv.piFinsetUnion π hst
  

Proof state:
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

Next 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
theorem lmarginal_union (f : (∀ i, π i) → ℝ≥0∞) (hf : Measurable f)
    (hst : Disjoint s t) : ∫⋯∫⁻_s ∪ t, f ∂μ = ∫⋯∫⁻_s, ∫⋯∫⁻_t, f ∂μ ∂μ := by
  ext1 x
  let e := MeasurableEquiv.piFinsetUnion π hst
  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
        

Proof state:
δ : 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
⊢ (∫⁻ (y : (i : { x // x ∈ s ∪ t }) → π ↑i), f (updateFinset x (s ∪ t) y) ∂Measure.pi fun i' => μ ↑i') =
    ∫⁻ (y : ((i : { x // x ∈ s }) → π ↑i) × ((j : { x // x ∈ t }) → π ↑j)),
      f (updateFinset x (s ∪ t) (?m.66050 y)) ∂Measure.prod (Measure.pi fun i => μ ↑i) (Measure.pi fun j => μ ↑j)

Next tactic:
rw [measurePreserving_piFinsetUnion hst μ |>.lintegral_map_equiv]
theorem lmarginal_union (f : (∀ i, π i) → ℝ≥0∞) (hf : Measurable f)
    (hst : Disjoint s t) : ∫⋯∫⁻_s ∪ t, f ∂μ = ∫⋯∫⁻_s, ∫⋯∫⁻_t, f ∂μ ∂μ := by
  ext1 x
  let e := MeasurableEquiv.piFinsetUnion π hst
  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
        

Proof state:
δ : 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
⊢ ∫⁻ (y : ((i : { x // x ∈ s }) → π ↑i) × ((j : { x // x ∈ t }) → π ↑j)),
      f
        (updateFinset x (s ∪ t)
          ((MeasurableEquiv.piFinsetUnion (fun i => π i) hst)
            y)) ∂Measure.prod (Measure.pi fun i => μ ↑i) (Measure.pi fun j => μ ↑j) =
    ∫⁻ (y : (i : { x // x ∈ s }) → π ↑i),
      ∫⁻ (z : (j : { x // x ∈ t }) → π ↑j),
        f (updateFinset x (s ∪ t) (e (y, z))) ∂Measure.pi fun j => μ ↑j ∂Measure.pi fun i => μ ↑i

Next tactic:
apply lintegral_prod
theorem lmarginal_union (f : (∀ i, π i) → ℝ≥0∞) (hf : Measurable f)
    (hst : Disjoint s t) : ∫⋯∫⁻_s ∪ t, f ∂μ = ∫⋯∫⁻_s, ∫⋯∫⁻_t, f ∂μ ∂μ := by
  ext1 x
  let e := MeasurableEquiv.piFinsetUnion π hst
  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
        

Proof state:
case hf
δ : 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
⊢ AEMeasurable fun z => f (updateFinset x (s ∪ t) ((MeasurableEquiv.piFinsetUnion (fun i => π i) hst) z))

Next tactic:
apply Measurable.aemeasurable
theorem lmarginal_union (f : (∀ i, π i) → ℝ≥0∞) (hf : Measurable f)
    (hst : Disjoint s t) : ∫⋯∫⁻_s ∪ t, f ∂μ = ∫⋯∫⁻_s, ∫⋯∫⁻_t, f ∂μ ∂μ := by
  ext1 x
  let e := MeasurableEquiv.piFinsetUnion π hst
  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
        

Proof state:
case hf.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
⊢ Measurable fun z => f (updateFinset x (s ∪ t) ((MeasurableEquiv.piFinsetUnion (fun i => π i) hst) z))

Next tactic:
exact hf.comp <| measurable_updateFinset.comp e.measurable
theorem lmarginal_union (f : (∀ i, π i) → ℝ≥0∞) (hf : Measurable f)
    (hst : Disjoint s t) : ∫⋯∫⁻_s ∪ t, f ∂μ = ∫⋯∫⁻_s, ∫⋯∫⁻_t, f ∂μ ∂μ := by
  ext1 x
  let e := MeasurableEquiv.piFinsetUnion π hst
  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
        

Proof state:
δ : 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
⊢ (∫⁻ (y : (i : { x // x ∈ s }) → π ↑i),
      ∫⁻ (z : (j : { x // x ∈ t }) → π ↑j),
        f (updateFinset x (s ∪ t) (e (y, z))) ∂Measure.pi fun j => μ ↑j ∂Measure.pi fun i => μ ↑i) =
    (∫⋯∫⁻_s, ∫⋯∫⁻_t, f ∂μ ∂μ) x

Next tactic:
simp_rw [lmarginal, updateFinset_updateFinset hst]
theorem lmarginal_union (f : (∀ i, π i) → ℝ≥0∞) (hf : Measurable f)
    (hst : Disjoint s t) : ∫⋯∫⁻_s ∪ t, f ∂μ = ∫⋯∫⁻_s, ∫⋯∫⁻_t, f ∂μ ∂μ := by
  ext1 x
  let e := MeasurableEquiv.piFinsetUnion π hst
  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]
        

Proof state:
δ : 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
⊢ (∫⁻ (y : (i : { x // x ∈ s }) → π ↑i),
      ∫⁻ (z : (j : { x // x ∈ t }) → π ↑j),
        f
          (updateFinset x (s ∪ t)
            ((MeasurableEquiv.piFinsetUnion π hst) (y, z))) ∂Measure.pi fun j => μ ↑j ∂Measure.pi fun i => μ ↑i) =
    ∫⁻ (y : (i : { x // x ∈ s }) → π ↑i),
      ∫⁻ (y_1 : (i : { x // x ∈ t }) → π ↑i),
        f
          (updateFinset x (s ∪ t)
            ((piFinsetUnion (fun i => π i) hst) (y, y_1))) ∂Measure.pi fun j => μ ↑j ∂Measure.pi fun i => μ ↑i

Next tactic:
rfl
theorem lmarginal_union' (f : (∀ i, π i) → ℝ≥0∞) (hf : Measurable f) {s t : Finset δ}
    (hst : Disjoint s t) : ∫⋯∫⁻_s ∪ t, f ∂μ = ∫⋯∫⁻_t, ∫⋯∫⁻_s, f ∂μ ∂μ := by
  

Proof state:
δ : 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
s t : Finset δ
hst : Disjoint s t
⊢ ∫⋯∫⁻_s ∪ t, f ∂μ = ∫⋯∫⁻_t, ∫⋯∫⁻_s, f ∂μ ∂μ

Next tactic:
rw [Finset.union_comm, lmarginal_union μ f hf hst.symm]
theorem lmarginal_singleton (f : (∀ i, π i) → ℝ≥0∞) (i : δ) :
    ∫⋯∫⁻_{i}, f ∂μ = fun x => ∫⁻ xᵢ, f (Function.update x i xᵢ) ∂μ i := by
  

Proof state:
δ : 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∞
i : δ
⊢ ∫⋯∫⁻_{i}, f ∂μ = fun x => ∫⁻ (xᵢ : π i), f (update x i xᵢ) ∂μ i

Next tactic:
let α : Type _ := ({i} : Finset δ)
theorem lmarginal_singleton (f : (∀ i, π i) → ℝ≥0∞) (i : δ) :
    ∫⋯∫⁻_{i}, f ∂μ = fun x => ∫⁻ xᵢ, f (Function.update x i xᵢ) ∂μ i := by
  let α : Type _ := ({i} : Finset δ)
  

Proof state:
δ : 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∞
i : δ
α : Type u_1 := { x // x ∈ {i} }
⊢ ∫⋯∫⁻_{i}, f ∂μ = fun x => ∫⁻ (xᵢ : π i), f (update x i xᵢ) ∂μ i

Next tactic:
let e := (MeasurableEquiv.piUnique fun j : α ↦ π j).symm
theorem lmarginal_singleton (f : (∀ i, π i) → ℝ≥0∞) (i : δ) :
    ∫⋯∫⁻_{i}, f ∂μ = fun x => ∫⁻ xᵢ, f (Function.update x i xᵢ) ∂μ i := by
  let α : Type _ := ({i} : Finset δ)
  let e := (MeasurableEquiv.piUnique fun j : α ↦ π j).symm
  

Proof state:
δ : 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∞
i : δ
α : Type u_1 := { x // x ∈ {i} }
e : π ↑default ≃ᵐ ((i_1 : α) → π ↑i_1) := (MeasurableEquiv.piUnique fun j => π ↑j).symm
⊢ ∫⋯∫⁻_{i}, f ∂μ = fun x => ∫⁻ (xᵢ : π i), f (update x i xᵢ) ∂μ i

Next tactic:
ext1 x
theorem lmarginal_singleton (f : (∀ i, π i) → ℝ≥0∞) (i : δ) :
    ∫⋯∫⁻_{i}, f ∂μ = fun x => ∫⁻ xᵢ, f (Function.update x i xᵢ) ∂μ i := by
  let α : Type _ := ({i} : Finset δ)
  let e := (MeasurableEquiv.piUnique fun j : α ↦ π j).symm
  ext1 x
  

Proof state:
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∞
i : δ
α : Type u_1 := { x // x ∈ {i} }
e : π ↑default ≃ᵐ ((i_1 : α) → π ↑i_1) := (MeasurableEquiv.piUnique fun j => π ↑j).symm
x : (i : δ) → π i
⊢ (∫⋯∫⁻_{i}, f ∂μ) x = ∫⁻ (xᵢ : π i), f (update x i xᵢ) ∂μ i

Next tactic:
calc (∫⋯∫⁻_{i}, f ∂μ) x
      = ∫⁻ (y : π (default : α)), f (updateFinset x {i} (e y)) ∂μ (default : α) := by
        simp_rw [lmarginal, measurePreserving_piUnique (fun j : ({i} : Finset δ) ↦ μ j) |>.symm _
          |>.lintegral_map_equiv]
    _ = ∫⁻ xᵢ, f (Function.update x i xᵢ) ∂μ i := by simp [update_eq_updateFinset]; rfl
theorem lmarginal_singleton (f : (∀ i, π i) → ℝ≥0∞) (i : δ) :
    ∫⋯∫⁻_{i}, f ∂μ = fun x => ∫⁻ xᵢ, f (Function.update x i xᵢ) ∂μ i := by
  let α : Type _ := ({i} : Finset δ)
  let e := (MeasurableEquiv.piUnique fun j : α ↦ π j).symm
  ext1 x
  calc (∫⋯∫⁻_{i}, f ∂μ) x
      = ∫⁻ (y : π (default : α)), f (updateFinset x {i} (e y)) ∂μ (default : α) := by
        

Proof state:
δ : 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∞
i : δ
α : Type u_1 := { x // x ∈ {i} }
e : π ↑default ≃ᵐ ((i_1 : α) → π ↑i_1) := (MeasurableEquiv.piUnique fun j => π ↑j).symm
x : (i : δ) → π i
⊢ (∫⋯∫⁻_{i}, f ∂μ) x = ∫⁻ (y : π ↑default), f (updateFinset x {i} (e y)) ∂μ ↑default

Next tactic:
simp_rw [lmarginal, measurePreserving_piUnique (fun j : ({i} : Finset δ) ↦ μ j) |>.symm _
          |>.lintegral_map_equiv]
theorem lmarginal_singleton (f : (∀ i, π i) → ℝ≥0∞) (i : δ) :
    ∫⋯∫⁻_{i}, f ∂μ = fun x => ∫⁻ xᵢ, f (Function.update x i xᵢ) ∂μ i := by
  let α : Type _ := ({i} : Finset δ)
  let e := (MeasurableEquiv.piUnique fun j : α ↦ π j).symm
  ext1 x
  calc (∫⋯∫⁻_{i}, f ∂μ) x
      = ∫⁻ (y : π (default : α)), f (updateFinset x {i} (e y)) ∂μ (default : α) := by
        simp_rw [lmarginal, measurePreserving_piUnique (fun j : ({i} : Finset δ) ↦ μ j) |>.symm _
          |>.lintegral_map_equiv]
    _ = ∫⁻ xᵢ, f (Function.update x i xᵢ) ∂μ i := by 

Proof state:
δ : 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∞
i : δ
α : Type u_1 := { x // x ∈ {i} }
e : π ↑default ≃ᵐ ((i_1 : α) → π ↑i_1) := (MeasurableEquiv.piUnique fun j => π ↑j).symm
x : (i : δ) → π i
⊢ ∫⁻ (y : π ↑default), f (updateFinset x {i} (e y)) ∂μ ↑default = ∫⁻ (xᵢ : π i), f (update x i xᵢ) ∂μ i

Next tactic:
simp [update_eq_updateFinset]
theorem lmarginal_singleton (f : (∀ i, π i) → ℝ≥0∞) (i : δ) :
    ∫⋯∫⁻_{i}, f ∂μ = fun x => ∫⁻ xᵢ, f (Function.update x i xᵢ) ∂μ i := by
  let α : Type _ := ({i} : Finset δ)
  let e := (MeasurableEquiv.piUnique fun j : α ↦ π j).symm
  ext1 x
  calc (∫⋯∫⁻_{i}, f ∂μ) x
      = ∫⁻ (y : π (default : α)), f (updateFinset x {i} (e y)) ∂μ (default : α) := by
        simp_rw [lmarginal, measurePreserving_piUnique (fun j : ({i} : Finset δ) ↦ μ j) |>.symm _
          |>.lintegral_map_equiv]
    _ = ∫⁻ xᵢ, f (Function.update x i xᵢ) ∂μ i := by simp [update_eq_updateFinset]; 

Proof state:
δ : 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∞
i : δ
α : Type u_1 := { x // x ∈ {i} }
e : π ↑default ≃ᵐ ((i_1 : α) → π ↑i_1) := (MeasurableEquiv.piUnique fun j => π ↑j).symm
x : (i : δ) → π i
⊢ ∫⁻ (y : π i), f (updateFinset x {i} ((MeasurableEquiv.piUnique fun j => π ↑j).symm y)) ∂μ i =
    ∫⁻ (xᵢ : π i), f (updateFinset x {i} (uniqueElim xᵢ)) ∂μ i

Next tactic:
rfl
/-- Peel off a single integral from a `lmarginal` integral at the beginning (compare with
`lmarginal_insert'`, which peels off an integral at the end). -/
theorem lmarginal_insert (f : (∀ i, π i) → ℝ≥0∞) (hf : Measurable f) {i : δ}
    (hi : i ∉ s) (x : ∀ i, π i) :
    (∫⋯∫⁻_insert i s, f ∂μ) x = ∫⁻ xᵢ, (∫⋯∫⁻_s, f ∂μ) (Function.update x i xᵢ) ∂μ i := by
  

Proof state:
δ : 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
i : δ
hi : i ∉ s
x : (i : δ) → π i
⊢ (∫⋯∫⁻_insert i s, f ∂μ) x = ∫⁻ (xᵢ : π i), (∫⋯∫⁻_s, f ∂μ) (update x i xᵢ) ∂μ i

Next tactic:
rw [Finset.insert_eq, lmarginal_union μ f hf (Finset.disjoint_singleton_left.mpr hi),
    lmarginal_singleton]
/-- Peel off a single integral from a `lmarginal` integral at the beginning (compare with
`lmarginal_erase'`, which peels off an integral at the end). -/
theorem lmarginal_erase (f : (∀ i, π i) → ℝ≥0∞) (hf : Measurable f) {i : δ}
    (hi : i ∈ s) (x : ∀ i, π i) :
    (∫⋯∫⁻_s, f ∂μ) x = ∫⁻ xᵢ, (∫⋯∫⁻_(erase s i), f ∂μ) (Function.update x i xᵢ) ∂μ i := by
  

Proof state:
δ : 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
i : δ
hi : i ∈ s
x : (i : δ) → π i
⊢ (∫⋯∫⁻_s, f ∂μ) x = ∫⁻ (xᵢ : π i), (∫⋯∫⁻_erase s i, f ∂μ) (update x i xᵢ) ∂μ i

Next tactic:
simpa [insert_erase hi] using lmarginal_insert _ hf (not_mem_erase i s) x
/-- Peel off a single integral from a `lmarginal` integral at the end (compare with
`lmarginal_insert`, which peels off an integral at the beginning). -/
theorem lmarginal_insert' (f : (∀ i, π i) → ℝ≥0∞) (hf : Measurable f) {i : δ}
    (hi : i ∉ s) :
    ∫⋯∫⁻_insert i s, f ∂μ = ∫⋯∫⁻_s, (fun x ↦ ∫⁻ xᵢ, f (Function.update x i xᵢ) ∂μ i) ∂μ := by
  

Proof state:
δ : 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
i : δ
hi : i ∉ s
⊢ ∫⋯∫⁻_insert i s, f ∂μ = ∫⋯∫⁻_s, fun x => ∫⁻ (xᵢ : π i), f (update x i xᵢ) ∂μ i ∂μ

Next tactic:
rw [Finset.insert_eq, Finset.union_comm,
    lmarginal_union (s := s) μ f hf (Finset.disjoint_singleton_right.mpr hi), lmarginal_singleton]
/-- Peel off a single integral from a `lmarginal` integral at the end (compare with
`lmarginal_erase`, which peels off an integral at the beginning). -/
theorem lmarginal_erase' (f : (∀ i, π i) → ℝ≥0∞) (hf : Measurable f) {i : δ}
    (hi : i ∈ s) :
    ∫⋯∫⁻_s, f ∂μ = ∫⋯∫⁻_(erase s i), (fun x ↦ ∫⁻ xᵢ, f (Function.update x i xᵢ) ∂μ i) ∂μ := by
  

Proof state:
δ : 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
i : δ
hi : i ∈ s
⊢ ∫⋯∫⁻_s, f ∂μ = ∫⋯∫⁻_erase s i, fun x => ∫⁻ (xᵢ : π i), f (update x i xᵢ) ∂μ i ∂μ

Next tactic:
simpa [insert_erase hi] using lmarginal_insert' _ hf (not_mem_erase i s)