-- Mathlib/MeasureTheory/Integral/SetIntegral.lean
theorem setIntegral_neg_eq_setIntegral_nonpos [LinearOrder E] {f : X → E}
    (hf : AEStronglyMeasurable f μ) :
    ∫ x in {x | f x < 0}, f x ∂μ = ∫ x in {x | f x ≤ 0}, f x ∂μ

Proof state:
X : Type u_1
E : Type u_3
mX : MeasurableSpace X
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedSpace ℝ E
μ : Measure X
inst✝ : LinearOrder E
f : X → E
hf : AEStronglyMeasurable f μ
h_union : {x | f x ≤ 0} = {x | f x < 0} ∪ {x | f x = 0}
⊢ ∫ (x : X) in {x | f x < 0}, f x ∂μ = ∫ (x : X) in {x | f x < 0} ∪ {x | f x = 0}, f x ∂μ

Tactic:
have B : NullMeasurableSet {x | f x = 0} μ :=
  hf.nullMeasurableSet_eq_fun aestronglyMeasurable_zero

Result:
X : Type u_1
E : Type u_3
mX : MeasurableSpace X
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedSpace ℝ E
μ : Measure X
inst✝ : LinearOrder E
f : X → E
hf : AEStronglyMeasurable f μ
h_union : {x | f x ≤ 0} = {x | f x < 0} ∪ {x | f x = 0}
B : NullMeasurableSet {x | f x = 0} μ
⊢ ∫ (x : X) in {x | f x < 0}, f x ∂μ = ∫ (x : X) in {x | f x < 0} ∪ {x | f x = 0}, f x ∂μ

Proof state:
X : Type u_1
E : Type u_3
mX : MeasurableSpace X
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedSpace ℝ E
μ : Measure X
inst✝ : LinearOrder E
f : X → E
hf : AEStronglyMeasurable f μ
h_union : {x | f x ≤ 0} = {x | f x < 0} ∪ {x | f x = 0}
B : NullMeasurableSet {x | f x = 0} μ
⊢ ∀ᵐ (x : X) ∂μ.restrict {x | f x = 0}, f x = 0

Tactic:
filter_upwards [ae_restrict_mem₀ B] with x hx using hx

Result:
no goals

Proof state:
X : Type u_1
E : Type u_3
mX : MeasurableSpace X
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedSpace ℝ E
μ : Measure X
inst✝ : LinearOrder E
f : X → E
hf : AEStronglyMeasurable f μ
h_union : {x | f x ≤ 0} = {x | f x < 0} ∪ {x | f x = 0}
⊢ ∫ (x : X) in {x | f x < 0}, f x ∂μ = ∫ (x : X) in {x | f x ≤ 0}, f x ∂μ

Tactic:
rw [h_union]

Result:
X : Type u_1
E : Type u_3
mX : MeasurableSpace X
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedSpace ℝ E
μ : Measure X
inst✝ : LinearOrder E
f : X → E
hf : AEStronglyMeasurable f μ
h_union : {x | f x ≤ 0} = {x | f x < 0} ∪ {x | f x = 0}
⊢ ∫ (x : X) in {x | f x < 0}, f x ∂μ = ∫ (x : X) in {x | f x < 0} ∪ {x | f x = 0}, f x ∂μ

Proof state:
X : Type u_1
E : Type u_3
mX : MeasurableSpace X
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedSpace ℝ E
μ : Measure X
inst✝ : LinearOrder E
f : X → E
hf : AEStronglyMeasurable f μ
⊢ ∫ (x : X) in {x | f x < 0}, f x ∂μ = ∫ (x : X) in {x | f x ≤ 0}, f x ∂μ

Tactic:
have h_union : {x | f x ≤ 0} = {x | f x < 0} ∪ {x | f x = 0} := by
  simp_rw [le_iff_lt_or_eq, setOf_or]

Result:
X : Type u_1
E : Type u_3
mX : MeasurableSpace X
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedSpace ℝ E
μ : Measure X
inst✝ : LinearOrder E
f : X → E
hf : AEStronglyMeasurable f μ
h_union : {x | f x ≤ 0} = {x | f x < 0} ∪ {x | f x = 0}
⊢ ∫ (x : X) in {x | f x < 0}, f x ∂μ = ∫ (x : X) in {x | f x ≤ 0}, f x ∂μ

Proof state:
X : Type u_1
E : Type u_3
mX : MeasurableSpace X
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedSpace ℝ E
μ : Measure X
inst✝ : LinearOrder E
f : X → E
hf : AEStronglyMeasurable f μ
⊢ {x | f x ≤ 0} = {x | f x < 0} ∪ {x | f x = 0}

Tactic:
simp_rw [le_iff_lt_or_eq, setOf_or]

Result:
no goals

Proof state:
X : Type u_1
E : Type u_3
mX : MeasurableSpace X
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedSpace ℝ E
μ : Measure X
inst✝ : LinearOrder E
f : X → E
hf : AEStronglyMeasurable f μ
h_union : {x | f x ≤ 0} = {x | f x < 0} ∪ {x | f x = 0}
B : NullMeasurableSet {x | f x = 0} μ
⊢ ∫ (x : X) in {x | f x < 0}, f x ∂μ = ∫ (x : X) in {x | f x < 0} ∪ {x | f x = 0}, f x ∂μ

Tactic:
symm

Result:
X : Type u_1
E : Type u_3
mX : MeasurableSpace X
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedSpace ℝ E
μ : Measure X
inst✝ : LinearOrder E
f : X → E
hf : AEStronglyMeasurable f μ
h_union : {x | f x ≤ 0} = {x | f x < 0} ∪ {x | f x = 0}
B : NullMeasurableSet {x | f x = 0} μ
⊢ ∫ (x : X) in {x | f x < 0} ∪ {x | f x = 0}, f x ∂μ = ∫ (x : X) in {x | f x < 0}, f x ∂μ

Proof state:
X : Type u_1
E : Type u_3
mX : MeasurableSpace X
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedSpace ℝ E
μ : Measure X
inst✝ : LinearOrder E
f : X → E
hf : AEStronglyMeasurable f μ
h_union : {x | f x ≤ 0} = {x | f x < 0} ∪ {x | f x = 0}
B : NullMeasurableSet {x | f x = 0} μ
⊢ ∫ (x : X) in {x | f x < 0} ∪ {x | f x = 0}, f x ∂μ = ∫ (x : X) in {x | f x < 0}, f x ∂μ

Tactic:
refine integral_union_eq_left_of_ae ?_

Result:
X : Type u_1
E : Type u_3
mX : MeasurableSpace X
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedSpace ℝ E
μ : Measure X
inst✝ : LinearOrder E
f : X → E
hf : AEStronglyMeasurable f μ
h_union : {x | f x ≤ 0} = {x | f x < 0} ∪ {x | f x = 0}
B : NullMeasurableSet {x | f x = 0} μ
⊢ ∀ᵐ (x : X) ∂μ.restrict {x | f x = 0}, f x = 0