3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-04-15 08:44:10 +00:00
z3/src
Arie 665d4f36ff
Fixes for lar_term== operator (#9284)
* Fix broken term_comparer in m_normalized_terms_to_columns lookup

The `m_normalized_terms_to_columns` map in `lar_solver` uses a
`term_comparer` that delegates to `lar_term::operator==`, which
intentionally returns `false` (with comment "take care not to create
identical terms"). This makes `fetch_normalized_term_column` unable to
find any term, rendering the Horner module's `interval_from_term`
bounds-recovery path dead code.

History: `lar_term::operator==` returning `false` has been present since
the original "merge LRA" commit (911b24784, 2018). The
`m_normalized_terms_to_columns` lookup was added later (dfe0e856,
c95f66e0, Aug 2019) as "toward fetching existing terms intervals from
lar_solver". The initial code had `lp_assert(find == end)` on
registration (always true with broken ==) and `lp_assert(find != end)`
on deregister (always false). The very next commit (207c1c50, one day
later) removed both asserts, replacing them with soft checks. The
`term_comparer` struct delegating to `operator==` was introduced during
a later PIMPL refactor (b375faa77).

Fix: Replace the `term_comparer` implementation with a structural
comparison that checks size and then verifies each coefficient-variable
pair via `coeffs().find_core()`. This is localized to the
`m_normalized_terms_to_columns` map and does not change
`lar_term::operator==`, preserving its intentional semantics elsewhere.

Validated: on a QF_UFNIA benchmark, `interval_from_term` lookups go
from 0/573 successful to 34/573 successful. Unit test added for the
`fetch_normalized_term_column` round-trip.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Disable operator== for lar_term

The operator== for lar_term was never intended to be used.
This changes physically disables it to identify what happens to depend
on the operator.

* Work around missing lar_term==

Previous commit disabled lar_term==. This is the only use of the
operator that seems meaningful. Changed it to compare by references
instead.

Compiles, but not sure this is the best solution.

* replace with e

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* Delete unused ineq::operator==

The operator is unused, so there is no need to figure what is
the best fix for it.

* Remove lp tests that use ineq::operator==

---------

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-04-12 14:31:18 -07:00
..
ackermannization Fix off-by-one vulnerabilities: use range-based for on goals; cache loop bound 2026-02-19 22:37:22 +00:00
api Go/OCaml API gaps: substitution, AST introspection, Spacer, Goal completion (#9277) 2026-04-12 14:00:03 -07:00
ast add flag to control non-linear substitutions: smt.solve_eqs.linear is by default false, setting it to true restricts solutions to substitutions to only use linear terms. This can have an effect on cross-multiplication of nested substitutions 2026-04-12 09:41:46 -07:00
cmd_context Remove redundant default constructors when they're the only constructor (#8461) 2026-02-18 20:58:01 -08:00
math Fixes for lar_term== operator (#9284) 2026-04-12 14:31:18 -07:00
model Remove redundant default constructors when they're the only constructor (#8461) 2026-02-18 20:58:01 -08:00
muz Refactor sls_euf_plugin.cpp validate_model and add SASSERT in udoc_relation.cpp 2026-03-09 16:57:59 +00:00
nlsat Fix apply_permutation to take perm by const reference 2026-03-30 04:57:08 -10:00
opt fix box mode: reset bounds before each objective 2026-03-19 17:07:21 -10:00
params add flag to control non-linear substitutions: smt.solve_eqs.linear is by default false, setting it to true restricts solutions to substitutions to only use linear terms. This can have an effect on cross-multiplication of nested substitutions 2026-04-12 09:41:46 -07:00
parsers Revert "Refactor find_psort_decl() to return std::optional<psort_decl*> (#8339)" 2026-02-18 20:57:56 -08:00
qe Simplify extract_var_bound via operator normalization (#9062) 2026-03-22 16:01:12 -07:00
sat Fix assertion violation in q_mbi diagnostic output 2026-02-28 11:15:28 -10:00
shell Standardize for-loop increments to prefix form (++i) (#8199) 2026-02-18 20:57:29 -08:00
smt Fix scaled_min test failure from #9235 mod-factor-propagation (#9260) 2026-04-10 12:52:42 -07:00
solver Remove copies (#8583) 2026-02-18 21:02:22 -08:00
tactic Merge pull request #8955 from Z3Prover/copilot/convert-injectivity-to-simplifier 2026-03-12 17:07:19 -07:00
test Fixes for lar_term== operator (#9284) 2026-04-12 14:31:18 -07:00
util fix truncation error 2026-04-10 18:04:08 -07:00
CMakeLists.txt git bindings v1.0 2026-02-18 21:02:25 -08:00