Guard PARI polgalois on unsupported number-field degrees - #7168
Open
roed-math wants to merge 3 commits into
Open
Guard PARI polgalois on unsupported number-field degrees#7168roed-math wants to merge 3 commits into
roed-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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #6759.
Some auto-generated code snippets on number-field pages error when run. 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 #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.Ported from roed-math#32, where the full write-up and comment history live.
🤖 Generated with Claude Code