l3lab/ntp-mathlib huggingface dataset:
/-- If a function equals zero almost everywhere w.r.t. restriction of the measure to `sᶜ`, then its
integral on `s` coincides with its integral on the whole space. -/
lemma set_integral_eq_integral_of_ae_restrict_eq_zero (hs : f =ᵐ[μ.restrict sᶜ] 0) :
    ∫ ω in s, f ω ∂μ = ∫ ω, f ω ∂μ := by
  borelize E
  refine set_integral_eq_integral_of_ae_compl_eq_zero ?_
  

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
hs : f =ᵐ[Measure.restrict μ sᶜ] 0
this✝¹ : MeasurableSpace E := borel E
this✝ : BorelSpace E
⊢ ∀ᵐ (x : α) ∂μ, x ∉ s → f x = 0

Next tactic:
have f_mble : NullMeasurable f (μ.restrict sᶜ) :=
    NullMeasurable.congr measurable_const.nullMeasurable hs.symm
/-- If a function equals zero almost everywhere w.r.t. restriction of the measure to `sᶜ`, then its
integral on `s` coincides with its integral on the whole space. -/
lemma set_integral_eq_integral_of_ae_restrict_eq_zero (hs : f =ᵐ[μ.restrict sᶜ] 0) :
    ∫ ω in s, f ω ∂μ = ∫ ω, f ω ∂μ := by
  borelize E
  refine set_integral_eq_integral_of_ae_compl_eq_zero ?_
  have f_mble : NullMeasurable f (μ.restrict sᶜ) :=
    NullMeasurable.congr measurable_const.nullMeasurable hs.symm
  

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
hs : f =ᵐ[Measure.restrict μ sᶜ] 0
this✝¹ : MeasurableSpace E := borel E
this✝ : BorelSpace E
f_mble : NullMeasurable f
⊢ ∀ᵐ (x : α) ∂μ, x ∉ s → f x = 0

Next tactic:
simpa only [mem_compl_iff] using (ae_restrict_eq_const_iff_ae_eq_const_of_mem 0 f_mble).mp hs
theorem set_integral_neg_eq_set_integral_nonpos [LinearOrder E] {f : α → E}
    (hf : AEStronglyMeasurable f μ) :
    ∫ x in {x | f x < 0}, f x ∂μ = ∫ x in {x | f x ≤ 0}, f x ∂μ := by
  

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝³ : MeasurableSpace α
inst✝² : NormedAddCommGroup E
f✝ g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝¹ : NormedSpace ℝ E
inst✝ : LinearOrder E
f : α → E
hf : AEStronglyMeasurable f μ
⊢ ∫ (x : α) in {x | f x < 0}, f x ∂μ = ∫ (x : α) in {x | f x ≤ 0}, f x ∂μ

Next tactic:
have h_union : {x | f x ≤ 0} = {x | f x < 0} ∪ {x | f x = 0} := by
    ext; simp_rw [Set.mem_union, Set.mem_setOf_eq]; exact le_iff_lt_or_eq
theorem set_integral_neg_eq_set_integral_nonpos [LinearOrder E] {f : α → E}
    (hf : AEStronglyMeasurable f μ) :
    ∫ x in {x | f x < 0}, f x ∂μ = ∫ x in {x | f x ≤ 0}, f x ∂μ := by
  have h_union : {x | f x ≤ 0} = {x | f x < 0} ∪ {x | f x = 0} := by
    

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝³ : MeasurableSpace α
inst✝² : NormedAddCommGroup E
f✝ g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝¹ : NormedSpace ℝ E
inst✝ : LinearOrder E
f : α → E
hf : AEStronglyMeasurable f μ
⊢ {x | f x ≤ 0} = {x | f x < 0} ∪ {x | f x = 0}

Next tactic:
ext
theorem set_integral_neg_eq_set_integral_nonpos [LinearOrder E] {f : α → E}
    (hf : AEStronglyMeasurable f μ) :
    ∫ x in {x | f x < 0}, f x ∂μ = ∫ x in {x | f x ≤ 0}, f x ∂μ := by
  have h_union : {x | f x ≤ 0} = {x | f x < 0} ∪ {x | f x = 0} := by
    ext; 

Proof state:
case h
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝³ : MeasurableSpace α
inst✝² : NormedAddCommGroup E
f✝ g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝¹ : NormedSpace ℝ E
inst✝ : LinearOrder E
f : α → E
hf : AEStronglyMeasurable f μ
x✝ : α
⊢ x✝ ∈ {x | f x ≤ 0} ↔ x✝ ∈ {x | f x < 0} ∪ {x | f x = 0}

