mirror of
https://github.com/Z3Prover/z3
synced 2026-07-15 11:35:42 +00:00
`qe-lite` could produce malformed formulas when expanding bounded
quantifiers under nested binders, leaving outer de Bruijn indices
unshifted after eliminating an inner quantifier (e.g., `(:var 1)`
escaping capture). This change fixes index normalization in that rewrite
path and adds a regression for the reported forall/exists arithmetic
case.
- **Rewrite correctness in bounded quantifier expansion**
- In `src/qe/lite/qe_lite_tactic.cpp`, after substituting bounded
variables in payload conjuncts, apply `inv_var_shifter(num_decls)` so
outer bound variables are reindexed relative to the removed binder.
- This preserves quantifier structure correctness when
`try_expand_bounded_quantifier` eliminates an inner quantifier.
- **Regression coverage for the reported pattern**
- In `src/test/smt_context.cpp`, add a focused quantified arithmetic
formula matching the bug shape:
- outer `forall (x, x4)`
- inner `exists (y)`
- mixed inequalities that trigger qe-lite bounded expansion
- Assert the formula is unsatisfiable, preventing reintroduction of
invalid index handling in this path.
```c++
inst = vs(p, subst_map.size(), subst_map.data());
shift(inst, num_decls, inst); // reindex outer de Bruijn vars after eliminating inner quantifier
```
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
|
||
|---|---|---|
| .. | ||
| lite | ||
| mbp | ||
| CMakeLists.txt | ||
| nlarith_util.cpp | ||
| nlarith_util.h | ||
| nlqsat.cpp | ||
| nlqsat.h | ||
| qe.cpp | ||
| qe.h | ||
| qe_arith_plugin.cpp | ||
| qe_array_plugin.cpp | ||
| qe_bool_plugin.cpp | ||
| qe_bv_plugin.cpp | ||
| qe_cmd.cpp | ||
| qe_cmd.h | ||
| qe_datatype_plugin.cpp | ||
| qe_dl_plugin.cpp | ||
| qe_mbi.cpp | ||
| qe_mbi.h | ||
| qe_mbp.cpp | ||
| qe_mbp.h | ||
| qe_tactic.cpp | ||
| qe_tactic.h | ||
| qsat.cpp | ||
| qsat.h | ||