Avoiding some false positives in check_primality#526
Merged
Conversation
check_primality(polys, extra_relations) substitutes the non-leader variables of each generator with random integers, then tests whether the characteristic polynomial of a generic multiplication operator on the resulting zero-dimensional quotient is irreducible. The random specialization could land on a point where a generator's leading coefficient (w.r.t. its leader) vanishes, dropping that generator's degree in its leader. When every generator collapses to degree 1, the quotient ring becomes 1-dimensional, its charpoly is a degree-1 (hence trivially irreducible) polynomial, and the routine reports the ideal as prime even when it is not. This is a soundness bug: for the io_projections issue-#132 case the ideal is not prime, yet ~6/500 RNG seeds drove check_primality(proj) to return true. It surfaced as a master red on the julia-pre (1.13.0-rc1) Core lane, whose changed global-RNG stream happened to hit such a draw at test/bodies/io_projections.jl:55 (`@test !check_primality(proj)`). Fix: only accept random specializations that preserve every generator's degree in its leader, i.e. that stay on the open set where the leading coefficients do not vanish (the set the ideal is implicitly saturated at, per the docstring). Resample otherwise, with a bounded retry. The extra_relations are evaluated at the same point, matching the previous behavior. Verified on Julia 1.13.0-rc1: false-positive rate over seeds 0..499 drops from 6/500 to 0/500; io_projections body 10/10 (was 9/1); positive case check_primality(proj, [projection_poly]) 50/50 true. No regression on Julia 1.12: io_projections 10/10, check_primality_zerodim 5/5. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.8 (1M context) <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.
This PR is a minor cleanup of #525