measure_theory.measure.haar.inner_product_spaceMathlib.MeasureTheory.Measure.Haar.InnerProductSpace

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
@@ -3,8 +3,8 @@ Copyright (c) 2022 Sébastien Gouëzel. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel
 -/
-import Mathbin.Analysis.InnerProductSpace.Orientation
-import Mathbin.MeasureTheory.Measure.Lebesgue.EqHaar
+import Analysis.InnerProductSpace.Orientation
+import MeasureTheory.Measure.Lebesgue.EqHaar
 
 #align_import measure_theory.measure.haar.inner_product_space from "leanprover-community/mathlib"@"c20927220ef87bb4962ba08bf6da2ce3cf50a6dd"
 
Diff
@@ -2,15 +2,12 @@
 Copyright (c) 2022 Sébastien Gouëzel. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel
-
-! This file was ported from Lean 3 source module measure_theory.measure.haar.inner_product_space
-! leanprover-community/mathlib commit c20927220ef87bb4962ba08bf6da2ce3cf50a6dd
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Analysis.InnerProductSpace.Orientation
 import Mathbin.MeasureTheory.Measure.Lebesgue.EqHaar
 
+#align_import measure_theory.measure.haar.inner_product_space from "leanprover-community/mathlib"@"c20927220ef87bb4962ba08bf6da2ce3cf50a6dd"
+
 /-!
 # Volume forms and measures on inner product spaces
 
Diff
@@ -36,8 +36,7 @@ section
 
 variable {m n : ℕ} [_i : Fact (finrank ℝ F = n)]
 
-include _i
-
+#print Orientation.measure_orthonormalBasis /-
 /-- The volume form coming from an orientation in an inner product space gives measure `1` to the
 parallelepiped associated to any orthonormal basis. This is a rephrasing of
 `abs_volume_form_apply_of_orthonormal` in terms of measures. -/
@@ -53,6 +52,7 @@ theorem Orientation.measure_orthonormalBasis (o : Orientation ℝ F (Fin n))
   rw [A, parallelepiped_comp_equiv, AlternatingMap.measure_parallelepiped,
     o.abs_volume_form_apply_of_orthonormal, ENNReal.ofReal_one]
 #align orientation.measure_orthonormal_basis Orientation.measure_orthonormalBasis
+-/
 
 #print Orientation.measure_eq_volume /-
 /-- In an oriented inner product space, the measure coming from the canonical volume form
@@ -71,6 +71,7 @@ theorem Orientation.measure_eq_volume (o : Orientation ℝ F (Fin n)) :
 
 end
 
+#print OrthonormalBasis.volume_parallelepiped /-
 /-- The volume measure in a finite-dimensional inner product space gives measure `1` to the
 parallelepiped spanned by any orthonormal basis. -/
 theorem OrthonormalBasis.volume_parallelepiped (b : OrthonormalBasis ι ℝ F) :
@@ -81,4 +82,5 @@ theorem OrthonormalBasis.volume_parallelepiped (b : OrthonormalBasis ι ℝ F) :
   rw [← o.measure_eq_volume]
   exact o.measure_orthonormal_basis b
 #align orthonormal_basis.volume_parallelepiped OrthonormalBasis.volume_parallelepiped
+-/
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel
 
 ! This file was ported from Lean 3 source module measure_theory.measure.haar.inner_product_space
-! leanprover-community/mathlib commit fd5edc43dc4f10b85abfe544b88f82cf13c5f844
+! leanprover-community/mathlib commit c20927220ef87bb4962ba08bf6da2ce3cf50a6dd
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -14,6 +14,9 @@ import Mathbin.MeasureTheory.Measure.Lebesgue.EqHaar
 /-!
 # Volume forms and measures on inner product spaces
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 A volume form induces a Lebesgue measure on general finite-dimensional real vector spaces. In this
 file, we discuss the specific situation of inner product spaces, where an orientation gives
 rise to a canonical volume form. We show that the measure coming from this volume form gives
