Skip to content

Validate Euler factor links to abelian varieties over Fq on L-function pages#29

Open
roed-math wants to merge 2 commits into
mainfrom
ai/t37-euler-avfq-links
Open

Validate Euler factor links to abelian varieties over Fq on L-function pages#29
roed-math wants to merge 2 commits into
mainfrom
ai/t37-euler-avfq-links

Conversation

@roed-math

Copy link
Copy Markdown
Owner

L-function pages of motivic weight 1 link each good-prime Euler factor to the corresponding
isogeny class of abelian varieties over F_p (feature introduced in LMFDB#6573). This PR hardens that
linking: a new Lfactor_to_gq check confirms the factor is genuinely the reciprocal Weil
polynomial of an abelian variety over F_p (even degree, integral, lead p^g, self-dual) before a
label is displayed, so malformed or non-Weil factors now give an empty cell instead of a
ValueError-driven 500 or a wrong/garbage label, while out-of-range (g,q) still shows a plain
unlinked label. The av/Fq coverage lookup now happens lazily at first use instead of at module
import, and the row's prime is passed in so the label can be checked against it. Verified
against av_fq_isog data (11.a links 1.2.c at p=2 with 5 = #E(F_2) points; genus 2 curve 169.a
links 2.2.d_f, its reduced Jacobian) and covered by new tests in test_lfunctions.py; the full
lfunctions suite passes.
Addresses LMFDB#4535.
Addresses LMFDB#4922.

🤖 Generated with Claude Code

roed314 and others added 2 commits July 19, 2026 11:59
…FDB#4535, LMFDB#4922)

The isogeny class column of the L-function Euler factor table (added in
LMFDB#6573) derived (g, q) from the factor's leading coefficient via
nth_root, which raises ValueError (a 500 page) when the coefficient is
not a perfect g-th power, and produced garbage labels for factors that
are not genuine Weil polynomials (negative lead, non-self-dual).  Add
Lfactor_to_gq, which checks that the factor is the reciprocal Weil
polynomial of an abelian variety over F_p (even degree, integral,
constant term 1, leading coefficient p^g, self-duality
a_{2g-i} = q^{g-i} a_i) and pass the row's prime in from lfuncEPhtml,
leaving the cell empty otherwise; out-of-range (g, q) still shows a
plain unlinked label.  Also defer the AbvarFqStats query from module
import to first use.

Verified on 11.a (links 1.2.c at p=2, matching 5 = #E(F_2)), genus 2
curve 169.a (2.2.d_f at p=2, the reduced Jacobian, matching
av_fq_isog.poly and 19 points), an EC/NF and degree 6/8 CMF pages
(labels beyond av/Fq coverage stay unlinked), and EC/G2C isogeny class
pages; new tests in test_lfunctions.py plus the full suite (25 passed)
and pyflakes are clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…v/Fq links (LMFDB#4535)

Lfactor_to_gq checked reciprocity but not the root condition, so self-dual
non-Weil factors like [1, 10, 2] (x^2 + 10x + 2 violates the Hasse bound at
p = 2) produced links to wrong or nonexistent isogeny classes.  Now the
reversal must pass Sage's exact is_weil_polynomial (Sturm's theorem, no
floating point; 26-53us per call for g = 1..6).  For proper prime powers,
where Weil does not imply realizable (x^2 + 25 over F_25, Honda-Tate), the
link emitter confirms the label against av_fq_isog; pages always pass a
prime, where Weil is exactly Honda-Tate, so page renders add no queries.
polynomial_unroll now rejects empty/non-list payloads with ValueError
(previously IndexError escaped to a 500) and gives prod an initial
polynomial so exponent-0 factorizations no longer raise; Lfactor_to_gq
catches these and returns None.

Verified: new must-reject unit tests ([1,10,2], boundary (x+2)^2, malformed
flat/factored payloads); av/Fq link counts on six real L-function pages
(EC/Q 11.a, G2C 169.a, EC/NF deg 4, deg 6, deg 8) identical before/after;
full lfunctions suite 27 passed; pyflakes clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@roed-math

Copy link
Copy Markdown
Owner Author

Addressed both of the external review's P2 findings: commit b0a99a2.

Weil condition: the validator now requires the reversed factor to pass Sage's is_weil_polynomial() — exact arithmetic (squared-roots trace polynomial + Sturm counting via PARI polsturm, no floats). The reviewer's [1,10,2] example is rejected in both flat and factored form (regression tests added); the supersingular boundary case (x+2)² over F₄ is correctly accepted. Measured cost 26–53 µs/call, ~1 ms/page worst case.

Beyond the review: while verifying, the agent found that Weil ⟹ exists-in-DB only holds for prime q (Honda–Tate): x²+25 is Weil but 1.25.a doesn't exist. Labels for proper prime-power q are now confirmed against av_fq_isog before linking — a cold path, since current pages always pass prime p, so zero added queries on real pages.

Empty/malformed payloads: polynomial_unroll now raises ValueError on empty/non-list input instead of IndexError, an exponent-0 factorization no longer hits an uncaught NotImplementedError (a second 500 path found en route), and the caller catches these → empty cell, not a 500.

27/27 lfunctions tests pass; av/Fq links verified identical before/after on six real pages (11.a→1.2.c etc.).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants