measure_theory.measure.lebesgue.basicMathlib.MeasureTheory.Measure.Lebesgue.Basic

This file has been ported!

Changes since the initial port

The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -126,14 +126,14 @@ theorem volume_univ : volume (univ : Set ℝ) = ∞ :=
 #print Real.volume_ball /-
 @[simp]
 theorem volume_ball (a r : ℝ) : volume (Metric.ball a r) = ofReal (2 * r) := by
-  rw [ball_eq_Ioo, volume_Ioo, ← sub_add, add_sub_cancel', two_mul]
+  rw [ball_eq_Ioo, volume_Ioo, ← sub_add, add_sub_cancel_left, two_mul]
 #align real.volume_ball Real.volume_ball
 -/
 
 #print Real.volume_closedBall /-
 @[simp]
 theorem volume_closedBall (a r : ℝ) : volume (Metric.closedBall a r) = ofReal (2 * r) := by
-  rw [closed_ball_eq_Icc, volume_Icc, ← sub_add, add_sub_cancel', two_mul]
+  rw [closed_ball_eq_Icc, volume_Icc, ← sub_add, add_sub_cancel_left, two_mul]
 #align real.volume_closed_ball Real.volume_closedBall
 -/
 
@@ -386,11 +386,11 @@ theorem smul_map_volume_mul_left {a : ℝ} (h : a ≠ 0) :
     simp only [Real.volume_Ioo, measure.smul_apply, ← ENNReal.ofReal_mul (le_of_lt <| neg_pos.2 h),
       measure.map_apply (measurable_const_mul a) measurableSet_Ioo, neg_sub_neg, neg_mul,
       preimage_const_mul_Ioo_of_neg _ _ h, abs_of_neg h, mul_sub, smul_eq_mul,
-      mul_div_cancel' _ (ne_of_lt h)]
+      mul_div_cancel₀ _ (ne_of_lt h)]
   ·
     simp only [Real.volume_Ioo, measure.smul_apply, ← ENNReal.ofReal_mul (le_of_lt h),
       measure.map_apply (measurable_const_mul a) measurableSet_Ioo, preimage_const_mul_Ioo _ _ h,
-      abs_of_pos h, mul_sub, mul_div_cancel' _ (ne_of_gt h), smul_eq_mul]
+      abs_of_pos h, mul_sub, mul_div_cancel₀ _ (ne_of_gt h), smul_eq_mul]
 #align real.smul_map_volume_mul_left Real.smul_map_volume_mul_left
 -/
 
Diff
@@ -468,7 +468,7 @@ theorem smul_map_diagonal_volume_pi [DecidableEq ι] {D : ι → ℝ} (h : det (
     by
     intro i
     have A : D i ≠ 0 := by
-      simp only [det_diagonal, Ne.def] at h 
+      simp only [det_diagonal, Ne.def] at h
       exact Finset.prod_ne_zero_iff.1 h i (Finset.mem_univ i)
     rw [volume_preimage_mul_left A, ← mul_assoc, ← ENNReal.ofReal_mul (abs_nonneg _), ← abs_mul,
       mul_inv_cancel A, abs_one, ENNReal.ofReal_one, one_mul]
@@ -564,7 +564,7 @@ theorem map_linearMap_volume_pi_eq_smul_volume_pi {f : (ι → ℝ) →ₗ[ℝ]
   have B : f = M.to_lin' := by simp only [to_lin'_to_matrix']
   rw [A, B]
   apply map_matrix_volume_pi_eq_smul_volume_pi
-  rwa [A] at hf 
+  rwa [A] at hf
 #align real.map_linear_map_volume_pi_eq_smul_volume_pi Real.map_linearMap_volume_pi_eq_smul_volume_pi
 -/
 
@@ -735,7 +735,7 @@ theorem ae_restrict_of_ae_restrict_inter_Ioo {μ : Measure ℝ} [NoAtoms μ] {s
   have : s ⊆ s \ u ∪ ⋃ p ∈ A, s ∩ T p := by
     intro x hx
     by_cases h'x : x ∈ ⋃ i : ↥s × ↥s, T i
-    · rw [← hA] at h'x 
+    · rw [← hA] at h'x
       obtain ⟨p, pA, xp⟩ : ∃ p : ↥s × ↥s, p ∈ A ∧ x ∈ T p := by
         simpa only [mem_Union, exists_prop, SetCoe.exists, exists_and_right] using h'x
       right
@@ -783,7 +783,7 @@ theorem ae_of_mem_of_ae_of_mem_inter_Ioo {μ : Measure ℝ} [NoAtoms μ] {s : Se
   filter_upwards [M, M'] with x hx h'x
   intro xs
   by_cases Hx : x ∈ ⋃ i : ↥s × ↥s, T i
-  · rw [← hA] at Hx 
+  · rw [← hA] at Hx
     obtain ⟨p, pA, xp⟩ : ∃ p : ↥s × ↥s, p ∈ A ∧ x ∈ T p := by
       simpa only [mem_Union, exists_prop, SetCoe.exists, exists_and_right] using Hx
     apply h'x p pA ⟨xs, xp⟩
Diff
@@ -556,11 +556,18 @@ theorem map_matrix_volume_pi_eq_smul_volume_pi [DecidableEq ι] {M : Matrix ι 
 /-- Any invertible linear map rescales Lebesgue measure through the absolute value of its
 determinant. -/
 theorem map_linearMap_volume_pi_eq_smul_volume_pi {f : (ι → ℝ) →ₗ[ℝ] ι → ℝ} (hf : f.det ≠ 0) :
-    Measure.map f volume = ENNReal.ofReal (abs f.det⁻¹) • volume := by classical
+    Measure.map f volume = ENNReal.ofReal (abs f.det⁻¹) • volume := by
+  classical
+  -- this is deduced from the matrix case
+  let M := f.to_matrix'
+  have A : f.det = det M := by simp only [LinearMap.det_toMatrix']
+  have B : f = M.to_lin' := by simp only [to_lin'_to_matrix']
+  rw [A, B]
+  apply map_matrix_volume_pi_eq_smul_volume_pi
+  rwa [A] at hf 
 #align real.map_linear_map_volume_pi_eq_smul_volume_pi Real.map_linearMap_volume_pi_eq_smul_volume_pi
 -/
 
--- this is deduced from the matrix case
 end Real
 
 section regionBetween
@@ -655,7 +662,23 @@ theorem measurableSet_graph (hf : Measurable f) : MeasurableSet {p : α × ℝ |
 #print volume_regionBetween_eq_lintegral' /-
 theorem volume_regionBetween_eq_lintegral' (hf : Measurable f) (hg : Measurable g)
     (hs : MeasurableSet s) :
-    μ.Prod volume (regionBetween f g s) = ∫⁻ y in s, ENNReal.ofReal ((g - f) y) ∂μ := by classical
+    μ.Prod volume (regionBetween f g s) = ∫⁻ y in s, ENNReal.ofReal ((g - f) y) ∂μ := by
+  classical
+  rw [measure.prod_apply]
+  · have h :
+      (fun x => volume {a | x ∈ s ∧ a ∈ Ioo (f x) (g x)}) =
+        s.indicator fun x => ENNReal.ofReal (g x - f x) :=
+      by
+      funext x
+      rw [indicator_apply]
+      split_ifs
+      · have hx : {a | x ∈ s ∧ a ∈ Ioo (f x) (g x)} = Ioo (f x) (g x) := by simp [h, Ioo]
+        simp only [hx, Real.volume_Ioo, sub_zero]
+      · have hx : {a | x ∈ s ∧ a ∈ Ioo (f x) (g x)} = ∅ := by simp [h]
+        simp only [hx, measure_empty]
+    dsimp only [regionBetween, preimage_set_of_eq]
+    rw [h, lintegral_indicator] <;> simp only [hs, Pi.sub_apply]
+  · exact measurableSet_regionBetween hf hg hs
 #align volume_region_between_eq_lintegral' volume_regionBetween_eq_lintegral'
 -/
 
Diff
@@ -556,18 +556,11 @@ theorem map_matrix_volume_pi_eq_smul_volume_pi [DecidableEq ι] {M : Matrix ι 
 /-- Any invertible linear map rescales Lebesgue measure through the absolute value of its
 determinant. -/
 theorem map_linearMap_volume_pi_eq_smul_volume_pi {f : (ι → ℝ) →ₗ[ℝ] ι → ℝ} (hf : f.det ≠ 0) :
-    Measure.map f volume = ENNReal.ofReal (abs f.det⁻¹) • volume := by
-  classical
-  -- this is deduced from the matrix case
-  let M := f.to_matrix'
-  have A : f.det = det M := by simp only [LinearMap.det_toMatrix']
-  have B : f = M.to_lin' := by simp only [to_lin'_to_matrix']
-  rw [A, B]
-  apply map_matrix_volume_pi_eq_smul_volume_pi
-  rwa [A] at hf 
+    Measure.map f volume = ENNReal.ofReal (abs f.det⁻¹) • volume := by classical
 #align real.map_linear_map_volume_pi_eq_smul_volume_pi Real.map_linearMap_volume_pi_eq_smul_volume_pi
 -/
 
+-- this is deduced from the matrix case
 end Real
 
 section regionBetween
@@ -662,23 +655,7 @@ theorem measurableSet_graph (hf : Measurable f) : MeasurableSet {p : α × ℝ |
 #print volume_regionBetween_eq_lintegral' /-
 theorem volume_regionBetween_eq_lintegral' (hf : Measurable f) (hg : Measurable g)
     (hs : MeasurableSet s) :
-    μ.Prod volume (regionBetween f g s) = ∫⁻ y in s, ENNReal.ofReal ((g - f) y) ∂μ := by
-  classical
-  rw [measure.prod_apply]
-  · have h :
-      (fun x => volume {a | x ∈ s ∧ a ∈ Ioo (f x) (g x)}) =
-        s.indicator fun x => ENNReal.ofReal (g x - f x) :=
-      by
-      funext x
-      rw [indicator_apply]
-      split_ifs
-      · have hx : {a | x ∈ s ∧ a ∈ Ioo (f x) (g x)} = Ioo (f x) (g x) := by simp [h, Ioo]
-        simp only [hx, Real.volume_Ioo, sub_zero]
-      · have hx : {a | x ∈ s ∧ a ∈ Ioo (f x) (g x)} = ∅ := by simp [h]
-        simp only [hx, measure_empty]
-    dsimp only [regionBetween, preimage_set_of_eq]
-    rw [h, lintegral_indicator] <;> simp only [hs, Pi.sub_apply]
-  · exact measurableSet_regionBetween hf hg hs
+    μ.Prod volume (regionBetween f g s) = ∫⁻ y in s, ENNReal.ofReal ((g - f) y) ∂μ := by classical
 #align volume_region_between_eq_lintegral' volume_regionBetween_eq_lintegral'
 -/
 
Diff
@@ -3,13 +3,13 @@ Copyright (c) 2017 Johannes Hölzl. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Johannes Hölzl, Sébastien Gouëzel, Yury Kudryashov
 -/
-import Mathbin.Dynamics.Ergodic.MeasurePreserving
-import Mathbin.LinearAlgebra.Determinant
-import Mathbin.LinearAlgebra.Matrix.Diagonal
-import Mathbin.LinearAlgebra.Matrix.Transvection
-import Mathbin.MeasureTheory.Constructions.Pi
-import Mathbin.MeasureTheory.Measure.Stieltjes
-import Mathbin.MeasureTheory.Measure.Haar.OfBasis
+import Dynamics.Ergodic.MeasurePreserving
+import LinearAlgebra.Determinant
+import LinearAlgebra.Matrix.Diagonal
+import LinearAlgebra.Matrix.Transvection
+import MeasureTheory.Constructions.Pi
+import MeasureTheory.Measure.Stieltjes
+import MeasureTheory.Measure.Haar.OfBasis
 
 #align_import measure_theory.measure.lebesgue.basic from "leanprover-community/mathlib"@"af471b9e3ce868f296626d33189b4ce730fa4c00"
 
Diff
@@ -244,9 +244,9 @@ instance isFiniteMeasure_restrict_Ioo (x y : ℝ) : IsFiniteMeasure (volume.rest
 #print Real.volume_le_diam /-
 theorem volume_le_diam (s : Set ℝ) : volume s ≤ EMetric.diam s :=
   by
-  by_cases hs : Metric.Bounded s
+  by_cases hs : Bornology.IsBounded s
   · rw [Real.ediam_eq hs, ← volume_Icc]
-    exact volume.mono (Real.subset_Icc_sInf_sSup_of_bounded hs)
+    exact volume.mono (Real.subset_Icc_sInf_sSup_of_isBounded hs)
   · rw [Metric.ediam_of_unbounded hs]; exact le_top
 #align real.volume_le_diam Real.volume_le_diam
 -/
Diff
@@ -2,11 +2,6 @@
 Copyright (c) 2017 Johannes Hölzl. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Johannes Hölzl, Sébastien Gouëzel, Yury Kudryashov
-
-! This file was ported from Lean 3 source module measure_theory.measure.lebesgue.basic
-! leanprover-community/mathlib commit af471b9e3ce868f296626d33189b4ce730fa4c00
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Dynamics.Ergodic.MeasurePreserving
 import Mathbin.LinearAlgebra.Determinant
@@ -16,6 +11,8 @@ import Mathbin.MeasureTheory.Constructions.Pi
 import Mathbin.MeasureTheory.Measure.Stieltjes
 import Mathbin.MeasureTheory.Measure.Haar.OfBasis
 
+#align_import measure_theory.measure.lebesgue.basic from "leanprover-community/mathlib"@"af471b9e3ce868f296626d33189b4ce730fa4c00"
+
 /-!
 # Lebesgue measure on the real line and on `ℝⁿ`
 
Diff
@@ -172,7 +172,7 @@ instance noAtoms_volume : NoAtoms (volume : Measure ℝ) :=
 
 #print Real.volume_interval /-
 @[simp]
-theorem volume_interval {a b : ℝ} : volume (uIcc a b) = ofReal (|b - a|) := by
+theorem volume_interval {a b : ℝ} : volume (uIcc a b) = ofReal |b - a| := by
   rw [← Icc_min_max, volume_Icc, max_sub_min_eq_abs]
 #align real.volume_interval Real.volume_interval
 -/
@@ -381,7 +381,7 @@ theorem volume_pi_le_diam_pow (s : Set (ι → ℝ)) : volume s ≤ EMetric.diam
 
 #print Real.smul_map_volume_mul_left /-
 theorem smul_map_volume_mul_left {a : ℝ} (h : a ≠ 0) :
-    ENNReal.ofReal (|a|) • Measure.map ((· * ·) a) volume = volume :=
+    ENNReal.ofReal |a| • Measure.map ((· * ·) a) volume = volume :=
   by
   refine' (Real.measure_ext_Ioo_rat fun p q => _).symm
   cases' lt_or_gt_of_ne h with h h
@@ -399,7 +399,7 @@ theorem smul_map_volume_mul_left {a : ℝ} (h : a ≠ 0) :
 
 #print Real.map_volume_mul_left /-
 theorem map_volume_mul_left {a : ℝ} (h : a ≠ 0) :
-    Measure.map ((· * ·) a) volume = ENNReal.ofReal (|a⁻¹|) • volume := by
+    Measure.map ((· * ·) a) volume = ENNReal.ofReal |a⁻¹| • volume := by
   conv_rhs =>
     rw [← Real.smul_map_volume_mul_left h, smul_smul, ← ENNReal.ofReal_mul (abs_nonneg _), ←
       abs_mul, inv_mul_cancel h, abs_one, ENNReal.ofReal_one, one_smul]
@@ -419,14 +419,14 @@ theorem volume_preimage_mul_left {a : ℝ} (h : a ≠ 0) (s : Set ℝ) :
 
 #print Real.smul_map_volume_mul_right /-
 theorem smul_map_volume_mul_right {a : ℝ} (h : a ≠ 0) :
-    ENNReal.ofReal (|a|) • Measure.map (· * a) volume = volume := by
+    ENNReal.ofReal |a| • Measure.map (· * a) volume = volume := by
   simpa only [mul_comm] using Real.smul_map_volume_mul_left h
 #align real.smul_map_volume_mul_right Real.smul_map_volume_mul_right
 -/
 
 #print Real.map_volume_mul_right /-
 theorem map_volume_mul_right {a : ℝ} (h : a ≠ 0) :
-    Measure.map (· * a) volume = ENNReal.ofReal (|a⁻¹|) • volume := by
+    Measure.map (· * a) volume = ENNReal.ofReal |a⁻¹| • volume := by
   simpa only [mul_comm] using Real.map_volume_mul_left h
 #align real.map_volume_mul_right Real.map_volume_mul_right
 -/
Diff
@@ -498,7 +498,7 @@ theorem volume_preserving_transvectionStruct [DecidableEq ι] (t : TransvectionS
   have : (t.to_matrix.to_lin' : (ι → ℝ) → ι → ℝ) = e.symm ∘ F ∘ e :=
     by
     cases t
-    ext (f k)
+    ext f k
     simp only [LinearEquiv.map_smul, dite_eq_ite, LinearMap.id_coe, p, ite_not,
       Algebra.id.smul_eq_mul, one_mul, dot_product, std_basis_matrix,
       MeasurableEquiv.piEquivPiSubtypeProd_symm_apply, id.def, transvection, Pi.add_apply,
Diff
@@ -86,26 +86,37 @@ theorem volume_val (s) : volume s = StieltjesFunction.id.Measure s := by
 #align real.volume_val Real.volume_val
 -/
 
+#print Real.volume_Ico /-
 @[simp]
 theorem volume_Ico {a b : ℝ} : volume (Ico a b) = ofReal (b - a) := by simp [volume_val]
 #align real.volume_Ico Real.volume_Ico
+-/
 
+#print Real.volume_Icc /-
 @[simp]
 theorem volume_Icc {a b : ℝ} : volume (Icc a b) = ofReal (b - a) := by simp [volume_val]
 #align real.volume_Icc Real.volume_Icc
+-/
 
+#print Real.volume_Ioo /-
 @[simp]
 theorem volume_Ioo {a b : ℝ} : volume (Ioo a b) = ofReal (b - a) := by simp [volume_val]
 #align real.volume_Ioo Real.volume_Ioo
+-/
 
+#print Real.volume_Ioc /-
 @[simp]
 theorem volume_Ioc {a b : ℝ} : volume (Ioc a b) = ofReal (b - a) := by simp [volume_val]
 #align real.volume_Ioc Real.volume_Ioc
+-/
 
+#print Real.volume_singleton /-
 @[simp]
 theorem volume_singleton {a : ℝ} : volume ({a} : Set ℝ) = 0 := by simp [volume_val]
 #align real.volume_singleton Real.volume_singleton
+-/
 
+#print Real.volume_univ /-
 @[simp]
 theorem volume_univ : volume (univ : Set ℝ) = ∞ :=
   ENNReal.eq_top_of_forall_nnreal_le fun r =>
@@ -113,17 +124,23 @@ theorem volume_univ : volume (univ : Set ℝ) = ∞ :=
       (r : ℝ≥0∞) = volume (Icc (0 : ℝ) r) := by simp
       _ ≤ volume univ := measure_mono (subset_univ _)
 #align real.volume_univ Real.volume_univ
+-/
 
+#print Real.volume_ball /-
 @[simp]
 theorem volume_ball (a r : ℝ) : volume (Metric.ball a r) = ofReal (2 * r) := by
   rw [ball_eq_Ioo, volume_Ioo, ← sub_add, add_sub_cancel', two_mul]
 #align real.volume_ball Real.volume_ball
+-/
 
+#print Real.volume_closedBall /-
 @[simp]
 theorem volume_closedBall (a r : ℝ) : volume (Metric.closedBall a r) = ofReal (2 * r) := by
   rw [closed_ball_eq_Icc, volume_Icc, ← sub_add, add_sub_cancel', two_mul]
 #align real.volume_closed_ball Real.volume_closedBall
+-/
 
+#print Real.volume_emetric_ball /-
 @[simp]
 theorem volume_emetric_ball (a : ℝ) (r : ℝ≥0∞) : volume (EMetric.ball a r) = 2 * r :=
   by
@@ -133,7 +150,9 @@ theorem volume_emetric_ball (a : ℝ) (r : ℝ≥0∞) : volume (EMetric.ball a
     rw [Metric.emetric_ball_nnreal, volume_ball, two_mul, ← NNReal.coe_add,
       ENNReal.ofReal_coe_nnreal, ENNReal.coe_add, two_mul]
 #align real.volume_emetric_ball Real.volume_emetric_ball
+-/
 
+#print Real.volume_emetric_closedBall /-
 @[simp]
 theorem volume_emetric_closedBall (a : ℝ) (r : ℝ≥0∞) : volume (EMetric.closedBall a r) = 2 * r :=
   by
@@ -143,6 +162,7 @@ theorem volume_emetric_closedBall (a : ℝ) (r : ℝ≥0∞) : volume (EMetric.c
     rw [Metric.emetric_closedBall_nnreal, volume_closed_ball, two_mul, ← NNReal.coe_add,
       ENNReal.ofReal_coe_nnreal, ENNReal.coe_add, two_mul]
 #align real.volume_emetric_closed_ball Real.volume_emetric_closedBall
+-/
 
 #print Real.noAtoms_volume /-
 instance noAtoms_volume : NoAtoms (volume : Measure ℝ) :=
@@ -150,11 +170,14 @@ instance noAtoms_volume : NoAtoms (volume : Measure ℝ) :=
 #align real.has_no_atoms_volume Real.noAtoms_volume
 -/
 
+#print Real.volume_interval /-
 @[simp]
 theorem volume_interval {a b : ℝ} : volume (uIcc a b) = ofReal (|b - a|) := by
   rw [← Icc_min_max, volume_Icc, max_sub_min_eq_abs]
 #align real.volume_interval Real.volume_interval
+-/
 
+#print Real.volume_Ioi /-
 @[simp]
 theorem volume_Ioi {a : ℝ} : volume (Ioi a) = ∞ :=
   top_unique <|
@@ -163,11 +186,15 @@ theorem volume_Ioi {a : ℝ} : volume (Ioi a) = ∞ :=
         (n : ℝ≥0∞) = volume (Ioo a (a + n)) := by simp
         _ ≤ volume (Ioi a) := measure_mono Ioo_subset_Ioi_self
 #align real.volume_Ioi Real.volume_Ioi
+-/
 
+#print Real.volume_Ici /-
 @[simp]
 theorem volume_Ici {a : ℝ} : volume (Ici a) = ∞ := by simp [← measure_congr Ioi_ae_eq_Ici]
 #align real.volume_Ici Real.volume_Ici
+-/
 
+#print Real.volume_Iio /-
 @[simp]
 theorem volume_Iio {a : ℝ} : volume (Iio a) = ∞ :=
   top_unique <|
@@ -176,10 +203,13 @@ theorem volume_Iio {a : ℝ} : volume (Iio a) = ∞ :=
         (n : ℝ≥0∞) = volume (Ioo (a - n) a) := by simp
         _ ≤ volume (Iio a) := measure_mono Ioo_subset_Iio_self
 #align real.volume_Iio Real.volume_Iio
+-/
 
+#print Real.volume_Iic /-
 @[simp]
 theorem volume_Iic {a : ℝ} : volume (Iic a) = ∞ := by simp [← measure_congr Iio_ae_eq_Iic]
 #align real.volume_Iic Real.volume_Iic
+-/
 
 #print Real.locallyFinite_volume /-
 instance locallyFinite_volume : IsLocallyFiniteMeasure (volume : Measure ℝ) :=
@@ -214,6 +244,7 @@ instance isFiniteMeasure_restrict_Ioo (x y : ℝ) : IsFiniteMeasure (volume.rest
 #align real.is_finite_measure_restrict_Ioo Real.isFiniteMeasure_restrict_Ioo
 -/
 
+#print Real.volume_le_diam /-
 theorem volume_le_diam (s : Set ℝ) : volume s ≤ EMetric.diam s :=
   by
   by_cases hs : Metric.Bounded s
@@ -221,7 +252,9 @@ theorem volume_le_diam (s : Set ℝ) : volume s ≤ EMetric.diam s :=
     exact volume.mono (Real.subset_Icc_sInf_sSup_of_bounded hs)
   · rw [Metric.ediam_of_unbounded hs]; exact le_top
 #align real.volume_le_diam Real.volume_le_diam
+-/
 
+#print Filter.Eventually.volume_pos_of_nhds_real /-
 theorem Filter.Eventually.volume_pos_of_nhds_real {p : ℝ → Prop} {a : ℝ} (h : ∀ᶠ x in 𝓝 a, p x) :
     (0 : ℝ≥0∞) < volume {x | p x} :=
   by
@@ -229,6 +262,7 @@ theorem Filter.Eventually.volume_pos_of_nhds_real {p : ℝ → Prop} {a : ℝ} (
   refine' lt_of_lt_of_le _ (measure_mono hs)
   simpa [-mem_Ioo] using hx.1.trans hx.2
 #align filter.eventually.volume_pos_of_nhds_real Filter.Eventually.volume_pos_of_nhds_real
+-/
 
 /-!
 ### Volume of a box in `ℝⁿ`
@@ -243,11 +277,13 @@ theorem volume_Icc_pi {a b : ι → ℝ} : volume (Icc a b) = ∏ i, ENNReal.ofR
 #align real.volume_Icc_pi Real.volume_Icc_pi
 -/
 
+#print Real.volume_Icc_pi_toReal /-
 @[simp]
 theorem volume_Icc_pi_toReal {a b : ι → ℝ} (h : a ≤ b) :
     (volume (Icc a b)).toReal = ∏ i, (b i - a i) := by
   simp only [volume_Icc_pi, ENNReal.toReal_prod, ENNReal.toReal_ofReal (sub_nonneg.2 (h _))]
 #align real.volume_Icc_pi_to_real Real.volume_Icc_pi_toReal
+-/
 
 #print Real.volume_pi_Ioo /-
 theorem volume_pi_Ioo {a b : ι → ℝ} :
@@ -256,11 +292,13 @@ theorem volume_pi_Ioo {a b : ι → ℝ} :
 #align real.volume_pi_Ioo Real.volume_pi_Ioo
 -/
 
+#print Real.volume_pi_Ioo_toReal /-
 @[simp]
 theorem volume_pi_Ioo_toReal {a b : ι → ℝ} (h : a ≤ b) :
     (volume (pi univ fun i => Ioo (a i) (b i))).toReal = ∏ i, (b i - a i) := by
   simp only [volume_pi_Ioo, ENNReal.toReal_prod, ENNReal.toReal_ofReal (sub_nonneg.2 (h _))]
 #align real.volume_pi_Ioo_to_real Real.volume_pi_Ioo_toReal
+-/
 
 #print Real.volume_pi_Ioc /-
 theorem volume_pi_Ioc {a b : ι → ℝ} :
@@ -269,11 +307,13 @@ theorem volume_pi_Ioc {a b : ι → ℝ} :
 #align real.volume_pi_Ioc Real.volume_pi_Ioc
 -/
 
+#print Real.volume_pi_Ioc_toReal /-
 @[simp]
 theorem volume_pi_Ioc_toReal {a b : ι → ℝ} (h : a ≤ b) :
     (volume (pi univ fun i => Ioc (a i) (b i))).toReal = ∏ i, (b i - a i) := by
   simp only [volume_pi_Ioc, ENNReal.toReal_prod, ENNReal.toReal_ofReal (sub_nonneg.2 (h _))]
 #align real.volume_pi_Ioc_to_real Real.volume_pi_Ioc_toReal
+-/
 
 #print Real.volume_pi_Ico /-
 theorem volume_pi_Ico {a b : ι → ℝ} :
@@ -282,12 +322,15 @@ theorem volume_pi_Ico {a b : ι → ℝ} :
 #align real.volume_pi_Ico Real.volume_pi_Ico
 -/
 
+#print Real.volume_pi_Ico_toReal /-
 @[simp]
 theorem volume_pi_Ico_toReal {a b : ι → ℝ} (h : a ≤ b) :
     (volume (pi univ fun i => Ico (a i) (b i))).toReal = ∏ i, (b i - a i) := by
   simp only [volume_pi_Ico, ENNReal.toReal_prod, ENNReal.toReal_ofReal (sub_nonneg.2 (h _))]
 #align real.volume_pi_Ico_to_real Real.volume_pi_Ico_toReal
+-/
 
+#print Real.volume_pi_ball /-
 @[simp]
 theorem volume_pi_ball (a : ι → ℝ) {r : ℝ} (hr : 0 < r) :
     volume (Metric.ball a r) = ENNReal.ofReal ((2 * r) ^ Fintype.card ι) :=
@@ -295,7 +338,9 @@ theorem volume_pi_ball (a : ι → ℝ) {r : ℝ} (hr : 0 < r) :
   simp only [volume_pi_ball a hr, volume_ball, Finset.prod_const]
   exact (ENNReal.ofReal_pow (mul_nonneg zero_le_two hr.le) _).symm
 #align real.volume_pi_ball Real.volume_pi_ball
+-/
 
+#print Real.volume_pi_closedBall /-
 @[simp]
 theorem volume_pi_closedBall (a : ι → ℝ) {r : ℝ} (hr : 0 ≤ r) :
     volume (Metric.closedBall a r) = ENNReal.ofReal ((2 * r) ^ Fintype.card ι) :=
@@ -303,7 +348,9 @@ theorem volume_pi_closedBall (a : ι → ℝ) {r : ℝ} (hr : 0 ≤ r) :
   simp only [volume_pi_closed_ball a hr, volume_closed_ball, Finset.prod_const]
   exact (ENNReal.ofReal_pow (mul_nonneg zero_le_two hr) _).symm
 #align real.volume_pi_closed_ball Real.volume_pi_closedBall
+-/
 
+#print Real.volume_pi_le_prod_diam /-
 theorem volume_pi_le_prod_diam (s : Set (ι → ℝ)) :
     volume s ≤ ∏ i : ι, EMetric.diam (Function.eval i '' s) :=
   calc
@@ -314,7 +361,9 @@ theorem volume_pi_le_prod_diam (s : Set (ι → ℝ)) :
     _ ≤ ∏ i : ι, EMetric.diam (Function.eval i '' s) :=
       Finset.prod_le_prod' fun i hi => (volume_le_diam _).trans_eq (EMetric.diam_closure _)
 #align real.volume_pi_le_prod_diam Real.volume_pi_le_prod_diam
+-/
 
+#print Real.volume_pi_le_diam_pow /-
 theorem volume_pi_le_diam_pow (s : Set (ι → ℝ)) : volume s ≤ EMetric.diam s ^ Fintype.card ι :=
   calc
     volume s ≤ ∏ i : ι, EMetric.diam (Function.eval i '' s) := volume_pi_le_prod_diam s
@@ -323,12 +372,14 @@ theorem volume_pi_le_diam_pow (s : Set (ι → ℝ)) : volume s ≤ EMetric.diam
     _ = EMetric.diam s ^ Fintype.card ι := by
       simp only [ENNReal.coe_one, one_mul, Finset.prod_const, Fintype.card]
 #align real.volume_pi_le_diam_pow Real.volume_pi_le_diam_pow
+-/
 
 /-!
 ### Images of the Lebesgue measure under multiplication in ℝ
 -/
 
 
+#print Real.smul_map_volume_mul_left /-
 theorem smul_map_volume_mul_left {a : ℝ} (h : a ≠ 0) :
     ENNReal.ofReal (|a|) • Measure.map ((· * ·) a) volume = volume :=
   by
@@ -344,14 +395,18 @@ theorem smul_map_volume_mul_left {a : ℝ} (h : a ≠ 0) :
       measure.map_apply (measurable_const_mul a) measurableSet_Ioo, preimage_const_mul_Ioo _ _ h,
       abs_of_pos h, mul_sub, mul_div_cancel' _ (ne_of_gt h), smul_eq_mul]
 #align real.smul_map_volume_mul_left Real.smul_map_volume_mul_left
+-/
 
+#print Real.map_volume_mul_left /-
 theorem map_volume_mul_left {a : ℝ} (h : a ≠ 0) :
     Measure.map ((· * ·) a) volume = ENNReal.ofReal (|a⁻¹|) • volume := by
   conv_rhs =>
     rw [← Real.smul_map_volume_mul_left h, smul_smul, ← ENNReal.ofReal_mul (abs_nonneg _), ←
       abs_mul, inv_mul_cancel h, abs_one, ENNReal.ofReal_one, one_smul]
 #align real.map_volume_mul_left Real.map_volume_mul_left
+-/
 
+#print Real.volume_preimage_mul_left /-
 @[simp]
 theorem volume_preimage_mul_left {a : ℝ} (h : a ≠ 0) (s : Set ℝ) :
     volume ((· * ·) a ⁻¹' s) = ENNReal.ofReal (abs a⁻¹) * volume s :=
@@ -360,17 +415,23 @@ theorem volume_preimage_mul_left {a : ℝ} (h : a ≠ 0) (s : Set ℝ) :
       ((Homeomorph.mulLeft₀ a h).toMeasurableEquiv.map_apply s).symm
     _ = ENNReal.ofReal (abs a⁻¹) * volume s := by rw [map_volume_mul_left h]; rfl
 #align real.volume_preimage_mul_left Real.volume_preimage_mul_left
+-/
 
+#print Real.smul_map_volume_mul_right /-
 theorem smul_map_volume_mul_right {a : ℝ} (h : a ≠ 0) :
     ENNReal.ofReal (|a|) • Measure.map (· * a) volume = volume := by
   simpa only [mul_comm] using Real.smul_map_volume_mul_left h
 #align real.smul_map_volume_mul_right Real.smul_map_volume_mul_right
+-/
 
+#print Real.map_volume_mul_right /-
 theorem map_volume_mul_right {a : ℝ} (h : a ≠ 0) :
     Measure.map (· * a) volume = ENNReal.ofReal (|a⁻¹|) • volume := by
   simpa only [mul_comm] using Real.map_volume_mul_left h
 #align real.map_volume_mul_right Real.map_volume_mul_right
+-/
 
+#print Real.volume_preimage_mul_right /-
 @[simp]
 theorem volume_preimage_mul_right {a : ℝ} (h : a ≠ 0) (s : Set ℝ) :
     volume ((· * a) ⁻¹' s) = ENNReal.ofReal (abs a⁻¹) * volume s :=
@@ -379,6 +440,7 @@ theorem volume_preimage_mul_right {a : ℝ} (h : a ≠ 0) (s : Set ℝ) :
       ((Homeomorph.mulRight₀ a h).toMeasurableEquiv.map_apply s).symm
     _ = ENNReal.ofReal (abs a⁻¹) * volume s := by rw [map_volume_mul_right h]; rfl
 #align real.volume_preimage_mul_right Real.volume_preimage_mul_right
+-/
 
 /-!
 ### Images of the Lebesgue measure under translation/linear maps in ℝⁿ
@@ -387,6 +449,7 @@ theorem volume_preimage_mul_right {a : ℝ} (h : a ≠ 0) (s : Set ℝ) :
 
 open Matrix
 
+#print Real.smul_map_diagonal_volume_pi /-
 /-- A diagonal matrix rescales Lebesgue according to its determinant. This is a special case of
 `real.map_matrix_volume_pi_eq_smul_volume_pi`, that one should use instead (and whose proof
 uses this particular case). -/
@@ -416,6 +479,7 @@ theorem smul_map_diagonal_volume_pi [DecidableEq ι] {D : ι → ℝ} (h : det (
     ENNReal.ofReal_prod_of_nonneg fun i hi => abs_nonneg (D i), ← Finset.prod_mul_distrib]
   simp only [B]
 #align real.smul_map_diagonal_volume_pi Real.smul_map_diagonal_volume_pi
+-/
 
 #print Real.volume_preserving_transvectionStruct /-
 /-- A transvection preserves Lebesgue measure. -/
@@ -465,6 +529,7 @@ theorem volume_preserving_transvectionStruct [DecidableEq ι] (t : TransvectionS
 #align real.volume_preserving_transvection_struct Real.volume_preserving_transvectionStruct
 -/
 
+#print Real.map_matrix_volume_pi_eq_smul_volume_pi /-
 /-- Any invertible matrix rescales Lebesgue measure through the absolute value of its
 determinant. -/
 theorem map_matrix_volume_pi_eq_smul_volume_pi [DecidableEq ι] {M : Matrix ι ι ℝ} (hM : det M ≠ 0) :
@@ -488,7 +553,9 @@ theorem map_matrix_volume_pi_eq_smul_volume_pi [DecidableEq ι] {M : Matrix ι 
     · apply Continuous.measurable
       apply LinearMap.continuous_on_pi
 #align real.map_matrix_volume_pi_eq_smul_volume_pi Real.map_matrix_volume_pi_eq_smul_volume_pi
+-/
 
+#print Real.map_linearMap_volume_pi_eq_smul_volume_pi /-
 /-- Any invertible linear map rescales Lebesgue measure through the absolute value of its
 determinant. -/
 theorem map_linearMap_volume_pi_eq_smul_volume_pi {f : (ι → ℝ) →ₗ[ℝ] ι → ℝ} (hf : f.det ≠ 0) :
@@ -502,6 +569,7 @@ theorem map_linearMap_volume_pi_eq_smul_volume_pi {f : (ι → ℝ) →ₗ[ℝ]
   apply map_matrix_volume_pi_eq_smul_volume_pi
   rwa [A] at hf 
 #align real.map_linear_map_volume_pi_eq_smul_volume_pi Real.map_linearMap_volume_pi_eq_smul_volume_pi
+-/
 
 end Real
 
@@ -594,6 +662,7 @@ theorem measurableSet_graph (hf : Measurable f) : MeasurableSet {p : α × ℝ |
 #align measurable_set_graph measurableSet_graph
 -/
 
+#print volume_regionBetween_eq_lintegral' /-
 theorem volume_regionBetween_eq_lintegral' (hf : Measurable f) (hg : Measurable g)
     (hs : MeasurableSet s) :
     μ.Prod volume (regionBetween f g s) = ∫⁻ y in s, ENNReal.ofReal ((g - f) y) ∂μ := by
@@ -614,7 +683,9 @@ theorem volume_regionBetween_eq_lintegral' (hf : Measurable f) (hg : Measurable
     rw [h, lintegral_indicator] <;> simp only [hs, Pi.sub_apply]
   · exact measurableSet_regionBetween hf hg hs
 #align volume_region_between_eq_lintegral' volume_regionBetween_eq_lintegral'
+-/
 
+#print volume_regionBetween_eq_lintegral /-
 /-- The volume of the region between two almost everywhere measurable functions on a measurable set
     can be represented as a Lebesgue integral. -/
 theorem volume_regionBetween_eq_lintegral [SigmaFinite μ] (hf : AEMeasurable f (μ.restrict s))
@@ -644,9 +715,11 @@ theorem volume_regionBetween_eq_lintegral [SigmaFinite μ] (hf : AEMeasurable f
       (measure.restrict_eq_self _
           (regionBetween_subset (AEMeasurable.mk f hf) (AEMeasurable.mk g hg) s)).symm
 #align volume_region_between_eq_lintegral volume_regionBetween_eq_lintegral
+-/
 
 end regionBetween
 
+#print ae_restrict_of_ae_restrict_inter_Ioo /-
 /-- Consider a real set `s`. If a property is true almost everywhere in `s ∩ (a, b)` for
 all `a, b ∈ s`, then it is true almost everywhere in `s`. Formulated with `μ.restrict`.
 See also `ae_of_mem_of_ae_of_mem_inter_Ioo`. -/
@@ -682,7 +755,9 @@ theorem ae_restrict_of_ae_restrict_inter_Ioo {μ : Measure ℝ} [NoAtoms μ] {s
     · simp only [Ioo_eq_empty_of_le hba, inter_empty, restrict_empty, ae_zero]
     · exact h a b as bs hab
 #align ae_restrict_of_ae_restrict_inter_Ioo ae_restrict_of_ae_restrict_inter_Ioo
+-/
 
+#print ae_of_mem_of_ae_of_mem_inter_Ioo /-
 /-- Consider a real set `s`. If a property is true almost everywhere in `s ∩ (a, b)` for
 all `a, b ∈ s`, then it is true almost everywhere in `s`. Formulated with bare membership.
 See also `ae_restrict_of_ae_restrict_inter_Ioo`. -/
@@ -717,4 +792,5 @@ theorem ae_of_mem_of_ae_of_mem_inter_Ioo {μ : Measure ℝ} [NoAtoms μ] {s : Se
     apply h'x p pA ⟨xs, xp⟩
   · exact False.elim (hx ⟨xs, Hx⟩)
 #align ae_of_mem_of_ae_of_mem_inter_Ioo ae_of_mem_of_ae_of_mem_inter_Ioo
+-/
 
Diff
@@ -245,7 +245,7 @@ theorem volume_Icc_pi {a b : ι → ℝ} : volume (Icc a b) = ∏ i, ENNReal.ofR
 
 @[simp]
 theorem volume_Icc_pi_toReal {a b : ι → ℝ} (h : a ≤ b) :
-    (volume (Icc a b)).toReal = ∏ i, b i - a i := by
+    (volume (Icc a b)).toReal = ∏ i, (b i - a i) := by
   simp only [volume_Icc_pi, ENNReal.toReal_prod, ENNReal.toReal_ofReal (sub_nonneg.2 (h _))]
 #align real.volume_Icc_pi_to_real Real.volume_Icc_pi_toReal
 
@@ -258,7 +258,7 @@ theorem volume_pi_Ioo {a b : ι → ℝ} :
 
 @[simp]
 theorem volume_pi_Ioo_toReal {a b : ι → ℝ} (h : a ≤ b) :
-    (volume (pi univ fun i => Ioo (a i) (b i))).toReal = ∏ i, b i - a i := by
+    (volume (pi univ fun i => Ioo (a i) (b i))).toReal = ∏ i, (b i - a i) := by
   simp only [volume_pi_Ioo, ENNReal.toReal_prod, ENNReal.toReal_ofReal (sub_nonneg.2 (h _))]
 #align real.volume_pi_Ioo_to_real Real.volume_pi_Ioo_toReal
 
@@ -271,7 +271,7 @@ theorem volume_pi_Ioc {a b : ι → ℝ} :
 
 @[simp]
 theorem volume_pi_Ioc_toReal {a b : ι → ℝ} (h : a ≤ b) :
-    (volume (pi univ fun i => Ioc (a i) (b i))).toReal = ∏ i, b i - a i := by
+    (volume (pi univ fun i => Ioc (a i) (b i))).toReal = ∏ i, (b i - a i) := by
   simp only [volume_pi_Ioc, ENNReal.toReal_prod, ENNReal.toReal_ofReal (sub_nonneg.2 (h _))]
 #align real.volume_pi_Ioc_to_real Real.volume_pi_Ioc_toReal
 
@@ -284,7 +284,7 @@ theorem volume_pi_Ico {a b : ι → ℝ} :
 
 @[simp]
 theorem volume_pi_Ico_toReal {a b : ι → ℝ} (h : a ≤ b) :
-    (volume (pi univ fun i => Ico (a i) (b i))).toReal = ∏ i, b i - a i := by
+    (volume (pi univ fun i => Ico (a i) (b i))).toReal = ∏ i, (b i - a i) := by
   simp only [volume_pi_Ico, ENNReal.toReal_prod, ENNReal.toReal_ofReal (sub_nonneg.2 (h _))]
 #align real.volume_pi_Ico_to_real Real.volume_pi_Ico_toReal
 
Diff
@@ -112,7 +112,6 @@ theorem volume_univ : volume (univ : Set ℝ) = ∞ :=
     calc
       (r : ℝ≥0∞) = volume (Icc (0 : ℝ) r) := by simp
       _ ≤ volume univ := measure_mono (subset_univ _)
-      
 #align real.volume_univ Real.volume_univ
 
 @[simp]
@@ -163,7 +162,6 @@ theorem volume_Ioi {a : ℝ} : volume (Ioi a) = ∞ :=
       calc
         (n : ℝ≥0∞) = volume (Ioo a (a + n)) := by simp
         _ ≤ volume (Ioi a) := measure_mono Ioo_subset_Ioi_self
-        
 #align real.volume_Ioi Real.volume_Ioi
 
 @[simp]
@@ -177,7 +175,6 @@ theorem volume_Iio {a : ℝ} : volume (Iio a) = ∞ :=
       calc
         (n : ℝ≥0∞) = volume (Ioo (a - n) a) := by simp
         _ ≤ volume (Iio a) := measure_mono Ioo_subset_Iio_self
-        
 #align real.volume_Iio Real.volume_Iio
 
 @[simp]
@@ -316,7 +313,6 @@ theorem volume_pi_le_prod_diam (s : Set (ι → ℝ)) :
     _ = ∏ i, volume (closure <| Function.eval i '' s) := (volume_pi_pi _)
     _ ≤ ∏ i : ι, EMetric.diam (Function.eval i '' s) :=
       Finset.prod_le_prod' fun i hi => (volume_le_diam _).trans_eq (EMetric.diam_closure _)
-    
 #align real.volume_pi_le_prod_diam Real.volume_pi_le_prod_diam
 
 theorem volume_pi_le_diam_pow (s : Set (ι → ℝ)) : volume s ≤ EMetric.diam s ^ Fintype.card ι :=
@@ -326,7 +322,6 @@ theorem volume_pi_le_diam_pow (s : Set (ι → ℝ)) : volume s ≤ EMetric.diam
       (Finset.prod_le_prod' fun i hi => (LipschitzWith.eval i).ediam_image_le s)
     _ = EMetric.diam s ^ Fintype.card ι := by
       simp only [ENNReal.coe_one, one_mul, Finset.prod_const, Fintype.card]
-    
 #align real.volume_pi_le_diam_pow Real.volume_pi_le_diam_pow
 
 /-!
@@ -364,7 +359,6 @@ theorem volume_preimage_mul_left {a : ℝ} (h : a ≠ 0) (s : Set ℝ) :
     volume ((· * ·) a ⁻¹' s) = Measure.map ((· * ·) a) volume s :=
       ((Homeomorph.mulLeft₀ a h).toMeasurableEquiv.map_apply s).symm
     _ = ENNReal.ofReal (abs a⁻¹) * volume s := by rw [map_volume_mul_left h]; rfl
-    
 #align real.volume_preimage_mul_left Real.volume_preimage_mul_left
 
 theorem smul_map_volume_mul_right {a : ℝ} (h : a ≠ 0) :
@@ -384,7 +378,6 @@ theorem volume_preimage_mul_right {a : ℝ} (h : a ≠ 0) (s : Set ℝ) :
     volume ((· * a) ⁻¹' s) = Measure.map (· * a) volume s :=
       ((Homeomorph.mulRight₀ a h).toMeasurableEquiv.map_apply s).symm
     _ = ENNReal.ofReal (abs a⁻¹) * volume s := by rw [map_volume_mul_right h]; rfl
-    
 #align real.volume_preimage_mul_right Real.volume_preimage_mul_right
 
 /-!
Diff
@@ -35,7 +35,7 @@ are proved more generally for any additive Haar measure on a finite-dimensional
 -/
 
 
-assert_not_exists measure_theory.integral
+assert_not_exists MeasureTheory.integral
 
 noncomputable section
 
Diff
@@ -238,11 +238,13 @@ theorem Filter.Eventually.volume_pos_of_nhds_real {p : ℝ → Prop} {a : ℝ} (
 -/
 
 
+#print Real.volume_Icc_pi /-
 theorem volume_Icc_pi {a b : ι → ℝ} : volume (Icc a b) = ∏ i, ENNReal.ofReal (b i - a i) :=
   by
   rw [← pi_univ_Icc, volume_pi_pi]
   simp only [Real.volume_Icc]
 #align real.volume_Icc_pi Real.volume_Icc_pi
+-/
 
 @[simp]
 theorem volume_Icc_pi_toReal {a b : ι → ℝ} (h : a ≤ b) :
@@ -250,10 +252,12 @@ theorem volume_Icc_pi_toReal {a b : ι → ℝ} (h : a ≤ b) :
   simp only [volume_Icc_pi, ENNReal.toReal_prod, ENNReal.toReal_ofReal (sub_nonneg.2 (h _))]
 #align real.volume_Icc_pi_to_real Real.volume_Icc_pi_toReal
 
+#print Real.volume_pi_Ioo /-
 theorem volume_pi_Ioo {a b : ι → ℝ} :
     volume (pi univ fun i => Ioo (a i) (b i)) = ∏ i, ENNReal.ofReal (b i - a i) :=
   (measure_congr Measure.univ_pi_Ioo_ae_eq_Icc).trans volume_Icc_pi
 #align real.volume_pi_Ioo Real.volume_pi_Ioo
+-/
 
 @[simp]
 theorem volume_pi_Ioo_toReal {a b : ι → ℝ} (h : a ≤ b) :
@@ -261,10 +265,12 @@ theorem volume_pi_Ioo_toReal {a b : ι → ℝ} (h : a ≤ b) :
   simp only [volume_pi_Ioo, ENNReal.toReal_prod, ENNReal.toReal_ofReal (sub_nonneg.2 (h _))]
 #align real.volume_pi_Ioo_to_real Real.volume_pi_Ioo_toReal
 
+#print Real.volume_pi_Ioc /-
 theorem volume_pi_Ioc {a b : ι → ℝ} :
     volume (pi univ fun i => Ioc (a i) (b i)) = ∏ i, ENNReal.ofReal (b i - a i) :=
   (measure_congr Measure.univ_pi_Ioc_ae_eq_Icc).trans volume_Icc_pi
 #align real.volume_pi_Ioc Real.volume_pi_Ioc
+-/
 
 @[simp]
 theorem volume_pi_Ioc_toReal {a b : ι → ℝ} (h : a ≤ b) :
@@ -272,10 +278,12 @@ theorem volume_pi_Ioc_toReal {a b : ι → ℝ} (h : a ≤ b) :
   simp only [volume_pi_Ioc, ENNReal.toReal_prod, ENNReal.toReal_ofReal (sub_nonneg.2 (h _))]
 #align real.volume_pi_Ioc_to_real Real.volume_pi_Ioc_toReal
 
+#print Real.volume_pi_Ico /-
 theorem volume_pi_Ico {a b : ι → ℝ} :
     volume (pi univ fun i => Ico (a i) (b i)) = ∏ i, ENNReal.ofReal (b i - a i) :=
   (measure_congr Measure.univ_pi_Ico_ae_eq_Icc).trans volume_Icc_pi
 #align real.volume_pi_Ico Real.volume_pi_Ico
+-/
 
 @[simp]
 theorem volume_pi_Ico_toReal {a b : ι → ℝ} (h : a ≤ b) :
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Johannes Hölzl, Sébastien Gouëzel, Yury Kudryashov
 
 ! This file was ported from Lean 3 source module measure_theory.measure.lebesgue.basic
-! leanprover-community/mathlib commit fd5edc43dc4f10b85abfe544b88f82cf13c5f844
+! leanprover-community/mathlib commit af471b9e3ce868f296626d33189b4ce730fa4c00
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -19,6 +19,9 @@ import Mathbin.MeasureTheory.Measure.Haar.OfBasis
 /-!
 # Lebesgue measure on the real line and on `ℝⁿ`
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 We show that the Lebesgue measure on the real line (constructed as a particular case of additive
 Haar measure on inner product spaces) coincides with the Stieltjes measure associated
 to the function `x ↦ x`. We deduce properties of this measure on `ℝ`, and then of the product
@@ -51,6 +54,7 @@ namespace Real
 
 variable {ι : Type _} [Fintype ι]
 
+#print Real.volume_eq_stieltjes_id /-
 /-- The volume on the real line (as a particular case of the volume on a finite-dimensional
 inner product space) coincides with the Stieltjes measure coming from the identity function. -/
 theorem volume_eq_stieltjes_id : (volume : Measure ℝ) = StieltjesFunction.id.Measure :=
@@ -74,10 +78,13 @@ theorem volume_eq_stieltjes_id : (volume : Measure ℝ) = StieltjesFunction.id.M
       A]
   simp only [volume, Basis.addHaar, one_smul]
 #align real.volume_eq_stieltjes_id Real.volume_eq_stieltjes_id
+-/
 
+#print Real.volume_val /-
 theorem volume_val (s) : volume s = StieltjesFunction.id.Measure s := by
   simp [volume_eq_stieltjes_id]
 #align real.volume_val Real.volume_val
+-/
 
 @[simp]
 theorem volume_Ico {a b : ℝ} : volume (Ico a b) = ofReal (b - a) := by simp [volume_val]
@@ -138,9 +145,11 @@ theorem volume_emetric_closedBall (a : ℝ) (r : ℝ≥0∞) : volume (EMetric.c
       ENNReal.ofReal_coe_nnreal, ENNReal.coe_add, two_mul]
 #align real.volume_emetric_closed_ball Real.volume_emetric_closedBall
 
+#print Real.noAtoms_volume /-
 instance noAtoms_volume : NoAtoms (volume : Measure ℝ) :=
   ⟨fun x => volume_singleton⟩
 #align real.has_no_atoms_volume Real.noAtoms_volume
+-/
 
 @[simp]
 theorem volume_interval {a b : ℝ} : volume (uIcc a b) = ofReal (|b - a|) := by
@@ -175,28 +184,38 @@ theorem volume_Iio {a : ℝ} : volume (Iio a) = ∞ :=
 theorem volume_Iic {a : ℝ} : volume (Iic a) = ∞ := by simp [← measure_congr Iio_ae_eq_Iic]
 #align real.volume_Iic Real.volume_Iic
 
-instance locally_finite_volume : LocallyFiniteMeasure (volume : Measure ℝ) :=
+#print Real.locallyFinite_volume /-
+instance locallyFinite_volume : IsLocallyFiniteMeasure (volume : Measure ℝ) :=
   ⟨fun x =>
     ⟨Ioo (x - 1) (x + 1),
       IsOpen.mem_nhds isOpen_Ioo ⟨sub_lt_self _ zero_lt_one, lt_add_of_pos_right _ zero_lt_one⟩, by
       simp only [Real.volume_Ioo, ENNReal.ofReal_lt_top]⟩⟩
-#align real.locally_finite_volume Real.locally_finite_volume
+#align real.locally_finite_volume Real.locallyFinite_volume
+-/
 
-instance finiteMeasure_restrict_Icc (x y : ℝ) : FiniteMeasure (volume.restrict (Icc x y)) :=
+#print Real.isFiniteMeasure_restrict_Icc /-
+instance isFiniteMeasure_restrict_Icc (x y : ℝ) : IsFiniteMeasure (volume.restrict (Icc x y)) :=
   ⟨by simp⟩
-#align real.is_finite_measure_restrict_Icc Real.finiteMeasure_restrict_Icc
+#align real.is_finite_measure_restrict_Icc Real.isFiniteMeasure_restrict_Icc
+-/
 
-instance finiteMeasure_restrict_Ico (x y : ℝ) : FiniteMeasure (volume.restrict (Ico x y)) :=
+#print Real.isFiniteMeasure_restrict_Ico /-
+instance isFiniteMeasure_restrict_Ico (x y : ℝ) : IsFiniteMeasure (volume.restrict (Ico x y)) :=
   ⟨by simp⟩
-#align real.is_finite_measure_restrict_Ico Real.finiteMeasure_restrict_Ico
+#align real.is_finite_measure_restrict_Ico Real.isFiniteMeasure_restrict_Ico
+-/
 
-instance finiteMeasure_restrict_Ioc (x y : ℝ) : FiniteMeasure (volume.restrict (Ioc x y)) :=
+#print Real.isFiniteMeasure_restrict_Ioc /-
+instance isFiniteMeasure_restrict_Ioc (x y : ℝ) : IsFiniteMeasure (volume.restrict (Ioc x y)) :=
   ⟨by simp⟩
-#align real.is_finite_measure_restrict_Ioc Real.finiteMeasure_restrict_Ioc
+#align real.is_finite_measure_restrict_Ioc Real.isFiniteMeasure_restrict_Ioc
+-/
 
-instance finiteMeasure_restrict_Ioo (x y : ℝ) : FiniteMeasure (volume.restrict (Ioo x y)) :=
+#print Real.isFiniteMeasure_restrict_Ioo /-
+instance isFiniteMeasure_restrict_Ioo (x y : ℝ) : IsFiniteMeasure (volume.restrict (Ioo x y)) :=
   ⟨by simp⟩
-#align real.is_finite_measure_restrict_Ioo Real.finiteMeasure_restrict_Ioo
+#align real.is_finite_measure_restrict_Ioo Real.isFiniteMeasure_restrict_Ioo
+-/
 
 theorem volume_le_diam (s : Set ℝ) : volume s ≤ EMetric.diam s :=
   by
@@ -207,7 +226,7 @@ theorem volume_le_diam (s : Set ℝ) : volume s ≤ EMetric.diam s :=
 #align real.volume_le_diam Real.volume_le_diam
 
 theorem Filter.Eventually.volume_pos_of_nhds_real {p : ℝ → Prop} {a : ℝ} (h : ∀ᶠ x in 𝓝 a, p x) :
-    (0 : ℝ≥0∞) < volume { x | p x } :=
+    (0 : ℝ≥0∞) < volume {x | p x} :=
   by
   rcases h.exists_Ioo_subset with ⟨l, u, hx, hs⟩
   refine' lt_of_lt_of_le _ (measure_mono hs)
@@ -397,6 +416,7 @@ theorem smul_map_diagonal_volume_pi [DecidableEq ι] {D : ι → ℝ} (h : det (
   simp only [B]
 #align real.smul_map_diagonal_volume_pi Real.smul_map_diagonal_volume_pi
 
+#print Real.volume_preserving_transvectionStruct /-
 /-- A transvection preserves Lebesgue measure. -/
 theorem volume_preserving_transvectionStruct [DecidableEq ι] (t : TransvectionStruct ι ℝ) :
     MeasurePreserving t.toMatrix.toLin' :=
@@ -442,6 +462,7 @@ theorem volume_preserving_transvectionStruct [DecidableEq ι] (t : TransvectionS
       (eventually_of_forall fun a => map_add_left_eq_self _ _)
   exact ((A.symm e).comp B).comp A
 #align real.volume_preserving_transvection_struct Real.volume_preserving_transvectionStruct
+-/
 
 /-- Any invertible matrix rescales Lebesgue measure through the absolute value of its
 determinant. -/
@@ -472,13 +493,13 @@ determinant. -/
 theorem map_linearMap_volume_pi_eq_smul_volume_pi {f : (ι → ℝ) →ₗ[ℝ] ι → ℝ} (hf : f.det ≠ 0) :
     Measure.map f volume = ENNReal.ofReal (abs f.det⁻¹) • volume := by
   classical
-    -- this is deduced from the matrix case
-    let M := f.to_matrix'
-    have A : f.det = det M := by simp only [LinearMap.det_toMatrix']
-    have B : f = M.to_lin' := by simp only [to_lin'_to_matrix']
-    rw [A, B]
-    apply map_matrix_volume_pi_eq_smul_volume_pi
-    rwa [A] at hf 
+  -- this is deduced from the matrix case
+  let M := f.to_matrix'
+  have A : f.det = det M := by simp only [LinearMap.det_toMatrix']
+  have B : f = M.to_lin' := by simp only [to_lin'_to_matrix']
+  rw [A, B]
+  apply map_matrix_volume_pi_eq_smul_volume_pi
+  rwa [A] at hf 
 #align real.map_linear_map_volume_pi_eq_smul_volume_pi Real.map_linearMap_volume_pi_eq_smul_volume_pi
 
 end Real
@@ -487,18 +508,23 @@ section regionBetween
 
 variable {α : Type _}
 
+#print regionBetween /-
 /-- The region between two real-valued functions on an arbitrary set. -/
 def regionBetween (f g : α → ℝ) (s : Set α) : Set (α × ℝ) :=
-  { p : α × ℝ | p.1 ∈ s ∧ p.2 ∈ Ioo (f p.1) (g p.1) }
+  {p : α × ℝ | p.1 ∈ s ∧ p.2 ∈ Ioo (f p.1) (g p.1)}
 #align region_between regionBetween
+-/
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print regionBetween_subset /-
 theorem regionBetween_subset (f g : α → ℝ) (s : Set α) : regionBetween f g s ⊆ s ×ˢ univ := by
   simpa only [prod_univ, regionBetween, Set.preimage, set_of_subset_set_of] using fun a => And.left
 #align region_between_subset regionBetween_subset
+-/
 
 variable [MeasurableSpace α] {μ : Measure α} {f g : α → ℝ} {s : Set α}
 
+#print measurableSet_regionBetween /-
 /-- The region between two measurable functions on a measurable set is measurable. -/
 theorem measurableSet_regionBetween (hf : Measurable f) (hg : Measurable g) (hs : MeasurableSet s) :
     MeasurableSet (regionBetween f g s) :=
@@ -510,12 +536,14 @@ theorem measurableSet_regionBetween (hf : Measurable f) (hg : Measurable g) (hs
         (measurableSet_lt measurable_snd (hg.comp measurable_fst)))
   exact measurable_fst hs
 #align measurable_set_region_between measurableSet_regionBetween
+-/
 
+#print measurableSet_region_between_oc /-
 /-- The region between two measurable functions on a measurable set is measurable;
 a version for the region together with the graph of the upper function. -/
 theorem measurableSet_region_between_oc (hf : Measurable f) (hg : Measurable g)
     (hs : MeasurableSet s) :
-    MeasurableSet { p : α × ℝ | p.fst ∈ s ∧ p.snd ∈ Ioc (f p.fst) (g p.fst) } :=
+    MeasurableSet {p : α × ℝ | p.fst ∈ s ∧ p.snd ∈ Ioc (f p.fst) (g p.fst)} :=
   by
   dsimp only [regionBetween, Ioc, mem_set_of_eq, set_of_and]
   refine'
@@ -524,12 +552,14 @@ theorem measurableSet_region_between_oc (hf : Measurable f) (hg : Measurable g)
         (measurableSet_le measurable_snd (hg.comp measurable_fst)))
   exact measurable_fst hs
 #align measurable_set_region_between_oc measurableSet_region_between_oc
+-/
 
+#print measurableSet_region_between_co /-
 /-- The region between two measurable functions on a measurable set is measurable;
 a version for the region together with the graph of the lower function. -/
 theorem measurableSet_region_between_co (hf : Measurable f) (hg : Measurable g)
     (hs : MeasurableSet s) :
-    MeasurableSet { p : α × ℝ | p.fst ∈ s ∧ p.snd ∈ Ico (f p.fst) (g p.fst) } :=
+    MeasurableSet {p : α × ℝ | p.fst ∈ s ∧ p.snd ∈ Ico (f p.fst) (g p.fst)} :=
   by
   dsimp only [regionBetween, Ico, mem_set_of_eq, set_of_and]
   refine'
@@ -538,12 +568,14 @@ theorem measurableSet_region_between_co (hf : Measurable f) (hg : Measurable g)
         (measurableSet_lt measurable_snd (hg.comp measurable_fst)))
   exact measurable_fst hs
 #align measurable_set_region_between_co measurableSet_region_between_co
+-/
 
+#print measurableSet_region_between_cc /-
 /-- The region between two measurable functions on a measurable set is measurable;
 a version for the region together with the graphs of both functions. -/
 theorem measurableSet_region_between_cc (hf : Measurable f) (hg : Measurable g)
     (hs : MeasurableSet s) :
-    MeasurableSet { p : α × ℝ | p.fst ∈ s ∧ p.snd ∈ Icc (f p.fst) (g p.fst) } :=
+    MeasurableSet {p : α × ℝ | p.fst ∈ s ∧ p.snd ∈ Icc (f p.fst) (g p.fst)} :=
   by
   dsimp only [regionBetween, Icc, mem_set_of_eq, set_of_and]
   refine'
@@ -552,31 +584,34 @@ theorem measurableSet_region_between_cc (hf : Measurable f) (hg : Measurable g)
         (measurableSet_le measurable_snd (hg.comp measurable_fst)))
   exact measurable_fst hs
 #align measurable_set_region_between_cc measurableSet_region_between_cc
+-/
 
+#print measurableSet_graph /-
 /-- The graph of a measurable function is a measurable set. -/
-theorem measurableSet_graph (hf : Measurable f) : MeasurableSet { p : α × ℝ | p.snd = f p.fst } :=
-  by simpa using measurableSet_region_between_cc hf hf MeasurableSet.univ
+theorem measurableSet_graph (hf : Measurable f) : MeasurableSet {p : α × ℝ | p.snd = f p.fst} := by
+  simpa using measurableSet_region_between_cc hf hf MeasurableSet.univ
 #align measurable_set_graph measurableSet_graph
+-/
 
 theorem volume_regionBetween_eq_lintegral' (hf : Measurable f) (hg : Measurable g)
     (hs : MeasurableSet s) :
     μ.Prod volume (regionBetween f g s) = ∫⁻ y in s, ENNReal.ofReal ((g - f) y) ∂μ := by
   classical
-    rw [measure.prod_apply]
-    · have h :
-        (fun x => volume { a | x ∈ s ∧ a ∈ Ioo (f x) (g x) }) =
-          s.indicator fun x => ENNReal.ofReal (g x - f x) :=
-        by
-        funext x
-        rw [indicator_apply]
-        split_ifs
-        · have hx : { a | x ∈ s ∧ a ∈ Ioo (f x) (g x) } = Ioo (f x) (g x) := by simp [h, Ioo]
-          simp only [hx, Real.volume_Ioo, sub_zero]
-        · have hx : { a | x ∈ s ∧ a ∈ Ioo (f x) (g x) } = ∅ := by simp [h]
-          simp only [hx, measure_empty]
-      dsimp only [regionBetween, preimage_set_of_eq]
-      rw [h, lintegral_indicator] <;> simp only [hs, Pi.sub_apply]
-    · exact measurableSet_regionBetween hf hg hs
+  rw [measure.prod_apply]
+  · have h :
+      (fun x => volume {a | x ∈ s ∧ a ∈ Ioo (f x) (g x)}) =
+        s.indicator fun x => ENNReal.ofReal (g x - f x) :=
+      by
+      funext x
+      rw [indicator_apply]
+      split_ifs
+      · have hx : {a | x ∈ s ∧ a ∈ Ioo (f x) (g x)} = Ioo (f x) (g x) := by simp [h, Ioo]
+        simp only [hx, Real.volume_Ioo, sub_zero]
+      · have hx : {a | x ∈ s ∧ a ∈ Ioo (f x) (g x)} = ∅ := by simp [h]
+        simp only [hx, measure_empty]
+    dsimp only [regionBetween, preimage_set_of_eq]
+    rw [h, lintegral_indicator] <;> simp only [hs, Pi.sub_apply]
+  · exact measurableSet_regionBetween hf hg hs
 #align volume_region_between_eq_lintegral' volume_regionBetween_eq_lintegral'
 
 /-- The volume of the region between two almost everywhere measurable functions on a measurable set
@@ -672,7 +707,7 @@ theorem ae_of_mem_of_ae_of_mem_inter_Ioo {μ : Measure ℝ} [NoAtoms μ] {s : Se
       simp only [Ioo_eq_empty_of_le hba, inter_empty, IsEmpty.forall_iff, eventually_true,
         mem_empty_iff_false]
     · exact h a b as bs hab
-  filter_upwards [M, M']with x hx h'x
+  filter_upwards [M, M'] with x hx h'x
   intro xs
   by_cases Hx : x ∈ ⋃ i : ↥s × ↥s, T i
   · rw [← hA] at Hx 
Diff
@@ -388,7 +388,7 @@ theorem smul_map_diagonal_volume_pi [DecidableEq ι] {D : ι → ℝ} (h : det (
     by
     intro i
     have A : D i ≠ 0 := by
-      simp only [det_diagonal, Ne.def] at h
+      simp only [det_diagonal, Ne.def] at h 
       exact Finset.prod_ne_zero_iff.1 h i (Finset.mem_univ i)
     rw [volume_preimage_mul_left A, ← mul_assoc, ← ENNReal.ofReal_mul (abs_nonneg _), ← abs_mul,
       mul_inv_cancel A, abs_one, ENNReal.ofReal_one, one_mul]
@@ -478,7 +478,7 @@ theorem map_linearMap_volume_pi_eq_smul_volume_pi {f : (ι → ℝ) →ₗ[ℝ]
     have B : f = M.to_lin' := by simp only [to_lin'_to_matrix']
     rw [A, B]
     apply map_matrix_volume_pi_eq_smul_volume_pi
-    rwa [A] at hf
+    rwa [A] at hf 
 #align real.map_linear_map_volume_pi_eq_smul_volume_pi Real.map_linearMap_volume_pi_eq_smul_volume_pi
 
 end Real
@@ -629,7 +629,7 @@ theorem ae_restrict_of_ae_restrict_inter_Ioo {μ : Measure ℝ} [NoAtoms μ] {s
   have : s ⊆ s \ u ∪ ⋃ p ∈ A, s ∩ T p := by
     intro x hx
     by_cases h'x : x ∈ ⋃ i : ↥s × ↥s, T i
-    · rw [← hA] at h'x
+    · rw [← hA] at h'x 
       obtain ⟨p, pA, xp⟩ : ∃ p : ↥s × ↥s, p ∈ A ∧ x ∈ T p := by
         simpa only [mem_Union, exists_prop, SetCoe.exists, exists_and_right] using h'x
       right
@@ -675,7 +675,7 @@ theorem ae_of_mem_of_ae_of_mem_inter_Ioo {μ : Measure ℝ} [NoAtoms μ] {s : Se
   filter_upwards [M, M']with x hx h'x
   intro xs
   by_cases Hx : x ∈ ⋃ i : ↥s × ↥s, T i
-  · rw [← hA] at Hx
+  · rw [← hA] at Hx 
     obtain ⟨p, pA, xp⟩ : ∃ p : ↥s × ↥s, p ∈ A ∧ x ∈ T p := by
       simpa only [mem_Union, exists_prop, SetCoe.exists, exists_and_right] using Hx
     apply h'x p pA ⟨xs, xp⟩
Diff
@@ -40,7 +40,7 @@ open Classical Set Filter MeasureTheory MeasureTheory.Measure TopologicalSpace
 
 open ENNReal (ofReal)
 
-open BigOperators ENNReal NNReal Topology
+open scoped BigOperators ENNReal NNReal Topology
 
 /-!
 ### Definition of the Lebesgue measure and lengths of intervals
Diff
@@ -203,8 +203,7 @@ theorem volume_le_diam (s : Set ℝ) : volume s ≤ EMetric.diam s :=
   by_cases hs : Metric.Bounded s
   · rw [Real.ediam_eq hs, ← volume_Icc]
     exact volume.mono (Real.subset_Icc_sInf_sSup_of_bounded hs)
-  · rw [Metric.ediam_of_unbounded hs]
-    exact le_top
+  · rw [Metric.ediam_of_unbounded hs]; exact le_top
 #align real.volume_le_diam Real.volume_le_diam
 
 theorem Filter.Eventually.volume_pos_of_nhds_real {p : ℝ → Prop} {a : ℝ} (h : ∀ᶠ x in 𝓝 a, p x) :
@@ -337,10 +336,7 @@ theorem volume_preimage_mul_left {a : ℝ} (h : a ≠ 0) (s : Set ℝ) :
   calc
     volume ((· * ·) a ⁻¹' s) = Measure.map ((· * ·) a) volume s :=
       ((Homeomorph.mulLeft₀ a h).toMeasurableEquiv.map_apply s).symm
-    _ = ENNReal.ofReal (abs a⁻¹) * volume s :=
-      by
-      rw [map_volume_mul_left h]
-      rfl
+    _ = ENNReal.ofReal (abs a⁻¹) * volume s := by rw [map_volume_mul_left h]; rfl
     
 #align real.volume_preimage_mul_left Real.volume_preimage_mul_left
 
@@ -360,10 +356,7 @@ theorem volume_preimage_mul_right {a : ℝ} (h : a ≠ 0) (s : Set ℝ) :
   calc
     volume ((· * a) ⁻¹' s) = Measure.map (· * a) volume s :=
       ((Homeomorph.mulRight₀ a h).toMeasurableEquiv.map_apply s).symm
-    _ = ENNReal.ofReal (abs a⁻¹) * volume s :=
-      by
-      rw [map_volume_mul_right h]
-      rfl
+    _ = ENNReal.ofReal (abs a⁻¹) * volume s := by rw [map_volume_mul_right h]; rfl
     
 #align real.volume_preimage_mul_right Real.volume_preimage_mul_right
 
@@ -383,8 +376,7 @@ theorem smul_map_diagonal_volume_pi [DecidableEq ι] {D : ι → ℝ} (h : det (
   refine' (measure.pi_eq fun s hs => _).symm
   simp only [det_diagonal, measure.coe_smul, Algebra.id.smul_eq_mul, Pi.smul_apply]
   rw [measure.map_apply _ (MeasurableSet.univ_pi hs)]
-  swap
-  · exact Continuous.measurable (LinearMap.continuous_on_pi _)
+  swap; · exact Continuous.measurable (LinearMap.continuous_on_pi _)
   have :
     (Matrix.toLin' (diagonal D) ⁻¹' Set.pi Set.univ fun i : ι => s i) =
       Set.pi Set.univ fun i : ι => (· * ·) (D i) ⁻¹' s i :=
Diff
@@ -3,8 +3,8 @@ Copyright (c) 2017 Johannes Hölzl. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Johannes Hölzl, Sébastien Gouëzel, Yury Kudryashov
 
-! This file was ported from Lean 3 source module measure_theory.measure.lebesgue
-! leanprover-community/mathlib commit ec4528061e02f0acc848ed06eb22573645602c7e
+! This file was ported from Lean 3 source module measure_theory.measure.lebesgue.basic
+! leanprover-community/mathlib commit fd5edc43dc4f10b85abfe544b88f82cf13c5f844
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -14,7 +14,7 @@ import Mathbin.LinearAlgebra.Matrix.Diagonal
 import Mathbin.LinearAlgebra.Matrix.Transvection
 import Mathbin.MeasureTheory.Constructions.Pi
 import Mathbin.MeasureTheory.Measure.Stieltjes
-import Mathbin.MeasureTheory.Measure.HaarOfBasis
+import Mathbin.MeasureTheory.Measure.Haar.OfBasis
 
 /-!
 # Lebesgue measure on the real line and on `ℝⁿ`
@@ -27,11 +27,13 @@ Lebesgue measure on `ℝⁿ`. In particular, we prove that they are translation
 We show that, on `ℝⁿ`, a linear map acts on Lebesgue measure by rescaling it through the absolute
 value of its determinant, in `real.map_linear_map_volume_pi_eq_smul_volume_pi`.
 
-More properties of the Lebesgue measure are deduced from this in `haar_lebesgue.lean`, where they
+More properties of the Lebesgue measure are deduced from this in `lebesgue.eq_haar.lean`, where they
 are proved more generally for any additive Haar measure on a finite-dimensional real vector space.
 -/
 
 
+assert_not_exists measure_theory.integral
+
 noncomputable section
 
 open Classical Set Filter MeasureTheory MeasureTheory.Measure TopologicalSpace
@@ -615,28 +617,6 @@ theorem volume_regionBetween_eq_lintegral [SigmaFinite μ] (hf : AEMeasurable f
           (regionBetween_subset (AEMeasurable.mk f hf) (AEMeasurable.mk g hg) s)).symm
 #align volume_region_between_eq_lintegral volume_regionBetween_eq_lintegral
 
-theorem volume_regionBetween_eq_integral' [SigmaFinite μ] (f_int : IntegrableOn f s μ)
-    (g_int : IntegrableOn g s μ) (hs : MeasurableSet s) (hfg : f ≤ᵐ[μ.restrict s] g) :
-    μ.Prod volume (regionBetween f g s) = ENNReal.ofReal (∫ y in s, (g - f) y ∂μ) :=
-  by
-  have h : g - f =ᵐ[μ.restrict s] fun x => Real.toNNReal (g x - f x) :=
-    hfg.mono fun x hx => (Real.coe_toNNReal _ <| sub_nonneg.2 hx).symm
-  rw [volume_regionBetween_eq_lintegral f_int.ae_measurable g_int.ae_measurable hs,
-    integral_congr_ae h, lintegral_congr_ae,
-    lintegral_coe_eq_integral _ ((integrable_congr h).mp (g_int.sub f_int))]
-  simpa only
-#align volume_region_between_eq_integral' volume_regionBetween_eq_integral'
-
-/-- If two functions are integrable on a measurable set, and one function is less than
-    or equal to the other on that set, then the volume of the region
-    between the two functions can be represented as an integral. -/
-theorem volume_regionBetween_eq_integral [SigmaFinite μ] (f_int : IntegrableOn f s μ)
-    (g_int : IntegrableOn g s μ) (hs : MeasurableSet s) (hfg : ∀ x ∈ s, f x ≤ g x) :
-    μ.Prod volume (regionBetween f g s) = ENNReal.ofReal (∫ y in s, (g - f) y ∂μ) :=
-  volume_regionBetween_eq_integral' f_int g_int hs
-    ((ae_restrict_iff' hs).mpr (eventually_of_forall hfg))
-#align volume_region_between_eq_integral volume_regionBetween_eq_integral
-
 end regionBetween
 
 /-- Consider a real set `s`. If a property is true almost everywhere in `s ∩ (a, b)` for
@@ -710,64 +690,3 @@ theorem ae_of_mem_of_ae_of_mem_inter_Ioo {μ : Measure ℝ} [NoAtoms μ] {s : Se
   · exact False.elim (hx ⟨xs, Hx⟩)
 #align ae_of_mem_of_ae_of_mem_inter_Ioo ae_of_mem_of_ae_of_mem_inter_Ioo
 
-section SummableNormIcc
-
-open ContinuousMap
-
-/- The following lemma is a minor variation on `integrable_of_summable_norm_restrict` in
-`measure_theory.integral.set_integral`, but it is placed here because it needs to know that
-`Icc a b` has volume `b - a`. -/
-/-- If the sequence with `n`-th term the the sup norm of `λ x, f (x + n)` on the interval `Icc 0 1`,
-for `n ∈ ℤ`, is summable, then `f` is integrable on `ℝ`. -/
-theorem Real.integrable_of_summable_norm_Icc {E : Type _} [NormedAddCommGroup E] {f : C(ℝ, E)}
-    (hf : Summable fun n : ℤ => ‖(f.comp <| ContinuousMap.addRight n).restrict (Icc 0 1)‖) :
-    Integrable f :=
-  by
-  refine'
-    integrable_of_summable_norm_restrict
-      (summable_of_nonneg_of_le
-        (fun n : ℤ =>
-          mul_nonneg (norm_nonneg (f.restrict (⟨Icc n (n + 1), is_compact_Icc⟩ : compacts ℝ)))
-            ENNReal.toReal_nonneg)
-        (fun n => _) hf)
-      (iUnion_Icc_int_cast ℝ)
-  simp only [compacts.coe_mk, Real.volume_Icc, add_sub_cancel', ENNReal.toReal_ofReal zero_le_one,
-    mul_one, norm_le _ (norm_nonneg _)]
-  intro x
-  have :=
-    ((f.comp <| ContinuousMap.addRight n).restrict (Icc 0 1)).norm_coe_le_norm
-      ⟨x - n, ⟨sub_nonneg.mpr x.2.1, sub_le_iff_le_add'.mpr x.2.2⟩⟩
-  simpa only [ContinuousMap.restrict_apply, comp_apply, coe_add_right, Subtype.coe_mk,
-    sub_add_cancel] using this
-#align real.integrable_of_summable_norm_Icc Real.integrable_of_summable_norm_Icc
-
-end SummableNormIcc
-
-/-!
-### Substituting `-x` for `x`
-
-These lemmas are stated in terms of either `Iic` or `Ioi` (neglecting `Iio` and `Ici`) to match
-mathlib's conventions for integrals over finite intervals (see `interval_integral`). For the case
-of finite integrals, see `interval_integral.integral_comp_neg`.
--/
-
-
-@[simp]
-theorem integral_comp_neg_Iic {E : Type _} [NormedAddCommGroup E] [NormedSpace ℝ E]
-    [CompleteSpace E] (c : ℝ) (f : ℝ → E) : (∫ x in Iic c, f (-x)) = ∫ x in Ioi (-c), f x :=
-  by
-  have A : MeasurableEmbedding fun x : ℝ => -x :=
-    (Homeomorph.neg ℝ).ClosedEmbedding.MeasurableEmbedding
-  have := A.set_integral_map f (Ici (-c))
-  rw [measure.map_neg_eq_self (volume : Measure ℝ)] at this
-  simp_rw [← integral_Ici_eq_integral_Ioi, this, neg_preimage, preimage_neg_Ici, neg_neg]
-#align integral_comp_neg_Iic integral_comp_neg_Iic
-
-@[simp]
-theorem integral_comp_neg_Ioi {E : Type _} [NormedAddCommGroup E] [NormedSpace ℝ E]
-    [CompleteSpace E] (c : ℝ) (f : ℝ → E) : (∫ x in Ioi c, f (-x)) = ∫ x in Iic (-c), f x :=
-  by
-  rw [← neg_neg c, ← integral_comp_neg_Iic]
-  simp only [neg_neg]
-#align integral_comp_neg_Ioi integral_comp_neg_Ioi
-

Changes in mathlib4

mathlib3
mathlib4
chore: avoid id.def (adaptation for nightly-2024-03-27) (#11829)

Co-authored-by: Ruben Van de Velde <65514131+Ruben-VandeVelde@users.noreply.github.com>

Diff
@@ -60,11 +60,11 @@ theorem volume_eq_stieltjes_id : (volume : Measure ℝ) = StieltjesFunction.id.m
         Real.measure_ext_Ioo_rat fun p q => by
           simp only [Measure.map_apply (measurable_const_add a) measurableSet_Ioo,
             sub_sub_sub_cancel_right, StieltjesFunction.measure_Ioo, StieltjesFunction.id_leftLim,
-            StieltjesFunction.id_apply, id.def, preimage_const_add_Ioo]⟩
+            StieltjesFunction.id_apply, id, preimage_const_add_Ioo]⟩
   have A : StieltjesFunction.id.measure (stdOrthonormalBasis ℝ ℝ).toBasis.parallelepiped = 1 := by
     change StieltjesFunction.id.measure (parallelepiped (stdOrthonormalBasis ℝ ℝ)) = 1
     rcases parallelepiped_orthonormalBasis_one_dim (stdOrthonormalBasis ℝ ℝ) with (H | H) <;>
-      simp only [H, StieltjesFunction.measure_Icc, StieltjesFunction.id_apply, id.def, tsub_zero,
+      simp only [H, StieltjesFunction.measure_Icc, StieltjesFunction.id_apply, id, tsub_zero,
         StieltjesFunction.id_leftLim, sub_neg_eq_add, zero_add, ENNReal.ofReal_one]
   conv_rhs =>
     rw [addHaarMeasure_unique StieltjesFunction.id.measure
chore: superfluous parentheses part 2 (#12131)

Co-authored-by: Moritz Firsching <firsching@google.com>

Diff
@@ -273,7 +273,7 @@ theorem volume_pi_le_prod_diam (s : Set (ι → ℝ)) :
     volume s ≤ volume (pi univ fun i => closure (Function.eval i '' s)) :=
       volume.mono <|
         Subset.trans (subset_pi_eval_image univ s) <| pi_mono fun _ _ => subset_closure
-    _ = ∏ i, volume (closure <| Function.eval i '' s) := (volume_pi_pi _)
+    _ = ∏ i, volume (closure <| Function.eval i '' s) := volume_pi_pi _
     _ ≤ ∏ i : ι, EMetric.diam (Function.eval i '' s) :=
       Finset.prod_le_prod' fun _ _ => (volume_le_diam _).trans_eq (EMetric.diam_closure _)
 #align real.volume_pi_le_prod_diam Real.volume_pi_le_prod_diam
refactor: golf proof using lmarginal (#10857)

Co-authored-by: Heather Macbeth [25316162+hrmacbeth@users.noreply.github.com](mailto:25316162+hrmacbeth@users.noreply.github.com)

Diff
@@ -7,7 +7,8 @@ import Mathlib.Dynamics.Ergodic.MeasurePreserving
 import Mathlib.LinearAlgebra.Determinant
 import Mathlib.LinearAlgebra.Matrix.Diagonal
 import Mathlib.LinearAlgebra.Matrix.Transvection
-import Mathlib.MeasureTheory.Constructions.Pi
+import Mathlib.MeasureTheory.Group.LIntegral
+import Mathlib.MeasureTheory.Integral.Marginal
 import Mathlib.MeasureTheory.Measure.Stieltjes
 import Mathlib.MeasureTheory.Measure.Haar.OfBasis
 
@@ -377,44 +378,23 @@ theorem smul_map_diagonal_volume_pi [DecidableEq ι] {D : ι → ℝ} (h : det (
 /-- A transvection preserves Lebesgue measure. -/
 theorem volume_preserving_transvectionStruct [DecidableEq ι] (t : TransvectionStruct ι ℝ) :
     MeasurePreserving (toLin' t.toMatrix) := by
-  /- We separate the coordinate along which there is a shearing from the other ones, and apply
-    Fubini. Along this coordinate (and when all the other coordinates are fixed), it acts like a
+  /- We use `lmarginal` to conveniently use Fubini's theorem.
+    Along the coordinate where there is a shearing, it acts like a
     translation, and therefore preserves Lebesgue. -/
-  let p : ι → Prop := fun i => i ≠ t.i
-  let α : Type _ := { x // p x }
-  let β : Type _ := { x // ¬p x }
-  let g : (α → ℝ) → (β → ℝ) → β → ℝ := fun a b => (fun _ => t.c * a ⟨t.j, t.hij.symm⟩) + b
-  let F : (α → ℝ) × (β → ℝ) → (α → ℝ) × (β → ℝ) := fun p => (id p.1, g p.1 p.2)
-  let e : (ι → ℝ) ≃ᵐ (α → ℝ) × (β → ℝ) := MeasurableEquiv.piEquivPiSubtypeProd (fun _ : ι => ℝ) p
-  have : (toLin' t.toMatrix : (ι → ℝ) → ι → ℝ) = e.symm ∘ F ∘ e := by
-    cases t with | mk t_i t_j t_hij t_c =>
-    ext f k
-    simp only [e, g, p, LinearEquiv.map_smul, dite_eq_ite, LinearMap.id_coe, ite_not,
-      Algebra.id.smul_eq_mul, one_mul, dotProduct, stdBasisMatrix,
-      MeasurableEquiv.piEquivPiSubtypeProd_symm_apply, id.def, transvection, Pi.add_apply,
-      zero_mul, LinearMap.smul_apply, Function.comp_apply,
-      MeasurableEquiv.piEquivPiSubtypeProd_apply, Matrix.TransvectionStruct.toMatrix_mk,
-      Matrix.mulVec, LinearEquiv.map_add, ite_mul, Matrix.toLin'_apply, Pi.smul_apply,
-      Subtype.coe_mk, LinearMap.add_apply, Finset.sum_congr, Matrix.toLin'_one]
-    by_cases h : t_i = k
-    · simp only [h, true_and_iff, Finset.mem_univ, if_true, eq_self_iff_true, Finset.sum_ite_eq,
-        one_apply, boole_mul, add_comm]
-    · simp only [h, Ne.symm h, add_zero, if_false, Finset.sum_const_zero, false_and_iff,
-        mul_zero]
-  rw [this]
-  have A : MeasurePreserving e := by
-    convert volume_preserving_piEquivPiSubtypeProd (fun _ : ι => ℝ) p
-  have B : MeasurePreserving F :=
-    haveI g_meas : Measurable (Function.uncurry g) := by
-      have : Measurable fun c : α → ℝ => c ⟨t.j, t.hij.symm⟩ :=
-        measurable_pi_apply ⟨t.j, t.hij.symm⟩
-      refine Measurable.add ?_ measurable_snd
-      refine measurable_pi_lambda _ fun _ => Measurable.const_mul ?_ _
-      exact this.comp measurable_fst
-    (MeasurePreserving.id _).skew_product g_meas
-      (eventually_of_forall fun a => map_add_left_eq_self
-        (Measure.pi fun _ => (stdOrthonormalBasis ℝ ℝ).toBasis.addHaar) _)
-  exact ((A.symm e).comp B).comp A
+  have ht : Measurable (toLin' t.toMatrix) :=
+    (toLin' t.toMatrix).continuous_of_finiteDimensional.measurable
+  refine ⟨ht, ?_⟩
+  refine (pi_eq fun s hs ↦ ?_).symm
+  have h2s : MeasurableSet (univ.pi s) := .pi countable_univ fun i _ ↦ hs i
+  simp_rw [← pi_pi, ← lintegral_indicator_one h2s]
+  rw [lintegral_map (measurable_one.indicator h2s) ht, volume_pi]
+  refine lintegral_eq_of_lmarginal_eq {t.i} ((measurable_one.indicator h2s).comp ht)
+    (measurable_one.indicator h2s) ?_
+  simp_rw [lmarginal_singleton]
+  ext x
+  cases t with | mk t_i t_j t_hij t_c =>
+  simp [transvection, mulVec_stdBasisMatrix, t_hij.symm, ← Function.update_add,
+    lintegral_add_right_eq_self fun xᵢ ↦ indicator (univ.pi s) 1 (Function.update x t_i xᵢ)]
 #align real.volume_preserving_transvection_struct Real.volume_preserving_transvectionStruct
 
 /-- Any invertible matrix rescales Lebesgue measure through the absolute value of its
@@ -429,8 +409,8 @@ theorem map_matrix_volume_pi_eq_smul_volume_pi [DecidableEq ι] {M : Matrix ι 
     rw [smul_smul, ← ENNReal.ofReal_mul (abs_nonneg _), ← abs_mul, inv_mul_cancel hD, abs_one,
       ENNReal.ofReal_one, one_smul]
   · intro t
-    simp only [Matrix.TransvectionStruct.det, ENNReal.ofReal_one,
-      (volume_preserving_transvectionStruct _).map_eq, one_smul, _root_.inv_one, abs_one]
+    simp_rw [Matrix.TransvectionStruct.det, _root_.inv_one, abs_one, ENNReal.ofReal_one, one_smul,
+      (volume_preserving_transvectionStruct _).map_eq]
   · intro A B _ _ IHA IHB
     rw [toLin'_mul, det_mul, LinearMap.coe_comp, ← Measure.map_map, IHB, Measure.map_smul, IHA,
       smul_smul, ← ENNReal.ofReal_mul (abs_nonneg _), ← abs_mul, mul_comm, mul_inv]
chore: avoid Ne.def (adaptation for nightly-2024-03-27) (#11813)
Diff
@@ -365,7 +365,7 @@ theorem smul_map_diagonal_volume_pi [DecidableEq ι] {D : ι → ℝ} (h : det (
   have B : ∀ i, ofReal (abs (D i)) * volume ((D i * ·) ⁻¹' s i) = volume (s i) := by
     intro i
     have A : D i ≠ 0 := by
-      simp only [det_diagonal, Ne.def] at h
+      simp only [det_diagonal, Ne] at h
       exact Finset.prod_ne_zero_iff.1 h i (Finset.mem_univ i)
     rw [volume_preimage_mul_left A, ← mul_assoc, ← ENNReal.ofReal_mul (abs_nonneg _), ← abs_mul,
       mul_inv_cancel A, abs_one, ENNReal.ofReal_one, one_mul]
chore: Rename mul-div cancellation lemmas (#11530)

Lemma names around cancellation of multiplication and division are a mess.

This PR renames a handful of them according to the following table (each big row contains the multiplicative statement, then the three rows contain the GroupWithZero lemma name, the Group lemma, the AddGroup lemma name).

| Statement | New name | Old name | |

Diff
@@ -105,12 +105,12 @@ theorem volume_univ : volume (univ : Set ℝ) = ∞ :=
 
 @[simp]
 theorem volume_ball (a r : ℝ) : volume (Metric.ball a r) = ofReal (2 * r) := by
-  rw [ball_eq_Ioo, volume_Ioo, ← sub_add, add_sub_cancel', two_mul]
+  rw [ball_eq_Ioo, volume_Ioo, ← sub_add, add_sub_cancel_left, two_mul]
 #align real.volume_ball Real.volume_ball
 
 @[simp]
 theorem volume_closedBall (a r : ℝ) : volume (Metric.closedBall a r) = ofReal (2 * r) := by
-  rw [closedBall_eq_Icc, volume_Icc, ← sub_add, add_sub_cancel', two_mul]
+  rw [closedBall_eq_Icc, volume_Icc, ← sub_add, add_sub_cancel_left, two_mul]
 #align real.volume_closed_ball Real.volume_closedBall
 
 @[simp]
@@ -298,10 +298,10 @@ theorem smul_map_volume_mul_left {a : ℝ} (h : a ≠ 0) :
   · simp only [Real.volume_Ioo, Measure.smul_apply, ← ENNReal.ofReal_mul (le_of_lt <| neg_pos.2 h),
       Measure.map_apply (measurable_const_mul a) measurableSet_Ioo, neg_sub_neg, neg_mul,
       preimage_const_mul_Ioo_of_neg _ _ h, abs_of_neg h, mul_sub, smul_eq_mul,
-      mul_div_cancel' _ (ne_of_lt h)]
+      mul_div_cancel₀ _ (ne_of_lt h)]
   · simp only [Real.volume_Ioo, Measure.smul_apply, ← ENNReal.ofReal_mul (le_of_lt h),
       Measure.map_apply (measurable_const_mul a) measurableSet_Ioo, preimage_const_mul_Ioo _ _ h,
-      abs_of_pos h, mul_sub, mul_div_cancel' _ (ne_of_gt h), smul_eq_mul]
+      abs_of_pos h, mul_sub, mul_div_cancel₀ _ (ne_of_gt h), smul_eq_mul]
 #align real.smul_map_volume_mul_left Real.smul_map_volume_mul_left
 
 theorem map_volume_mul_left {a : ℝ} (h : a ≠ 0) :
chore: scope open Classical (#11199)

We remove all but one open Classicals, instead preferring to use open scoped Classical. The only real side-effect this led to is moving a couple declarations to use Exists.choose instead of Classical.choose.

The first few commits are explicitly labelled regex replaces for ease of review.

Diff
@@ -34,7 +34,8 @@ assert_not_exists MeasureTheory.integral
 
 noncomputable section
 
-open Classical Set Filter MeasureTheory MeasureTheory.Measure TopologicalSpace
+open scoped Classical
+open Set Filter MeasureTheory MeasureTheory.Measure TopologicalSpace
 
 open ENNReal (ofReal)
 
chore: more backporting of simp changes from #10995 (#11001)

Co-authored-by: Patrick Massot <patrickmassot@free.fr> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -388,7 +388,7 @@ theorem volume_preserving_transvectionStruct [DecidableEq ι] (t : TransvectionS
   have : (toLin' t.toMatrix : (ι → ℝ) → ι → ℝ) = e.symm ∘ F ∘ e := by
     cases t with | mk t_i t_j t_hij t_c =>
     ext f k
-    simp only [LinearEquiv.map_smul, dite_eq_ite, LinearMap.id_coe, ite_not,
+    simp only [e, g, p, LinearEquiv.map_smul, dite_eq_ite, LinearMap.id_coe, ite_not,
       Algebra.id.smul_eq_mul, one_mul, dotProduct, stdBasisMatrix,
       MeasurableEquiv.piEquivPiSubtypeProd_symm_apply, id.def, transvection, Pi.add_apply,
       zero_mul, LinearMap.smul_apply, Function.comp_apply,
@@ -447,8 +447,8 @@ theorem map_linearMap_volume_pi_eq_smul_volume_pi {f : (ι → ℝ) →ₗ[ℝ]
   classical
     -- this is deduced from the matrix case
     let M := LinearMap.toMatrix' f
-    have A : LinearMap.det f = det M := by simp only [LinearMap.det_toMatrix']
-    have B : f = toLin' M := by simp only [toLin'_toMatrix']
+    have A : LinearMap.det f = det M := by simp only [M, LinearMap.det_toMatrix']
+    have B : f = toLin' M := by simp only [M, toLin'_toMatrix']
     rw [A, B]
     apply map_matrix_volume_pi_eq_smul_volume_pi
     rwa [A] at hf
@@ -665,7 +665,7 @@ theorem ae_restrict_of_ae_restrict_inter_Ioo {μ : Measure ℝ} [NoAtoms μ] {s
   · have : μ.restrict (s \ u) = 0 := by simp only [restrict_eq_zero, hfinite.measure_zero]
     simp only [this, ae_zero, eventually_bot]
   · rintro ⟨⟨a, as⟩, ⟨b, bs⟩⟩ -
-    dsimp
+    dsimp [T]
     rcases le_or_lt b a with (hba | hab)
     · simp only [Ioo_eq_empty_of_le hba, inter_empty, restrict_empty, ae_zero, eventually_bot]
     · exact h a b as bs hab
chore: classify simp can do this porting notes (#10619)

Classify by adding issue number (#10618) to porting notes claiming anything semantically equivalent to simp can prove this or simp can simplify this.

Diff
@@ -90,11 +90,11 @@ theorem volume_Ioo {a b : ℝ} : volume (Ioo a b) = ofReal (b - a) := by simp [v
 theorem volume_Ioc {a b : ℝ} : volume (Ioc a b) = ofReal (b - a) := by simp [volume_val]
 #align real.volume_Ioc Real.volume_Ioc
 
--- @[simp] -- Porting note: simp can prove this
+-- @[simp] -- Porting note (#10618): simp can prove this
 theorem volume_singleton {a : ℝ} : volume ({a} : Set ℝ) = 0 := by simp [volume_val]
 #align real.volume_singleton Real.volume_singleton
 
--- @[simp] -- Porting note: simp can prove this, after mathlib4#4628
+-- @[simp] -- Porting note (#10618): simp can prove this, after mathlib4#4628
 theorem volume_univ : volume (univ : Set ℝ) = ∞ :=
   ENNReal.eq_top_of_forall_nnreal_le fun r =>
     calc
chore: bump to v4.3.0-rc2 (#8366)

PR contents

This is the supremum of

along with some minor fixes from failures on nightly-testing as Mathlib master is merged into it.

Note that some PRs for changes that are already compatible with the current toolchain and will be necessary have already been split out: #8380.

I am hopeful that in future we will be able to progressively merge adaptation PRs into a bump/v4.X.0 branch, so we never end up with a "big merge" like this. However one of these adaptation PRs (#8056) predates my new scheme for combined CI, and it wasn't possible to keep that PR viable in the meantime.

Lean PRs involved in this bump

In particular this includes adjustments for the Lean PRs

leanprover/lean4#2778

We can get rid of all the

local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue [lean4#2220](https://github.com/leanprover/lean4/pull/2220)

macros across Mathlib (and in any projects that want to write natural number powers of reals).

leanprover/lean4#2722

Changes the default behaviour of simp to (config := {decide := false}). This makes simp (and consequentially norm_num) less powerful, but also more consistent, and less likely to blow up in long failures. This requires a variety of changes: changing some previously by simp or norm_num to decide or rfl, or adding (config := {decide := true}).

leanprover/lean4#2783

This changed the behaviour of simp so that simp [f] will only unfold "fully applied" occurrences of f. The old behaviour can be recovered with simp (config := { unfoldPartialApp := true }). We may in future add a syntax for this, e.g. simp [!f]; please provide feedback! In the meantime, we have made the following changes:

  • switching to using explicit lemmas that have the intended level of application
  • (config := { unfoldPartialApp := true }) in some places, to recover the old behaviour
  • Using @[eqns] to manually adjust the equation lemmas for a particular definition, recovering the old behaviour just for that definition. See #8371, where we do this for Function.comp and Function.flip.

This change in Lean may require further changes down the line (e.g. adding the !f syntax, and/or upstreaming the special treatment for Function.comp and Function.flip, and/or removing this special treatment). Please keep an open and skeptical mind about these changes!

Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Mauricio Collares <mauricio@collares.org>

Diff
@@ -34,8 +34,6 @@ assert_not_exists MeasureTheory.integral
 
 noncomputable section
 
-local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue lean4#2220
-
 open Classical Set Filter MeasureTheory MeasureTheory.Measure TopologicalSpace
 
 open ENNReal (ofReal)
refactor(Topology/MetricSpace): remove Metric.Bounded (#7240)

Use Bornology.IsBounded instead.

Diff
@@ -191,9 +191,9 @@ instance isFiniteMeasure_restrict_Ioo (x y : ℝ) : IsFiniteMeasure (volume.rest
 #align real.is_finite_measure_restrict_Ioo Real.isFiniteMeasure_restrict_Ioo
 
 theorem volume_le_diam (s : Set ℝ) : volume s ≤ EMetric.diam s := by
-  by_cases hs : Metric.Bounded s
+  by_cases hs : Bornology.IsBounded s
   · rw [Real.ediam_eq hs, ← volume_Icc]
-    exact volume.mono (Real.subset_Icc_sInf_sSup_of_bounded hs)
+    exact volume.mono (Real.subset_Icc_sInf_sSup_of_isBounded hs)
   · rw [Metric.ediam_of_unbounded hs]; exact le_top
 #align real.volume_le_diam Real.volume_le_diam
 
chore: generalize layercake formulas to null-measurable and a.e.-nonnegative functions (#6936)

The layercake formulas (a typical example of which is ∫⁻ f^p ∂μ = p * ∫⁻ t in 0..∞, t^(p-1) * μ {ω | f(ω) > t}) had been originally proven assuming measurability and nonnegativity of f. This PR generalizes them to null-measurable and a.e.-nonnegative f.

Co-authored-by: kkytola <“kalle.kytola@aalto.fi”> Co-authored-by: kkytola <39528102+kkytola@users.noreply.github.com>

Diff
@@ -577,6 +577,65 @@ theorem volume_regionBetween_eq_lintegral [SigmaFinite μ] (hf : AEMeasurable f
           (regionBetween_subset (AEMeasurable.mk f hf) (AEMeasurable.mk g hg) s)).symm
 #align volume_region_between_eq_lintegral volume_regionBetween_eq_lintegral
 
+/-- The region between two a.e.-measurable functions on a null-measurable set is null-measurable. -/
+lemma nullMeasurableSet_regionBetween (μ : Measure α)
+    {f g : α → ℝ} (f_mble : AEMeasurable f μ) (g_mble : AEMeasurable g μ)
+    {s : Set α} (s_mble : NullMeasurableSet s μ) :
+    NullMeasurableSet {p : α × ℝ | p.1 ∈ s ∧ p.snd ∈ Ioo (f p.fst) (g p.fst)} (μ.prod volume) := by
+  refine NullMeasurableSet.inter
+          (s_mble.preimage quasiMeasurePreserving_fst) (NullMeasurableSet.inter ?_ ?_)
+  · exact nullMeasurableSet_lt (AEMeasurable.fst f_mble) measurable_snd.aemeasurable
+  · exact nullMeasurableSet_lt measurable_snd.aemeasurable (AEMeasurable.fst g_mble)
+
+/-- The region between two a.e.-measurable functions on a null-measurable set is null-measurable;
+a version for the region together with the graph of the upper function. -/
+lemma nullMeasurableSet_region_between_oc (μ : Measure α)
+    {f g : α → ℝ} (f_mble : AEMeasurable f μ) (g_mble : AEMeasurable g μ)
+    {s : Set α} (s_mble : NullMeasurableSet s μ) :
+    NullMeasurableSet {p : α × ℝ | p.1 ∈ s ∧ p.snd ∈ Ioc (f p.fst) (g p.fst)} (μ.prod volume) := by
+  refine NullMeasurableSet.inter
+          (s_mble.preimage quasiMeasurePreserving_fst) (NullMeasurableSet.inter ?_ ?_)
+  · exact nullMeasurableSet_lt (AEMeasurable.fst f_mble) measurable_snd.aemeasurable
+  · change NullMeasurableSet {p : α × ℝ | p.snd ≤ g p.fst} (μ.prod volume)
+    rw [show {p : α × ℝ | p.snd ≤ g p.fst} = {p : α × ℝ | g p.fst < p.snd}ᶜ by
+          ext p
+          simp only [mem_setOf_eq, mem_compl_iff, not_lt]]
+    exact (nullMeasurableSet_lt (AEMeasurable.fst g_mble) measurable_snd.aemeasurable).compl
+
+/-- The region between two a.e.-measurable functions on a null-measurable set is null-measurable;
+a version for the region together with the graph of the lower function. -/
+lemma nullMeasurableSet_region_between_co (μ : Measure α)
+    {f g : α → ℝ} (f_mble : AEMeasurable f μ) (g_mble : AEMeasurable g μ)
+    {s : Set α} (s_mble : NullMeasurableSet s μ) :
+    NullMeasurableSet {p : α × ℝ | p.1 ∈ s ∧ p.snd ∈ Ico (f p.fst) (g p.fst)} (μ.prod volume) := by
+  refine NullMeasurableSet.inter
+          (s_mble.preimage quasiMeasurePreserving_fst) (NullMeasurableSet.inter ?_ ?_)
+  · change NullMeasurableSet {p : α × ℝ | f p.fst ≤ p.snd} (μ.prod volume)
+    rw [show {p : α × ℝ | f p.fst ≤ p.snd} = {p : α × ℝ | p.snd < f p.fst}ᶜ by
+          ext p
+          simp only [mem_setOf_eq, mem_compl_iff, not_lt]]
+    exact (nullMeasurableSet_lt measurable_snd.aemeasurable (AEMeasurable.fst f_mble)).compl
+  · exact nullMeasurableSet_lt measurable_snd.aemeasurable (AEMeasurable.fst g_mble)
+
+/-- The region between two a.e.-measurable functions on a null-measurable set is null-measurable;
+a version for the region together with the graphs of both functions. -/
+lemma nullMeasurableSet_region_between_cc (μ : Measure α)
+    {f g : α → ℝ} (f_mble : AEMeasurable f μ) (g_mble : AEMeasurable g μ)
+    {s : Set α} (s_mble : NullMeasurableSet s μ) :
+    NullMeasurableSet {p : α × ℝ | p.1 ∈ s ∧ p.snd ∈ Icc (f p.fst) (g p.fst)} (μ.prod volume) := by
+  refine NullMeasurableSet.inter
+          (s_mble.preimage quasiMeasurePreserving_fst) (NullMeasurableSet.inter ?_ ?_)
+  · change NullMeasurableSet {p : α × ℝ | f p.fst ≤ p.snd} (μ.prod volume)
+    rw [show {p : α × ℝ | f p.fst ≤ p.snd} = {p : α × ℝ | p.snd < f p.fst}ᶜ by
+          ext p
+          simp only [mem_setOf_eq, mem_compl_iff, not_lt]]
+    exact (nullMeasurableSet_lt measurable_snd.aemeasurable (AEMeasurable.fst f_mble)).compl
+  · change NullMeasurableSet {p : α × ℝ | p.snd ≤ g p.fst} (μ.prod volume)
+    rw [show {p : α × ℝ | p.snd ≤ g p.fst} = {p : α × ℝ | g p.fst < p.snd}ᶜ by
+          ext p
+          simp only [mem_setOf_eq, mem_compl_iff, not_lt]]
+    exact (nullMeasurableSet_lt (AEMeasurable.fst g_mble) measurable_snd.aemeasurable).compl
+
 end regionBetween
 
 /-- Consider a real set `s`. If a property is true almost everywhere in `s ∩ (a, b)` for
chore: drop MulZeroClass. in mul_zero/zero_mul (#6682)

Search&replace MulZeroClass.mul_zero -> mul_zero, MulZeroClass.zero_mul -> zero_mul.

These were introduced by Mathport, as the full name of mul_zero is actually MulZeroClass.mul_zero (it's exported with the short name).

Diff
@@ -393,7 +393,7 @@ theorem volume_preserving_transvectionStruct [DecidableEq ι] (t : TransvectionS
     simp only [LinearEquiv.map_smul, dite_eq_ite, LinearMap.id_coe, ite_not,
       Algebra.id.smul_eq_mul, one_mul, dotProduct, stdBasisMatrix,
       MeasurableEquiv.piEquivPiSubtypeProd_symm_apply, id.def, transvection, Pi.add_apply,
-      MulZeroClass.zero_mul, LinearMap.smul_apply, Function.comp_apply,
+      zero_mul, LinearMap.smul_apply, Function.comp_apply,
       MeasurableEquiv.piEquivPiSubtypeProd_apply, Matrix.TransvectionStruct.toMatrix_mk,
       Matrix.mulVec, LinearEquiv.map_add, ite_mul, Matrix.toLin'_apply, Pi.smul_apply,
       Subtype.coe_mk, LinearMap.add_apply, Finset.sum_congr, Matrix.toLin'_one]
@@ -401,7 +401,7 @@ theorem volume_preserving_transvectionStruct [DecidableEq ι] (t : TransvectionS
     · simp only [h, true_and_iff, Finset.mem_univ, if_true, eq_self_iff_true, Finset.sum_ite_eq,
         one_apply, boole_mul, add_comm]
     · simp only [h, Ne.symm h, add_zero, if_false, Finset.sum_const_zero, false_and_iff,
-        MulZeroClass.mul_zero]
+        mul_zero]
   rw [this]
   have A : MeasurePreserving e := by
     convert volume_preserving_piEquivPiSubtypeProd (fun _ : ι => ℝ) p
chore: banish Type _ and Sort _ (#6499)

We remove all possible occurences of Type _ and Sort _ in favor of Type* and Sort*.

This has nice performance benefits.

Diff
@@ -49,7 +49,7 @@ open scoped BigOperators ENNReal NNReal Topology
 
 namespace Real
 
-variable {ι : Type _} [Fintype ι]
+variable {ι : Type*} [Fintype ι]
 
 /-- The volume on the real line (as a particular case of the volume on a finite-dimensional
 inner product space) coincides with the Stieltjes measure coming from the identity function. -/
@@ -460,7 +460,7 @@ end Real
 
 section regionBetween
 
-variable {α : Type _}
+variable {α : Type*}
 
 /-- The region between two real-valued functions on an arbitrary set. -/
 def regionBetween (f g : α → ℝ) (s : Set α) : Set (α × ℝ) :=
chore: regularize HPow.hPow porting notes (#6465)
Diff
@@ -34,7 +34,7 @@ assert_not_exists MeasureTheory.integral
 
 noncomputable section
 
-local macro_rules | `($x ^ $y)   => `(HPow.hPow $x $y) -- Porting note: See issue #2220
+local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue lean4#2220
 
 open Classical Set Filter MeasureTheory MeasureTheory.Measure TopologicalSpace
 
chore: script to replace headers with #align_import statements (#5979)

Open in Gitpod

Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -2,11 +2,6 @@
 Copyright (c) 2017 Johannes Hölzl. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Johannes Hölzl, Sébastien Gouëzel, Yury Kudryashov
-
-! This file was ported from Lean 3 source module measure_theory.measure.lebesgue.basic
-! leanprover-community/mathlib commit fd5edc43dc4f10b85abfe544b88f82cf13c5f844
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Dynamics.Ergodic.MeasurePreserving
 import Mathlib.LinearAlgebra.Determinant
@@ -16,6 +11,8 @@ import Mathlib.MeasureTheory.Constructions.Pi
 import Mathlib.MeasureTheory.Measure.Stieltjes
 import Mathlib.MeasureTheory.Measure.Haar.OfBasis
 
+#align_import measure_theory.measure.lebesgue.basic from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
+
 /-!
 # Lebesgue measure on the real line and on `ℝⁿ`
 
fix: precedence of , and abs (#5619)
Diff
@@ -140,7 +140,7 @@ instance noAtoms_volume : NoAtoms (volume : Measure ℝ) :=
 #align real.has_no_atoms_volume Real.noAtoms_volume
 
 @[simp]
-theorem volume_interval {a b : ℝ} : volume (uIcc a b) = ofReal (|b - a|) := by
+theorem volume_interval {a b : ℝ} : volume (uIcc a b) = ofReal |b - a| := by
   rw [← Icc_min_max, volume_Icc, max_sub_min_eq_abs]
 #align real.volume_interval Real.volume_interval
 
@@ -296,7 +296,7 @@ theorem volume_pi_le_diam_pow (s : Set (ι → ℝ)) : volume s ≤ EMetric.diam
 
 
 theorem smul_map_volume_mul_left {a : ℝ} (h : a ≠ 0) :
-    ENNReal.ofReal (|a|) • Measure.map (a * ·) volume = volume := by
+    ENNReal.ofReal |a| • Measure.map (a * ·) volume = volume := by
   refine' (Real.measure_ext_Ioo_rat fun p q => _).symm
   cases' lt_or_gt_of_ne h with h h
   · simp only [Real.volume_Ioo, Measure.smul_apply, ← ENNReal.ofReal_mul (le_of_lt <| neg_pos.2 h),
@@ -309,7 +309,7 @@ theorem smul_map_volume_mul_left {a : ℝ} (h : a ≠ 0) :
 #align real.smul_map_volume_mul_left Real.smul_map_volume_mul_left
 
 theorem map_volume_mul_left {a : ℝ} (h : a ≠ 0) :
-    Measure.map (a * ·) volume = ENNReal.ofReal (|a⁻¹|) • volume := by
+    Measure.map (a * ·) volume = ENNReal.ofReal |a⁻¹| • volume := by
   conv_rhs =>
     rw [← Real.smul_map_volume_mul_left h, smul_smul, ← ENNReal.ofReal_mul (abs_nonneg _), ←
       abs_mul, inv_mul_cancel h, abs_one, ENNReal.ofReal_one, one_smul]
@@ -325,12 +325,12 @@ theorem volume_preimage_mul_left {a : ℝ} (h : a ≠ 0) (s : Set ℝ) :
 #align real.volume_preimage_mul_left Real.volume_preimage_mul_left
 
 theorem smul_map_volume_mul_right {a : ℝ} (h : a ≠ 0) :
-    ENNReal.ofReal (|a|) • Measure.map (· * a) volume = volume := by
+    ENNReal.ofReal |a| • Measure.map (· * a) volume = volume := by
   simpa only [mul_comm] using Real.smul_map_volume_mul_left h
 #align real.smul_map_volume_mul_right Real.smul_map_volume_mul_right
 
 theorem map_volume_mul_right {a : ℝ} (h : a ≠ 0) :
-    Measure.map (· * a) volume = ENNReal.ofReal (|a⁻¹|) • volume := by
+    Measure.map (· * a) volume = ENNReal.ofReal |a⁻¹| • volume := by
   simpa only [mul_comm] using Real.map_volume_mul_left h
 #align real.map_volume_mul_right Real.map_volume_mul_right
 
fix: precedences of ⨆⋃⋂⨅ (#5614)
Diff
@@ -594,7 +594,7 @@ theorem ae_restrict_of_ae_restrict_inter_Ioo {μ : Measure ℝ} [NoAtoms μ] {s
   let u := ⋃ i : ↥s × ↥s, T i
   have hfinite : (s \ u).Finite := s.finite_diff_iUnion_Ioo'
   obtain ⟨A, A_count, hA⟩ :
-    ∃ A : Set (↥s × ↥s), A.Countable ∧ (⋃ i ∈ A, T i) = ⋃ i : ↥s × ↥s, T i :=
+    ∃ A : Set (↥s × ↥s), A.Countable ∧ ⋃ i ∈ A, T i = ⋃ i : ↥s × ↥s, T i :=
     isOpen_iUnion_countable _ fun p => isOpen_Ioo
   have : s ⊆ s \ u ∪ ⋃ p ∈ A, s ∩ T p := by
     intro x hx
@@ -629,7 +629,7 @@ theorem ae_of_mem_of_ae_of_mem_inter_Ioo {μ : Measure ℝ} [NoAtoms μ] {s : Se
   let u := ⋃ i : ↥s × ↥s, T i
   have hfinite : (s \ u).Finite := s.finite_diff_iUnion_Ioo'
   obtain ⟨A, A_count, hA⟩ :
-    ∃ A : Set (↥s × ↥s), A.Countable ∧ (⋃ i ∈ A, T i) = ⋃ i : ↥s × ↥s, T i :=
+    ∃ A : Set (↥s × ↥s), A.Countable ∧ ⋃ i ∈ A, T i = ⋃ i : ↥s × ↥s, T i :=
     isOpen_iUnion_countable _ fun p => isOpen_Ioo
   have M : ∀ᵐ x ∂μ, x ∉ s \ u := hfinite.countable.ae_not_mem _
   have M' : ∀ᵐ x ∂μ, ∀ (i : ↥s × ↥s), i ∈ A → x ∈ s ∩ T i → p x := by
chore: remove superfluous parentheses in calls to ext (#5258)

Co-authored-by: Xavier Roblot <46200072+xroblot@users.noreply.github.com> Co-authored-by: Joël Riou <joel.riou@universite-paris-saclay.fr> Co-authored-by: Riccardo Brasca <riccardo.brasca@gmail.com> Co-authored-by: Yury G. Kudryashov <urkud@urkud.name> Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Jeremy Tan Jie Rui <reddeloostw@gmail.com> Co-authored-by: Pol'tta / Miyahara Kō <pol_tta@outlook.jp> Co-authored-by: Jason Yuen <jason_yuen2007@hotmail.com> Co-authored-by: Mario Carneiro <di.gama@gmail.com> Co-authored-by: Jireh Loreaux <loreaujy@gmail.com> Co-authored-by: Ruben Van de Velde <65514131+Ruben-VandeVelde@users.noreply.github.com> Co-authored-by: Kyle Miller <kmill31415@gmail.com> Co-authored-by: Heather Macbeth <25316162+hrmacbeth@users.noreply.github.com> Co-authored-by: Jujian Zhang <jujian.zhang1998@outlook.com> Co-authored-by: Yaël Dillies <yael.dillies@gmail.com>

Diff
@@ -392,7 +392,7 @@ theorem volume_preserving_transvectionStruct [DecidableEq ι] (t : TransvectionS
   let e : (ι → ℝ) ≃ᵐ (α → ℝ) × (β → ℝ) := MeasurableEquiv.piEquivPiSubtypeProd (fun _ : ι => ℝ) p
   have : (toLin' t.toMatrix : (ι → ℝ) → ι → ℝ) = e.symm ∘ F ∘ e := by
     cases t with | mk t_i t_j t_hij t_c =>
-    ext (f k)
+    ext f k
     simp only [LinearEquiv.map_smul, dite_eq_ite, LinearMap.id_coe, ite_not,
       Algebra.id.smul_eq_mul, one_mul, dotProduct, stdBasisMatrix,
       MeasurableEquiv.piEquivPiSubtypeProd_symm_apply, id.def, transvection, Pi.add_apply,
chore: tidy various files (#4757)
Diff
@@ -27,8 +27,9 @@ Lebesgue measure on `ℝⁿ`. In particular, we prove that they are translation
 We show that, on `ℝⁿ`, a linear map acts on Lebesgue measure by rescaling it through the absolute
 value of its determinant, in `Real.map_linearMap_volume_pi_eq_smul_volume_pi`.
 
-More properties of the Lebesgue measure are deduced from this in `Lebesgue.EqHaar.lean`, where they
-are proved more generally for any additive Haar measure on a finite-dimensional real vector space.
+More properties of the Lebesgue measure are deduced from this in
+`Mathlib/MeasureTheory/Measure/Lebesgue/EqHaar.lean`, where they are proved more generally for any
+additive Haar measure on a finite-dimensional real vector space.
 -/
 
 
@@ -426,8 +427,7 @@ theorem map_matrix_volume_pi_eq_smul_volume_pi [DecidableEq ι] {M : Matrix ι 
     Measure.map (toLin' M) volume = ENNReal.ofReal (abs (det M)⁻¹) • volume := by
   -- This follows from the cases we have already proved, of diagonal matrices and transvections,
   -- as these matrices generate all invertible matrices.
-  apply
-    diagonal_transvection_induction_of_det_ne_zero _ M hM
+  apply diagonal_transvection_induction_of_det_ne_zero _ M hM
   · intro D hD
     conv_rhs => rw [← smul_map_diagonal_volume_pi hD]
     rw [smul_smul, ← ENNReal.ofReal_mul (abs_nonneg _), ← abs_mul, inv_mul_cancel hD, abs_one,
feat: add instances about volume (#4628)

Lean 3 was able to apply, e.g., instances about measure_theory.measure.prod to the volume on the Cartesian product. Lean 4 can't do this, so we need to duplicate many instances.

Co-authored-by: Jeremy Tan Jie Rui <reddeloostw@gmail.com> Co-authored-by: Komyyy <pol_tta@outlook.jp>

Diff
@@ -98,7 +98,7 @@ theorem volume_Ioc {a b : ℝ} : volume (Ioc a b) = ofReal (b - a) := by simp [v
 theorem volume_singleton {a : ℝ} : volume ({a} : Set ℝ) = 0 := by simp [volume_val]
 #align real.volume_singleton Real.volume_singleton
 
-@[simp]
+-- @[simp] -- Porting note: simp can prove this, after mathlib4#4628
 theorem volume_univ : volume (univ : Set ℝ) = ∞ :=
   ENNReal.eq_top_of_forall_nnreal_le fun r =>
     calc
@@ -414,27 +414,7 @@ theorem volume_preserving_transvectionStruct [DecidableEq ι] (t : TransvectionS
       refine Measurable.add ?_ measurable_snd
       refine measurable_pi_lambda _ fun _ => Measurable.const_mul ?_ _
       exact this.comp measurable_fst
-    /-
-    Porting note: TODO
-    In Lean 4, the following tc search fails, even if we make `volume` reducible in
-    `MeasureSpaceDef`.
-    ```lean
-    variable [Fintype ι]
-    #synth SigmaFinite (volume : Measure (ι → ℝ))
-    -- fails
-    #synth SigmaFinite (Measure.pi fun _ => volume : Measure (ι → ℝ))
-    -- defeq and succeeds
-    #synth IsAddLeftInvariant (volume : Measure (ι → ℝ))
-    -- fails
-    #synth IsAddLeftInvariant (Measure.pi fun _ =>
-      (stdOrthonormalBasis ℝ ℝ).toBasis.addHaar : Measure (ι → ℝ))
-    -- defeq and succeeds
-    ```
-    These instances are required in this file.
-    This file can be built by specifying latter measures now, but this should be fixed clearly.
-    -/
-    (MeasurePreserving.id _).skew_product (μb := Measure.pi fun _ => volume)
-      (μd := Measure.pi fun _ => volume) g_meas
+    (MeasurePreserving.id _).skew_product g_meas
       (eventually_of_forall fun a => map_add_left_eq_self
         (Measure.pi fun _ => (stdOrthonormalBasis ℝ ℝ).toBasis.addHaar) _)
   exact ((A.symm e).comp B).comp A
style: recover Is of Foo which is ported from is_foo (#4639)

I have misported is_foo to Foo because I misunderstood the rule for IsLawfulFoo. This PR recover Is of Foo which is ported from is_foo. This PR also renames some misported theorems.

Diff
@@ -56,7 +56,7 @@ variable {ι : Type _} [Fintype ι]
 /-- The volume on the real line (as a particular case of the volume on a finite-dimensional
 inner product space) coincides with the Stieltjes measure coming from the identity function. -/
 theorem volume_eq_stieltjes_id : (volume : Measure ℝ) = StieltjesFunction.id.measure := by
-  haveI : AddLeftInvariant StieltjesFunction.id.measure :=
+  haveI : IsAddLeftInvariant StieltjesFunction.id.measure :=
     ⟨fun a =>
       Eq.symm <|
         Real.measure_ext_Ioo_rat fun p q => by
@@ -169,28 +169,28 @@ theorem volume_Iio {a : ℝ} : volume (Iio a) = ∞ :=
 theorem volume_Iic {a : ℝ} : volume (Iic a) = ∞ := by rw [← measure_congr Iio_ae_eq_Iic]; simp
 #align real.volume_Iic Real.volume_Iic
 
-instance locallyFinite_volume : LocallyFiniteMeasure (volume : Measure ℝ) :=
+instance locallyFinite_volume : IsLocallyFiniteMeasure (volume : Measure ℝ) :=
   ⟨fun x =>
     ⟨Ioo (x - 1) (x + 1),
       IsOpen.mem_nhds isOpen_Ioo ⟨sub_lt_self _ zero_lt_one, lt_add_of_pos_right _ zero_lt_one⟩, by
       simp only [Real.volume_Ioo, ENNReal.ofReal_lt_top]⟩⟩
 #align real.locally_finite_volume Real.locallyFinite_volume
 
-instance finiteMeasure_restrict_Icc (x y : ℝ) : FiniteMeasure (volume.restrict (Icc x y)) :=
+instance isFiniteMeasure_restrict_Icc (x y : ℝ) : IsFiniteMeasure (volume.restrict (Icc x y)) :=
   ⟨by simp⟩
-#align real.is_finite_measure_restrict_Icc Real.finiteMeasure_restrict_Icc
+#align real.is_finite_measure_restrict_Icc Real.isFiniteMeasure_restrict_Icc
 
-instance finiteMeasure_restrict_Ico (x y : ℝ) : FiniteMeasure (volume.restrict (Ico x y)) :=
+instance isFiniteMeasure_restrict_Ico (x y : ℝ) : IsFiniteMeasure (volume.restrict (Ico x y)) :=
   ⟨by simp⟩
-#align real.is_finite_measure_restrict_Ico Real.finiteMeasure_restrict_Ico
+#align real.is_finite_measure_restrict_Ico Real.isFiniteMeasure_restrict_Ico
 
-instance finiteMeasure_restrict_Ioc (x y : ℝ) : FiniteMeasure (volume.restrict (Ioc x y)) :=
+instance isFiniteMeasure_restrict_Ioc (x y : ℝ) : IsFiniteMeasure (volume.restrict (Ioc x y)) :=
   ⟨by simp⟩
-#align real.is_finite_measure_restrict_Ioc Real.finiteMeasure_restrict_Ioc
+#align real.is_finite_measure_restrict_Ioc Real.isFiniteMeasure_restrict_Ioc
 
-instance finiteMeasure_restrict_Ioo (x y : ℝ) : FiniteMeasure (volume.restrict (Ioo x y)) :=
+instance isFiniteMeasure_restrict_Ioo (x y : ℝ) : IsFiniteMeasure (volume.restrict (Ioo x y)) :=
   ⟨by simp⟩
-#align real.is_finite_measure_restrict_Ioo Real.finiteMeasure_restrict_Ioo
+#align real.is_finite_measure_restrict_Ioo Real.isFiniteMeasure_restrict_Ioo
 
 theorem volume_le_diam (s : Set ℝ) : volume s ≤ EMetric.diam s := by
   by_cases hs : Metric.Bounded s
@@ -424,9 +424,9 @@ theorem volume_preserving_transvectionStruct [DecidableEq ι] (t : TransvectionS
     -- fails
     #synth SigmaFinite (Measure.pi fun _ => volume : Measure (ι → ℝ))
     -- defeq and succeeds
-    #synth AddLeftInvariant (volume : Measure (ι → ℝ))
+    #synth IsAddLeftInvariant (volume : Measure (ι → ℝ))
     -- fails
-    #synth AddLeftInvariant (Measure.pi fun _ =>
+    #synth IsAddLeftInvariant (Measure.pi fun _ =>
       (stdOrthonormalBasis ℝ ℝ).toBasis.addHaar : Measure (ι → ℝ))
     -- defeq and succeeds
     ```
feat: port MeasureTheory.Measure.Lebesgue.Basic (#4552)

Co-authored-by: Heather Macbeth <25316162+hrmacbeth@users.noreply.github.com>

Dependencies 12 + 955

956 files ported (98.8%)
431553 lines ported (98.7%)
Show graph

The unported dependencies are

The following 1 dependencies have changed in mathlib3 since they were ported, which may complicate porting this file