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.Int |
| 4 | import Mathlib.Algebra.Order.Star.Real |
| 5 | import Mathlib.Algebra.Ring.IsFormallyReal |
| 6 | import Mathlib.NumberTheory.SumTwoSquares |
| 7 | import Mathlib.RingTheory.ZMod.UnitsCyclic |
| 8 | import TauCeti.Combinatorics.Additive.NoRelation |
| 9 | public import New.Reduction.Data.AdmissibleData |
| 10 | import Lib.Analytic.Primes |
| 11 | |
| 12 | /-! |
| 13 | # Admissible data exist at every large x |
| 14 | |
| 15 | For every large integer `x`, this file constructs the data `New.Data`. It builds the ranks and the |
| 16 | field, the places, the scales and the primes in turn. |
| 17 | |
| 18 | ## Main definitions and results |
| 19 | |
| 20 | * `New.Parameters.IsAdmissibleData`: admissible data, with explicit values of the ranks and scales |
| 21 | and any `b`-places and primes that have the required properties. |
| 22 | * `New.Parameters.IsAdmissibleData.exists_hasFields`: at a large scale such data give the ranks, |
| 23 | scales and tower exponent (`New.Data.HasFields`) of the data `New.Data`. |
| 24 | * `New.eventually_exists_data`: admissible data exist at every large `x`. |
| 25 | |
| 26 | Notions from other files: |
| 27 | * `P : Parameters` fixes `q₀` and the prime `d` with `K = ℚ(√-d)`; at the exponent `s` it gives |
| 28 | `P.q₁ s = q₀ * towerDeg s`, where `towerDeg s = 3 l₀ 2 ^ s` and `l₀ = 3 ^ (⌊log₃ s⌋ + 4)` is, for |
| 29 | `s ≥ 1`, the least power of `3` above `27 s`. |
| 30 | * `P.Φ s` is the set of infinite places of the field `E = P.E s`, a group identified with `(ℤ/q₁)ˣ`; |
| 31 | `P.placeOfInt s ν` is the place of the class of `ν`, and `P.placeClass` reduces this class modulo |
| 32 | a divisor of `q₁`. |
| 33 | * `P.IsSparse s L T`: no places `σ, τ, ρ` in `T` have `τ / σ ≡ ± ℓ ^ i` and `ρ / σ ≡ ± ℓ ^ j` modulo |
| 34 | the part of `q₁` prime to `ℓ`, for a prime `ℓ ≤ L` and `0 < i < j < l₀`. |
| 35 | * `P.q₂ s = (q₀ d) ^ (s + 6)`; its square, written `q₂²`, is the modulus of the primes to be found. |
| 36 | * `TauCeti.exists_eq_and_eq_of_add_mul_modEq` gives the sets of Behrend's type: if `(L H) ^ n ≤ o`, |
| 37 | at least `H ^ n / (n H ^ 2)` numbers below `o` such that a congruence |
| 38 | `(α + α') e₂ ≡ α e₁ + α' e₃` modulo `o` between three of them, with `α, α' > 0` and |
| 39 | `α + α' ≤ L`, forces `e₁ = e₂ = e₃`. |
| 40 | * `P.logLevelMin s m κ M L` is `log N₋`, where `N₋ = κ̄ ^ m (M rd_E / 2π) ^ (m - 1) b ^ (-15 / 2)`, |
| 41 | `κ̄` being the geometric mean of the weights `κ`, `rd_E` the root discriminant and `L = log b`. |
| 42 | -/ |
| 43 | |
| 44 | @[expose] public section |
| 45 | |
| 46 | /-! |
| 47 | ## Existence of admissible data at every large integer x |
| 48 | |
| 49 | The ranks `m`, `r`, the exponent `s`, the field and the scales `x₁`, `b` come from `x`. The places |
| 50 | of weight `b` are `-g ^ e` with `g = 1 + 3 l₀ q₀` and `e` in a set of Behrend's type. The primes |
| 51 | `p₀`, `p₁` and `N` come from windows for primes in progressions, the element of norm `p₀ p₁` from |
| 52 | a pigeonhole argument in the class group of `K`, and the element of norm `N` from a sum of two |
| 53 | squares. The windows are those of `exists_prime_modEq_one_log_mem`, a consequence of the |
| 54 | Siegel–Walfisz theorem. That lemma needs an upper bound for the start of a window, so the upper |
| 55 | bound for `log N₋` is used as well. |
| 56 | -/ |
| 57 | |
| 58 | namespace New |
| 59 | |
| 60 | open Finset Real Filter NumberField ClassGroup NeZero QuadField |
| 61 | |
| 62 | /-- The infinite places `P.Φ s` of `E = P.E s` form the group `(ℤ/q₁)ˣ`, `q₁ = P.q₁ s`; |
| 63 | `P.placeOfInt s ν` is the place of the residue of an integer `ν` prime to `q₁`, and `P.placeClass` |
| 64 | reduces a place modulo a divisor of `q₁`. The place of `g = 1 + 3 l₀ q₀`, where `q₀ = P.q₀` and |
| 65 | `l₀ = 3 ^ (⌊log₃ s⌋ + 4)`, has order `2 ^ s` modulo some power `2 ^ (s + v)` that divides `q₁`. -/ |
| 66 | lemma Parameters.exists_orderOf_placeClass_eq (P : Parameters) (s : ℕ) : |
| 67 | ∃ (v : ℕ) (hv : 2 ^ (s + v) ∣ P.q₁ s), |
| 68 | orderOf (P.placeClass hv (P.placeOfInt s (3 * l₀ s * P.q₀ + 1 : ℕ))) = 2 ^ s := by |
| 69 | -- Write `q₀ = 2 ^ v u` with `u` odd and `v ≥ 2`; then `g = 1 + 2 ^ v (3 l₀ u)`. |
| 70 | obtain ⟨v, u, hu, hq₀⟩ : ∃ v u : ℕ, Odd u ∧ P.q₀ = 2 ^ v * u := |
| 71 | Nat.exists_eq_two_pow_mul_odd (ne P.q₀) |
| 72 | have h_four : 2 ^ 2 ∣ 2 ^ v * u := (Nat.dvd_trans (by norm_num) P.dvd_q₀).trans hq₀.dvd |
| 73 | have h_two_le : 2 ≤ v := (Nat.pow_dvd_pow_iff_le_right one_lt_two).1 |
| 74 | ((hu.coprime_two_left.pow_left 2).dvd_of_dvd_mul_right h_four) |
| 75 | set a : ℕ := 3 * l₀ s * u with ha |
| 76 | have ha_odd : Odd a := by simp [ha, l₀, Nat.odd_mul, Nat.odd_pow_iff, hu, Nat.odd_iff.2] |
| 77 | have h_order : orderOf (1 + 2 ^ v * (a : ℤ) : ZMod (2 ^ (s + v))) = 2 ^ s := |
| 78 | ZMod.orderOf_one_add_mul_prime_pow Nat.prime_two v (by omega) a |
| 79 | (mod_cast ha_odd.not_two_dvd_nat) s |
| 80 | refine ⟨v, ⟨a, by grind [towerDeg_eq]⟩, ?_⟩ |
| 81 | rw [← orderOf_units, P.placeClass_placeOfInt (by simp [isCoprime_one_left]), ← h_order, hq₀, ha] |
| 82 | push_cast |
| 83 | ring_nf |
| 84 | |
| 85 | /-- Let `y` be a place whose class modulo the part of `q₁` prime to the prime `ℓ` is `± ℓ ^ i`. |
| 86 | Then the square of its class modulo every divisor of `q₁` prime to `ℓ` is `ℓ ^ (2 i)`. -/ |
| 87 | lemma Parameters.placeClass_sq_eq (P : Parameters) {s ℓ i q : ℕ} (hℓ : ℓ.Prime) {y : P.Φ s} {ε : ℤˣ} |
| 88 | (hy : (P.placeClass (Nat.ordCompl_dvd (P.q₁ s) ℓ) y).val = (ε : ℤ) * ℓ ^ i) (hq : q ∣ P.q₁ s) |
| 89 | (h_coprime : ℓ.Coprime q) : (P.placeClass hq y).val ^ 2 = (ℓ : ZMod q) ^ (2 * i) := by |
| 90 | have h_dvd : q ∣ ordCompl[ℓ] (P.q₁ s) := |
| 91 | Nat.dvd_ordCompl_of_dvd_not_dvd hq (hℓ.coprime_iff_not_dvd.1 h_coprime) |
| 92 | have h_val : (P.placeClass hq y).val = |
| 93 | ZMod.castHom h_dvd (ZMod q) (P.placeClass (Nat.ordCompl_dvd (P.q₁ s) ℓ) y).val := by |
| 94 | rw [Parameters.placeClass, ← ZMod.unitsMap_comp h_dvd (Nat.ordCompl_dvd (P.q₁ s) ℓ)] |
| 95 | simp [Parameters.placeClass, ZMod.unitsMap_def] |
| 96 | rw [h_val, hy, map_mul, map_pow, map_intCast, map_natCast, mul_pow, ← Int.cast_pow, |
| 97 | Int.isUnit_sq ε.isUnit, Int.cast_one, one_mul, ← pow_mul'] |
| 98 | |
| 99 | /-- If two places have classes `±ℓⁱ` and `±ℓʲ`, raising their classes to powers `2j` and |
| 100 | `2i` gives the same residue modulo every divisor of `q₁` coprime to `ℓ`. Squaring removes |
| 101 | both signs, leaving `ℓ ^ (2 * i * j)` on each side. -/ |
| 102 | lemma Parameters.placeClass_pow_eq_of_two_returns (P : Parameters) {s ℓ i j q : ℕ} |
| 103 | (hℓ : ℓ.Prime) {u v : P.Φ s} {ε δ : ℤˣ} |
| 104 | (hu : (P.placeClass (Nat.ordCompl_dvd (P.q₁ s) ℓ) u).val = (ε : ℤ) * ℓ ^ i) |
| 105 | (hv : (P.placeClass (Nat.ordCompl_dvd (P.q₁ s) ℓ) v).val = (δ : ℤ) * ℓ ^ j) |
| 106 | (hq : q ∣ P.q₁ s) (hcop : ℓ.Coprime q) : |
| 107 | P.placeClass hq u ^ (2 * j) = P.placeClass hq v ^ (2 * i) := by |
| 108 | have hi := P.placeClass_sq_eq hℓ hu hq hcop |
| 109 | have hj := P.placeClass_sq_eq hℓ hv hq hcop |
| 110 | simp only [Units.ext_iff, Units.val_pow_eq_pow_val, pow_mul _ 2, hi, hj] |
| 111 | ring |
| 112 | |
| 113 | /-- In a commutative group, `(g ^ e₂ / g ^ e₁) ^ (a + b) = (g ^ e₃ / g ^ e₁) ^ b` forces |
| 114 | `(a + b) e₂ ≡ a e₁ + b e₃` modulo the order of `g`. -/ |
| 115 | lemma modEq_orderOf_of_div_pow_eq {G : Type*} [CommGroup G] {g : G} {e₁ e₂ e₃ a b : ℕ} |
| 116 | (h_eq : (g ^ e₂ / g ^ e₁) ^ (a + b) = (g ^ e₃ / g ^ e₁) ^ b) : |
| 117 | (a + b) * e₂ ≡ a * e₁ + b * e₃ [MOD orderOf g] := by |
| 118 | refine Nat.ModEq.add_right_cancel' (e₁ * b) (pow_eq_pow_iff_modEq.1 ?_) |
| 119 | rw [div_pow, div_pow, div_eq_div_iff_mul_eq_mul] at h_eq |
| 120 | calc g ^ ((a + b) * e₂ + e₁ * b) = g ^ (e₃ * b + e₁ * (a + b)) := by |
| 121 | simpa only [← pow_mul, ← pow_add, mul_comm e₂] using h_eq |
| 122 | _ = g ^ (a * e₁ + b * e₃ + e₁ * b) := by ring_nf |
| 123 | |
| 124 | /-- If `(2 l₀ H) ^ n ≤ 2 ^ s` and `2 l₀ (L + 1) < 2 ^ s`, there is a set of at least |
| 125 | `H ^ n / (n H ^ 2)` places of class `-1` modulo `q₀` that is sparse for the primes `ℓ ≤ L`: it has |
| 126 | no places `σ, τ, ρ` with `τ / σ ≡ ± ℓ ^ i` and `ρ / σ ≡ ± ℓ ^ j`, `0 < i < j < l₀`, modulo the part |
| 127 | of `q₁` prime to `ℓ`. -/ |
| 128 | lemma Parameters.exists_large_isSparse (P : Parameters) {s n H L : ℕ} |
| 129 | (h_room : (2 * l₀ s * H) ^ n ≤ 2 ^ s) (hL : 2 * l₀ s * (L + 1) < 2 ^ s) : |
| 130 | ∃ T : Finset (P.Φ s), |
| 131 | (∀ σ ∈ T, P.placeClass (P.q₀.dvd_mul_right (towerDeg s)) σ = -1) ∧ |
| 132 | (H ^ n / (n * H ^ 2) : ℝ) ≤ #T ∧ |
| 133 | P.IsSparse s L T := by |
| 134 | -- Take the places `-g ^ e`, with `g = 1 + 3 l₀ q₀` and `e` in Behrend's set to base `2 l₀ H`. |
| 135 | -- For `ℓ = 2` these have no ratio `± ℓ ^ i` modulo `3 l₀`. For odd `ℓ`, three of them in a |
| 136 | -- forbidden position give a congruence between their exponents, which Behrend's set allows only |
| 137 | -- if they are equal; then `ℓ ^ (2 i) ≡ 1`, which is false as `ℓ` has a large order. |
| 138 | let g : P.Φ s := P.placeOfInt s (3 * l₀ s * P.q₀ + 1 : ℕ) |
| 139 | obtain ⟨v, hv, h_order_g⟩ := P.exists_orderOf_placeClass_eq s |
| 140 | let ψ : P.Φ s →* (ZMod (2 ^ (s + v)))ˣ := P.placeClass hv |
| 141 | -- Behrend's set `S` of exponents below the order of `ψ g`, for the weights up to `2 l₀` |
| 142 | obtain ⟨S, h_lt, h_card, h_free⟩ := TauCeti.exists_eq_and_eq_of_add_mul_modEq |
| 143 | (o := orderOf (ψ g)) (by linarith [mul_lt_l₀ s]) (h_room.trans h_order_g.ge) |
| 144 | push_cast at h_card |
| 145 | -- the places `-g ^ e` are distinct modulo `2 ^ (s + v)`, and `≡ -1` modulo `3 l₀ q₀` |
| 146 | let place (e : ℕ) : P.Φ s := P.placeOfInt s (-1) * g ^ e |
| 147 | have h_inj : Set.InjOn place S := fun e he e' he' h ↦ |
| 148 | pow_injOn_Iio_orderOf (x := ψ g) (h_lt e he) (h_lt e' he') |
| 149 | (by simpa only [map_pow] using congrArg ψ (mul_left_cancel h)) |
| 150 | have h_class {q : ℕ} (hq : q ∣ P.q₁ s) (hq' : q ∣ 3 * l₀ s * P.q₀) (e : ℕ) : |
| 151 | P.placeClass hq (place e) = -1 := by |
| 152 | rw [Units.ext_iff, map_mul, map_pow, Units.val_mul, Units.val_pow_eq_pow_val, |
| 153 | P.placeClass_placeOfInt isCoprime_one_left.neg_left, |
| 154 | P.placeClass_placeOfInt (by simp [isCoprime_one_left]), Int.cast_natCast, Nat.cast_succ, |
| 155 | (ZMod.natCast_eq_zero_iff _ q).2 hq'] |
| 156 | simp |
| 157 | refine ⟨S.image place, forall_mem_image.2 fun e _ ↦ h_class _ (dvd_mul_left P.q₀ (3 * l₀ s)) e, |
| 158 | by rwa [card_image_of_injOn h_inj], ?_⟩ |
| 159 | rintro ℓ hℓ hℓL i j hi hij hj φ ⟨σ, hσ, τ, hτ, ρ, hρ, ε, ε', h_ratio_i, h_ratio_j⟩ |
| 160 | obtain ⟨e₁, he₁, rfl⟩ := mem_image.1 hσ |
| 161 | obtain ⟨e₂, he₂, rfl⟩ := mem_image.1 hτ |
| 162 | obtain ⟨e₃, he₃, rfl⟩ := mem_image.1 hρ |
| 163 | obtain rfl | h_odd := hℓ.eq_two_or_odd' |
| 164 | · -- `ℓ = 2`: modulo `3 l₀ = 3 ^ c` the ratio is `1`, so `4 ^ i ≡ 1`; but `4` has order `l₀ > i` |
| 165 | set c : ℕ := Nat.log 3 s + 5 |
| 166 | have h_dvd : 3 ^ c ∣ P.q₁ s := Dvd.dvd.mul_left (dvd_mul_right ..) P.q₀ |
| 167 | have h_dvd' : 3 ^ c ∣ 3 * l₀ s * P.q₀ := ⟨P.q₀, by rw [l₀, ← pow_succ']⟩ |
| 168 | have h_four : (1 + 3 : ZMod (3 ^ c)) ^ i = 1 := by |
| 169 | have h_sq := P.placeClass_sq_eq hℓ h_ratio_i h_dvd (.pow_right c (by norm_num)) |
| 170 | norm_num [map_div, h_class h_dvd h_dvd', pow_mul] at h_sq ⊢ |
| 171 | exact h_sq.symm |
| 172 | have h_order : orderOf (1 + 3 : ZMod (3 ^ c)) = l₀ s := |
| 173 | ZMod.orderOf_one_add_prime Nat.prime_three (by norm_num) _ |
| 174 | linarith [orderOf_le_of_pow_eq_one hi h_four] |
| 175 | · -- `ℓ` odd: modulo `2 ^ (s + v)`, the `2 j`-th power of the first ratio and the `2 i`-th |
| 176 | -- power of the second are both `ℓ ^ (2 i j)` |
| 177 | have h_coprime_two (k : ℕ) : ℓ.Coprime (2 ^ k) := .pow_right _ (by simpa using h_odd) |
| 178 | have h_rel : ψ (place e₂ / place e₁) ^ (2 * j) = ψ (place e₃ / place e₁) ^ (2 * i) := |
| 179 | P.placeClass_pow_eq_of_two_returns hℓ h_ratio_i h_ratio_j hv (h_coprime_two _) |
| 180 | -- compare exponents of `g`: `2 j e₂ ≡ 2 (j - i) e₁ + 2 i e₃` |
| 181 | obtain ⟨a, ha, rfl⟩ : ∃ a > 0, a + i = j := ⟨j - i, by omega, by omega⟩ |
| 182 | have h_cong : (2 * a + 2 * i) * e₂ ≡ 2 * a * e₁ + 2 * i * e₃ [MOD orderOf (ψ g)] := by |
| 183 | have h_ψ (e : ℕ) : ψ (place e / place e₁) = ψ g ^ e / ψ g ^ e₁ := by |
| 184 | simp only [place, mul_div_mul_left_eq_div, map_div, map_pow] |
| 185 | exact modEq_orderOf_of_div_pow_eq (by rwa [← h_ψ e₂, ← h_ψ e₃, ← mul_add]) |
| 186 | obtain ⟨rfl, -⟩ : e₁ = e₂ ∧ e₂ = e₃ := |
| 187 | h_free e₁ he₁ e₂ he₂ e₃ he₃ (2 * a) (2 * i) (by omega) (by omega) (by omega) h_cong |
| 188 | -- so `2 ^ (s + 1) ∣ ℓ ^ (2 i) - 1`, and the order of `ℓ` is too large for that |
| 189 | have h_pow : (ℓ : ZMod (2 ^ (s + 1))) ^ (2 * i) = 1 := by |
| 190 | simpa using (P.placeClass_sq_eq hℓ h_ratio_i P.two_pow_dvd_q₁ (h_coprime_two _)).symm |
| 191 | have h_order : 2 ^ s ≤ (ℓ + 1) * (2 * i) := |
| 192 | two_pow_le_of_pow_eq_one (q := ℓ) hℓ.one_lt (by omega) (by simpa using h_pow) |
| 193 | have h_small : (ℓ + 1) * (2 * i) ≤ (L + 1) * (2 * l₀ s) := Nat.mul_le_mul (by omega) (by omega) |
| 194 | linarith only [h_order, h_small, hL] |
| 195 | |
| 196 | /-- **A large sparse set of places.** The infinite places `P.Φ s` of `E = P.E s` form the group |
| 197 | `(ℤ/q₁)ˣ`. Let `0 < n`, `1 ≤ W ≤ 2 ^ s ≤ W ^ n`, `(2 l₀) ^ n ≤ W`, `3 l₀ n 2 ^ n ≤ W ^ 3` and |
| 198 | `2 l₀ (L + 1) < 2 ^ s`. There is a set of at least `towerDeg s / W ^ 6` places of class `-1` modulo |
| 199 | `q₀` that is sparse for the primes `ℓ ≤ L`: it has no places `σ, τ, ρ` with `τ / σ ≡ ± ℓ ^ i` and |
| 200 | `ρ / σ ≡ ± ℓ ^ j`, `0 < i < j < l₀`, modulo the part of `q₁` prime to `ℓ`. -/ |
| 201 | lemma Parameters.exists_isSparse (P : Parameters) {s n L : ℕ} {W : ℝ} (hn : 0 < n) (hW : 1 ≤ W) |
| 202 | (h_lower : W ≤ 2 ^ s) (h_upper : 2 ^ s ≤ W ^ n) (h_room : (2 * l₀ s) ^ n ≤ W) |
| 203 | (h_count : 3 * l₀ s * n * 2 ^ n ≤ W ^ 3) (hL : 2 * l₀ s * (L + 1) < 2 ^ s) : |
| 204 | ∃ T : Finset (P.Φ s), |
| 205 | (∀ σ ∈ T, P.placeClass (P.q₀.dvd_mul_right (towerDeg s)) σ = -1) ∧ |
| 206 | towerDeg s ≤ #T * W ^ 6 ∧ |
| 207 | P.IsSparse s L T := by |
| 208 | have hW_pos : 0 < W := one_pos.trans_le hW |
| 209 | -- the side `H = 2 ^ k` of Behrend's cube has `H ^ n ≤ 2 ^ s / W < (2 H) ^ n`, so `H ≤ W` |
| 210 | obtain ⟨k, hk_lower, hk_upper⟩ : |
| 211 | ∃ k : ℕ, (2 ^ n) ^ k ≤ 2 ^ s / W ∧ 2 ^ s / W < (2 ^ n) ^ (k + 1) := |
| 212 | exists_nat_pow_near ((one_le_div hW_pos).2 h_lower) (one_lt_pow₀ one_lt_two hn.ne') |
| 213 | rw [pow_right_comm, le_div_iff₀ hW_pos] at hk_lower |
| 214 | rw [pow_right_comm, div_lt_iff₀ hW_pos, pow_succ', mul_pow] at hk_upper |
| 215 | have hH : 2 ^ k ≤ W := |
| 216 | le_of_pow_le_pow_left₀ hn.ne' hW_pos.le (by grw [← h_upper, ← hk_lower, ← hW, mul_one]) |
| 217 | have h_fit : (2 * l₀ s * 2 ^ k) ^ n ≤ 2 ^ s := by |
| 218 | rify |
| 219 | grw [mul_pow _ (2 ^ k), h_room, ← hk_lower, mul_comm] |
| 220 | obtain ⟨T, h_class, h_card, h_sparse⟩ := P.exists_large_isSparse h_fit hL |
| 221 | refine ⟨T, h_class, ?_, h_sparse⟩ |
| 222 | push_cast at h_card |
| 223 | calc (towerDeg s : ℝ) = 3 * l₀ s * 2 ^ s := by simp [towerDeg_eq] |
| 224 | _ ≤ 3 * l₀ s * (2 ^ n * (2 ^ k) ^ n * W) := by grw [hk_upper] |
| 225 | _ = (2 ^ k) ^ n / (n * (2 ^ k) ^ 2) * (3 * l₀ s * n * 2 ^ n * W * (2 ^ k) ^ 2) := by field |
| 226 | _ ≤ #T * (W ^ 3 * W * W ^ 2) := by gcongr |
| 227 | _ = #T * W ^ 6 := by ring |
| 228 | |
| 229 | /-- Pigeonhole in the class group: given `h + 1` pairs `(I i, J i)` of finite places with |
| 230 | `I i * J i` principal, `h` the class number, there are `i ≠ j` with `I i * J j` principal. -/ |
| 231 | lemma exists_ne_isPrincipal_mul {K : Type*} [Field K] [NumberField K] |
| 232 | {I J : Fin (classNumber K + 1) → FinPlace K} |
| 233 | (h_principal : ∀ i : Fin (classNumber K + 1), ((I i).asIdeal * (J i).asIdeal).IsPrincipal) : |
| 234 | ∃ i j : Fin (classNumber K + 1), i ≠ j ∧ ((I i).asIdeal * (J j).asIdeal).IsPrincipal := by |
| 235 | -- two of the `I i` have the same class, and the class of `J j` is the inverse of that of `I j` |
| 236 | let c (v : FinPlace K) : ClassGroup (𝓞 K) := |
| 237 | mk0 ⟨v.asIdeal, mem_nonZeroDivisors_of_ne_zero v.ne_bot⟩ |
| 238 | have h_iff (v w : FinPlace K) : (v.asIdeal * w.asIdeal).IsPrincipal ↔ c v * c w = 1 := by |
| 239 | simp only [c, ← map_mul, MulMemClass.mk_mul_mk, mk0_eq_one_iff] |
| 240 | obtain ⟨i, j, hij, h_same : c (I i) = c (I j)⟩ := |
| 241 | Fintype.exists_ne_map_eq_of_card_lt (c ∘ I) (by simp [← classNumber.eq_1]) |
| 242 | exact ⟨i, j, hij, by simpa only [h_iff, h_same] using h_principal j⟩ |
| 243 | |
| 244 | /-- The conditions on each of the two primes `p₀`, `p₁` of admissible data, whose product |
| 245 | `M = p₀ p₁` is called the principal level: `p` is a prime `≡ 1` modulo `q₂² = P.q₂ s ^ 2` in |
| 246 | `[b ^ 10, b ^ 11]`, where `b = exp L`. -/ |
| 247 | structure Parameters.IsPrincipalLevelPrime (P : Parameters) (s : ℕ) (L : ℝ) (p : ℕ) : Prop where |
| 248 | /-- `p` is prime. -/ |
| 249 | prime : p.Prime |
| 250 | /-- `p ≡ 1` modulo `q₂²`. -/ |
| 251 | modEq_one : p ≡ 1 [MOD P.q₂ s ^ 2] |
| 252 | /-- `p` lies in `[b ^ 10, b ^ 11]`. -/ |
| 253 | mem_Icc : (p : ℝ) ∈ Set.Icc (exp L ^ 10) (exp L ^ 11) |
| 254 | |
| 255 | /-- The product `M = p₀ p₁` of the two primes of the principal level lies in `[b ^ 20, b ^ 22]`, |
| 256 | where `b = exp L`. -/ |
| 257 | lemma Parameters.IsPrincipalLevelPrime.mul_mem_Icc {P : Parameters} {s p₀ p₁ : ℕ} {L : ℝ} |
| 258 | (hp₀ : P.IsPrincipalLevelPrime s L p₀) (hp₁ : P.IsPrincipalLevelPrime s L p₁) : |
| 259 | ((p₀ * p₁ : ℕ) : ℝ) ∈ Set.Icc (exp L ^ 20) (exp L ^ 22) := |
| 260 | ⟨by grw [Nat.cast_mul, ← hp₀.mem_Icc.1, ← hp₁.mem_Icc.1, ← pow_add], |
| 261 | by grw [Nat.cast_mul, hp₀.mem_Icc.2, hp₁.mem_Icc.2, ← pow_add]⟩ |
| 262 | |
| 263 | /-- A prime `p ≡ 1` modulo `P.q₂ s ^ 2` splits in `K = P.K`: the ideal `(p)` is the product of |
| 264 | two finite places of norm `p`. -/ |
| 265 | private lemma Parameters.exists_finPlace_mul_eq_span (P : Parameters) {s p : ℕ} |
| 266 | (hp : p.Prime) (h_mod : p ≡ 1 [MOD P.q₂ s ^ 2]) : |
| 267 | ∃ I J : FinPlace P.K, |
| 268 | I.q = p ∧ J.q = p ∧ Ideal.span {(p : 𝓞 P.K)} = I.asIdeal * J.asIdeal := by |
| 269 | have : Fact p.Prime := ⟨hp⟩ |
| 270 | obtain ⟨I, hI⟩ := FinPlace.exists_natCast_mem P.K p |
| 271 | have hI_norm : I.q = p := by |
| 272 | simp [q_eq_iff_chiK_ne_neg_one I hI, |
| 273 | P.chiK_eq_one_of_modEq_one (h_mod.of_dvd (P.q₁_mul_d_dvd_q₂.pow two_ne_zero))] |
| 274 | obtain ⟨J, -, ⟨-, h_inert : I.q = p ^ 2⟩ | h_two⟩ := prime_inert_or_eq_mul I hI |
| 275 | -- the inert case would give `p = p ^ 2` |
| 276 | exacts [by nlinarith only [hI_norm, h_inert, hp.one_lt], ⟨I, J, h_two⟩] |
| 277 | |
| 278 | /-- Let `0 < W` and `(2 h + 2) W ≤ L`, with `h` the class number of `K`. If each window |
| 279 | `[U, U + W]` with `10 L ≤ U ≤ 11 L` holds the logarithm of a prime `≡ 1` modulo `P.q₂ s ^ 2`, |
| 280 | there are `h + 1` distinct primes of the principal level (`P.IsPrincipalLevelPrime s L`). -/ |
| 281 | private lemma Parameters.exists_injective_isPrincipalLevelPrime (P : Parameters) (s : ℕ) |
| 282 | {W L : ℝ} (hW : 0 < W) (h_classNumber_le : (2 * classNumber P.K + 2) * W ≤ L) |
| 283 | (h_window : ∀ U ∈ Set.Icc (10 * L) (11 * L), ∃ p : ℕ, |
| 284 | p.Prime ∧ p ≡ 1 [MOD P.q₂ s ^ 2] ∧ log p ∈ Set.Icc U (U + W)) : |
| 285 | ∃ p : Fin (classNumber P.K + 1) → ℕ, |
| 286 | p.Injective ∧ ∀ i, P.IsPrincipalLevelPrime s L (p i) := by |
| 287 | -- one prime from each of the `h + 1` disjoint windows starting at `10 L + 2 i W` |
| 288 | have h_shift (i : Fin (classNumber P.K + 1)) : 0 ≤ i * W ∧ 2 * i * W + W ≤ L := |
| 289 | ⟨by positivity, by nlinarith [(mod_cast i.is_le : (i : ℝ) ≤ classNumber P.K)]⟩ |
| 290 | have h_exists (i : Fin (classNumber P.K + 1)) : ∃ p : ℕ, p.Prime ∧ p ≡ 1 [MOD P.q₂ s ^ 2] ∧ |
| 291 | log p ∈ Set.Icc (10 * L + 2 * i * W) (10 * L + 2 * i * W + W) := |
| 292 | h_window (10 * L + 2 * i * W) ⟨by linarith [h_shift i], by linarith [h_shift i]⟩ |
| 293 | choose p hp h_mod h_log using h_exists |
| 294 | have h_level (i : Fin (classNumber P.K + 1)) : P.IsPrincipalLevelPrime s L (p i) := by |
| 295 | have hp_pos : (0 : ℝ) < p i := mod_cast (hp i).pos |
| 296 | refine ⟨hp i, h_mod i, ?_⟩ |
| 297 | simp only [Set.mem_Icc, ← exp_natCast_mul, ← le_log_iff_exp_le hp_pos, |
| 298 | ← log_le_iff_le_exp hp_pos, Nat.cast_ofNat] |
| 299 | exact ⟨by linarith [h_shift i, (h_log i).1], by linarith [h_shift i, (h_log i).2]⟩ |
| 300 | have h_inj : p.Injective := .of_lt_imp_ne fun i j (hij : i.val + 1 ≤ j) h_eq ↦ by |
| 301 | rify at hij |
| 302 | have h_lower : 10 * L + 2 * j * W ≤ log (p i) := by simpa only [h_eq] using (h_log j).1 |
| 303 | nlinarith only [hW, (h_log i).2, h_lower, hij] |
| 304 | exact ⟨p, h_inj, h_level⟩ |
| 305 | |
| 306 | /-- The primes `p₀`, `p₁`. Let `0 < W` and `(2 h + 2) W ≤ L`, with `h` the class number of `K`. |
| 307 | If each window `[U, U + W]` with `10 L ≤ U ≤ 11 L` holds the logarithm of a prime `≡ 1` modulo |
| 308 | `q₂² = P.q₂ s ^ 2`, there are two distinct such primes `p₀`, `p₁` in `[b ^ 10, b ^ 11]`, |
| 309 | `b = exp L`, whose product is the norm `α ᾱ` of an integer `α` of `K`. -/ |
| 310 | lemma Parameters.exists_prime_pair_norm (P : Parameters) (s : ℕ) {W L : ℝ} (hW : 0 < W) |
| 311 | (h_classNumber_le : (2 * classNumber P.K + 2) * W ≤ L) |
| 312 | (h_window : ∀ U ∈ Set.Icc (10 * L) (11 * L), ∃ p : ℕ, |
| 313 | p.Prime ∧ p ≡ 1 [MOD P.q₂ s ^ 2] ∧ log p ∈ Set.Icc U (U + W)) : |
| 314 | ∃ (p₀ p₁ : ℕ) (α : 𝓞 P.K), |
| 315 | p₀ ≠ p₁ ∧ |
| 316 | P.IsPrincipalLevelPrime s L p₀ ∧ |
| 317 | P.IsPrincipalLevelPrime s L p₁ ∧ |
| 318 | α * star α = p₀ * p₁ := by |
| 319 | -- one prime from each of the `h + 1` disjoint windows starting at `10 L + 2 i W` |
| 320 | obtain ⟨p, h_inj, h_level⟩ := |
| 321 | P.exists_injective_isPrincipalLevelPrime s hW h_classNumber_le h_window |
| 322 | -- each `p i` is `≡ 1` mod `q₁ d`, so it splits in `K` as `I i * J i` |
| 323 | have h_split (i : Fin (classNumber P.K + 1)) := |
| 324 | P.exists_finPlace_mul_eq_span (h_level i).prime (h_level i).modEq_one |
| 325 | choose I J hI hJ hIJ using h_split |
| 326 | -- pigeonhole: some `I i * J j` with `i ≠ j` is principal; a generator has norm `p i * p j` |
| 327 | obtain ⟨i, j, hij : i ≠ j, α, hα : (I i).asIdeal * (J j).asIdeal = .span {α}⟩ := |
| 328 | exists_ne_isPrincipal_mul (I := I) (J := J) fun i ↦ ⟨p i, (hIJ i).symm⟩ |
| 329 | exact ⟨p i, p j, α, h_inj.ne hij, h_level i, h_level j, |
| 330 | by simp [← absNorm_span_eq_mul_star, ← hα, hI, hJ]⟩ |
| 331 | |
| 332 | /-- A prime `N ≡ 1` modulo `4` is a sum `a ^ 2 + b ^ 2` of two squares (Fermat), hence the norm |
| 333 | `y ȳ` of `y = a + b i` in the CM field `E = P.E s`, which contains `i`. -/ |
| 334 | lemma Parameters.exists_mul_star_eq_prime (P : Parameters) (s : ℕ) {N : ℕ} (hN : N.Prime) |
| 335 | (h_mod : N ≡ 1 [MOD 4]) : ∃ y : 𝓞 (P.E s), y * star y = N := by |
| 336 | have : Fact N.Prime := ⟨hN⟩ |
| 337 | obtain ⟨a, b, hab : a ^ 2 + b ^ 2 = N⟩ := Nat.Prime.sq_add_sq (h_mod.trans_ne (by norm_num)) |
| 338 | obtain ⟨i, hi_sq, hi_star⟩ : ∃ i : 𝓞 (P.E s), i * i = -1 ∧ star i = -i := |
| 339 | HasPrimitiveRoot5040.exists_mul_self_eq_neg_one |
| 340 | refine ⟨a + b * i, ?_⟩ |
| 341 | simp only [← hab, star_add, star_mul, hi_star, star_natCast, Nat.cast_add, Nat.cast_pow] |
| 342 | linear_combination -(b : 𝓞 (P.E s)) ^ 2 * hi_sq |
| 343 | |
| 344 | /-- For `1 < q` and `1 < z`, the least power of `q` that is at least `z` is some `q ^ (e + 1)` with |
| 345 | `q ^ e < z`. -/ |
| 346 | lemma exists_isLeast_pow {q : ℕ} {z : ℝ} (hq : 1 < q) (hz : 1 < z) : |
| 347 | ∃ e : ℕ, IsLeast {n : ℕ | (∃ j : ℕ, n = q ^ j) ∧ z ≤ n} (q ^ (e + 1)) ∧ (q : ℝ) ^ e < z := by |
| 348 | have h_exists : ∃ j : ℕ, z ≤ (q : ℝ) ^ j := |
| 349 | (pow_unbounded_of_one_lt z (mod_cast hq)).imp fun _ ↦ le_of_lt |
| 350 | obtain ⟨e, he⟩ := Nat.exists_eq_succ_of_ne_zero (n := Nat.find h_exists) (by simpa using hz) |
| 351 | have h_le : z ≤ (q : ℝ) ^ (e + 1) := by simpa [he] using Nat.find_spec h_exists |
| 352 | refine ⟨e, ⟨⟨⟨_, rfl⟩, mod_cast h_le⟩, ?_⟩, not_le.1 (Nat.find_min h_exists (by omega))⟩ |
| 353 | rintro _ ⟨⟨j, rfl⟩, hj⟩ |
| 354 | exact Nat.pow_le_pow_right hq.le (he.ge.trans (Nat.find_min' h_exists (mod_cast hj))) |
| 355 | |
| 356 | /-- The ranks at `x = exp y`, `y ≥ 2`. The least power `m` of `2` with `m ≥ √x` is at most `2 √x`, |
| 357 | and the least power `r` of `3` with `r ≥ x⁵` is at most `3 x⁵`. Both have a positive exponent, and |
| 358 | for `m = 2 ^ (e + 1)` the exponent `s = 22 (e + 1)` is at most `32 log x`. -/ |
| 359 | lemma exists_isLeast_two_pow_three_pow {y : ℝ} (hy : 2 ≤ y) : |
| 360 | ∃ m r s : ℕ, |
| 361 | IsLeast {n : ℕ | (∃ j : ℕ, n = 2 ^ j) ∧ exp (y / 2) ≤ n} m ∧ |
| 362 | IsLeast {n : ℕ | (∃ j : ℕ, n = 3 ^ j) ∧ exp (5 * y) ≤ n} r ∧ |
| 363 | m ≤ 2 * exp (y / 2) ∧ |
| 364 | r ≤ 3 * exp (5 * y) ∧ |
| 365 | (∃ e : ℕ, m = 2 ^ (e + 1) ∧ s = (e + 1) * 22) ∧ |
| 366 | (∃ e : ℕ, r = 3 ^ (e + 1)) ∧ |
| 367 | s ≤ 32 * y := by |
| 368 | obtain ⟨a, hm, hm_pred_lt : ((2 : ℕ) : ℝ) ^ a < exp (y / 2)⟩ := |
| 369 | exists_isLeast_pow (z := exp (y / 2)) one_lt_two (Real.one_lt_exp_iff.2 (by linarith)) |
| 370 | obtain ⟨c, hr, hr_pred_lt : ((3 : ℕ) : ℝ) ^ c < exp (5 * y)⟩ := |
| 371 | exists_isLeast_pow (q := 3) (z := exp (5 * y)) (by simp) (Real.one_lt_exp_iff.2 (by linarith)) |
| 372 | refine ⟨2 ^ (a + 1), 3 ^ (c + 1), (a + 1) * 22, hm, hr, by simpa [pow_succ'] using hm_pred_lt.le, |
| 373 | by simpa [pow_succ'] using hr_pred_lt.le, ⟨a, rfl, rfl⟩, ⟨c, rfl⟩, ?_⟩ |
| 374 | -- `a log 2 < y / 2` and `2 ≤ y` |
| 375 | rw [← log_lt_iff_lt_exp (by positivity), log_pow, Nat.cast_ofNat] at hm_pred_lt |
| 376 | push_cast |
| 377 | nlinarith [log_two_gt_d9] |
| 378 | |
| 379 | /-- The inequality `2 l₀ (k t + 1) < 2 ^ s` for `k = r + 1 - m`, `t = 5 r` and |
| 380 | `l₀ = 3 ^ (⌊log₃ s⌋ + 4)`, the bound on the exponents in `Parameters.IsSparse`. It holds when |
| 381 | `0 < y`, `10⁶ y ≤ exp y`, `exp (y / 2) ≤ m`, `r ≤ 3 exp (5 y)`, `2 ^ s = m ^ 22` and |
| 382 | `l₀ ≤ 2592 y`. -/ |
| 383 | lemma mul_rank_lt_two_pow {y : ℝ} {m r s : ℕ} (hy : 0 < y) (h_large : 1e6 * y ≤ exp y) |
| 384 | (hm : exp (y / 2) ≤ m) (hr : r ≤ 3 * exp (5 * y)) (h_pow : 2 ^ s = m ^ 22) |
| 385 | (hl : l₀ s ≤ 2592 * y) : 2 * l₀ s * ((r + 1 - m) * (5 * r) + 1) < 2 ^ s := by |
| 386 | have h_rank : (((r + 1 - m) * (5 * r) + 1 : ℕ) : ℝ) ≤ 46 * exp (5 * y) ^ 2 := by |
| 387 | have hm_pos : 0 < m := mod_cast (exp_pos _).trans_le hm |
| 388 | grw [show r + 1 - m ≤ r by omega] |
| 389 | push_cast |
| 390 | grw [hr, hr] |
| 391 | linarith only [one_le_pow₀ (n := 2) (one_le_exp (x := 5 * y) (by positivity))] |
| 392 | rw [h_pow, ← Nat.cast_lt (α := ℝ), Nat.cast_mul, Nat.cast_mul, Nat.cast_pow] |
| 393 | calc _ ≤ 2 * (2592 * y) * (46 * exp (5 * y) ^ 2) := by grw [h_rank, hl, Nat.cast_ofNat] |
| 394 | _ < 1e6 * y * exp (5 * y) ^ 2 := by linarith [mul_pos hy (pow_pos (exp_pos (5 * y)) 2)] |
| 395 | _ ≤ exp y * exp (5 * y) ^ 2 := by gcongr |
| 396 | _ = exp (y / 2) ^ 22 := by |
| 397 | rw [← exp_natCast_mul, ← exp_natCast_mul, ← exp_add] |
| 398 | ring_nf |
| 399 | _ ≤ m ^ 22 := by gcongr |
| 400 | |
| 401 | /-- The modulus `q₂² = P.q₂ s ^ 2` is at most `W ^ n` if `2 ≤ y`, `0 < W`, `s ≤ 32 y` and |
| 402 | `99 q₀ d y ≤ n log W`. -/ |
| 403 | lemma Parameters.q₂_sq_le (P : Parameters) {s n : ℕ} {y W : ℝ} (hy : 2 ≤ y) (hW : 0 < W) |
| 404 | (hs : s ≤ 32 * y) (hn : 99 * P.q₀ * P.d * y ≤ n * log W) : (P.q₂ s ^ 2 : ℕ) ≤ W ^ n := by |
| 405 | have h_prod : (0 : ℝ) ≤ P.q₀ * P.d := by positivity |
| 406 | rw [Parameters.q₂, ← pow_mul, Nat.cast_pow, Nat.cast_mul] |
| 407 | refine pow_le_of_le_log hW ?_ |
| 408 | grw [log_pow, ← hn, log_le_self h_prod] |
| 409 | push_cast |
| 410 | nlinarith only [mul_le_mul_of_nonneg_right hs h_prod, mul_le_mul_of_nonneg_right hy h_prod] |
| 411 | |
| 412 | /-- For `0 ≤ W`, the logarithm of the integer `⌊exp W⌋` lies in `[W - 1, W]`. -/ |
| 413 | lemma log_floor_exp_mem_Icc {W : ℝ} (hW : 0 ≤ W) : log ⌊exp W⌋₊ ∈ Set.Icc (W - 1) W := by |
| 414 | have h_one : (1 : ℝ) ≤ ⌊exp W⌋₊ := mod_cast Nat.floor_pos.2 (one_le_exp hW) |
| 415 | rw [Set.mem_Icc, le_log_iff_exp_le (by linarith), log_le_iff_le_exp (by linarith), exp_sub, |
| 416 | div_le_iff₀ (exp_pos 1)] |
| 417 | -- `exp W ≤ ⌊exp W⌋ e`, since `exp W < ⌊exp W⌋ + 1 ≤ 2 ⌊exp W⌋` and `2 ≤ e` |
| 418 | exact ⟨by nlinarith [Nat.lt_floor_add_one (exp W), add_one_le_exp 1], Nat.floor_le (exp_pos W).le⟩ |
| 419 | |
| 420 | /-- The least multiple of `q` that exceeds `exp U` has logarithm in `[U, U + 1]` if `q ≤ exp U`. -/ |
| 421 | lemma exists_isLeast_dvd_and_exp_lt {q : ℕ} {U : ℝ} (hq : 0 < q) (h_le : q ≤ exp U) : |
| 422 | ∃ b : ℕ, IsLeast {b : ℕ | q ∣ b ∧ exp U < b} b ∧ log b ∈ Set.Icc U (U + 1) := by |
| 423 | have hq' : (0 : ℝ) < q := mod_cast hq |
| 424 | have h_lt_iff (c : ℕ) : exp U < (q * c : ℕ) ↔ ⌊exp U / q⌋₊ < c := by |
| 425 | rw [Nat.floor_lt (by positivity), div_lt_iff₀' hq', Nat.cast_mul] |
| 426 | have h_lt : exp U < (q * (⌊exp U / q⌋₊ + 1) : ℕ) := (h_lt_iff _).2 (Nat.lt_succ_self _) |
| 427 | refine ⟨_, ⟨⟨dvd_mul_right .., h_lt⟩, ?_⟩, (le_log_iff_exp_le (by positivity)).2 h_lt.le, ?_⟩ |
| 428 | · rintro _ ⟨⟨c, rfl⟩, hc⟩ |
| 429 | exact Nat.mul_le_mul_left q ((h_lt_iff c).1 hc) |
| 430 | · have h_floor : q * ⌊exp U / q⌋₊ ≤ exp U := (le_div_iff₀' hq').1 (Nat.floor_le (by positivity)) |
| 431 | rw [log_le_iff_le_exp (by positivity), exp_add, Nat.cast_mul, Nat.cast_succ] |
| 432 | nlinarith [add_one_le_exp 1, exp_pos U] |
| 433 | |
| 434 | /-- `W ^ n exp W ≤ exp (W ^ 6)` if `n + 1 ≤ W`. -/ |
| 435 | lemma pow_mul_exp_le_exp_pow_six {n : ℕ} {W : ℝ} (hn : n + 1 ≤ W) : |
| 436 | W ^ n * exp W ≤ exp (W ^ 6) := by |
| 437 | have hW : 1 ≤ W := by linarith [Nat.cast_nonneg (α := ℝ) n] |
| 438 | calc W ^ n * exp W ≤ exp W ^ n * exp W := by |
| 439 | gcongr |
| 440 | linarith only [add_one_le_exp W] |
| 441 | _ = exp ((n + 1) * W) := by rw [← exp_natCast_mul, ← exp_add, add_one_mul] |
| 442 | _ ≤ exp (W ^ 6) := by grw [hn, ← sq, pow_le_pow_right₀ hW (by norm_num : 2 ≤ 6)] |
| 443 | |
| 444 | /-- The scale `b`, the least multiple of `q x₁` above `exp (W ^ 6)`, where `x₁ = ⌊exp W⌋` and |
| 445 | `q ≤ W ^ n`: `log b` lies in `[W ^ 6, W ^ 6 + 1]`, and `log log b` in `[6 log W, 6 log W + 1]`. -/ |
| 446 | lemma exists_isLeast_dvd_log_log_mem_Icc {q n : ℕ} {W : ℝ} (hq : 0 < q) |
| 447 | (hn : n + 1 ≤ W) (hq_le : q ≤ W ^ n) : |
| 448 | ∃ b : ℕ, IsLeast {b : ℕ | q * ⌊exp W⌋₊ ∣ b ∧ exp (W ^ 6) < b} b ∧ |
| 449 | log b ∈ Set.Icc (W ^ 6) (W ^ 6 + 1) ∧ |
| 450 | log (log b) ∈ Set.Icc (6 * log W) (6 * log W + 1) := by |
| 451 | have hW : 1 ≤ W := by linarith [Nat.cast_nonneg (α := ℝ) n] |
| 452 | have hW_pow : 1 ≤ W ^ 6 := one_le_pow₀ hW |
| 453 | have h_step_le : (q * ⌊exp W⌋₊ : ℕ) ≤ exp (W ^ 6) := by |
| 454 | grw [← pow_mul_exp_le_exp_pow_six hn, Nat.cast_mul, hq_le, Nat.floor_le (exp_pos W).le] |
| 455 | obtain ⟨b, hb, h_lower, h_upper⟩ := exists_isLeast_dvd_and_exp_lt |
| 456 | (mul_pos hq (Nat.floor_pos.2 (one_le_exp (by linarith)))) h_step_le |
| 457 | have h_log_pow : log (W ^ 6) = 6 * log W := by simp |
| 458 | refine ⟨b, hb, ⟨h_lower, h_upper⟩, h_log_pow.ge.trans (log_le_log (by linarith) h_lower), ?_⟩ |
| 459 | rw [← h_log_pow, log_le_iff_le_exp (by linarith), exp_add, exp_log (by linarith)] |
| 460 | nlinarith [add_one_le_exp 1] |
| 461 | |
| 462 | /-- Let `2 ≤ y`, `0 < n`, `10⁶ y ≤ W ≤ exp (y / 2) ≤ m`, `r ≤ 3 exp (5 y)`, |
| 463 | `2 ^ s = m ^ 22 ≤ W ^ n`, `s ≤ 32 y`, `(5184 y) ^ n ≤ W` and `7776 y n 2 ^ n ≤ W`. At least |
| 464 | `towerDeg s / W ^ 6` places of class `-1` modulo `q₀` form a set that is sparse for the primes |
| 465 | `ℓ ≤ k t`, where `k = r + 1 - m` and `t = 5 r`: it has no places `σ, τ, ρ` with `τ / σ ≡ ± ℓ ^ i` |
| 466 | and `ρ / σ ≡ ± ℓ ^ j`, `0 < i < j < l₀`, modulo the part of `q₁` prime to `ℓ` |
| 467 | (`Parameters.IsSparse`). -/ |
| 468 | lemma Parameters.exists_isSparse_of_ranks (P : Parameters) {m r s n : ℕ} {y W : ℝ} (hy : 2 ≤ y) |
| 469 | (hn : 0 < n) (hm : exp (y / 2) ≤ m) (hr : r ≤ 3 * exp (5 * y)) (h_pow : 2 ^ s = m ^ 22) |
| 470 | (hs : s ≤ 32 * y) (hW : W ≤ exp (y / 2)) (h_upper : 2 ^ s ≤ W ^ n) (h_large : 1e6 * y ≤ W) |
| 471 | (h_room : (5184 * y) ^ n ≤ W) (h_count : 7776 * y * n * 2 ^ n ≤ W) : |
| 472 | ∃ T : Finset (P.Φ s), (∀ σ ∈ T, P.placeClass (P.q₀.dvd_mul_right (towerDeg s)) σ = -1) ∧ |
| 473 | towerDeg s ≤ #T * W ^ 6 ∧ |
| 474 | P.IsSparse s ((r + 1 - m) * (5 * r)) T := by |
| 475 | have hW_one : 1 < W := by linarith |
| 476 | have h_lower : W ≤ 2 ^ s := |
| 477 | calc W ≤ m ^ 22 := (hW.trans hm).trans (le_self_pow₀ (by linarith) (by norm_num)) |
| 478 | _ = 2 ^ s := mod_cast h_pow.symm |
| 479 | have hs_ne : s ≠ 0 := fun h ↦ by simp [h, hW_one.not_ge] at h_lower |
| 480 | have hl : l₀ s ≤ 2592 * y := by linarith [show (l₀ s : ℝ) ≤ 81 * s from mod_cast l₀_le_mul hs_ne] |
| 481 | have h_exp : 1e6 * y ≤ exp y := (h_large.trans hW).trans (exp_le_exp.2 (by linarith)) |
| 482 | refine P.exists_isSparse hn hW_one.le h_lower h_upper ?_ ?_ |
| 483 | (mul_rank_lt_two_pow (by linarith) h_exp hm hr h_pow hl) |
| 484 | · grw [← h_room, hl, ← mul_assoc, show (2 * 2592 : ℝ) = 5184 by norm_num] |
| 485 | · grw [hl, ← le_self_pow₀ hW_one.le three_ne_zero] |
| 486 | linarith |
| 487 | |
| 488 | /-- The level `N`. Let `E = P.E s = K(ζ_{q₁})` with `K = ℚ(√-d)`, `d = P.d` and `q₁ = P.q₁ s`. Let |
| 489 | `b = exp L` with `7 ≤ L` and `W ^ 2 ≤ L`, let `2 ≤ m`, let the weights `κ τ` at the infinite places |
| 490 | `τ` of `E` lie in `[1, b]` and `M` in `[b ^ 20, b ^ 22]`, and let `q₁ d ≤ b`. Let each window |
| 491 | `[U, U + W]` with `m L ≤ U ≤ 24 m L` hold the logarithm of a prime `≡ 1` modulo `q₂²`. There is such |
| 492 | a prime `N` with `log N₋ ≤ log N ≤ log N₋ + √L` and `N = y ȳ` for an integer `y` of `E`. -/ |
| 493 | lemma Parameters.exists_prime_log_mem_Icc_mul_star_eq (P : Parameters) {s m M : ℕ} {κ : P.Φ s → ℕ} |
| 494 | {W L : ℝ} (hm_two : 2 ≤ m) (hL_seven : 7 ≤ L) (hW_sq : W ^ 2 ≤ L) |
| 495 | (hκ_mem : ∀ τ : P.Φ s, (κ τ : ℝ) ∈ Set.Icc 1 (exp L)) |
| 496 | (hM_mem : (M : ℝ) ∈ Set.Icc (exp L ^ 20) (exp L ^ 22)) (h_cond : (P.q₁ s * P.d : ℕ) ≤ exp L) |
| 497 | (h_window : ∀ U ∈ Set.Icc (m * L) (24 * m * L), ∃ p : ℕ, |
| 498 | p.Prime ∧ p ≡ 1 [MOD P.q₂ s ^ 2] ∧ log p ∈ Set.Icc U (U + W)) : |
| 499 | ∃ (N : ℕ) (y : 𝓞 (P.E s)), N.Prime ∧ N ≡ 1 [MOD P.q₂ s ^ 2] ∧ |
| 500 | log N ∈ Set.Icc (P.logLevelMin s m κ M L) (P.logLevelMin s m κ M L + √L) ∧ |
| 501 | y * star y = N := by |
| 502 | obtain ⟨N, hN, h_mod, h_lower, h_upper⟩ := |
| 503 | h_window _ (P.logLevelMin_mem_Icc hm_two hL_seven hκ_mem hM_mem h_cond) |
| 504 | have h_four : 4 ∣ P.q₂ s ^ 2 := |
| 505 | calc 4 ∣ P.q₀ := .trans (by norm_num) P.dvd_q₀ |
| 506 | _ ∣ P.q₁ s * P.d := (dvd_mul_right P.q₀ (towerDeg s)).mul_right P.d |
| 507 | _ ∣ P.q₂ s ^ 2 := P.q₁_mul_d_dvd_q₂.pow two_ne_zero |
| 508 | obtain ⟨y, hy⟩ := P.exists_mul_star_eq_prime s hN (h_mod.of_dvd h_four) |
| 509 | exact ⟨N, y, hN, h_mod, ⟨h_lower, by grw [h_upper, le_sqrt_of_sq_le hW_sq]⟩, hy⟩ |
| 510 | |
| 511 | /-- For any proposition `p`, the value `if p then b else x * b / x₁` (natural-number division) lies |
| 512 | in `[1, b]` if `1 ≤ x ≤ x₁ ≤ b`. -/ |
| 513 | lemma ite_mul_div_mem_Icc {x x₁ b : ℕ} (hx : 1 ≤ x) (hx₁ : x ≤ x₁) (hb : x₁ ≤ b) (p : Prop) |
| 514 | [Decidable p] : (if p then b else x * b / x₁) ∈ Set.Icc 1 b := by |
| 515 | split_ifs |
| 516 | exacts [⟨by omega, le_rfl⟩, ⟨Nat.div_pos (hb.trans (Nat.le_mul_of_pos_left b hx)) (by omega), |
| 517 | Nat.div_le_of_le_mul (Nat.mul_le_mul_right b hx₁)⟩] |
| 518 | |
| 519 | lemma exp_five_mul_log {x : ℝ} (hx : 0 < x) : exp (5 * log x) = x ^ 5 := by |
| 520 | simpa [exp_log hx] using exp_natCast_mul 5 (log x) |
| 521 | |
| 522 | lemma rpow_div_six_pow_six (x : ℕ) (ε : ℝ) : ((x : ℝ) ^ (ε / 6)) ^ 6 = (x : ℝ) ^ ε := by |
| 523 | simp [← rpow_mul_natCast x.cast_nonneg] |
| 524 | |
| 525 | /-! ### Admissible data -/ |
| 526 | |
| 527 | /-- The admissible data at the integer `x` and the real `W`. The ranks `m`, `r`, the exponent `s` |
| 528 | and the scales `x₁ = ⌊exp W⌋` and `b` are determined by `x` and `W`; the set `T` of `b`-places (the |
| 529 | infinite places of `P.E s` that get the weight `b`), the |
| 530 | primes `p₀ = g 0`, `p₁ = g 1`, `N` and the elements `α`, `β` with `α ᾱ = p₀ p₁` and `β β̄ = N` are |
| 531 | any with the listed properties. -/ |
| 532 | structure Parameters.IsAdmissibleData (P : Parameters) (x : ℕ) (W : ℝ) (m r s b : ℕ) |
| 533 | (T : Finset (P.Φ s)) (g : Fin 2 → ℕ) (α : 𝓞 P.K) (N : ℕ) (β : 𝓞 (P.E s)) : Prop where |
| 534 | /-- `m` is the least power of `2` with `m ≥ √x`. -/ |
| 535 | isLeast_m : IsLeast {n : ℕ | (∃ j : ℕ, n = 2 ^ j) ∧ √x ≤ n} m |
| 536 | /-- `r` is the least power of `3` with `r ≥ x⁵`. -/ |
| 537 | isLeast_r : IsLeast {n : ℕ | (∃ j : ℕ, n = 3 ^ j) ∧ (x : ℝ) ^ 5 ≤ n} r |
| 538 | /-- `s = 22 log₂ m`. -/ |
| 539 | two_pow_eq : 2 ^ s = m ^ 22 |
| 540 | /-- `b` is the least multiple of `q₁ x₁` that exceeds `exp (W ^ 6)`. -/ |
| 541 | isLeast_b : IsLeast {c : ℕ | P.q₁ s * ⌊exp W⌋₊ ∣ c ∧ exp (W ^ 6) < c} b |
| 542 | /-- The `b`-places are `≡ -1` modulo `q₀`. -/ |
| 543 | placeClass_eq_neg_one : ∀ σ ∈ T, P.placeClass (P.q₀.dvd_mul_right (towerDeg s)) σ = -1 |
| 544 | /-- There are at least `towerDeg s / log b` of them. -/ |
| 545 | towerDeg_le : towerDeg s ≤ #T * log b |
| 546 | /-- The `b`-places are sparse for the primes up to `k t`, where `k = r + 1 - m` and `t = 5 r`. -/ |
| 547 | sparse : P.IsSparse s ((r + 1 - m) * (5 * r)) T |
| 548 | /-- `p₀` and `p₁` are prime. -/ |
| 549 | levelPrime_prime (i : Fin 2) : (g i).Prime |
| 550 | /-- `p₀, p₁ ≡ 1` modulo `q₂²`. -/ |
| 551 | levelPrime_modEq_one (i : Fin 2) : g i ≡ 1 [MOD P.q₂ s ^ 2] |
| 552 | /-- `p₀ ≠ p₁`. -/ |
| 553 | levelPrime_injective : g.Injective |
| 554 | /-- `p₀` and `p₁` lie in `[b¹⁰, b¹¹]`. -/ |
| 555 | levelPrime_mem (i : Fin 2) : (g i : ℝ) ∈ Set.Icc ((b : ℝ) ^ 10) ((b : ℝ) ^ 11) |
| 556 | /-- The norm of `α` is `p₀ p₁`. -/ |
| 557 | α_mul_star : α * star α = g 0 * g 1 |
| 558 | /-- The level `N` is prime. -/ |
| 559 | N_prime : N.Prime |
| 560 | /-- `N ≡ 1` modulo `q₂²`. -/ |
| 561 | N_modEq_one : N ≡ 1 [MOD P.q₂ s ^ 2] |
| 562 | /-- `log N₋ ≤ log N ≤ log N₋ + √(log b)`, for the weights `b` on `T` and `x b / x₁` elsewhere. -/ |
| 563 | log_N_mem : |
| 564 | let κ := P.placeWeight T x ⌊exp W⌋₊ b |
| 565 | log N ∈ Set.Icc (P.logLevelMin s m κ (g 0 * g 1) (log b)) |
| 566 | (P.logLevelMin s m κ (g 0 * g 1) (log b) + √(log b)) |
| 567 | /-- `β` times its complex conjugate is `N`. -/ |
| 568 | β_mul_star : β * star β = N |
| 569 | |
| 570 | /-- The scalar fields of the admissible data `D` are the given values, with `x₁ = ⌊exp W⌋`. The |
| 571 | arguments are the first of those of `Parameters.IsAdmissibleData`. -/ |
| 572 | structure Data.HasFields {P : Parameters} (D : Data P) (x : ℕ) (W : ℝ) (m r s b : ℕ) : Prop where |
| 573 | /-- The length of the prime sum is `x`. -/ |
| 574 | natX_eq : D.natX = x |
| 575 | /-- The scale `x₁` is `⌊exp W⌋`. -/ |
| 576 | natX₁_eq : D.natX₁ = ⌊exp W⌋₊ |
| 577 | /-- The scale `D.natB` is `b`. -/ |
| 578 | natB_eq : D.natB = b |
| 579 | /-- The rank `D.m` is `m`. -/ |
| 580 | m_eq : D.m = m |
| 581 | /-- The rank `D.r` is `r`. -/ |
| 582 | r_eq : D.r = r |
| 583 | /-- The exponent of the tower is `s`. -/ |
| 584 | towerExp_eq : D.towerExp = s |
| 585 | |
| 586 | /-- `W` is a large scale for `y` with exponent `n`: `W` is small against `x = exp y` and large |
| 587 | against the parameters, `n` and the multiples of `y` and `y ^ n` listed below; `n` is so large that |
| 588 | `q₂² ≤ W ^ n` for `s ≤ 32 y` (`Parameters.q₂_sq_le`). -/ |
| 589 | structure Parameters.IsLargeScale (P : Parameters) (n : ℕ) (y W : ℝ) : Prop where |
| 590 | /-- `(e W ^ 6) ^ 100 ≤ x`. -/ |
| 591 | log_W_le : 100 * (6 * log W + 1) ≤ y |
| 592 | /-- `log W` is large against `P.constantBound`, a bound for the constants that depend on `q₀` and |
| 593 | `d` only. -/ |
| 594 | const_le : 1e12 * P.constantBound ≤ log W |
| 595 | /-- `W` is large against `y`. -/ |
| 596 | mul_y_le_W : 2e6 * y ≤ W |
| 597 | /-- `W` is large against the class number of `K`. -/ |
| 598 | classNumber_le : 2 * classNumber P.K + 2 ≤ W |
| 599 | /-- `n` is positive. -/ |
| 600 | n_pos : 0 < n |
| 601 | /-- `n` is small against `W`. -/ |
| 602 | add_one_le : n + 1 ≤ W |
| 603 | /-- `n log W` is large against `log q₂²`. -/ |
| 604 | le_mul_log_W : 99 * P.q₀ * P.d * y ≤ n * log W |
| 605 | /-- Room for a set of Behrend's type. -/ |
| 606 | pow_le : (5184 * y) ^ n ≤ W |
| 607 | /-- The loss in the size of that set. -/ |
| 608 | mul_two_pow_le : 7776 * y * n * 2 ^ n ≤ W |
| 609 | |
| 610 | /-- For `0 < ε < 1 / 100` there is an `n` such that `W = x ^ (ε / 6)` is a large scale for |
| 611 | `y = log x` with exponent `n` at every large integer `x`: `0 < n`, `100 (6 log W + 1) ≤ y`, |
| 612 | `99 q₀ d y ≤ n log W`, and `W` is at least `2 · 10⁶ y`, `(5184 y) ^ n`, `7776 y n 2 ^ n`, `n + 1`, |
| 613 | `2 h + 2` with `h` the class number of `K = P.K`, and `exp (10¹² c)`, where `c = P.constantBound` |
| 614 | bounds the constants that depend on `q₀ = P.q₀` and `d = P.d` only. -/ |
| 615 | lemma Parameters.exists_eventually_isLargeScale (P : Parameters) {ε : ℝ} (hε : 0 < ε) |
| 616 | (hε_lt : ε < 1 / 100) : |
| 617 | ∃ n : ℕ, ∀ᶠ x : ℕ in atTop, P.IsLargeScale n (log x) ((x : ℝ) ^ (ε / 6)) := by |
| 618 | have hε_six : 0 < ε / 6 := by positivity |
| 619 | obtain ⟨n, hn, hn_pos⟩ : ∃ n : ℕ, 99 * P.q₀ * P.d < n * (ε / 6) ∧ 0 < n := by |
| 620 | simpa [div_lt_iff₀ hε_six] using exists_nat_gt (99 * P.q₀ * P.d / (ε / 6) ⊔ 0) |
| 621 | have hW : Tendsto (fun x : ℕ ↦ (x : ℝ) ^ (ε / 6)) atTop atTop := |
| 622 | (tendsto_rpow_atTop hε_six).comp tendsto_natCast_atTop_atTop |
| 623 | have h_pow_le (c : ℝ) (j : ℕ) : ∀ᶠ x : ℕ in atTop, c * log x ^ j ≤ (x : ℝ) ^ (ε / 6) := by |
| 624 | filter_upwards [tendsto_natCast_atTop_atTop.eventually |
| 625 | ((isLittleO_log_rpow_rpow_atTop j hε_six).const_mul_left c).eventuallyLE] with x hx |
| 626 | simpa [abs_of_nonneg (rpow_nonneg x.cast_nonneg _)] using (le_norm_self _).trans hx |
| 627 | use n |
| 628 | filter_upwards [eventually_gt_atTop 0, h_pow_le 2e6 1, h_pow_le (5184 ^ n) n, |
| 629 | h_pow_le (7776 * n * 2 ^ n) 1, hW.eventually_ge_atTop (exp (1e12 * P.constantBound)), |
| 630 | hW.eventually_ge_atTop (2 * classNumber P.K + 2), hW.eventually_ge_atTop (n + 1), |
| 631 | (tendsto_log_atTop.comp tendsto_natCast_atTop_atTop).eventually_ge_atTop (100 / (1 - 100 * ε))] |
| 632 | with x hx h_large h_room h_count h_const h_classNumber hn_le |
| 633 | (h_small : 100 / (1 - 100 * ε) ≤ log x) |
| 634 | have h_log : log ((x : ℝ) ^ (ε / 6)) = ε / 6 * log x := log_rpow (mod_cast hx) _ |
| 635 | exact |
| 636 | { log_W_le := by linarith only [h_log, (div_le_iff₀ (by linarith)).1 h_small] |
| 637 | const_le := (le_log_iff_exp_le (by positivity)).2 h_const |
| 638 | mul_y_le_W := by simpa only [pow_one] using h_large |
| 639 | classNumber_le := h_classNumber, n_pos := hn_pos, add_one_le := hn_le |
| 640 | le_mul_log_W := by grw [h_log, hn, mul_assoc] |
| 641 | pow_le := by rwa [mul_pow] |
| 642 | mul_two_pow_le := by linarith only [h_count] } |
| 643 | |
| 644 | namespace Parameters.IsLargeScale |
| 645 | |
| 646 | variable {P : Parameters} {n s : ℕ} {y W : ℝ} |
| 647 | |
| 648 | /-- A large scale `W` (`Parameters.IsLargeScale`) is at least `1`. -/ |
| 649 | lemma one_le (h_scale : P.IsLargeScale n y W) : 1 ≤ W := by |
| 650 | linarith only [h_scale.add_one_le, n.cast_nonneg (α := ℝ)] |
| 651 | |
| 652 | /-- If `W` is a large scale for `y` (`Parameters.IsLargeScale`), then `100 ≤ y`. -/ |
| 653 | lemma hundred_le (h_scale : P.IsLargeScale n y W) : 100 ≤ y := by |
| 654 | linarith only [h_scale.log_W_le, log_nonneg h_scale.one_le] |
| 655 | |
| 656 | /-- At a large scale `W`, the modulus `q₂² = P.q₂ s ^ 2` is at most `W ^ n` for `s ≤ 32 y`. -/ |
| 657 | lemma q₂_sq_le (h_scale : P.IsLargeScale n y W) (hs : s ≤ 32 * y) : (P.q₂ s ^ 2 : ℕ) ≤ W ^ n := |
| 658 | P.q₂_sq_le (by linarith [h_scale.hundred_le]) (one_pos.trans_le h_scale.one_le) hs |
| 659 | h_scale.le_mul_log_W |
| 660 | |
| 661 | /-- At a large scale `W`, `q₁ d ≤ W ^ n` for `s ≤ 32 y`, as `q₁ d` divides `q₂²`. -/ |
| 662 | lemma q₁_mul_d_le (h_scale : P.IsLargeScale n y W) (hs : s ≤ 32 * y) : |
| 663 | (P.q₁ s * P.d : ℕ) ≤ W ^ n := by |
| 664 | grw [Nat.le_of_dvd (NeZero.pos _) (P.q₁_mul_d_dvd_q₂.pow two_ne_zero), h_scale.q₂_sq_le hs] |
| 665 | |
| 666 | /-- At a large scale `W`, `2 ^ s ≤ W ^ n` for `s ≤ 32 y`, as `2 ^ s` divides `q₁ d`. -/ |
| 667 | lemma two_pow_le (h_scale : P.IsLargeScale n y W) (hs : s ≤ 32 * y) : 2 ^ s ≤ W ^ n := |
| 668 | (h_scale.q₁_mul_d_le hs).trans' <| mod_cast Nat.le_of_dvd (mul_pos (NeZero.pos _) P.d_prime.pos) |
| 669 | (((pow_dvd_pow 2 s.le_succ).trans P.two_pow_dvd_q₁).mul_right P.d) |
| 670 | |
| 671 | /-- Let `W` be a large scale for `y` with exponent `n` under the parameters `P` |
| 672 | (`Parameters.IsLargeScale`). If `s ≤ 32 y` and `W ^ 6 ≤ L`, then `P.q₁ s * P.d ≤ exp L`. -/ |
| 673 | lemma q₁_mul_d_le_exp (h_scale : P.IsLargeScale n y W) (hs : s ≤ 32 * y) {L : ℝ} (hL : W ^ 6 ≤ L) : |
| 674 | (P.q₁ s * P.d : ℕ) ≤ exp L := by |
| 675 | have hW : 0 ≤ W := zero_le_one.trans h_scale.one_le |
| 676 | grw [h_scale.q₁_mul_d_le hs, ← hL, |
| 677 | ← pow_mul_exp_le_exp_pow_six h_scale.add_one_le, ← one_le_exp hW, mul_one] |
| 678 | |
| 679 | /-- Let the real `W` be a large scale for the real `y`, and let `s` be a natural number with |
| 680 | `s ≤ 32 y`. The least multiple `b` of `P.q₁ s * ⌊exp W⌋` above `exp (W ^ 6)` is positive, in the |
| 681 | form `exp (log b) = b`; it has `log b` in `[W ^ 6, W ^ 6 + 1]` and `log log b` in |
| 682 | `[6 log W, 6 log W + 1]`. -/ |
| 683 | lemma exists_isLeast_dvd_log_log_mem_Icc (h_scale : P.IsLargeScale n y W) (hs : s ≤ 32 * y) : |
| 684 | ∃ b : ℕ, IsLeast {c : ℕ | P.q₁ s * ⌊exp W⌋₊ ∣ c ∧ exp (W ^ 6) < c} b ∧ |
| 685 | exp (log b) = b ∧ |
| 686 | log b ∈ Set.Icc (W ^ 6) (W ^ 6 + 1) ∧ |
| 687 | log (log b) ∈ Set.Icc (6 * log W) (6 * log W + 1) := by |
| 688 | have hq₁_le : P.q₁ s ≤ W ^ n := by |
| 689 | grw [Nat.le_mul_of_pos_right (P.q₁ s) P.d_prime.pos, h_scale.q₁_mul_d_le hs] |
| 690 | obtain ⟨b, ⟨⟨hb_dvd, hb_lt⟩, hb_min⟩, h_log⟩ := |
| 691 | New.exists_isLeast_dvd_log_log_mem_Icc (NeZero.pos (P.q₁ s)) h_scale.add_one_le |
| 692 | hq₁_le |
| 693 | exact ⟨b, ⟨⟨hb_dvd, hb_lt⟩, hb_min⟩, exp_log ((exp_pos (W ^ 6)).trans hb_lt), h_log⟩ |
| 694 | |
| 695 | end Parameters.IsLargeScale |
| 696 | |
| 697 | /-- Let `W` be a large scale for `log x`, and let admissible data at `x` and `W` be given. A term |
| 698 | `D : Data P` bundles such objects and scales `x`, `x₁` with the inequalities `(log b) ^ 100 ≤ x`, |
| 699 | `x ^ 10⁶ ≤ x₁`, `x₁ ^ 10⁶ ≤ b`, `(log x₁) ^ 6 ≤ log b`, `10¹² P.constantBound ≤ log log b`, |
| 700 | `m ∈ [√x, 2 √x]` and `r ∈ [x⁵, 3 x⁵]`. There is a `D` whose ranks, scales and tower exponent are |
| 701 | the given ones, with `x₁ = ⌊exp W⌋` (`Data.HasFields`). Moreover `W - 1 ≤ log x₁` and |
| 702 | `W ^ 6 ≤ log b ≤ W ^ 6 + 1`. -/ |
| 703 | lemma Parameters.IsAdmissibleData.exists_hasFields {P : Parameters} {x n m r s b N : ℕ} {W : ℝ} |
| 704 | {T : Finset (P.Φ s)} {g : Fin 2 → ℕ} {α : 𝓞 P.K} {β : 𝓞 (P.E s)} |
| 705 | (h_adm : P.IsAdmissibleData x W m r s b T g α N β) (h_scale : P.IsLargeScale n (log x) W) : |
| 706 | ∃ D : Data P, |
| 707 | D.HasFields x W m r s b ∧ |
| 708 | W - 1 ≤ D.logX₁ ∧ |
| 709 | D.logB ∈ Set.Icc (W ^ 6) (W ^ 6 + 1) := by |
| 710 | have hW_one : 1 ≤ W := h_scale.one_le |
| 711 | have hy : 100 ≤ log x := h_scale.hundred_le |
| 712 | have hx_pos : (0 : ℝ) < x := by linarith [log_le_self x.cast_nonneg] |
| 713 | -- The ranks are those of `exists_isLeast_two_pow_three_pow`, and `b` is that of |
| 714 | -- `exists_isLeast_dvd_log_log_mem_Icc`. |
| 715 | obtain ⟨m', r', s', hm, hr, hm_upper, hr_upper, ⟨e, hm_pow, hs_eq⟩, hr_pow, hs⟩ := |
| 716 | exists_isLeast_two_pow_three_pow (y := log x) (by linarith) |
| 717 | obtain rfl : m = m' := h_adm.isLeast_m.unique (by simpa [exp_half, exp_log hx_pos] using hm) |
| 718 | obtain rfl : r = r' := h_adm.isLeast_r.unique (by simpa [exp_five_mul_log hx_pos] using hr) |
| 719 | obtain rfl : s = s' := Nat.pow_right_injective le_rfl <| |
| 720 | show 2 ^ s = 2 ^ s' by rw [h_adm.two_pow_eq, hs_eq, pow_mul, ← hm_pow] |
| 721 | obtain ⟨b', hb, hb_eq, h_log_b, h_log_log_lower, h_log_log_upper⟩ := |
| 722 | h_scale.exists_isLeast_dvd_log_log_mem_Icc hs |
| 723 | obtain rfl : b = b' := h_adm.isLeast_b.unique hb |
| 724 | obtain ⟨⟨-, hm_lower : exp (log x / 2) ≤ m⟩, -⟩ := hm |
| 725 | obtain ⟨⟨-, hr_lower : exp (5 * log x) ≤ r⟩, -⟩ := hr |
| 726 | obtain ⟨⟨hb_dvd : P.q₁ s * ⌊exp W⌋₊ ∣ b, -⟩, -⟩ := hb |
| 727 | obtain ⟨hx₁_lower : W - 1 ≤ log ⌊exp W⌋₊, hx₁_upper : log ⌊exp W⌋₊ ≤ W⟩ := |
| 728 | log_floor_exp_mem_Icc (zero_le_one.trans hW_one) |
| 729 | have hb_large : 2e8 * W ≤ log b := by |
| 730 | nlinarith only [pow_le_pow_right₀ hW_one (by norm_num : 2 ≤ 6), h_log_b.1, h_scale.mul_y_le_W, |
| 731 | hy] |
| 732 | have h_log_log : log (log ⌊exp W⌋₊) ≤ log W := |
| 733 | log_le_log (by linarith [h_scale.mul_y_le_W]) hx₁_upper |
| 734 | -- the fields not listed are the fields of `h_adm` of the same name |
| 735 | let D : Data P := |
| 736 | { h_adm with |
| 737 | m, r, towerExp := s, levelPrime := g, N |
| 738 | natX := x, natX₁ := ⌊exp W⌋₊, natB := b |
| 739 | logX := log x, logX₁ := log ⌊exp W⌋₊, logB := log b |
| 740 | bPlaces := T, piMBar := α, piN := β |
| 741 | levelPrime_prime := h_adm.levelPrime_prime |
| 742 | levelPrime_modEq_one_q₂_sq := h_adm.levelPrime_modEq_one |
| 743 | levelPrime_injective := h_adm.levelPrime_injective |
| 744 | N_modEq_one_q₂_sq := h_adm.N_modEq_one |
| 745 | exp_logX := exp_log hx_pos |
| 746 | exp_logX₁ := exp_log (mod_cast Nat.floor_pos.2 (one_le_exp (by linarith))) |
| 747 | exp_logB := hb_eq |
| 748 | constantBound_le := by linarith [h_scale.const_le, log_nonneg hW_one] |
| 749 | mul_log_logB_le_logX := by linarith [h_scale.log_W_le] |
| 750 | logX_le_logX₁ := by linarith [h_scale.mul_y_le_W] |
| 751 | logX₁_le_logB := by linarith |
| 752 | log_logX₁_le_log_logB := by linarith |
| 753 | m_mem := ⟨hm_lower, hm_upper⟩, r_mem := ⟨hr_lower, hr_upper⟩ |
| 754 | exists_m_eq_two_pow := ⟨e, hm_pow, hs_eq⟩, exists_r_eq_three_pow := hr_pow |
| 755 | towerExp_le := hs, dvd_natB := hb_dvd |
| 756 | placeClass_of_mem_bPlaces := h_adm.placeClass_eq_neg_one |
| 757 | towerDeg_le_card_bPlaces_mul := h_adm.towerDeg_le |
| 758 | levelPrime_mem i := by simpa only [hb_eq] using h_adm.levelPrime_mem i |
| 759 | piMBar_mul_star := h_adm.α_mul_star, piN_mul_star := h_adm.β_mul_star } |
| 760 | have h_fields : D.HasFields x W m r s b := ⟨rfl, rfl, rfl, rfl, rfl, rfl⟩ |
| 761 | exact ⟨D, h_fields, hx₁_lower, h_log_b⟩ |
| 762 | |
| 763 | /-- Let `W` be a large scale for `y = log x` with exponent `n`. Let the windows `[U, U + W]` with |
| 764 | `W ≤ U ≤ W ^ (n + 7)` hold logarithms of primes `≡ 1` modulo the powers `(q₀ d) ^ k ≤ W ^ (n + 7)`, |
| 765 | `k > 1`. Then admissible data exist at `x` and `W`: the least powers `m ≥ √x` of `2` and `r ≥ x⁵` of |
| 766 | `3`; `s` with `2 ^ s = m ^ 22`; the least multiple `b > exp (W ^ 6)` of `P.q₁ s * ⌊exp W⌋`; a sparse |
| 767 | set `T` of at least `towerDeg s / log b` infinite places of `E = P.E s` of class `-1` modulo `q₀`; |
| 768 | distinct primes `g 0`, `g 1` in `[b¹⁰, b¹¹]` and a prime `N` with `log N` in the interval of length |
| 769 | `√(log b)` that starts at `P.logLevelMin`, all `≡ 1` modulo `(q₀ d) ^ (2 (s + 6))`; and integers `α` |
| 770 | of `K = P.K = ℚ(√-d)` and `β` of `E` with `α ᾱ = g 0 * g 1` and `β β̄ = N`. -/ |
| 771 | lemma Parameters.IsLargeScale.exists_isAdmissibleData {P : Parameters} {x n : ℕ} {W : ℝ} |
| 772 | (h_scale : P.IsLargeScale n (log x) W) |
| 773 | (h_window : ∀ k : ℕ, 1 < k → ((P.q₀ * P.d : ℕ) : ℝ) ^ k ≤ W ^ (n + 7) → |
| 774 | ∀ U ∈ Set.Icc W (W ^ (n + 7)), ∃ p : ℕ, |
| 775 | p.Prime ∧ p ≡ 1 [MOD (P.q₀ * P.d) ^ k] ∧ log p ∈ Set.Icc U (U + W)) : |
| 776 | ∃ (m r s b : ℕ) (T : Finset (P.Φ s)) (g : Fin 2 → ℕ) (α : 𝓞 P.K) (N : ℕ) (β : 𝓞 (P.E s)), |
| 777 | P.IsAdmissibleData x W m r s b T g α N β := by |
| 778 | have hW_one : 1 ≤ W := h_scale.one_le |
| 779 | have hW_pos : 0 < W := by linarith |
| 780 | have hy : 100 ≤ log x := h_scale.hundred_le |
| 781 | have h_large : 2e6 * log x ≤ W := h_scale.mul_y_le_W |
| 782 | have hx_pos : (0 : ℝ) < x := by linarith [log_le_self x.cast_nonneg] |
| 783 | have hW_le : W ≤ exp (log x / 2) := |
| 784 | (log_le_iff_le_exp hW_pos).1 (by linarith [log_nonneg hW_one, h_scale.log_W_le]) |
| 785 | -- ranks and field; `W ≤ m ≤ 2 ^ s ≤ W ^ n` and `q₂ s ^ 2 ≤ W ^ n` |
| 786 | obtain ⟨m, r, s, hm, hr, -, hr_upper, ⟨e, hm_pow, hs_eq⟩, -, hs⟩ := |
| 787 | exists_isLeast_two_pow_three_pow (y := log x) (by linarith) |
| 788 | have h_pow : 2 ^ s = m ^ 22 := by rw [hm_pow, hs_eq, pow_mul] |
| 789 | have h_two_pow : 2 ^ s ≤ W ^ n := h_scale.two_pow_le hs |
| 790 | have hm_le : m ≤ W ^ n := |
| 791 | h_two_pow.trans' (mod_cast (Nat.le_self_pow (by norm_num) m).trans h_pow.ge) |
| 792 | have hm_lower : exp (log x / 2) ≤ m := hm.1.2 |
| 793 | -- places |
| 794 | obtain ⟨T, h_class_T, h_card, h_sparse⟩ := P.exists_isSparse_of_ranks (by linarith) h_scale.n_pos |
| 795 | hm_lower hr_upper h_pow hs hW_le h_two_pow (by linarith) h_scale.pow_le h_scale.mul_two_pow_le |
| 796 | -- scales and weights |
| 797 | obtain ⟨b, hb, hb_eq, hL, -⟩ := h_scale.exists_isLeast_dvd_log_log_mem_Icc hs |
| 798 | set L : ℝ := log b |
| 799 | have hL_sq : W ^ 2 ≤ L := (pow_le_pow_right₀ hW_one (by norm_num)).trans hL.1 |
| 800 | have hL_large : 2e8 * W ≤ L := by nlinarith only [hL_sq, h_large, hy] |
| 801 | have hm_mul : L ≤ m * L := le_mul_of_one_le_left (by linarith) (by linarith) |
| 802 | have hx_le : x ≤ ⌊exp W⌋₊ := Nat.le_floor ((log_le_iff_le_exp hx_pos).1 (by linarith)) |
| 803 | have hb_ge : ⌊exp W⌋₊ ≤ b := |
| 804 | Nat.le_of_dvd (mod_cast (exp_pos L).trans_eq hb_eq) (dvd_of_mul_left_dvd hb.1.1) |
| 805 | let κ := P.placeWeight T x ⌊exp W⌋₊ b |
| 806 | have hκ (τ : P.Φ s) : (κ τ : ℝ) ∈ Set.Icc 1 (exp L) := by |
| 807 | simpa [hb_eq] using (show κ τ ∈ Set.Icc 1 b from |
| 808 | ite_mul_div_mem_Icc (mod_cast hx_pos) hx_le hb_ge (τ ∈ T)) |
| 809 | -- primes and level, from windows that start in `[L, 24 m L] ⊆ [W, W ^ (n + 7)]` |
| 810 | replace h_window (U : ℝ) (h_lower : L ≤ U) (h_upper : U ≤ 24 * m * L) : |
| 811 | ∃ p : ℕ, p.Prime ∧ p ≡ 1 [MOD P.q₂ s ^ 2] ∧ log p ∈ Set.Icc U (U + W) := by |
| 812 | have h_top : 24 * L ≤ W ^ 7 := by |
| 813 | nlinarith only [hL.2, one_le_pow₀ (n := 6) hW_one, h_large, hy] |
| 814 | have h_modulus : (P.q₂ s ^ 2 : ℕ) ≤ W ^ (n + 7) := |
| 815 | (h_scale.q₂_sq_le hs).trans (pow_le_pow_right₀ hW_one (n.le_add_right 7)) |
| 816 | rw [Parameters.q₂, ← pow_mul] at h_modulus ⊢ |
| 817 | refine h_window _ (by omega) (mod_cast h_modulus) U ⟨by linarith, ?_⟩ |
| 818 | calc U ≤ m * (24 * L) := by linarith |
| 819 | _ ≤ W ^ (n + 7) := by grw [hm_le, h_top, pow_add] |
| 820 | have h_classNumber_le : (2 * classNumber P.K + 2) * W ≤ L := by |
| 821 | grw [h_scale.classNumber_le, ← sq, hL_sq] |
| 822 | obtain ⟨p₀, p₁, α, h_ne, hp₀, hp₁, h_norm⟩ := P.exists_prime_pair_norm s hW_pos h_classNumber_le |
| 823 | fun U hU ↦ h_window U (by linarith [hU.1]) (by linarith [hU.2]) |
| 824 | have hg : ∀ i : Fin 2, P.IsPrincipalLevelPrime s L (![p₀, p₁] i) := |
| 825 | Fin.forall_fin_two.2 ⟨hp₀, hp₁⟩ |
| 826 | have hm_two : 2 ≤ m := mod_cast (by linarith : (2 : ℝ) ≤ m) |
| 827 | obtain ⟨N, β, hN, hN_mod, hN_log, hβ⟩ := P.exists_prime_log_mem_Icc_mul_star_eq hm_two |
| 828 | (by linarith) hL_sq hκ (hp₀.mul_mem_Icc hp₁) (h_scale.q₁_mul_d_le_exp hs hL.1) |
| 829 | fun U hU ↦ h_window U (hm_mul.trans hU.1) hU.2 |
| 830 | exact ⟨m, r, s, b, T, ![p₀, p₁], α, N, β, |
| 831 | { isLeast_m := by simpa [exp_half, exp_log hx_pos] using hm |
| 832 | isLeast_r := by simpa [exp_five_mul_log hx_pos] using hr |
| 833 | two_pow_eq := h_pow, isLeast_b := hb |
| 834 | placeClass_eq_neg_one := h_class_T, towerDeg_le := by grw [h_card, hL.1] |
| 835 | sparse := h_sparse |
| 836 | levelPrime_prime i := (hg i).prime, levelPrime_modEq_one i := (hg i).modEq_one |
| 837 | levelPrime_injective := Matrix.injective_pair_iff_ne.2 h_ne |
| 838 | levelPrime_mem i := by simpa only [hb_eq] using (hg i).mem_Icc |
| 839 | α_mul_star := h_norm |
| 840 | N_prime := hN, N_modEq_one := hN_mod, log_N_mem := hN_log, β_mul_star := hβ }⟩ |
| 841 | |
| 842 | /-- **Existence of the data.** A term `D : Data P` consists of integer scales `x`, `x₁`, `b` with |
| 843 | `(log b) ^ 100 ≤ x`, `x ^ 10⁶ ≤ x₁` and `x₁ ^ 10⁶ ≤ b`, ranks `m`, `r`, the exponent `s` with |
| 844 | `2 ^ s = m ^ 22`, a large sparse set of infinite places of `E = K(ζ_{q₁})`, and primes `p₀ ≠ p₁`, |
| 845 | `N` of prescribed size and residue with `p₀ p₁ = α ᾱ` in `K = P.K` and `N = β β̄` in `E`. For |
| 846 | `0 < ε < 1 / 100` such a `D` exists at every large integer `x`, with `x₁ = ⌊exp (x ^ (ε / 6))⌋` and |
| 847 | `b` the least multiple of `q₁ x₁` that exceeds `exp (x ^ ε)`; `m` is the least power of `2` with |
| 848 | `m ≥ √x` and `r` the least power of `3` with `r ≥ x⁵`. Then `x ^ (ε / 6) - 1 ≤ log x₁` and |
| 849 | `x ^ ε ≤ log b ≤ x ^ ε + 1`. -/ |
| 850 | theorem eventually_exists_data (P : Parameters) {ε : ℝ} (hε : 0 < ε) (hε_lt : ε < 1 / 100) : |
| 851 | ∀ᶠ x : ℕ in atTop, ∃ D : Data P, |
| 852 | D.natX = x ∧ |
| 853 | D.natX₁ = ⌊exp ((x : ℝ) ^ (ε / 6))⌋₊ ∧ |
| 854 | IsLeast {b : ℕ | D.q₁ * D.natX₁ ∣ b ∧ exp ((x : ℝ) ^ ε) < b} D.natB ∧ |
| 855 | IsLeast {n : ℕ | (∃ j : ℕ, n = 2 ^ j) ∧ √x ≤ n} D.m ∧ |
| 856 | IsLeast {n : ℕ | (∃ j : ℕ, n = 3 ^ j) ∧ (x : ℝ) ^ 5 ≤ n} D.r ∧ |
| 857 | (x : ℝ) ^ (ε / 6) - 1 ≤ D.logX₁ ∧ |
| 858 | D.logB ∈ Set.Icc ((x : ℝ) ^ ε) ((x : ℝ) ^ ε + 1) := by |
| 859 | obtain ⟨n, h_scale⟩ := P.exists_eventually_isLargeScale hε hε_lt |
| 860 | have h_four : 4 ∣ P.q₀ * P.d := Dvd.dvd.mul_right (.trans (by norm_num) P.dvd_q₀) P.d |
| 861 | have hW : Tendsto (fun x : ℕ ↦ (x : ℝ) ^ (ε / 6)) atTop atTop := |
| 862 | (tendsto_rpow_atTop (by positivity)).comp tendsto_natCast_atTop_atTop |
| 863 | filter_upwards [h_scale, hW.eventually (exists_prime_modEq_one_log_mem _ (n + 7) h_four)] |
| 864 | with x hx h_window |
| 865 | -- admissible data exist, and they are the fields of the data `D` |
| 866 | obtain ⟨m, r, s, b, T, g, α, N, β, h_adm⟩ := hx.exists_isAdmissibleData h_window |
| 867 | obtain ⟨D, h_fields, h_logX₁, h_logB⟩ := h_adm.exists_hasFields hx |
| 868 | obtain rfl : D.m = m := h_fields.m_eq |
| 869 | obtain rfl : D.r = r := h_fields.r_eq |
| 870 | obtain rfl : D.natB = b := h_fields.natB_eq |
| 871 | obtain rfl : D.towerExp = s := h_fields.towerExp_eq |
| 872 | have h_natB : IsLeast {b : ℕ | D.q₁ * D.natX₁ ∣ b ∧ exp ((x : ℝ) ^ ε) < b} D.natB := by |
| 873 | simpa only [h_fields.natX₁_eq, rpow_div_six_pow_six] using h_adm.isLeast_b |
| 874 | exact ⟨D, h_fields.natX_eq, h_fields.natX₁_eq, h_natB, h_adm.isLeast_m, h_adm.isLeast_r, h_logX₁, |
| 875 | by simpa only [rpow_div_six_pow_six] using h_logB⟩ |
| 876 | |
| 877 | end New |