3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-08-09 23:42:21 +00:00
z3/src
z3prover-ci-bot[bot] 9695ceafbc
[snapshot-regression-fix] Allow shadowing non-core nullary builtins (pi, euler) (#10424)
## Summary

Fixes a regression detected by the snapshot-regression corpus.

- Originating discussion:
https://github.com/Z3Prover/bench/discussions/3514
- Benchmark ref: `iss-2795/bug-1.smt2`

## Divergence

```diff
--- bug-1.expected.out (expected)
+++ produced (current z3)
@@ -1 +1,2 @@
+(error "line 3 column 23: invalid declaration, builtin symbol 'pi' has the same argument sorts")
 unsat
```

The benchmark declares `(declare-fun pi () Real)`. The expected oracle
is `unsat`; current z3 instead errors out before solving.

## Root cause

Commit 2999517d5 (#10411, "Reject declarations that clash with built-in
signatures") added `cmd_context::builtin_signature_collides`, which
rejects any user declaration whose name resolves to a built-in
application. For **nullary** symbols there are no argument sorts to
distinguish an overload, so this also rejected declarations of
Z3-specific arithmetic *extension* constants such as `pi` and `euler`
(registered as `OP_PI` / `OP_E` in `arith_decl_plugin`). These are not
SMT-LIB reserved symbols and were historically allowed to be shadowed by
user declarations, which is what `iss-2795/bug-1.smt2` relies on.

## Fix

In `builtin_signature_collides`, keep rejecting:
- any collision with `arity > 0` (real overload clash), and
- nullary symbols that resolve into the **basic** theory family (genuine
reserved core constants such as `true`/`false`).

Allow nullary symbols that resolve into non-core theory plugins (e.g.
`pi`, `euler`) to be shadowed. The change is confined to
`src/cmd_context/cmd_context.cpp`.

## Validation

Rebuilt z3 (`make -j8` from `scripts/mk_make.py`) and re-ran the
benchmark:

```
$ ./z3 -T:20 inputs/issues/iss-2795/bug-1.smt2
unsat
```

which now matches the recorded oracle. Also confirmed the intended
#10411 rejections still fire:
- `(declare-fun and (Bool Bool) Int)` -> rejected
- `(declare-const true Bool)` -> rejected
- `(define-fun + ((a Int)(b Int)) Int 0)` -> rejected
- `(declare-fun pi () Real)` / `(declare-fun euler () Real)` -> now
accepted




> [!WARNING]
> <details>
> <summary>Firewall blocked 1 domain</summary>
>
> The following domain was blocked by the firewall during workflow
execution:
>
> - `pypi.org`
>> To allow these domains, add them to the `network.allowed` list in
your workflow frontmatter:
>
> ```yaml
> network:
>   allowed:
>     - defaults
>     - "pypi.org"
> ```
>
> See [Network
Configuration](https://github.github.com/gh-aw/reference/network/) for
more information.
>
> </details>


> Generated by [Fix a Z3 snapshot-regression
divergence](https://github.com/Z3Prover/bench/actions/runs/31074578887)
· 190.8 AIC · ⌖ 19.6 AIC · ⊞ 10.7K ·
[◷](https://github.com/search?q=repo%3AZ3Prover%2Fz3+%22gh-aw-workflow-id%3A+snapshot-regression-fixer%22&type=pullrequests)

<!-- gh-aw-agentic-workflow: Fix a Z3 snapshot-regression divergence,
engine: copilot, version: 1.0.65, model: claude-opus-4.8, id:
31074578887, workflow_id: snapshot-regression-fixer, run:
https://github.com/Z3Prover/bench/actions/runs/31074578887 -->

<!-- gh-aw-workflow-id: snapshot-regression-fixer -->
<!-- gh-aw-workflow-call-id: Z3Prover/bench/snapshot-regression-fixer
-->

Co-authored-by: z3prover-ci-bot[bot] <305651407+z3prover-ci-bot[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-08-06 14:35:18 -07:00
..
ackermannization block ackermann over nested selects 2026-06-19 10:41:56 -07:00
api Fix npm dependency security vulnerabilities in src/api/js (#10369) 2026-08-03 10:56:27 -07:00
ast Update seq_axioms.cpp 2026-08-05 18:13:35 -07:00
cmd_context [snapshot-regression-fix] Allow shadowing non-core nullary builtins (pi, euler) (#10424) 2026-08-06 14:35:18 -07:00
math Refine monomial bound optimization 2026-08-06 12:50:38 -07:00
model updates to tptp_frontend 2026-07-04 14:34:21 -07:00
muz Make implicit switch case fall-throughs explicit (#10284) 2026-07-29 09:05:42 -07:00
nlsat Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
opt opt: don't stop the search on a stalled delta-rational objective (#10412) 2026-08-05 12:35:32 -07:00
params Add monadic regex end-game solver 2026-08-01 12:03:53 -07:00
parsers scanner: emit ERROR_TOKEN on I/O failure instead of silent EOF (#10294) 2026-07-29 14:00:42 -07:00
qe [snapshot-regression-fix] Spacer: keep symbolic term_graph representatives to fix 'Stuck on a lemma' regression (#10237) 2026-07-29 14:19:25 -07:00
sat Add global suppress_platform_verbose parameter (#10319) 2026-07-30 20:08:25 -07:00
shell
smt Fix 10388 (#10418) 2026-08-05 19:27:03 -07:00
solver fix: parallel mode exits unknown immediately for QF_BV due to reason-string mismatch (#10183) 2026-07-21 19:48:55 -07:00
tactic Disable "-Wnoctad-maybe-unsupported", add and fix "-Wdeprecated-copy-with-user-provided-copy". (#10332) 2026-07-31 19:34:08 -07:00
test Reject declarations that clash with built-in signatures (#10411) 2026-08-05 17:08:31 -07:00
util Track maximum regex lengths 2026-08-05 12:15:55 -07:00
CMakeLists.txt