Diff
@@ -51,6 +51,7 @@ theorem Orientation.measure_orthonormalBasis (o : Orientation ℝ F (Fin n))
     o.abs_volume_form_apply_of_orthonormal, ENNReal.ofReal_one]
 #align orientation.measure_orthonormal_basis Orientation.measure_orthonormalBasis
 
+#print Orientation.measure_eq_volume /-
 /-- In an oriented inner product space, the measure coming from the canonical volume form
 associated to an orientation coincides with the volume. -/
 theorem Orientation.measure_eq_volume (o : Orientation ℝ F (Fin n)) :
@@ -63,6 +64,7 @@ theorem Orientation.measure_eq_volume (o : Orientation ℝ F (Fin n)) :
     A, one_smul]
   simp only [volume, Basis.addHaar]
 #align orientation.measure_eq_volume Orientation.measure_eq_volume
+-/
 
 end
 
Diff
@@ -3,13 +3,13 @@ Copyright (c) 2022 Sébastien Gouëzel. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel
 
-! This file was ported from Lean 3 source module measure_theory.measure.haar_of_inner
-! leanprover-community/mathlib commit 46b633fd842bef9469441c0209906f6dddd2b4f5
+! This file was ported from Lean 3 source module measure_theory.measure.haar.inner_product_space
+! leanprover-community/mathlib commit fd5edc43dc4f10b85abfe544b88f82cf13c5f844
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
 import Mathbin.Analysis.InnerProductSpace.Orientation
-import Mathbin.MeasureTheory.Measure.HaarLebesgue
+import Mathbin.MeasureTheory.Measure.Lebesgue.EqHaar
 
 /-!
 # Volume forms and measures on inner product spaces

Changes in mathlib4