Next tactic:
simp_rw [Set.mem_union, Set.mem_setOf_eq]
theorem set_integral_neg_eq_set_integral_nonpos [LinearOrder E] {f : α → E}
    (hf : AEStronglyMeasurable f μ) :
    ∫ x in {x | f x < 0}, f x ∂μ = ∫ x in {x | f x ≤ 0}, f x ∂μ := by
  have h_union : {x | f x ≤ 0} = {x | f x < 0} ∪ {x | f x = 0} := by
    ext; simp_rw [Set.mem_union, Set.mem_setOf_eq]; 

Proof state:
case h
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝³ : MeasurableSpace α
inst✝² : NormedAddCommGroup E
f✝ g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝¹ : NormedSpace ℝ E
inst✝ : LinearOrder E
f : α → E
hf : AEStronglyMeasurable f μ
x✝ : α
⊢ f x✝ ≤ 0 ↔ f x✝ < 0 ∨ f x✝ = 0

Next tactic:
exact le_iff_lt_or_eq
theorem set_integral_neg_eq_set_integral_nonpos [LinearOrder E] {f : α → E}
    (hf : AEStronglyMeasurable f μ) :
    ∫ x in {x | f x < 0}, f x ∂μ = ∫ x in {x | f x ≤ 0}, f x ∂μ := by
  have h_union : {x | f x ≤ 0} = {x | f x < 0} ∪ {x | f x = 0} := by
    ext; simp_rw [Set.mem_union, Set.mem_setOf_eq]; exact le_iff_lt_or_eq
  

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝³ : MeasurableSpace α
inst✝² : NormedAddCommGroup E
f✝ g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝¹ : NormedSpace ℝ E
inst✝ : LinearOrder E
f : α → E
hf : AEStronglyMeasurable f μ
h_union : {x | f x ≤ 0} = {x | f x < 0} ∪ {x | f x = 0}
⊢ ∫ (x : α) in {x | f x < 0}, f x ∂μ = ∫ (x : α) in {x | f x ≤ 0}, f x ∂μ

Next tactic:
rw [h_union]
theorem set_integral_neg_eq_set_integral_nonpos [LinearOrder E] {f : α → E}
    (hf : AEStronglyMeasurable f μ) :
    ∫ x in {x | f x < 0}, f x ∂μ = ∫ x in {x | f x ≤ 0}, f x ∂μ := by
  have h_union : {x | f x ≤ 0} = {x | f x < 0} ∪ {x | f x = 0} := by
    ext; simp_rw [Set.mem_union, Set.mem_setOf_eq]; exact le_iff_lt_or_eq
  rw [h_union]
  

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝³ : MeasurableSpace α
inst✝² : NormedAddCommGroup E
f✝ g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝¹ : NormedSpace ℝ E
inst✝ : LinearOrder E
f : α → E
hf : AEStronglyMeasurable f μ
h_union : {x | f x ≤ 0} = {x | f x < 0} ∪ {x | f x = 0}
⊢ ∫ (x : α) in {x | f x < 0}, f x ∂μ = ∫ (x : α) in {x | f x < 0} ∪ {x | f x = 0}, f x ∂μ

Next tactic:
have B : NullMeasurableSet {x | f x = 0} μ :=
    hf.nullMeasurableSet_eq_fun aestronglyMeasurable_zero
theorem set_integral_neg_eq_set_integral_nonpos [LinearOrder E] {f : α → E}
    (hf : AEStronglyMeasurable f μ) :
    ∫ x in {x | f x < 0}, f x ∂μ = ∫ x in {x | f x ≤ 0}, f x ∂μ := by
  have h_union : {x | f x ≤ 0} = {x | f x < 0} ∪ {x | f x = 0} := by
    ext; simp_rw [Set.mem_union, Set.mem_setOf_eq]; exact le_iff_lt_or_eq
  rw [h_union]
  have B : NullMeasurableSet {x | f x = 0} μ :=
    hf.nullMeasurableSet_eq_fun aestronglyMeasurable_zero
  

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝³ : MeasurableSpace α
inst✝² : NormedAddCommGroup E
f✝ g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝¹ : NormedSpace ℝ E
inst✝ : LinearOrder E
f : α → 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 : α) in {x | f x < 0}, f x ∂μ = ∫ (x : α) in {x | f x < 0} ∪ {x | f x = 0}, f x ∂μ

