Skip to content

Fix non-termination of the lifting of the parametrization with -L 1 - #417

Open
jerebertho wants to merge 2 commits into
algebraic-solving:masterfrom
jerebertho:fix-mulmat-lift-check
Open

jerebertho wants to merge 2 commits into
algebraic-solving:masterfrom
jerebertho:fix-mulmat-lift-check

Conversation

@jerebertho

Copy link
Copy Markdown
Contributor

With -L 1, the lifting of the parametrization over QQ (msolve_trace_qq) may not
terminate when the lifted multiplication matrix is wrong. This PR checks the lifted data
against every prime that ran F4 and gives up -L on a mismatch. It does not change the
outputs.

Once the multiplication matrix (and the linear forms) are lifted over QQ, the next primes
skip F4 and get their matrix by reduction of the lifted one. But the primes of the batch
in which the lifting completes (or of the next batch, when it completes on the last prime
of a batch) have already run F4. Only one of them was checked against the lifted matrix
(check_matrix), and the images of the others entered the CRT unchecked. If the lifted
matrix is wrong, the images obtained from it are then mixed with correct images, and no
rational number can agree with all of them: the rational reconstruction never succeeds.
Each prime passes its own checks, so no bad prime is counted and nothing stops the loop.

A wrong lifted matrix is very unlikely with random primes, but with a fixed seed the
primes are known in advance. Adding to a constant term of the input the product of the
first primes that msolve draws makes the input coincide with the original one modulo all
of them. For Katsura-8 (input_files/kat8-qq-truncate.ms, -P 2 -L 1 --random-seed 7),
adding the product of the first 14 primes (about 420 bits) makes master loop with -t 2
and -t 3, and the product of the first 15 to 18 primes (up to 543 bits) makes it loop
with -t 3, while the actual computation takes 3 s. With -t 1, and whenever all the
primes in flight divide the product, master returns the parametrization of the original
system instead: this wrong output is expected with a fixed seed, with or without -L.

Now every prime that ran F4 while the matrix or the linear forms are lifted is checked
against them (check_lifted_data; coefficients whose denominator vanishes modulo the
prime are skipped). On a mismatch, -L is given up for the rest of the computation (all
primes run F4 again); since no image has been computed from the lifted data yet, nothing
has to be discarded. The images then all come from F4 or all agree with the lifted
matrix, so they are the reductions of a single parametrization and the lifting
terminates. The output is then the one of the call without -L, and the verbose output
shows <-L given up>.

On the trapped Katsura-8 inputs, -t 2 and -t 3 now terminate, with the output of the
call without -L. On the input files with -P 2 -L 1, -P 2, -L 1, -P 1 -L 1 and the
default call, with -t 1 and -t 3, all outputs are identical to master (870 runs), and
-L is never given up (172 runs with -P 2 -L 1, 20 of them with the matrix lifted).
make check passes, and AddressSanitizer reports no error.

This branch also contains a commit that raises the CI time-out to 30 minutes, see PR#416.

jerebertho and others added 2 commits November 27, 2026 14:10
With -L 1, once the multiplication matrix is lifted, the next primes skip
F4. But the primes of the batch in which the lifting completes (or the
batch right after, when it completes on the last prime of a batch) have
already run F4, and only one of them was checked against the lifted
matrix: the images of the others entered the CRT unchecked. If the lifted
matrix is wrong (e.g. all its primes divide some coefficient of the input,
which can be forced with a fixed seed), these images are mixed with images
computed from the wrong matrix, and the rational reconstruction never
succeeds: msolve does not terminate (with -t 2 and more).

Now every prime that ran F4 while the matrix or the linear forms are
lifted is checked against them; on a mismatch, -L is given up (all images
obtained so far come from F4).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant