3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-07-15 11:35:42 +00:00
z3/src
Copilot 710b4082d1
Add constant-bound contradiction shortcut for string < constraints in theory_seq (#10112)
The reported case showed expensive reasoning for lexicographic string
comparisons under the default sequence solver, and incorrect handling
expectations with `z3str3` (which does not interpret these comparisons).
This change targets the default solver path by short-circuiting
contradictory constant-bound `<` constraints earlier.

- **Theory shortcut for constant lexical bounds**
- In `theory_seq::assign_eh`, detect asserted `str.<` constraints of the
form `c < x` or `x < c` where `c` is a string constant.
- When a complementary bound on the same equivalence class is already
true, check bound consistency immediately.
- If bounds are contradictory (`!(lower < upper)`), emit a direct theory
conflict from the two active literals instead of waiting for deeper
axiom propagation.

- **Preserve existing comparison reasoning**
  - Existing `check_lts` transitivity/axiom flow is retained.
- The new logic is a narrow fast path for contradictory constant bounds
and does not alter general string-order semantics.

- **Regression coverage**
- Added a solver-level regression in `src/test/seq_rewriter.cpp` for
contradictory date-like lexical bounds to ensure this class of
constraints is rejected as `unsat`.

```cpp
ctx.assert_expr(su.str.mk_lex_lt(su.str.mk_string("2024-01-01"), x));
ctx.assert_expr(su.str.mk_lex_lt(x, su.str.mk_string("2024-12-31")));
ctx.assert_expr(su.str.mk_lex_lt(x, su.str.mk_string("2023-01-01")));
ENSURE(ctx.check() == l_false);
```

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-07-13 12:56:57 -07:00
..
ackermannization block ackermann over nested selects 2026-06-19 10:41:56 -07:00
api Java API: return EnumSort instead of DatatypeSort from Sort.create() (#10104) 2026-07-12 21:46:46 -07:00
ast Fix non-termination in mod rewriter for symbolic modulus (#10105) 2026-07-13 09:20:03 -07:00
cmd_context Set pi.avoid_skolems=false for TPTP solver runs (#10100) 2026-07-12 19:21:25 -07:00
math Add linear divisibility closure lemma for lp/nla solver (#7464) (#10107) 2026-07-12 21:20:50 -07:00
model updates to tptp_frontend 2026-07-04 14:34:21 -07:00
muz Spacer QE: avoid assertion on extended arithmetic model values and add #3845 regression (#10096) 2026-07-12 18:52:44 -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 (#10059) 2026-07-09 10:39:23 -07:00
params expose avoid-skolems parameter to deal with TPTP problems 2026-07-12 18:54:31 -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 Issue 438 (#10085) 2026-07-12 13:35:57 -07:00
shell Fixes necessary to compile z3 included in clang-tidy via FetchContents. (#9768) 2026-06-08 19:44:01 -07:00
smt Add constant-bound contradiction shortcut for string < constraints in theory_seq (#10112) 2026-07-13 12:56:57 -07:00
solver Fix unsigned overflow in parallel solver conflict budget escalation (#10076) 2026-07-10 15:25:57 -07:00
tactic Issue 438 (#10085) 2026-07-12 13:35:57 -07:00
test Add constant-bound contradiction shortcut for string < constraints in theory_seq (#10112) 2026-07-13 12:56:57 -07:00
util bug fixes to ho_matching - offset alignment inv_var_shift, callback scopes should not be nested, allow bindings that are not ground 2026-07-09 19:16:12 -07:00
CMakeLists.txt git bindings v1.0 2026-02-18 21:02:25 -08:00