Next tactic:
symm
theorem set_integral_neg_eq_set_integral_nonpos [LinearOrder E] {f : α → E}
    (hf : AEStronglyMeasurable f μ) :
    ∫ x in {x | f x < 0}, f x ∂μ = ∫ x in {x | f x ≤ 0}, f x ∂μ := by
  have h_union : {x | f x ≤ 0} = {x | f x < 0} ∪ {x | f x = 0} := by
    ext; simp_rw [Set.mem_union, Set.mem_setOf_eq]; exact le_iff_lt_or_eq
  rw [h_union]
  have B : NullMeasurableSet {x | f x = 0} μ :=
    hf.nullMeasurableSet_eq_fun aestronglyMeasurable_zero
  symm
  

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝³ : MeasurableSpace α
inst✝² : NormedAddCommGroup E
f✝ g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝¹ : NormedSpace ℝ E
inst✝ : LinearOrder E
f : α → 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 : α) in {x | f x < 0} ∪ {x | f x = 0}, f x ∂μ = ∫ (x : α) in {x | f x < 0}, f x ∂μ

Next tactic:
refine' integral_union_eq_left_of_ae _
theorem set_integral_neg_eq_set_integral_nonpos [LinearOrder E] {f : α → E}
    (hf : AEStronglyMeasurable f μ) :
    ∫ x in {x | f x < 0}, f x ∂μ = ∫ x in {x | f x ≤ 0}, f x ∂μ := by
  have h_union : {x | f x ≤ 0} = {x | f x < 0} ∪ {x | f x = 0} := by
    ext; simp_rw [Set.mem_union, Set.mem_setOf_eq]; exact le_iff_lt_or_eq
  rw [h_union]
  have B : NullMeasurableSet {x | f x = 0} μ :=
    hf.nullMeasurableSet_eq_fun aestronglyMeasurable_zero
  symm
  refine' integral_union_eq_left_of_ae _
  

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝³ : MeasurableSpace α
inst✝² : NormedAddCommGroup E
f✝ g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝¹ : NormedSpace ℝ E
inst✝ : LinearOrder E
f : α → 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 : α) ∂Measure.restrict μ {x | f x = 0}, f x = 0

Next tactic:
filter_upwards [ae_restrict_mem₀ B] with x hx using hx
theorem integral_norm_eq_pos_sub_neg {f : α → ℝ} (hfi : Integrable f μ) :
    ∫ x, ‖f x‖ ∂μ = (∫ x in {x | 0 ≤ f x}, f x ∂μ) - ∫ x in {x | f x ≤ 0}, f x ∂μ :=
  have h_meas : NullMeasurableSet {x | 0 ≤ f x} μ :=
    aestronglyMeasurable_const.nullMeasurableSet_le hfi.1
  calc
    ∫ x, ‖f x‖ ∂μ = (∫ x in {x | 0 ≤ f x}, ‖f x‖ ∂μ) + ∫ x in {x | 0 ≤ f x}ᶜ, ‖f x‖ ∂μ := by
      

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f✝ g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
f : α → ℝ
hfi : Integrable f
h_meas : NullMeasurableSet {x | 0 ≤ f x}
⊢ ∫ (x : α), ‖f x‖ ∂μ = ∫ (x : α) in {x | 0 ≤ f x}, ‖f x‖ ∂μ + ∫ (x : α) in {x | 0 ≤ f x}ᶜ, ‖f x‖ ∂μ

Next tactic:
rw [← integral_add_compl₀ h_meas hfi.norm]
theorem integral_norm_eq_pos_sub_neg {f : α → ℝ} (hfi : Integrable f μ) :
    ∫ x, ‖f x‖ ∂μ = (∫ x in {x | 0 ≤ f x}, f x ∂μ) - ∫ x in {x | f x ≤ 0}, f x ∂μ :=
  have h_meas : NullMeasurableSet {x | 0 ≤ f x} μ :=
    aestronglyMeasurable_const.nullMeasurableSet_le hfi.1
  calc
    ∫ x, ‖f x‖ ∂μ = (∫ x in {x | 0 ≤ f x}, ‖f x‖ ∂μ) + ∫ x in {x | 0 ≤ f x}ᶜ, ‖f x‖ ∂μ := by
      rw [← integral_add_compl₀ h_meas hfi.norm]
    _ = (∫ x in {x | 0 ≤ f x}, f x ∂μ) + ∫ x in {x | 0 ≤ f x}ᶜ, ‖f x‖ ∂μ := by
      

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f✝ g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
f : α → ℝ
hfi : Integrable f
h_meas : NullMeasurableSet {x | 0 ≤ f x}
⊢ ∫ (x : α) in {x | 0 ≤ f x}, ‖f x‖ ∂μ + ∫ (x : α) in {x | 0 ≤ f x}ᶜ, ‖f x‖ ∂μ =
    ∫ (x : α) in {x | 0 ≤ f x}, f x ∂μ + ∫ (x : α) in {x | 0 ≤ f x}ᶜ, ‖f x‖ ∂μ

