# Roadmap: character sums over finite fields **Summary.** A character sum over a finite field `𝔽_q` adds up the values of a character, often composed with a polynomial: `∑_x χ(f(x))` for a multiplicative character `χ`, `∑_x ψ(f(x))` for an additive one. The basic examples are the Gauss sum `g(χ,ψ) = ∑_x χ(x)ψ(x)`, the Jacobi sum `J(χ₁,χ₂) = ∑_x χ₁(x)χ₂(1−x)` and the Kloosterman sum `K(χ;a,b) = ∑_{x≠0} χ(x)ψ(ax+b/x)`. A Gauss sum of two nontrivial characters has `q` terms but absolute value exactly `√q`. This roadmap develops these sums and their square-root bounds over finite fields, then modulo any integer `c`. The characters and the Gauss and Jacobi sums are Mathlib's, with complex values except in Layer 6. Unless another is named, the additive character is `ψ(x) = e(Tr(x)/p)`, with `p` the characteristic. Every multiplicative character, even the trivial one, vanishes at `0`, so the trivial one has Gauss sum `−1`. Weil's bounds come first. Let `χ ≠ 1` have order `d`, and let `f` be a nonzero polynomial with `m` distinct roots in an algebraic closure, not a constant times a `d`-th power in `𝔽_q[x]`. Then `|∑_x χ(f(x))| ≤ (m−1)√q`. If `ψ ≠ 1` and `f` has degree `n ≥ 1` prime to `p`, then `|∑_x ψ(f(x))| ≤ (n−1)√q`. For nonzero `a, b` and every `χ`, `|K(χ;a,b)| ≤ 2√q`. The proofs use Stepanov's elementary method, never a sheaf. The Hasse–Davenport relation compares Gauss sums over `F` and over an extension `E` of degree `n`: for `χ, ψ` not both trivial, `−g(χ∘N_{E/F},ψ∘Tr_{E/F}) = (−g(χ,ψ))^n`. The signs matter: the quadratic Gauss sum is `i√3` over `𝔽_3` and `3` over `𝔽_9`, not `(i√3)² = −3`. From Gauss's sign over the prime field, which Tau Ceti has, the relation gives the quadratic Gauss sum over every `𝔽_q` of odd characteristic. The last results concern prime factorization. Let `𝔓` be a prime above `p` of `K = ℚ(ζ_{q−1})`; its residue field has `q` elements. Its Teichmüller character `ω` sends each nonzero residue to the unique `(q−1)`-th root of unity reducing to it. For `0 ≤ a < q−1`, the Gauss sum `g(ω^{−a})` is an integer of `L = ℚ(ζ_{q−1},ζ_p)`, and Stickelberger's theorem gives its valuation at every prime of `L`. At a prime `𝔓̃` above `𝔓` it is `s(a)`, the sum of the base-`p` digits of `a`; Tau Ceti already has this case. Every prime above `p` is `τ_t⁻¹(𝔓̃)` for a unit `t` modulo `q−1`, where `τ_t` raises `ζ_{q−1}` to the power `t` and fixes `ζ_p`; the valuation there is `s(ta mod (q−1))`. Away from `p` it is zero. For `0 < a, b < q−1` with `a+b ≢ 0 (mod q−1)`, the Jacobi sum `J(ω^{−a},ω^{−b})` is an integer of `K` with `𝔓`-adic valuation `(s(a)+s(b)−s(a+b mod (q−1)))/(p−1)`. Within Tau Ceti, the [classical arithmetic roadmap](../ClassicalArithmeticCompletion/README.md) provides Stickelberger's congruence and relation and the Hasse–Davenport product relation. [DirichletPadicLFunctions](../DirichletPadicLFunctions/README.md) provides Morita's `p`-adic Gamma function and the Gross–Koblitz formula. The rank-two hyper-Kloosterman sums of [CongruenceSpectralGap](../CongruenceSpectralGap/README.md) are the untwisted Kloosterman sums here, and its Deligne bound in rank two is `2√q`. Modulo `c`, they are the sums `S(m,n;c)` of [AutomorphicSpectralTheory](../AutomorphicSpectralTheory/README.md). Layer 0 sets up the characters: additive characters are shifts `x ↦ ψ(ux)` of the canonical one, multiplicative ones form a cyclic group, and both lift to extensions. Layer 1 adds to Mathlib's Gauss sums their absolute value, field of definition and Galois action. Layer 2 treats Jacobi sums, including multiple ones, and Jacobsthal sums; it also counts solutions of diagonal equations. Layer 3 builds the `L`-series of a multiplicative function on monic polynomials and derives the Hasse–Davenport relation from it. Layer 4 proves Stepanov's point-count bounds, uniform over all finite extensions, and turns them into Weil's bounds through that `L`-series. Layer 5 does the same for Kloosterman sums and proves Salié's evaluation. Layer 6 reads Tau Ceti's power residue symbol as the Teichmüller character, deduces the factorization results above, and transfers the Gross–Koblitz formula to these sums. Layer 7 passes to the integers modulo `c`, where the LMFDB displays these sums. It proves `|S(m,n;c)| ≤ τ(c)(m,n,c)^{1/2}c^{1/2}` for every `c ≥ 1` and all integers `m, n`, with `τ(c)` the number of divisors and `(m,n,c)` the greatest common divisor. Layer 6 is independent of Layers 3 to 5; Layer 7 draws on Layers 0, 1, 2 and 5. ## Conventions | Object | Convention | |---|---| | The field | `F` with `[Field F] [Finite F]`; `q = Nat.card F`; `p = ringChar F`, a prime; `f` with `q = p ^ f`. The sums over `F`, and Mathlib's `gaussSum` and `jacobiSum`, which take a `Fintype` structure, read `F` through `Fintype.ofFinite F`; any two `Fintype` structures on `F` are equal (`Fintype.subsingleton`), so every statement applies to a finite field however its `Fintype` instance arises. A general finite commutative ring is `R` with `[CommRing R] [Fintype R]`, and `ZMod c` is the integer-modulus case. | | Multiplicative characters | Mathlib's `MulChar F ℂ`: `χ(0) = 0` **for every `χ`, including `χ = 1`**. So `∑_x χ(x) = 0` for `χ ≠ 1`, `∑_x 1(x) = q − 1`, `g(1) = −1` and `J(1, 1) = q − 2`. This is also the LMFDB's convention: its principal character `χ_q(1, ·)` is `0` off the units, so `τ_1(χ_q(1,·)) = μ(q)`. ⚠ Sources that set `χ(0) = 1` for the trivial character (Lidl–Niederreiter) shift `g(1)`, `J(1, χ)` and `J(1, 1)` by `1`; every statement here is checked against Mathlib's convention. | | The quadratic character | `η_F := (quadraticChar F).ringHomComp (Int.castRingHom ℂ)`, the unique character of order `2` when `p ≠ 2`; for `p = 2` it is `1`. "`η`" always means this. | | Characters of order `d` | Exist iff `d ∣ q − 1` (`MulChar.exists_mulChar_orderOf`). A **generator** `ω` of the character group is a character of exact order `q − 1`; the choice is a parameter of every statement that mentions one. The Teichmüller character of Layer 6 is the generator canonically attached to a prime of `ℚ(ζ_{q−1})` above `p`. | | The canonical additive character | `ψ_F(x) = e(Tr_{F/𝔽_p}(x)/p)`, in Lean `stdAddChar F := (ZMod.stdAddChar).compAddMonoidHom (Algebra.trace (ZMod p) F)`, with `e(t) = exp(2πit)`. For `F = ZMod p` it is Mathlib's `ZMod.stdAddChar`. It is primitive. **Every unqualified `ψ` means `ψ_F`**, and `g(χ)`, `J`, `K(χ; a, b)` without a second argument are taken against it. Mathlib's `FiniteField.primitiveChar_to_Complex F` is a primitive additive character chosen through an abstract cyclotomic extension; 0.2 shows it is `ψ_F.mulShift u` for a unique unit `u`, and no theorem here is stated against it. | | Gauss sums | `g(χ, ψ) = gaussSum χ ψ = ∑_{x ∈ F} χ(x) ψ(x)`, with the **plus sign** `e(+Tr(x)/p)`; `g(χ) := g(χ, ψ_F)`; the shifted sum `g_a(χ) := gaussSum χ (ψ_F.mulShift a) = ∑_x χ(x) ψ_F(a x)`, so `g_a(χ) = χ(a)⁻¹ g(χ)` for `a ≠ 0` (`gaussSum_mulShift_eq`). The LMFDB's `τ_a(χ)` is `g_a(χ)` over `ZMod q`. Changing only the additive sign gives `g(χ, ψ⁻¹) = χ(−1) g(χ, ψ)`; conjugation inverts both characters: `conj(g(χ, ψ)) = g(χ⁻¹, ψ⁻¹)` (`gaussSum_mulShift_eq`, `star_gaussSum_eq`). The ideal `(g)` and `|g|` are unchanged by the additive sign change. | | Jacobi sums | `J(χ, ψ) = jacobiSum χ ψ = ∑_{x ∈ F} χ(x) ψ(1 − x)`; the `r`-fold sum `J(χ₁, …, χ_r) = ∑_{x₁ + ⋯ + x_r = 1} ∏ χ_i(x_i)` and `J₀(χ₁, …, χ_r)` with `∑ x_i = 0`. | | Kloosterman sums | `K(χ; a, b) = K(χ, ψ; a, b) := ∑_{x ∈ R^×} χ(x) ψ(a x + b x⁻¹)` on a finite commutative ring `R`, `ψ` an additive character of `R`, `a, b ∈ R`. The sum is over **units**. `K(a, b) := K(1; a, b)`. On `ZMod c` with `ψ = ZMod.stdAddChar`: `S(m, n; c) := K(1; m, n)` and, for a Dirichlet character `χ` of modulus `N ∣ c`, `S_χ(m, n; c) := K(changeLevel χ; m, n)`. The LMFDB's `K(a, b, χ)` is `S_χ(a, b; q)` with `N = c = q`. | | Salié sums | `S(χ := η; a, b)`, that is `K(η; a, b)`; no separate name. | | Kloosterman angle | For `a b ≠ 0` in `F`, `θ_F(a, b) ∈ [0, π]` is defined by `K(a, b) = −2√q cos θ_F(a, b)`, equivalently the reciprocal roots of the `L`-polynomial 5.4 are `√q e^{±iθ}`. ⚠ Katz's normalization `Kl = 2√q cos θ` for the sum `−K` differs by the sign; the sign here is the one that makes `θ` the argument of a reciprocal root. | | The `L`-series of a multiplicative function | For `λ` on monic polynomials over `F` with `λ(1) = 1` and `λ(gh) = λ(g)λ(h)`: `L(λ, T) = ∑_{g monic} λ(g) T^{deg g} ∈ ℂ⟦T⟧`. The lifted sum of degree `n` is `S_n(λ) = ∑_{α ∈ E} λ(minpoly_F α)^{n / deg α}` for `E/F` of degree `n`. When `L(λ, T) = ∏_{i 1` is 3.3, derived from this one, and the case `f = 1` of `gauss_quadChar_eq` is this statement. *Needs:* 1.2, the classical arithmetic roadmap 4.19, Tau Ceti's `JacobiTheta.GaussSum`. ### 1.5 Gauss sums of characters of small order Record the consequences of `gaussSum_pow_eq_prod_jacobiSum` in the shape the worked examples use: for `orderOf χ = 3`, `g(χ)³ = q J(χ, χ)` (Tau Ceti's `gaussSum_pow_three_eq_card_mul_jacobiSum`; classical arithmetic 1.19); for `orderOf χ = 4`, `g(χ)⁴ = q J(χ, χ)²` (Tau Ceti's `gaussSum_pow_four_eq_card_mul_jacobiSum_sq`) and `g(χ)² = J(χ, χ) g(η)` (`jacobiSum_mul_nontrivial`); for `orderOf χ = 6`, `g(χ)⁶ = χ(−1) q ∏_{i=1}^{4} J(χ, χ^i)` with `χ(−1) = (−1)^{(q−1)/6}` by 0.4: `−1` for `q = 7`, `+1` for `q = 13`. The identification of `J(χ, χ)` with a primary prime for the residue characters of `ℤ[ω]` and `ℤ[i]` (exactly `π` in the cubic case, `−χ(−1) π` in the quartic case) is Tau Ceti's `jacobiSum_powerResidueSymbol_three_eq` and `jacobiSum_powerResidueSymbol_four_eq` (classical arithmetic 1.53 and 1.36), and the cube and the fourth power of those Gauss sums, `g(χ)³ = N P · π` and `g(χ)⁴ = N P · π²`, are `gaussSum_powerResidueSymbol_three_pow_three_eq` and `gaussSum_powerResidueSymbol_four_pow_four_eq` (1.19, 1.60 and 1.46); all are consumed in the worked examples and not reproved. *Needs:* 1.1, Mathlib's `gaussSum_pow_eq_prod_jacobiSum` and Tau Ceti's `JacobiSum.Cubic`, `JacobiSum.Quartic`, `Cyclotomic.Three.JacobiSum`, `Cyclotomic.Three.CubicReciprocity`, `Cyclotomic.Four.JacobiSum` and `Cyclotomic.Four.GaussSum`; nothing from Layer 2 is needed. ### Examples Over `𝔽_7`: `g(1) = −1`; for `ω` of order `6` with `ω(3) = e(1/6)`, `g(ω) = −2.4401 + 1.0226 i` with `|g(ω)|² = 7`, `g_2(ω) = ω(2)⁻¹ g(ω) = 2.1057 + 1.6019 i`, `g(ω⁷) = g(ω)` (Frobenius invariance at `p = 7`, trivially), and `g(ω)⁶ = −7 ∏_{i=1}^{4} J(ω, ω^i)`. The quadratic Gauss sums `g(η_3) = i√3`, `g(η_5) = √5`, `g(η_7) = i√7`, `g(η_11) = i√11` are the signs of 1.4, each equal to `(1 + i)/2 · (1 + (−i)^p) · √p`; at `N = 4` the same native gives `(1 + i)/2 · 2 · 2 = 2 + 2i`, which is no Gauss sum of a character modulo `4`, and is why 1.4 reads it at odd primes only. ### Dependencies Layer 0 (0.1, 0.2, 0.5); Mathlib's `GaussSum.lean` and cyclotomic fields; Tau Ceti's `GaussSum.Basic` (1.2, 1.3), `PowerResidueSymbol.StickelbergerPhi` (1.3), `JacobiSum.Cubic`, `JacobiSum.Quartic` and the `Cyclotomic.Three` and `Cyclotomic.Four` Gauss- and Jacobi-sum files (1.5); the classical arithmetic roadmap's 4.19 and Tau Ceti's `JacobiTheta.GaussSum` for 1.4. ## Layer 2: Jacobi and Jacobsthal sums ### 2.1 Jacobi sums: the trivial cases and symmetry `J(χ, ψ) = jacobiSum χ ψ`. Record from Mathlib: `J(χ, ψ) = J(ψ, χ)`; `J(1, 1) = q − 2`; `J(1, χ) = −1` for `χ ≠ 1`; `J(χ, χ⁻¹) = −χ(−1)` for `χ ≠ 1`. Prove the shift forms the point counts use: `∑_x χ(x) ψ(c − x) = χψ(c) J(χ, ψ)` for `c ≠ 0`, `∑_x χ(x) ψ(−x) = χ(−1)(q − 1)[χψ = 1]`, and `∑_x χ(x) ψ(a − b x) = χ(b)⁻¹ χψ(a) J(χ, ψ)` for `a ≠ 0`, `b ≠ 0`. *Needs:* Mathlib. ### 2.2 The Gauss–Jacobi relation, absolute value and integrality For `χ, ψ ≠ 1`, `χψ ≠ 1`: `J(χ, ψ) = g(χ) g(ψ) / g(χψ)` (Mathlib), `|J(χ, ψ)| = √q` (from 1.2), `J(χ, ψ) J(χ⁻¹, ψ⁻¹) = q`, `conj J(χ, ψ) = J(χ⁻¹, ψ⁻¹)`, and `J(χ, ψ) ∈ ℤ[ζ_m]` for `m` the lcm of the orders (`jacobiSum_mem_algebraAdjoin_of_pow_eq_one`). For `χ, ψ ≠ 1` with `χψ = 1` the value is `−χ(−1)`, of absolute value `1`; this is the **boundary check** on the hypothesis `χψ ≠ 1`. *Needs:* 1.2, Mathlib. ### 2.3 Powers of Gauss sums and the two-squares theorem Restate `gaussSum_pow_eq_prod_jacobiSum` against `ψ_F`. The two-squares shape of the quartic and cubic Jacobi sums is in Tau Ceti and is cited, not reproved: for `q ≡ 1 (mod 4)` and `χ` of order `4` with values in `𝓞_{ℚ(i)} = ℤ[i]`, `J(χ, χ) = a + b i` has norm `a² + b² = q` (`TauCeti.norm_jacobiSum_eq_card_of_orderOf_eq_four`) and `−χ(−1) J(χ, χ)` is primary, that is `≡ 1 (mod (1 + i)³)` (`TauCeti.isPrimaryGaussian_neg_apply_neg_one_mul_jacobiSum`), so `a` is odd and `b` even; for `q ≡ 1 (mod 3)` and `χ` of order `3` with values in a domain, `J(χ, χ) ≡ 2 (mod 3)` (`TauCeti.isPrimaryEisenstein_jacobiSum`), and `J(χ, χ) = a + b ω ∈ ℤ[ω]` has `a² − ab + b² = q` by 2.2. Over `𝔽_5` with `χ(2) = i`, `J(χ, χ) = −1 − 2i`: norm `5`, and `−χ(−1) J(χ, χ) = −1 − 2i` with `(−1 − 2i) − 1 = −2(1 + i)`, divisible by `(1 + i)³ = −2 + 2i` since the quotient is `−2(1 + i)/(−2 + 2i) = i`. The normalizations `J(χ, χ) = −(−1)^{(p−1)/4} π` and `J(χ, χ) = π` for the residue characters of a primary `π` are Tau Ceti's `jacobiSum_powerResidueSymbol_four_eq` and `jacobiSum_powerResidueSymbol_three_eq` (the classical arithmetic roadmap's 1.36 and 1.53); the weaker `J(χ^a, χ^b) ∈ P` for `a, b ≠ 0` with `a + b < n`, for the `n`-th power residue character `χ` of any prime `P` of norm prime to `n`, is `jacobiSum_powerResidueSymbol_pow_mem`. *Needs:* 2.2, 1.5, Tau Ceti's `Cyclotomic.Three.JacobiSum` and `Cyclotomic.Four.JacobiSum`. ### 2.4 Multiple Jacobi sums and diagonal equations Define `J(χ₁, …, χ_r) = ∑_{x₁ + ⋯ + x_r = 1} ∏ χ_i(x_i)` (`multiJacobiSum`) and `J₀(χ₁, …, χ_r) = ∑_{x₁ + ⋯ + x_r = 0} ∏ χ_i(x_i)` for `r ≥ 0` (finite sums over the fibres of `x ↦ ∑ x_i`; `r = 2` recovers `jacobiSum`). Prove: `J₀ = 0` if the product `∏χ_i ≠ 1` and `J₀ = χ_r(−1)(q − 1) J(χ₁, …, χ_{r−1})` if `∏χ_i = 1` and `r ≥ 1`; `J(χ₁, …, χ_r) = g(χ₁)⋯g(χ_r) / g(∏χ_i)` if all `χ_i ≠ 1` and `∏χ_i ≠ 1` (`multiJacobiSum_eq_prod_gauss_div`), and `J(χ₁, …, χ_r) = −χ_r(−1) J(χ₁, …, χ_{r−1})` if all `χ_i ≠ 1`, `∏χ_i = 1` and `r ≥ 1`; hence `|J(χ₁, …, χ_r)| = q^{(r−1)/2}` in the first case and `q^{(r−2)/2}` in the second, with `r ≥ 1` in both norm assertions. Deduce the **number of solutions of a diagonal equation**: for `r ≥ 1`, `a_i ∈ F^×`, `d_i ∣ q − 1` and `b ∈ F`, `#{x ∈ F^r : ∑ a_i x_i^{d_i} = b} = q^{r−1} + ∑ ∏χ_i(a_i)⁻¹ · (J or J₀ term)` over the tuples of characters `χ_i ≠ 1` with `χ_i^{d_i} = 1` (the `J` term, times `∏χ_i(b)`, for `b ≠ 0`; the `J₀` term for `b = 0`), and the bound `|N − q^{r−1}| ≤ ∏(d_i − 1) · q^{(r−1)/2}` for `r ≥ 1` and `b ≠ 0` (`card_diagonal_sub_le`; Ireland–Rosen Ch. 8 §7 and Ch. 10 §3). At every `d_i = 2` with `ringChar F ≠ 2` the count is Tau Ceti's `card_sum_mul_sq_eq_of_card_eq_two_mul_add_one` (`q^{2m} + η((−1)^m ∏ a_i · b) q^m` in rank `r = 2m + 1`) and `card_sum_mul_sq_eq_of_card_eq_two_mul_add_two` (`q^{2m+1} + η((−1)^{m+1} ∏ a_i) q^m ν(b)` in rank `r = 2m + 2`, with `ν(0) = q − 1` and `ν(b) = −1` otherwise), which the character expansion reproduces: every `χ_i` is `η`, and `J(η, …, η)` over `2m + 1` entries is `g(η)^{2m} = (η(−1) q)^m`. *Needs:* 2.2, 0.3 (the power count `#{y : y^d = c} = 1 + ∑_{χ^d = 1, χ ≠ 1} χ(c)`; the tuples with a trivial entry contribute `q^{r−1}` and `0`, the all-nontrivial tuples the Jacobi sums). The supporting API comprises: - The sums on fibres of one and zero specialize at two entries to the ordinary Jacobi sum and its zero-fibre counterpart. - For nonempty families the product character determines the recursion and the two norm formulas with their stated nontriviality hypotheses. - For `r ≥ 1`, the character expansion counts diagonal solutions and yields `card_diagonal_sub_le` when `b ≠ 0`. **Checks.** - (`r = 2`) over `𝔽_7` with `ω(3) = e(1/6)`, `J(ω, ω) = 3 − ζ_6 = 2.5 − 0.8660 i`, the same value as Mathlib's `jacobiSum ω ω`, of absolute value `√7`. - (`r = 1` and `r = 0`) `J(χ₁) = χ₁(1) = 1` for every `χ₁`, which is `g(χ₁)/g(χ₁)` when `χ₁ ≠ 1`; `J₀(χ₁) = χ₁(0) = 0`; the empty sums are `J() = 0` (no empty tuple sums to `1`) and `J₀() = 1`, so the recursion `J₀(1) = 1(−1)(q − 1) J() = 0` agrees with `J₀(1) = 1(0) = 0`. - (`r = 3`, trivial product) over `𝔽_7` with the cubic character `χ = ω²`: `J(χ, χ, χ) = −χ(−1) J(χ, χ) = −(0.5 − 2.5981 i) = −0.5 + 2.5981 i`, of absolute value `√7 = q^{(3−2)/2}`; with `(χ, χ, χ⁻¹)` the product is `χ ≠ 1` and `J = g(χ) g(χ) g(χ⁻¹)/g(χ) = χ(−1) q = 7`, which is `q^{(3−1)/2}`. - (empty diagonal equation) at `r = 0`, `b = 1` the count is `0`; no nonempty-family baseline applies. At `r = 1`, `d₁ = 1`, `a₁ = b = 1`, the count is `1`, the baseline is `1`, and the error bound is `0`. - (diagonal count) `x² + y² = 1` over `𝔽_7` has `8` solutions: `q^{r−1} + J(η, η) = 7 − η(−1) = 8`, and `|8 − 7| ≤ 1 · 1 · √7`; `x² + y² = 0` has the single solution `(0, 0)`: `7 + J₀(η, η) = 7 + η(−1)(q − 1) J(η) = 7 − 6 = 1`, where a definition dropping the `J₀` branch would predict `7`. - (odd-rank quadric) `x² + y² + z² = 1` over `𝔽_7` has `42` solutions: Tau Ceti's odd-rank count at `m = 1` is `49 + η(−1) · 7 = 42`, and the expansion gives `49 + J(η, η, η)` with `J(η, η, η) = g(η)² = η(−1) · 7 = −7`; a formula with `η(1)` in place of `η(−1)` would predict `56`. ### 2.5 Jacobsthal sums For `p ≠ 2` and `n ≥ 0` define `φ_n(a) = ∑_{x ∈ F} η(x) η(x^n + a)` (`jacobsthalPhi`) and `ψ_n(a) = ∑_{x ∈ F} η(x^n + a)` (`jacobsthalPsi`). Prove, for `n ≥ 1` and `a ≠ 0`: `ψ_n(a) = η(a) ∑_{χ^n = 1, χ ≠ 1} χ(−a) J(χ, η)` (`jacobsthalPsi_eq_sum_jacobiSum`; from `#{x : x^n = y} = ∑_{χ^n=1} χ(y)` for `y ≠ 0`, the term `x = 0` contributing `η(a)`, and 2.1), and `φ_n(a) = η(a) ∑_{χ^n = η} χ(−a) J(χ, η)` (`jacobsthalPhi_eq_sum_jacobiSum`), the sum over the characters `χ` with `χ^n = η`, which is empty, so `φ_n(a) = 0`, unless `η` is trivial on the `n`-th roots of unity of `F` (from `∑_{x^n = y} η(x) = ∑_{χ^n = η} χ(y)`). Record the closed forms: `ψ_2(a) = −1` for `a ≠ 0`, `φ_1(a) = −1`, and `φ_2(a s²) = η(s) φ_2(a)`. **Jacobsthal's two-squares identity** (`jacobsthalPhi_two_sq_add_sq`): for every finite field `F` with `q ≡ 1 (mod 4)` and every non-square `r ∈ F`, `q = (φ_2(1)/2)² + (φ_2(r)/2)²` (Jacobsthal 1907, §2, formula 3), p. 240, for `F = ZMod p`: `p = (φ(r)/2)² + (φ(n)/2)²` for a square `r` and a non-square `n`, in his notation `φ(e) = ∑_m (m/p)((m² + e)/p) = φ_2(e)`). His second-moment proof holds verbatim over `F`: by the scaling, `φ_2²` is constant on each of the two classes of `F^× / F^{×2}`, and `φ_2(0) = ∑_x η(x)³ = 0`; and `∑_e φ_2(e)² = ∑_{x, y} η(x y) ∑_e η((e + x²)(e + y²)) = q (q − 1)(1 + η(−1))`, since the inner sum is `q − 1` when `y = ±x` and `−1` otherwise (Tau Ceti's `sum_quadraticChar_mul_sub` at `c = x² − y²`, after the shift `u = e + x²`). At `η(−1) = 1` this reads `((q − 1)/2)(φ_2(1)² + φ_2(r)²) = 2q(q − 1)`. Equivalently, at `n = 2` the expansion above gives `φ_2(1) = 2 Re(χ(−1) J(χ, η))` and `φ_2(r) = ±2 Im(χ(−1) J(χ, η))` for `χ` of order `4`, and `|J(χ, η)|² = q` (2.2). **The sign of `a`** (`F = ZMod p`, `p ≡ 1 (mod 4)`): `φ_2(1) = −2a` where `p = a² + b²` with `a ≡ 1 (mod 4)` (`jacobsthalPhi_two_one`), so that `φ_2(r) = ±2b` for every non-square `r` by the identity. Jacobsthal's sign normalization 5), p. 241, `a_J ≡ (p − 3)/2 (mod 8)` for `a_J = φ(−1)/2`, becomes `a ≡ 1 (mod 4)` for `a = −φ(1)/2` through his scaling 2), `φ(1) = (i/p) φ(−1)` with `i² ≡ −1`, since `(i/p) = 1` exactly when `p ≡ 1 (mod 8)`. The sign statement is about primes: a prime has one representation `a² + b²` up to order and signs, and with `a` odd and `a ≡ 1 (mod 4)` this fixes `a`, while `q = 25` has two, `(−3)² + 4²` and `5² + 0²`, with `−3 ≡ 5 ≡ 1 (mod 4)`. **Elliptic reading**: `η(x³ + a x) = η(x) η(x² + a)`, so `∑_x η(x³ + a x) = φ_2(a)` and the projective point count of `y² = x³ + a x` is `q + 1 + φ_2(a)`, its trace `−φ_2(a)`, by the character-sum count of `EllipticLegendreCharacterInterfaces` 5.1; the vanishing `φ_2(a) = 0` for `η(−1) = −1` is that roadmap's `symmetric_cubic_trace_zero` (count `q + 1`, trace `0` for `q ≡ 3 (mod 4)`). *Needs:* 2.1, 2.2, 2.3, 0.4, Tau Ceti's `QuadraticChar.Basic`; `EllipticLegendreCharacterInterfaces` 5.1 for the elliptic reading. The supporting API comprises: - For `n ≥ 1` and `a ≠ 0`, the two sums have the stated Jacobi expansions. - For `a ≠ 0`, the closed forms are `ψ_2(a) = −1` and `φ_1(a) = −1`; scaling `a` by `s²` scales `φ_2(a)` by `η(s)`, including `s = 0` when both sides vanish. - Over every finite field with `q ≡ 1 (mod 4)` and for every non-square `r`, the halves of `φ_2(1)` and `φ_2(r)` are the two parts of a representation of `q` as a sum of two squares: `jacobsthalPhi_two_sq_add_sq`. - At primes congruent to one modulo four, the signed two-squares evaluation is `jacobsthalPhi_two_one`. **Checks.** - (zero exponent) over `𝔽_3`, `ψ_0(1) = 3η(2) = −3`, whereas the proposed Jacobi expansion would give `−1`; at `n = 1` both sides are `0`. Thus the expansion requires positive exponent even though the sum is defined at zero. - (`p = 5`) `φ_2(1) = −2`, `φ_2(2) = −4`, `ψ_2(1) = −1`; `5 = 1² + 2²` with `a = 1 ≡ 1 (mod 4)`, so `φ_2(1) = −2a` and `φ_2(2) = −2b`. - (sign of `a`) `p = 13 = (−3)² + 2²` with `a = −3 ≡ 1 (mod 4)`: `φ_2(1) = 6 = −2a`; a statement with `a = 3` or with `+2a` predicts `−6`. The values at `p = 17, 29, 37, 41` are `−2, −10, −2, −10` with `a = 1, 5, 1, 5`. - (two squares beyond the prime field) over `𝔽_9`, `φ_2(1) = 6` and `φ_2(r) = 0` for each of the four non-squares, so `9 = 3² + 0²`; over `𝔽_25`, `φ_2(1) = 6` and `φ_2(r) = ±8`, so `25 = 3² + 4²`. The sign statement does not extend: `25 = 5² + 0²` with `5 ≡ 1 (mod 4)`, and `−2 · 5 = −10 ≠ 6`. - (non-square needed) over `𝔽_13` with the square `r = 3`, `φ_2(3) = φ_2(1) = 6` and `3² + 3² = 18 ≠ 13`; over `𝔽_7`, `𝔽_11` and `𝔽_27`, where `q ≡ 3 (mod 4)`, both `φ_2(1)` and `φ_2(r)` vanish and the left side is `0`, so the identity needs `q ≡ 1 (mod 4)`. - (scaling) over `𝔽_5`, `φ_2(4) = φ_2(1 · 2²) = η(2) φ_2(1) = 2`: the four terms are `0, 1, 1, 0`. - (vanishing) over `𝔽_7`, where `η(−1) = −1`, `φ_2(1) = 0`, and `y² = x³ + x` has `8 = q + 1` projective points; over `𝔽_5` and `𝔽_13` the counts are `4 = 6 − 2` and `20 = 14 + 6`. - (degenerate) `φ_n(0) = ∑_x η(x) η(x^n) = ∑_x η(x)^{n+1}`, which is `q − 1` for `n` odd and `0` for `n` even; the Jacobi-sum expansion is stated for `a ≠ 0` only. ### Examples Over `𝔽_7` with `ω(3) = e(1/6)`: `J(ω, 1) = −1`, `J(ω, ω) = 2.5 − 0.8660 i`, `J(ω², ω²) = −1 − 3 e(1/3) = 0.5 − 2.5981 i` (the primary prime of norm `7` of Tau Ceti's `jacobiSum_powerResidueSymbol_three_eq`, classical arithmetic 1.53), `J(η, η) = 1`, `J(ω, ω⁵) = −ω(−1) = 1`. Over `𝔽_5` with `χ(2) = i`: `J(χ, χ) = −1 − 2i`, `5 = 1 + 4`. Jacobsthal: `φ_2(1) = −2, 0, 6` over `𝔽_5, 𝔽_7, 𝔽_13`. ### Dependencies Layer 1 (1.2, 1.5) and Layer 0 (0.3, 0.4); Mathlib's `JacobiSum/Basic.lean`; Tau Ceti's `PowerResidueSymbol.JacobiSum`, `Cyclotomic.Three.JacobiSum` and `Cyclotomic.Four.JacobiSum` for the normalizations of 2.3, `LegendreSymbol.QuadraticChar.Quadric` for the quadric case of 2.4 and `LegendreSymbol.QuadraticChar.Basic` for the two-squares identity of 2.5; `EllipticLegendreCharacterInterfaces` 5.1 for the elliptic reading of 2.5 only. ## Layer 3: the polynomial `L`-series and the Hasse–Davenport relations This layer isolates one piece of machinery, the `L`-series of a multiplicative function on monic polynomials, and uses it three times here and twice more in Layers 4 and 5. Its content is Ireland–Rosen's proof of the Hasse–Davenport relation (Ch. 11 §4) written once, generically. ### 3.1 The `L`-series of a multiplicative function on monic polynomials For `λ : F[X] → ℂ` with `λ(1) = 1` and `λ(g h) = λ(g) λ(h)` for monic `g, h` (`IsMonicMultiplicative λ`; the values off monic polynomials are irrelevant), define `L(λ, T) = ∑_{d ≥ 0} (∑_{g monic, deg g = d} λ(g)) T^d ∈ ℂ⟦T⟧` (`lSeries`), the coefficient sums being over the `q^d` monic polynomials `X^d + ∑_{i 1`, `e ∣ d`, `g ∈ F̄[X]` (equivalently, over `F` itself once `d ∣ q − 1`). There are `C` and `Q₀`, depending only on `d` and `m`: fix `d,m` first, choose the constants, then quantify over every finite base field `F`, every such `f` of degree `m`, and every finite extension `E/F` with `|E| = Q ≥ Q₀`, `| #{(x, y) ∈ E² : y^d = f(x)} − Q | ≤ C √Q` (`stepanov_kummer`). Route of record: Stepanov's auxiliary polynomial on the `d` branches, with 4.1. The bound is the case `Y^d − f(X)` of Schmidt's theorem for absolutely irreducible plane curves (Schmidt 1973, Satz, p. 347): for `F(X, Y) ∈ E[X, Y]` absolutely irreducible of degree `m > 0` in `X` and `n > 0` in `Y`, and `Q > 9(m + 1)²(n + 1)²`, the number `A` of solutions of `F = 0` in `E²` satisfies `|A − Q| < 2 min(m²n, n²m) √Q`; and `Y^d − f(X)` is absolutely irreducible exactly when `f` is not `c · g^e` with `e > 1`, `e ∣ d`: over `K = F̄(X)` a binomial `Y^d − a` is irreducible when `a` is not an `ℓ`-th power for every prime `ℓ ∣ d` and, for `4 ∣ d`, not in `−4 K⁴` (Capelli's criterion; the prime-exponent case is Mathlib's `irreducible_X_pow_sub_C_iff_of_prime`, `Mathlib/FieldTheory/KummerPolynomial.lean`), and for a polynomial `a = f` over the perfect field `F̄` both conditions say `f = c · g^ℓ`. So `C = 2 min(m²d, d²m)` and `Q₀ = 9(m + 1)²(d + 1)² + 1` are admissible; any explicit admissible `(C, Q₀)` is acceptable, and the statement is existential in them. The hypothesis on `f` is stable under extension of `F`, which is what makes the bound uniform in `E`. *Needs:* 4.1. ### 4.3 Stepanov's bound for Artin–Schreier equations (i) For `f ∈ F[X]` of degree `n ≥ 1` with `p ∤ n`, there are `C, Q₀` depending only on `q,n` such that for every finite base field of cardinality `q`, every such polynomial of degree `n`, and every finite extension `E/F` with `|E| = Q ≥ Q₀`, `| #{(x, y) ∈ E² : y^q − y = f(x)} − Q | ≤ C √Q` (`stepanov_artinSchreier`). (ii) For `a, b ∈ F^×` and `d ≥ 1` with `p ∤ d`, there are `C, Q₀` depending only on `q,d`, chosen before the base field of cardinality `q` and the units `a,b`, such that `| #{(x, y) ∈ E^× × E : y^q − y = a x^d + b x^{−d}} − (Q − 1) | ≤ C √Q` for `|E| = Q ≥ Q₀` (`stepanov_kloostermanCurve`). Route of record for (i): the case `Y^q − Y − f(X)` of Schmidt's theorem (Schmidt 1973, Satz, p. 347, quoted in 4.2), absolutely irreducible because a root `y₀` has `q · v(y₀) = −n · e` at the place above `∞` of `F̄(X)`, so `p ∤ n` forces the ramification index `e`, hence the degree, to be a multiple of `q`; this gives `C = 2 n q min(n, q)` and `Q₀ = 9(n + 1)²(q + 1)² + 1`. For (ii): the same theorem applied to `X^d (Y^q − Y) − a X^{2d} − b`, which has no solution with `x = 0` because `b ≠ 0` and is absolutely irreducible by the same valuation argument at `x = 0`, where `a x^d + b x^{−d}` has a pole of order `d` prime to `p` (`C = 4 d q min(2d, q) + 1`, the `+ 1` for `Q − 1` in place of `Q`); or the auxiliary polynomial in `F[x, x⁻¹]` of Iwaniec–Kowalski Ch. 11 §11.7 (the case `d = 1` is their proof of Weil's bound for Kloosterman sums), with `x^d` in place of `x`. The coefficient `q` in `y^q − y` is `|F|`, so that `#{y ∈ E : y^q − y = c} = q · [Tr_{E/F} c = 0]`. *Needs:* 4.1. **Checks.** - For `y² = x` over any finite field, each `y` gives exactly one `x`; `N = Q`, so the Kummer constants may be `C = Q₀ = 0` for degrees `(2,1)`. - For `y^q − y = x²` with odd `q` and `Q = q^{4r}`, `r ≥ 1`, additive orthogonality and the lifted quadratic Gauss sum give `N = Q − (q − 1)√Q`. At `(q,Q) = (3,81)` and `(5,625)`, `N = 63,525` and the normalized errors are `2,4`; the constants cannot depend only on the degree in `x`. - For `q = Q = 3`, `a = b = 1`, `d = 1`, the Laurent equation has no points: its right side is `2,1` at the two units, while `y³ − y = 0`. Its error from `Q − 1` is `2`. ### 4.4 The power-sum lemma If `ω : Fin k → ℂ`, `ρ > 0`, `C ≥ 0` and `|∑_i ω_i^n| ≤ C ρ^n` for all `n ≥ n₀`, then `|ω_i| ≤ ρ` for every `i`. One route uses finite Vandermonde linear algebra: group the distinct nonzero values as `z_j` with positive integer multiplicities `m_j`. Invert the matrix `(z_j^h)` for `0 ≤ h < l`, where `l` is the number of distinct nonzero values. Applied to the consecutive power sums at `n,…,n+l−1`, its fixed inverse expresses each `m_j z_j^n` as a fixed linear combination of them. Thus `|m_j z_j^n| ≤ D_j ρ^n` for a constant independent of `n`; if `|z_j| > ρ`, division by `|z_j|^n` would force the positive integer `m_j` to tend to zero. Zero roots already satisfy the bound. *Needs:* Mathlib's `Matrix.det_vandermonde` (`Mathlib/LinearAlgebra/Vandermonde.lean`), `Matrix.mul_nonsing_inv` (`Mathlib/LinearAlgebra/Matrix/NonsingularInverse.lean`) and `tendsto_pow_atTop_nhds_zero_of_norm_lt_one` (`Mathlib/Analysis/SpecificLimits/Normed.lean`). **Checks.** - For the empty family every power sum is `0` and there is no root to bound. - For roots `2,−2` and `ρ = 1`, odd power sums vanish but the even sums are `2·2^n`; a bound only on odd indices would miss both roots. - For roots `1,1`, every power sum is `2`; grouping gives multiplicity `2`, so equal roots cannot cancel. For roots `0,1`, every positive power sum is `1` and both norms are at most `1`. ### 4.5 The `L`-polynomial of a multiplicative character sum For `χ ≠ 1` of order `d` and `f ∈ F[X]` nonzero, put `λ_f(g) := χ(N_{F[X]/(g)}(f))` (`mulCharResultant χ f`), the character of the resultant `Res(g, f) = ∏_{g(α)=0} f(α)` for monic `g` (`Algebra.norm F` on `AdjoinRoot g`). It is monic multiplicative, `λ_f(X − c) = χ(f(c))`, and for `f = c ∏_P P^{e_P}` with monic irreducibles `P`, resultant reciprocity gives `λ_f(g) = χ((−1)^{deg f} c)^{deg g} ∏_P (χ^{e_P} ∘ N_{(F[X]/P)/F})(g mod P)`. The product is the character of the quotient by `rad f`, extended by zero on nonunits; the scalar factor depends on `deg g` and is constant within each coefficient sum. Prove (`lSeries_mulCharResultant`): if `f` is not of the form `c · h^d`, `h ∈ F[X]`, then `∑_{deg g = e} λ_f(g) = 0` for every `e ≥ m := deg(rad f)`, because the map `g ↦ g mod rad f` from monic polynomials of degree `e` onto `F[X]/(rad f)` is `q^{e−m}`-to-one and the quotient-character factor is nontrivial on `(F[X]/(rad f))^×`, extended by zero; its sum vanishes, and multiplication by the fixed scalar preserves zero; hence `L(λ_f, T)` is a polynomial of degree `≤ m − 1`, with `S_1(λ_f) = ∑_{x ∈ F} χ(f(x))` and `S_n(λ_f) = ∑_{x ∈ E} χ(N_{E/F} f(x))`, the lifted sum. *Needs:* 3.1, 3.2, 0.3, 0.6 (the characters of order dividing `d` of `E^×` are lifts). The boundary case: for `f = c h^d`, `∑_x χ(f(x)) = χ(c) (q − #{roots of h in F})`, which is not `O(√q)`; the hypothesis is necessary. The supporting API comprises: - On monic products the resultant character is multiplicative, and at `X − c` it is `χ(f(c))`. - At each fixed degree it is the displayed scalar times a quotient character modulo the radical. - For non-power `f`, the quotient character is nontrivial, giving the degree bound and the norm-lifted root-power identity. **Checks.** - (linear `g`) `F[X]/(X − c) ≅ F` and the norm of `f mod (X − c)` is `f(c)`, so `λ_f(X − c) = χ(f(c))`; over `𝔽_7` with `f = X`, `χ = η`: `λ_X(X − 3) = η(3) = −1`. - (quadratic `g`) over `𝔽_7`, `g = X² + 1` is irreducible (`−1` is a non-square) and `F[X]/(g) ≅ 𝔽_49` with `X ↦ i`; `N(i) = i · i⁷ = 1`, so `λ_X(X² + 1) = η(1) = 1`, in agreement with `Res(g, X) = (−1)² g(0) = 1`. - (degree zero) `g = 1`: `F[X]/(1)` is the zero algebra, Mathlib's norm on it is `1`, and `λ_f(1) = χ(1) = 1`, as monic multiplicativity requires. - (degree factor) over `𝔽_7`, `f = X`, `χ = η`, both `X − 1` and `X² − 1` reduce to `−1` modulo `X`, but their values are `1,−1`. The quotient character is `η(−1) = −1`, multiplied by `(−1)^{deg g}`; omitting that factor gives the wrong first value. - (dependence on the radical) `f = X²`, `χ = η`: `λ_f(g) = η(g(0)²) = [g(0) ≠ 0]` depends on `g` modulo `rad f = X` only; the degree-`e` coefficient sum is `q^e − q^{e−1} ≠ 0`, and indeed `f = X² = 1 · X^2` is excluded by the hypothesis. - (non-monic `g`) `λ_f(2X − 2) = λ_f(X − 1) = χ(f(1))`: the value depends on the ideal `(g)` only, and the `L`-series reads monic `g` only. ### 4.6 The `L`-polynomial of an additive character sum For `ψ ≠ 1` and `f ∈ F[X]` of degree `n ≥ 1` with `p ∤ n`, put `μ_f(g) := ψ(Tr_{F[X]/(g)}(f)) = ψ(∑_{g(α)=0} f(α))` for monic `g` (`addCharTrace ψ f`). It is monic multiplicative, `μ_f(X − c) = ψ(f(c))`, and `∑_{deg g = e} μ_f(g) = 0` for `e ≥ n`: writing `∑_{g(α)=0} f(α) = ∑_{j ≤ n} f_j p_j(g)` with `p_j` the `j`-th power sum of the roots, Newton's identities give `p_n(g) = −n c_{e−n}(g) + P(c_{e−1}, …, c_{e−n+1})` with `P` a polynomial, so for `e ≥ n` the coefficient `c_{e−n}` is free and the sum over it of `ψ(−n f_n c_{e−n} + const)` vanishes because `n f_n ≠ 0`. Hence `L(μ_f, T)` is a polynomial of degree `≤ n − 1` (`lSeries_addCharTrace`), `S_1(μ_f) = ∑_x ψ(f(x))`, and `S_n(μ_f) = ∑_{x ∈ E} ψ(Tr_{E/F} f(x))`. *Needs:* 3.1, 3.2. Boundary: for `f = X^p − X` over `F = 𝔽_p`, `∑_x ψ(f(x)) = p`, and `p ∤ n` fails; the hypothesis is necessary. The supporting API comprises: - The trace character is multiplicative on monic products and evaluates at `X − c` as `ψ(f(c))`. - When the positive degree of `f` is prime to the characteristic, the free coefficient in Newton’s identity forces all coefficient sums from that degree on to vanish. - The resulting polynomial and its trace-lifted sums satisfy `lSeries_addCharTrace` and the root-power identity of 3.2. **Checks.** - (linear `g`) `μ_f(X − c) = ψ(f(c))`; over `𝔽_7` with `f = X³`, `μ_f(X − 2) = ψ(8) = e(1/7)`. - (quadratic `g`) over `𝔽_7`, `g = X² + 1`: the roots `±i` have sum `0` and `∑ α² = −2`, so `μ_X(g) = ψ(0) = 1` and `μ_{X²}(g) = ψ(−2) = e(5/7)`. - (`n = 1`) `f = X`: the degree-`1` sum is `∑_c ψ(c) = 0` and the degree-`2` sum is `∑_{c₁, c₀} ψ(−c₁) = q · 0 = 0`, so `L(μ_X, T) = 1`, of degree `0 = n − 1`, in agreement with `∑_x ψ(x) = 0` and the bound `(n − 1)√q = 0`. - (boundary) `f = X^p − X` over `𝔽_p`: `μ_f(X − c) = ψ(0) = 1` for every `c`, the degree-`1` sum is `p ≠ 0`, and `p ∣ n = p`. ### 4.7 Weil's bound for multiplicative character sums For `χ ≠ 1` of order `d` and `f ∈ F[X]` nonzero, not of the form `c h^d`, with `m` distinct roots in `F̄`: `|∑_{x ∈ F} χ(f(x))| ≤ (m − 1) √q` (`weil_mulChar_sum_bound`), and the reciprocal roots `ω_1, …, ω_{m−1}` of `L(λ_f, T)` all satisfy `|ω_i| ≤ √q`. Proof of record. First reduce to the hypothesis of 4.2: if `f = c h^e` for some `e > 1` dividing `d` (take `e` maximal), then `∑_x χ(f(x)) = χ(c) ∑_x χ^e(h(x))` and `L(λ_f^{χ}, T) = L(λ_h^{χ^e}, χ(c) T)`, where `χ^e` has order `d/e`, `h` has the same `m` distinct roots, and `h` is not `c' h'^{d/e}`; so it suffices to prove the bound when `f` is not `c h^e` for any `e > 1` dividing `d`, which is the hypothesis of 4.2 and gives 4.5 for every nontrivial `χ'` with `χ'^d = 1`. Then, by 0.3 and 0.6, `#{(x, y) ∈ E² : y^d = f(x)} = Q + ∑_{χ'^d = 1, χ' ≠ 1} S_n(λ_f^{χ'})`, where the inner sums are the lifted sums 4.5 of the `d − 1` nontrivial characters of order dividing `d`; 4.2 bounds the left side by `C √Q` uniformly for `Q ≥ Q₀`; the root-power identity 3.2 writes the right side as `−∑ ω^n` over the union of the reciprocal roots of the `d − 1` `L`-polynomials; 4.4 gives `|ω| ≤ √q` for every one; and `S_1 = −∑ ω_i` has at most `m − 1` terms; the argument is self-contained given 4.2, 4.4, 4.5 and 3.2. (Weil 1948; Lidl–Niederreiter Ch. 5 §5.4.) *Needs:* 4.2, 4.4, 4.5, 3.2. ### 4.8 Weil's bound for additive character sums For `ψ ≠ 1` and `f ∈ F[X]` of degree `n ≥ 1` with `p ∤ n`: `|∑_{x ∈ F} ψ(f(x))| ≤ (n − 1) √q` (`weil_addChar_sum_bound`), and the reciprocal roots of `L(μ_f, T)` have `|ω_i| ≤ √q`. Proof of record: `#{(x, y) ∈ E² : y^q − y = f(x)} = Q + ∑_{t ∈ F^×} S_n(μ_f^{ψ_t})` with `ψ_t = ψ.mulShift t` (0.2 and `#{y : y^q − y = c} = ∑_{t ∈ F} ψ(t Tr c)`), 4.3 (i), 3.2 and 4.4 as in 4.7. (Weil 1948; Lidl–Niederreiter Ch. 5 §5.4.) *Needs:* 4.3, 4.4, 4.6, 3.2. ### 4.9 Point-count corollaries For `d ∣ q − 1` and `f` nonzero with `m` distinct roots that is not of the form `c h^e` for any `e > 1` dividing `d` (the hypothesis of 4.2, which makes 4.7 available for every nontrivial `χ'` with `χ'^d = 1`): `|#{(x, y) ∈ F² : y^d = f(x)} − q| ≤ (d − 1)(m − 1) √q`. The stronger hypothesis is necessary here, unlike in 4.7: `y⁴ = x²` over `𝔽_5` has `9` points, not `5`, and `y⁴ = (x² − 1)²` over `𝔽_25` has `46`, while `(d − 1)(m − 1)√q` is `0` and `15`. In particular for a squarefree `f` of degree `m ≥ 1` and `p ≠ 2`, `|#{y² = f(x)} − q| ≤ (m − 1) √q` (`card_hyperelliptic_sub_le`). For `f` as in 4.8: `|#{(x, y) ∈ F² : y^p − y = f(x)} − q| ≤ (p − 1)(n − 1) √q`. The first is the counting identity of 4.7 at `E = F` with the bounds summed. The second is not 4.8's identity at `E = F` (there `y^q − y` vanishes on `F` and the count is `q · #{x ∈ F : f(x) = 0}`); it uses `#{y ∈ F : y^p − y = c} = p · [Tr_{F/𝔽_p} c = 0] = ∑_{t ∈ 𝔽_p} ψ_F(t c)`, so the count is `q + ∑_{t ∈ 𝔽_p^×} ∑_x (ψ_F.mulShift t)(f(x))`, and 4.8 bounds each of the `p − 1` sums. *Needs:* 4.7, 4.8. **Checks.** - Over `𝔽_3`, `f = X` gives `N = 3`, so the degree-one bound is `0 ≤ 0`. - Over `𝔽_3`, `f = 1` is squarefree but gives `N = 6`: the proposed degree-zero bound would be `3 ≤ −√3`, so positive degree is essential. - Over `𝔽_5`, `f = X²` gives `N = 9`; squarefreeness fails, and the squarefree bound `4 ≤ √5` would be false. - Over `𝔽_9`, `y³ − y = x²` has `15` points, and `|15 − 9| = 6 = (p − 1)(n − 1)√q`: the Artin–Schreier bound is attained. With `y⁹ − y` in place of `y^p − y` the count is `9 = q · #{x : x² = 0}`, so an identity summing over `t ∈ F^×` instead of `t ∈ 𝔽_p^×` counts a different set. ### Examples `∑_{x ∈ 𝔽_13} η(x³ + x) = 6 ≤ 2√13 = 7.2111` (`m = 3`); `∑_{x ∈ 𝔽_7} η(x³ + x + 1) = −3`; `∑_{x ∈ 𝔽_{101}} η(x³ + x) = −2`. `|∑_{x ∈ 𝔽_7} e(x³/7)| = 4.7409 ≤ 2√7`; `∑_{x ∈ 𝔽_11} e(x³/11) = 0` (`3 ∤ 10`, cubing is a bijection); `|∑_{x ∈ 𝔽_13} e((x³ + x)/13)| = 5.6800`. For `y² = x⁴ + x + 1` over `𝔽_p`, `p < 200`, `|N − p| ≤ 0.58 · 3√p`. Off-hypothesis: `∑_{x ∈ 𝔽_p} η(x²) = p − 1` (`f = X²` is a square) and `∑_{x ∈ 𝔽_p} e((x^p − x)/p) = p` (`p ∣ deg f`). ### Dependencies 4.1–4.4 need Mathlib only (Hasse derivatives, `AlgebraicClosure`, power series); 4.5–4.6 need 3.1–3.2 and 0.3, 0.6; 4.7–4.9 need all of 4.1–4.6 and 3.2. Nothing from another roadmap. ## Layer 5: Kloosterman and Salié sums over a finite field ### 5.1 The definition on a finite commutative ring and the elementary identities For `R` a finite commutative ring, `χ : MulChar R ℂ`, `ψ : AddChar R ℂ` and `a, b ∈ R`, define `kloostermanSum χ ψ a b = ∑_{x ∈ Rˣ} χ(x) ψ(a x + b x⁻¹)`. Prove: `kloostermanSum χ ψ a 0 = gaussSum χ (ψ.mulShift a)` (the terms off the units vanish because `χ` does); `kloostermanSum 1 ψ 0 0 = #Rˣ`; symmetry `K(χ; a, b) = K(χ⁻¹; b, a)` (substitute `x ↦ x⁻¹`); scaling `K(χ; u a, u⁻¹ b) = χ(u)⁻¹ K(χ; a, b)` for a unit `u`, so `K(χ; a, b) = χ(a)⁻¹ K(χ; 1, a b)` for `a` a unit; conjugation `conj K(χ, ψ; a, b) = K(χ⁻¹, ψ⁻¹; a, b) = K(χ⁻¹, ψ; −a, −b)` (through `ψ⁻¹ = ψ.mulShift (−1)`); hence `K(1; a, b)` is **real** and `K(η; a, b)` is real or purely imaginary according as `η(−1) = ±1`. On a field `F` with `a ≠ 0`, `b = 0`: `K(χ; a, 0) = χ(a)⁻¹ g(χ)`, in particular `K(1; a, 0) = −1`. On a field `F`, for `a, b ∈ Fˣ` and every `ψ`: `kloostermanSum 1 ψ a b = hyperKloosterman F 2 ψ (a b)`, the rank-two raw hyper-Kloosterman sum of `CongruenceSpectralGap` §4.2a (the map `x ↦ (a x, b x⁻¹)` is a bijection from `Fˣ` onto the pairs of units with product `a b`); the twist `χ` and the finite ring `R` are what this milestone adds to it. *Needs:* 1.1, Mathlib; `CongruenceSpectralGap` §4.2a. The supporting API comprises: - At zero second frequency the sum is the shifted Gauss sum; with both frequencies zero and trivial multiplicative character it counts units. - Inversion exchanges the two frequencies and inverts the multiplicative character; unit scaling contributes the stated inverse character value. - Conjugation inverts both characters; over a field the untwisted sum at unit frequencies agrees with the rank-two hyper-Kloosterman sum. **Checks.** - (field) over `𝔽_7`, `K(1; 1, 1) = 2.0489` and `K(1; 1, 2) = −2.3569`, both real; `K(ω; 1, 2) = 0.6027 − 0.3479 i` for `ω(3) = e(1/6)`, and the symmetry gives `K(ω⁵; 2, 1)` the same value. - (Gauss-sum boundary) `K(ω; 1, 0) = g(ω) = −2.4401 + 1.0226 i` over `𝔽_7`, and `K(1; a, 0) = −1`. - (ring, not a field) over `ZMod 12`, `K(1; 0, 0) = #(ℤ/12)^× = φ(12) = 4`; a definition summing over all residues would give `12`, and `K(1; 1, 0) = ∑_{d ∈ (ℤ/12)^×} e(d/12) = 0 = μ(12)`. - (hyper-Kloosterman) over `𝔽_7` with `a = 1`, `b = 2`: the six pairs `(x, 2/x)` of units with product `2` give `∑ ψ(x + 2/x) = K(1; 1, 2) = −2.3569`, the value of `hyperKloosterman 𝔽_7 2 ψ 2`. - (scaling) `K(1; 2, 3) = K(1; 1, 6)` over `𝔽_7` (`u = 2`, `χ = 1`), while `K(1; 1, 6) ≠ K(1; 1, 2)`: the sum depends on `a b` and on `χ(a)`, not on `a` and `b` separately only when `χ = 1`. ### 5.2 The Gauss-sum expansion On a finite field, for every `χ` and `a, b ∈ F^×` (`kloostermanSum_eq_sum_gauss`): `K(χ; a, b) = (q − 1)⁻¹ ∑_{θ} θ(b)⁻¹ (χθ)(a)⁻¹ g(θ) g(χθ)`, the sum over all multiplicative characters `θ`. (For `a b = 0` the right side is `0` while `K(χ; a, 0) = χ(a)⁻¹ g(χ)` by 5.1: the hypothesis is not decorative.) Proof: the Fourier expansion 0.3 of `x ↦ ψ(b x⁻¹)` on `F^×` is `(q − 1)⁻¹ ∑_θ θ(b)⁻¹ g(θ) θ(x)`, and `∑_x (χθ)(x) ψ(a x) = (χθ)(a)⁻¹ g(χθ)`. Corollaries: for `a b ≠ 0`, `K(χ; a, b)` is an algebraic integer of `ℚ(ζ_{q−1}, ζ_p)`; and for `χ = 1`, `F = 𝔽_p`, `K(1; a, b) ∈ ℚ(ζ_p)^+ = ℚ(ζ_p + ζ_p⁻¹)` with Galois conjugates `K(1; t a, t b)`, `t ∈ 𝔽_p^×` (equivalently `K(1; 1, t² a b)`). *Needs:* 0.3, 1.1. ### 5.3 Salié's evaluation For `p ≠ 2` and `a, b ∈ F^×` (`kloostermanSum_quadChar_eq`): `K(η; a, b) = η(b) g(η) ∑_{y ∈ F, y² = 4 a b} ψ_F(y)`; so `K(η; a, b) = 0` when `a b` is a non-square and `K(η; a, b) = η(b) g(η) (ψ(y₀) + ψ(−y₀))` when `y₀² = 4ab`, of absolute value `≤ 2√q`. Proof of record: in the Gauss-sum expansion 5.2 the duplication formula 3.4 turns `g(θ) g(ηθ)` into `θ(4)⁻¹ g(θ²) g(η)`, so `K(η; a, b) = η(a) g(η) (q − 1)⁻¹ ∑_θ θ(4ab)⁻¹ g(θ²)`; expanding `g(θ²) = ∑_y θ(y²) ψ(y)` and summing over `θ` first, the orthogonality 0.3 leaves exactly the `y` with `y² = 4ab`. When `4ab` is a square `η(a) = η(b)`; when it is not, both sides vanish, the right as an empty sum and the left because the substitution `x ↦ b a⁻¹ x⁻¹` multiplies it by `η(ab) = −1`. (Iwaniec–Kowalski Ch. 12, Lemma 12.4, for the prime modulus.) Consequence: for `F = 𝔽_p`, `K(η; a, b) = ε_p √p (b/p) ∑_{y² ≡ 4ab} e(y/p)` (1.4). *Needs:* 5.2, 3.4, 0.3, 1.4. **Checks.** - `K(η; 1, 2)` over `𝔽_7` is `η(2) · i√7 · (e(1/7) + e(6/7)) = i√7 · 2cos(2π/7) = 3.2992 i` (`4 · 1 · 2 = 8 ≡ 1`, `y = ±1`). - `K(η; 2, 3)` over `𝔽_7` is `0` (`24 ≡ 3` is a non-square modulo `7`), and so is `K(η; 1, 2)` over `𝔽_5` (`8 ≡ 3` is a non-square modulo `5`). - A formula with `η(a)` in place of `η(b)` agrees whenever `ab` is a square and is therefore indistinguishable on the nonzero values; the stated form is the one that survives the symmetry `K(η; a, b) = K(η; b, a)` termwise. ### 5.4 The Kloosterman `L`-polynomial and the lifting relation For `a, b ∈ F^×` and any `χ`, put `κ(g) := χ(s_d(g)) ψ(a·s₁(g) + b·s_{d−1}(g)/s_d(g))` for monic `g` of degree `d` with `g(0) ≠ 0`, where `s_j` is the `j`-th elementary symmetric function of the roots (so `s_d = (−1)^d g(0)`, `s₁ = −c_{d−1}`, `s_{d−1}/s_d = ∑_{g(α)=0} 1/α`), and `κ(g) = 0` if `g(0) = 0`. Then `κ` is monic multiplicative with `κ(X − c) = χ(c) ψ(a c + b c⁻¹)`, `∑_{deg g = 1} κ(g) = K(χ; a, b)`, `∑_{deg g = 2} κ(g) = χ(−b/a) q`, and `∑_{deg g = d} κ(g) = 0` for `d ≥ 3` (the coefficient `s₁` is free and `a ≠ 0`); hence `L(κ, T) = 1 + K(χ; a, b) T + χ(−b a⁻¹) q T²`. Writing `L(κ, T) = (1 − ω₁T)(1 − ω₂T)`, `ω₁ + ω₂ = −K(χ; a, b)`, `ω₁ ω₂ = χ(−b/a) q`, and the **lifting relation** (`kloostermanSum_lift`, which also carries the absolute values of 5.5): for every finite extension `E/F` of degree `n`, `K(χ.liftNorm, ψ.liftTrace; a, b) = −(ω₁^n + ω₂^n)`. *Needs:* 3.1, 3.2, 0.6. (Lidl–Niederreiter Ch. 5 §5.5; the proof there is through 5.2 and 3.3, which is an acceptable alternative route.) **Checks.** - `𝔽_3 ⊂ 𝔽_9`, `a = b = 1`: `K_3 = −1`, `L = 1 − T + 3T²`, so `ω₁ + ω₂ = 1`, `ω₁ ω₂ = 3`, `ω² − ω + 3 = 0`, and `K_9 = −(ω₁² + ω₂²) = −(1 − 6) = 5`. - `𝔽_7 ⊂ 𝔽_49` with `χ = ω` of order `6`, `a = 1`, `b = 2`: `K(ω; 1, 2) = 0.6027 − 0.3479 i`, `ω₁ ω₂ = ω(−2) · 7`, and `K_{49} = 6.7579 − 11.7050 i = −(ω₁² + ω₂²)`. - (sign of the constant term) with `χ = 1` the constant term is `q`, so `ω₁ ω₂ = q` and the reciprocal roots are complex conjugates of modulus `√q`; a polynomial `1 + K T − q T²` would give real roots of moduli `≠ √q` for `|K| < 2√q`. ### 5.5 Weil's bound and the Kloosterman angle For `a, b ∈ F^×` and any `χ`: `|ω₁| = |ω₂| = √q`, hence `|K(χ; a, b)| ≤ 2√q` (`norm_kloostermanSum_le`). Proof of record: for `χ` of order `d`, `#{(z, y) ∈ E^× × E : y^q − y = a z^d + b z^{−d}} = (Q − 1) + ∑_{(χ', t) ≠ (1, 0)} K(χ'.liftNorm, ψ_t.liftTrace; a, b)` over the characters `χ'` of order dividing `d` and `t ∈ F` (by 0.3, 0.6 and `#{y : y^q − y = c} = ∑_t ψ(t Tr c)`), where the terms with `t = 0` and `χ' ≠ 1` vanish; 4.3 (ii) bounds the left side by `C √Q` uniformly; the root-power identity 3.2 and 4.4 give `|ω| ≤ √q` for every reciprocal root of every `L(κ_{χ', t}, T)`; and `|ω₁ ω₂| = q` forces equality. Define the **Kloosterman angle** `θ_F(a, b) ∈ [0, π]` for `χ = 1` by `K(1; a, b) = −2√q cos θ_F(a, b)`, that is `θ_F(a, b) = arccos(−K(1; a, b)/(2√q))`, so that `ω_{1,2} = √q e^{±iθ}`, and prove `K_{E}(a, b) = −2 q^{n/2} cos(n θ_F(a, b))` for `[E : F] = n`. At `χ = 1` the inequality is `CongruenceSpectralGap`'s `hyperKloosterman_bound` (§4.2b) at `k = 2`, through 5.1's identification; the proof of record above is the one that covers every `χ`. (Weil 1948; Iwaniec–Kowalski Ch. 11 §11.7; Lidl–Niederreiter Ch. 5 §5.5.) *Needs:* 5.4, 4.3, 4.4, 3.2. The supporting API comprises: - For unit frequencies the untwisted sum determines a unique angle in `[0,π]` through the negative-cosine convention. - The reciprocal roots have arguments equal to this angle and its negative. - Over a degree-`n` extension the untwisted sum is `−2 q^{n/2} cos(nθ)`. **Checks.** - `S(1, 1; 5) = (3 − √5)/2 = 0.3820`, `S(1, 1; 7) = 2.0489`, `S(1, 1; 11) = −2.3579`, `S(1, 1; 13) = 5.2595 ≤ 2√13 = 7.2111`; over `𝔽_9` the values `K(1; 1, b)` are `5, 2, −1, −4`, all `≤ 6`. - (angle) `θ_7(1, 1) = arccos(−2.0489/(2√7)) = 1.9684`, in `[0, π]`; the lifted value is `K_{49}(1, 1) = −14 cos(2 θ_7(1, 1)) = 9.8019 = −(K_7² − 14)`; Katz's normalization `Kl = 2√q cos θ'` for `−K` gives `θ' = θ`, with both sides `−2.0489`. The complement `π − θ` applies only when the same sum `K` is written with a positive cosine. - (endpoints) `θ = 0` would mean `K = −2√q` and `θ = π` would mean `K = 2√q`. Over `𝔽_p` with `p` odd neither is attained, by the second moment `∑_{c ∈ 𝔽_p^×} K(1; 1, c)² = p(p − 1) − 1` (expand the square and sum over `c` first: `p` times the `p − 1` pairs `y = −x`, minus `(∑_{x ≠ 0} ψ(x))² = 1`): a value `K(1; 1, c) = ±2√p` is carried by the automorphisms `ζ_p ↦ ζ_p^t` to `K(1; 1, t²c) = ±2√p`, so the `(p − 1)/2` values at the square class of `c` would already contribute `2p(p − 1)`. Irrationality of `√p` is not a reason: `√5 = ζ_5 + ζ_5⁴ − ζ_5² − ζ_5³` lies in `ℚ(ζ_5)^+`. At `p = 5` the values `K(1; 1, c)` are `0.3820, −3.2361, 1.2361, 2.6180` with `∑ K² = 19 = 5 · 4 − 1`; at `p = 13` the sum of the twelve squares is `155`. ### 5.6 Degenerate parameters and the trivial additive character Complete the case analysis: `K(χ, ψ; a, b)` for `ψ = 1` is `∑_{x ∈ Rˣ} χ(x) = #Rˣ·[χ = 1]`; on a field with `a = 0 ≠ b`, `K(χ; 0, b) = χ(b) g(χ⁻¹)`; with `a ≠ 0 = b`, `K(χ; a, 0) = χ(a)⁻¹ g(χ)`; with `a = b = 0`, `(q − 1)[χ = 1]`. So the bound `2√q` of 5.5 holds for all `(a, b) ≠ (0, 0)`, and at `(0, 0)` it holds for `χ ≠ 1` and reads `q − 1 ≤ 2√q` for `χ = 1`, true exactly for `q ≤ 5`. *Needs:* 5.1, 1.1. ### Examples Over `𝔽_7`: `S(1, 1; 7) = 2.0489`, `S(1, 2; 7) = −2.3569`, `θ_7(1, 1) = 1.9684`, `K(η; 1, 2) = 3.2992 i`, `K(η; 2, 3) = 0`, `K(ω; 1, 2) = 0.6027 − 0.3479 i`, `S(0, 1; 7) = −1`. Over `𝔽_9`: `K(1; 1, b) ∈ {5, 2, 2, 2, −1, −1, −4, −4}` for the eight units `b`. Over `𝔽_49`: `K(ω ∘ N; 1, 2) = 6.7579 − 11.7050 i` and `K(1; 1, 1) = 9.8019`. ### Dependencies 5.1 needs 1.1 and `CongruenceSpectralGap` §4.2a; 5.2 needs 0.3; 5.3 needs 3.4, 1.4 and 2.1; 5.4 needs 3.1–3.2 and 0.6; 5.5 needs 5.4, 4.3 (ii), 4.4 and `CongruenceSpectralGap` §4.2b for the comparison at `χ = 1`; 5.6 needs 5.1. ## Layer 6: the Teichmüller character, Stickelberger's theorem and the Gross–Koblitz evaluation Fix a prime `p`, `f ≥ 1`, `q = p^f`, a field `K` with `IsCyclotomicExtension {q − 1} ℚ K`, a prime `𝔓` of `𝓞_K` above `p`, and a field `L` with `IsCyclotomicExtension {p} K L` (so `L = ℚ(ζ_{q−1}, ζ_p)`). Let `𝔓̃` be a prime of `𝓞_L` above `𝔓` and `λ := ζ_p − 1 ∈ 𝓞_L`, the uniformizer at `𝔓̃` in which the Stickelberger congruence is written; the Gross–Koblitz element `π` of 6.4 is a different element of the completion, congruent to `λ` modulo `𝔓̃²`. The Stickelberger congruence and the digit-sum valuation of `g(ω^{−a})` are the classical arithmetic roadmap's 7.12 and 1.55; Morita's `Γ_p` and the Gross–Koblitz formula are `DirichletPadicLFunctions` §§4.1, 4.4 and 4.5. This layer reads Tau Ceti's `Ideal.powerResidueSymbol` at `n = q − 1` (the residue character of `ClassicalArithmeticCompletion` §1.23) as the Teichmüller character, records the residue cardinality, and supplies the corollaries the two roadmaps leave open, the identification of the two Teichmüller lifts, and the transport of the Gross–Koblitz formula to the Gauss and Jacobi sums of this roadmap. ### 6.1 The residue field and the Teichmüller character Record that `𝓞_K ⧸ 𝔓` is a finite field with `q` elements: `𝔓` is unramified over `p` since `p ∤ q − 1`, and for `q > 2` its residue degree is the order of `p` in `(ℤ/(q − 1))^×`, namely `f`, by Tau Ceti's cyclotomic splitting law `IsPrimitiveRoot.inertiaDeg_eq_orderOf_of_val_eq_absNorm` at the base `ℚ`, `m = q − 1`, `𝔭 = (p)` and an arithmetic Frobenius at `𝔓`; for `q = 2`, `K = ℚ` and the residue field is `𝔽_2`. Write `ω_𝔓 := Ideal.powerResidueSymbol 𝔓 (q − 1)`, Tau Ceti's power residue symbol at `n = q − 1` (the residue character of `ClassicalArithmeticCompletion` §1.23). Its source is `𝓞_K ⧸ 𝔓` and its target is `𝓞_K`; `N 𝔓 = q` is prime to `q − 1`, so the symbol is not the conventional trivial character of a prime of bad norm, and the exponent `(N 𝔓 − 1)/n` in the defining congruence is one. The specialization has the following API, each item an instance of the supplied declaration named: - It sends zero to zero and sends each nonzero `x` to the unique `(q − 1)`-th root of unity of `𝓞_K` reducing to `x` (`mk_powerResidueSymbol`, `powerResidueSymbol_eq_iff`); it is multiplicative and its order is exactly `q − 1` (`orderOf_powerResidueSymbol`). - For `m ∣ q − 1`, its power `ω_𝔓^{(q−1)/m}` is the `m`-th power residue character (`powerResidueSymbol_pow_div`), so the inverse character used in §1.47 of the supplier is `ω_𝔓^{−(q−1)/m}`. - Galois equivariance (`map_powerResidueSymbol`): a ring automorphism `σ` of `𝓞_K` carries `ω_𝔓` to the character of `σ𝔓`, `σ(ω_𝔓(x mod 𝔓)) = ω_{σ𝔓}(σx mod σ𝔓)`. - Under the ring map `𝓞_K → 𝓞_{K,𝔓}` to the completed valuation ring, it agrees on units with `TauCeti.teichmuller`; 6.4 proves this comparison by the unique-root congruence. The character depends on the prime: Galois conjugation moves both `𝔓` and its character. *Needs:* Tau Ceti's `PowerResidueSymbol.Basic` and `Cyclotomic.ResidueDegree`, Mathlib's `Ideal.Quotient.field` and `IsArithFrobAt.exists_of_isInvariant`. **Checks.** - (computation) `q = 7`, `K = ℚ(ζ_3)`, `𝔓 = (ζ_3 − 2)`, a prime of norm `7`: `ω_𝔓(2) = ζ_3`, `ω_𝔓(3) = −ζ_3²`, `ω_𝔓(5) = −ζ_3` and `ω_𝔓(−1) = −1`, so `ω_𝔓` has order `6`. - (power residue) for `q = 7`, `m = 3`: `ω_𝔓²` is the cubic residue character `x ↦ x² mod 𝔓` (`powerResidueSymbol_pow_div` at `d = 3`, the classical arithmetic roadmap's 1.23): `ω_𝔓²(2) = ζ_3² ≡ 4 = 2² (mod 𝔓)`. - (rejection) `ω_𝔓⁻¹ = ω_𝔓⁵` also has order `6`, but `ω_𝔓⁻¹(2) = ζ_3² ≡ 4 ≢ 2 (mod 𝔓)`; it is the Teichmüller character of the conjugate prime `(ζ_3² − 2)`, not of `𝔓`. - (degenerate) for `q = p = 3`, `K = ℚ` and `𝔓 = (3)`: `ω_𝔓` is the Legendre symbol `(·/3)` with values in `ℤ` (`ω_𝔓(2) = −1 ≡ 2 (mod 3)`); for `q = 2` it is the trivial character of `𝔽_2`. - (comparison) composing `ω_𝔓` on units with `𝓞_K → 𝓞_{K,𝔓}` gives Tau Ceti's local `TauCeti.teichmuller` of the Henselian ring `𝓞_{K,𝔓}`; for `q = 7` the image of `ζ_3 = ω_𝔓(2)` in `ℤ_7` is the Teichmüller representative of `2`, which is `30 = 2 + 4 · 7` modulo `49` (`30² + 30 + 1 = 19 · 49`). ### 6.2 Stickelberger's congruence and theorem, consumed Let `ψ(x) = ζ_p^{Tr(x)}` be the trace additive character of `𝓞_K ⧸ 𝔓` with values in `𝓞_L`, using the same `ζ_p` as `λ = ζ_p − 1`, and for `0 ≤ a < q − 1` put `g_a := gaussSum (ω_𝔓.ringHomComp (algebraMap 𝓞_K 𝓞_L))^{−a} ψ ∈ 𝓞_L`, with `a = ∑_{i q − 1` is allowed: the digit sum on the right is taken of the remainder of `a + b` modulo `q − 1`. The headline `jacobiSum_powerResidueSymbol_multiplicity` states it without the division, as `(p − 1) v_𝔓(J) + s(a + b mod (q − 1)) = s(a) + s(b)`, for `K` with `IsCyclotomicExtension {q − 1} ℚ K` and `𝔓` of norm `q`. The hypothesis `K = ℚ(ζ_{q−1})` enters through `v_𝔓(p) = 1`: for a number field `K` whose integers merely contain `μ_{q−1}`, `ω_𝔓` and `J` are the same elements of `ℚ(ζ_{q−1})` and the identity reads `(p − 1) v_𝔓(J) = (s(a) + s(b) − s(a + b mod (q − 1))) v_𝔓(p)`, both valuations being those of `ℚ(ζ_{q−1})` multiplied by the ramification index of `𝔓`. The weaker `J(ω^a, ω^b) ∈ 𝔓` for `a, b ≠ 0`, `a + b < q − 1` (`jacobiSum_powerResidueSymbol_pow_mem`) is the case where the base-`p` addition of `q − 1 − a` and `q − 1 − b` carries. *Needs:* 6.2, 2.2, Tau Ceti's `PowerResidueSymbol.Basic`. **Checks.** - (`q = 7`) `J(ω^{−1}, ω^{−1}) = g_1²/g_2` has `v_𝔓 = (1 + 1 − 2)/6 = 0`. - (`q = 7`) `J(ω^{−4}, ω^{−4}) = g_4²/g_2` has `v_𝔓 = (4 + 4 − 2)/6 = 1`; indeed `J(χ, χ)` for the cubic character `χ = ω^{−4} = ω^2` is the primary prime of norm `7` by Tau Ceti's `jacobiSum_powerResidueSymbol_three_eq` (classical arithmetic 1.53). - (`q = 5`, `K = ℚ(i)`, `𝔓 = (2 − i)`, `ω(2) = i`) the pairs `(a, b) = (1, 1), (1, 2), (2, 3), (3, 3)` give `J(ω^{−a}, ω^{−b}) = −1 + 2i, 1 − 2i, 1 + 2i, −1 − 2i` with `v_𝔓 = 0, 0, 1, 1`, and `4 v_𝔓 + s(a + b mod 4) = 2, 3, 5, 6 = s(a) + s(b)`; the excluded pairs `(2, 2)` and `(1, 3)` have `J = −1` and `1`, of valuation `0`, where the right side would be `4`. - (ramified base, excluded) over `K = ℚ(ζ_3, √7)` the prime `𝔓` above `(ζ_3 − 2)` has norm `7` and ramification index `2`; `ω_𝔓` is the character of `𝔽_7` of the `q = 7` Checks and `J(ω^{−4}, ω^{−4})` is the same primary prime `π = −1 − 3ζ_3` of norm `7`, but `(π) = 𝔓²` in `𝓞_K`, so `v_𝔓(J) = 2`, not `1`: the identity with `v_𝔓(7) = 2` reads `6 · 2 = (4 + 4 − 2) · 2`, and the stated form needs `K = ℚ(ζ_{q−1})`. - (`q = 7`, with `a + b > q − 1`) `J(ω^{−5}, ω^{−5})` has `v_𝔓 = (5 + 5 − 4)/6 = 1`. - (excluded boundary) for `a + b = q − 1` the Jacobi sum is `J(ω^{−a}, ω^{a}) = −ω^{−a}(−1) = ±1` (2.1), of valuation `0`, while the right side would read `(s(a) + s(q − 1 − a))/(p − 1) = f`: the hypothesis `a + b ≢ 0 (mod q − 1)` is necessary. ### 6.4 The Gross–Koblitz formula, consumed, and the identification of the two Teichmüller lifts Let `L_𝔓̃` be the completion of `L` at `𝔓̃` (`IsDedekindDomain.HeightOneSpectrum.adicCompletion`) with valuation ring `𝓞_{L_𝔓̃}`, and `K_𝔓 ⊆ L_𝔓̃` the completion of `K` at `𝔓`: since `p ∤ q − 1`, `p` is unramified in `K`, so `K_𝔓` is the unramified extension `E_f` of `ℚ_p` of degree `f`, with residue field `𝓞_K ⧸ 𝔓` of `q` elements, and `L_𝔓̃ = K_𝔓(ζ_p)` is totally ramified of degree `p − 1` over it. **Consumed** from `DirichletPadicLFunctions` §4.5: the local Teichmüller lift `ω_loc : 𝓞_K ⧸ 𝔓 → 𝓞_{K_𝔓}` (Tau Ceti's `TauCeti.teichmullerLift` of the local field `K_𝔓`, the unique zero-preserving multiplicative section of reduction, `teichmullerLift_unique`); the element `π ∈ L_𝔓̃` with `π^{p−1} = −p` and `π ≡ ζ_p − 1 (mod (ζ_p − 1)²)`, which exists and is unique for the given `ζ_p`, with `v_𝔓̃(π) = 1`; and `grossKoblitz_formula`: for `0 ≤ a < q − 1`, the negative Gauss sum `g_q(a) := −∑_{x ∈ (𝓞_K/𝔓)^×} ω_loc(x)^{−a} ζ_p^{Tr x}` equals `π^{S_p(a)} ∏_{j ⌊k/2⌋`). With the `p ∣ mn` cases this is the **conductor-weighted prime-power bound** `|S_χ(m, n; p^k)| ≤ τ(p^k) (m, n, p^k)^{1/2} 𝔠_χ^{1/2} p^{k/2}` for every prime `p`, every `k ≥ 1` and all `m, n`, `𝔠_χ` the conductor of `χ` (Knightly–Li, *Kuznetsov's trace formula and the Hecke eigenvalues of Maass forms*, §9.1, Theorem 9.3, inequality (9.7); their (9.8) sharpens the conductor factor to `𝔠_χ^{1/4} p^{1/4}`, which is not a target here; for `p = 2` the trivial bound `φ(2^k)` covers `k ≤ 6` and the stationary phase, with at most eight critical classes, the rest). *Needs:* 1.4, 5.5, 5.6, Mathlib's `ZMod` and `legendreSym`. **Checks.** - `S(1, 1; 25) = 10 cos(4π/25) = 8.7631`, `S(1, 2; 25) = 0` (`2` is a non-square modulo `5`), `S(1, 1; 27) = −2·3^{3/2} sin(4π/27) = −4.6641`, `S(1, 1; 49) = 14 cos(4π/49) = 13.5421`, `S(2, 3; 125) = −0.8428` with `ℓ = 16` (`16² = 256 ≡ 6 = 2 · 3`). - `|S_χ(1, 1; 25)| ∈ {0, 5}` for the eight primitive `χ` of order `20` modulo `25` (four each), all `≤ 2 · 5`. - (the sign factor) `S(1, 4; 125) = −21.9102` with `ℓ = 2`, a non-residue modulo `5`: the factor `(ℓ/5)³ = −1` is the sign, and the formula without it gives `+21.9102`; `S(3, 5; 121) = −19.3770` with `ℓ = 35` (`35² ≡ 15`), where `k = 2` and the factor is `(35/11)² = 1`. - `|S_χ(7, 7; 125)| = 25 = p^{(k+1)/2}` for a primitive `χ` of order `50` modulo `125`: the untwisted bound `2 p^{k/2} = 22.36` fails for twisted sums at `k = 3`. ### 7.6 Weil's bound for a general modulus For every `c ≥ 1` and all integers `m, n`: `|S(m, n; c)| ≤ τ(c) · (m, n, c)^{1/2} · c^{1/2}` (`norm_kloostermanSum_zmod_le`), with `τ(c) = σ₀(c)` the number of divisors and `(m, n, c) = gcd(gcd(m, n), c)`. Proof: 7.4 reduces to prime powers, where `τ(p^k) = k + 1 ≥ 2`; at `k = 1` the factor is 5.5 and 5.6 (`S(m, n; p)` is a Kloosterman, Gauss or Ramanujan sum); at `k ≥ 2` it is 7.5 (for `p` odd, Salié's evaluation gives `2 p^{k/2}` for `p ∤ mn`; for `p = 2` the stationary-phase count of 7.5 with `χ = 1` gives the bound `(k + 1) 2^{k/2}` for `mn` odd; for `p ∣ m`, `p ∤ n` the sum is `0`; for `p ∣ gcd(m, n)` it is `p · S(m/p, n/p; p^{k−1})`, and induction on `k` applies); the gcd factor multiplies across coprime moduli. (Weil 1948 at `k = 1`; Iwaniec–Kowalski Ch. 11, Corollary 11.12 to Theorem 11.11, equation (11.58).) **Twisted form.** For a Dirichlet character `χ` of modulus `N ∣ c` and conductor `𝔠_χ`: `|S_χ(m, n; c)| ≤ τ(c) (m, n, c)^{1/2} 𝔠_χ^{1/2} c^{1/2}` (`norm_kloostermanSum_zmod_le_of_char`; 7.4 with the conductor-weighted prime-power factors of 7.5; Knightly–Li Theorem 9.3 at prime powers and Theorem 9.2 with `n = 1` for every `c`), and for `c` **cube-free** the conductor factor can be dropped (`norm_kloostermanSum_zmod_le_of_cubefree`; 7.4 with the factors 5.5–5.6 at `k = 1` and 7.5 at `k = 2`). The factor is needed: `|S_χ(1, 15; 17³)| = 289 > τ(17³) · 17^{3/2}` (7.5; Knightly–Li's Example 9.9 gives `|S_χ(a, b; p³)| = p²` for a primitive `χ` modulo `p³` and suitable units `a, b`, which beats `τ(p³) p^{3/2} = 4 p^{3/2}` exactly from `p = 17` on). *Needs:* 7.4, 7.5, 5.5, 5.6. **Checks.** - `|S(1, 1; 15)| = 2.618 ≤ τ(15) √15 = 15.49`; `|S_χ(1, 1; 15)| = 1.9021` for `χ` of order `4` modulo `5` (`15` is cube-free). - `S(7, 1; 7) = −1`, `S(0, 0; 12) = φ(12) = 4 ≤ τ(12) · √12 · √12 = 72`. - `|S_χ(1, 15; 17³)| = 289 > 280.37 = τ(17³) 17^{3/2}`: the twisted bound carries `𝔠_χ^{1/2}` unless `c` is cube-free; the untwisted bound holds for every `c` (checked for all `m, n` and `c ≤ 60`). ### 7.7 The character page Assemble, for a Dirichlet character `χ` of modulus `q`, named by its Conrey index `n` (the unit `n` modulo `q` with `χ = conreyCharacter q n`, Tau Ceti's Conrey labelling, whose value at a unit is the Conrey pairing `conreyPairing q n`; for prime `q` this is the character with `χ(g) = e(a/(q − 1))`, `g` the Conrey generator `conreyGenerator q`, the least primitive root modulo `q²`, and `n ≡ g^a`; the labelling is consumed, and no construction of the pairing is a target), the three displayed quantities: `τ_2(χ)` (7.1), `J(χ, χ_q(1, ·))` (7.2) and `K(1, 2, χ) = S_χ(1, 2; q)` (7.3), together with the theorems that evaluate them: `|τ_2(χ)| = √q` for `χ` primitive and `q` odd, which is Tau Ceti's `DirichletCharacter.IsPrimitive.norm_gaussSum` at `e = ψ_q.mulShift 2`, a primitive character because `2` is a unit modulo odd `q` (equivalently `τ_2(χ) = χ(2)⁻¹ τ(χ)` with `|χ(2)| = 1`); for primitive `χ` and even `q`, `τ_2(χ) = 0` by `DirichletCharacter.gaussSum_mulShift_of_isPrimitive`. The primitive character modulo `4` has `τ_2 = −1 + 1 = 0`, while the quartic character modulo `5` has `|τ_2| = √5`. Also `J(χ, 1) = −1` for prime `q` and `χ ≠ 1`, `|K(1, 2, χ)| ≤ τ(q) 𝔠_χ^{1/2} √q`, and `|K(1, 2, χ)| ≤ τ(q) √q` for cube-free `q` (7.6). Nothing here depends on the Conrey labelling beyond naming the character. *Needs:* 7.1–7.3, 7.6, Tau Ceti's `DirichletCharacter.GaussSum` and `DirichletCharacter.Conrey`. ### Examples Modulo `7`, for `χ = χ_7(3, ·)` of order `6`: `τ_2(χ) = 2.1057 + 1.6019 i`, `J(χ, 1) = −1`, `K(1, 2, χ) = 0.6027 − 0.3479 i`. Modulo `5`, for the quartic `χ = χ_5(2, ·)`: `τ_2(χ) = 1.9021 + 1.1756 i`, `K(1, 2, χ) = 1.1756 − 1.1756 i`. Composite moduli: `S(1, 1; 15) = −2.6180`, `S(1, 1; 25) = 8.7631`, `S(1, 1; 27) = −4.6641`, `S(1, 1; 81) = 17.7838`, `S(1, 1; 125) = 22.2478`; `τ(1_{12}) = 0`; the imprimitive and Chinese-remainder formulas hold for every character modulo `12, 15, 18, 20` and every coprime pair `(3, 5)`, `(4, 5)`, `(3, 7)`, `(8, 3)`. ### Dependencies 0.7, 1.1, 1.4, 2.2, 5.1, 5.5, 5.6; Mathlib's Dirichlet characters and `ZMod.chineseRemainder`; Tau Ceti's `DirichletCharacter.GaussSum` (`gaussSum_mul_gaussSum_inv_eq_neg_one_mul_card_of_isPrimitive`, `IsPrimitive.norm_gaussSum` and `gaussSum_ne_zero_of_isPrimitive`; 7.1, 7.2, 7.7) and `DirichletCharacter.Conrey` (7.7); `AutomorphicSpectralTheory` §1.16 for the comparison in 7.3; Knightly–Li for the twisted bounds of 7.5–7.6. ## Downstream consumers - The LMFDB's Dirichlet character pages display exactly the quantities of 7.7: `τ_2(χ)`, `J(χ, χ_q(1, ·))` and `K(1, 2, χ)`, with the bounds of 7.6. - `CurvesOverFiniteFields` and `FunctionFieldArithmetic` border this roadmap without consuming it: the point counts of Layer 4 are finite sums bounded by Stepanov's method. Neither the comparison of the `L`-polynomials of Layers 3–5 with numerators of zeta functions nor their trace-function reading (3.6) is a target of this roadmap (Scope and ownership). ## Worked examples (acceptance criteria) Every number below was computed exactly or to ten decimals; a decimal is a target only up to the displayed precision, and every exact equality is a target. Conrey labels `q.n` name the character with Conrey index `n` (Tau Ceti's `conreyCharacter q n`); for prime `q` this is the character with `χ(g) = e(a/(q−1))` where `g` is the Conrey generator, the least primitive root modulo `q²`, and `n ≡ g^a`. ### `7.3`: the character of order `6` modulo `7` `χ = χ_7(3, ·)`, `χ(3) = e(1/6)` (`3` is the least primitive root modulo `7`), `χ(2) = e(1/3)`, `χ(−1) = χ(6) = −1`. - 1.1–1.2: `τ(χ) = g(χ) = −2.4401 + 1.0226 i`, `|τ(χ)|² = 7`; `τ_2(χ) = χ(2)⁻¹ τ(χ) = e(−1/3) τ(χ) = 2.1057 + 1.6019 i` (the LMFDB's displayed `τ_2`). - 2.1–2.2: `J(χ, 1) = −1`; `J(χ, χ) = 3 − ζ_6 = 2.5 − 0.8660 i`, of absolute value `√7`. - 1.5: `g(χ)⁶ = −7 ∏_{i=1}^{4} J(χ, χ^i)`. - 7.3, 5.5: `K(1, 2, χ) = S_χ(1, 2; 7) = 0.6027 − 0.3479 i`, `|K| ≤ 2√7`; `K(1, 0, χ) = τ(χ)`. - 5.4: over `𝔽_49`, `K(χ ∘ N; 1, 2) = 6.7579 − 11.7050 i = −(ω₁² + ω₂²)` where `1 + K(χ; 1, 2) T + χ(−2) · 7 · T² = (1 − ω₁T)(1 − ω₂T)`, and `|ω_i| = √7`. ### `7.6`: the Legendre symbol modulo `7` `η = χ_7(6, ·) = (·/7)`, `η(−1) = −1` (`7 ≡ 3 mod 4`). - 1.4: `g(η) = ε_7 √7 = i√7` (the consumed sign); `g(η)² = η(−1) · 7 = −7` (`gaussSum_sq`). - 2.1: `J(η, η) = −η(−1) = 1`; `J(η, 1) = −1`. - 5.3: `K(η; 1, 2) = η(2) g(η) (e(1/7) + e(6/7)) = i√7 · 2cos(2π/7) = 3.2992 i` (`4 · 1 · 2 = 8 ≡ 1` is a square, `y = ±1`); `K(η; 2, 3) = 0` (`24 ≡ 3` is a non-square modulo `7`). - 5.5: `S(1, 1; 7) = 2.0489`, `S(1, 2; 7) = −2.3569`, both `≤ 2√7 = 5.2915`; `θ_7(1, 1) = arccos(−2.0489/(2√7)) = 1.9684`. - 7.3: `S(7, 1; 7) = S(0, 1; 7) = −1` (the Ramanujan/Gauss degenerate case, 5.6). ### `7.2`: the cubic character modulo `7` `χ = χ_7(2, ·)`, order `3`, `χ(3) = e(1/3)` hence `χ(2) = e(2/3)`, `χ(−1) = 1`. - 1.5, 2.3: `g(χ)³ = 7 J(χ, χ)` with `J(χ, χ) = 0.5 − 2.5981 i = −1 − 3ω` (`ω = e(1/3)`), the primary prime of norm `7` of Tau Ceti's `jacobiSum_powerResidueSymbol_three_eq` (classical arithmetic 1.53), with `g(χ)³ = 7π` its `gaussSum_powerResidueSymbol_three_pow_three_eq`; `g(χ) = 2.3705 − 1.1751 i`, `g(χ)³ = 3.5 − 18.1865 i = 7(−1 − 3ω)`. - 6.1–6.3: with `𝔓` a prime of `ℚ(ζ_6) = ℚ(ζ_3)` above `7` and `ω_𝔓` its Teichmüller character, `χ = ω_𝔓^{±2}` according to the choice of `𝔓`; in `L = ℚ(ζ_42)` the two primes above `7` have `(e, f) = (6, 1)`, `v_𝔓̃(g(ω^{−a})) = a` for `a = 1, …, 5`, the other prime has valuation `6 − a` (`multiplicity_map_gaussSum_powerResidueSymbol_inv_pow` at `t = 1` and `t = 5`); at `a = 0` both valuations are `0` and `g_0 = −1`; `N_{L/ℚ}(g(ω^{−a})) = 7^6` for `a ≠ 0`, and `v_𝔓̃(g(ω^{−a}) + λ^a/a!) = a + 1` with `λ = ζ_7 − 1`. - 6.4–6.5: in `ℚ_7(ζ_7)`, `g(ω^{−a}) = −π^a Γ_7(a/6)` for `a = 1, …, 5` with `π^6 = −7`, `π ≡ λ (mod 𝔓̃²)`, `v_𝔓̃(π − λ) = 2`; and `J(ω^{−4}, ω^{−4}) = 7 Γ_7(2/3)²/Γ_7(1/3)` is the `7`-adic image of the primary prime `−1 − 3 ζ_3` under `ζ_3 ↦` the Teichmüller representative of `2` (checked to `7^9`), and not the image of its conjugate `−1 − 3 ζ_3²`, which differs from it already modulo `7`. ### `5.2`: the quartic character modulo `5`, and two-squares `χ = χ_5(2, ·)`, order `4`, `χ(2) = e(1/4) = i`, `χ(−1) = −1`. - 2.3: `J(χ, χ) = −1 − 2i`, `(−1)² + 2² = 5`; `a = −1` odd, `b = −2` even. Tau Ceti's `jacobiSum_powerResidueSymbol_four_eq` (classical arithmetic 1.36) reads `−χ(−1) J(χ, χ) = J(χ, χ) = −1 − 2i = π̄`, the primary Gaussian prime with `2 ≡ i (mod π̄)`, so `χ = (·/π̄)_4` (`−(−1)^{(5−1)/4} = +1`); the conjugate character `χ_5(3, ·)` has `J = −1 + 2i = π`, the prime of 1.36's own check. - 1.1: `τ(χ) = −1.1756 + 1.9021 i`, `τ_2(χ) = χ(2)⁻¹ τ(χ) = 1.9021 + 1.1756 i`. - 7.3: `K(1, 2, χ) = 1.1756 − 1.1756 i`. - 2.5 (Jacobsthal, `p = 5`): `φ_2(1) = −2 = −2a` with `a = 1 ≡ 1 (mod 4)`, `5 = 1² + 2²`; `φ_2(2) = −4 = −2b`; `ψ_2(1) = −1`. ### Jacobsthal's theorem at `p = 13, 17, 29, 37, 41` `φ_2(1) = 6, −2, −10, −2, −10` and the representations `p = a² + b²` with `a ≡ 1 (mod 4)` are `a = −3, 1, 5, 1, 5`: `φ_2(1) = −2a` in every case. `φ_2(r)` for the least non-square `r` is `−4, 8, −4, 12, −8 = ±2b`, and `(φ_2(1)/2)² + (φ_2(r)/2)²` is `9 + 4, 1 + 16, 25 + 4, 1 + 36, 25 + 16 = p` (`jacobsthalPhi_two_sq_add_sq`). `ψ_2(1) = −1` throughout. ### Over `𝔽_9`, `𝔽_25`, `𝔽_27`, `𝔽_49`: the Hasse–Davenport sign - 3.3: `g(η_9) = 3`, `g(η_25) = −5`, `g(η_27) = −3√3 i`, `g(η_49) = 7`, `g(η_121) = 11`; from `g(η_3) = i√3`, `g(η_5) = √5`, `g(η_7) = i√7`, `g(η_11) = i√11` and `g(η_{p^f}) = (−1)^{f−1} (ε_p√p)^f`. **Boundary check**: `g(η_9) = 3 ≠ (i√3)² = −3`: the relation is `−g' = (−g)^n`, not `g' = g^n`. - 5.4–5.5: `K_3(1, 1) = −1` over `𝔽_3`, `K_9(1, 1) = 5` over `𝔽_9` (`ω² − ω + 3 = 0`, `ω₁² + ω₂² = 1 − 6 = −5`); the eight values `K_9(1, b)`, `b ∈ 𝔽_9^×`, are `5, 2, 2, 2, −1, −1, −4, −4`, all of absolute value `≤ 2√9 = 6`. ### Hasse–Davenport product over `𝔽_13` - 3.4 with `χ = ω` of order `12` and `m = 3`, `λ = ω^4`: `∏_{j<3} g(ω^{1+4j}) = ω(3)^{−3} g(ω³) g(ω⁴) g(ω⁸) = −44.8610 + 13.5828 i`; with `χ = ω²`: `46.8722`. - Duplication (`m = 2`): `g(ω²) = ω(4) g(ω) g(ω η)/g(η)` for `ω` of order `12` over `𝔽_13`, with `g(η_13) = √13 = 3.6056`. - 2.3: `J(χ, χ) = 3 − 2i` for `χ = ω³` of order `4` (`ω(2) = e(1/12)`), `13 = 3² + 2²`. ### Weil's bounds, with the hypotheses tested - 4.7: `∑_{x ∈ 𝔽_13} η(x³ + x) = 6 ≤ 2√13 = 7.2111` (`m = 3`); `∑_{x ∈ 𝔽_7} η(x³ + x + 1) = −3 ≤ 2√7`; `∑_{x ∈ 𝔽_{101}} η(x³ + x) = −2 ≤ 2√101`. **Boundary**: `∑_{x ∈ 𝔽_p} η(x²) = p − 1`, not `≤ 0·√p`; `f = X²` is a square and 4.7 does not apply to it. - 4.8: `|∑_{x ∈ 𝔽_7} e(x³/7)| = 4.7409 ≤ 2√7`; `∑_{x ∈ 𝔽_11} e(x³/11) = 0` (`3 ∤ 10`, cubing is a bijection); `|∑_{x ∈ 𝔽_13} e((x³ + x)/13)| = 5.6800 ≤ 2√13`. **Boundary**: `∑_{x ∈ 𝔽_p} e((x^p − x)/p) = p`; `p ∣ deg f` and 4.8 does not apply. - 4.9: for `y² = x⁴ + x + 1` over `𝔽_p`, `p < 200`, `|N − p| ≤ 0.58 · 3√p`. ### Kloosterman sums to composite and prime-power moduli - 7.4: `S(1, 1; 15) = −2.6180 = S(2, 2; 3) · S(2, 2; 5) = (−1) · (2 + 2cos(2π/5))`. - 7.5: `S(1, 1; 25) = 2 · 5 · cos(4π/25) = 8.7631`; `S(1, 2; 25) = 0` (`2` is a non-square modulo `5`); `S(1, 1; 27) = −2 · 3^{3/2} sin(4π/27) = −4.6641` (`ε_{27} = i`, `(1/3)³ = 1`); `S(1, 1; 81) = 17.7838` (`ε_{81} = 1`); `S(1, 1; 49) = 14 cos(4π/49) = 13.5421`; `S(1, 3; 49) = 0`; `S(2, 3; 125) = −0.8428` (`ℓ = 16`, `16² = 256 ≡ 6 = 2·3`); `S(1, 1; 125) = 22.2478`; `S(1, 4; 125) = −21.9102` (`ℓ = 2`, `(2/5)³ = −1`). - 7.3: `S(m, 0; 12) = 0, 2, 0, −2, −4, 4` for `m = 1, 2, 3, 4, 6, 0`, the Ramanujan sums `∑_{d ∣ (m, 12)} μ(12/d) d`; `τ(1_{12}) = μ(12) = 0`. - 7.6: `|S_χ(1, 1; 15)| = 1.9021 ≤ 4√15` for `χ` of order `4` modulo `5` viewed modulo `15`; `|S_χ(1, 1; 25)| ∈ {0, 5} ≤ 2 · 5` for the eight primitive `χ` of order `20` modulo `25`. **Boundary**: `|S_χ(1, 15; 17³)| = 289 > τ(17³) · 17^{3/2} = 280.37` for a primitive `χ` of order `4624`: the twisted bound needs `c` cube-free or the conductor factor `𝔠_χ^{1/2}`. ### Jacobi and Gauss sums modulo composite `N` - 7.2: whenever `χψ` is primitive, `J(χ, ψ)τ(χψ) = τ(χ)τ(ψ)` and the denominator is nonzero, so the quotient formula holds. For an order-six character modulo `9`, `J(χ,χ⁻¹) = 0`, `τ(χ)τ(χ⁻¹) = −9`, and `τ(1_9) = 0`: the cross-multiplied equality fails (`0 ≠ −9`). Classical division by `τ(1_9)` is undefined; Lean's totalized division gives `−9/0 = 0`, so this pair does not refute the quotient equality. - 7.1: `τ(χ) = μ(N/f) χ^∗(N/f) τ(χ^∗)` for every `χ` modulo `12, 15, 18, 20`; `τ(1_{12}) = 0`, `τ(1_7) = −1`. ### Boundary and off-hypothesis checks, collected - `g(1) = −1`, `J(1, 1) = q − 2`, `J(1, χ) = −1`: Mathlib's `χ(0) = 0` convention; a source with `1(0) = 1` has `g(1) = 0` and `J(1, 1) = q` instead. - `gaussSum χ 1 = 0` for `χ ≠ 1`: the trivial additive character is excluded from every estimate. - `K(1; a, 0) = −1`, `K(1; 0, 0) = q − 1`: the Weil bound `2√q` fails only at `(0, 0)`. - `K(η; a, b) = 0` when `ab` is a non-square (5.3): the bound `2√q` is not attained there. - `J(χ, χ⁻¹) = −χ(−1)`, not of absolute value `√q`: the hypothesis `χψ ≠ 1` of 2.2. - `J(χ, χ⁻¹)τ(1) = 0 ≠ −9 = τ(χ)τ(χ⁻¹)` for the order-six character modulo `9`: the cross-multiplied identity requires the primitivity hypothesis of 7.2; totalized division masks this failure. - `f = X²` in 4.7 and `f = X^p − X` in 4.8: the non-power and `p ∤ n` hypotheses. - `S(1, 2; 25) = 0`: the non-square branch of 7.5; `S(0, 0; 12) = φ(12)`, not `12`: the sum is over units. - Stickelberger: `v(g(ω^{+a}))` at the same prime is `6 − a` for `q = 7` and `1 ≤ a ≤ 5`, not `a`: the theorem is about `ω^{−a}`. - Gross–Koblitz: `g(ω^{−a}) = −π^a Γ_7(a/6)` and not `−π^a Γ_7(1 − a/6)` for `a ≠ 3` (6.4): the fractional part is `⟨a/(q−1)⟩`; the congruence of 6.2 holds for `λ = ζ_7 − 1` and not for `π`. - `|S_χ(1, 15; 17³)| = 289 > 280.37 = τ(17³) 17^{3/2}`: the twisted Weil bound of 7.6 carries the factor `𝔠_χ^{1/2}` unless `c` is cube-free; the untwisted bound holds for every `c`. ## Provenance This section is secondary: it maps targets to existing Lean formalizations and prescribes nothing. Two Apache-2.0 repositories formalize the étale-cohomological side of the Weil conjectures, on Lean and Mathlib versions other than this roadmap's pins: [`AxiomMath/Weil`](https://github.com/AxiomMath/Weil) at commit `27cdb20` (Lean `v4.34.0-rc2`, Mathlib `16edf57`; it requires the Apache-2.0 [`AxiomMath/Stacks`](https://github.com/AxiomMath/Stacks) at commit `012108f`, cited as Stacks below) and [`formal-arithmetic-geometry/weil-conjectures`](https://github.com/formal-arithmetic-geometry/weil-conjectures) at commit `55abf46` (Lean `v4.33.1`). None of the three is a supplier: no target or route of this roadmap passes through étale cohomology or purity, and the Bombieri–Stepanov bounds of Stacks count the points of proper curves, not of the affine equations of Layer 4. The overlap is small. - **4.9.** `Weil/AlgebraicGeometry/EtaleCohomology/Trace/WeilRiemannHypothesisForm.lean` (Weil) states the Riemann-hypothesis form of the Weil conjectures for a smooth proper geometrically irreducible scheme over `𝔽_q`; `WeilConjectures/ZetaFunction/HasseWeil.lean` (weil-conjectures) proves `|N − (q + 1)| ≤ 2g√q` for a smooth proper geometrically integral curve of genus `g`, and `StacksFrontier/AlgebraicGeometry/Curves/WeilBound/WeilBound.lean` (Stacks) proves the same bound for a smooth proper geometrically irreducible curve over every finite extension of its base field, with the Bombieri–Stepanov eigenvalue bound as input. None of these files states an affine count. For `y² = f(x)`, `p ≠ 2`, with `f` squarefree of degree `m` and leading coefficient `a`, the curve bound gives the count of 4.9 once the smooth projective model is known to have genus `⌊(m − 1)/2⌋` and `1` (odd `m`) or `1 + η(a)` (even `m`) rational points at infinity, the affine error then being at most `(m − 1)√q` or `(m − 2)√q + 1 ≤ (m − 1)√q`; the counts for `y^d = f(x)` and `y^p − y = f(x)` need the genus and the points at infinity of those models as well. - **3.1 and 4.5–4.8.** weil-conjectures has the Artin–Schreier sheaf of `ψ(a x)` on the affine line with its trace function `x ↦ ψ(Tr(a x))` (`WeilConjectures/WeilSheaf/ArtinSchreierTrace.lean`), the `L`-series of a Weil sheaf as an Euler product over closed points with the logarithmic-derivative identity that 3.1 proves for monic polynomials (`WeilConjectures/WeilSheaf/LSeries.lean`), and the trace formula for the `L`-series of a lisse sheaf on a smooth geometrically connected affine curve through `H_c¹` and `H_c²` (`WeilConjectures/WeilSheaf/EulerProduct.lean`). These files do not assemble them into the `L`-polynomial of `∑_x ψ(f(x))`, its degree `deg f − 1` (4.6) or a bound. Weil proves that the `L`-function of a `ℚ_ℓ`-sheaf on a separated scheme of finite type over `𝔽_q`, given with a compactification, is rational (`Weil/AlgebraicGeometry/EtaleCohomology/Trace/LAdicTraceFormulaFinal.lean`). - **4.1–4.4.** Stacks formalizes Bombieri's form of Stepanov's method (Bombieri's Bourbaki report in the References). `StacksFrontier/RingTheory/Polynomial/HasseDerivPowChar.lean` proves that Hasse derivatives of order `0 < i < p^e` kill `p^e`-th powers and that `(X − a)^m ∣ f` when every Hasse derivative of order `< m` of `f` vanishes at `a` (4.1). For a smooth proper geometrically integral curve over `𝔽_q` with `N_m` points over `𝔽_{q^m}`, `StacksFrontier/AlgebraicGeometry/Curves/BombieriStepanov/` proves `N_m ≤ q^m + C√q^m` (`SmoothUpperBound.lean`) and `q^m ≤ N_m + C√q^m` (`LowerBoundCurve.lean`) for every `m ≥ m₀` divisible by some `d ≠ 0`, with `C`, `m₀` and `d` depending on the curve; 4.2–4.3 count the affine points of one possibly singular equation with constants chosen before the equation. `StacksFrontier/NumberTheory/TraceFormula/RiemannHypothesisBound.lean` proves that `‖∑_i α_i^m‖ ≤ C B^m` for every `m ≥ m₀` divisible by `d ≠ 0`, with `B > 0`, forces `‖α_i‖ ≤ B`; at `d = 1` this is 4.4, proved by a sector argument. - **Layers 0–2, 4.5 and 5–7.** Multiplicative characters and their Kummer sheaves, and Gauss, Jacobi and Kloosterman sums, have no counterpart in these three repositories. Additive characters do: `WeilConjectures/Mathlib/NumberTheory/LegendreSymbol/AddCharacter.lean` (weil-conjectures) defines `ψ ∘ Tr_{L/K}` for an extension `L/K` of fields, the `ψ.liftTrace` of 0.6, proves its transitivity in a tower of finite extensions and its primitivity for `ψ ≠ 1` and `L/K` finite and separable (at `K = 𝔽_p`, the primitivity of 0.1), and proves that every additive character of a finite field with values in a field is a shift `ψ.mulShift a` of a given primitive one, the surjectivity in 0.2. The Apache-2.0 [`LeanPool/lean-pool`](https://github.com/LeanPool/lean-pool) at commit `f8b9b72` (Lean `v4.35.0`, Mathlib `56a0058`) carries, in the 38 files of `LeanPool/KloostermanWeil/` (adapted from the Apache-2.0 [`charliedorsey/weil-bounds-toolkit`](https://github.com/charliedorsey/weil-bounds-toolkit) at commit `7adcd23`), Weil's bound for untwisted Kloosterman sums to a prime modulus, proved by Stepanov's method and Carlitz's lifting of these sums to `𝔽_{p^n}`. It is not a supplier: its Kloosterman sums carry no multiplicative character, its lifting relation and its bounds for these sums over a finite field are for parameters in `𝔽_p`, and its Stepanov estimate is for `y² = f(x)` only. The paths below are relative to that directory. - **4.1, 4.2 and 4.4.** `Stepanov/Algebra.lean` proves the multiplicity criterion in divisibility form, `(X − x)^l ∣ h` exactly when the Hasse derivatives of `h` of order `< l` vanish at `x`, the root count `l · #S ≤ deg h` for `h ≠ 0` divisible by `(X − x)^l` at every `x ∈ S`, and, in characteristic `p`, the vanishing of the Hasse derivatives of order `0 < k < p^e` on `X^{j p^e}` (4.1). `Stepanov/Defect.lean` proves, over a field with `q = p^e` elements, `p` odd, for `f ≠ 0` of degree `m ≥ 4` with `f(0) ≠ 0` that is not a nonzero constant times a square in `F[X]`, and for `100(m + 1)(⌊√q⌋ + 1) < q`, the estimate `|#{(x, y) ∈ F² : y² = f(x)} − q| < 80(m + 1)(⌊√q⌋ + 1) + 1`: the case `d = 2` of 4.2 in odd characteristic, with constants depending on `m` alone, under the two further hypotheses `f(0) ≠ 0` and `m ≥ 4`. `Stepanov/PowerSumSpectral.lean` proves 4.4 with `C ≥ 1`, which loses nothing, through Newton's identities and Cauchy's root bound. - **5.1 and 5.4–5.6 at `χ = 1` over `𝔽_p`.** `Weil/PrimeFoundation.lean` proves the symmetry `S(m, n; p) = S(n, m; p)`, the scaling `S(m, n; p) = S(1, m n; p)` for `m ≠ 0`, and the degenerate values `S(m, 0; p) = −1` for `m ≠ 0` and `S(0, 0; p) = p − 1`. For `t ∈ 𝔽_p`, the `Carlitz/` files define, on monic polynomials over `𝔽_p`, the weight that is the `κ` of 5.4 at `χ = 1`, `a = 1`, `b = t`, prove that its coefficient sums in degrees `1`, `2` and `≥ 3` are `K(1; 1, t)`, `p` (for `t ≠ 0`) and `0`, and derive Carlitz's generating identity; with `Stepanov/CarlitzRoots.lean` this is the lifting relation `K_{𝔽_{p^n}}(1; 1, t) = −(α^n + β^n)`, with `α + β = −K(1; 1, t)` and `α β = p`, for `t ≠ 0`. `Stepanov/PrimeWeil.lean` proves `|α| = |β| = √p` for odd `p` without 4.3 (ii): the curve `y² = (x^p − x)² − 4t` over `𝔽_{p^n}` has `p^n − 1 + ∑_{s ∈ 𝔽_p^×} K_{𝔽_{p^n}}(1; 1, s² t)` points (`Stepanov/CurveTrace.lean`, `Stepanov/PointCountBridge.lean`), and the Stepanov estimate above bounds that count. `Weil/PrimeKloosterman.lean` concludes `|S(m, n; p)| ≤ 2√p` for `m, n ∈ 𝔽_p^×` and every prime `p`, the case `p = 2` by the trivial bound. Twisted sums, a base field `𝔽_q` with `q ≠ p`, the Kloosterman angle, 5.2 and 5.3 have no counterpart there. - **7.4 and 7.6 at `χ = 1`.** `Weil/ChineseRemainderAndCompletion.lean` proves, for `N = c₁ c₂` with coprime factors, the Chinese-remainder factorization of `S(m, n; N)` with the multipliers `c̄₂ mod c₁` and `c̄₁ mod c₂`, the untwisted case of 7.4. `Weil/Contracts.lean` gives `|S(m, n; N)| ≤ 2^{ω(N)} √N` for squarefree `N` and `n` a unit modulo `N`: the case of 7.6 in which `τ(N) = 2^{ω(N)}` and `(m, n, N) = 1`. The estimates for incomplete sums over intervals in these two files are outside this roadmap (*Not owned here*). A proof adapted from any of these repositories keeps its Apache-2.0 attribution. The statements of this roadmap are specified independently of all of them. ## Scope and ownership Several roadmaps border this one. The [classical arithmetic roadmap](../ClassicalArithmeticCompletion/README.md) owns the cubic and quartic Gauss and Jacobi sums of primary primes, power residue symbols, the Stickelberger congruence and Stickelberger's relation for `Φ(P) = g(P)^m`, the Hasse–Davenport product relation (§7.29), and the reciprocity laws; this roadmap consumes those milestones by number (Layer 1, 1.55 and 7.12 there) and proves nothing about primary elements or reciprocity. The [theta-series roadmap](../ThetaSeries/README.md) owns the Gauss sums of a lattice and their reciprocity law, which are sums of `e(a‖y‖²/2c)` over `L/cL` and not character sums; it states in its scope that Gauss's sign determination is never needed there and is not its target. Gauss's evaluation `∑_{r 0` in `X` and `n > 0` in `Y`, and `Q > 9(m + 1)²(n + 1)²`, the number `A` of solutions of `F = 0` in `𝔽_Q²` satisfies `|A − Q| < 2 min(m²n, n²m) √Q`; the locator of record for 4.2 and 4.3. **W. M. Schmidt, *Equations over Finite Fields: An Elementary Approach*, LNM 536, Springer 1976.** - The book form of the method of Schmidt 1973 (Ch. I) and of the `L`-function argument of 4.4–4.8 (Ch. II); cited as background only, and no statement here relies on it. **H. Iwaniec and E. Kowalski, *Analytic Number Theory*, AMS Colloquium 53.** - Ch. 11: sums over finite fields; §11.7, the Stepanov proof of Weil's bound for Kloosterman sums, Theorem 11.11 (`|S(a, b; p)| ≤ 2√p`) and its corollary (11.58) for general moduli (4.3 (ii), 5.5, 7.6). - Ch. 12 §12.3: Kloosterman sums to prime-power moduli, twisted multiplicativity and the evaluation (12.39) (7.4–7.5); §12.4, Lemma 12.4: Salié sums (5.3). **E. Bombieri, *Counting points on curves over finite fields (d'après S. A. Stepanov)*, Sém. Bourbaki 430 (1972/73).** Background for Stepanov's method only: its Theorem 1 bounds the points of a curve of genus `g` through the Riemann–Roch theorem on the curve, which is not the polynomial form of 4.2–4.3; nothing is consumed from it. **A. Weil, *On some exponential sums*, Proc. Nat. Acad. Sci. USA 34 (1948), 204–207.** The bounds 4.7, 4.8, 5.5 as originally stated. **L. C. Washington, *Introduction to Cyclotomic Fields*, 2nd ed., GTM 83.** Ch. 6 §6.2: Gauss sums, the Stickelberger congruence and the ideal factorization (6.2). **S. Lang, *Cyclotomic Fields I and II*, GTM 121.** Ch. 1 §§1–2: the Teichmüller character and Stickelberger's theorem (6.1–6.2). **F. Beukers, H. Cohen and A. Mellit, *Finite hypergeometric functions*, arXiv:1505.02900.** Definition 1.1 (Gauss sums `g(ω^m)` for a fixed generator `ω`) and Theorem 1.3 (the reduction using the Hasse–Davenport product formula): the shape of the Gauss-sum API of Layers 1 and 3; `HypergeometricMotives` builds the same sums on Mathlib's `gaussSum` and consumes nothing here. **K. Conrad, *Gauss and Jacobi sums on finite fields and Z/mZ*.** Appendix (A.6), p. 19: the product normalization used in the supplier contract of 3.4. **B. H. Gross and N. Koblitz, *Gauss sums and the p-adic Γ-function*, Ann. of Math. 109 (1979), 569–581.** Theorem 1.7: the formula consumed in 6.4 through `DirichletPadicLFunctions` §4.5, with Morita's `Γ_p` and the normalization `π^{p−1} = −p`; Lemma 2.3: the reflection formula behind the consistency check of 6.5. **A. Knightly and C. Li, *Kuznetsov's trace formula and the Hecke eigenvalues of Maass forms*, Mem. Amer. Math. Soc. 224 (2013), no. 1055 (arXiv:1202.0189).** §9.1, Theorem 9.3 ((9.7), (9.8)): the Weil bound for twisted Kloosterman sums to a prime-power modulus with the conductor factor `𝔠_χ^{1/2}`; Theorem 9.2 (with `n = 1`): the same for every modulus; Example 9.9: `|S_χ(a, b; p³)| = p²` for primitive `χ` modulo `p³`, so the untwisted constant fails for twisted sums (7.5–7.6). **N. M. Katz, *Gauss Sums, Kloosterman Sums, and Monodromy Groups*, Annals of Math. Studies 116.** Cited only as the boundary for the equidistribution of Kloosterman angles; nothing is consumed. **P. Deligne, *Cohomologie étale* (SGA 4½), Lecture Notes in Math. 569, Springer 1977, exposé *Applications de la formule des traces aux sommes trigonométriques* [Sommes trig.].** 1.4, Définition 1.7 and (1.7.6)–(1.7.7): the sheaves of the Lang torsors of `𝔾_a` and `𝔾_m` and the normalization of their geometric-Frobenius traces; Scholie 1.9: the trace formula over every `𝔽_{q^n}`; (3.2.1): the Euler–Poincaré formula; Exemple 3.5, Proposition 4.2 and Théorème 7.4: the cohomology of `∑_x ψ(f(x))`, of the Gauss sum (with the sign of (4.1.1)) and of the Kloosterman sums. Background for 3.6 and *Not owned here*; nothing is consumed. **The LMFDB knowls** `character.dirichlet.gauss_sum`, `character.dirichlet.jacobi_sum`, `character.dirichlet.kloosterman_sum` (the definitions of 7.1–7.3) and `character.dirichlet.conrey` (the names of the worked examples).