Guard PARI polgalois on unsupported number-field degrees (LMFDB#6759) - #32
Guard PARI polgalois on unsupported number-field degrees (LMFDB#6759)#32roed-math wants to merge 3 commits into
Conversation
Running the number field snippets across a spread of fields (Q, quadratic, cubic, quartic, degree 12) surfaced three genuine errors that the snippet CI harness cannot catch, since it only tests degree <= 2 fields and skips Magma: - The Magma galois_group snippet used `=` (equality) instead of `:=` (assignment), erroring on every field. - Magma's NumberField collapses a degree-1 polynomial to the rationals, so the Q field page (1.1.1.1) broke on unit rank, regulator, subfields and the class number formula; fixed with `DoLinearExtension := true` in the field and class-number-formula snippets. - PARI's polgalois hard-errors above degree 11; now guarded with an if() that returns an explanatory message (degree <= 11 is unchanged). Updates the two committed gp snippet-test logs for the new PARI Galois command line (its output is unchanged). Verified by executing the fixed snippets in sage, sage --gp and Magma across the field spread. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…t-errors # Conflicts: # lmfdb/number_fields/code.yaml
) The Magma Galois assignment and rational-field fixes carried by this branch were superseded by LMFDB#7079, which represents Q as RationalsAsNumberField(). Drop the DoLinearExtension templates so there is a single rational-field strategy: with them in place the exact replace("NumberField(x)", "RationalsAsNumberField()") in WebNumberField.make_code_snippets() silently became dead code, and the committed Magma logs no longer matched the templates. Extend the PARI guard to the real support boundary. polgalois is unconditional only through degree 7; degrees 8 to 11 need the optional galdata package, and above 11 it hard-errors. Both cases now yield an explanatory string, while any other polgalois failure still propagates. Verified in PARI 2.17.2 via sage --gp for degrees 2, 8 and 12, with galdata present and with datadir pointed at a directory without it. The Magma snippet harness reports no change to the committed Magma logs; the two gp logs differ only in the echoed command line, with identical computed output. Adds regression tests for the guarded degree-12 gp download and for the Magma representation of Q. sage -python -m pytest lmfdb/number_fields/test_numberfield.py -> 36 passed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Updated in f6b304f to address the review. Summary of what changed and how it was checked. 1. Dropped the duplicate Magma rational-field implementation. Both Re-running the Magma harness against the committed fixtures confirms no drift: 2. Widened the PARI guard to the documented support boundary. One deviation from the suggested expression, and it is deliberate: the review proposed the predicate
With galdata removed, 3. Regenerated the gp fixtures. Only the echoed command line differs; the computed outputs are byte-identical, so the mathematical content of the two logs is unchanged. Note for anyone reproducing: the harness intersects the 4. Added the two regression tests in
Lint is clean ( 5. Title and body now describe the final diff: the Magma assignment and Q-collapse fixes are attributed to LMFDB#7079 and this PR is just the PARI guard plus its tests. The high-degree |
|
GPT signed off. |
|
Superseded by LMFDB#7168, opened upstream from this same branch. Closing here; review continues upstream. |
Some auto-generated code snippets on number-field pages error when run (LMFDB#6759). The snippet CI harness cannot catch them because it only exercises degree <= 2 fields, so I ran every number-field snippet across a spread of fields (Q, imaginary/real quadratic, monogenic and non-monogenic cubics, a quartic, and a degree-12 field). That surfaced three genuine bugs; two of them, the Magma Galois-group assignment (
=instead of:=) and Magma's collapse of a degree-1 polynomial to the rationals on the Q page, have since been fixed onmainby LMFDB#7079, which represents Q asRationalsAsNumberField(). Those changes are dropped here, leaving a single rational-field strategy, and this PR now carries only the third fix.PARI's
polgaloishard-errors above degree 11 ("sorry, galois of degree higher than 11 is not yet implemented"), and it is unconditional only through degree 7: degrees 8 to 11 need the optionalgaldatapackage, which is not part of a stock PARI installation. Thegalois_groupsnippet inlmfdb/number_fields/code.yamlis now guarded so that either case returns an explanatory string instead of aborting the rest of the snippet file, while any otherpolgaloisfailure still propagates.Verified in PARI 2.17.2 (via
sage --gp) for degrees 2, 8 and 12, both withgaldatapresent and withdatadirpointed at a directory without it. The two committed gp snippet-test logs are updated for the new Galois line; their computed output is unchanged, and re-running the Magma snippet harness reports no change to the committed Magma logs. Two regression tests are added inlmfdb/number_fields/test_numberfield.py: one checks that the degree-12 gp download is guarded and never emits a barepolgalois(K.pol)line, the other pins the Magma representation of Q toRationalsAsNumberField()in both the field definition and the self-contained class-number-formula snippet.One issue is intentionally left as a documented limitation: the PARI analytic-class-number-formula snippet overflows the default PARI stack on high-degree fields (a resource limit, not a code error), so no
allocatememdirective is injected into a user-facing snippet.Addresses LMFDB#6759.
🤖 Generated with Claude Code