3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-07-30 02:33:51 +00:00
z3/src
Lev Nachmanson 4065e4688c opt: validate strict optimization optima faithfully with delta-rational bounds
Maximizing/minimizing under a strict inequality (e.g. maximize r subject to
r < 1) has the delta-rational optimum 1 - epsilon. Reporting it soundly
requires check_bound to validate the bound r >= 1 - epsilon, i.e. to assert a
LOWER bound whose value carries a NEGATIVE infinitesimal (r, -1).

No lconstraint_kind can express that: the kind->epsilon map only produces the
matching-sign infinitesimals (GT -> lower (r, +1), LT -> upper (r, -1)) or zero
(GE/LE). opt_solver::mk_ge therefore projected the negative infinitesimal away,
turning r >= 1 - epsilon into the over-strong, unsatisfiable r >= 1, so
validation spuriously failed and the strictly smaller current model value was
reported instead (e.g. r = 0). For shared-symbol objectives this also produced
values matching neither the model nor the true optimum (issue #10028 follow-up).

Fix: carry the infinitesimal faithfully through the bound pipeline.
- lp_api::bound gains an eps component so get_value reports the true delta value
  (no spurious rational fixed-variable equality is propagated to EUF).
- lar_base_constraint stores its right-hand side as a delta-rational impq pair;
  rhs() returns the rational component, bound_eps() the infinitesimal one.
- lar_solver bound activation/update threads the whole impq bound, so a lower
  bound (r, -1) can be asserted; constraint_holds accounts for it using the same
  strict-bounds delta that flattens the model (computed once per model).
- theory_lra::mk_ge builds a fresh predicate for the (r, -1) lower bound to
  avoid colliding with an already-internalized v >= r literal, and attaches
  eps = -1; opt_solver::mk_ge passes the unprojected value to theory_lra /
  theory_mi_arith / theory_inf_arith (whose bounds are inf_rational).

Results: maximize r, r<1 -> 1-eps; minimize r, r>1 -> 1+eps; bounded and lex/box
strict optima correct; integer optima and the #10028 shared-symbol cases
unchanged. Unit tests 92/92; the opt regression corpus (model_validate=true) is
byte-identical to baseline.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-07 15:30:05 -07:00
..
ackermannization block ackermann over nested selects 2026-06-19 10:41:56 -07:00
api Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
ast Fix debug-only well-sorted traversal freeing temporary assertions (#10067) 2026-07-07 13:26:44 -07:00
cmd_context reduce leaks for sorts 2026-07-07 12:04:14 -07:00
math opt: validate strict optimization optima faithfully with delta-rational bounds 2026-07-07 15:30:05 -07:00
model updates to tptp_frontend 2026-07-04 14:34:21 -07:00
muz Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
nlsat Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
opt opt: validate strict optimization optima faithfully with delta-rational bounds 2026-07-07 15:30:05 -07:00
params fix loop bug in ho_matching and add throttle configurations 2026-07-07 09:20:32 -07:00
parsers Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
qe Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
sat Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
shell Fixes necessary to compile z3 included in clang-tidy via FetchContents. (#9768) 2026-06-08 19:44:01 -07:00
smt opt: validate strict optimization optima faithfully with delta-rational bounds 2026-07-07 15:30:05 -07:00
solver stop complaining abot Char in QF_S benchmarks 2026-07-04 14:27:34 -07:00
tactic [snapshot-regression-fix] Fix elim_uncnstr disabled by manager-wide has_type_vars() flag (iss-6260/small-2) (#10063) 2026-07-07 13:02:37 -07:00
test bugfixes to front-end and matcher 2026-07-06 17:14:41 -07:00
util Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
CMakeLists.txt git bindings v1.0 2026-02-18 21:02:25 -08:00