Next tactic:
congr 1
theorem integral_norm_eq_pos_sub_neg {f : α → ℝ} (hfi : Integrable f μ) :
    ∫ x, ‖f x‖ ∂μ = (∫ x in {x | 0 ≤ f x}, f x ∂μ) - ∫ x in {x | f x ≤ 0}, f x ∂μ :=
  have h_meas : NullMeasurableSet {x | 0 ≤ f x} μ :=
    aestronglyMeasurable_const.nullMeasurableSet_le hfi.1
  calc
    ∫ x, ‖f x‖ ∂μ = (∫ x in {x | 0 ≤ f x}, ‖f x‖ ∂μ) + ∫ x in {x | 0 ≤ f x}ᶜ, ‖f x‖ ∂μ := by
      rw [← integral_add_compl₀ h_meas hfi.norm]
    _ = (∫ x in {x | 0 ≤ f x}, f x ∂μ) + ∫ x in {x | 0 ≤ f x}ᶜ, ‖f x‖ ∂μ := by
      congr 1
      

Proof state:
case e_a
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f✝ g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
f : α → ℝ
hfi : Integrable f
h_meas : NullMeasurableSet {x | 0 ≤ f x}
⊢ ∫ (x : α) in {x | 0 ≤ f x}, ‖f x‖ ∂μ = ∫ (x : α) in {x | 0 ≤ f x}, f x ∂μ

Next tactic:
refine' set_integral_congr₀ h_meas fun x hx => _
theorem integral_norm_eq_pos_sub_neg {f : α → ℝ} (hfi : Integrable f μ) :
    ∫ x, ‖f x‖ ∂μ = (∫ x in {x | 0 ≤ f x}, f x ∂μ) - ∫ x in {x | f x ≤ 0}, f x ∂μ :=
  have h_meas : NullMeasurableSet {x | 0 ≤ f x} μ :=
    aestronglyMeasurable_const.nullMeasurableSet_le hfi.1
  calc
    ∫ x, ‖f x‖ ∂μ = (∫ x in {x | 0 ≤ f x}, ‖f x‖ ∂μ) + ∫ x in {x | 0 ≤ f x}ᶜ, ‖f x‖ ∂μ := by
      rw [← integral_add_compl₀ h_meas hfi.norm]
    _ = (∫ x in {x | 0 ≤ f x}, f x ∂μ) + ∫ x in {x | 0 ≤ f x}ᶜ, ‖f x‖ ∂μ := by
      congr 1
      refine' set_integral_congr₀ h_meas fun x hx => _
      

Proof state:
case e_a
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f✝ g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
f : α → ℝ
hfi : Integrable f
h_meas : NullMeasurableSet {x | 0 ≤ f x}
x : α
hx : x ∈ {x | 0 ≤ f x}
⊢ ‖f x‖ = f x

Next tactic:
dsimp only
theorem integral_norm_eq_pos_sub_neg {f : α → ℝ} (hfi : Integrable f μ) :
    ∫ x, ‖f x‖ ∂μ = (∫ x in {x | 0 ≤ f x}, f x ∂μ) - ∫ x in {x | f x ≤ 0}, f x ∂μ :=
  have h_meas : NullMeasurableSet {x | 0 ≤ f x} μ :=
    aestronglyMeasurable_const.nullMeasurableSet_le hfi.1
  calc
    ∫ x, ‖f x‖ ∂μ = (∫ x in {x | 0 ≤ f x}, ‖f x‖ ∂μ) + ∫ x in {x | 0 ≤ f x}ᶜ, ‖f x‖ ∂μ := by
      rw [← integral_add_compl₀ h_meas hfi.norm]
    _ = (∫ x in {x | 0 ≤ f x}, f x ∂μ) + ∫ x in {x | 0 ≤ f x}ᶜ, ‖f x‖ ∂μ := by
      congr 1
      refine' set_integral_congr₀ h_meas fun x hx => _
      dsimp only
      

