/- Copyright (c) 2026 Wave-7 Formalization. All rights reserved. Released under Apache 2.0 license. -/ import Mathlib.AlgebraicGeometry.EllipticCurve.Affine.Point import Mathlib.FieldTheory.Finite.GaloisField import Mathlib.Analysis.Complex.Basic import Mathlib.Analysis.SpecialFunctions.Complex.LogBounds import Mathlib.Analysis.SpecialFunctions.Pow.Real import Mathlib.Tactic /-! # Exact 2/3-Torsion (`ψ₃`), Frobenius Endomorphism, `𝔽₂₅` Hasse–Weil Sharpness & Weil Zeta Rationality This standalone file establishes four major arithmetic results on elliptic curves over finite fields extending Mathlib's `WeierstrassCurve`: 1. **Exact 2-Torsion & 3-Torsion Division Polynomial `ψ₃`** (`two_torsion_iff`, `card_two_torsion_le_four`, `three_torsion_iff`, `card_three_torsion_le_nine`): On `E : y² = x³ + a x + b` (`char ≠ 2, 3`, `4 a³ + 27 b² ≠ 0`), an affine point `(x, y)` is 2-torsion iff `y = 0` (`|E[2]| ≤ 4`) and 3-torsion iff `ψ₃(x) = 3 x⁴ + 6 a x² + 12 b x - a² = 0` (`|E[3]| ≤ 9`). 2. **Frobenius Endomorphism & Rational Fixed Points** (`frobEnd`, `frobEnd_some`, `frobEnd_fixed_iff`): For any finite field `𝔽_q` and field extension `K / 𝔽_q`, the `q`-power Frobenius map `π_q : (x, y) ↦ (x^q, y^q)` is an additive group endomorphism `E(K) →+ E(K)` whose fixed-point subgroup `ker(π_q - 1)` is precisely the image of `E(𝔽_q)`. 3. **Exact Hasse–Weil Sharpness Witnesses over `𝔽₂₅`** (`hasse_weil_maximal_F25`, `hasse_weil_minimal_F25`): Over the explicit finite field `𝔽₂₅ = 𝔽₅[w] / (w² - 2)`, `E_max : y² = x³ + 1` achieves `#E_max(𝔽₂₅) = 36 = (5 + 1)² = 25 + 1 + 2√25`, while its quadratic twist `E_min : y² = x³ + 2w` achieves `#E_min(𝔽₂₅) = 16 = (5 - 1)² = 25 + 1 - 2√25`. 4. **Frobenius Trace Recurrence, Riemann Hypothesis & Weil Zeta Function Rationality** (`frobEigenvalues_norm`, `traceSeq_eq_pow_add_pow`, `traceSeq_hasse_bound`, `weilZeta_rationality_exp`, `weilZeta_functional_eq`): For any `q ≥ 1` and `t ∈ ℤ` satisfying `t² ≤ 4 q`, the Frobenius eigenvalues `α, β ∈ ℂ` satisfy `|α| = |β| = √q`, the integer trace recurrence `t_{n+2} = t t_{n+1} - q t_n` satisfies `t_n = α^n + β^n` and `|t_n| ≤ 2 q^{n/2}`, and the Weil zeta series sums identically to `exp(∑_{n≥1} ((q^n + 1 - t_n)/n) T^n) = (1 - t T + q T²) / ((1 - T)(1 - q T))` with exact functional equation `Z(1 / (q T)) = Z(T)`. -/ open Polynomial namespace EllipticTorsionZeta /-- Short Weierstrass curve `Y² = X³ + a X + b`. -/ def shortWeierstrass {R : Type*} [CommRing R] (a b : R) : WeierstrassCurve R := ⟨0, 0, 0, a, b⟩ lemma shortWeierstrass_equation_iff {R : Type*} [CommRing R] (a b x y : R) : (shortWeierstrass a b).toAffine.Equation x y ↔ y ^ 2 = x ^ 3 + a * x + b := by rw [WeierstrassCurve.Affine.equation_iff] change y ^ 2 + 0 * x * y + 0 * y = x ^ 3 + 0 * x ^ 2 + a * x + b ↔ _ constructor <;> intro h <;> linear_combination h lemma shortWeierstrass_nonsingular_iff {R : Type*} [CommRing R] (a b x y : R) : (shortWeierstrass a b).toAffine.Nonsingular x y ↔ y ^ 2 = x ^ 3 + a * x + b ∧ (2 * y ≠ 0 ∨ 3 * x ^ 2 + a ≠ 0) := by rw [WeierstrassCurve.Affine.nonsingular_iff, shortWeierstrass_equation_iff] change y ^ 2 = x ^ 3 + a * x + b ∧ (0 * y ≠ 3 * x ^ 2 + 2 * 0 * x + a ∨ y ≠ -y - 0 * x - 0) ↔ _ constructor · rintro ⟨heq, h | h⟩ · exact ⟨heq, Or.inr (fun h0 => h (by linear_combination -h0))⟩ · exact ⟨heq, Or.inl (fun h0 => h (by linear_combination h0))⟩ · rintro ⟨heq, h | h⟩ · exact ⟨heq, Or.inr (fun h0 => h (by linear_combination h0))⟩ · exact ⟨heq, Or.inl (fun h0 => h (by linear_combination -h0))⟩ lemma cubic_deriv_ne_zero_of_root {F : Type*} [Field F] {a b x : F} (hΔ : 4 * a ^ 3 + 27 * b ^ 2 ≠ 0) (hr : x ^ 3 + a * x + b = 0) : 3 * x ^ 2 + a ≠ 0 := by intro hd have ha : a = -3 * x ^ 2 := by linear_combination hd have hb : b = 2 * x ^ 3 := by linear_combination hr - x * ha apply hΔ rw [ha, hb]; ring lemma shortWeierstrass_nonsingular_of_eq {F : Type*} [Field F] {a b x y : F} (h2 : (2 : F) ≠ 0) (hΔ : 4 * a ^ 3 + 27 * b ^ 2 ≠ 0) (heq : y ^ 2 = x ^ 3 + a * x + b) : (shortWeierstrass a b).toAffine.Nonsingular x y := by rw [shortWeierstrass_nonsingular_iff] refine ⟨heq, ?_⟩ by_cases hy : y = 0 · right; exact cubic_deriv_ne_zero_of_root hΔ (by rw [← heq, hy]; ring) · left; exact mul_ne_zero h2 hy noncomputable def shortWeierstrassPointEquiv {F : Type*} [Field F] (a b : F) : (shortWeierstrass a b).toAffine.Point ≃ Option { p : F × F // (shortWeierstrass a b).toAffine.Nonsingular p.1 p.2 } where toFun | .zero => none | .some x y h => some ⟨(x, y), h⟩ invFun | none => .zero | some ⟨(x, y), h⟩ => .some x y h left_inv P := by cases P <;> rfl right_inv o := by rcases o with _ | ⟨⟨x, y⟩, h⟩ <;> rfl noncomputable instance shortWeierstrassPointFintype {F : Type*} [Field F] [Fintype F] (a b : F) : Fintype (shortWeierstrass a b).toAffine.Point := letI := Classical.decPred (fun p : F × F => (shortWeierstrass a b).toAffine.Nonsingular p.1 p.2) Fintype.ofEquiv _ (shortWeierstrassPointEquiv a b).symm /-! ## Section 1: Exact 2-Torsion & 3-Torsion Division Polynomial `ψ₃` -/ /-- **Exact 2-Torsion Characterization**: On `E : y² = x³ + a x + b` (`char ≠ 2`), an affine point `P = (x, y)` satisfies `2 • P = 0` if and only if `y = 0` (equivalently `x³ + a x + b = 0`). -/ theorem two_torsion_iff {F : Type*} [Field F] [DecidableEq F] {a b x y : F} (h2 : (2 : F) ≠ 0) (h : (shortWeierstrass a b).toAffine.Nonsingular x y) : (2 : ℕ) • (WeierstrassCurve.Affine.Point.some x y h) = 0 ↔ y = 0 := by have h2smul : (2 : ℕ) • (WeierstrassCurve.Affine.Point.some x y h) = WeierstrassCurve.Affine.Point.some x y h + WeierstrassCurve.Affine.Point.some x y h := two_nsmul _ rw [h2smul, add_eq_zero_iff_eq_neg, WeierstrassCurve.Affine.Point.neg_some, WeierstrassCurve.Affine.Point.some.injEq] change x = x ∧ y = -y - 0 * x - 0 ↔ y = 0 simp only [true_and] constructor · intro hy have : 2 * y = 0 := by linear_combination hy exact (mul_eq_zero.mp this).resolve_left h2 · intro hy; rw [hy]; ring /-- **Exact 2-Torsion Cardinality Bound**: `|E[2](F)| ≤ 4` for any finite field `F` (`char ≠ 2`). -/ theorem card_two_torsion_le_four {F : Type*} [Field F] [Fintype F] [DecidableEq F] {a b : F} (h2 : (2 : F) ≠ 0) : letI := Classical.decEq (shortWeierstrass a b).toAffine.Point (Finset.univ.filter fun P : (shortWeierstrass a b).toAffine.Point => (2 : ℕ) • P = 0).card ≤ 4 := by let _ := Classical.decEq (shortWeierstrass a b).toAffine.Point set S := Finset.univ.filter fun P : (shortWeierstrass a b).toAffine.Point => (2 : ℕ) • P = 0 set f : F[X] := X ^ 3 + C a * X + C b have hf_ne : f ≠ 0 := by intro h0; have : f.coeff 3 = 0 := by rw [h0]; simp simp [f] at this have hf_deg : f.natDegree ≤ 3 := by unfold f refine (natDegree_add_le _ _).trans (max_le ((natDegree_add_le _ _).trans (max_le ?_ ?_)) ?_) · simp · exact natDegree_mul_le.trans (by simp) · simp have hinj : (S.erase 0).card ≤ f.roots.toFinset.card := by refine Finset.card_le_card_of_injOn (fun P => match P with | .zero => 0 | .some x _ _ => x) ?_ ?_ · intro P hP simp only [Finset.mem_coe, Finset.mem_erase, Finset.mem_filter, Finset.mem_univ, true_and, S] at hP cases P with | zero => exact absurd rfl hP.1 | some x y h => have hy : y = 0 := (two_torsion_iff h2 h).mp hP.2 have heq := (shortWeierstrass_nonsingular_iff a b x y).mp h |>.1 simp only [Finset.mem_coe, Multiset.mem_toFinset, mem_roots hf_ne, IsRoot] simp only [f, eval_add, eval_pow, eval_X, eval_mul, eval_C] rw [← heq, hy]; ring · intro P₁ hP₁ P₂ hP₂ heqx simp only [Finset.mem_coe, Finset.mem_erase, Finset.mem_filter, Finset.mem_univ, true_and, S] at hP₁ hP₂ cases P₁ with | zero => exact absurd rfl hP₁.1 | some x₁ y₁ h₁ => cases P₂ with | zero => exact absurd rfl hP₂.1 | some x₂ y₂ h₂ => have hy₁ : y₁ = 0 := (two_torsion_iff h2 h₁).mp hP₁.2 have hy₂ : y₂ = 0 := (two_torsion_iff h2 h₂).mp hP₂.2 simp only [WeierstrassCurve.Affine.Point.some.injEq] exact ⟨heqx, hy₁.trans hy₂.symm⟩ have hroots : f.roots.toFinset.card ≤ 3 := (Multiset.toFinset_card_le _).trans ((Polynomial.card_roots' f).trans hf_deg) have h0mem : (0 : (shortWeierstrass a b).toAffine.Point) ∈ S := by simp [S] have hcard : S.card = (S.erase 0).card + 1 := (Finset.card_erase_add_one h0mem).symm change S.card ≤ 4 omega /-- The 3-division polynomial `ψ₃(X) = 3 X⁴ + 6 a X² + 12 b X - a²` of `y² = x³ + a x + b`. -/ noncomputable def psi3 {R : Type*} [CommRing R] (a b : R) : R[X] := C 3 * X ^ 4 + C (6 * a) * X ^ 2 + C (12 * b) * X - C (a ^ 2) lemma eval_psi3 {R : Type*} [CommRing R] (a b x : R) : (psi3 a b).eval x = 3 * x ^ 4 + 6 * a * x ^ 2 + 12 * b * x - a ^ 2 := by simp [psi3] /-- **Exact 3-Torsion Characterization via `ψ₃`**: On `E : y² = x³ + a x + b` (`char ≠ 2`, `4 a³ + 27 b² ≠ 0`), an affine point `P = (x, y)` satisfies `3 • P = 0` if and only if `ψ₃(x) = 3 x⁴ + 6 a x² + 12 b x - a² = 0`. -/ theorem three_torsion_iff {F : Type*} [Field F] [DecidableEq F] {a b x y : F} (h2 : (2 : F) ≠ 0) (hΔ : 4 * a ^ 3 + 27 * b ^ 2 ≠ 0) (h : (shortWeierstrass a b).toAffine.Nonsingular x y) : (3 : ℕ) • (WeierstrassCurve.Affine.Point.some x y h) = 0 ↔ (psi3 a b).eval x = 0 := by have heq : y ^ 2 = x ^ 3 + a * x + b := (shortWeierstrass_nonsingular_iff a b x y).mp h |>.1 have hpsi_id : (psi3 a b).eval x = 12 * x * y ^ 2 - (3 * x ^ 2 + a) ^ 2 := by rw [eval_psi3, heq]; ring have h3smul : (3 : ℕ) • (WeierstrassCurve.Affine.Point.some x y h) = (WeierstrassCurve.Affine.Point.some x y h + WeierstrassCurve.Affine.Point.some x y h) + WeierstrassCurve.Affine.Point.some x y h := by rw [show (3 : ℕ) = 2 + 1 from rfl, add_nsmul, two_nsmul, one_nsmul] rw [h3smul, add_eq_zero_iff_eq_neg] by_cases hy : y = 0 · have h2P : WeierstrassCurve.Affine.Point.some x y h + WeierstrassCurve.Affine.Point.some x y h = 0 := by have := (two_torsion_iff h2 h).mpr hy rwa [two_nsmul] at this rw [h2P] have hneg_ne : (0 : (shortWeierstrass a b).toAffine.Point) ≠ -(WeierstrassCurve.Affine.Point.some x y h) := by rw [WeierstrassCurve.Affine.Point.neg_some] exact (WeierstrassCurve.Affine.Point.some_ne_zero _).symm have hpsi_ne : (psi3 a b).eval x ≠ 0 := by rw [hpsi_id, hy] have hd := cubic_deriv_ne_zero_of_root hΔ (by rw [← heq, hy]; ring) simp only [zero_pow (by norm_num : 2 ≠ 0), mul_zero, zero_sub, neg_ne_zero] exact pow_ne_zero 2 hd exact ⟨fun h0 => absurd h0 hneg_ne, fun h0 => absurd h0 hpsi_ne⟩ · have hneg : y ≠ (shortWeierstrass a b).toAffine.negY x y := by change y ≠ -y - 0 * x - 0 intro h0 exact mul_ne_zero h2 hy (by linear_combination h0) have hxy : ¬ (x = x ∧ y = (shortWeierstrass a b).toAffine.negY x y) := fun h' => hneg h'.2 have h2P : WeierstrassCurve.Affine.Point.some x y h + WeierstrassCurve.Affine.Point.some x y h = WeierstrassCurve.Affine.Point.some _ _ ((shortWeierstrass a b).toAffine.nonsingular_add h h hxy) := WeierstrassCurve.Affine.Point.add_some hxy set x2 := (shortWeierstrass a b).toAffine.addX x x ((shortWeierstrass a b).toAffine.slope x x y y) have hx2_eq : x2 = ((3 * x ^ 2 + a) / (2 * y)) ^ 2 - 2 * x := by change (shortWeierstrass a b).toAffine.addX x x ((shortWeierstrass a b).toAffine.slope x x y y) = _ rw [WeierstrassCurve.Affine.slope_of_Y_ne rfl hneg] change ((3 * x ^ 2 + 2 * 0 * x + a - 0 * y) / (y - (-y - 0 * x - 0))) ^ 2 + 0 * ((3 * x ^ 2 + 2 * 0 * x + a - 0 * y) / (y - (-y - 0 * x - 0))) - 0 - x - x = _ have h2y : y - (-y - 0 * x - 0) = 2 * y := by ring have hnum : 3 * x ^ 2 + 2 * 0 * x + a - 0 * y = 3 * x ^ 2 + a := by ring rw [h2y, hnum]; ring have hx2_iff : x2 = x ↔ (psi3 a b).eval x = 0 := by rw [hx2_eq, hpsi_id] have h2y : 2 * y ≠ 0 := mul_ne_zero h2 hy have h4y2 : (2 * y) ^ 2 ≠ 0 := pow_ne_zero 2 h2y constructor · intro h' have h1 : ((3 * x ^ 2 + a) / (2 * y)) ^ 2 = 3 * x := by linear_combination h' rw [div_pow, div_eq_iff h4y2] at h1 linear_combination -h1 · intro h' have h1 : (3 * x ^ 2 + a) ^ 2 = 3 * x * (2 * y) ^ 2 := by linear_combination -h' have h2' : ((3 * x ^ 2 + a) / (2 * y)) ^ 2 = 3 * x := by rw [div_pow, div_eq_iff h4y2]; exact h1 linear_combination h2' constructor · intro h2eq rw [h2P, WeierstrassCurve.Affine.Point.neg_some, WeierstrassCurve.Affine.Point.some.injEq] at h2eq exact hx2_iff.mp h2eq.1 · intro hpsi0 have hx2x : x2 = x := hx2_iff.mpr hpsi0 set y2 := (shortWeierstrass a b).toAffine.addY x x y ((shortWeierstrass a b).toAffine.slope x x y y) have hy2_sq : y2 ^ 2 = y ^ 2 := by have h2ns := (shortWeierstrass a b).toAffine.nonsingular_add h h hxy have h2eq := (shortWeierstrass_nonsingular_iff a b x2 y2).mp h2ns |>.1 rw [h2eq, hx2x, ← heq] rcases sq_eq_sq_iff_eq_or_eq_neg.mp hy2_sq with hy2_eq | hy2_neg · exfalso have h2P_eq_P : WeierstrassCurve.Affine.Point.some x y h + WeierstrassCurve.Affine.Point.some x y h = WeierstrassCurve.Affine.Point.some x y h := by rw [h2P, WeierstrassCurve.Affine.Point.some.injEq] exact ⟨hx2x, hy2_eq⟩ simp at h2P_eq_P · rw [h2P, WeierstrassCurve.Affine.Point.neg_some, WeierstrassCurve.Affine.Point.some.injEq] refine ⟨hx2x, ?_⟩ change y2 = -y - 0 * x - 0 linear_combination hy2_neg /-- **Exact 3-Torsion Cardinality Bound**: `|E[3](F)| ≤ 9` for any finite field `F` (`char ≠ 2, 3`, `4 a³ + 27 b² ≠ 0`). -/ theorem card_three_torsion_le_nine {F : Type*} [Field F] [Fintype F] [DecidableEq F] {a b : F} (h2 : (2 : F) ≠ 0) (h3 : (3 : F) ≠ 0) (hΔ : 4 * a ^ 3 + 27 * b ^ 2 ≠ 0) : open Classical in (Finset.univ.filter fun P : (shortWeierstrass a b).toAffine.Point => (3 : ℕ) • P = 0).card ≤ 9 := by classical set S := Finset.univ.filter fun P : (shortWeierstrass a b).toAffine.Point => (3 : ℕ) • P = 0 have hpsi_ne : psi3 a b ≠ 0 := by intro h0 have hcoeff : (psi3 a b).coeff 4 = 0 := by rw [h0]; simp have hcalc : (psi3 a b).coeff 4 = 3 := by unfold psi3 rw [coeff_sub, coeff_add, coeff_add, coeff_C_mul_X_pow, coeff_C_mul_X_pow, coeff_C_mul_X, coeff_C] simp exact h3 (hcalc ▸ hcoeff) have hpsi_deg : (psi3 a b).natDegree ≤ 4 := by unfold psi3 refine (natDegree_sub_le _ _).trans (max_le ?_ (by rw [natDegree_C]; omega)) refine (natDegree_add_le _ _).trans (max_le ?_ (natDegree_mul_le.trans (by rw [natDegree_C, natDegree_X]; omega))) refine (natDegree_add_le _ _).trans (max_le ?_ (natDegree_mul_le.trans (by rw [natDegree_C, natDegree_X_pow]; omega))) exact natDegree_mul_le.trans (by rw [natDegree_C, natDegree_X_pow]) have hfib : (S.erase 0).card ≤ ∑ x ∈ (psi3 a b).roots.toFinset, ((S.erase 0).filter fun P => match P with | .zero => False | .some x' _ _ => x' = x).card := by have hsub : S.erase 0 ⊆ (psi3 a b).roots.toFinset.biUnion (fun x => (S.erase 0).filter fun P => match P with | .zero => False | .some x' _ _ => x' = x) := by intro P hP have hP' := hP rw [Finset.mem_erase, Finset.mem_filter] at hP cases P with | zero => exact absurd rfl hP.1 | some x y h => rw [Finset.mem_biUnion] refine ⟨x, ?_, ?_⟩ · rw [Multiset.mem_toFinset, mem_roots hpsi_ne, IsRoot] exact (three_torsion_iff h2 hΔ h).mp hP.2.2 · exact Finset.mem_filter.mpr ⟨hP', rfl⟩ exact (Finset.card_le_card hsub).trans Finset.card_biUnion_le have hfib_le2 : ∀ x ∈ (psi3 a b).roots.toFinset, ((S.erase 0).filter fun P => match P with | .zero => False | .some x' _ _ => x' = x).card ≤ 2 := by intro x _ have hinj : ((S.erase 0).filter fun P => match P with | .zero => False | .some x' _ _ => x' = x).card ≤ (Finset.univ.filter fun y : F => y ^ 2 = x ^ 3 + a * x + b).card := by refine Finset.card_le_card_of_injOn (fun P => match P with | .zero => 0 | .some _ y _ => y) ?_ ?_ · intro P hP have hP' := (Finset.mem_filter.mp (Finset.mem_coe.mp hP)).2 cases P with | zero => exact False.elim hP' | some x' y h => subst hP' exact Finset.mem_coe.mpr (Finset.mem_filter.mpr ⟨Finset.mem_univ _, (shortWeierstrass_nonsingular_iff a b x' y).mp h |>.1⟩) · intro P₁ hP₁ P₂ hP₂ hy have h1 := (Finset.mem_filter.mp (Finset.mem_coe.mp hP₁)).2 have h2' := (Finset.mem_filter.mp (Finset.mem_coe.mp hP₂)).2 cases P₁ with | zero => exact False.elim h1 | some x₁ y₁ h₁ => cases P₂ with | zero => exact False.elim h2' | some x₂ y₂ h₂ => simp only [WeierstrassCurve.Affine.Point.some.injEq] exact ⟨h1.trans h2'.symm, hy⟩ have hsq2 : (Finset.univ.filter fun y : F => y ^ 2 = x ^ 3 + a * x + b).card ≤ 2 := by set c := x ^ 3 + a * x + b set g : F[X] := X ^ 2 - C c have hg_ne : g ≠ 0 := by intro h0 have hcoeff : g.coeff 2 = 0 := by rw [h0]; simp have hcalc : g.coeff 2 = 1 := by unfold g; rw [coeff_sub, coeff_X_pow, coeff_C]; simp exact one_ne_zero (hcalc ▸ hcoeff) have hg_deg : g.natDegree ≤ 2 := (natDegree_sub_le _ _).trans (max_le (by simp) (by simp)) have hsub' : (Finset.univ.filter fun y : F => y ^ 2 = c) ⊆ g.roots.toFinset := by intro y hy simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hy rw [Multiset.mem_toFinset, mem_roots hg_ne, IsRoot] simp [g, hy] exact (Finset.card_le_card hsub').trans ((Multiset.toFinset_card_le _).trans ((Polynomial.card_roots' g).trans hg_deg)) exact hinj.trans hsq2 have hsum_le : (S.erase 0).card ≤ 2 * (psi3 a b).roots.toFinset.card := by calc (S.erase 0).card ≤ ∑ x ∈ (psi3 a b).roots.toFinset, 2 := hfib.trans (Finset.sum_le_sum hfib_le2) _ = 2 * (psi3 a b).roots.toFinset.card := by rw [Finset.sum_const, smul_eq_mul, mul_comm] have hroots : (psi3 a b).roots.toFinset.card ≤ 4 := (Multiset.toFinset_card_le _).trans ((Polynomial.card_roots' (psi3 a b)).trans hpsi_deg) have h0mem : (0 : (shortWeierstrass a b).toAffine.Point) ∈ S := by simp [S] have hcard : S.card = (S.erase 0).card + 1 := (Finset.card_erase_add_one h0mem).symm change S.card ≤ 9 omega /-! ## Section 2: The Frobenius Endomorphism `π_q : E(K) →+ E(K)` and `ker(π_q - 1) = E(𝔽_q)` -/ section FrobeniusEndomorphism variable (Fq : Type*) [Field Fq] [Fintype Fq] [DecidableEq Fq] variable (K : Type*) [Field K] [DecidableEq K] [Algebra Fq K] /-- The `q`-power Frobenius `Fq`-algebra endomorphism `x ↦ x^q` on any field extension `K / Fq`. -/ noncomputable def frobAlgHom : K →ₐ[Fq] K where toFun x := x ^ Fintype.card Fq map_one' := one_pow _ map_mul' x y := mul_pow x y _ map_zero' := zero_pow Fintype.card_pos.ne' map_add' x y := by obtain ⟨n, hp, hcard⟩ := FiniteField.card Fq (ringChar Fq) have : Fact (ringChar Fq).Prime := ⟨hp⟩ have : CharP K (ringChar Fq) := charP_of_injective_algebraMap (algebraMap Fq K).injective _ rw [hcard, add_pow_char_pow] commutes' c := by rw [← map_pow, FiniteField.pow_card c] /-- **The Frobenius Endomorphism** `π_q : E(K) →+ E(K)` sending `𝓞 ↦ 𝓞` and `(x, y) ↦ (x^q, y^q)`. -/ noncomputable def frobEnd (a b : Fq) : ((shortWeierstrass a b).toAffine.baseChange K).Point →+ ((shortWeierstrass a b).toAffine.baseChange K).Point := WeierstrassCurve.Affine.Point.map (frobAlgHom Fq K) omit [DecidableEq Fq] in lemma frobEnd_some (a b : Fq) (x y : K) (h : ((shortWeierstrass a b).toAffine.baseChange K).Nonsingular x y) : frobEnd Fq K a b (.some x y h) = .some (frobAlgHom Fq K x) (frobAlgHom Fq K y) (((shortWeierstrass a b).toAffine.baseChange_nonsingular (frobAlgHom Fq K).injective _ _).mpr h) := rfl omit [DecidableEq Fq] in /-- An element `x ∈ K` is fixed by `x ↦ x^q` iff `x` lies in the base field `Fq`. -/ lemma pow_card_eq_self_iff_mem_range (x : K) : x ^ Fintype.card Fq = x ↔ x ∈ Set.range (algebraMap Fq K) := by constructor · intro hx set f : K[X] := X ^ Fintype.card Fq - X have hf_ne : f ≠ 0 := by intro h0 have h1 : f.coeff (Fintype.card Fq) = 0 := by rw [h0]; simp have hq1 : 1 < Fintype.card Fq := Fintype.one_lt_card simp only [f, coeff_sub, coeff_X_pow, ↓reduceIte, coeff_X] at h1 rw [if_neg (by omega : 1 ≠ Fintype.card Fq), sub_zero] at h1 exact one_ne_zero h1 have hf_deg : f.natDegree ≤ Fintype.card Fq := (natDegree_sub_le _ _).trans (max_le (by simp) (by simp; exact Fintype.card_pos)) let img : Finset K := Finset.univ.image (algebraMap Fq K) have himg_card : img.card = Fintype.card Fq := by rw [Finset.card_image_of_injective _ (algebraMap Fq K).injective, Finset.card_univ] have himg_sub : img ⊆ f.roots.toFinset := by intro y hy rcases Finset.mem_image.mp hy with ⟨c, _, rfl⟩ rw [Multiset.mem_toFinset, mem_roots hf_ne, IsRoot] simp [f, ← map_pow, FiniteField.pow_card c] have hroots_eq : img = f.roots.toFinset := by refine Finset.eq_of_subset_of_card_le himg_sub ?_ rw [himg_card] exact (Multiset.toFinset_card_le _).trans ((Polynomial.card_roots' f).trans hf_deg) have hx_root : x ∈ f.roots.toFinset := by rw [Multiset.mem_toFinset, mem_roots hf_ne, IsRoot] simp [f, hx] rw [← hroots_eq] at hx_root rcases Finset.mem_image.mp hx_root with ⟨c, _, rfl⟩ exact ⟨c, rfl⟩ · rintro ⟨c, rfl⟩ rw [← map_pow, FiniteField.pow_card c] /-- **Fixed-Point Characterization `ker(π_q - 1) = E(𝔽_q)`**: A point `P ∈ E(K)` is fixed by the Frobenius endomorphism `π_q` if and only if `P` comes from a rational point in `E(𝔽_q)`! -/ theorem frobEnd_fixed_iff (a b : Fq) (P : ((shortWeierstrass a b).toAffine.baseChange K).Point) : frobEnd Fq K a b P = P ↔ P ∈ Set.range (WeierstrassCurve.Affine.Point.map (Algebra.ofId Fq K) : ((shortWeierstrass a b).toAffine.baseChange Fq).Point →+ ((shortWeierstrass a b).toAffine.baseChange K).Point) := by constructor · intro hfix cases P with | zero => exact ⟨0, rfl⟩ | some x y h => rw [frobEnd_some, WeierstrassCurve.Affine.Point.some.injEq] at hfix obtain ⟨x₀, rfl⟩ := (pow_card_eq_self_iff_mem_range Fq K x).mp hfix.1 obtain ⟨y₀, rfl⟩ := (pow_card_eq_self_iff_mem_range Fq K y).mp hfix.2 have h0 : ((shortWeierstrass a b).toAffine.baseChange Fq).Nonsingular x₀ y₀ := by exact ((shortWeierstrass a b).toAffine.baseChange_nonsingular (Algebra.ofId Fq K).injective x₀ y₀).mp h exact ⟨.some x₀ y₀ h0, rfl⟩ · rintro ⟨Q, rfl⟩ cases Q with | zero => rfl | some x₀ y₀ h₀ => rw [WeierstrassCurve.Affine.Point.map_some, frobEnd_some, WeierstrassCurve.Affine.Point.some.injEq] exact ⟨by change (algebraMap Fq K x₀) ^ Fintype.card Fq = algebraMap Fq K x₀; rw [← map_pow, FiniteField.pow_card], by change (algebraMap Fq K y₀) ^ Fintype.card Fq = algebraMap Fq K y₀; rw [← map_pow, FiniteField.pow_card]⟩ end FrobeniusEndomorphism /-! ## Section 3: Exact Hasse–Weil Sharpness Witnesses over `𝔽₂₅ = 𝔽₅[w] / (w² - 2)` -/ /-- Explicit finite field `𝔽₂₅ = 𝔽₅[w] / (w² - 2)`, represented as pairs `(c₀, c₁)` for `c₀ + c₁ w`. -/ @[ext] structure F25 where re : ZMod 5 im : ZMod 5 deriving DecidableEq instance : Fintype F25 := Fintype.ofEquiv (ZMod 5 × ZMod 5) { toFun := fun p => ⟨p.1, p.2⟩ invFun := fun z => (z.re, z.im) left_inv := fun ⟨_, _⟩ => rfl right_inv := fun ⟨_, _⟩ => rfl } lemma card_F25 : Fintype.card F25 = 25 := by decide instance : Zero F25 := ⟨⟨0, 0⟩⟩ instance : One F25 := ⟨⟨1, 0⟩⟩ instance : Add F25 := ⟨fun x y => ⟨x.re + y.re, x.im + y.im⟩⟩ instance : Neg F25 := ⟨fun x => ⟨-x.re, -x.im⟩⟩ instance : Sub F25 := ⟨fun x y => ⟨x.re - y.re, x.im - y.im⟩⟩ instance : Mul F25 := ⟨fun x y => ⟨x.re * y.re + 2 * x.im * y.im, x.re * y.im + x.im * y.re⟩⟩ instance : Inv F25 := ⟨fun x => let n := x.re * x.re - 2 * x.im * x.im ⟨x.re * n⁻¹, -x.im * n⁻¹⟩⟩ instance : CommRing F25 where add_assoc a b c := F25.ext (add_assoc a.re b.re c.re) (add_assoc a.im b.im c.im) zero_add a := F25.ext (zero_add a.re) (zero_add a.im) add_zero a := F25.ext (add_zero a.re) (add_zero a.im) nsmul := nsmulRec zsmul := zsmulRec add_comm a b := F25.ext (add_comm a.re b.re) (add_comm a.im b.im) neg_add_cancel a := F25.ext (neg_add_cancel a.re) (neg_add_cancel a.im) sub_eq_add_neg a b := F25.ext (sub_eq_add_neg a.re b.re) (sub_eq_add_neg a.im b.im) mul_assoc a b c := F25.ext (by change (a.re * b.re + 2 * a.im * b.im) * c.re + 2 * (a.re * b.im + a.im * b.re) * c.im = a.re * (b.re * c.re + 2 * b.im * c.im) + 2 * a.im * (b.re * c.im + b.im * c.re); ring) (by change (a.re * b.re + 2 * a.im * b.im) * c.im + (a.re * b.im + a.im * b.re) * c.re = a.re * (b.re * c.im + b.im * c.re) + a.im * (b.re * c.re + 2 * b.im * c.im); ring) one_mul a := F25.ext (by change (1 : ZMod 5) * a.re + 2 * 0 * a.im = a.re; ring) (by change (1 : ZMod 5) * a.im + 0 * a.re = a.im; ring) mul_one a := F25.ext (by change a.re * 1 + 2 * a.im * 0 = a.re; ring) (by change a.re * 0 + a.im * 1 = a.im; ring) left_distrib a b c := F25.ext (by change a.re * (b.re + c.re) + 2 * a.im * (b.im + c.im) = (a.re * b.re + 2 * a.im * b.im) + (a.re * c.re + 2 * a.im * c.im); ring) (by change a.re * (b.im + c.im) + a.im * (b.re + c.re) = (a.re * b.im + a.im * b.re) + (a.re * c.im + a.im * c.re); ring) right_distrib a b c := F25.ext (by change (a.re + b.re) * c.re + 2 * (a.im + b.im) * c.im = (a.re * c.re + 2 * a.im * c.im) + (b.re * c.re + 2 * b.im * c.im); ring) (by change (a.re + b.re) * c.im + (a.im + b.im) * c.re = (a.re * c.im + a.im * c.re) + (b.re * c.im + b.im * c.re); ring) zero_mul a := F25.ext (by change (0 : ZMod 5) * a.re + 2 * 0 * a.im = 0; ring) (by change (0 : ZMod 5) * a.im + 0 * a.re = 0; ring) mul_zero a := F25.ext (by change a.re * 0 + 2 * a.im * 0 = 0; ring) (by change a.re * 0 + a.im * 0 = 0; ring) mul_comm a b := F25.ext (by change a.re * b.re + 2 * a.im * b.im = b.re * a.re + 2 * b.im * a.im; ring) (by change a.re * b.im + a.im * b.re = b.re * a.im + b.im * a.re; ring) lemma f25_norm_ne_zero {x : F25} (hx : x ≠ 0) : x.re * x.re - 2 * x.im * x.im ≠ 0 := by have hall : ∀ a b : ZMod 5, (a ≠ 0 ∨ b ≠ 0) → a * a - 2 * b * b ≠ 0 := by decide apply hall x.re x.im by_contra h push Not at h exact hx (F25.ext h.1 h.2) instance : Field F25 where exists_pair_ne := ⟨0, 1, by decide⟩ mul_inv_cancel x hx := by have : Fact (Nat.Prime 5) := ⟨by decide⟩ have hn := f25_norm_ne_zero hx refine F25.ext ?_ ?_ · change x.re * (x.re * (x.re * x.re - 2 * x.im * x.im)⁻¹) + 2 * x.im * (-x.im * (x.re * x.re - 2 * x.im * x.im)⁻¹) = 1 have : x.re * (x.re * (x.re * x.re - 2 * x.im * x.im)⁻¹) + 2 * x.im * (-x.im * (x.re * x.re - 2 * x.im * x.im)⁻¹) = (x.re * x.re - 2 * x.im * x.im) * (x.re * x.re - 2 * x.im * x.im)⁻¹ := by ring rw [this, mul_inv_cancel₀ hn] · change x.re * (-x.im * (x.re * x.re - 2 * x.im * x.im)⁻¹) + x.im * (x.re * (x.re * x.re - 2 * x.im * x.im)⁻¹) = 0 ring inv_zero := F25.ext (by change (0 : ZMod 5) * (0 * 0 - 2 * 0 * 0)⁻¹ = 0; ring) (by change -(0 : ZMod 5) * (0 * 0 - 2 * 0 * 0)⁻¹ = 0; ring) nnqsmul := _ qsmul := _ lemma card_shortWeierstrass_eq_filter_add_one {F : Type*} [Field F] [Fintype F] [DecidableEq F] {a b : F} (h2 : (2 : F) ≠ 0) (hΔ : 4 * a ^ 3 + 27 * b ^ 2 ≠ 0) : Fintype.card (shortWeierstrass a b).toAffine.Point = (Finset.univ.filter fun p : F × F => p.2 ^ 2 = p.1 ^ 3 + a * p.1 + b).card + 1 := by have hcard_opt : Fintype.card (shortWeierstrass a b).toAffine.Point = Fintype.card { p : F × F // p.2 ^ 2 = p.1 ^ 3 + a * p.1 + b } + 1 := by let e : (shortWeierstrass a b).toAffine.Point ≃ Option { p : F × F // p.2 ^ 2 = p.1 ^ 3 + a * p.1 + b } := { toFun := fun P => match P with | .zero => none | .some x y h => some ⟨(x, y), (shortWeierstrass_nonsingular_iff a b x y).mp h |>.1⟩ invFun := fun o => match o with | none => .zero | some ⟨(x, y), heq⟩ => .some x y (shortWeierstrass_nonsingular_of_eq h2 hΔ heq) left_inv := fun P => by cases P <;> rfl right_inv := fun o => by rcases o with _ | ⟨⟨x, y⟩, h⟩ <;> rfl } rw [Fintype.card_congr e, Fintype.card_option] rw [hcard_opt, Fintype.card_subtype] /-- **Hasse–Weil Upper Sharpness Witness (Maximal Curve over `𝔽₂₅`)**: `E_max : y² = x³ + 1` over `𝔽₂₅` has `#E_max(𝔽₂₅) = 36 = (5 + 1)² = 25 + 1 + 2√25`, attaining exact equality in the Hasse–Weil bound! -/ theorem hasse_weil_maximal_F25 : Fintype.card (shortWeierstrass (0 : F25) 1).toAffine.Point = 36 ∧ ((36 : ℤ) - (Fintype.card F25 + 1)) ^ 2 = 4 * (Fintype.card F25 : ℤ) := by have h2 : (2 : F25) ≠ 0 := by decide have hΔ : 4 * (0 : F25) ^ 3 + 27 * (1 : F25) ^ 2 ≠ 0 := by decide have h35 : (Finset.univ.filter fun p : F25 × F25 => p.2 ^ 2 = p.1 ^ 3 + 0 * p.1 + 1).card = 35 := by decide refine ⟨?_, ?_⟩ · rw [card_shortWeierstrass_eq_filter_add_one h2 hΔ, h35] · rw [card_F25]; norm_num /-- **Hasse–Weil Lower Sharpness Witness (Minimal Quadratic Twist over `𝔽₂₅`)**: `E_min : y² = x³ + 2w` over `𝔽₂₅` has `#E_min(𝔽₂₅) = 16 = (5 - 1)² = 25 + 1 - 2√25`, attaining exact equality in the lower Hasse–Weil bound! -/ theorem hasse_weil_minimal_F25 : Fintype.card (shortWeierstrass (0 : F25) ⟨0, 2⟩).toAffine.Point = 16 ∧ ((16 : ℤ) - (Fintype.card F25 + 1)) ^ 2 = 4 * (Fintype.card F25 : ℤ) := by have h2 : (2 : F25) ≠ 0 := by decide have hΔ : 4 * (0 : F25) ^ 3 + 27 * (⟨0, 2⟩ : F25) ^ 2 ≠ 0 := by decide have h15 : (Finset.univ.filter fun p : F25 × F25 => p.2 ^ 2 = p.1 ^ 3 + 0 * p.1 + ⟨0, 2⟩).card = 15 := by decide refine ⟨?_, ?_⟩ · rw [card_shortWeierstrass_eq_filter_add_one h2 hΔ, h15] · rw [card_F25]; norm_num /-! ## Section 4: Frobenius Trace Recurrence, Riemann Hypothesis & Weil Zeta Function Rationality -/ section WeilZeta /-- Complex Frobenius eigenvalue `α = (t + i √(4q - t²)) / 2`. -/ noncomputable def frobAlpha (q : ℕ) (t : ℤ) : ℂ := ((t : ℂ) + Complex.I * (Real.sqrt (4 * (q : ℝ) - (t : ℝ) ^ 2) : ℂ)) / 2 /-- Conjugate Frobenius eigenvalue `β = (t - i √(4q - t²)) / 2`. -/ noncomputable def frobBeta (q : ℕ) (t : ℤ) : ℂ := ((t : ℂ) - Complex.I * (Real.sqrt (4 * (q : ℝ) - (t : ℝ) ^ 2) : ℂ)) / 2 lemma frobAlpha_add_frobBeta (q : ℕ) (t : ℤ) : frobAlpha q t + frobBeta q t = (t : ℂ) := by unfold frobAlpha frobBeta; ring lemma frobAlpha_mul_frobBeta {q : ℕ} {t : ℤ} (hHW : t ^ 2 ≤ 4 * (q : ℤ)) : frobAlpha q t * frobBeta q t = (q : ℂ) := by unfold frobAlpha frobBeta have hnonneg : 0 ≤ 4 * (q : ℝ) - (t : ℝ) ^ 2 := by have : ((t : ℝ) ^ 2) ≤ 4 * (q : ℝ) := by exact_mod_cast hHW linarith have hsq : ((Real.sqrt (4 * (q : ℝ) - (t : ℝ) ^ 2) : ℂ)) ^ 2 = 4 * (q : ℂ) - (t : ℂ) ^ 2 := by rw [← Complex.ofReal_pow, Real.sq_sqrt hnonneg] push_cast; ring calc ((t : ℂ) + Complex.I * (Real.sqrt (4 * (q : ℝ) - (t : ℝ) ^ 2) : ℂ)) / 2 * (((t : ℂ) - Complex.I * (Real.sqrt (4 * (q : ℝ) - (t : ℝ) ^ 2) : ℂ)) / 2) = ((t : ℂ) ^ 2 - Complex.I ^ 2 * ((Real.sqrt (4 * (q : ℝ) - (t : ℝ) ^ 2) : ℂ)) ^ 2) / 4 := by ring _ = ((t : ℂ) ^ 2 - (-1) * (4 * (q : ℂ) - (t : ℂ) ^ 2)) / 4 := by rw [Complex.I_sq, hsq] _ = (q : ℂ) := by ring /-- **Riemann Hypothesis for Elliptic Curves**: `‖α‖ = ‖β‖ = √q` whenever `t² ≤ 4 q`. -/ theorem frobEigenvalues_norm {q : ℕ} {t : ℤ} (hHW : t ^ 2 ≤ 4 * (q : ℤ)) : ‖frobAlpha q t‖ = Real.sqrt q ∧ ‖frobBeta q t‖ = Real.sqrt q := by have hconj : starRingEnd ℂ (frobAlpha q t) = frobBeta q t := by unfold frobAlpha frobBeta simp [map_div₀, map_add, map_mul, Complex.conj_I, Complex.conj_ofReal, map_ofNat] ring have hmul : ‖frobAlpha q t‖ ^ 2 = (q : ℝ) := by have h1 := frobAlpha_mul_frobBeta hHW rw [← hconj, Complex.mul_conj'] at h1 exact Complex.ofReal_injective (by simpa using h1) have hα : ‖frobAlpha q t‖ = Real.sqrt q := by rw [← Real.sqrt_sq (norm_nonneg _), hmul] have hβ : ‖frobBeta q t‖ = Real.sqrt q := by rw [← hconj, Complex.norm_conj, hα] exact ⟨hα, hβ⟩ /-- Integer Frobenius trace sequence over extension fields `𝔽_{q^n}`: `t₀ = 2`, `t₁ = t`, `t_{n+2} = t * t_{n+1} - q * t_n`. -/ def traceSeq (q : ℕ) (t : ℤ) : ℕ → ℤ | 0 => 2 | 1 => t | n + 2 => t * traceSeq q t (n + 1) - (q : ℤ) * traceSeq q t n /-- **Exact Binet / Frobenius Power-Sum Formula**: `t_n = α^n + β^n` for ALL `n ∈ ℕ`. -/ theorem traceSeq_eq_pow_add_pow {q : ℕ} {t : ℤ} (hHW : t ^ 2 ≤ 4 * (q : ℤ)) (n : ℕ) : (traceSeq q t n : ℂ) = (frobAlpha q t) ^ n + (frobBeta q t) ^ n := by induction n using Nat.strongRecOn with | ind n ih => match n with | 0 => simp [traceSeq]; norm_num | 1 => simp only [traceSeq, pow_one] exact (frobAlpha_add_frobBeta q t).symm | k + 2 => simp only [traceSeq, Int.cast_sub, Int.cast_mul, Int.cast_natCast] rw [ih (k + 1) (by omega), ih k (by omega)] rw [← frobAlpha_add_frobBeta q t, ← frobAlpha_mul_frobBeta hHW] ring /-- **Extension-Field Hasse Bound**: `|t_n| ≤ 2 (√q)^n` for ALL `n ∈ ℕ`. -/ theorem traceSeq_hasse_bound {q : ℕ} {t : ℤ} (hHW : t ^ 2 ≤ 4 * (q : ℤ)) (n : ℕ) : |(traceSeq q t n : ℝ)| ≤ 2 * (Real.sqrt q) ^ n := by have hnorm : |(traceSeq q t n : ℝ)| = ‖(traceSeq q t n : ℂ)‖ := by rw [← Real.norm_eq_abs, ← Complex.norm_real] simp rw [hnorm, traceSeq_eq_pow_add_pow hHW n] have ⟨hα, hβ⟩ := frobEigenvalues_norm hHW calc ‖(frobAlpha q t) ^ n + (frobBeta q t) ^ n‖ ≤ ‖(frobAlpha q t) ^ n‖ + ‖(frobBeta q t) ^ n‖ := norm_add_le _ _ _ = ‖frobAlpha q t‖ ^ n + ‖frobBeta q t‖ ^ n := by rw [norm_pow, norm_pow] _ = 2 * (Real.sqrt q) ^ n := by rw [hα, hβ]; ring /-- The rational **Weil Zeta Function** `Z(E/𝔽_q, T) = (1 - t T + q T²) / ((1 - T)(1 - q T))`. -/ noncomputable def weilZeta (q : ℕ) (t : ℤ) (T : ℂ) : ℂ := (1 - (t : ℂ) * T + (q : ℂ) * T ^ 2) / ((1 - T) * (1 - (q : ℂ) * T)) /-- Helper: `HasSum (fun n => z^(n+1) / (n+1)) (-Complex.log (1 - z))` for `‖z‖ < 1`. -/ lemma hasSum_pow_succ_div_eq_neg_log {z : ℂ} (hz : ‖z‖ < 1) : HasSum (fun n : ℕ => z ^ (n + 1) / ((n + 1 : ℕ) : ℂ)) (-Complex.log (1 - z)) := by have h := Complex.hasSum_taylorSeries_neg_log hz rw [← hasSum_nat_add_iff' 1] at h simpa using h /-- **WEIL ZETA FUNCTION RATIONALITY (Exact Exponential Power-Series Identity)**: For every `q ≥ 1`, `t ∈ ℤ` with `t² ≤ 4 q`, and every `T ∈ ℂ` with `‖T‖ < q⁻¹`: `exp(∑_{n=1}^∞ ((q^n + 1 - t_n) / n) T^n) = (1 - t T + q T²) / ((1 - T)(1 - q T))`! -/ theorem weilZeta_rationality_exp {q : ℕ} {t : ℤ} (hq : 1 ≤ q) (hHW : t ^ 2 ≤ 4 * (q : ℤ)) {T : ℂ} (hT : ‖T‖ < ((q : ℝ))⁻¹) : Complex.exp (∑' n : ℕ, (((q : ℂ) ^ (n + 1) + 1 - (traceSeq q t (n + 1) : ℂ)) / ((n + 1 : ℕ) : ℂ)) * T ^ (n + 1)) = weilZeta q t T := by have hq_pos : (0 : ℝ) < (q : ℝ) := by exact_mod_cast hq have hq_ge1 : (1 : ℝ) ≤ (q : ℝ) := by exact_mod_cast hq have hqT : ‖(q : ℂ) * T‖ < 1 := by rw [norm_mul, Complex.norm_natCast] calc (q : ℝ) * ‖T‖ < (q : ℝ) * ((q : ℝ))⁻¹ := mul_lt_mul_of_pos_left hT hq_pos _ = 1 := mul_inv_cancel₀ hq_pos.ne' have h1T : ‖T‖ < 1 := lt_of_lt_of_le hT (inv_le_one_of_one_le₀ hq_ge1) have ⟨hα_norm, hβ_norm⟩ := frobEigenvalues_norm hHW have hsqrt_le : Real.sqrt q ≤ q := by calc Real.sqrt q ≤ Real.sqrt (q * q) := Real.sqrt_le_sqrt (by nlinarith) _ = q := Real.sqrt_mul_self hq_pos.le have hαT : ‖frobAlpha q t * T‖ < 1 := by rw [norm_mul, hα_norm] calc Real.sqrt q * ‖T‖ ≤ (q : ℝ) * ‖T‖ := mul_le_mul_of_nonneg_right hsqrt_le (norm_nonneg T) _ < 1 := by simpa [norm_mul, Complex.norm_natCast] using hqT have hβT : ‖frobBeta q t * T‖ < 1 := by rw [norm_mul, hβ_norm] calc Real.sqrt q * ‖T‖ ≤ (q : ℝ) * ‖T‖ := mul_le_mul_of_nonneg_right hsqrt_le (norm_nonneg T) _ < 1 := by simpa [norm_mul, Complex.norm_natCast] using hqT have hS_q := hasSum_pow_succ_div_eq_neg_log hqT have hS_1 := hasSum_pow_succ_div_eq_neg_log h1T have hS_α := hasSum_pow_succ_div_eq_neg_log hαT have hS_β := hasSum_pow_succ_div_eq_neg_log hβT have hS_comb := ((hS_q.add hS_1).sub hS_α).sub hS_β have hterm_eq : (fun n : ℕ => (((q : ℂ) ^ (n + 1) + 1 - (traceSeq q t (n + 1) : ℂ)) / ((n + 1 : ℕ) : ℂ)) * T ^ (n + 1)) = fun n : ℕ => ((q : ℂ) * T) ^ (n + 1) / ((n + 1 : ℕ) : ℂ) + T ^ (n + 1) / ((n + 1 : ℕ) : ℂ) - (frobAlpha q t * T) ^ (n + 1) / ((n + 1 : ℕ) : ℂ) - (frobBeta q t * T) ^ (n + 1) / ((n + 1 : ℕ) : ℂ) := by ext n rw [traceSeq_eq_pow_add_pow hHW (n + 1), mul_pow, mul_pow, mul_pow] ring rw [hterm_eq, hS_comb.tsum_eq] have hne_1 : 1 - T ≠ 0 := by intro h0; have : T = 1 := (sub_eq_zero.mp h0).symm; rw [this, norm_one] at h1T; exact lt_irrefl _ h1T have hne_q : 1 - (q : ℂ) * T ≠ 0 := by intro h0; have : (q : ℂ) * T = 1 := (sub_eq_zero.mp h0).symm; rw [this, norm_one] at hqT; exact lt_irrefl _ hqT have hne_α : 1 - frobAlpha q t * T ≠ 0 := by intro h0; have : frobAlpha q t * T = 1 := (sub_eq_zero.mp h0).symm; rw [this, norm_one] at hαT; exact lt_irrefl _ hαT have hne_β : 1 - frobBeta q t * T ≠ 0 := by intro h0; have : frobBeta q t * T = 1 := (sub_eq_zero.mp h0).symm; rw [this, norm_one] at hβT; exact lt_irrefl _ hβT have hexp_alg : -Complex.log (1 - (q : ℂ) * T) + -Complex.log (1 - T) - -Complex.log (1 - frobAlpha q t * T) - -Complex.log (1 - frobBeta q t * T) = (Complex.log (1 - frobAlpha q t * T) + Complex.log (1 - frobBeta q t * T)) - (Complex.log (1 - T) + Complex.log (1 - (q : ℂ) * T)) := by ring rw [hexp_alg, Complex.exp_sub, Complex.exp_add, Complex.exp_add, Complex.exp_log hne_α, Complex.exp_log hne_β, Complex.exp_log hne_1, Complex.exp_log hne_q] unfold weilZeta congr 1 have hfac : (1 - frobAlpha q t * T) * (1 - frobBeta q t * T) = 1 - (frobAlpha q t + frobBeta q t) * T + (frobAlpha q t * frobBeta q t) * T ^ 2 := by ring rw [hfac, frobAlpha_add_frobBeta, frobAlpha_mul_frobBeta hHW] /-- **Weil Zeta Functional Equation**: `Z(E/𝔽_q, 1 / (q T)) = Z(E/𝔽_q, T)`. -/ theorem weilZeta_functional_eq (q : ℕ) (t : ℤ) (hq : (q : ℂ) ≠ 0) {T : ℂ} (hT0 : T ≠ 0) (hT1 : 1 - T ≠ 0) (hqT1 : 1 - (q : ℂ) * T ≠ 0) : weilZeta q t (1 / ((q : ℂ) * T)) = weilZeta q t T := by unfold weilZeta have hqT : (q : ℂ) * T ≠ 0 := mul_ne_zero hq hT0 have h1 : 1 - 1 / ((q : ℂ) * T) = -(1 - (q : ℂ) * T) / ((q : ℂ) * T) := by field_simp [hqT]; ring have h2 : 1 - (q : ℂ) * (1 / ((q : ℂ) * T)) = -(1 - T) / T := by field_simp [hq, hT0]; ring have hnum : 1 - (t : ℂ) * (1 / ((q : ℂ) * T)) + (q : ℂ) * (1 / ((q : ℂ) * T)) ^ 2 = (1 - (t : ℂ) * T + (q : ℂ) * T ^ 2) / ((q : ℂ) * T ^ 2) := by field_simp [hq, hT0]; ring rw [h1, h2, hnum] have _ : (1 - T) * (1 - (q : ℂ) * T) ≠ 0 := mul_ne_zero hT1 hqT1 field_simp [hq, hT0, hT1, hqT1] end WeilZeta end EllipticTorsionZeta #print axioms EllipticTorsionZeta.two_torsion_iff #print axioms EllipticTorsionZeta.card_two_torsion_le_four #print axioms EllipticTorsionZeta.three_torsion_iff #print axioms EllipticTorsionZeta.card_three_torsion_le_nine #print axioms EllipticTorsionZeta.frobEnd_fixed_iff #print axioms EllipticTorsionZeta.hasse_weil_maximal_F25 #print axioms EllipticTorsionZeta.hasse_weil_minimal_F25 #print axioms EllipticTorsionZeta.frobEigenvalues_norm #print axioms EllipticTorsionZeta.traceSeq_eq_pow_add_pow #print axioms EllipticTorsionZeta.traceSeq_hasse_bound #print axioms EllipticTorsionZeta.weilZeta_rationality_exp #print axioms EllipticTorsionZeta.weilZeta_functional_eq