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 | import Mathlib.Algebra.Order.Star.Rat |
| 4 | import Mathlib.Algebra.Order.Star.Real |
| 5 | public import New.Derivatives.Vacuum.IntegralVacuum |
| 6 | public import New.Reduction.Zeros.PrimeError |
| 7 | public import Lib.Shimura.Uniformisation.HolomorphicFamilies |
| 8 | |
| 9 | /-! |
| 10 | # Admissible data |
| 11 | |
| 12 | Fix parameters `P : New.Parameters`. The data `D : New.Data P` are the objects that grow with the |
| 13 | length `x` of the prime sum: scales, ranks, the field `E`, the `a`-places and `b`-places, weights, |
| 14 | three primes, and numbers read off from them. |
| 15 | |
| 16 | Letters used in comments, and the names in the code: |
| 17 | |
| 18 | | letter | code | |
| 19 | |---|---| |
| 20 | | `p₀`, `p₁` | `D.levelPrime 0`, `D.levelPrime 1` | |
| 21 | | `π_M`, `π_N` | `star D.piMBar`, `D.piN` | |
| 22 | | `κ(τ)`, `κ_j(τ)` | `D.weight τ`, `D.liftWeight j τ` | |
| 23 | | `s`, `Δ` | `D.towerExp`, `D.gap` | |
| 24 | | `s_∞`, `s_fin` | `D.jetSize`, `D.primeSum` | |
| 25 | |
| 26 | ## Main definitions and results |
| 27 | |
| 28 | * `New.Data`: the data; `New.Parameters.IsSparse` is the condition on the `b`-places. The scales and |
| 29 | ranks are asked to lie in ranges only. The data with the exact values are |
| 30 | `New.Parameters.IsAdmissibleData`; at a large scale they give data |
| 31 | (`New.Parameters.IsAdmissibleData.exists_hasFields`). Sizes are compared in the files `Magnitudes` |
| 32 | and `Sizes` of this folder. |
| 33 | * `New.Parameters.logLevelMin_mem_Icc`: the lower end `N₋` of the range for the level has logarithm |
| 34 | between `m log b` and `24 m log b`. |
| 35 | |
| 36 | Notions from other files: |
| 37 | * `New.Parameters`: a multiple `q₀` of `18480 = 16 · 3 · 5 · 7 · 11` and a prime `d` with |
| 38 | `d ≡ q₀/2 - 1 mod q₀`; they determine the field `P.K = ℚ(√-d)`. |
| 39 | * `New.towerDeg s`: the number `3 l₀ 2 ^ s`, where `l₀ = New.l₀ s` is, for `s ≥ 1`, the least power |
| 40 | of `3` above `27 s`. The modulus `P.q₁ s` is `q₀ * towerDeg s`. |
| 41 | * `P.E s`, `P.Φ s`: the field `E = K(ζ)`, with `ζ` a primitive `q₁`-th root of unity, and its |
| 42 | infinite places, which form a group isomorphic to `(ℤ/q₁)ˣ`. |
| 43 | * `P.q₂ s`: the number `(q₀ d) ^ (s + 6)`. |
| 44 | -/ |
| 45 | |
| 46 | @[expose] public section |
| 47 | |
| 48 | noncomputable section |
| 49 | |
| 50 | open NumberField Set |
| 51 | open Real (exp log) |
| 52 | |
| 53 | /-- A bound for the constants that depend on `q₀` and `d` only. It is the sum of the constant |
| 54 | `P.vacuumBoundConst` in the bound for the conjugates of the integral vacuum, `2 d + 6`, `q₀`, the |
| 55 | absolute value of `chowlaSelbergConst d = γ - Re L'/L(1, χ_K)`, and `∑_w |log ‖Φ'(w)‖|`, where `w` |
| 56 | runs over the complex roots of the cyclotomic polynomial `Φ` of order `q₀`. -/ |
| 57 | def New.Parameters.constantBound (P : Parameters) : ℝ := |
| 58 | P.vacuumBoundConst + (2 * P.d + 6) + (P.q₀ + |chowlaSelbergConst P.d| + |
| 59 | ∑ w ∈ primitiveRoots P.q₀ ℂ, |log ‖(Polynomial.cyclotomic P.q₀ ℂ).derivative.eval w‖|) |
| 60 | |
| 61 | /-- A set `T` of infinite places of `P.E s`, viewed in `(ℤ/q₁)ˣ` with `q₁ = P.q₁ s`, is sparse for |
| 62 | the primes up to `L` if for all primes `ℓ ≤ L` and integers `0 < i < j < l₀ s` there are no places |
| 63 | `σ, τ, ρ` in `T`, distinct or not, with `τ / σ ≡ ± ℓ ^ i` and `ρ / σ ≡ ± ℓ ^ j` modulo the part of |
| 64 | `q₁` prime to `ℓ`. The two signs are independent. -/ |
| 65 | def New.Parameters.IsSparse (P : Parameters) (s L : ℕ) (T : Finset (P.Φ s)) : Prop := |
| 66 | ∀ ℓ : ℕ, ℓ.Prime → ℓ ≤ L → ∀ i j : ℕ, 0 < i → i < j → j < l₀ s → |
| 67 | let φ : P.Φ s →* (ZMod (ordCompl[ℓ] (P.q₁ s)))ˣ := P.placeClass (Nat.ordCompl_dvd (P.q₁ s) ℓ) |
| 68 | ¬∃ σ ∈ T, ∃ τ ∈ T, ∃ ρ ∈ T, ∃ ε ε' : ℤˣ, |
| 69 | (φ (τ / σ)).val = (ε : ℤ) * ℓ ^ i ∧ (φ (ρ / σ)).val = (ε' : ℤ) * ℓ ^ j |
| 70 | |
| 71 | /-- The logarithm of `N₋ = κ̄ ^ m (M rd_E / 2π) ^ (m - 1) b ^ (-15 / 2)`, the lower end of the |
| 72 | range for the level. Here `κ̄` is the geometric mean of the weights `κ τ` over the infinite |
| 73 | places `τ` of `E = P.E s`, `rd_E` is the root discriminant of `E`, and `logB = log b`. -/ |
| 74 | def New.Parameters.logLevelMin (P : Parameters) (s m : ℕ) (κ : P.Φ s → ℕ) (M : ℕ) (logB : ℝ) : ℝ := |
| 75 | m * ((∑ τ : P.Φ s, log (κ τ)) / Core.numInfPlaces (P.E s)) + |
| 76 | (m - 1) * log (M * rootDiscr (P.E s) / (2 * Real.pi)) - 15 / 2 * logB |
| 77 | |
| 78 | /-- The weight of an infinite place is `b` on `T` and `x * b / x₁` off `T`. -/ |
| 79 | def New.Parameters.placeWeight (P : Parameters) {s : ℕ} (T : Finset (P.Φ s)) (x x₁ b : ℕ) |
| 80 | (τ : P.Φ s) : ℕ := if τ ∈ T then b else x * b / x₁ |
| 81 | |
| 82 | /-- The data for the parameters `P`: scales `x`, `x₁`, `b`, the number `m` of lifts, the rank `r`, |
| 83 | the exponent `s` of the field `E = P.E s`, a sparse set of `b`-places with the weights that it |
| 84 | determines, and primes `p₀`, `p₁`, `N` with integers of `K` and of `E` whose products with their |
| 85 | conjugates are `p₀ p₁` and `N`. The scales, `m` and `r` are not fixed: they lie in ranges, `m` and |
| 86 | `r` are powers of `2` and `3`, and `q₁ x₁` divides `b`. `New.eventually_exists_data` constructs data |
| 87 | with explicit `x₁`, `b`, `m`, `r` for every large integer `x`. -/ |
| 88 | structure New.Data (P : Parameters) where |
| 89 | /-- The length `x` of the prime sum, an integer. -/ |
| 90 | natX : ℕ |
| 91 | /-- The second cut-off `x₁`, an integer. -/ |
| 92 | natX₁ : ℕ |
| 93 | /-- The weight `b` at the `b`-places, an integer. -/ |
| 94 | natB : ℕ |
| 95 | /-- The logarithm of `x`. -/ |
| 96 | logX : ℝ |
| 97 | /-- The logarithm of `x₁`. -/ |
| 98 | logX₁ : ℝ |
| 99 | /-- The logarithm of `b`. -/ |
| 100 | logB : ℝ |
| 101 | /-- `logX = log x`. -/ |
| 102 | exp_logX : exp logX = natX |
| 103 | /-- `logX₁ = log x₁`. -/ |
| 104 | exp_logX₁ : exp logX₁ = natX₁ |
| 105 | /-- `logB = log b`. -/ |
| 106 | exp_logB : exp logB = natB |
| 107 | /-- `log log b ≥ 10¹² c`, where `c = P.constantBound` bounds the constants that depend on `P` |
| 108 | only. -/ |
| 109 | constantBound_le : 1e12 * P.constantBound ≤ log logB |
| 110 | /-- `(log b) ^ 100 ≤ x`. -/ |
| 111 | mul_log_logB_le_logX : 100 * log logB ≤ logX |
| 112 | /-- `x ^ 10⁶ ≤ x₁`. -/ |
| 113 | logX_le_logX₁ : 1e6 * logX ≤ logX₁ |
| 114 | /-- `x₁ ^ 10⁶ ≤ b`. -/ |
| 115 | logX₁_le_logB : 1e6 * logX₁ ≤ logB |
| 116 | /-- `(log x₁) ^ 6 ≤ log b`. -/ |
| 117 | log_logX₁_le_log_logB : 6 * log logX₁ ≤ log logB |
| 118 | /-- The number `m` of lifts in the chain. -/ |
| 119 | m : ℕ |
| 120 | /-- The rank `r` of the target, that is, of the hermitian spaces `New.Data.spaceW` over `E`. -/ |
| 121 | r : ℕ |
| 122 | /-- The exponent `s` with `2 ^ s = m ^ 22`; the field is `P.E s`. -/ |
| 123 | towerExp : ℕ |
| 124 | /-- `m` lies in `[√x, 2 √x]`. -/ |
| 125 | m_mem : (m : ℝ) ∈ Icc (exp (logX / 2)) (2 * exp (logX / 2)) |
| 126 | /-- `r` lies in `[x⁵, 3 x⁵]`. -/ |
| 127 | r_mem : (r : ℝ) ∈ Icc (exp (5 * logX)) (3 * exp (5 * logX)) |
| 128 | /-- `m` is a power of `2` with positive exponent, and `2 ^ s = m ^ 22`. -/ |
| 129 | exists_m_eq_two_pow : ∃ e : ℕ, m = 2 ^ (e + 1) ∧ towerExp = (e + 1) * 22 |
| 130 | /-- `r` is a power of `3` with positive exponent. -/ |
| 131 | exists_r_eq_three_pow : ∃ e : ℕ, r = 3 ^ (e + 1) |
| 132 | /-- `s ≤ 32 log x`. -/ |
| 133 | towerExp_le : towerExp ≤ 32 * logX |
| 134 | /-- `b` is a multiple of `q₁ x₁`. -/ |
| 135 | dvd_natB : P.q₁ towerExp * natX₁ ∣ natB |
| 136 | /-- The set `Φ_b` of `b`-places. -/ |
| 137 | bPlaces : Finset (P.Φ towerExp) |
| 138 | /-- The `b`-places are `≡ -1` modulo `q₀`. -/ |
| 139 | placeClass_of_mem_bPlaces : ∀ σ ∈ bPlaces, |
| 140 | P.placeClass (P.q₀.dvd_mul_right (towerDeg towerExp)) σ = -1 |
| 141 | /-- There are at least `towerDeg s / log b` of them; `towerDeg s` is the number of places `≡ 1` |
| 142 | modulo `q₀`. -/ |
| 143 | towerDeg_le_card_bPlaces_mul : towerDeg towerExp ≤ bPlaces.card * logB |
| 144 | /-- The `b`-places are sparse for the primes up to `k t`, where `k = r + 1 - m` and `t = 5 r`. -/ |
| 145 | sparse : P.IsSparse towerExp ((r + 1 - m) * (5 * r)) bPlaces |
| 146 | /-- The two primes `p₀`, `p₁` of the principal level. -/ |
| 147 | levelPrime : Fin 2 → ℕ |
| 148 | /-- `p₀` and `p₁` are prime. -/ |
| 149 | levelPrime_prime (i : Fin 2) : (levelPrime i).Prime |
| 150 | /-- `p₀, p₁ ≡ 1` modulo `q₂²`, with `q₂ = P.q₂ s`. -/ |
| 151 | levelPrime_modEq_one_q₂_sq (i : Fin 2) : levelPrime i ≡ 1 [MOD P.q₂ towerExp ^ 2] |
| 152 | /-- `p₀ ≠ p₁`. -/ |
| 153 | levelPrime_injective : levelPrime.Injective |
| 154 | /-- `p₀` and `p₁` lie in `[b¹⁰, b¹¹]`. -/ |
| 155 | levelPrime_mem (i : Fin 2) : (levelPrime i : ℝ) ∈ Icc (exp logB ^ 10) (exp logB ^ 11) |
| 156 | /-- An integer of `K` of norm `M = p₀ p₁`; its conjugate is written `π_M`. -/ |
| 157 | piMBar : 𝓞 P.K |
| 158 | /-- `piMBar` times its conjugate is `p₀ p₁`. -/ |
| 159 | piMBar_mul_star : piMBar * star piMBar = levelPrime 0 * levelPrime 1 |
| 160 | /-- The level `N`. -/ |
| 161 | N : ℕ |
| 162 | /-- `N` is prime. -/ |
| 163 | N_prime : N.Prime |
| 164 | /-- `N ≡ 1` modulo `q₂²`. -/ |
| 165 | N_modEq_one_q₂_sq : N ≡ 1 [MOD P.q₂ towerExp ^ 2] |
| 166 | /-- `log N₋ ≤ log N ≤ log N₋ + √(log b)`, with `N₋` as in `New.Parameters.logLevelMin`. -/ |
| 167 | log_N_mem : |
| 168 | let κ := P.placeWeight bPlaces natX natX₁ natB |
| 169 | log N ∈ Icc (P.logLevelMin towerExp m κ (levelPrime 0 * levelPrime 1) logB) |
| 170 | (P.logLevelMin towerExp m κ (levelPrime 0 * levelPrime 1) logB + √logB) |
| 171 | /-- An integer `π_N` of `E` whose product with its complex conjugate is `N`. -/ |
| 172 | piN : 𝓞 (P.E towerExp) |
| 173 | /-- `π_N` times its conjugate is `N`. -/ |
| 174 | piN_mul_star : piN * star piN = N |
| 175 | |
| 176 | namespace New.Data |
| 177 | |
| 178 | variable {P : Parameters} (D : Data P) |
| 179 | |
| 180 | /-- The weight `κ(τ)` determined by the scales and the set of `b`-places. -/ |
| 181 | def weight (self : Data P) : P.Φ self.towerExp → ℕ := |
| 182 | P.placeWeight self.bPlaces self.natX self.natX₁ self.natB |
| 183 | |
| 184 | /-- The weight is `b = a / x` at the `b`-places and `a / x₁` elsewhere, where `a = x b`. -/ |
| 185 | lemma weight_eq (self : Data P) (τ : P.Φ self.towerExp) : |
| 186 | self.weight τ = if τ ∈ self.bPlaces then self.natB |
| 187 | else self.natX * self.natB / self.natX₁ := rfl |
| 188 | |
| 189 | /-- The length `x` of the prime sum, as a real number. -/ |
| 190 | abbrev x : ℝ := exp D.logX |
| 191 | |
| 192 | /-- The second cut-off `x₁`, as a real number. -/ |
| 193 | abbrev x₁ : ℝ := exp D.logX₁ |
| 194 | |
| 195 | /-- The weight `b` at the `b`-places, as a real number. -/ |
| 196 | abbrev b : ℝ := exp D.logB |
| 197 | |
| 198 | /-- The field `E = K(ζ)`, with `ζ` a primitive root of unity of order `q₁`. -/ |
| 199 | @[reducible] def E : Type := P.E D.towerExp deriving NumberField, CharZero, IsCMField |
| 200 | |
| 201 | /-- The infinite places of `E`; they form the group `Gal(E/K) = (ℤ/q₁)ˣ`. -/ |
| 202 | protected abbrev Φ : Type := InfinitePlace D.E |
| 203 | |
| 204 | /-- The order `q₁ = 3 l₀ m ^ 22 q₀` of the root of unity that generates `E` over `K`; here |
| 205 | `l₀ = New.l₀ D.towerExp` and `m ^ 22 = 2 ^ D.towerExp`. -/ |
| 206 | abbrev q₁ : ℕ := P.q₁ D.towerExp |
| 207 | |
| 208 | /-- The number `f` of infinite places of `E`. -/ |
| 209 | abbrev f : ℕ := Core.numInfPlaces D.E |
| 210 | |
| 211 | /-- The number `q₁ d`; the field `E` lies in the cyclotomic field of this order. -/ |
| 212 | protected abbrev cyclotomicConductor : ℕ := D.q₁ * P.d |
| 213 | |
| 214 | /-- The root discriminant `rd_E` of `E`. -/ |
| 215 | abbrev rootDisc : ℝ := rootDiscr D.E |
| 216 | |
| 217 | /-- The rank `k = r + 1 - m` of the source; the subtraction is exact by `New.Data.r_add_one`. -/ |
| 218 | def k : ℕ := D.r + 1 - D.m |
| 219 | |
| 220 | /-- The number `t = 5 r`; consecutive ranks `n j` differ by `t + 1`. -/ |
| 221 | def t : ℕ := 5 * D.r |
| 222 | |
| 223 | /-- Half the gap, `Δ / 2 = r ^ 8`. -/ |
| 224 | def halfGap : ℕ := D.r ^ 8 |
| 225 | |
| 226 | /-- The gap `Δ = 2 r ^ 8` between the weights `D.liftWeight j σ` of consecutive lifts. -/ |
| 227 | def gap : ℕ := 2 * D.halfGap |
| 228 | |
| 229 | /-- The number `Δ / 2 - (t + 1) / 2`, where `Δ / 2 = D.halfGap`; note that `t` is odd. -/ |
| 230 | def reducedHalfGap : ℕ := D.halfGap - (D.t + 1) / 2 |
| 231 | |
| 232 | /-- The number `a = x b`, called the long order; the sum `D.primeSum` runs over `1 ≤ ν ≤ a`. -/ |
| 233 | def a : ℕ := D.natX * D.natB |
| 234 | |
| 235 | /-- The weight `a / x₁` at the places outside the set `D.bPlaces` of `b`-places. -/ |
| 236 | def offWeight : ℕ := D.a / D.natX₁ |
| 237 | |
| 238 | /-- The place that corresponds to the class of `j` in `(ℤ/q₁)ˣ` if `j` is prime to `q₁`, and the |
| 239 | identity place otherwise. -/ |
| 240 | abbrev placeOfInt (j : ℤ) : D.Φ := P.placeOfInt D.towerExp j |
| 241 | |
| 242 | /-- The ranks `n_j = k + j (t + 1)`. -/ |
| 243 | def n (j : ℕ) : ℕ := D.k + j * (D.t + 1) |
| 244 | |
| 245 | /-- The number `k + j - 1`. In the `j`-th step, `1 ≤ j ≤ m`, of the chain of theta lifts it is the |
| 246 | number of plus signs of the diagonal hermitian space `W_j = New.Data.spaceW` of rank `r` over `E`, |
| 247 | whose signs are `New.Data.signsW`. -/ |
| 248 | abbrev posRank (j : ℕ) : ℕ := D.k + j - 1 |
| 249 | |
| 250 | instance (j : Fin 2) : Fact (D.levelPrime j).Prime := ⟨D.levelPrime_prime j⟩ |
| 251 | |
| 252 | /-- The principal level `M = p₀ p₁`. -/ |
| 253 | def M : ℕ := D.levelPrime 0 * D.levelPrime 1 deriving NeZero |
| 254 | |
| 255 | /-- The set `Φ_a` of `a`-places: the places `≡ 1` modulo `q₀`. -/ |
| 256 | def aPlaces : Finset D.Φ := {τ : D.Φ | P.placeClass (P.q₀.dvd_mul_right |
| 257 | (towerDeg D.towerExp)) τ = 1} |
| 258 | |
| 259 | /-- The number `κ(σ) + (i + 1) Δ / 2`, where `κ = D.weight` and `Δ / 2 = D.halfGap` is half the |
| 260 | gap. -/ |
| 261 | def shiftedWeight (i : ℕ) (σ : D.Φ) : ℕ := D.weight σ + (i + 1) * D.halfGap |
| 262 | |
| 263 | /-- The weight `κ_j(σ) = κ(σ) + (j + 1/2) Δ` of the character of the `j`-th lift. -/ |
| 264 | def liftWeight (j : ℕ) (σ : D.Φ) : ℕ := D.shiftedWeight (2 * j) σ |
| 265 | |
| 266 | /-- The prime sum `s_fin(y, σ) = ∑ Λ_K(ν) (y / ν - κ(-ν σ))₊` over `1 ≤ ν ≤ a`. Here |
| 267 | `Λ_K(ν) = Λ(ν) (1 - χ_K(ν))` is `lambdaKResidueClass P.d 1 ν`, and `-ν σ` is the product of `σ` with |
| 268 | `D.placeOfInt (-ν)`, which is the identity place if `ν` is not prime to `q₁`. -/ |
| 269 | def primeSum (y : ℝ) (σ : D.Φ) : ℝ := |
| 270 | ∑ ν ∈ Finset.Icc 1 D.a, lambdaKResidueClass P.d 1 ν * (y / ν - D.weight (D.placeOfInt (-ν) * σ))⁺ |
| 271 | |
| 272 | /-- The unit of loss `f a log³ b`, with `f` the number of infinite places and `a = x b`. -/ |
| 273 | abbrev errorUnit : ℝ := D.f * D.a * D.logB ^ 3 |
| 274 | |
| 275 | /-- The size `s_∞(j) = log j! + j log (M / Ω)` of a derivative of order `j`. Here `M = D.M` and |
| 276 | `Ω = P.bigOmega D.towerExp = exp (γ - Re L'/L(1, χ_K)) 2π / rd_E`. -/ |
| 277 | def jetSize (j : ℕ) : ℝ := log j.factorial + j * log (D.M / P.bigOmega D.towerExp) |
| 278 | |
| 279 | /-- The direction amount `∑_σ (s_∞(κ(σ)) - s_fin(κ(σ), σ))`, summed over all infinite places `σ`: |
| 280 | the size `s_∞ = D.jetSize` of a derivative of order `κ(σ)`, less the prime sum `s_fin = D.primeSum` |
| 281 | that measures its guaranteed divisibility. -/ |
| 282 | def directionAmount : ℝ := ∑ σ : D.Φ, (D.jetSize (D.weight σ) - D.primeSum (D.weight σ) σ) |
| 283 | |
| 284 | end New.Data |
| 285 | |
| 286 | /-! ## The size of `N₋` |
| 287 | |
| 288 | The bounds for `N₋` do not involve the level `N`, so they can be used to construct it. -/ |
| 289 | |
| 290 | namespace New |
| 291 | |
| 292 | open Real Module |
| 293 | |
| 294 | /-- If a positive integer `c` lies in the different of the number field `K`, then the root |
| 295 | discriminant of `K` lies between `1` and `c`. -/ |
| 296 | lemma rootDiscr_mem_Icc {K : Type*} [Field K] [NumberField K] {c : ℕ} (hc : c ≠ 0) |
| 297 | (h_mem : (c : 𝓞 K) ∈ differentIdeal ℤ (𝓞 K)) : rootDiscr K ∈ Icc (1 : ℝ) c := by |
| 298 | refine ⟨one_le_rootDiscr K, ?_⟩ |
| 299 | -- the norm of the different is `|discr K|`, and it divides the norm `c ^ [K : ℚ]` of `c` |
| 300 | have h_dvd : (discr K).natAbs ∣ c ^ finrank ℚ K := by |
| 301 | rw [← absNorm_differentIdeal K (𝓞 K), ← RingOfIntegers.rank, ← Ideal.absNorm_span_natCast] |
| 302 | exact Ideal.absNorm_dvd_absNorm_of_le ((Ideal.span_singleton_le_iff_mem _).2 h_mem) |
| 303 | have h_le : |(discr K : ℝ)| ≤ (c : ℝ) ^ (finrank ℚ K : ℝ) := by |
| 304 | rw [rpow_natCast, ← Int.cast_abs, ← Nat.cast_natAbs] |
| 305 | exact_mod_cast Nat.le_of_dvd (by positivity) h_dvd |
| 306 | rw [rootDiscr_def, Int.cast_abs, rpow_inv_le_iff_of_pos (by positivity) c.cast_nonneg |
| 307 | (mod_cast finrank_pos)] |
| 308 | exact h_le |
| 309 | |
| 310 | /-- If real numbers `κ i`, indexed by a nonempty finite type, lie in `[1, exp L]`, then the mean of |
| 311 | their logarithms lies in `[0, L]`. -/ |
| 312 | lemma sum_log_div_card_mem_Icc {ι : Type*} [Fintype ι] [Nonempty ι] {κ : ι → ℝ} {L : ℝ} |
| 313 | (hκ : ∀ i : ι, κ i ∈ Icc 1 (exp L)) : |
| 314 | (∑ i : ι, log (κ i)) / Fintype.card ι ∈ Icc 0 L := by |
| 315 | have h_log (i : ι) : log (κ i) ∈ Icc 0 L := by |
| 316 | obtain ⟨h_lower, h_upper⟩ := hκ i |
| 317 | exact ⟨log_nonneg h_lower, (log_le_iff_le_exp (by positivity)).2 h_upper⟩ |
| 318 | rw [← Fintype.expect_eq_sum_div_card] |
| 319 | exact ⟨Finset.expect_nonneg fun i _ ↦ (h_log i).1, |
| 320 | Finset.expect_le Finset.univ_nonempty fun i _ ↦ (h_log i).2⟩ |
| 321 | |
| 322 | /-- If `b = exp L` with `L ≥ 7`, `M` lies in `[b ^ 20, b ^ 22]` and `R` lies in `[1, b]`, then |
| 323 | `M R / 2π` lies in `[b ^ 19, b ^ 23]`; the bounds are stated for the logarithm. -/ |
| 324 | lemma log_mul_div_two_pi_mem_Icc {M R L : ℝ} (hL : 7 ≤ L) (hM : M ∈ Icc (exp L ^ 20) (exp L ^ 22)) |
| 325 | (hR : R ∈ Icc 1 (exp L)) : log (M * R / (2 * π)) ∈ Icc (19 * L) (23 * L) := by |
| 326 | obtain ⟨hM_lower, hM_upper⟩ := hM |
| 327 | obtain ⟨hR_lower, hR_upper⟩ := hR |
| 328 | have hM_pos : 0 < M := hM_lower.trans_lt' (by positivity) |
| 329 | have h_pi_upper : 2 * π ≤ exp L := by linarith [pi_le_four, add_one_le_exp L] |
| 330 | constructor |
| 331 | · rw [le_log_iff_exp_le (by positivity), le_div_iff₀ (by positivity)] |
| 332 | calc exp (19 * L) * (2 * π) ≤ exp (19 * L) * exp L := by gcongr |
| 333 | _ = exp L ^ 20 * 1 := by |
| 334 | rw [← exp_add, ← exp_natCast_mul] |
| 335 | ring_nf |
| 336 | _ ≤ M * R := by gcongr |
| 337 | · rw [log_le_iff_le_exp (by positivity)] |
| 338 | calc M * R / (2 * π) ≤ M * R := div_le_self (by positivity) (by linarith [two_le_pi]) |
| 339 | _ ≤ exp L ^ 22 * exp L := by gcongr |
| 340 | _ = exp (23 * L) := mod_cast (exp_natCast_mul 23 L).symm |
| 341 | |
| 342 | /-- The bounds `m log b ≤ log N₋ ≤ 24 m log b` for `log N₋ = P.logLevelMin s m κ M L`, the logarithm |
| 343 | of `N₋ = κ̄ ^ m (M rd_E / 2π) ^ (m - 1) b ^ (-15 / 2)`, where `b = exp L`. The parameters `P` |
| 344 | consist of a modulus `q₀` and a prime `d = P.d`. The index `s` selects the multiple `q₁ = P.q₁ s` of |
| 345 | `q₀` and the field `E = K(ζ_{q₁})` over `K = ℚ(√-d)`, whose infinite places form the type `P.Φ s`. |
| 346 | Further `κ̄` is the geometric mean of the weights `κ` over these places, and `rd_E` is the root |
| 347 | discriminant of `E`, which is at most `q₁ d`. The hypotheses are `L ≥ 7`, `m ≥ 2`, weights in |
| 348 | `[1, b]`, `M` in `[b ^ 20, b ^ 22]` and `q₁ d ≤ b`. -/ |
| 349 | lemma Parameters.logLevelMin_mem_Icc (P : Parameters) {s m M : ℕ} {κ : P.Φ s → ℕ} {L : ℝ} |
| 350 | (hm : 2 ≤ m) (hL : 7 ≤ L) (hκ : ∀ τ : P.Φ s, (κ τ : ℝ) ∈ Icc 1 (exp L)) |
| 351 | (hM : (M : ℝ) ∈ Icc (exp L ^ 20) (exp L ^ 22)) |
| 352 | (h_conductor_le : (P.q₁ s * P.d : ℕ) ≤ exp L) : |
| 353 | P.logLevelMin s m κ M L ∈ Icc (m * L) (24 * m * L) := by |
| 354 | have hm_real : (2 : ℝ) ≤ m := mod_cast hm |
| 355 | have hm_sub : (0 : ℝ) ≤ m - 1 := by linarith |
| 356 | have h_rootDiscr : rootDiscr (P.E s) ∈ Icc (1 : ℝ) (P.q₁ s * P.d : ℕ) := |
| 357 | rootDiscr_mem_Icc (mul_ne_zero (NeZero.ne _) P.d_prime.ne_zero) P.conductor_mem_differentIdeal |
| 358 | set logMean : ℝ := (∑ τ : P.Φ s, log (κ τ)) / Fintype.card (P.Φ s) |
| 359 | set logScaled : ℝ := log (M * rootDiscr (P.E s) / (2 * π)) |
| 360 | obtain ⟨h_mean_lower, h_mean_upper⟩ : logMean ∈ Icc 0 L := sum_log_div_card_mem_Icc hκ |
| 361 | obtain ⟨h_scaled_lower, h_scaled_upper⟩ : logScaled ∈ Icc (19 * L) (23 * L) := |
| 362 | log_mul_div_two_pi_mem_Icc hL hM (Icc_subset_Icc_right h_conductor_le h_rootDiscr) |
| 363 | change m * logMean + (m - 1) * logScaled - 15 / 2 * L ∈ Icc (m * L) (24 * m * L) |
| 364 | constructor |
| 365 | · calc m * L ≤ m * 0 + (m - 1) * (19 * L) - 15 / 2 * L := by nlinarith |
| 366 | _ ≤ m * logMean + (m - 1) * logScaled - 15 / 2 * L := by gcongr |
| 367 | · calc m * logMean + (m - 1) * logScaled - 15 / 2 * L |
| 368 | _ ≤ m * L + (m - 1) * (23 * L) - 15 / 2 * L := by gcongr |
| 369 | _ ≤ 24 * m * L := by linarith |
| 370 | |
| 371 | end New |
| 372 | |
| 373 | end |