Proof state:
case e_a
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f✝ g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
f : α → ℝ
hfi : Integrable f
h_meas : NullMeasurableSet {x | 0 ≤ f x}
x : α
hx : x ∈ {x | 0 ≤ f x}
⊢ ‖f x‖ = f x

Next tactic:
rw [Real.norm_eq_abs, abs_eq_self.mpr _]
theorem integral_norm_eq_pos_sub_neg {f : α → ℝ} (hfi : Integrable f μ) :
    ∫ x, ‖f x‖ ∂μ = (∫ x in {x | 0 ≤ f x}, f x ∂μ) - ∫ x in {x | f x ≤ 0}, f x ∂μ :=
  have h_meas : NullMeasurableSet {x | 0 ≤ f x} μ :=
    aestronglyMeasurable_const.nullMeasurableSet_le hfi.1
  calc
    ∫ x, ‖f x‖ ∂μ = (∫ x in {x | 0 ≤ f x}, ‖f x‖ ∂μ) + ∫ x in {x | 0 ≤ f x}ᶜ, ‖f x‖ ∂μ := by
      rw [← integral_add_compl₀ h_meas hfi.norm]
    _ = (∫ x in {x | 0 ≤ f x}, f x ∂μ) + ∫ x in {x | 0 ≤ f x}ᶜ, ‖f x‖ ∂μ := by
      congr 1
      refine' set_integral_congr₀ h_meas fun x hx => _
      dsimp only
      rw [Real.norm_eq_abs, abs_eq_self.mpr _]
      

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f✝ g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
f : α → ℝ
hfi : Integrable f
h_meas : NullMeasurableSet {x | 0 ≤ f x}
x : α
hx : x ∈ {x | 0 ≤ f x}
⊢ 0 ≤ f x

Next tactic:
exact hx
theorem integral_norm_eq_pos_sub_neg {f : α → ℝ} (hfi : Integrable f μ) :
    ∫ x, ‖f x‖ ∂μ = (∫ x in {x | 0 ≤ f x}, f x ∂μ) - ∫ x in {x | f x ≤ 0}, f x ∂μ :=
  have h_meas : NullMeasurableSet {x | 0 ≤ f x} μ :=
    aestronglyMeasurable_const.nullMeasurableSet_le hfi.1
  calc
    ∫ x, ‖f x‖ ∂μ = (∫ x in {x | 0 ≤ f x}, ‖f x‖ ∂μ) + ∫ x in {x | 0 ≤ f x}ᶜ, ‖f x‖ ∂μ := by
      rw [← integral_add_compl₀ h_meas hfi.norm]
    _ = (∫ x in {x | 0 ≤ f x}, f x ∂μ) + ∫ x in {x | 0 ≤ f x}ᶜ, ‖f x‖ ∂μ := by
      congr 1
      refine' set_integral_congr₀ h_meas fun x hx => _
      dsimp only
      rw [Real.norm_eq_abs, abs_eq_self.mpr _]
      exact hx
    _ = (∫ x in {x | 0 ≤ f x}, f x ∂μ) - ∫ x in {x | 0 ≤ f x}ᶜ, f x ∂μ := by
      

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f✝ g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
f : α → ℝ
hfi : Integrable f
h_meas : NullMeasurableSet {x | 0 ≤ f x}
⊢ ∫ (x : α) in {x | 0 ≤ f x}, f x ∂μ + ∫ (x : α) in {x | 0 ≤ f x}ᶜ, ‖f x‖ ∂μ =
    ∫ (x : α) in {x | 0 ≤ f x}, f x ∂μ - ∫ (x : α) in {x | 0 ≤ f x}ᶜ, f x ∂μ

