Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - feat: Prove that the integral of a function composed with the absolute value is twice the integral over the positive #8036

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 27 additions & 0 deletions Mathlib/MeasureTheory/Measure/Lebesgue/Integral.lean
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,30 @@ theorem integral_comp_neg_Ioi {E : Type*} [NormedAddCommGroup E] [NormedSpace
rw [← neg_neg c, ← integral_comp_neg_Iic]
simp only [neg_neg]
#align integral_comp_neg_Ioi integral_comp_neg_Ioi

theorem integral_comp_abs {f : ℝ → ℝ} :
∫ x, f |x| = 2 * ∫ x in Ioi (0:ℝ), f x := by
have eq : ∫ (x : ℝ) in Ioi 0, f |x| = ∫ (x : ℝ) in Ioi 0, f x := by
refine set_integral_congr measurableSet_Ioi (fun _ hx => ?_)
rw [abs_eq_self.mpr (le_of_lt (by exact hx))]
by_cases hf : IntegrableOn (fun x => f |x|) (Ioi 0)
· have int_Iic : IntegrableOn (fun x ↦ f |x|) (Iic 0) := by
rw [← Measure.map_neg_eq_self (volume : Measure ℝ)]
let m : MeasurableEmbedding fun x : ℝ => -x := (Homeomorph.neg ℝ).measurableEmbedding
rw [m.integrableOn_map_iff]
simp_rw [Function.comp, abs_neg, neg_preimage, preimage_neg_Iic, neg_zero]
exact integrableOn_Ici_iff_integrableOn_Ioi.mpr hf
calc
_ = (∫ x in Iic 0, f |x|) + ∫ x in Ioi 0, f |x| := by
rw [← integral_union (Iic_disjoint_Ioi le_rfl) measurableSet_Ioi int_Iic hf,
Iic_union_Ioi, restrict_univ]
_ = 2 * ∫ x in Ioi 0, f x := by
rw [two_mul, eq]
congr! 1
rw [← neg_zero, ← integral_comp_neg_Iic, neg_zero]
refine set_integral_congr measurableSet_Iic (fun _ hx => ?_)
rw [abs_eq_neg_self.mpr (by exact hx)]
· have : ¬ Integrable (fun x => f |x|) := by
contrapose! hf
exact hf.integrableOn
rw [← eq, integral_undef hf, integral_undef this, mul_zero]