3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-07-15 11:35:42 +00:00
z3/.github/workflows
Lev Nachmanson ed6e2a241d
opt: validate strict optimization optima faithfully with delta-rational bounds (#10059)
## Problem

Maximizing/minimizing under a **strict** inequality has a delta-rational
optimum. For

```smt2
(declare-const r Real)
(assert (< r 1))
(maximize r)
(check-sat)
(get-objectives)
```

the optimum is the supremum `1 - epsilon`, but z3 reported `r = 0`.

The same defect makes shared-symbol objectives report a value matching
**neither the model nor the true optimum** (issue #10028 follow-up).
Minimal reproducer — a 6-mark Golomb ruler (a `>32`-arg `distinct`, so
the objective is coupled to EUF) with a strict real objective `obj >
x5`, whose true optimum is `17 + epsilon`:

| case | before | after |
|---|---|---|
| `maximize r`, `r < 1` | `0`  | `1 - epsilon`  |
| `minimize r`, `r > 1` | `0`  | `1 + epsilon`  |
| Golomb `minimize obj`, `obj > x5` | `35/2` / `7+eps`  | `17 +
epsilon`  |

## Root cause

`check_bound` validates the LP hint by asserting `objective >= optimum`.
For a supremum `1 - epsilon` this is a **lower** bound whose value
carries a **negative** infinitesimal `(1, -1)`.

No `lconstraint_kind` can express that. The kind->infinitesimal map only
yields the *matching-sign* cases — `GT` -> lower `(r, +1)`, `LT` ->
upper `(r, -1)` — or zero (`GE`/`LE`). The opposite-sign lower bound
`(r, -1)` (i.e. `r >= r0 - delta`) is a *relaxation* that no strict
inequality produces. `opt_solver::mk_ge` therefore projected the
`-epsilon` away, turning `r >= 1 - epsilon` into the over-strong,
unsatisfiable `r >= 1`; validation failed and the strictly smaller
current model value was reported instead.

## Fix — carry the infinitesimal faithfully through the bound pipeline

- **`lp_api::bound`** gains an `eps` component so `get_value` returns
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 already `inf_rational`).

The pair machinery is what makes the supremum both representable
(optimum `1 - epsilon`) and validatable; the reported witness model
remains the flattened rational (`find_delta_for_strict_bounds`),
consistent with the existing epsilon semantics.

## Validation

- Strict optima correct: `1-eps`, `1+eps`, bounded `2<r<5 -> 5-eps`, and
lex/box variants.
- Integer optima and the #10028 shared-symbol cases unchanged (Golomb
n=6/7/8 -> 17/25/34, consistent with the model).
- Unit tests **92/92** (release); no new debug-suite failures.
- Opt regression corpus (73 files, `model_validate=true`)
**byte-identical** to baseline.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-07-09 10:39:23 -07:00
..
shared Upgrade agentic workflows to gh-aw v0.36.0 (#8122) 2026-01-08 11:50:35 -08:00
a3-python.lock.yml Bump github/gh-aw-actions from 0.79.6 to 0.80.4 (#9902) 2026-06-18 17:42:08 -06:00
a3-python.md Suppress auto-created failure issues for agentic workflows (#9834) 2026-06-11 20:57:43 -07:00
academic-citation-tracker.lock.yml Bump actions/cache/save from 5.0.5 to 6.1.0 (#10024) 2026-07-03 13:17:06 -07:00
academic-citation-tracker.md Suppress auto-created failure issues for agentic workflows (#9834) 2026-06-11 20:57:43 -07:00
agentics-maintenance.yml Bump actions/cache/save from 5.0.5 to 6.1.0 (#10024) 2026-07-03 13:17:06 -07:00
android-build.yml Bump actions/checkout from 6.0.2 to 7.0.0 (#9913) 2026-06-20 12:14:49 -06:00
api-coherence-checker.lock.yml Bump actions/cache/save from 5.0.5 to 6.1.0 (#10024) 2026-07-03 13:17:06 -07:00
api-coherence-checker.md Suppress auto-created failure issues for agentic workflows (#9834) 2026-06-11 20:57:43 -07:00
build-warning-fixer.lock.yml Bump github/gh-aw-actions from 0.79.6 to 0.80.4 (#9902) 2026-06-18 17:42:08 -06:00
build-warning-fixer.md Suppress auto-created failure issues for agentic workflows (#9834) 2026-06-11 20:57:43 -07:00
build-z3-cache.yml Bump actions/cache from 6.0.0 to 6.1.0 (#10023) 2026-07-03 13:18:39 -07:00
ci.yml Fix OCaml static build: ensure stublibs dir is in ld.conf after ocamlfind install (#10003) 2026-06-30 08:43:02 -07:00
code-conventions-analyzer.lock.yml Bump actions/cache/save from 5.0.5 to 6.1.0 (#10024) 2026-07-03 13:17:06 -07:00
code-conventions-analyzer.md Suppress auto-created failure issues for agentic workflows (#9834) 2026-06-11 20:57:43 -07:00
code-simplifier.lock.yml Bump github/gh-aw-actions from 0.79.6 to 0.80.4 (#9902) 2026-06-18 17:42:08 -06:00
code-simplifier.md Suppress auto-created failure issues for agentic workflows (#9834) 2026-06-11 20:57:43 -07:00
compare-stats-anomaly-reporter.lock.yml Bump github/gh-aw-actions from 0.79.6 to 0.80.4 (#9902) 2026-06-18 17:42:08 -06:00
compare-stats-anomaly-reporter.md Suppress auto-created failure issues for agentic workflows (#9834) 2026-06-11 20:57:43 -07:00
copilot-setup-steps.yml update aw to current version 2026-01-08 18:15:03 +00:00
coverage.yml Bump actions/checkout from 6.0.2 to 7.0.0 (#9913) 2026-06-20 12:14:49 -06:00
cross-build.yml Bump actions/checkout from 6.0.2 to 7.0.0 (#9913) 2026-06-20 12:14:49 -06:00
csa-analysis.lock.yml Bump actions/cache/save from 5.0.5 to 6.1.0 (#10024) 2026-07-03 13:17:06 -07:00
csa-analysis.md Suppress auto-created failure issues for agentic workflows (#9834) 2026-06-11 20:57:43 -07:00
docs.yml Bump actions/checkout from 6.0.2 to 7.0.0 (#9913) 2026-06-20 12:14:49 -06:00
fstar-master-build.yml Bump actions/checkout from 6.0.2 to 7.0.0 (#9913) 2026-06-20 12:14:49 -06:00
issue-backlog-processor.lock.yml Bump actions/cache/save from 5.0.5 to 6.1.0 (#10024) 2026-07-03 13:17:06 -07:00
issue-backlog-processor.md Suppress auto-created failure issues for agentic workflows (#9834) 2026-06-11 20:57:43 -07:00
mark-prs-ready-for-review.yml Bump actions/github-script from 8.0.0 to 9.0.0 (#9296) 2026-04-19 16:49:03 +02:00
memory-safety-report.lock.yml Bump actions/cache/save from 5.0.5 to 6.1.0 (#10024) 2026-07-03 13:17:06 -07:00
memory-safety-report.md Suppress auto-created failure issues for agentic workflows (#9834) 2026-06-11 20:57:43 -07:00
memory-safety.yml Bump actions/checkout from 6.0.2 to 7.0.0 (#9913) 2026-06-20 12:14:49 -06:00
msvc-static-build-clang-cl.yml Bump actions/checkout from 6.0.2 to 7.0.0 (#9913) 2026-06-20 12:14:49 -06:00
msvc-static-build.yml Bump actions/checkout from 6.0.2 to 7.0.0 (#9913) 2026-06-20 12:14:49 -06:00
nightly-validation.yml Bump actions/checkout from 6.0.2 to 7.0.0 (#9913) 2026-06-20 12:14:49 -06:00
nightly.yml Nightly: fix Mac ARM64 build by targeting macOS 13.3 for std::format (#10075) 2026-07-09 08:45:51 -07:00
nuget-build.yml Bump actions/checkout from 6.0.2 to 7.0.0 (#9913) 2026-06-20 12:14:49 -06:00
ocaml.yaml opt: validate strict optimization optima faithfully with delta-rational bounds (#10059) 2026-07-09 10:39:23 -07:00
ostrich-benchmark.lock.yml Bump github/gh-aw-actions from 0.79.6 to 0.80.4 (#9902) 2026-06-18 17:42:08 -06:00
ostrich-benchmark.md Suppress auto-created failure issues for agentic workflows (#9834) 2026-06-11 20:57:43 -07:00
pyodide-pypi.yml Bump actions/checkout from 6.0.2 to 7.0.0 (#9913) 2026-06-20 12:14:49 -06:00
qf-s-benchmark.lock.yml Bump github/gh-aw-actions from 0.79.6 to 0.80.4 (#9902) 2026-06-18 17:42:08 -06:00
qf-s-benchmark.md Suppress auto-created failure issues for agentic workflows (#9834) 2026-06-11 20:57:43 -07:00
release-notes-updater.lock.yml Bump github/gh-aw-actions from 0.79.6 to 0.80.4 (#9902) 2026-06-18 17:42:08 -06:00
release-notes-updater.md Suppress auto-created failure issues for agentic workflows (#9834) 2026-06-11 20:57:43 -07:00
release.yml Pin macOS wheel target to 13.0 in release and nightly workflows (#10054) 2026-07-06 17:55:01 -07:00
smtlib-benchmark-finder.lock.yml Bump actions/cache/save from 5.0.5 to 6.1.0 (#10024) 2026-07-03 13:17:06 -07:00
smtlib-benchmark-finder.md Suppress auto-created failure issues for agentic workflows (#9834) 2026-06-11 20:57:43 -07:00
specbot-crash-analyzer.lock.yml Bump actions/cache/save from 5.0.5 to 6.1.0 (#10024) 2026-07-03 13:17:06 -07:00
specbot-crash-analyzer.md Suppress auto-created failure issues for agentic workflows (#9834) 2026-06-11 20:57:43 -07:00
tactic-to-simplifier.lock.yml Bump actions/cache/save from 5.0.5 to 6.1.0 (#10024) 2026-07-03 13:17:06 -07:00
tactic-to-simplifier.md Suppress auto-created failure issues for agentic workflows (#9834) 2026-06-11 20:57:43 -07:00
tptp-benchmark.lock.yml Bump github/gh-aw-actions from 0.79.6 to 0.80.4 (#9902) 2026-06-18 17:42:08 -06:00
tptp-benchmark.md Suppress auto-created failure issues for agentic workflows (#9834) 2026-06-11 20:57:43 -07:00
wasm-release.yml Bump actions/checkout from 6.0.2 to 7.0.0 (#9913) 2026-06-20 12:14:49 -06:00
wasm.yml Bump actions/checkout from 6.0.2 to 7.0.0 (#9913) 2026-06-20 12:14:49 -06:00
Windows.yml Bump actions/checkout from 6.0.2 to 7.0.0 (#9913) 2026-06-20 12:14:49 -06:00
wip.yml Bump actions/checkout from 6.0.2 to 7.0.0 (#9913) 2026-06-20 12:14:49 -06:00
workflow-suggestion-agent.lock.yml Bump actions/cache/save from 5.0.5 to 6.1.0 (#10024) 2026-07-03 13:17:06 -07:00
workflow-suggestion-agent.md Suppress auto-created failure issues for agentic workflows (#9834) 2026-06-11 20:57:43 -07:00
zipt-code-reviewer.lock.yml Bump actions/cache/save from 5.0.5 to 6.1.0 (#10024) 2026-07-03 13:17:06 -07:00
zipt-code-reviewer.md Suppress auto-created failure issues for agentic workflows (#9834) 2026-06-11 20:57:43 -07:00