Next tactic:
congr 1
theorem integral_norm_eq_pos_sub_neg {f : α → ℝ} (hfi : Integrable f μ) :
    ∫ x, ‖f x‖ ∂μ = (∫ x in {x | 0 ≤ f x}, f x ∂μ) - ∫ x in {x | f x ≤ 0}, f x ∂μ :=
  have h_meas : NullMeasurableSet {x | 0 ≤ f x} μ :=
    aestronglyMeasurable_const.nullMeasurableSet_le hfi.1
  calc
    ∫ x, ‖f x‖ ∂μ = (∫ x in {x | 0 ≤ f x}, ‖f x‖ ∂μ) + ∫ x in {x | 0 ≤ f x}ᶜ, ‖f x‖ ∂μ := by
      rw [← integral_add_compl₀ h_meas hfi.norm]
    _ = (∫ x in {x | 0 ≤ f x}, f x ∂μ) + ∫ x in {x | 0 ≤ f x}ᶜ, ‖f x‖ ∂μ := by
      congr 1
      refine' set_integral_congr₀ h_meas fun x hx => _
      dsimp only
      rw [Real.norm_eq_abs, abs_eq_self.mpr _]
      exact hx
    _ = (∫ x in {x | 0 ≤ f x}, f x ∂μ) - ∫ x in {x | 0 ≤ f x}ᶜ, f x ∂μ := by
      congr 1
      

Proof state:
case e_a
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f✝ g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
f : α → ℝ
hfi : Integrable f
h_meas : NullMeasurableSet {x | 0 ≤ f x}
⊢ ∫ (x : α) in {x | 0 ≤ f x}ᶜ, ‖f x‖ ∂μ = -∫ (x : α) in {x | 0 ≤ f x}ᶜ, f x ∂μ

Next tactic:
rw [← integral_neg]
theorem integral_norm_eq_pos_sub_neg {f : α → ℝ} (hfi : Integrable f μ) :
    ∫ x, ‖f x‖ ∂μ = (∫ x in {x | 0 ≤ f x}, f x ∂μ) - ∫ x in {x | f x ≤ 0}, f x ∂μ :=
  have h_meas : NullMeasurableSet {x | 0 ≤ f x} μ :=
    aestronglyMeasurable_const.nullMeasurableSet_le hfi.1
  calc
    ∫ x, ‖f x‖ ∂μ = (∫ x in {x | 0 ≤ f x}, ‖f x‖ ∂μ) + ∫ x in {x | 0 ≤ f x}ᶜ, ‖f x‖ ∂μ := by
      rw [← integral_add_compl₀ h_meas hfi.norm]
    _ = (∫ x in {x | 0 ≤ f x}, f x ∂μ) + ∫ x in {x | 0 ≤ f x}ᶜ, ‖f x‖ ∂μ := by
      congr 1
      refine' set_integral_congr₀ h_meas fun x hx => _
      dsimp only
      rw [Real.norm_eq_abs, abs_eq_self.mpr _]
      exact hx
    _ = (∫ x in {x | 0 ≤ f x}, f x ∂μ) - ∫ x in {x | 0 ≤ f x}ᶜ, f x ∂μ := by
      congr 1
      rw [← integral_neg]
      

Proof state:
case e_a
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f✝ g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
f : α → ℝ
hfi : Integrable f
h_meas : NullMeasurableSet {x | 0 ≤ f x}
⊢ ∫ (x : α) in {x | 0 ≤ f x}ᶜ, ‖f x‖ ∂μ = ∫ (a : α) in {x | 0 ≤ f x}ᶜ, -f a ∂μ

Next tactic:
refine' set_integral_congr₀ h_meas.compl fun x hx => _
theorem integral_norm_eq_pos_sub_neg {f : α → ℝ} (hfi : Integrable f μ) :
    ∫ x, ‖f x‖ ∂μ = (∫ x in {x | 0 ≤ f x}, f x ∂μ) - ∫ x in {x | f x ≤ 0}, f x ∂μ :=
  have h_meas : NullMeasurableSet {x | 0 ≤ f x} μ :=
    aestronglyMeasurable_const.nullMeasurableSet_le hfi.1
  calc
    ∫ x, ‖f x‖ ∂μ = (∫ x in {x | 0 ≤ f x}, ‖f x‖ ∂μ) + ∫ x in {x | 0 ≤ f x}ᶜ, ‖f x‖ ∂μ := by
      rw [← integral_add_compl₀ h_meas hfi.norm]
    _ = (∫ x in {x | 0 ≤ f x}, f x ∂μ) + ∫ x in {x | 0 ≤ f x}ᶜ, ‖f x‖ ∂μ := by
      congr 1
      refine' set_integral_congr₀ h_meas fun x hx => _
      dsimp only
      rw [Real.norm_eq_abs, abs_eq_self.mpr _]
      exact hx
    _ = (∫ x in {x | 0 ≤ f x}, f x ∂μ) - ∫ x in {x | 0 ≤ f x}ᶜ, f x ∂μ := by
      congr 1
      rw [← integral_neg]
      refine' set_integral_congr₀ h_meas.compl fun x hx => _
      

