Repository navigation
Decline a system whose exact row is shown not to be a solution - #2452
Merged
Merged
Conversation
y^2 - 2, x^2 + (P - Q y) x - 3, with (1 + sqrt(2))^70 = P + Q sqrt(2), was answered with the one row [-2P, -sqrt(2)], which leaves -2 in the second equation, and its four solutions were lost. The cause is the zero tolerance of a single equation's solve. It runs with PrecisionErrorZeroRange at 1e-12, so P - Q sqrt(2) = 1.6e-27 is dropped as a coefficient at y = sqrt(2) (roots +-sqrt(3)), and at y = -sqrt(2) the discriminant and the small root are rounded away (the one root -2P). Without that override the system is answered with four correct rows for n = 20..60; at n >= 70 the default downcasting, 1e-50, still reads b^2 + 12 as 12. That is downcasting itself, which v3 removes (#1019), and is left alone here. The wrong row got through RowsThatHold because its residual is exact and algebraic, and StatementSolver.IsEvidenceAgainst accepts such a residual up to 1e-50 of the largest term: -2 against terms of 4e53 passed. A row with only exact numbers is a solution only where each residual is exactly zero, so an interval from PreciseEvaluation that leaves out zero proves it is none. Such a row now declines the system rather than being dropped: that the tolerance accepted it means rounding reached the elimination, which lost true rows here too, and dropping it would answer an incomplete set. The interval is taken to the working precision in decimal places, with a second evaluation where the terms are large (n = 140 has terms near 1e107). An enclosure that holds zero, or cannot be computed, changes nothing, so no true row can be lost by the check. Measured, master -> branch, rows checked at 150 digits with mpmath: n = 5, 10 four correct rows -> unchanged n = 20..60 declined -> declined n = 70..120, 160 one wrong row [-2P, -sqrt(2)] -> declined n = 140, 200 three wrong rows -> declined System-solver filter 108 passed, 2 s before and after; Regression 411, EquationSolving|SolveTest 192, Algebra|Corpus|Solv 2235, PublicApiSurface 1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2452 +/- ##
==========================================
+ Coverage 86.93% 86.95% +0.01%
==========================================
Files 319 319
Lines 70760 70781 +21
Branches 20666 20676 +10
==========================================
+ Hits 61515 61545 +30
+ Misses 4966 4957 -9
Partials 4279 4279
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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.
y^2 - 2, x^2 + (P - Q y) x - 3, with (1 + sqrt(2))^70 = P + Q sqrt(2), was
answered with the one row [-2P, -sqrt(2)], which leaves -2 in the second
equation, and its four solutions were lost.
The cause is the zero tolerance of a single equation's solve. It runs with
PrecisionErrorZeroRange at 1e-12, so P - Q sqrt(2) = 1.6e-27 is dropped as a
coefficient at y = sqrt(2) (roots +-sqrt(3)), and at y = -sqrt(2) the
discriminant and the small root are rounded away (the one root -2P). Without
that override the system is answered with four correct rows for n = 20..60;
at n >= 70 the default downcasting, 1e-50, still reads b^2 + 12 as 12. That
is downcasting itself, which v3 removes (#1019), and is left alone here.
The wrong row got through RowsThatHold because its residual is exact and
algebraic, and StatementSolver.IsEvidenceAgainst accepts such a residual up
to 1e-50 of the largest term: -2 against terms of 4e53 passed. A row with
only exact numbers is a solution only where each residual is exactly zero,
so an interval from PreciseEvaluation that leaves out zero proves it is
none. Such a row now declines the system rather than being dropped: that
the tolerance accepted it means rounding reached the elimination, which
lost true rows here too, and dropping it would answer an incomplete set.
The interval is taken to the working precision in decimal places, with a
second evaluation where the terms are large (n = 140 has terms near 1e107).
An enclosure that holds zero, or cannot be computed, changes nothing, so no
true row can be lost by the check.
Measured, master -> branch, rows checked at 150 digits with mpmath:
n = 5, 10 four correct rows -> unchanged
n = 20..60 declined -> declined
n = 70..120, 160 one wrong row [-2P, -sqrt(2)] -> declined
n = 140, 200 three wrong rows -> declined
System-solver filter 108 passed, 2 s before and after; Regression 411,
EquationSolving|SolveTest 192, Algebra|Corpus|Solv 2235, PublicApiSurface 1.
Generated systems (syscheck, 1,190 systems), master and branch: identical. 1128 answered, 62 declined, 0 wrong rows, 0 timeouts on both, so no system that master answered correctly is declined now.
Full check on this commit: 19,865 unit tests, every harness, and the AOT smoke test 78/78.
Fixes #2446. The single-equation half, the 1e-12 override itself, is #2448 and follows separately.
🤖 Generated with Claude Code