-- Mathlib/MeasureTheory/Integral/BochnerL1.lean
theorem integral_eq_norm_posPart_sub (f : α →₁ₛ[μ] ℝ) : integral f = ‖posPart f‖ - ‖negPart f‖

Proof state:
case hg
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : ↥(simpleFunc ℝ 1 μ)
ae_eq₁ : ⇑(toSimpleFunc f).posPart =ᶠ[ae μ] ⇑(SimpleFunc.map norm (toSimpleFunc (posPart f)))
ae_eq₂ : ⇑(toSimpleFunc f).negPart =ᶠ[ae μ] ⇑(SimpleFunc.map norm (toSimpleFunc (negPart f)))
⊢ Integrable (⇑(SimpleFunc.map norm (toSimpleFunc (negPart f)))) μ

Tactic:
exact (SimpleFunc.integrable f).neg_part.congr ae_eq₂

Result:
no goals

Proof state:
case h
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : ↥(simpleFunc ℝ 1 μ)
ae_eq₁ : ⇑(toSimpleFunc f).posPart =ᶠ[ae μ] ⇑(SimpleFunc.map norm (toSimpleFunc (posPart f)))
a✝ : α
h : (toSimpleFunc (negPart f)) a✝ = (toSimpleFunc f).negPart a✝
⊢ (toSimpleFunc f).negPart a✝ = (SimpleFunc.map norm (toSimpleFunc (negPart f))) a✝

Tactic:
rw [SimpleFunc.map_apply, h]

Result:
case h
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : ↥(simpleFunc ℝ 1 μ)
ae_eq₁ : ⇑(toSimpleFunc f).posPart =ᶠ[ae μ] ⇑(SimpleFunc.map norm (toSimpleFunc (posPart f)))
a✝ : α
h : (toSimpleFunc (negPart f)) a✝ = (toSimpleFunc f).negPart a✝
⊢ (toSimpleFunc f).negPart a✝ = ‖(toSimpleFunc f).negPart a✝‖

Proof state:
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : ↥(simpleFunc ℝ 1 μ)
ae_eq₁ : ⇑(toSimpleFunc f).posPart =ᶠ[ae μ] ⇑(SimpleFunc.map norm (toSimpleFunc (posPart f)))
ae_eq₂ : ⇑(toSimpleFunc f).negPart =ᶠ[ae μ] ⇑(SimpleFunc.map norm (toSimpleFunc (negPart f)))
⊢ ⇑(toSimpleFunc f) =ᶠ[ae μ]
    ⇑(SimpleFunc.map norm (toSimpleFunc (posPart f)) - SimpleFunc.map norm (toSimpleFunc (negPart f)))

Tactic:
filter_upwards [ae_eq₁, ae_eq₂] with _ h₁ h₂

Result:
case h
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : ↥(simpleFunc ℝ 1 μ)
ae_eq₁ : ⇑(toSimpleFunc f).posPart =ᶠ[ae μ] ⇑(SimpleFunc.map norm (toSimpleFunc (posPart f)))
ae_eq₂ : ⇑(toSimpleFunc f).negPart =ᶠ[ae μ] ⇑(SimpleFunc.map norm (toSimpleFunc (negPart f)))
a✝ : α
h₁ : (toSimpleFunc f).posPart a✝ = (SimpleFunc.map norm (toSimpleFunc (posPart f))) a✝
h₂ : (toSimpleFunc f).negPart a✝ = (SimpleFunc.map norm (toSimpleFunc (negPart f))) a✝
⊢ (toSimpleFunc f) a✝ =
    (SimpleFunc.map norm (toSimpleFunc (posPart f)) - SimpleFunc.map norm (toSimpleFunc (negPart f))) a✝

Proof state:
case h
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : ↥(simpleFunc ℝ 1 μ)
ae_eq₁ : ⇑(toSimpleFunc f).posPart =ᶠ[ae μ] ⇑(SimpleFunc.map norm (toSimpleFunc (posPart f)))
ae_eq₂ : ⇑(toSimpleFunc f).negPart =ᶠ[ae μ] ⇑(SimpleFunc.map norm (toSimpleFunc (negPart f)))
a✝ : α
h₁ : (toSimpleFunc f).posPart a✝ = (SimpleFunc.map norm (toSimpleFunc (posPart f))) a✝
h₂ : (toSimpleFunc f).negPart a✝ = (SimpleFunc.map norm (toSimpleFunc (negPart f))) a✝
⊢ (toSimpleFunc f) a✝ = (toSimpleFunc f).posPart a✝ - (toSimpleFunc f).negPart a✝

Tactic:
exact DFunLike.congr_fun (toSimpleFunc f).posPart_sub_negPart.symm _

Result:
no goals

Proof state:
case h
α : Type u_1
m : MeasurableSpace α
μ : Measure α
f : ↥(simpleFunc ℝ 1 μ)
ae_eq₁ : ⇑(toSimpleFunc f).posPart =ᶠ[ae μ] ⇑(SimpleFunc.map norm (toSimpleFunc (posPart f)))
a✝ : α
h : (toSimpleFunc (negPart f)) a✝ = (toSimpleFunc f).negPart a✝
⊢ (toSimpleFunc f).negPart a✝ = ‖(toSimpleFunc f).negPart a✝‖

Tactic:
conv_lhs => rw [← SimpleFunc.negPart_map_norm, SimpleFunc.map_apply]

Result:
no goals