Proof state:
case e_a
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f✝ g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
f : α → ℝ
hfi : Integrable f
h_meas : NullMeasurableSet {x | 0 ≤ f x}
x : α
hx : x ∈ {x | 0 ≤ f x}ᶜ
⊢ ‖f x‖ = -f x

Next tactic:
dsimp only
theorem integral_norm_eq_pos_sub_neg {f : α → ℝ} (hfi : Integrable f μ) :
    ∫ x, ‖f x‖ ∂μ = (∫ x in {x | 0 ≤ f x}, f x ∂μ) - ∫ x in {x | f x ≤ 0}, f x ∂μ :=
  have h_meas : NullMeasurableSet {x | 0 ≤ f x} μ :=
    aestronglyMeasurable_const.nullMeasurableSet_le hfi.1
  calc
    ∫ x, ‖f x‖ ∂μ = (∫ x in {x | 0 ≤ f x}, ‖f x‖ ∂μ) + ∫ x in {x | 0 ≤ f x}ᶜ, ‖f x‖ ∂μ := by
      rw [← integral_add_compl₀ h_meas hfi.norm]
    _ = (∫ x in {x | 0 ≤ f x}, f x ∂μ) + ∫ x in {x | 0 ≤ f x}ᶜ, ‖f x‖ ∂μ := by
      congr 1
      refine' set_integral_congr₀ h_meas fun x hx => _
      dsimp only
      rw [Real.norm_eq_abs, abs_eq_self.mpr _]
      exact hx
    _ = (∫ x in {x | 0 ≤ f x}, f x ∂μ) - ∫ x in {x | 0 ≤ f x}ᶜ, f x ∂μ := by
      congr 1
      rw [← integral_neg]
      refine' set_integral_congr₀ h_meas.compl fun x hx => _
      dsimp only
      

Proof state:
case e_a
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f✝ g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
f : α → ℝ
hfi : Integrable f
h_meas : NullMeasurableSet {x | 0 ≤ f x}
x : α
hx : x ∈ {x | 0 ≤ f x}ᶜ
⊢ ‖f x‖ = -f x

Next tactic:
rw [Real.norm_eq_abs, abs_eq_neg_self.mpr _]
theorem integral_norm_eq_pos_sub_neg {f : α → ℝ} (hfi : Integrable f μ) :
    ∫ x, ‖f x‖ ∂μ = (∫ x in {x | 0 ≤ f x}, f x ∂μ) - ∫ x in {x | f x ≤ 0}, f x ∂μ :=
  have h_meas : NullMeasurableSet {x | 0 ≤ f x} μ :=
    aestronglyMeasurable_const.nullMeasurableSet_le hfi.1
  calc
    ∫ x, ‖f x‖ ∂μ = (∫ x in {x | 0 ≤ f x}, ‖f x‖ ∂μ) + ∫ x in {x | 0 ≤ f x}ᶜ, ‖f x‖ ∂μ := by
      rw [← integral_add_compl₀ h_meas hfi.norm]
    _ = (∫ x in {x | 0 ≤ f x}, f x ∂μ) + ∫ x in {x | 0 ≤ f x}ᶜ, ‖f x‖ ∂μ := by
      congr 1
      refine' set_integral_congr₀ h_meas fun x hx => _
      dsimp only
      rw [Real.norm_eq_abs, abs_eq_self.mpr _]
      exact hx
    _ = (∫ x in {x | 0 ≤ f x}, f x ∂μ) - ∫ x in {x | 0 ≤ f x}ᶜ, f x ∂μ := by
      congr 1
      rw [← integral_neg]
      refine' set_integral_congr₀ h_meas.compl fun x hx => _
      dsimp only
      rw [Real.norm_eq_abs, abs_eq_neg_self.mpr _]
      

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f✝ g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
f : α → ℝ
hfi : Integrable f
h_meas : NullMeasurableSet {x | 0 ≤ f x}
x : α
hx : x ∈ {x | 0 ≤ f x}ᶜ
⊢ f x ≤ 0

