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.Frobenius |
| 4 | import TauCeti.Analysis.Normed.Algebra.MatrixExponential |
| 5 | public import Mathlib.Analysis.LocallyConvex.AbsConvexOpen |
| 6 | import Mathlib.Analysis.CStarAlgebra.Module.Constructions |
| 7 | import Mathlib.Analysis.Matrix.Order |
| 8 | import Mathlib.LinearAlgebra.Matrix.FiniteDimensional |
| 9 | import Mathlib.RingTheory.PiTensorProduct |
| 10 | import Mathlib.RingTheory.SimpleRing.Principal |
| 11 | public import Lib.DiscreteSeries.FlenstedJensen.Defs |
| 12 | public import Lib.General.Analysis.GaussianIntegral |
| 13 | |
| 14 | /-! |
| 15 | # Matrices near the identity: Jacobi's formula and norm estimates |
| 16 | |
| 17 | This file collects known facts on complex matrices near the identity. |
| 18 | It proves Jacobi's formula for the derivative of the determinant at the identity. |
| 19 | Estimates in the Hilbert–Schmidt norm, which is the norm of all matrices in this file, control the |
| 20 | inverse and the logarithm of `1 + X`. |
| 21 | A matrix at distance less than `1` from the identity is accretive. |
| 22 | |
| 23 | ## Main definitions and results |
| 24 | |
| 25 | * `New.hasDerivAt_det_of_eq_one`: along a differentiable curve of complex matrices through the |
| 26 | identity, the derivative of the determinant there is the trace of the velocity. |
| 27 | * `New.DiscreteSeries.logOneAdd` and `exp_logOneAdd`: the logarithm of `1 + X` for `‖X‖ ≤ 1 / 2`. |
| 28 | |
| 29 | Notions from other files: |
| 30 | * `entryMask r X` keeps the entries `(i, j)` of `X` with `r i j` and replaces the others by `0`. |
| 31 | * A matrix `A` is accretive (`A.IsAccretive`) if `A + Aᴴ` is positive definite. |
| 32 | -/ |
| 33 | |
| 34 | @[expose] public section |
| 35 | |
| 36 | noncomputable section |
| 37 | |
| 38 | /-! ## Jacobi's formula for the derivative of the determinant -/ |
| 39 | |
| 40 | /-- Jacobi's formula at the identity: if `γ s = 1` and `γ` has derivative `Y` at `s`, then |
| 41 | `det ∘ γ` has derivative `Y.trace` at `s`. -/ |
| 42 | lemma New.hasDerivAt_det_of_eq_one {n : Type*} [Fintype n] [DecidableEq n] {γ : ℝ → Matrix n n ℂ} |
| 43 | {Y : Matrix n n ℂ} {s : ℝ} (hγ_one : γ s = 1) (hγ_deriv : HasDerivAt γ Y s) : |
| 44 | HasDerivAt (fun t : ℝ ↦ (γ t).det) Y.trace s := by |
| 45 | -- The determinant is a continuous multilinear function `D` of the rows. |
| 46 | let D : ContinuousMultilinearMap ℝ (fun _ : n ↦ n → ℂ) ℂ := |
| 47 | ⟨(Matrix.detRowAlternating (n := n) (R := ℂ)).toMultilinearMap.restrictScalars ℝ, |
| 48 | continuous_id.matrix_det⟩ |
| 49 | refine ((D.hasFDerivAt _).comp_hasDerivAt s hγ_deriv).congr_deriv ?_ |
| 50 | -- Its derivative at `1` replaces one row of `1` at a time by that row of `Y`; this gives `Y i i`. |
| 51 | calc D.linearDeriv (γ s) Y = ∑ i, ((γ s).updateRow i (Y i)).det := sum_apply .. |
| 52 | _ = Y.trace := by simp [hγ_one, ← Matrix.cramer_transpose_apply, Matrix.trace] |
| 53 | |
| 54 | /-! |
| 55 | ## Matrices near the identity in the Hilbert–Schmidt norm |
| 56 | |
| 57 | The main results are the bound `‖tr (X Y)‖ ≤ ‖X‖ ‖Y‖`, invariance under unitary left factors, the |
| 58 | inverse of `1 + X` for small `X`, the formula `det (exp M) = exp (tr M)`, and the logarithm of |
| 59 | `1 + X`, written as the integral of `(1 + s X)⁻¹ X` over `[0, 1]`. A matrix at distance less than |
| 60 | `1` from the identity is accretive. |
| 61 | -/ |
| 62 | |
| 63 | section FrobeniusNormTools |
| 64 | |
| 65 | open Matrix Finset Norms.Frobenius Complex intervalIntegral ComplexConjugate MatrixOrder WithLp |
| 66 | |
| 67 | namespace New.DiscreteSeries |
| 68 | |
| 69 | variable {n : Type*} [Fintype n] [DecidableEq n] {P X Y : Matrix n n ℂ} {ρ : ℝ} |
| 70 | |
| 71 | /-- An integral weight as a diagonal matrix. -/ |
| 72 | @[simp] abbrev intDiagonal (w : n → ℤ) : Matrix n n ℂ := diagonal fun i ↦ (w i : ℂ) |
| 73 | |
| 74 | /-- The Cauchy–Schwarz inequality for the trace form: `‖tr (X * Y)‖` is at most the product of the |
| 75 | Hilbert–Schmidt norms of `X` and `Y`. -/ |
| 76 | lemma norm_trace_mul_le_norm_mul_norm (X Y : Matrix n n ℂ) : ‖(X * Y).trace‖ ≤ ‖X‖ * ‖Y‖ := by |
| 77 | -- The trace is the inner product of `Xᴴ` and `Y` as vectors of entries. |
| 78 | let vec (M : Matrix n n ℂ) : PiLp 2 fun _ : n ↦ EuclideanSpace ℂ n := |
| 79 | WithLp.toLp 2 fun i ↦ WithLp.toLp 2 (M i) |
| 80 | have h_vec (M : Matrix n n ℂ) : ‖vec M‖ = ‖M‖ := rfl |
| 81 | calc ‖(X * Y).trace‖ = ‖inner ℂ (vec (star X)) (vec Y)‖ := by |
| 82 | rw [trace_mul_comm] |
| 83 | simp [vec, inner, trace, Matrix.mul_apply] |
| 84 | _ ≤ ‖X‖ * ‖Y‖ := by grw [norm_inner_le_norm, h_vec, h_vec, norm_star] |
| 85 | |
| 86 | /-- If `‖X‖ ≤ ρ` and `‖Y‖ ≤ σ`, then `‖(X * Y).trace‖ ≤ ρ * σ`. -/ |
| 87 | lemma norm_trace_mul_le {X Y : Matrix n n ℂ} {ρ σ : ℝ} (hX : ‖X‖ ≤ ρ) (hY : ‖Y‖ ≤ σ) : |
| 88 | ‖(X * Y).trace‖ ≤ ρ * σ := by |
| 89 | grw [norm_trace_mul_le_norm_mul_norm, hX, hY] |
| 90 | exact (norm_nonneg X).trans hX |
| 91 | |
| 92 | /-- The trace of `Xᴴ * X` equals the squared Hilbert–Schmidt norm of `X`. -/ |
| 93 | lemma trace_star_mul_self_eq_norm_sq : (Xᴴ * X).trace = ((‖X‖ ^ 2 : ℝ) : ℂ) := by |
| 94 | rw [frobenius_norm_sq_eq_sum_norm_sq, Finset.sum_comm] |
| 95 | simp [trace, Matrix.mul_apply, conj_mul'] |
| 96 | |
| 97 | /-- Left multiplication by a unitary matrix preserves the Hilbert–Schmidt norm. -/ |
| 98 | lemma frobenius_norm_mul_of_unitary (hX : Xᴴ * X = 1) (Y : Matrix n n ℂ) : ‖X * Y‖ = ‖Y‖ := by |
| 99 | have h_gram : (X * Y)ᴴ * (X * Y) = Yᴴ * Y := by simp [mul_assoc, ← mul_assoc Xᴴ, hX] |
| 100 | rw [← sq_eq_sq₀ (norm_nonneg _) (norm_nonneg _), ← ofReal_inj, ← trace_star_mul_self_eq_norm_sq, |
| 101 | h_gram, trace_star_mul_self_eq_norm_sq] |
| 102 | |
| 103 | /-- If `‖X‖ ≤ σ` and `ρ ∈ [0, 1]`, then `‖ρ • X‖ ≤ σ`. -/ |
| 104 | lemma norm_smul_le_of_le_one {X : Matrix n n ℂ} {σ : ℝ} (ρ : ℝ) (hX : ‖X‖ ≤ σ) |
| 105 | (hρ : ρ ∈ Set.Icc (0 : ℝ) 1) : ‖ρ • X‖ ≤ σ := by |
| 106 | grw [norm_smul_of_nonneg hρ.1, hρ.2, one_mul, hX] |
| 107 | |
| 108 | /-- If `‖X‖ < 1`, then the determinant of `1 + X` is nonzero. -/ |
| 109 | lemma det_one_add_ne_zero (hX : ‖X‖ < 1) : (1 + X).det ≠ 0 := by |
| 110 | have h_unit : IsUnit (1 - -X) := isUnit_one_sub_of_norm_lt_one (by rwa [norm_neg]) |
| 111 | simpa [isUnit_iff_isUnit_det] using h_unit |
| 112 | |
| 113 | lemma one_add_mul_inv_one_add (hX : ‖X‖ < 1) : (1 + X) * (1 + X)⁻¹ = 1 := |
| 114 | mul_nonsing_inv _ (det_one_add_ne_zero hX).isUnit |
| 115 | |
| 116 | lemma inv_one_add_mul_one_add (hX : ‖X‖ < 1) : (1 + X)⁻¹ * (1 + X) = 1 := |
| 117 | nonsing_inv_mul _ (det_one_add_ne_zero hX).isUnit |
| 118 | |
| 119 | /-- If `X` has Hilbert–Schmidt norm at most `1 / 2`, then `(1 + X)⁻¹` is within `2 * ‖X‖` of `1`. -/ |
| 120 | lemma norm_inv_one_add_sub_one_le (hX : ‖X‖ ≤ 2⁻¹) : ‖(1 + X)⁻¹ - 1‖ ≤ 2 * ‖X‖ := by |
| 121 | set V : Matrix n n ℂ := (1 + X)⁻¹ - 1 |
| 122 | have h_inv : (V + 1) * (1 + X) = 1 := by |
| 123 | simp [V, inv_one_add_mul_one_add (hX.trans_lt two_inv_lt_one)] |
| 124 | have h_eq : V = -(X + V * X) := by linear_combination (norm := noncomm_ring) h_inv |
| 125 | have h_bound : ‖X + V * X‖ ≤ ‖X‖ + ‖V‖ * 2⁻¹ := |
| 126 | norm_add_le_of_le le_rfl (norm_mul_le_of_le le_rfl hX) |
| 127 | rw [← norm_neg, ← h_eq] at h_bound |
| 128 | linarith |
| 129 | |
| 130 | /-- The logarithm of `1 + X`, as the integral of `(1 + s • X)⁻¹ * X` over `[0, 1]`. -/ |
| 131 | def logOneAdd (X : Matrix n n ℂ) : Matrix n n ℂ := ∫ s : ℝ in 0..1, (1 + s • X)⁻¹ * X |
| 132 | |
| 133 | /-- For `‖X‖ ≤ 1 / 2` and `s ∈ [0, 1]`, `(1 + s • X).det` is nonzero. -/ |
| 134 | lemma det_one_add_smul_ne_zero (hX : ‖X‖ ≤ 2⁻¹) {s : ℝ} (hs : s ∈ Set.Icc (0 : ℝ) 1) : |
| 135 | (1 + s • X).det ≠ 0 := |
| 136 | det_one_add_ne_zero ((norm_smul_le_of_le_one s hX hs).trans_lt two_inv_lt_one) |
| 137 | |
| 138 | /-- For `‖X‖ ≤ 1 / 2` the integrand of `logOneAdd X` is continuous at every point of `[0, 1]`. -/ |
| 139 | lemma continuousAt_inv_one_add_smul_mul (hX : ‖X‖ ≤ 2⁻¹) {s : ℝ} (hs : s ∈ Set.Icc (0 : ℝ) 1) : |
| 140 | ContinuousAt (fun t : ℝ ↦ (1 + t • X)⁻¹ * X) s := by |
| 141 | simp only [Matrix.inv_def, Ring.inverse_eq_inv'] |
| 142 | fun_prop (disch := exact det_one_add_smul_ne_zero hX hs) |
| 143 | |
| 144 | /-- For `‖X‖ ≤ 1 / 2` the integrand of `logOneAdd X` is continuous on `[0, 1]`. -/ |
| 145 | lemma continuousOn_inv_one_add_smul_mul (hX : ‖X‖ ≤ 2⁻¹) : |
| 146 | ContinuousOn (fun s : ℝ ↦ (1 + s • X)⁻¹ * X) (Set.uIcc 0 1) := |
| 147 | fun _ hs ↦ (continuousAt_inv_one_add_smul_mul hX (by simpa using hs)).continuousWithinAt |
| 148 | |
| 149 | /-- For `‖X‖ ≤ 1 / 2` and `0 ≤ s ≤ 1` the integral of `(1 + u • X)⁻¹ * X` over `[0, t]` has |
| 150 | derivative `(1 + s • X)⁻¹ * X` at `t = s`. -/ |
| 151 | lemma hasDerivAt_integral_inv_one_add_smul_mul (hX : ‖X‖ ≤ 2⁻¹) {s : ℝ} |
| 152 | (hs : s ∈ Set.Icc (0 : ℝ) 1) : |
| 153 | HasDerivAt (fun t : ℝ ↦ ∫ u : ℝ in 0..t, (1 + u • X)⁻¹ * X) ((1 + s • X)⁻¹ * X) s := by |
| 154 | have h_meas : MeasureTheory.AEStronglyMeasurable (fun u : ℝ ↦ (1 + u • X)⁻¹ * X) := by |
| 155 | simp only [Matrix.inv_def, Ring.inverse_eq_inv'] |
| 156 | fun_prop |
| 157 | exact integral_hasDerivAt_right ((continuousOn_inv_one_add_smul_mul hX).mono |
| 158 | (Set.uIcc_subset_uIcc_left (by simpa using hs))).intervalIntegrable |
| 159 | ⟨Set.univ, Filter.univ_mem, h_meas.restrict⟩ (continuousAt_inv_one_add_smul_mul hX hs) |
| 160 | |
| 161 | lemma commute_inv_one_add_smul (hY : Commute Y X) (s : ℝ) : Commute Y (1 + s • X)⁻¹ := by |
| 162 | simpa using Matrix.Commute.zpow_right ((Commute.one_right Y).add_right (hY.smul_right s)) (-1) |
| 163 | |
| 164 | /-- A matrix that commutes with all values of a continuous function `G` commutes with its |
| 165 | integral. -/ |
| 166 | lemma commute_intervalIntegral {G : ℝ → Matrix n n ℂ} {a b : ℝ} |
| 167 | (hG : ContinuousOn G (Set.uIcc a b)) (hY : ∀ s : ℝ, Commute Y (G s)) : |
| 168 | Commute Y (∫ s in a..b, G s) := |
| 169 | calc Y * ∫ s in a..b, G s = ∫ s in a..b, Y * G s := |
| 170 | ((ContinuousLinearMap.mul ℝ _ Y).intervalIntegral_comp_comm hG.intervalIntegrable).symm |
| 171 | _ = ∫ s in a..b, G s * Y := by simp only [(hY _).eq] |
| 172 | _ = (∫ s in a..b, G s) * Y := |
| 173 | ((ContinuousLinearMap.mul ℝ _).flip Y).intervalIntegral_comp_comm hG.intervalIntegrable |
| 174 | |
| 175 | /-- For `‖X‖ ≤ 1 / 2` the function `s ↦ tr (D * (1 + s • X)⁻¹ * X)` is integrable on `[0, 1]`. -/ |
| 176 | lemma intervalIntegrable_trace_mul_inv_one_add_smul_mul (hX : ‖X‖ ≤ 2⁻¹) (D : Matrix n n ℂ) : |
| 177 | IntervalIntegrable (fun s : ℝ ↦ (D * ((1 + s • X)⁻¹ * X)).trace) MeasureTheory.volume 0 1 := |
| 178 | (continuous_id.matrix_trace.comp_continuousOn' |
| 179 | (continuousOn_const.mul (continuousOn_inv_one_add_smul_mul hX))).intervalIntegrable |
| 180 | |
| 181 | /-- For `‖X‖ ≤ 1 / 2` the integral of `s ↦ tr (D * (1 + s • X)⁻¹ * X)` over `[0, 1]` is |
| 182 | `tr (D * logOneAdd X)`, where `logOneAdd X` is the integral of `(1 + s • X)⁻¹ * X`. -/ |
| 183 | lemma integral_trace_mul_inv_one_add_smul_mul (hX : ‖X‖ ≤ 2⁻¹) (D : Matrix n n ℂ) : |
| 184 | ∫ s : ℝ in 0..1, (D * ((1 + s • X)⁻¹ * X)).trace = (D * logOneAdd X).trace := |
| 185 | -- The continuous linear form `M ↦ tr (D * M)` commutes with the integral. |
| 186 | (traceLinearMap n ℂ ℂ ∘ₗ .mulLeft ℂ D).toContinuousLinearMap.intervalIntegral_comp_comm |
| 187 | (continuousOn_inv_one_add_smul_mul hX).intervalIntegrable |
| 188 | |
| 189 | /-- If `L` has derivative `L'` at `s` and `L s` commutes with `L t` for all `t ∈ S`, then |
| 190 | `exp (-L t)` has derivative `exp (-L s) * -L'` at `s` within `S`. -/ |
| 191 | lemma hasDerivWithinAt_exp_neg_of_commute {L : ℝ → Matrix n n ℂ} {L' : Matrix n n ℂ} {S : Set ℝ} |
| 192 | {s : ℝ} (hL : HasDerivAt L L' s) (h_comm : ∀ t ∈ S, Commute (L s) (L t)) : |
| 193 | HasDerivWithinAt (fun t : ℝ ↦ NormedSpace.exp (-L t)) (NormedSpace.exp (-L s) * -L') S s := by |
| 194 | -- On `S` we have `exp (-L t) = exp (-L s) * exp (L s - L t)`; differentiate `exp` at `0`. |
| 195 | have h_zero : HasFDerivAt (NormedSpace.exp : Matrix n n ℂ → Matrix n n ℂ) |
| 196 | (1 : Matrix n n ℂ →L[ℝ] Matrix n n ℂ) (L s - L s) := by |
| 197 | -- `using!`: the two instances of the topology on matrices agree only up to defeq. |
| 198 | simpa using! hasFDerivAt_exp_zero (𝕂 := ℝ) (𝔸 := Matrix n n ℂ) |
| 199 | have h_near : HasDerivAt (fun t : ℝ ↦ NormedSpace.exp (-L s) * NormedSpace.exp (L s - L t)) |
| 200 | (NormedSpace.exp (-L s) * -L') s := (h_zero.comp_hasDerivAt s (hL.const_sub _)).const_mul _ |
| 201 | refine h_near.hasDerivWithinAt.congr (fun t ht ↦ ?_) (by simp) |
| 202 | rw [← Matrix.exp_add_of_commute _ _ ((Commute.refl _).sub_right (h_comm t ht)).neg_left, |
| 203 | neg_add_eq_sub, sub_sub_cancel_left] |
| 204 | |
| 205 | /-- For `‖X‖ ≤ 1 / 2` and `0 ≤ s ≤ 1` the matrix `(1 + s • X)⁻¹ * X` times `1 + s • X` is `X`. -/ |
| 206 | lemma inv_one_add_smul_mul_mul_one_add_smul (hX : ‖X‖ ≤ 2⁻¹) {s : ℝ} |
| 207 | (hs : s ∈ Set.Icc (0 : ℝ) 1) : (1 + s • X)⁻¹ * X * (1 + s • X) = X := by |
| 208 | rw [← (commute_inv_one_add_smul (.refl X) s).eq, mul_assoc, |
| 209 | nonsing_inv_mul _ (det_one_add_smul_ne_zero hX hs).isUnit, mul_one] |
| 210 | |
| 211 | /-- If the Hilbert–Schmidt norm of `X` is at most `1 / 2`, then `logOneAdd X`, the integral of |
| 212 | `(1 + s • X)⁻¹ * X` over `[0, 1]`, is a logarithm of `1 + X`. -/ |
| 213 | lemma exp_logOneAdd (hX : ‖X‖ ≤ 2⁻¹) : NormedSpace.exp (logOneAdd X) = 1 + X := by |
| 214 | -- Put `G s = (1 + s X)⁻¹ X` and `L t = ∫ G over [0, t]`. All these matrices commute, so |
| 215 | -- `exp (-L t) * (1 + t X)` has derivative zero on `[0, 1]`. |
| 216 | let G (s : ℝ) : Matrix n n ℂ := (1 + s • X)⁻¹ * X |
| 217 | let L (t : ℝ) : Matrix n n ℂ := ∫ s in 0..t, G s |
| 218 | have hL_comm {Y : Matrix n n ℂ} (hY : Commute Y X) {t : ℝ} (ht : t ∈ Set.Icc (0 : ℝ) 1) : |
| 219 | Commute Y (L t) := |
| 220 | commute_intervalIntegral ((continuousOn_inv_one_add_smul_mul hX).mono |
| 221 | (Set.uIcc_subset_uIcc_left (by simpa using ht))) |
| 222 | fun s ↦ (commute_inv_one_add_smul hY s).mul_right hY |
| 223 | have hLL {s t : ℝ} (hs : s ∈ Set.Icc (0 : ℝ) 1) (ht : t ∈ Set.Icc (0 : ℝ) 1) : |
| 224 | Commute (L s) (L t) := hL_comm (hL_comm (.refl X) hs).symm ht |
| 225 | have h_exp (s : ℝ) (hs : s ∈ Set.Icc (0 : ℝ) 1) : HasDerivWithinAt |
| 226 | (fun t ↦ NormedSpace.exp (-L t)) (NormedSpace.exp (-L s) * -G s) (Set.Icc 0 1) s := |
| 227 | hasDerivWithinAt_exp_neg_of_commute (hasDerivAt_integral_inv_one_add_smul_mul hX hs) |
| 228 | fun _ ht ↦ hLL hs ht |
| 229 | have h_deriv (s : ℝ) (hs : s ∈ Set.Icc (0 : ℝ) 1) : HasDerivWithinAt |
| 230 | (fun t ↦ NormedSpace.exp (-L t) * (1 + t • X)) 0 (Set.Icc 0 1) s := by |
| 231 | have h_line : HasDerivAt (fun t : ℝ ↦ 1 + t • X) X s := by |
| 232 | -- `using!`: the two instances of the topology on matrices agree only up to defeq. |
| 233 | simpa only [one_smul] using! ((hasDerivAt_id' s).smul_const X).const_add (1 : Matrix n n ℂ) |
| 234 | have h_cancel : G s * (1 + s • X) = X := inv_one_add_smul_mul_mul_one_add_smul hX hs |
| 235 | refine ((h_exp s hs).fun_mul h_line.hasDerivWithinAt).congr_deriv ?_ |
| 236 | simp [mul_assoc, h_cancel] |
| 237 | have h_const : NormedSpace.exp (-L 1) * (1 + (1 : ℝ) • X) = |
| 238 | NormedSpace.exp (-L 0) * (1 + (0 : ℝ) • X) := |
| 239 | eq_of_norm_sub_le_zero (norm_image_sub_le_of_norm_deriv_le_segment_01' h_deriv (by simp)) |
| 240 | have h_exp_inv : NormedSpace.exp (logOneAdd X) * NormedSpace.exp (-logOneAdd X) = 1 := by |
| 241 | simp [← Matrix.exp_add_of_commute _ _ (Commute.refl (logOneAdd X)).neg_right] |
| 242 | exact left_inv_eq_right_inv h_exp_inv (by simpa [L, G, logOneAdd] using h_const) |
| 243 | |
| 244 | lemma det_one_add_eq_exp_trace_logOneAdd (hX : ‖X‖ ≤ 2⁻¹) : |
| 245 | (1 + X).det = cexp (logOneAdd X).trace := by |
| 246 | rw [← exp_logOneAdd hX, Matrix.det_exp, ← Complex.exp_eq_exp_ℂ] |
| 247 | |
| 248 | /-- If `X` has Hilbert–Schmidt norm at most `1 / 2`, then `logOneAdd X`, the integral of |
| 249 | `(1 + s • X)⁻¹ * X` over `[0, 1]`, has norm at most `2 * ‖X‖`. -/ |
| 250 | lemma norm_logOneAdd_le (hX : ‖X‖ ≤ 2⁻¹) : ‖logOneAdd X‖ ≤ 2 * ‖X‖ := by |
| 251 | have h_integrand (s : ℝ) (hs : s ∈ Set.uIoc (0 : ℝ) 1) : ‖(1 + s • X)⁻¹ * X‖ ≤ 2 * ‖X‖ := by |
| 252 | have h_smul : ‖s • X‖ ≤ 2⁻¹ := norm_smul_le_of_le_one s hX (by grind) |
| 253 | have h_near : ‖(1 + s • X)⁻¹ - 1‖ ≤ 1 := by linarith [norm_inv_one_add_sub_one_le h_smul] |
| 254 | calc ‖(1 + s • X)⁻¹ * X‖ = ‖X + ((1 + s • X)⁻¹ - 1) * X‖ := by simp [sub_one_mul] |
| 255 | _ ≤ 2 * ‖X‖ := by grw [norm_add_le, norm_mul_le, h_near, one_mul, two_mul] |
| 256 | simpa [logOneAdd] using norm_integral_le_of_norm_le_const h_integrand |
| 257 | |
| 258 | /-- If `P` is an orthogonal projection and `X` has Hilbert–Schmidt norm at most `ρ`, then so has |
| 259 | `P * X`. -/ |
| 260 | lemma norm_proj_mul_le (hP : IsStarProjection P) (hX : ‖X‖ ≤ ρ) : ‖P * X‖ ≤ ρ := by |
| 261 | -- `2 * P - 1` is unitary, and `2 • (P * X) = (2 * P - 1) * X + X`. |
| 262 | have h_two : (2 : ℝ) • (P * X) = (2 * P - 1) * X + X := by |
| 263 | rw [sub_mul, one_mul, sub_add_cancel, two_mul, add_mul, two_smul] |
| 264 | have h_sum : 2 * ‖P * X‖ ≤ ‖X‖ + ‖X‖ := by |
| 265 | grw [← norm_smul_of_nonneg zero_le_two, h_two, norm_add_le, |
| 266 | frobenius_norm_mul_of_unitary hP.two_mul_sub_one_mem_unitary.1] |
| 267 | linarith |
| 268 | |
| 269 | /-- Conjugating by a sign matrix preserves the Frobenius norm. -/ |
| 270 | lemma norm_signMatrix_conj (ε : n → ℤˣ) (A : Matrix n n ℂ) : |
| 271 | ‖signMatrix ε * A * signMatrix ε‖ = ‖A‖ := by |
| 272 | have hs_unit : signMatrix ε ∈ Matrix.unitaryGroup n ℂ := |
| 273 | mem_unitaryGroup_iff'.2 (by |
| 274 | rw [star_eq_conjTranspose, conjTranspose_signMatrix, signMatrix_mul_self]) |
| 275 | have hs_sq := Matrix.frobenius_norm_sq_conj_unitary (signMatrix ε) A hs_unit |
| 276 | rw [conjTranspose_signMatrix] at hs_sq |
| 277 | exact (sq_eq_sq₀ (norm_nonneg _) (norm_nonneg _)).1 hs_sq |
| 278 | |
| 279 | /-- The diagonal matrix whose entry at `i` is `1` if `p i` holds and `0` otherwise. It is the |
| 280 | coordinate projection onto the indices satisfying `p`. -/ |
| 281 | def coordProj (p : n → Prop) [DecidablePred p] : Matrix n n ℂ := |
| 282 | diagonal fun i : n ↦ if p i then 1 else 0 |
| 283 | |
| 284 | lemma isStarProjection_coordProj (p : n → Prop) [DecidablePred p] : |
| 285 | IsStarProjection (coordProj p) := by |
| 286 | simp [isStarProjection_iff', coordProj, star_eq_conjTranspose, Pi.star_def, ← ite_and, apply_ite] |
| 287 | |
| 288 | /-- Replacing some entries of a matrix by `0` does not increase its Hilbert–Schmidt norm. -/ |
| 289 | lemma norm_entryMask_le {n : Type} [Fintype n] {X : Matrix n n ℂ} {r : n → n → Prop} |
| 290 | [DecidableRel r] : ‖entryMask r X‖ ≤ ‖X‖ := by |
| 291 | simp only [frobenius_norm_def] |
| 292 | gcongr with i _ j _ |
| 293 | by_cases hij : r i j <;> simp [hij] |
| 294 | |
| 295 | /-- If `X` has Hilbert–Schmidt distance less than `1` from the identity, then the real spectrum of |
| 296 | `X + star X` is positive. -/ |
| 297 | lemma pos_of_mem_spectrum_add_star (h_near : ‖X - 1‖ < 1) {x : ℝ} |
| 298 | (hx : x ∈ spectrum ℝ (X + star X)) : 0 < x := by |
| 299 | -- Subtract the scalar matrix `2` from `X + star X` and bound its spectrum by its norm. |
| 300 | have hshift : x - 2 ∈ spectrum ℝ ((X - 1) + star (X - 1)) := by |
| 301 | have h := (spectrum.add_mem_iff (r := x - 2) (s := 2) (a := X + star X)).mp |
| 302 | (by simpa using hx) |
| 303 | convert h using 2 |
| 304 | simp only [← one_add_one_eq_two, map_add, map_one, star_sub, star_one] |
| 305 | abel |
| 306 | have hnorm := spectrum.norm_le_norm_of_mem hshift |
| 307 | have hlt : ‖(X - 1) + star (X - 1)‖ < 2 := |
| 308 | (norm_add_le ..).trans_lt (by rw [norm_star]; linarith) |
| 309 | rw [Real.norm_eq_abs] at hnorm |
| 310 | linarith [neg_le_abs (x - 2)] |
| 311 | |
| 312 | /-- A matrix `X` at Hilbert–Schmidt distance less than `1` from the identity is accretive, that is, |
| 313 | `X + Xᴴ` is positive definite. -/ |
| 314 | lemma isAccretive_of_norm_sub_one_lt (h_near : ‖X - 1‖ < 1) : X.IsAccretive := by |
| 315 | rw [Matrix.IsAccretive, ← star_eq_conjTranspose] |
| 316 | exact ((StarOrderedRing.isStrictlyPositive_iff_spectrum_pos _ (.add_star_self X)).2 |
| 317 | fun _ hx ↦ pos_of_mem_spectrum_add_star h_near hx).posDef |
| 318 | |
| 319 | end New.DiscreteSeries |
| 320 | |
| 321 | end FrobeniusNormTools |
| 322 | |
| 323 | end |