Prevent recursive solver factor cycles - #1966
Merged
ChrisRackauckas merged 1 commit intoAug 26, 2026
Merged
Conversation
Use Nemo's factorization unit when deciding whether a polynomial is already unfactored, so unit-only sign changes do not recurse indefinitely. Add a higher-degree symbolic polynomial regression that returns RootsOf. Co-Authored-By: OpenAI Codex <noreply@openai.com> Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://chatgpt.com/codex/tasks/01a03a04-70ae-77a0-ba1b-ec7a1ed9ef47
Member
Author
|
Investigation and verification checklist:
|
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1966 +/- ##
==========================================
- Coverage 23.42% 19.29% -4.14%
==========================================
Files 61 61
Lines 5997 5987 -10
==========================================
- Hits 1405 1155 -250
- Misses 4592 4832 +240 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ChrisRackauckas
marked this pull request as ready for review
August 26, 2026 07:03
ChrisRackauckas
merged commit Aug 26, 2026
eb1c9e7
into
JuliaSymbolics:master
19 of 24 checks passed
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.
Please ignore this PR until it has been reviewed by @ChrisRackauckas.
What changed and why
solve_univartreated a single Nemo factor as new work whenever the factor was not structurally equal to the input polynomial. Nemo returns a separate factorization unit, so an irreducible polynomial can be represented asu = -1plus the negated polynomial; recursively factoring that result can alternate betweenpand-puntil a stack overflow.This PR reconstructs the single-factor result with Nemo's unit before deciding that factorization made progress. It adds a public-API regression for an irreducible degree-5 symbolic polynomial and verifies that
symbolic_solvereturnsRootsOfrather than recursing.Failing before
I ran the new test against unfixed
masterwith a temporary recursion-depth diagnostic guard (not included in this PR), which turns the otherwise unbounded recursion into a prompt error:The factor trace on unfixed code alternates deterministically:
Passing after
The identical test against this branch passes:
The complete solver file passes, including the regression:
The full Core group reached 17,087 passes. The sole error is the independently reproduced
PreallocationTools.DiffCache.any_dufailure already fixed in the separate draft PR linked below; the RootFinding solver group is clean.Additional local checks:
The last three commands exited successfully without output.
Regression boundary
The recursive single-factor condition was introduced by the Symbolics commit linked below. Its parent returned the reduced polynomial as
RootsOfin 13.912763 seconds. The dependency behavior that exposes the latent bug begins at the tested Nemo version boundary: Nemo 0.47.5 terminates, while 0.48.0, 0.48.1, 0.49.5, 0.52.4, 0.56.0, and 0.56.1 return alternating unit/factor representations for this polynomial. This is valid factorization behavior; consuming Nemo's unit in Symbolics is the scoped fix.Not verified
Docs were not built because this changes no docstring, rendered documentation, or public API. GPU, downstream, and allowed-to-fail jobs were not run locally. No dependency or license changes are included.
Reviewer focus:
is_unfactoredreconstructs only a single factor with Nemo's unit for the progress check. Multi-factor root handling is unchanged.Links
🤖 Generated with Claude Code
https://chatgpt.com/codex/tasks/01a03a04-70ae-77a0-ba1b-ec7a1ed9ef47