Next tactic:
rw [Set.mem_compl_iff, Set.nmem_setOf_iff] at hx
theorem integral_norm_eq_pos_sub_neg {f : α → ℝ} (hfi : Integrable f μ) :
    ∫ x, ‖f x‖ ∂μ = (∫ x in {x | 0 ≤ f x}, f x ∂μ) - ∫ x in {x | f x ≤ 0}, f x ∂μ :=
  have h_meas : NullMeasurableSet {x | 0 ≤ f x} μ :=
    aestronglyMeasurable_const.nullMeasurableSet_le hfi.1
  calc
    ∫ x, ‖f x‖ ∂μ = (∫ x in {x | 0 ≤ f x}, ‖f x‖ ∂μ) + ∫ x in {x | 0 ≤ f x}ᶜ, ‖f x‖ ∂μ := by
      rw [← integral_add_compl₀ h_meas hfi.norm]
    _ = (∫ x in {x | 0 ≤ f x}, f x ∂μ) + ∫ x in {x | 0 ≤ f x}ᶜ, ‖f x‖ ∂μ := by
      congr 1
      refine' set_integral_congr₀ h_meas fun x hx => _
      dsimp only
      rw [Real.norm_eq_abs, abs_eq_self.mpr _]
      exact hx
    _ = (∫ x in {x | 0 ≤ f x}, f x ∂μ) - ∫ x in {x | 0 ≤ f x}ᶜ, f x ∂μ := by
      congr 1
      rw [← integral_neg]
      refine' set_integral_congr₀ h_meas.compl fun x hx => _
      dsimp only
      rw [Real.norm_eq_abs, abs_eq_neg_self.mpr _]
      rw [Set.mem_compl_iff, Set.nmem_setOf_iff] at hx
      

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f✝ g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
f : α → ℝ
hfi : Integrable f
h_meas : NullMeasurableSet {x | 0 ≤ f x}
x : α
hx : ¬0 ≤ f x
⊢ f x ≤ 0

Next tactic:
linarith
theorem integral_norm_eq_pos_sub_neg {f : α → ℝ} (hfi : Integrable f μ) :
    ∫ x, ‖f x‖ ∂μ = (∫ x in {x | 0 ≤ f x}, f x ∂μ) - ∫ x in {x | f x ≤ 0}, f x ∂μ :=
  have h_meas : NullMeasurableSet {x | 0 ≤ f x} μ :=
    aestronglyMeasurable_const.nullMeasurableSet_le hfi.1
  calc
    ∫ x, ‖f x‖ ∂μ = (∫ x in {x | 0 ≤ f x}, ‖f x‖ ∂μ) + ∫ x in {x | 0 ≤ f x}ᶜ, ‖f x‖ ∂μ := by
      rw [← integral_add_compl₀ h_meas hfi.norm]
    _ = (∫ x in {x | 0 ≤ f x}, f x ∂μ) + ∫ x in {x | 0 ≤ f x}ᶜ, ‖f x‖ ∂μ := by
      congr 1
      refine' set_integral_congr₀ h_meas fun x hx => _
      dsimp only
      rw [Real.norm_eq_abs, abs_eq_self.mpr _]
      exact hx
    _ = (∫ x in {x | 0 ≤ f x}, f x ∂μ) - ∫ x in {x | 0 ≤ f x}ᶜ, f x ∂μ := by
      congr 1
      rw [← integral_neg]
      refine' set_integral_congr₀ h_meas.compl fun x hx => _
      dsimp only
      rw [Real.norm_eq_abs, abs_eq_neg_self.mpr _]
      rw [Set.mem_compl_iff, Set.nmem_setOf_iff] at hx
      linarith
    _ = (∫ x in {x | 0 ≤ f x}, f x ∂μ) - ∫ x in {x | f x ≤ 0}, f x ∂μ := by
      

Proof state:
α : Type u_1
β : Type u_2
E : Type u_3
F : Type u_4
inst✝² : MeasurableSpace α
inst✝¹ : NormedAddCommGroup E
f✝ g : α → E
s t : Set α
μ ν : Measure α
l l' : Filter α
inst✝ : NormedSpace ℝ E
f : α → ℝ
hfi : Integrable f
h_meas : NullMeasurableSet {x | 0 ≤ f x}
⊢ ∫ (x : α) in {x | 0 ≤ f x}, f x ∂μ - ∫ (x : α) in {x | 0 ≤ f x}ᶜ, f x ∂μ =
    ∫ (x : α) in {x | 0 ≤ f x}, f x ∂μ - ∫ (x : α) in {x | f x ≤ 0}, f x ∂μ

Next tactic:
rw [← set_integral_neg_eq_set_integral_nonpos hfi.1]