Fix nra_solver regression: unknown instead of sat for satisfiable NL arithmetic problems#8747
Draft
Fix nra_solver regression: unknown instead of sat for satisfiable NL arithmetic problems#8747
unknown instead of sat for satisfiable NL arithmetic problems#8747Conversation
…() in nra_solver check() Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix Z3 regression: solver.check() returns 'unknown'
Fix nra_solver regression: Feb 24, 2026
unknown instead of sat for satisfiable NL arithmetic problems
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.
Commit 7395152 introduced a performance regression in the NRA (nonlinear real arithmetic) solver path: satisfiable problems with nonlinear constraints started returning
unknowninstead ofsat.Root Cause
check()was changed to usesetup_solver_poly(), which performs polynomial elaboration — substituting monic/term variable definitions directly into constraints. For example, given monicv = x1 * x2, a linear constraintv >= 5becomes the nonlinear atomx1*x2 - 5 >= 0. This silently promotes many linear constraints into nonlinear polynomial ones, making the underlyingnlsatsolver work substantially harder and causing it to time out.Fix
Revert
check()to callsetup_solver_terms()instead ofsetup_solver_poly(). Both produce a logically equivalentnlsatproblem, butsetup_solver_terms()preserves linearity where possible by encoding monic and term definitions as separate equality clauses rather than substituting them in:v - 5 >= 0(linear atom)x1*x2 - v = 0(nonlinear, but isolated)setup_solver_poly()remains in the codebase but is no longer called from the maincheck()path.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.