Riemann hypothesis: the Lean proof, cleaned up together
The 2026 Lean proof of the Riemann hypothesis and GRH, machine-checked by others, not refereed, no word from Clay; cleaned up together: more readable, faster to build, the theorems unchanged

| 1 | module |
| 2 | |
| 3 | public import TauCeti.Analysis.Matrix.MeasurableSpace |
| 4 | public import Mathlib.Data.Matrix.ColumnRowPartitioned |
| 5 | import Mathlib.Algebra.Order.Archimedean.Real.Hom |
| 6 | import Mathlib.Analysis.Calculus.FDeriv.Star |
| 7 | import Mathlib.Analysis.LocallyConvex.AbsConvexOpen |
| 8 | import Mathlib.LinearAlgebra.Matrix.FiniteDimensional |
| 9 | import Mathlib.RingTheory.Coalgebra.CoassocSimps |
| 10 | import Mathlib.RingTheory.SimpleRing.Principal |
| 11 | import Mathlib.RingTheory.TotallySplit |
| 12 | import TauCeti.Topology.Instances.Matrix |
| 13 | public import Lib.General.LinearAlgebra.HermitianMatrices |
| 14 | import Lib.DiscreteSeries.Haar.CayleyChart |
| 15 | |
| 16 | /-! |
| 17 | # Coordinates for the Gram map |
| 18 | |
| 19 | Let `J` be a hermitian matrix. The Gram map sends a tuple of vectors, the columns of a complex |
| 20 | matrix `Y`, to the hermitian matrix `T = Yᴴ J Y`. Tuples carry Lebesgue measure `dY`, and hermitian |
| 21 | matrices the product `dT` of the Lebesgue measures of the entries on and above the diagonal. |
| 22 | |
| 23 | * `New.joinCols`, `New.joinCol`: joining two groups of columns into one matrix; this preserves |
| 24 | volume (`New.measurePreserving_joinCols`, `New.measurePreserving_joinCol`). |
| 25 | * `New.hermOfReal`, `New.gramCoords`: real coordinates on hermitian matrices, and the Gram map in |
| 26 | these coordinates. |
| 27 | * `New.lintegral_eq_skewOfReal_add_hermOfReal`: Lebesgue measure on matrices `Z = S + T / 2` of size |
| 28 | `n`, with `S` skew-hermitian and `T` hermitian, is `2 ^ (-n) dS dT`. |
| 29 | * `New.exists_measurePreserving_hermBlocks`, `New.exists_measurePreserving_hermCorner`: cutting a |
| 30 | hermitian matrix into the corresponding blocks preserves volume. |
| 31 | |
| 32 | Notions from other files: |
| 33 | * `New.skewOfReal`: the skew-hermitian matrix with given real coordinates, normalised so that |
| 34 | Lebesgue measure in the coordinates is that of the entries on and above the diagonal. |
| 35 | * `New.skewCoords`: the real-linear left inverse of `New.skewOfReal`, inverse to it on |
| 36 | skew-hermitian matrices. |
| 37 | -/ |
| 38 | |
| 39 | @[expose] public section |
| 40 | |
| 41 | noncomputable section |
| 42 | |
| 43 | namespace New |
| 44 | |
| 45 | open Matrix MeasureTheory Measure Complex Fintype ENNReal Norms.L2Operator Filter Topology |
| 46 | |
| 47 | variable {ι n n₁ n₂ : Type} |
| 48 | |
| 49 | /-! ### Columns and transposes -/ |
| 50 | |
| 51 | /-- The linear isomorphism that sends a pair of matrices to the matrix with the columns of both, in |
| 52 | the places given by `e`. -/ |
| 53 | def joinCols (e : n₁ ⊕ n₂ ≃ n) : (Matrix ι n₁ ℂ × Matrix ι n₂ ℂ) ≃ₗ[ℝ] Matrix ι n ℂ where |
| 54 | toFun p := (fromCols p.1 p.2).submatrix id e.symm |
| 55 | invFun Y := (Y.submatrix id (e ∘ Sum.inl), Y.submatrix id (e ∘ Sum.inr)) |
| 56 | map_add' := by simp [← ext_iff, e.surjective.forall] |
| 57 | map_smul' := by simp [← ext_iff, e.surjective.forall] |
| 58 | left_inv := by simp [Function.LeftInverse, Prod.ext_iff, ← ext_iff] |
| 59 | right_inv := by simp [Function.RightInverse, Function.LeftInverse, ← ext_iff, e.surjective.forall] |
| 60 | |
| 61 | /-- Joining two groups of columns is continuous. -/ |
| 62 | @[fun_prop] |
| 63 | theorem continuous_joinCols [Fintype ι] [Fintype n₁] [Fintype n₂] (e : n₁ ⊕ n₂ ≃ n) : |
| 64 | Continuous (joinCols (ι := ι) e) := (joinCols e).continuous_of_finiteDimensional |
| 65 | |
| 66 | /-- Joining two groups of complex columns (`joinCols`) preserves Lebesgue measure. -/ |
| 67 | theorem measurePreserving_joinCols [Fintype ι] [Fintype n] [Fintype n₁] [Fintype n₂] |
| 68 | (e : n₁ ⊕ n₂ ≃ n) : MeasurePreserving (joinCols (ι := ι) e) := by |
| 69 | classical |
| 70 | have h_norm (p : Matrix ι n₁ ℂ × Matrix ι n₂ ℂ) : |
| 71 | ∑ a : ι, ∑ b : n, ‖joinCols e p a b‖ ^ 2 = |
| 72 | ∑ a : ι, ∑ b : n₁, ‖p.1 a b‖ ^ 2 + ∑ a : ι, ∑ b : n₂, ‖p.2 a b‖ ^ 2 := by |
| 73 | simp [joinCols, ← e.sum_comp, Finset.sum_add_distrib] |
| 74 | have : IsAddHaarMeasure (volume : Measure (Matrix ι n₁ ℂ × Matrix ι n₂ ℂ)) := |
| 75 | prod.instIsAddHaarMeasure _ _ |
| 76 | exact HasGaussianIntegral.measurePreserving _ h_norm |
| 77 | |
| 78 | /-- Placing one complex matrix above another preserves Lebesgue measure. -/ |
| 79 | theorem measurePreserving_fromRows {l m k : Type} [Fintype l] [Fintype m] [Fintype k] : |
| 80 | MeasurePreserving fun p : Matrix l k ℂ × Matrix m k ℂ ↦ fromRows p.1 p.2 := |
| 81 | volume_measurePreserving_sumPiEquivProdPi_symm fun _ ↦ k → ℂ |
| 82 | |
| 83 | /-- Left multiplication by a matrix acts on each of two groups of columns separately. -/ |
| 84 | theorem mul_joinCols {l : Type} [Fintype ι] (e : n₁ ⊕ n₂ ≃ n) (A : Matrix l ι ℂ) |
| 85 | (x : Matrix ι n₁ ℂ) (y : Matrix ι n₂ ℂ) : |
| 86 | A * joinCols e (x, y) = joinCols e (A * x, A * y) := by |
| 87 | simp [← ext_iff, e.surjective.forall, joinCols, Matrix.mul_apply] |
| 88 | |
| 89 | /-- A vector as a matrix with one column. -/ |
| 90 | def toCol (κ R : Type) [TopologicalSpace R] : (κ → R) ≃ₜ Matrix κ Unit R := |
| 91 | .piCongrRight fun _ ↦ (Homeomorph.funUnique Unit R).symm |
| 92 | |
| 93 | /-- Pointwise evaluation of the one-column matrix associated to a vector. -/ |
| 94 | @[simp] |
| 95 | theorem toCol_apply {κ R : Type} [TopologicalSpace R] (v : κ → R) (i : κ) (u : Unit) : |
| 96 | toCol κ R v i u = v i := rfl |
| 97 | |
| 98 | /-- Reading a vector as a matrix with one column (`toCol`) preserves volume. -/ |
| 99 | theorem measurePreserving_toCol (κ R : Type) [Fintype κ] [TopologicalSpace R] [MeasureSpace R] |
| 100 | [SigmaFinite (volume : Measure R)] : MeasurePreserving (toCol κ R) := |
| 101 | volume_preserving_pi fun _ ↦ (volume_preserving_funUnique Unit R).symm |
| 102 | |
| 103 | /-- A vector and a real number as a one-column matrix and a one-by-one matrix. -/ |
| 104 | def toCorner (κ : Type) : ((κ → ℂ) × ℝ) ≃ₜ Matrix κ Unit ℂ × Matrix Unit Unit ℝ := |
| 105 | (toCol κ ℂ).prodCongr ((Homeomorph.funUnique Unit ℝ).symm.trans (toCol Unit ℝ)) |
| 106 | |
| 107 | /-- Evaluation of `toCorner` on a vector and real scalar pair. -/ |
| 108 | theorem toCorner_apply {κ : Type} (v : κ → ℂ) (r : ℝ) : |
| 109 | toCorner κ (v, r) = (toCol κ ℂ v, toCol Unit ℝ fun _ : Unit ↦ r) := rfl |
| 110 | |
| 111 | /-- The homeomorphism `toCorner` preserves volume. -/ |
| 112 | theorem measurePreserving_toCorner [Fintype n] : MeasurePreserving (toCorner n) := |
| 113 | (measurePreserving_toCol n ℂ).prod |
| 114 | ((measurePreserving_toCol Unit ℝ).comp (volume_preserving_funUnique Unit ℝ).symm) |
| 115 | |
| 116 | /-- The matrix whose columns are those of `p.1` and the vector `p.2`, in the places given by `e`. -/ |
| 117 | def joinCol (e : n₁ ⊕ Unit ≃ n) (p : Matrix ι n₁ ℂ × (ι → ℂ)) : Matrix ι n ℂ := |
| 118 | joinCols e (p.1, toCol ι ℂ p.2) |
| 119 | |
| 120 | /-- The entry of `joinCol e p` in a column `e (.inl a)` is the entry of `p.1` in column `a`. -/ |
| 121 | @[simp] |
| 122 | theorem joinCol_inl (e : n₁ ⊕ Unit ≃ n) (p : Matrix ι n₁ ℂ × (ι → ℂ)) (i : ι) (a : n₁) : |
| 123 | joinCol e p i (e (.inl a)) = p.1 i a := by simp [joinCol, joinCols] |
| 124 | |
| 125 | /-- The entry of `joinCol e p` in the column `e (.inr ())` is the entry of `p.2`. -/ |
| 126 | @[simp] |
| 127 | theorem joinCol_inr (e : n₁ ⊕ Unit ≃ n) (p : Matrix ι n₁ ℂ × (ι → ℂ)) (i : ι) : |
| 128 | joinCol e p i (e (.inr ())) = p.2 i := by simp [joinCol, joinCols] |
| 129 | |
| 130 | @[fun_prop] |
| 131 | theorem continuous_joinCol [Fintype ι] [Fintype n₁] (e : n₁ ⊕ Unit ≃ n) : |
| 132 | Continuous (joinCol (ι := ι) e) := (continuous_joinCols e).comp (by fun_prop) |
| 133 | |
| 134 | /-- Adjoining a complex vector as a further column (`joinCol`) preserves Lebesgue measure. -/ |
| 135 | theorem measurePreserving_joinCol [Fintype ι] [Fintype n] [Fintype n₁] (e : n₁ ⊕ Unit ≃ n) : |
| 136 | MeasurePreserving (joinCol (ι := ι) e) := |
| 137 | (measurePreserving_joinCols e).comp ((MeasurePreserving.id _).prod (measurePreserving_toCol ι ℂ)) |
| 138 | |
| 139 | /-- Left multiplication by a matrix acts separately on the given columns and on the adjoined |
| 140 | one. -/ |
| 141 | theorem mul_joinCol {l : Type} [Fintype ι] (e : n₁ ⊕ Unit ≃ n) (A : Matrix l ι ℂ) |
| 142 | (Y : Matrix ι n₁ ℂ) (v : ι → ℂ) : A * joinCol e (Y, v) = joinCol e (A * Y, A *ᵥ v) := by |
| 143 | rw [joinCol, mul_joinCols] |
| 144 | rfl |
| 145 | |
| 146 | /-- On the matrices without columns, which form a single point, the volume is the unit mass. -/ |
| 147 | theorem volume_eq_dirac_of_isEmpty [Fintype ι] [Fintype n] {R : Type} [MeasureSpace R] |
| 148 | [SigmaFinite (volume : Measure R)] [IsEmpty n] (Y : Matrix ι n R) : volume = dirac Y := by |
| 149 | refine ext_iff_singleton.2 fun Z ↦ ?_ |
| 150 | rw [Subsingleton.eq_univ_of_nonempty (Set.singleton_nonempty Z), measure_univ (μ := dirac Y)] |
| 151 | exact (pi_univ _).trans (Finset.prod_eq_one fun _ _ ↦ pi_empty_univ _) |
| 152 | |
| 153 | /-- The conjugate transpose preserves Lebesgue measure on complex matrices. -/ |
| 154 | theorem measurePreserving_conjTranspose [Fintype ι] [Fintype n] [DecidableEq ι] [DecidableEq n] : |
| 155 | MeasurePreserving fun b : Matrix ι n ℂ ↦ bᴴ := by |
| 156 | have h_norm (b : Matrix ι n ℂ) : |
| 157 | ∑ a : n, ∑ i : ι, ‖bᴴ a i‖ ^ 2 = ∑ i : ι, ∑ a : n, ‖b i a‖ ^ 2 := by |
| 158 | simpa using Finset.sum_comm |
| 159 | let e : Matrix ι n ℂ ≃ₗ[ℝ] Matrix n ι ℂ := |
| 160 | { conjTransposeAddEquiv ι n ℂ with map_smul' := by simp [star_trivial] } |
| 161 | exact HasGaussianIntegral.measurePreserving e h_norm |
| 162 | |
| 163 | section Hermitian |
| 164 | |
| 165 | variable [Fintype ι] [DecidableEq n] |
| 166 | |
| 167 | /-! ### Measurability and linear changes of variables -/ |
| 168 | |
| 169 | omit [DecidableEq n] in |
| 170 | /-- The product of two measurable families of complex matrices is measurable. -/ |
| 171 | @[fun_prop] |
| 172 | theorem _root_.Measurable.matrix_mul [Fintype n] {X : Type} [MeasurableSpace X] [Fintype n₁] |
| 173 | {A : X → Matrix ι n₁ ℂ} {B : X → Matrix n₁ n ℂ} (hA : Measurable A) (hB : Measurable B) : |
| 174 | Measurable fun x : X ↦ A x * B x := |
| 175 | (continuous_fst.matrix_mul continuous_snd).measurable.comp (hA.prodMk hB) |
| 176 | |
| 177 | @[fun_prop] |
| 178 | theorem measurable_matrix_det [Fintype n] : Measurable fun Z : Matrix n n ℂ ↦ Z.det := |
| 179 | continuous_id.matrix_det.measurable |
| 180 | |
| 181 | /-- Substitution by an invertible real linear map `T` in an integral against an additive Haar |
| 182 | measure: the Jacobian is `|det T|`. -/ |
| 183 | theorem lintegral_eq_abs_det_mul_comp {V : Type*} [NormedAddCommGroup V] [NormedSpace ℝ V] |
| 184 | [FiniteDimensional ℝ V] [MeasurableSpace V] [BorelSpace V] (μ : Measure V) |
| 185 | [μ.IsAddHaarMeasure] {T : V →ₗ[ℝ] V} (hT : T.det ≠ 0) {K : V → ℝ≥0∞} (hK : Measurable K) : |
| 186 | ∫⁻ y : V, K y ∂μ = ENNReal.ofReal |T.det| * ∫⁻ y : V, K (T y) ∂μ := by |
| 187 | have h_map : ∫⁻ y : V, K (T y) ∂μ = ENNReal.ofReal |T.det⁻¹| * ∫⁻ y : V, K y ∂μ := by |
| 188 | rw [← lintegral_map hK T.continuous_of_finiteDimensional.measurable, |
| 189 | map_linearMap_addHaar_eq_smul_addHaar μ hT, lintegral_smul_measure, smul_eq_mul] |
| 190 | rw [h_map, ← mul_assoc, ← ENNReal.ofReal_mul (abs_nonneg _), ← abs_mul, mul_inv_cancel₀ hT] |
| 191 | simp |
| 192 | |
| 193 | /-- Substitution `y ↦ P y Q` in an integral over complex matrices, for invertible `P` and `Q`: the |
| 194 | Jacobian is `|det P| ^ (2 |n|) |det Q| ^ (2 |ι|)`. -/ |
| 195 | theorem lintegral_eq_det_mul_comp_mul_mul [Fintype n] |
| 196 | [DecidableEq ι] {P : Matrix ι ι ℂ} {Q : Matrix n n ℂ} |
| 197 | (hP : P.det ≠ 0) (hQ : Q.det ≠ 0) {K : Matrix ι n ℂ → ℝ≥0∞} (hK : Measurable K) : |
| 198 | ∫⁻ y : Matrix ι n ℂ, K y = |
| 199 | ‖P.det‖ₑ ^ (2 * card n) * ‖Q.det‖ₑ ^ (2 * card ι) * ∫⁻ y : Matrix ι n ℂ, K (P * y * Q) := by |
| 200 | let L : Matrix ι n ℂ →ₗ[ℝ] Matrix ι n ℂ := mulRightLinearMap ι ℝ Q ∘ₗ mulLeftLinearMap n ℝ P |
| 201 | have h_det : L.det = ‖P.det‖ ^ (2 * card n) * ‖Q.det‖ ^ (2 * card ι) := |
| 202 | det_mulLeft_mulRight_real P Q |
| 203 | have h_ne : L.det ≠ 0 := h_det.trans_ne (by positivity) |
| 204 | simp [lintegral_eq_abs_det_mul_comp volume h_ne hK, h_det, L, ENNReal.ofReal_mul, |
| 205 | ENNReal.ofReal_pow] |
| 206 | |
| 207 | /-! ### Hermitian coordinates -/ |
| 208 | |
| 209 | /-- The hermitian matrix with real coordinates `t`: it is `-i` times the skew-hermitian matrix |
| 210 | `skewOfReal t`, so its diagonal entries are those of `t`. Lebesgue measure in `t` is the product |
| 211 | of the Lebesgue measures of the entries on and above the diagonal. -/ |
| 212 | def hermOfReal (t : Matrix n n ℝ) : Matrix n n ℂ := -I • skewOfReal t |
| 213 | |
| 214 | /-- The Gram map: the real coordinates, in the sense of `hermOfReal`, of the Gram matrix |
| 215 | `Yᴴ J Y` of the columns of `Y`, for a hermitian `J` (`hermOfReal_gramCoords`). -/ |
| 216 | def gramCoords (J : Matrix ι ι ℂ) (Y : Matrix ι n ℂ) : Matrix n n ℝ := |
| 217 | skewCoords (I • (Yᴴ * J * Y)) |
| 218 | |
| 219 | /-- The matrix `hermOfReal t` is hermitian: it equals its conjugate transpose. -/ |
| 220 | @[simp] |
| 221 | theorem conjTranspose_hermOfReal (t : Matrix n n ℝ) : (hermOfReal t)ᴴ = hermOfReal t := by |
| 222 | simp [hermOfReal, conjTranspose_smul] |
| 223 | |
| 224 | /-- The real coordinates `skewCoords` of `I • hermOfReal t` are `t`. -/ |
| 225 | @[simp] |
| 226 | theorem skewCoords_I_smul_hermOfReal (t : Matrix n n ℝ) : skewCoords (I • hermOfReal t) = t := by |
| 227 | simp [hermOfReal, smul_smul] |
| 228 | |
| 229 | /-- For a hermitian `J`, the hermitian matrix with the real coordinates `gramCoords J Y` is the |
| 230 | Gram matrix `Yᴴ J Y`. -/ |
| 231 | theorem hermOfReal_gramCoords {J : Matrix ι ι ℂ} (hJ : J.IsHermitian) (Y : Matrix ι n ℂ) : |
| 232 | hermOfReal (gramCoords J Y) = Yᴴ * J * Y := by |
| 233 | have h_skew : (I • (Yᴴ * J * Y))ᴴ = -(I • (Yᴴ * J * Y)) := by |
| 234 | simp [conjTranspose_smul, hJ.eq, Matrix.mul_assoc] |
| 235 | simp [hermOfReal, gramCoords, skewOfReal_skewCoords h_skew, smul_smul] |
| 236 | |
| 237 | @[fun_prop] |
| 238 | theorem continuous_gramCoords [Fintype n] (J : Matrix ι ι ℂ) : |
| 239 | Continuous (gramCoords J : Matrix ι n ℂ → Matrix n n ℝ) := |
| 240 | skewCoords.continuous_of_finiteDimensional.comp (by fun_prop) |
| 241 | |
| 242 | @[fun_prop] |
| 243 | theorem continuous_hermOfReal [Fintype n] : Continuous (hermOfReal : Matrix n n ℝ → Matrix n n ℂ) := |
| 244 | skewOfReal.continuous_of_finiteDimensional.const_smul (-I) |
| 245 | |
| 246 | /-- In the real coordinates `t` of hermitian matrices `T = hermOfReal t` of size `n`, the congruence |
| 247 | `T ↦ Cᴴ T C` has the Jacobian `|det C| ^ (2 n)`. -/ |
| 248 | theorem lintegral_eq_det_mul_comp_congruence [Fintype n] {C : Matrix n n ℂ} (hC : C.det ≠ 0) |
| 249 | {G : Matrix n n ℂ → ℝ≥0∞} (hG : Measurable G) : |
| 250 | ∫⁻ t : Matrix n n ℝ, G (hermOfReal t) = |
| 251 | ‖C.det‖ₑ ^ (2 * card n) * ∫⁻ t : Matrix n n ℝ, G (Cᴴ * hermOfReal t * C) := by |
| 252 | let L : Matrix n n ℝ →ₗ[ℝ] Matrix n n ℝ := |
| 253 | skewCoords ∘ₗ LinearMap.mulLeftRight ℝ (Cᴴ, C) ∘ₗ skewOfReal |
| 254 | -- `abs_det_skew_congruence` allows coordinate changes on both sides; here both are trivial. |
| 255 | have h_det : |L.det| = ‖C.det‖ ^ (2 * card n) := by |
| 256 | simpa using abs_det_skew_congruence (LinearEquiv.refl ℝ (Matrix n n ℝ)) C LinearMap.id |
| 257 | have h_herm (t : Matrix n n ℝ) : hermOfReal (L t) = Cᴴ * hermOfReal t * C := by |
| 258 | simp [L, hermOfReal, skewOfReal_skewCoords, Matrix.mul_assoc] |
| 259 | have h_ne : L.det ≠ 0 := abs_ne_zero.1 (h_det.trans_ne (by positivity)) |
| 260 | simp [lintegral_eq_abs_det_mul_comp volume h_ne (show Measurable fun t ↦ G (hermOfReal t) by |
| 261 | fun_prop), h_det, h_herm, ENNReal.ofReal_pow] |
| 262 | |
| 263 | /-- The derivative of the Gram matrix `σᴴ J σ` of a differentiable family `σ` of matrices is |
| 264 | `σᴴ J dσ + dσᴴ J σ`, read in the coordinates of `gramCoords`. -/ |
| 265 | theorem hasFDerivAt_gramCoords {V : Type*} [NormedAddCommGroup V] [NormedSpace ℝ V] |
| 266 | [DecidableEq ι] (J : Matrix ι ι ℂ) {σ : V → Matrix ι ι ℂ} {σ' : V →L[ℝ] Matrix ι ι ℂ} {t : V} |
| 267 | (hσ : HasFDerivAt σ σ' t) : ∃ D : V →L[ℝ] Matrix ι ι ℝ, |
| 268 | HasFDerivAt (fun x : V ↦ gramCoords J (σ x)) D t ∧ |
| 269 | ∀ v : V, D v = skewCoords (I • ((σ t)ᴴ * J * σ' v + (σ' v)ᴴ * J * σ t)) := |
| 270 | -- the product rule, followed by the linear map `skewCoords` |
| 271 | ⟨_, skewCoords.toContinuousLinearMap.hasFDerivAt.comp t |
| 272 | (((hσ.star.mul_const' J).mul' hσ).const_smul I), fun _ ↦ rfl⟩ |
| 273 | |
| 274 | /-- The Gram map `Y ↦ Yᴴ J Y` on square matrices, read in the real coordinates of |
| 275 | `gramCoords`, is continuously differentiable. -/ |
| 276 | theorem contDiff_gramCoords [DecidableEq ι] (J : Matrix ι ι ℂ) : |
| 277 | ContDiff ℝ 1 (gramCoords J : Matrix ι ι ℂ → Matrix ι ι ℝ) := by |
| 278 | have h_star : ContDiff ℝ 1 fun Y : Matrix ι ι ℂ ↦ Yᴴ := (starL' ℝ).contDiff |
| 279 | exact skewCoords.toContinuousLinearMap.contDiff.comp |
| 280 | (((h_star.mul contDiff_const).mul contDiff_id).const_smul I) |
| 281 | |
| 282 | /-- The isomorphism `(t, s) ↦ S + T / 2` onto the complex matrices, where `S` is the skew-hermitian |
| 283 | matrix with coordinates `s` and `T` the hermitian matrix with coordinates `t`. The inverse reads |
| 284 | `T = Z + Zᴴ` and `S = (Z - Zᴴ) / 2`. -/ |
| 285 | def skewAddHerm : (Matrix n n ℝ × Matrix n n ℝ) ≃ₗ[ℝ] Matrix n n ℂ where |
| 286 | toFun p := skewOfReal p.2 + (2⁻¹ : ℂ) • hermOfReal p.1 |
| 287 | invFun Z := (skewCoords (I • (Z + Zᴴ)), skewCoords ((2⁻¹ : ℂ) • (Z - Zᴴ))) |
| 288 | map_add' p q := by simp [hermOfReal, smul_add, add_add_add_comm] |
| 289 | map_smul' c p := by simp [hermOfReal, smul_comm c] |
| 290 | left_inv p := by |
| 291 | have hZ : (skewOfReal p.2 + (2⁻¹ : ℂ) • hermOfReal p.1)ᴴ = |
| 292 | -skewOfReal p.2 + (2⁻¹ : ℂ) • hermOfReal p.1 := by simp [conjTranspose_smul] |
| 293 | refine Prod.ext ((congrArg skewCoords ?_).trans (skewCoords_I_smul_hermOfReal p.1)) |
| 294 | ((congrArg skewCoords ?_).trans (skewCoords_skewOfReal p.2)) |
| 295 | all_goals |
| 296 | rw [hZ] |
| 297 | module |
| 298 | right_inv Z := by |
| 299 | have h_herm : (I • (Z + Zᴴ))ᴴ = -(I • (Z + Zᴴ)) := by simp [conjTranspose_smul, add_comm] |
| 300 | have h_skew : ((2⁻¹ : ℂ) • (Z - Zᴴ))ᴴ = -((2⁻¹ : ℂ) • (Z - Zᴴ)) := by |
| 301 | simp [conjTranspose_smul, ← smul_neg] |
| 302 | change skewOfReal (skewCoords ((2⁻¹ : ℂ) • (Z - Zᴴ))) + |
| 303 | (2⁻¹ : ℂ) • hermOfReal (skewCoords (I • (Z + Zᴴ))) = Z |
| 304 | simp only [hermOfReal, skewOfReal_skewCoords h_herm, skewOfReal_skewCoords h_skew, |
| 305 | smul_smul (-I), neg_mul, I_mul_I, neg_neg, one_smul] |
| 306 | module |
| 307 | |
| 308 | /-- Evaluation of `skewAddHerm` on a pair `(t, s)`: `skewOfReal s + 2⁻¹ • hermOfReal t`. -/ |
| 309 | theorem skewAddHerm_apply (t s : Matrix n n ℝ) : |
| 310 | skewAddHerm (t, s) = skewOfReal s + (2⁻¹ : ℂ) • hermOfReal t := rfl |
| 311 | |
| 312 | /-- Evaluation of the inverse of `skewAddHerm` on `Z`: the pair |
| 313 | `(skewCoords (I • (Z + Zᴴ)), skewCoords (2⁻¹ • (Z - Zᴴ)))`. -/ |
| 314 | theorem skewAddHerm_symm_apply (Z : Matrix n n ℂ) : |
| 315 | skewAddHerm.symm Z = (skewCoords (I • (Z + Zᴴ)), skewCoords ((2⁻¹ : ℂ) • (Z - Zᴴ))) := rfl |
| 316 | |
| 317 | omit [DecidableEq n] in |
| 318 | /-- Scaling the entries of a real matrix by numbers `c a b` is a linear map with determinant |
| 319 | `∏ c a b`. -/ |
| 320 | theorem exists_linearMap_scale_entries [Fintype n] (c : n → n → ℝ) : |
| 321 | ∃ T : Matrix n n ℝ →ₗ[ℝ] Matrix n n ℝ, |
| 322 | (∀ (y : Matrix n n ℝ) (a b : n), T y a b = c a b * y a b) ∧ |
| 323 | T.det = ∏ a : n, ∏ b : n, c a b := by |
| 324 | let L (a : n) : (n → ℝ) →ₗ[ℝ] n → ℝ := |
| 325 | LinearMap.pi fun b : n ↦ (c a b • LinearMap.id) ∘ₗ LinearMap.proj b |
| 326 | refine ⟨LinearMap.pi fun a : n ↦ L a ∘ₗ LinearMap.proj a, |
| 327 | fun y a b ↦ rfl, (LinearMap.det_pi _).trans ?_⟩ |
| 328 | simp [L, LinearMap.det_pi] |
| 329 | |
| 330 | /-- The squared norms of the entries of `skewAddHerm (t', s')` in terms of `t` and `s`, when `t'` |
| 331 | and `s'` are `t` and `s` multiplied by `2 / d` and `1 / d` entrywise, with `d = 1` on the diagonal |
| 332 | and `d = √2` off it. -/ |
| 333 | theorem norm_sq_skewAddHerm_of_scale {t s t' s' : Matrix n n ℝ} |
| 334 | (ht : ∀ a b : n, t' a b = 2 / (if a = b then 1 else √2) * t a b) |
| 335 | (hs : ∀ a b : n, s' a b = 1 / (if a = b then 1 else √2) * s a b) (a b : n) : |
| 336 | ‖skewAddHerm (t', s') a b‖ ^ 2 = ((t a b + t b a + s a b - s b a) ^ 2 + |
| 337 | (s a b + s b a + t b a - t a b) ^ 2) / 4 := by |
| 338 | obtain rfl | hab := eq_or_ne a b |
| 339 | · simp [skewAddHerm_apply, ht, hs, hermOfReal, skewOfReal, Complex.sq_norm, normSq_apply] |
| 340 | ring |
| 341 | · simp [skewAddHerm_apply, ht, hs, hermOfReal, skewOfReal, Complex.sq_norm, normSq_apply, hab, |
| 342 | hab.symm, field] |
| 343 | ring |
| 344 | |
| 345 | variable [Fintype n] |
| 346 | |
| 347 | /-- For a finite index type `n` and linear maps `T₁`, `T₂` on `n × n` real matrices that scale the |
| 348 | `(a, b)` entry by `2 / d` and `1 / d` respectively, with `d = 1` on the diagonal and `d = √2` off |
| 349 | it, if `T₁.prodMap T₂` has nonzero determinant then composing it with `skewAddHerm` preserves |
| 350 | Lebesgue measure. -/ |
| 351 | private lemma measurePreserving_prodMap_trans_skewAddHerm |
| 352 | {T₁ T₂ : Matrix n n ℝ →ₗ[ℝ] Matrix n n ℝ} |
| 353 | (hT₁ : ∀ (y : Matrix n n ℝ) (a b : n), T₁ y a b = 2 / (if a = b then 1 else √2) * y a b) |
| 354 | (hT₂ : ∀ (y : Matrix n n ℝ) (a b : n), T₂ y a b = 1 / (if a = b then 1 else √2) * y a b) |
| 355 | (h_ne : (T₁.prodMap T₂).det ≠ 0) : |
| 356 | MeasurePreserving (((T₁.prodMap T₂).equivOfDetNeZero h_ne).trans skewAddHerm) := by |
| 357 | refine HasGaussianIntegral.measurePreserving _ fun p ↦ ?_ |
| 358 | let Z : Matrix n n ℂ := skewAddHerm (T₁ p.1, T₂ p.2) |
| 359 | have h_sq (a b : n) : ‖Z a b‖ ^ 2 + ‖Z b a‖ ^ 2 = |
| 360 | p.1 a b ^ 2 + p.2 a b ^ 2 + (p.1 b a ^ 2 + p.2 b a ^ 2) := by |
| 361 | rw [norm_sq_skewAddHerm_of_scale (hT₁ p.1) (hT₂ p.2), |
| 362 | norm_sq_skewAddHerm_of_scale (hT₁ p.1) (hT₂ p.2)] |
| 363 | ring |
| 364 | -- Sum over all `a`, `b`: each entry is counted twice on both sides. |
| 365 | have h_sum : ∑ a : n, ∑ b : n, (‖Z a b‖ ^ 2 + ‖Z b a‖ ^ 2) = |
| 366 | ∑ a : n, ∑ b : n, (p.1 a b ^ 2 + p.2 a b ^ 2 + (p.1 b a ^ 2 + p.2 b a ^ 2)) := by |
| 367 | simp only [h_sq] |
| 368 | change ∑ a : n, ∑ b : n, ‖Z a b‖ ^ 2 = |
| 369 | ∑ a : n, ∑ b : n, p.1 a b ^ 2 + ∑ a : n, ∑ b : n, p.2 a b ^ 2 |
| 370 | simp only [Finset.sum_add_distrib, Finset.sum_comm (f := fun a b ↦ ‖Z b a‖ ^ 2), |
| 371 | Finset.sum_comm (f := fun a b ↦ p.1 b a ^ 2), |
| 372 | Finset.sum_comm (f := fun a b ↦ p.2 b a ^ 2)] at h_sum |
| 373 | linarith |
| 374 | |
| 375 | /-- The isomorphism `skewAddHerm`, `(t, s) ↦ S + T / 2`, onto the complex matrices of size `n` |
| 376 | has Jacobian `2 ^ (-n)`; here `S` is the skew-hermitian matrix with coordinates `s` and `T` the |
| 377 | hermitian one with coordinates `t`. -/ |
| 378 | theorem lintegral_eq_comp_skewAddHerm {K : Matrix n n ℂ → ℝ≥0∞} (hK : Measurable K) : |
| 379 | ∫⁻ Z : Matrix n n ℂ, K Z = |
| 380 | (2 ^ card n)⁻¹ * ∫⁻ p : Matrix n n ℝ × Matrix n n ℝ, K (skewAddHerm p) := by |
| 381 | -- After scaling the entries of `t` by `2 / d` and those of `s` by `1 / d`, with `d = 1` on the |
| 382 | -- diagonal and `d = √2` off it, the map is an isometry for the sums of squares of the entries. |
| 383 | let d (a b : n) : ℝ := if a = b then 1 else √2 |
| 384 | obtain ⟨T₁, hT₁, hT₁_det⟩ := exists_linearMap_scale_entries fun a b : n ↦ 2 / d a b |
| 385 | obtain ⟨T₂, hT₂, hT₂_det⟩ := exists_linearMap_scale_entries fun a b : n ↦ 1 / d a b |
| 386 | have h_det : (T₁.prodMap T₂).det = 2 ^ card n := by |
| 387 | have h_entry (a b : n) : 2 / d a b * (1 / d a b) = if a = b then 2 else 1 := by |
| 388 | by_cases hab : a = b <;> simp [d, hab, field] |
| 389 | simp only [LinearMap.det_prodMap, hT₁_det, hT₂_det, ← Finset.prod_mul_distrib, h_entry] |
| 390 | simp |
| 391 | have h_ne : (T₁.prodMap T₂).det ≠ 0 := h_det.trans_ne (by positivity) |
| 392 | have h_iso : MeasurePreserving (((T₁.prodMap T₂).equivOfDetNeZero h_ne).trans skewAddHerm) := |
| 393 | measurePreserving_prodMap_trans_skewAddHerm hT₁ hT₂ h_ne |
| 394 | have hK' : Measurable fun p : Matrix n n ℝ × Matrix n n ℝ ↦ K (skewAddHerm p) := |
| 395 | hK.comp skewAddHerm.toLinearMap.continuous_of_finiteDimensional.measurable |
| 396 | have h_subst : ∫⁻ Z : Matrix n n ℂ, K Z = ∫⁻ p, K (skewAddHerm (T₁.prodMap T₂ p)) := |
| 397 | (h_iso.lintegral_comp hK).symm |
| 398 | simp [h_subst, lintegral_eq_abs_det_mul_comp volume h_ne hK', h_det, ENNReal.ofReal_pow, |
| 399 | ← mul_assoc, ENNReal.inv_mul_cancel] |
| 400 | |
| 401 | /-- Lebesgue measure on the complex matrices `Z = S + T / 2` of size `n`, with `S = skewOfReal s` |
| 402 | skew-hermitian and `T = hermOfReal t` hermitian, is `2 ^ (-n) ds dt`. -/ |
| 403 | theorem lintegral_eq_skewOfReal_add_hermOfReal {K : Matrix n n ℂ → ℝ≥0∞} (hK : Measurable K) : |
| 404 | ∫⁻ Z : Matrix n n ℂ, K Z = |
| 405 | (2 ^ card n)⁻¹ * ∫⁻ t : Matrix n n ℝ, ∫⁻ s : Matrix n n ℝ, |
| 406 | K (skewOfReal s + (2⁻¹ : ℂ) • hermOfReal t) := by |
| 407 | rw [lintegral_eq_comp_skewAddHerm hK, volume_eq_prod, lintegral_prod] |
| 408 | · simp only [skewAddHerm_apply] |
| 409 | · exact (hK.comp skewAddHerm.toLinearMap.continuous_of_finiteDimensional.measurable).aemeasurable |
| 410 | |
| 411 | /-! ### Blocks -/ |
| 412 | |
| 413 | /-- A hermitian matrix of size `n₁ + n₂` is given by its two diagonal blocks, which are hermitian, |
| 414 | and by one block off the diagonal. In the real coordinates `t`, for which the matrix itself is |
| 415 | `hermOfReal t`, this change of variables preserves volume. -/ |
| 416 | theorem exists_measurePreserving_hermBlocks [Fintype n₁] [Fintype n₂] [DecidableEq n₁] |
| 417 | [DecidableEq n₂] (e : n₁ ⊕ n₂ ≃ n) : |
| 418 | ∃ φ : Matrix n n ℝ ≃ₜ Matrix n₁ n₁ ℝ × Matrix n₁ n₂ ℂ × Matrix n₂ n₂ ℝ, |
| 419 | MeasurePreserving φ ∧ |
| 420 | ∀ t : Matrix n n ℝ, φ t = (t.submatrix (e ∘ Sum.inl) (e ∘ Sum.inl), |
| 421 | (hermOfReal t).submatrix (e ∘ Sum.inl) (e ∘ Sum.inr), |
| 422 | t.submatrix (e ∘ Sum.inr) (e ∘ Sum.inr)) := by |
| 423 | -- The map is a linear isometry between Euclidean spaces of the same dimension. |
| 424 | let f : Matrix n n ℝ →ₗ[ℝ] Matrix n₁ n₁ ℝ × Matrix n₁ n₂ ℂ × Matrix n₂ n₂ ℝ := |
| 425 | { toFun t := (t.submatrix (e ∘ Sum.inl) (e ∘ Sum.inl), |
| 426 | (hermOfReal t).submatrix (e ∘ Sum.inl) (e ∘ Sum.inr), |
| 427 | t.submatrix (e ∘ Sum.inr) (e ∘ Sum.inr)) |
| 428 | map_add' := by simp [hermOfReal, submatrix_add] |
| 429 | map_smul' := by simp [hermOfReal, submatrix_smul, submatrix_neg, smul_comm I] } |
| 430 | have h_entry (t : Matrix n n ℝ) (a : n₁) (b : n₂) : |
| 431 | ‖hermOfReal t (e (.inl a)) (e (.inr b))‖ ^ 2 = |
| 432 | t (e (.inl a)) (e (.inr b)) ^ 2 + t (e (.inr b)) (e (.inl a)) ^ 2 := by |
| 433 | simp [hermOfReal, skewOfReal, div_pow, RCLike.norm_sq_eq_def] |
| 434 | ring |
| 435 | have h_norm (t : Matrix n n ℝ) : |
| 436 | ∑ a : n₁, ∑ b : n₁, t (e (.inl a)) (e (.inl b)) ^ 2 + |
| 437 | (∑ a : n₁, ∑ b : n₂, ‖hermOfReal t (e (.inl a)) (e (.inr b))‖ ^ 2 + |
| 438 | ∑ a : n₂, ∑ b : n₂, t (e (.inr a)) (e (.inr b)) ^ 2) = |
| 439 | ∑ a : n, ∑ b : n, t a b ^ 2 := by |
| 440 | simp only [h_entry, ← e.sum_comp, Fintype.sum_sum_type, Finset.sum_add_distrib] |
| 441 | rw [Finset.sum_comm (s := (Finset.univ : Finset n₂)) (t := (Finset.univ : Finset n₁))] |
| 442 | ring |
| 443 | have h_rank : Module.finrank ℝ (Matrix n n ℝ) = |
| 444 | Module.finrank ℝ (Matrix n₁ n₁ ℝ × Matrix n₁ n₂ ℂ × Matrix n₂ n₂ ℝ) := by |
| 445 | simp [Module.finrank_matrix, ← card_congr e] |
| 446 | ring |
| 447 | -- The instances for the triple product are found once those for its last two factors are known. |
| 448 | have : IsAddHaarMeasure (volume : Measure (Matrix n₁ n₂ ℂ × Matrix n₂ n₂ ℝ)) := |
| 449 | prod.instIsAddHaarMeasure _ _ |
| 450 | have : BorelSpace (Matrix n₁ n₂ ℂ × Matrix n₂ n₂ ℝ) := Prod.borelSpace |
| 451 | obtain ⟨φ, hφ, hφ_symm⟩ := HasGaussianIntegral.exists_measurePreserving_equiv f h_norm h_rank |
| 452 | exact ⟨φ.symm.toContinuousLinearEquiv.toHomeomorph, |
| 453 | hφ.symm φ.toContinuousLinearEquiv.toHomeomorph.toMeasurableEquiv, congrFun hφ_symm⟩ |
| 454 | |
| 455 | end Hermitian |
| 456 | |
| 457 | /-- A hermitian matrix `hermOfReal t` of size `n₁ + 1`, with the extra index placed by `e`, is given |
| 458 | by a hermitian block of size `n₁`, by the rest of the column at the extra index and by the real |
| 459 | diagonal entry there. In the real coordinates `t` this change of variables preserves volume. -/ |
| 460 | theorem exists_measurePreserving_hermCorner [Fintype n] [Fintype n₁] [DecidableEq n] |
| 461 | [DecidableEq n₁] (e : n₁ ⊕ Unit ≃ n) : |
| 462 | ∃ φ : Matrix n n ℝ ≃ₜ Matrix n₁ n₁ ℝ × (n₁ → ℂ) × ℝ, |
| 463 | MeasurePreserving φ ∧ |
| 464 | ∀ t : Matrix n n ℝ, φ t = (t.submatrix (e ∘ Sum.inl) (e ∘ Sum.inl), |
| 465 | fun a : n₁ ↦ hermOfReal t (e (.inl a)) (e (.inr ())), t (e (.inr ())) (e (.inr ()))) := by |
| 466 | obtain ⟨φ, φ_vol, φ_apply⟩ := exists_measurePreserving_hermBlocks e |
| 467 | refine ⟨φ.trans ((Homeomorph.refl _).prodCongr (toCorner n₁).symm), ((MeasurePreserving.id _).prod |
| 468 | (measurePreserving_toCorner.symm (toCorner n₁).toMeasurableEquiv)).comp φ_vol, fun t ↦ ?_⟩ |
| 469 | simp [φ_apply]; rfl |
| 470 | |
| 471 | end New |
| 472 | |
| 473 | end |