mathlib3
mathlib4
chore(*): remove empty lines between variable statements (#11418)

Empty lines were removed by executing the following Python script twice

import os
import re


# Loop through each file in the repository
for dir_path, dirs, files in os.walk('.'):
  for filename in files:
    if filename.endswith('.lean'):
      file_path = os.path.join(dir_path, filename)

      # Open the file and read its contents
      with open(file_path, 'r') as file:
        content = file.read()

      # Use a regular expression to replace sequences of "variable" lines separated by empty lines
      # with sequences without empty lines
      modified_content = re.sub(r'(variable.*\n)\n(variable(?! .* in))', r'\1\2', content)

      # Write the modified content back to the file
      with open(file_path, 'w') as file:
        file.write(modified_content)
Diff
@@ -21,7 +21,6 @@ the canonical `volume` from the `MeasureSpace` instance.
 open FiniteDimensional MeasureTheory MeasureTheory.Measure Set
 
 variable {ι E F : Type*}
-
 variable [Fintype ι] [NormedAddCommGroup F] [InnerProductSpace ℝ F] [FiniteDimensional ℝ F]
   [MeasurableSpace F] [BorelSpace F]
 
feat(MeasureTheory): integral_comp for LinearIsometryEquiv (#10105)

Composition with a LinearIsometryEquiv on a finite dimensional real Hilbert space preserves integrals.

Diff
@@ -20,7 +20,7 @@ the canonical `volume` from the `MeasureSpace` instance.
 
 open FiniteDimensional MeasureTheory MeasureTheory.Measure Set
 
-variable {ι F : Type*}
+variable {ι E F : Type*}
 
 variable [Fintype ι] [NormedAddCommGroup F] [InnerProductSpace ℝ F] [FiniteDimensional ℝ F]
   [MeasurableSpace F] [BorelSpace F]
@@ -127,3 +127,30 @@ lemma volume_euclideanSpace_eq_dirac [IsEmpty ι] :
   rfl
 
 end PiLp
+
+namespace LinearIsometryEquiv
+
+variable [NormedAddCommGroup E] [InnerProductSpace ℝ E] [FiniteDimensional ℝ E]
+  [MeasurableSpace E] [BorelSpace E]
+
+variable (f : E ≃ₗᵢ[ℝ] F)
+
+/-- Every linear isometry on a real finite dimensional Hilbert space is measure-preserving. -/
+theorem measurePreserving : MeasurePreserving f := by
+  refine ⟨f.continuous.measurable, ?_⟩
+  rcases exists_orthonormalBasis ℝ E with ⟨w, b, _hw⟩
+  erw [← OrthonormalBasis.addHaar_eq_volume b, ← OrthonormalBasis.addHaar_eq_volume (b.map f),
+    Basis.map_addHaar _ f.toContinuousLinearEquiv]
+  congr
+
+/-- Every linear isometry equivalence is a measurable equivalence. -/
+def toMeasureEquiv : E ≃ᵐ F where
+  toEquiv := f
+  measurable_toFun := f.continuous.measurable
+  measurable_invFun := f.symm.continuous.measurable
+
+@[simp] theorem coe_toMeasureEquiv : (f.toMeasureEquiv : E → F) = f := rfl
+
+theorem toMeasureEquiv_symm : f.toMeasureEquiv.symm = f.symm.toMeasureEquiv := rfl
+
+end LinearIsometryEquiv
chore: reduce imports (#9830)

This uses the improved shake script from #9772 to reduce imports across mathlib. The corresponding noshake.json file has been added to #9772.

Co-authored-by: Mario Carneiro <di.gama@gmail.com>

Diff
@@ -4,9 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel
 -/
 import Mathlib.Analysis.InnerProductSpace.Orientation
-import Mathlib.Analysis.SpecialFunctions.Integrals
 import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar
-import Mathlib.MeasureTheory.Measure.Lebesgue.Integral
 
 #align_import measure_theory.measure.haar.inner_product_space from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
 
feat: the volume in a MeasureSpace over an empty index is the Dirac mass (#8799)
Diff
@@ -120,4 +120,12 @@ theorem PiLp.volume_preserving_equiv : MeasurePreserving (WithLp.equiv 2 (ι →
 theorem PiLp.volume_preserving_equiv_symm : MeasurePreserving (WithLp.equiv 2 (ι → ℝ)).symm :=
   (EuclideanSpace.volume_preserving_measurableEquiv ι).symm
 
+lemma volume_euclideanSpace_eq_dirac [IsEmpty ι] :
+    (volume : Measure (EuclideanSpace ℝ ι)) = Measure.dirac 0 := by
+  ext s hs
+  simp only [← ((EuclideanSpace.volume_preserving_measurableEquiv ι).symm).measure_preimage hs,
+    volume_pi_eq_dirac 0, MeasurableEquiv.measurableSet_preimage, hs, dirac_apply', indicator,
+    mem_preimage, Pi.one_apply]
+  rfl
+
 end PiLp
feat: Compute volume of balls of higher dimension for Lp norms (#8030)

We give a formula measure_unitBall_eq_integral_div_gamma for computing the volume of the unit ball in a normed finite dimensional -vector space E with an Haar measure:

theorem measure_unitBall_eq_integral_div_gamma {E : Type*} {p : ℝ}
    [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] [MeasurableSpace E]
    [BorelSpace E] (μ : Measure E) [IsAddHaarMeasure μ] (hp : 0 < p) :
    μ (Metric.ball 0 1) =
      ENNReal.ofReal ((∫ (x : E), Real.exp (- ‖x‖ ^ p) ∂μ) / Real.Gamma (finrank ℝ E / p + 1))

We also provide a theorem measure_lt_one_eq_integral_div_gamma to compute the volume of the ball {x : E | g x < 1} for a function g : E → ℝ defining a norm.

theorem measure_lt_one_eq_integral_div_gamma {E : Type*}
    [AddCommGroup E] [Module ℝ E] [FiniteDimensional ℝ E] [mE : MeasurableSpace E]
    [tE : TopologicalSpace E] [TopologicalAddGroup E] [BorelSpace E] [T2Space E]
    [ContinuousSMul ℝ E] (μ : Measure E) [IsAddHaarMeasure μ]
    {g : E → ℝ} (hg0 : g 0 = 0) (hgn : ∀ x, g (- x) = g x) (hgt : ∀ x y, g (x + y) ≤ g x + g y)
    (hgs : ∀ {x}, g x = 0 → x = 0) (hns :  ∀ r x, g (r • x) ≤ |r| * (g x)) {p : ℝ} (hp : 0 < p) :
    μ {x : E | g x < 1} =
      ENNReal.ofReal ((∫ (x : E), Real.exp (- (g x) ^ p) ∂μ) / Real.Gamma (finrank ℝ E / p + 1))

This provides a way to compute the volume of the unit ball for the norms L_p for 1 ≤ p in any dimension over the reals MeasureTheory.volume_sum_rpow_lt_one and the complex Complex.volume_sum_rpow_lt_one.

variable (ι : Type*) [Fintype ι] {p : ℝ} (hp : 1 ≤ p)

theorem volume_sum_rpow_lt_one :
    volume {x : ι → ℝ | ∑ i, |x i| ^ p < 1} =
      ENNReal.ofReal ((2 * Real.Gamma (1 / p + 1)) ^ card ι / Real.Gamma (card ι / p + 1))

theorem Complex.volume_sum_rpow_lt_one {p : ℝ} (hp : 1 ≤ p) :
    volume {x : ι → ℂ | ∑ i, ‖x i‖ ^ p < 1} =
      ENNReal.ofReal ((π * Real.Gamma (2 / p + 1)) ^ card ι / Real.Gamma (2 * card ι / p + 1)) 

From these, we deduce the volume of balls in several situations.

--

Other significant changes include:

  • Adding MeasurePreserving.integral_comp': when the theorem MeasurePreserving.integral_comp is used with f a measurable equiv, it is necessary to specify that it is a measurable embedding although it is trivial in this case. This version bypasses this hypothesis
  • Proof of volume computations of the unit ball in and in EuclideanSpace ℝ (Fin 2) which are now done with the methods of the file VolumeOfBalls have been moved to this file.

Co-authored-by: Yury G. Kudryashov <urkud@urkud.name>

Diff
@@ -121,45 +121,3 @@ theorem PiLp.volume_preserving_equiv_symm : MeasurePreserving (WithLp.equiv 2 (
   (EuclideanSpace.volume_preserving_measurableEquiv ι).symm
 
 end PiLp
-
-namespace EuclideanSpace
-
-open BigOperators ENNReal
-
-@[simp]
-theorem volume_ball (x : EuclideanSpace ℝ (Fin 2)) (r : ℝ) :
-    volume (Metric.ball x r) = NNReal.pi * (ENNReal.ofReal r) ^ 2 := by
-  obtain hr | hr := le_total r 0
-  · rw [Metric.ball_eq_empty.mpr hr, measure_empty, ← zero_eq_ofReal.mpr hr, zero_pow zero_lt_two,
-      mul_zero]
-  · suffices volume (Metric.ball (0 : EuclideanSpace ℝ (Fin 2)) 1) = NNReal.pi by
-      rw [Measure.addHaar_ball _ _ hr, finrank_euclideanSpace_fin, ofReal_pow hr, this, mul_comm]
-    calc
-      _ = volume {p : ℝ × ℝ | p.1 ^ 2 + p.2 ^ 2 < 1} := by
-        have : MeasurePreserving (_ : ℝ × ℝ ≃ᵐ EuclideanSpace ℝ (Fin 2)) :=
-          MeasurePreserving.trans
-            (volume_preserving_finTwoArrow ℝ).symm (volume_preserving_measurableEquiv (Fin 2)).symm
-        rw [← this.measure_preimage_emb (MeasurableEquiv.measurableEmbedding _),
-          ball_zero_eq _ zero_le_one, preimage_setOf_eq]
-        simp only [MeasurableEquiv.finTwoArrow_symm_apply, Fin.sum_univ_two, preimage_setOf_eq,
-          Fin.cons_zero, Fin.cons_one, one_pow, Function.comp_apply, coe_measurableEquiv_symm,
-          MeasurableEquiv.trans_apply, WithLp.equiv_symm_pi_apply]
-      _ = volume {p : ℝ × ℝ | (- 1 < p.1 ∧ p.1 ≤ 1) ∧ p.1 ^ 2 + p.2 ^ 2 < 1} := by
-        congr
-        refine Set.ext fun _ => iff_and_self.mpr fun h => And.imp_right le_of_lt ?_
-        rw [← abs_lt, ← sq_lt_one_iff_abs_lt_one]
-        exact lt_of_add_lt_of_nonneg_left h (sq_nonneg _)
-      _ = volume (regionBetween (fun x => - Real.sqrt (1 - x ^ 2)) (fun x => Real.sqrt (1 - x ^ 2))
-          (Set.Ioc (-1) 1)) := by
-        simp_rw [regionBetween, Set.mem_Ioo, Set.mem_Ioc, ← Real.sq_lt, lt_tsub_iff_left]
-      _ = ENNReal.ofReal ((2 : ℝ) * ∫ (a : ℝ) in Set.Ioc (-1) 1, Real.sqrt (1 - a ^ 2)) := by
-        rw [volume_eq_prod, volume_regionBetween_eq_integral (Continuous.integrableOn_Ioc
-          (by continuity)) (Continuous.integrableOn_Ioc (by continuity)) measurableSet_Ioc
-          (fun _ _ => neg_le_self (Real.sqrt_nonneg _))]
-        simp_rw [Pi.sub_apply, sub_neg_eq_add, ← two_mul, integral_mul_left]
-      _ = NNReal.pi := by
-        rw [← intervalIntegral.integral_of_le (by norm_num : (-1 : ℝ) ≤ 1),
-          integral_sqrt_one_sub_sq, two_mul, add_halves, ← NNReal.coe_real_pi,
-          ofReal_coe_nnreal]
-
-end EuclideanSpace
chore: space after (#8178)

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

Diff
@@ -139,7 +139,7 @@ theorem volume_ball (x : EuclideanSpace ℝ (Fin 2)) (r : ℝ) :
         have : MeasurePreserving (_ : ℝ × ℝ ≃ᵐ EuclideanSpace ℝ (Fin 2)) :=
           MeasurePreserving.trans
             (volume_preserving_finTwoArrow ℝ).symm (volume_preserving_measurableEquiv (Fin 2)).symm
-        rw [←this.measure_preimage_emb (MeasurableEquiv.measurableEmbedding _),
+        rw [← this.measure_preimage_emb (MeasurableEquiv.measurableEmbedding _),
           ball_zero_eq _ zero_le_one, preimage_setOf_eq]
         simp only [MeasurableEquiv.finTwoArrow_symm_apply, Fin.sum_univ_two, preimage_setOf_eq,
           Fin.cons_zero, Fin.cons_one, one_pow, Function.comp_apply, coe_measurableEquiv_symm,
feat: Add OrthonormalBasis.measurePreserving_measurableEquiv (#8427)

Let F be a finite-dimensional inner product space. Then any orthonormal basis of F defines a measurable equivalence between F and the euclidean space of the same dimension that is volume preserving.

Diff
@@ -78,6 +78,25 @@ theorem OrthonormalBasis.addHaar_eq_volume {ι F : Type*} [Fintype ι] [NormedAd
   rw [Basis.addHaar_eq_iff]
   exact b.volume_parallelepiped
 
+/-- An orthonormal basis of a finite-dimensional inner product space defines a measurable
+equivalence between the space and the Euclidean space of the same dimension. -/
+noncomputable def OrthonormalBasis.measurableEquiv (b : OrthonormalBasis ι ℝ F) :
+    F ≃ᵐ EuclideanSpace ℝ ι := b.repr.toHomeomorph.toMeasurableEquiv
+
+/-- The measurable equivalence defined by an orthonormal basis is volume preserving. -/
+theorem OrthonormalBasis.measurePreserving_measurableEquiv (b : OrthonormalBasis ι ℝ F) :
+    MeasurePreserving b.measurableEquiv volume volume := by
+  convert (b.measurableEquiv.symm.measurable.measurePreserving _).symm
+  rw [← (EuclideanSpace.basisFun ι ℝ).addHaar_eq_volume]
+  erw [MeasurableEquiv.coe_toEquiv_symm, Basis.map_addHaar _ b.repr.symm.toContinuousLinearEquiv]
+  exact b.addHaar_eq_volume.symm
+
+theorem OrthonormalBasis.measurePreserving_repr (b : OrthonormalBasis ι ℝ F) :
+    MeasurePreserving b.repr volume volume := b.measurePreserving_measurableEquiv
+
+theorem OrthonormalBasis.measurePreserving_repr_symm (b : OrthonormalBasis ι ℝ F) :
+    MeasurePreserving b.repr.symm volume volume := b.measurePreserving_measurableEquiv.symm
+
 section PiLp
 
 variable (ι : Type*) [Fintype ι]
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
@@ -20,8 +20,6 @@ measure `1` to the parallelepiped spanned by any orthonormal basis, and that it
 the canonical `volume` from the `MeasureSpace` instance.
 -/
 
-local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue lean4#2220
-
 open FiniteDimensional MeasureTheory MeasureTheory.Measure Set
 
 variable {ι F : Type*}
@@ -134,15 +132,14 @@ theorem volume_ball (x : EuclideanSpace ℝ (Fin 2)) (r : ℝ) :
         exact lt_of_add_lt_of_nonneg_left h (sq_nonneg _)
       _ = volume (regionBetween (fun x => - Real.sqrt (1 - x ^ 2)) (fun x => Real.sqrt (1 - x ^ 2))
           (Set.Ioc (-1) 1)) := by
-        simp_rw [regionBetween, Set.mem_Ioo, Set.mem_Ioc, ← Real.sq_lt, lt_tsub_iff_left,
-          Nat.cast_one]
+        simp_rw [regionBetween, Set.mem_Ioo, Set.mem_Ioc, ← Real.sq_lt, lt_tsub_iff_left]
       _ = ENNReal.ofReal ((2 : ℝ) * ∫ (a : ℝ) in Set.Ioc (-1) 1, Real.sqrt (1 - a ^ 2)) := by
         rw [volume_eq_prod, volume_regionBetween_eq_integral (Continuous.integrableOn_Ioc
           (by continuity)) (Continuous.integrableOn_Ioc (by continuity)) measurableSet_Ioc
           (fun _ _ => neg_le_self (Real.sqrt_nonneg _))]
         simp_rw [Pi.sub_apply, sub_neg_eq_add, ← two_mul, integral_mul_left]
       _ = NNReal.pi := by
-        rw [← intervalIntegral.integral_of_le (by norm_num : (-1 : ℝ) ≤ 1), Nat.cast_one,
+        rw [← intervalIntegral.integral_of_le (by norm_num : (-1 : ℝ) ≤ 1),
           integral_sqrt_one_sub_sq, two_mul, add_halves, ← NNReal.coe_real_pi,
           ofReal_coe_nnreal]
 
feat: volume of a complex ball (#6907)

We prove the formula for the area of a disc

theorem volume_ball (x : EuclideanSpace ℝ (Fin 2)) (r : ℝ) :
    volume (Metric.ball x r) = NNReal.pi * (ENNReal.ofReal r) ^ 2 

and deduce from this, the volume of complex balls

theorem volume_ball (a : ℂ) (r : ℝ) :  
    volume (Metric.ball a r) = NNReal.pi * (ENNReal.ofReal r) ^ 2

Co-authored-by: James Arthur Co-authored-by: Benjamin Davidson Co-authored-by: Andrew Souther

Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Diff
@@ -4,7 +4,9 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel
 -/
 import Mathlib.Analysis.InnerProductSpace.Orientation
+import Mathlib.Analysis.SpecialFunctions.Integrals
 import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar
+import Mathlib.MeasureTheory.Measure.Lebesgue.Integral
 
 #align_import measure_theory.measure.haar.inner_product_space from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
 
@@ -18,6 +20,7 @@ measure `1` to the parallelepiped spanned by any orthonormal basis, and that it
 the canonical `volume` from the `MeasureSpace` instance.
 -/
 
+local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue lean4#2220
 
 open FiniteDimensional MeasureTheory MeasureTheory.Measure Set
 
@@ -78,6 +81,7 @@ theorem OrthonormalBasis.addHaar_eq_volume {ι F : Type*} [Fintype ι] [NormedAd
   exact b.volume_parallelepiped
 
 section PiLp
+
 variable (ι : Type*) [Fintype ι]
 
 /-- The measure equivalence between `EuclideanSpace ℝ ι` and `ι → ℝ` is volume preserving. -/
@@ -100,3 +104,46 @@ theorem PiLp.volume_preserving_equiv_symm : MeasurePreserving (WithLp.equiv 2 (
   (EuclideanSpace.volume_preserving_measurableEquiv ι).symm
 
 end PiLp
+
+namespace EuclideanSpace
+
+open BigOperators ENNReal
+
+@[simp]
+theorem volume_ball (x : EuclideanSpace ℝ (Fin 2)) (r : ℝ) :
+    volume (Metric.ball x r) = NNReal.pi * (ENNReal.ofReal r) ^ 2 := by
+  obtain hr | hr := le_total r 0
+  · rw [Metric.ball_eq_empty.mpr hr, measure_empty, ← zero_eq_ofReal.mpr hr, zero_pow zero_lt_two,
+      mul_zero]
+  · suffices volume (Metric.ball (0 : EuclideanSpace ℝ (Fin 2)) 1) = NNReal.pi by
+      rw [Measure.addHaar_ball _ _ hr, finrank_euclideanSpace_fin, ofReal_pow hr, this, mul_comm]
+    calc
+      _ = volume {p : ℝ × ℝ | p.1 ^ 2 + p.2 ^ 2 < 1} := by
+        have : MeasurePreserving (_ : ℝ × ℝ ≃ᵐ EuclideanSpace ℝ (Fin 2)) :=
+          MeasurePreserving.trans
+            (volume_preserving_finTwoArrow ℝ).symm (volume_preserving_measurableEquiv (Fin 2)).symm
+        rw [←this.measure_preimage_emb (MeasurableEquiv.measurableEmbedding _),
+          ball_zero_eq _ zero_le_one, preimage_setOf_eq]
+        simp only [MeasurableEquiv.finTwoArrow_symm_apply, Fin.sum_univ_two, preimage_setOf_eq,
+          Fin.cons_zero, Fin.cons_one, one_pow, Function.comp_apply, coe_measurableEquiv_symm,
+          MeasurableEquiv.trans_apply, WithLp.equiv_symm_pi_apply]
+      _ = volume {p : ℝ × ℝ | (- 1 < p.1 ∧ p.1 ≤ 1) ∧ p.1 ^ 2 + p.2 ^ 2 < 1} := by
+        congr
+        refine Set.ext fun _ => iff_and_self.mpr fun h => And.imp_right le_of_lt ?_
+        rw [← abs_lt, ← sq_lt_one_iff_abs_lt_one]
+        exact lt_of_add_lt_of_nonneg_left h (sq_nonneg _)
+      _ = volume (regionBetween (fun x => - Real.sqrt (1 - x ^ 2)) (fun x => Real.sqrt (1 - x ^ 2))
+          (Set.Ioc (-1) 1)) := by
+        simp_rw [regionBetween, Set.mem_Ioo, Set.mem_Ioc, ← Real.sq_lt, lt_tsub_iff_left,
+          Nat.cast_one]
+      _ = ENNReal.ofReal ((2 : ℝ) * ∫ (a : ℝ) in Set.Ioc (-1) 1, Real.sqrt (1 - a ^ 2)) := by
+        rw [volume_eq_prod, volume_regionBetween_eq_integral (Continuous.integrableOn_Ioc
+          (by continuity)) (Continuous.integrableOn_Ioc (by continuity)) measurableSet_Ioc
+          (fun _ _ => neg_le_self (Real.sqrt_nonneg _))]
+        simp_rw [Pi.sub_apply, sub_neg_eq_add, ← two_mul, integral_mul_left]
+      _ = NNReal.pi := by
+        rw [← intervalIntegral.integral_of_le (by norm_num : (-1 : ℝ) ≤ 1), Nat.cast_one,
+          integral_sqrt_one_sub_sq, two_mul, add_halves, ← NNReal.coe_real_pi,
+          ofReal_coe_nnreal]
+
+end EuclideanSpace
feat: Prove that the measure equivalence between EuclideanSpace ℝ ι and ι → ℝ is volume preserving (#7037)

We prove that the two MeasureSpace structures on $\mathbb{R}^\iota$, the one coming from its identification with ι→ ℝ and the one coming from EuclideanSpace ℝ ι, agree in the sense that the measure equivalence between the two corresponding volumes is measure preserving.

Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Diff
@@ -67,3 +67,36 @@ theorem OrthonormalBasis.volume_parallelepiped (b : OrthonormalBasis ι ℝ F) :
   rw [← o.measure_eq_volume]
   exact o.measure_orthonormalBasis b
 #align orthonormal_basis.volume_parallelepiped OrthonormalBasis.volume_parallelepiped
+
+/-- The Haar measure defined by any orthonormal basis of a finite-dimensional inner product space
+is equal to its volume measure. -/
+theorem OrthonormalBasis.addHaar_eq_volume {ι F : Type*} [Fintype ι] [NormedAddCommGroup F]
+    [InnerProductSpace ℝ F] [FiniteDimensional ℝ F] [MeasurableSpace F] [BorelSpace F]
+    (b : OrthonormalBasis ι ℝ F) :
+    b.toBasis.addHaar = volume := by
+  rw [Basis.addHaar_eq_iff]
+  exact b.volume_parallelepiped
+
+section PiLp
+variable (ι : Type*) [Fintype ι]
+
+/-- The measure equivalence between `EuclideanSpace ℝ ι` and `ι → ℝ` is volume preserving. -/
+theorem EuclideanSpace.volume_preserving_measurableEquiv :
+    MeasurePreserving (EuclideanSpace.measurableEquiv ι) := by
+  suffices volume = map (EuclideanSpace.measurableEquiv ι).symm volume by
+    convert ((EuclideanSpace.measurableEquiv ι).symm.measurable.measurePreserving _).symm
+  rw [← addHaarMeasure_eq_volume_pi, ← Basis.parallelepiped_basisFun, ← Basis.addHaar_def,
+    coe_measurableEquiv_symm, ← PiLp.continuousLinearEquiv_symm_apply 2 ℝ, Basis.map_addHaar]
+  exact (EuclideanSpace.basisFun _ _).addHaar_eq_volume.symm
+
+/-- A copy of `EuclideanSpace.volume_preserving_measurableEquiv` for the canonical spelling of the
+equivalence. -/
+theorem PiLp.volume_preserving_equiv : MeasurePreserving (WithLp.equiv 2 (ι → ℝ)) :=
+  EuclideanSpace.volume_preserving_measurableEquiv ι
+
+/-- The reverse direction of `PiLp.volume_preserving_measurableEquiv`, since
+`MeasurePreserving.symm` only works for `MeasurableEquiv`s. -/
+theorem PiLp.volume_preserving_equiv_symm : MeasurePreserving (WithLp.equiv 2 (ι → ℝ)).symm :=
+  (EuclideanSpace.volume_preserving_measurableEquiv ι).symm
+
+end PiLp
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
@@ -21,7 +21,7 @@ the canonical `volume` from the `MeasureSpace` instance.
 
 open FiniteDimensional MeasureTheory MeasureTheory.Measure Set
 
-variable {ι F : Type _}
+variable {ι F : Type*}
 
 variable [Fintype ι] [NormedAddCommGroup F] [InnerProductSpace ℝ F] [FiniteDimensional ℝ F]
   [MeasurableSpace F] [BorelSpace F]
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,15 +2,12 @@
 Copyright (c) 2022 Sébastien Gouëzel. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel
-
-! This file was ported from Lean 3 source module measure_theory.measure.haar.inner_product_space
-! 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.Analysis.InnerProductSpace.Orientation
 import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar
 
+#align_import measure_theory.measure.haar.inner_product_space from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
+
 /-!
 # Volume forms and measures on inner product spaces
 
feat: port MeasureTheory.Measure.Haar.InnerProductSpace (#4708)

Dependencies 12 + 965

966 files ported (98.8%)
434875 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