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.Rat |
| 5 | import Mathlib.GroupTheory.Nilpotent |
| 6 | import Mathlib.NumberTheory.MulChar.Lemmas |
| 7 | import Mathlib.NumberTheory.NumberField.Cyclotomic.Basic |
| 8 | import TauCeti.Algebra.Group.AddChar.Basic |
| 9 | public import Lib.GaloisRep.Main.SelmerModules |
| 10 | import Lib.Adelic.Adeles.LocalFactors |
| 11 | import Lib.ClassField.Global.AlbertBrauerHasseNoether |
| 12 | import Lib.General.Algebra.ValuativeIntegrality |
| 13 | import Lib.General.NumberTheory.FrobeniusOrbits |
| 14 | |
| 15 | /-! |
| 16 | # A weak form of Stickelberger's theorem for Gauss sums, and a family of Jacobi-type quotients |
| 17 | |
| 18 | Gauss sums over `𝔽_p` give a family of elements `J x` of `Ωˣ`, `Ω = ℚ̄`, indexed by torsion points |
| 19 | `x` of `ℚ/ℤ`, with a known Galois action and a distribution relation up to elements of finite order. |
| 20 | |
| 21 | * `New.OddPart.floorDiff`, `New.OddPart.sum_floorDiff`: the integer `⌊c ⟨x⟩⌋ - ⌊c ⟨-x⟩⌋` and its |
| 22 | distribution relation (Hermite's identity). |
| 23 | * `New.OddPart.exists_galUnitsRep_gaussSum_eq`, `New.OddPart.stickelberger`: Galois action on Gauss |
| 24 | sums, and their orders at a place `B` above `p`. |
| 25 | * `New.OddPart.exists_isJacobiFamily`: the family `J`, built from the quotients |
| 26 | `j t = g(χ) ^ c / g(χ ^ c)` as `j t / j (-t)`. |
| 27 | |
| 28 | Notions from other files: |
| 29 | * `Ω` is `ℚ̄`, and `DiscreteUnits Ω` is `Ωˣ` written additively: a sum is a product, `c • u` is |
| 30 | `u ^ c`. `galUnitsRep σ` is the action of `σ ∈ Gal(Ω/ℚ)` on it. |
| 31 | * `ClosurePlace`: a valuation subring `B` of `Ω`; it lies above `p` when `B.valuation p < 1`, and |
| 32 | `centerPrime Ω B` is the prime ideal of `𝓞 Ω` that it defines; `principalUnits B` is the subgroup |
| 33 | of `DiscreteUnits Ω` of the `u` with `B.valuation (u - 1) < 1`, that is `u ≡ 1` at `B`. |
| 34 | * `ordRat ℚ B u`: the order of `u` at `B`, normalised so that a prime `p` below `B` has order one. |
| 35 | * `cyclotomicCharMod Ω N σ`: the cyclotomic character of `σ` modulo `N`, the unit `a` with |
| 36 | `σ ζ = ζ ^ a` for every `N`-th root of unity `ζ`. |
| 37 | * `New.QZ`: the group `ℚ/ℤ`; `New.QZ.fracRep x = ⟨x⟩` is the representative in `[0, 1)`, and |
| 38 | `New.QZ.ofZMod r b = b / r`. |
| 39 | |
| 40 | ## Relation to the literature |
| 41 | |
| 42 | Known result: Stickelberger's factorisation of Gauss sums and the Davenport–Hasse product relation. |
| 43 | Here only prime fields are treated, and characters are named by the valuation of their Gauss sum. |
| 44 | The product relation is proved for Jacobi-type quotients of Gauss sums and only up to a root of |
| 45 | unity. Source: L. Washington, Introduction to Cyclotomic Fields, 2nd ed. 1997, 6.2 and Thm 15.1; for |
| 46 | the product relation, H. Davenport, H. Hasse, J. reine angew. Math. 172 (1935). |
| 47 | -/ |
| 48 | |
| 49 | @[expose] public section |
| 50 | |
| 51 | namespace New.OddPart |
| 52 | |
| 53 | open Int Finset NumberField IntermediateField AddChar MulChar AddMonoidHom QZ ZMod QuotientAddGroup |
| 54 | HasEnoughRootsOfUnity Embeddings ComplexEmbedding ValuationSubring Cohomology NeZero Fact Ideal |
| 55 | |
| 56 | variable {r m p : ℕ} [NeZero r] [hp : Fact p.Prime] {B : ClosurePlace} |
| 57 | |
| 58 | /-- For `c : ℕ`, the integer `⌊c ⟨x⟩⌋ - ⌊c ⟨-x⟩⌋`, where `⟨x⟩` is the representative of `x ∈ ℚ/ℤ` |
| 59 | in `[0, 1)`. -/ |
| 60 | noncomputable def floorDiff (c : ℕ) (x : QZ) : ℤ := ⌊c * x.fracRep⌋ - ⌊c * (-x).fracRep⌋ |
| 61 | |
| 62 | /-- Hermite's identity in `ℚ/ℤ`: the sum of the fractional parts of `x + v b / r`, for a unit |
| 63 | `v` mod `r`, equals the fractional part of `r • x` plus the sum of the representatives `b / r`. -/ |
| 64 | private lemma sum_fracRep_add_ofZMod_mul (x : QZ) {v : ZMod r} (hv : IsUnit v) : |
| 65 | ∑ b : ZMod r, QZ.fracRep (x + ofZMod r (v * b)) = |
| 66 | (∑ b : ZMod r, (b.val : ℚ) / r) + (r • x).fracRep := by |
| 67 | calc |
| 68 | -- Reindex by the permutation `b ↦ ⌊r x⌋ + v b` of `ZMod r`. |
| 69 | _ = ∑ b : ZMod r, (b.val + fract (r * x.fracRep)) / r := by |
| 70 | refine Fintype.sum_equiv (hv.unit.mulLeft.trans (.addLeft ⌊r * x.fracRep⌋)) _ _ fun b ↦ |
| 71 | .trans ?_ (floor_add_fract _) |
| 72 | have h_intCast (a : ℤ) : ofZMod r (a : ZMod r) = QZ.mk ((a : ℚ) / r) := |
| 73 | ZMod.toRatAddCircle_intCast r a |
| 74 | -- Keep the cast of `b.val` so that `← ofZMod_apply` matches. The `↓` flags apply the floor |
| 75 | -- lemmas before `simp` rewrites their arguments. |
| 76 | simp [← ofZMod_apply, -natCast_val, h_intCast, add_assoc, sub_div, |
| 77 | ↓floor_div_natCast, ↓floor_natCast_add, ↓floor_fract, ediv_eq_zero_of_lt, val_lt, |
| 78 | ← fracRep_mk, add_div, ← self_sub_fract, NeZero.ne] |
| 79 | _ = _ := by |
| 80 | simp only [natCast_val, ← nsmul_eq_mul, ← fracRep_mk, map_nsmul, mk_fracRep, add_div, |
| 81 | sum_add_distrib, sum_const, card_univ, ZMod.card, add_right_inj] |
| 82 | rw [nsmul_eq_mul, mul_div_cancel₀ _ (NeZero.ne (r : ℚ))] |
| 83 | |
| 84 | /-- The distribution relation for `floorDiff m`, with `m` prime to `r`: its sum over the translates |
| 85 | of `x` by the points `v b / r`, for a unit `v` mod `r`, is its value at `r • x`. -/ |
| 86 | lemma sum_floorDiff (h_cop : m.Coprime r) (x : QZ) {v : ZMod r} (hv : IsUnit v) : |
| 87 | ∑ b : ZMod r, floorDiff m (x + ofZMod r (v * b)) = floorDiff m (r • x) := by |
| 88 | -- In `ℚ`, `⌊m ⟨y⟩⌋ = m ⟨y⟩ - ⟨m y⟩`, so `floorDiff m y = m ⟨y⟩ - ⟨m y⟩ - m ⟨-y⟩ + ⟨-(m y)⟩`. |
| 89 | have hm : IsUnit (m : ZMod r) := (isUnit_iff_coprime m r).mpr h_cop |
| 90 | qify |
| 91 | simp [floorDiff, map_nsmul, ← nsmul_eq_mul, ← fracRep_mk, ← self_sub_fract] |
| 92 | -- Apply Hermite's identity `sum_fracRep_add_ofZMod_mul` with `v`, `m * v`, `-v` and `-(m * v)`. |
| 93 | -- The constant `∑ b, b / r` occurs with the coefficients `m - 1 - m + 1 = 0`. |
| 94 | simp [sum_fracRep_add_ofZMod_mul, hm, hv, smul_comm r, ← map_neg, ← neg_mul, add_comm, |
| 95 | ← mul_sum, ← map_nsmul, ← mul_assoc] |
| 96 | ring |
| 97 | |
| 98 | /-- Kronecker's theorem in `Ω = ℚ̄`: an element of `Ω` that lies in every valuation ring of `Ω` and |
| 99 | has absolute value one in every complex embedding is a root of unity. -/ |
| 100 | lemma isOfFinOrder_of_norm_eq_one {x : Ω} (h_mem : ∀ A : ClosurePlace, x ∈ A) |
| 101 | (h_norm : ∀ τ : Ω →+* ℂ, ‖τ x‖ = 1) : IsOfFinOrder x := by |
| 102 | -- Apply Mathlib's Kronecker theorem to the generator of the number field `ℚ⟮x⟯`. |
| 103 | have h_int : IsIntegral ℤ x := |
| 104 | ((algebraMap ℤ Ω).isIntegralElem_iff_forall_valuationSubring x).2 fun A _ ↦ h_mem A |
| 105 | have : NumberField ℚ⟮x⟯ := { to_finiteDimensional := adjoin.finiteDimensional h_int.tower_top } |
| 106 | -- Every embedding of `ℚ⟮x⟯` into `ℂ` extends to `Ω`. |
| 107 | have h_gen (φ : ℚ⟮x⟯ →+* ℂ) : ‖φ (AdjoinSimple.gen ℚ x)‖ = 1 := by |
| 108 | rw [← lift_algebraMap_apply Ω φ] |
| 109 | exact h_norm _ |
| 110 | obtain ⟨n, hn_pos, h_pow⟩ := pow_eq_one_of_norm_eq_one ℚ⟮x⟯ ℂ (coe_isIntegral_iff.mp h_int) h_gen |
| 111 | exact isOfFinOrder_iff_pow_eq_one.mpr ⟨n, hn_pos, by simpa [Subtype.ext_iff] using h_pow⟩ |
| 112 | |
| 113 | /-! ### Gauss sums -/ |
| 114 | |
| 115 | /-- Galois action on Gauss sums. Let `ψ` be an additive character of `𝔽_p`, let `t ↦ χ t` be a |
| 116 | homomorphism from `ZMod r` to the multiplicative characters of `𝔽_p`, and let the unit `g t` of |
| 117 | `Ω` be the Gauss sum of `χ t` and `ψ`. There are homomorphisms `K σ : ZMod r → Ωˣ` with |
| 118 | `σ (g t) = K σ (a t) * g (a t)`, where `a` is the cyclotomic character of `σ` modulo `r`; in the |
| 119 | additive notation of `DiscreteUnits Ω` the right side is `(K σ + g) (a * t)`. -/ |
| 120 | lemma exists_galUnitsRep_gaussSum_eq {ψ : AddChar (ZMod p) (𝓞 Ω)} |
| 121 | {χ : AddChar (ZMod r) (MulChar (ZMod p) (𝓞 Ω))} |
| 122 | (g : ZMod r → DiscreteUnits Ω) (hg : ∀ t : ZMod r, (g t).toMul.val = gaussSum (χ t) ψ) : |
| 123 | ∃ K : Gal(Ω/ℚ) → ZMod r →+ DiscreteUnits Ω, ∀ (σ : Gal(Ω/ℚ)) (t : ZMod r), |
| 124 | galUnitsRep σ (g t) = (K σ + g) (cyclotomicCharMod Ω r σ * t) := by |
| 125 | -- With `c σ` the cyclotomic character of `σ` modulo `p`, the factor is `K σ t = (χ t)⁻¹ (c σ)`. |
| 126 | let c : Gal(Ω/ℚ) →* (ZMod p)ˣ := cyclotomicCharMod Ω p |
| 127 | have hK_ne (σ : Gal(Ω/ℚ)) (t : ZMod r) : (((χ t)⁻¹ (c σ) : 𝓞 Ω) : Ω) ≠ 0 := by |
| 128 | simp [apply_eq_zero_iff] |
| 129 | let K (σ : Gal(Ω/ℚ)) (t : ZMod r) : DiscreteUnits Ω := .ofNeZero ((χ t)⁻¹ (c σ) : 𝓞 Ω) (hK_ne σ t) |
| 130 | have K_add (σ : Gal(Ω/ℚ)) (a b : ZMod r) : K σ (a + b) = K σ a + K σ b := by |
| 131 | simp [K, DiscreteUnits.ext_iff, field, map_add_eq_mul] |
| 132 | refine ⟨fun σ ↦ mk' (K σ) (K_add σ), fun σ t ↦ ?_⟩ |
| 133 | -- The values of `χ t` on units are `r`-th, those of `ψ` are `p`-th roots of unity. So `σ` turns |
| 134 | -- `gaussSum (χ t) ψ` into the Gauss sum of `χ (cyclotomicCharMod Ω r σ * t)` and |
| 135 | -- `ψ.mulShift (c σ)`. |
| 136 | have h_shift (s : ZMod r) : ((gaussSum (χ s) (ψ.mulShift (c σ)) : 𝓞 Ω) : Ω) = |
| 137 | (((χ s)⁻¹ (c σ) * gaussSum (χ s) ψ : 𝓞 Ω) : Ω) := by |
| 138 | rw [gaussSum_mulShift_eq] |
| 139 | simpa [K, c, DiscreteUnits.ext_iff, smul_eq_pow_cyclotomicCharMod (N := p), |
| 140 | smul_eq_pow_cyclotomicCharMod (N := r), hg, gaussSum, sum_eq_add_sum_units, smul_sum, |
| 141 | NeZero.ne, ← RingHom.map_pow, ← pow_apply_coe, ← map_nsmul_eq_pow, natCast_self] |
| 142 | using h_shift (cyclotomicCharMod Ω r σ * t) |
| 143 | |
| 144 | /-- Let `B` be a place of `Ω` above the prime `p`. An algebraic integer `x` with `x ^ p = 1` is |
| 145 | congruent to `1` modulo the prime ideal `centerPrime Ω B` of `𝓞 Ω` that `B` defines. -/ |
| 146 | lemma mk_centrePrime_eq_one_of_pow_eq_one (hB : B.valuation p < 1) {x : 𝓞 Ω} (hx : x ^ p = 1) : |
| 147 | ↑x = (1 : 𝓞 Ω ⧸ centerPrime Ω B) := by |
| 148 | -- Otherwise the residue of `x` is a primitive `p`-th root of unity in a domain where `p = 0`. |
| 149 | by_contra h_ne |
| 150 | have h_prim : IsPrimitiveRoot (x : 𝓞 Ω ⧸ centerPrime Ω B) p := |
| 151 | IsPrimitiveRoot.iff_orderOf.mpr (orderOf_eq_prime (congrArg _ hx) h_ne) |
| 152 | exact h_prim.neZero'.out (mk_ker.ge (mem_centerPrime.mpr hB)) |
| 153 | |
| 154 | /-- A weak form of Stickelberger's theorem for `𝔽_p`. Let `B` be a place of `Ω` above `p`, `ψ` a |
| 155 | primitive additive character of `ZMod p`, `r` prime to `p`, `t ↦ χ t` a primitive (so injective) |
| 156 | additive map from `ZMod r` to the multiplicative characters of `ZMod p`, and `g t` the Gauss sum of |
| 157 | `χ t` and `ψ`. Then some injective `S : ZMod r →+ ℚ/ℤ` has, for every `t`, representative |
| 158 | `(S t).fracRep` in `[0, 1)` equal to `ordRat ℚ B (g t)`, the order at `B` normalised so that `p` has |
| 159 | order `1`. Stickelberger's factorisation of Gauss sums computes these orders; here they are only |
| 160 | tied to `S`. -/ |
| 161 | lemma stickelberger (hB : B.valuation p < 1) {ψ : AddChar (ZMod p) (𝓞 Ω)} |
| 162 | {χ : AddChar (ZMod r) (MulChar (ZMod p) (𝓞 Ω))} (g : ZMod r → DiscreteUnits Ω) |
| 163 | (hg : ∀ t : ZMod r, (g t).toMul.val = gaussSum (χ t) ψ) (hψ : ψ.IsPrimitive) |
| 164 | (hχ : χ.IsPrimitive) (h_cop : p.Coprime r) : |
| 165 | ∃ S : ZMod r →+ QZ, (⇑S).Injective ∧ ∀ t : ZMod r, (S t).fracRep = ordRat ℚ B (g t) := by |
| 166 | -- `v` is the place of `ℚ` below `B`, and `p` has order one at `B` |
| 167 | obtain ⟨v, hv, -, ord_p⟩ := exists_isPlaceOver_prime hB |
| 168 | obtain ⟨K, hK⟩ := exists_galUnitsRep_gaussSum_eq g hg |
| 169 | -- Inertia fixes the `r`-th roots of unity, so it multiplies `g t` by the character `K σ t` and |
| 170 | -- fixes `g (a + b) / (g a * g b)`, whose order is therefore an integer. |
| 171 | have ord_add (a b : ZMod r) : ∃ n : ℤ, ordRat ℚ B (g (a + b) - (g a + g b)) = n := by |
| 172 | refine hv.exists_ordRat_eq_intCast (Γ := Gal(Ω/ℚ)) fun σ hσ ↦ ?_ |
| 173 | have hK_inert (s : ZMod r) : galUnitsRep σ (g s) = K σ s + g s := by |
| 174 | simp [hK, cyclotomicCharMod_eq_one_of_mem_inertiaGroup hσ, h_cop.valuation_eq_one hB] |
| 175 | simp only [map_sub, map_add, hK_inert] |
| 176 | abel |
| 177 | -- So the class of `ord (g t)` in `ℚ/ℤ` is additive in `t`. |
| 178 | have S_add (a b : ZMod r) : |
| 179 | QZ.mk (ordRat ℚ B (g (a + b))) = QZ.mk (ordRat ℚ B (g a)) + QZ.mk (ordRat ℚ B (g b)) := by |
| 180 | obtain ⟨n, hn⟩ := ord_add a b |
| 181 | rw [← map_add, ← map_add] |
| 182 | exact eq_iff_sub_mem.mpr (AddSubgroup.mem_zmultiples_iff.mpr ⟨n, by simp [← hn]⟩) |
| 183 | let S : ZMod r →+ QZ := mk' (fun t ↦ QZ.mk (ordRat ℚ B (g t))) S_add |
| 184 | -- The Gauss sum of `χ' ≠ 1` has positive order: `ψ' ≡ 1` at `B`, so it is `≡ ∑ x, χ' x = 0`. |
| 185 | have ord_pos (u : DiscreteUnits Ω) {χ' : MulChar (ZMod p) (𝓞 Ω)} {ψ' : AddChar (ZMod p) (𝓞 Ω)} |
| 186 | (hu : u.toMul.val = gaussSum χ' ψ') (hχ' : χ' ≠ 1) : 0 < ordRat ℚ B u := by |
| 187 | have h_cen : gaussSum χ' ψ' - gaussSum χ' 1 ∈ centerPrime Ω B := by |
| 188 | simp [gaussSum, mk_centrePrime_eq_one_of_pow_eq_one hB, ← Submodule.Quotient.mk_eq_zero] |
| 189 | rw [gaussSum_one_right hχ', sub_zero, mem_centerPrime] at h_cen |
| 190 | rw [lt_iff_le_and_ne, ne_comm, Ne, hv.ordRat_nonneg_iff, hv.ordRat_eq_zero_iff, hu] |
| 191 | exact ⟨algebraMap_ringOfIntegers_mem B (gaussSum χ' ψ'), h_cen.ne⟩ |
| 192 | -- The order of `g t` lies in `[0, 1)`, so it is the representative of its class `S t`. |
| 193 | have lift_S (t : ZMod r) : (S t).fracRep = ordRat ℚ B (g t) := by |
| 194 | refine (toIcoMod_eq_self _).mpr ?_ |
| 195 | rw [zero_add] |
| 196 | by_cases ht : χ t = 1 |
| 197 | · -- Here `g t = -1`. |
| 198 | have hψ_ne : ψ ≠ 1 := by simpa using hψ one_ne_zero |
| 199 | have ord_zero : ordRat ℚ B (g t) = 0 := |
| 200 | hv.ordRat_eq_zero_iff.mpr (by simp [hg, ht, gaussSum_one_left hψ_ne]) |
| 201 | simp [ord_zero] |
| 202 | · -- `p / g t` is the Gauss sum of `(χ t)⁻¹` and `ψ⁻¹`, of positive order, and `ord p = 1`. |
| 203 | have h_mul : ((gaussSum (χ t) ψ * gaussSum (χ t)⁻¹ ψ⁻¹ : 𝓞 Ω) : Ω) = p := by |
| 204 | simp [gaussSum_mul_gaussSum_eq_card ht hψ] |
| 205 | have h_quot : 0 < ordRat ℚ B (.ofNeZero p out - g t) := |
| 206 | ord_pos _ (ψ' := ψ⁻¹) (by simpa [field, ← hg] using h_mul.symm) (inv_ne_one.mpr ht) |
| 207 | exact ⟨(ord_pos _ (hg t) ht).le, by simpa [ord_p] using h_quot⟩ |
| 208 | -- If `S t = 0` the order of `g t` is `0`, which forces `χ t = 1`, that is `t = 0`. |
| 209 | refine ⟨S, (injective_iff_map_eq_zero S).mpr fun t ht ↦ ?_, lift_S⟩ |
| 210 | have ord_zero : ordRat ℚ B (g t) = 0 := by |
| 211 | rw [← lift_S, ht, ← map_zero QZ.mk, fracRep_mk, fract_zero] |
| 212 | by_contra ht_ne |
| 213 | exact (ord_pos (g t) (hg t) (mt (hχ.zmod_char_eq_one_iff r t).mp ht_ne)).ne' ord_zero |
| 214 | |
| 215 | /-- The distribution relation up to roots of unity. Let `Ω` be the algebraic closure of `ℚ`, let `B` |
| 216 | be a place of `Ω` above `p`, and let `J : ℚ/ℤ → Ωˣ` (written additively) satisfy the following on |
| 217 | the `M`-torsion: it is Galois equivariant (`σ (J x) = J (a • x)` when `σ` raises `M`-th roots of |
| 218 | unity to the power `a`), a unit at every place not above `p`, of order |
| 219 | `floorDiff c x = ⌊c⟨x⟩⌋ − ⌊c⟨−x⟩⌋` at `B` normalised on `ℚ` (where `⟨x⟩` is the representative of |
| 220 | `x` in `[0, 1)`), and of absolute value one in every complex embedding. Then for `M • x = 0`, |
| 221 | `r ∣ M` and `c` prime to `r`, the quotient `(∏ b mod r, J (x + b / r)) / J (r x)` is a root of |
| 222 | unity. -/ |
| 223 | lemma isOfFinAddOrder_distribution (hB : B.valuation p < 1) {c M : ℕ} [NeZero M] |
| 224 | {J : QZ → DiscreteUnits Ω} |
| 225 | (h_gal : ∀ x : QZ, M • x = 0 → ∀ (σ : Gal(Ω/ℚ)) (a : ℕ), |
| 226 | (cyclotomicCharMod Ω M σ).val = a → galUnitsRep σ (J x) = J (a • x)) |
| 227 | (h_unit : ∀ x : QZ, M • x = 0 → ∀ A : ClosurePlace, A.valuation p = 1 → |
| 228 | A.valuation (J x).toMul.val = 1) |
| 229 | (h_ord : ∀ x : QZ, M • x = 0 → ordRat ℚ B (J x) = floorDiff c x) |
| 230 | (h_abs : ∀ x : QZ, M • x = 0 → ∀ τ : Ω →+* ℂ, ‖τ (J x).toMul.val‖ = 1) {x : QZ} (hx : M • x = 0) |
| 231 | (hr : r ∣ M) (hc : c.Coprime r) : |
| 232 | IsOfFinAddOrder (∑ b : ZMod r, J (x + ofZMod r b) - J (r • x)) := by |
| 233 | obtain ⟨M', rfl⟩ : ∃ M' : ℕ, M = r * M' := hr |
| 234 | -- `over_p`: all places of `Ω` above `p` lie over one place `v` of `ℚ`. |
| 235 | obtain ⟨v, -, -, over_p⟩ := exists_rat_place_of_prime hp.out |
| 236 | set Q : DiscreteUnits Ω := ∑ b : ZMod r, J (x + ofZMod r b) - J (r • x) with hQ |
| 237 | -- By Kronecker's theorem it suffices to see integrality everywhere and absolute value one. |
| 238 | refine Units.isOfFinOrder_val.mp (isOfFinOrder_of_norm_eq_one (fun A ↦ ?_) fun τ ↦ ?_) |
| 239 | · obtain hA | hA : A.valuation p = 1 ∨ A.valuation p < 1 := (valuation_le_one A p).eq_or_lt |
| 240 | · -- Off `p` every factor is a unit by `h_unit`, so the quotient has valuation one. |
| 241 | have h_val_one : A.valuation (Q.toMul : Ω) = 1 := by |
| 242 | simp [hQ, toMul_sub, toMul_sum, h_unit, hA, hx, smul_comm, ← map_nsmul, natCast_self] |
| 243 | exact (valuation_le_one_iff A _).mp h_val_one.le |
| 244 | · -- A place `A` above `p` is conjugate to `B`: `σ • A = B`. The conjugate quotient is the sum |
| 245 | -- of `J (a x + a b / r)` minus `J (r a x)`; its order at `B` vanishes by `sum_floorDiff`. |
| 246 | obtain ⟨σ, hσ⟩ := (over_p A hA).exists_smul Gal(Ω/ℚ) (over_p B hB) |
| 247 | obtain ⟨a, ha⟩ : ∃ a : ℕ, (cyclotomicCharMod Ω (r * M') σ : ZMod (r * M')) = a := |
| 248 | ⟨_, (natCast_zmod_val _).symm⟩ |
| 249 | have ha_unit : IsUnit (a : ZMod r) := by |
| 250 | rw [← ZMod.cast_natCast (dvd_mul_right r M'), ← ha] |
| 251 | exact isUnit_cast_of_dvd (dvd_mul_right r M') _ |
| 252 | have h_ord_conj : ordRat ℚ B (galUnitsRep σ Q) = |
| 253 | ↑(∑ b : ZMod r, floorDiff c (a • x + ofZMod r (a * b)) - floorDiff c (r • a • x)) := by |
| 254 | simp [hQ, h_gal _ _ σ a ha, h_ord, hx, smul_comm (r * _), smul_comm r, ← map_nsmul, |
| 255 | natCast_self, smul_add] |
| 256 | refine ((over_p A hA).ordRat_nonneg_iff Q).mp (ge_of_eq ?_) |
| 257 | rw [← (over_p A hA).ordRat_smul σ, hσ, h_ord_conj, sum_floorDiff hc _ ha_unit, sub_self, |
| 258 | Int.cast_zero] |
| 259 | · simp [hQ, toMul_sub, toMul_sum, h_abs, hx, smul_comm, ← map_nsmul, natCast_self] |
| 260 | |
| 261 | /-- The properties of a family `J : ℚ/ℤ → Ωˣ` (written additively) of Jacobi-type quotients of |
| 262 | Gauss sums over `𝔽_p`, on the points `x` with `M • x = 0`. Here `B` is a place of `Ω` (above `p` |
| 263 | where the family is built), and `c` is the exponent in `g(χ) ^ c / g(χ ^ c)`. -/ |
| 264 | structure IsJacobiFamily (p : ℕ) (B : ClosurePlace) (c M : ℕ) [NeZero M] |
| 265 | (J : QZ → DiscreteUnits Ω) : Prop where |
| 266 | /-- The distribution relation up to a root of unity: for `r ∣ M` prime to `c`, the quotient |
| 267 | `(∏ b mod r, J (x + b / r)) / J (r • x)` has finite order. -/ |
| 268 | isOfFinAddOrder_sum_sub {x : QZ} (hx : M • x = 0) (r : ℕ) [NeZero r] (hr : r ∣ M) |
| 269 | (hc : c.Coprime r) : IsOfFinAddOrder (∑ b : ZMod r, J (x + ofZMod r b) - J (r • x)) |
| 270 | /-- The Galois action: `σ (J x) = J (a • x)` if `σ` raises the `M`-th roots of unity to the |
| 271 | power `a`. -/ |
| 272 | galUnitsRep_apply {x : QZ} (hx : M • x = 0) (σ : Gal(Ω/ℚ)) (a : ℕ) |
| 273 | (ha : (cyclotomicCharMod Ω M σ).val = a) : galUnitsRep σ (J x) = J (a • x) |
| 274 | /-- `J x` is a unit at every place not above `p`. -/ |
| 275 | valuation_eq_one {x : QZ} (hx : M • x = 0) (A : ClosurePlace) (hA : A.valuation p = 1) : |
| 276 | A.valuation (J x).toMul.val = 1 |
| 277 | /-- The order of `J x` at `B` is `floorDiff c x`. -/ |
| 278 | ordRat_eq {x : QZ} (hx : M • x = 0) : ordRat ℚ B (J x) = floorDiff c x |
| 279 | /-- For a prime `q ∣ p - 1` and `q • b = 0`, the quotient `J (x + b) / J x` is `≡ 1` at every |
| 280 | place above `q`. -/ |
| 281 | sub_mem_principalUnits {x : QZ} (hx : M • x = 0) (q : ℕ) [Fact q.Prime] (A : ClosurePlace) |
| 282 | (b : QZ) (hb : q • b = 0) (hq : q ∣ p - 1) (hA : A.valuation q < 1) : |
| 283 | J (x + b) - J x ∈ principalUnits A |
| 284 | |
| 285 | /-- A Gauss sum over `𝔽_p` of a multiplicative character `χ₀` and a primitive additive character |
| 286 | `ψ` divides `p` in `𝓞 Ω`. -/ |
| 287 | lemma gaussSum_dvd_natCast_of_isPrimitive {ψ : AddChar (ZMod p) (𝓞 Ω)} (hψ : ψ.IsPrimitive) |
| 288 | (χ₀ : MulChar (ZMod p) (𝓞 Ω)) : |
| 289 | gaussSum χ₀ ψ ∣ p := by |
| 290 | by_cases hχ₀ : χ₀ = 1 |
| 291 | · simp [hχ₀, gaussSum_one_left (show ψ ≠ 1 by simpa using hψ one_ne_zero)] |
| 292 | · simpa using Dvd.intro _ (gaussSum_mul_gaussSum_eq_card hχ₀ hψ) |
| 293 | |
| 294 | /-- Let `A` be a place of `Ω` not above `p`. A Gauss sum over `𝔽_p` of a multiplicative character |
| 295 | `χ₀` and a primitive additive character `ψ` has valuation one at `A`: it is integral and divides |
| 296 | `p`, which is a unit at `A`. -/ |
| 297 | lemma valuation_gaussSum_eq_one_of_valuation_eq_one {A : ClosurePlace} (hA : A.valuation p = 1) |
| 298 | {ψ : AddChar (ZMod p) (𝓞 Ω)} (hψ : ψ.IsPrimitive) (χ₀ : MulChar (ZMod p) (𝓞 Ω)) : |
| 299 | A.valuation ((gaussSum χ₀ ψ : 𝓞 Ω) : Ω) = 1 := by |
| 300 | have h_le : A.valuation ((gaussSum χ₀ ψ : 𝓞 Ω) : Ω) ≤ 1 := |
| 301 | A.valuation_le_one ⟨_, algebraMap_ringOfIntegers_mem A (gaussSum χ₀ ψ)⟩ |
| 302 | refine h_le.eq_of_not_lt fun h_lt ↦ hA.not_lt ?_ |
| 303 | exact mem_centerPrime.mp (mem_of_dvd _ (gaussSum_dvd_natCast_of_isPrimitive hψ χ₀) |
| 304 | (mem_centerPrime.mpr h_lt)) |
| 305 | |
| 306 | /-- An injective homomorphism `S : ℤ/r → ℚ/ℤ` maps the `m`-torsion onto the `m`-torsion, for |
| 307 | `m ∣ r`. -/ |
| 308 | lemma exists_apply_eq_and_nsmul_eq_zero_of_injective {S : ZMod r →+ QZ} (hS : (⇑S).Injective) |
| 309 | {x : QZ} (hx : m • x = 0) (h_dvd : m ∣ r) : ∃ t : ZMod r, S t = x ∧ m • t = 0 := by |
| 310 | -- The image has order `r`, so it is the full subgroup of `r`-torsion. |
| 311 | have h_range : S.range = AddSubgroup.torsionBy QZ (r : ℤ) := |
| 312 | AddCircle.eq_torsionBy_of_natCard_eq (1 : ℚ) (by exact_mod_cast NeZero.ne r) |
| 313 | ((Nat.card_congr (Equiv.ofInjective S hS).symm).trans (Nat.card_zmod r)) |
| 314 | obtain ⟨t, ht⟩ : x ∈ S.range := by |
| 315 | rw [h_range, AddSubgroup.torsionBy.nsmul_iff] |
| 316 | exact Submodule.torsionBy_le_torsionBy_of_dvd m r h_dvd hx |
| 317 | exact ⟨t, ht, hS (by rw [map_nsmul, ht, hx, map_zero])⟩ |
| 318 | |
| 319 | /-- For a prime `p`, there are a primitive additive character `ψ` of `𝔽_p` and a primitive (so |
| 320 | injective) homomorphism `χ` from `ZMod (p - 1)` to the multiplicative characters of `𝔽_p`, both with |
| 321 | values in `𝓞 Ω`. -/ |
| 322 | lemma exists_addChar_isPrimitive_and_mulChar_isPrimitive : |
| 323 | ∃ (ψ : AddChar (ZMod p) (𝓞 Ω)) (χ : AddChar (ZMod p.pred) (MulChar (ZMod p) (𝓞 Ω))), |
| 324 | ψ.IsPrimitive ∧ χ.IsPrimitive := by |
| 325 | have hn_ne : NeZero p.pred := of_pos hp.out.pred_pos |
| 326 | have root (m : ℕ) [NeZero m] : ∃ ζ : 𝓞 Ω, IsPrimitiveRoot ζ m := |
| 327 | ⟨_, (exists_isPrimitiveRoot Ω m).choose_spec.toInteger_isPrimitiveRoot⟩ |
| 328 | obtain ⟨ζp, hζp⟩ := root p |
| 329 | obtain ⟨ζn, hζn⟩ := root p.pred |
| 330 | -- `χ` sends `1` to a character `χ₀` of order `p - 1`, a generator of the dual of `𝔽_pˣ`. |
| 331 | obtain ⟨χ₀, hχ₀⟩ : ∃ χ₀ : MulChar (ZMod p) (𝓞 Ω), orderOf χ₀ = p.pred := |
| 332 | exists_mulChar_orderOf (ZMod p) (by simp) hζn |
| 333 | exact ⟨_, _, zmodChar_primitive_of_primitive_root p hζp, |
| 334 | zmodChar_primitive_of_primitive_root p.pred (IsPrimitiveRoot.iff_orderOf.mpr hχ₀)⟩ |
| 335 | |
| 336 | /-- Let `A` be a place of `Ω` above a prime `q`, let `ψ` be an additive character of `𝔽_p` and |
| 337 | `t ↦ χ t` a homomorphism from `ZMod n` to the multiplicative characters of `𝔽_p`. If `q • u = 0`, |
| 338 | the Gauss sums of `χ (w + u)` and of `χ w` with `ψ` are congruent modulo the prime ideal |
| 339 | `centerPrime Ω A`: the values of `χ u` on units are `q`-th roots of unity, so `≡ 1` at `A`. -/ |
| 340 | lemma gaussSum_add_sub_gaussSum_mem_centrePrime_of_nsmul_eq_zero {n q : ℕ} [Fact q.Prime] |
| 341 | {A : ClosurePlace} (hA : A.valuation q < 1) (ψ : AddChar (ZMod p) (𝓞 Ω)) |
| 342 | (χ : AddChar (ZMod n) (MulChar (ZMod p) (𝓞 Ω))) (w u : ZMod n) (hu : q • u = 0) : |
| 343 | gaussSum (χ (w + u)) ψ - gaussSum (χ w) ψ ∈ centerPrime Ω A := by |
| 344 | simp [gaussSum, mk_centrePrime_eq_one_of_pow_eq_one hA, hu, sum_eq_add_sum_units, |
| 345 | map_add_eq_mul, ← Submodule.Quotient.mk_eq_zero, ← pow_apply_coe, ← map_nsmul_eq_pow] |
| 346 | |
| 347 | /-- Let `B` be a place of `Ω` above the prime `p` and let `c : ℕ`. There is a family `J : ℚ/ℤ → Ωˣ` |
| 348 | (written additively) such that, for every `M` with `p ≡ 1` mod `M`, its values at the points `x` |
| 349 | with `M • x = 0` have the properties `New.OddPart.IsJacobiFamily`. It is built from the Jacobi-type |
| 350 | quotients `j t = g(χ) ^ c / g(χ ^ c)` of Gauss sums over `𝔽_p` (`χ` the character of index `t`): at |
| 351 | the point `x` of index `t` it is `j t / j (-t)`. |
| 352 | |
| 353 | Such quotients of Gauss sums are used to prove Stickelberger's theorem on annihilators of class |
| 354 | groups of cyclotomic fields; no class group appears in the statement. -/ |
| 355 | lemma exists_isJacobiFamily (hB : B.valuation p < 1) (c : ℕ) : |
| 356 | ∃ J : QZ → DiscreteUnits Ω, |
| 357 | ∀ (M : ℕ) [NeZero M], p ≡ 1 [MOD M] → IsJacobiFamily p B c M J := by |
| 358 | -- Let `G t` be the Gauss sum of `χ t = χ₀ ^ t`, for a generator `χ₀` of the dual of `𝔽_pˣ`. By |
| 359 | -- `stickelberger`, `S t = ord (G t)` identifies `ZMod (p - 1)` with the `(p - 1)`-torsion of |
| 360 | -- `ℚ/ℤ`. Put `j t = G t ^ c / G (c t)` and `J (S t) = j t / j (-t)`. |
| 361 | let n : ℕ := p.pred |
| 362 | have hn_ne : NeZero n := of_pos hp.out.pred_pos |
| 363 | have h_cop : p.Coprime n := by simp [n, hp.out.one_le] |
| 364 | obtain ⟨ψ, χ, hψ, hχ⟩ := exists_addChar_isPrimitive_and_mulChar_isPrimitive (p := p) |
| 365 | -- Gauss sums divide `p`, so they are non-zero. |
| 366 | have gauss_ne (t : ZMod n) : ((gaussSum (χ t) ψ : 𝓞 Ω) : Ω) ≠ 0 := |
| 367 | RingOfIntegers.ext.mt (ne_zero_of_dvd_ne_zero out |
| 368 | (gaussSum_dvd_natCast_of_isPrimitive hψ (χ t))) |
| 369 | let G (t : ZMod n) : DiscreteUnits Ω := .ofNeZero (gaussSum (χ t) ψ : 𝓞 Ω) (gauss_ne t) |
| 370 | have hG (t : ZMod n) : (G t).toMul.val = gaussSum (χ t) ψ := rfl |
| 371 | obtain ⟨K, hK⟩ := exists_galUnitsRep_gaussSum_eq G hG |
| 372 | obtain ⟨S, hS, lift_S⟩ := stickelberger hB G hG hψ hχ h_cop |
| 373 | let j : ZMod n → DiscreteUnits Ω := c • G - G ∘ fun t : ZMod n ↦ c • t |
| 374 | let J : QZ → DiscreteUnits Ω := (⇑S).extend (j - j ∘ fun t : ZMod n ↦ -t) 0 |
| 375 | have J_S (t : ZMod n) : J (S t) = j t - j (-t) := hS.extend_apply _ 0 t |
| 376 | refine ⟨J, fun M _ hM ↦ ?_⟩ |
| 377 | have S_surj {x : QZ} (hx : M • x = 0) : ∃ t : ZMod n, S t = x ∧ M • t = 0 := |
| 378 | exists_apply_eq_and_nsmul_eq_zero_of_injective hS hx hM.symm.dvd' |
| 379 | have h_gal (x : QZ) (hx : M • x = 0) (σ : Gal(Ω/ℚ)) (a : ℕ) |
| 380 | (ha : (cyclotomicCharMod Ω M σ).val = a) : galUnitsRep σ (J x) = J (a • x) := by |
| 381 | obtain ⟨t, rfl, ht⟩ := S_surj hx |
| 382 | -- The factors `K σ` cancel in `j`, and `σ` acts on the index by `t ↦ a • t`. Test this on an |
| 383 | -- injective `μ : ZMod n →+ DiscreteUnits Ω`, where `M • μ t = 0` as `M • t = 0`. |
| 384 | let μ : ZMod n →+ DiscreteUnits Ω := (rootPowHom Ω n).val |
| 385 | have hμ : Function.Injective μ := (rootPowHom Ω n).property.left |
| 386 | have hμ_tors : M • μ t = 0 := by rw [← map_nsmul, ht, map_zero] |
| 387 | have cyc_mul : (cyclotomicCharMod Ω n σ).val * t = a • t := hμ <| by |
| 388 | rw [map_cyclotomicCharMod_mul, cyclotomicCharMod_eq_iff_unitsRep.mp ha hμ_tors, map_nsmul] |
| 389 | -- Without `-nsmul_eq_mul`, `a • t` becomes `↑a * t` and `cyc_mul` no longer applies. |
| 390 | simp [J_S, j, hK, cyc_mul, -nsmul_eq_mul, ← map_nsmul] |
| 391 | have h_unit (x : QZ) (hx : M • x = 0) (A : ClosurePlace) (hA : A.valuation p = 1) : |
| 392 | A.valuation (J x).toMul.val = 1 := by |
| 393 | obtain ⟨t, rfl, -⟩ := S_surj hx |
| 394 | simp [J_S, j, hG, valuation_gaussSum_eq_one_of_valuation_eq_one hA hψ] |
| 395 | have h_ord (x : QZ) (hx : M • x = 0) : ordRat ℚ B (J x) = floorDiff c x := by |
| 396 | obtain ⟨t, rfl, -⟩ := S_surj hx |
| 397 | -- With `x = S t`, the order of `j t` is `c ⟨x⟩ - ⟨c x⟩ = ⌊c ⟨x⟩⌋`. |
| 398 | simp [J_S, floorDiff, map_nsmul, ← nsmul_eq_mul, ← lift_S, j, ← self_sub_fract, ← fracRep_mk] |
| 399 | have h_abs (x : QZ) (hx : M • x = 0) (τ : Ω →+* ℂ) : ‖τ (J x).toMul.val‖ = 1 := by |
| 400 | obtain ⟨t, rfl, -⟩ := S_surj hx |
| 401 | -- A complex conjugation `σ` for `τ` sends `j t` to `j (-t)`, so `τ (J x)` is `z / conj z`. |
| 402 | obtain ⟨σ, hσ⟩ : ∃ σ : Gal(Ω/ℚ), ∀ z : Ω, τ (σ • z) = star τ z := |
| 403 | exists_apply_smul_eq_of_comp_algebraMap_eq Gal(Ω/ℚ) τ (star τ) (RingHom.ext_rat _ _) |
| 404 | have j_neg : j (-t) = galUnitsRep σ (j t) := by |
| 405 | simp [j, hK, IsComplexConj.cyclotomicCharMod_eq_neg_one ⟨τ, hσ⟩, ← map_nsmul] |
| 406 | -- `AlgEquiv.smul_def` would hide the action `σ • z` that `hσ` rewrites. |
| 407 | simp [J_S, j_neg, hσ, -AlgEquiv.smul_def] |
| 408 | -- The distribution relation follows from these four properties; the congruence remains. |
| 409 | refine |
| 410 | { isOfFinAddOrder_sum_sub hx r := isOfFinAddOrder_distribution hB h_gal h_unit h_ord h_abs hx |
| 411 | galUnitsRep_apply := h_gal _ |
| 412 | valuation_eq_one := h_unit _ |
| 413 | ordRat_eq := h_ord _ |
| 414 | sub_mem_principalUnits := fun hx q _ A b hb hq hA ↦ ?_ } |
| 415 | obtain ⟨t, rfl, -⟩ := S_surj hx |
| 416 | obtain ⟨s, rfl, hs⟩ := exists_apply_eq_and_nsmul_eq_zero_of_injective hS hb hq |
| 417 | -- If `q • u = 0` the values of `χ u` on units are `q`-th roots of unity, `≡ 1` at `A`. |
| 418 | -- So `G (w + u) ≡ G w`, and both are units at `A` as `q ≠ p`. |
| 419 | have hA_p : A.valuation p = 1 := (h_cop.symm.of_dvd_left hq).valuation_eq_one hA |
| 420 | have G_congr (w u : ZMod n) (hu : q • u = 0) : |
| 421 | (G (w + u) : DiscreteUnits Ω ⧸ principalUnits A) = G w := by |
| 422 | have h_val : valuationVia Ω A (gaussSum (χ (w + u)) ψ - gaussSum (χ w) ψ) < 1 := |
| 423 | mem_centerPrime.mp (gaussSum_add_sub_gaussSum_mem_centrePrime_of_nsmul_eq_zero hA ψ χ w u hu) |
| 424 | refine eq_iff_sub_mem.mpr (show A.valuation (((G (w + u) - G w).toMul : Ω) - 1) < 1 from ?_) |
| 425 | simpa [toMul_sub, valuationVia, div_sub_one, gauss_ne, map_div₀, hG, |
| 426 | valuation_gaussSum_eq_one_of_valuation_eq_one hA_p hψ] using h_val |
| 427 | have j_congr (w u : ZMod n) (hu : q • u = 0) : |
| 428 | (j (w + u) : DiscreteUnits Ω ⧸ principalUnits A) = j w := by |
| 429 | have hcu : q • c • u = 0 := by rw [smul_comm, hu, smul_zero] |
| 430 | simp [-nsmul_eq_mul, j, G_congr w u hu, G_congr _ _ hcu] |
| 431 | rw [← map_add, J_S, J_S, ← eq_iff_sub_mem, neg_add, QuotientAddGroup.mk_sub, |
| 432 | QuotientAddGroup.mk_sub, j_congr t s hs, j_congr (-t) (-s) (by rw [smul_neg, hs, neg_zero])] |
| 433 | |
| 434 | end New.OddPart |