[coz3-deepunknown] str.replace_all on symbolic first argument returns `unknown` (QF_SLIA transducer-plus benchmark)
[!CAUTION] agentic threat detected Threat detection flagged this output in warn mode. Manual review is REQUIRED before any follow-up automation.
DetailsPotential security threats were detected in the agent output.
Review the workflow run logs for details.
[!CAUTION] Protected files were modified in this change. This pull request is in
request-reviewmode and requires explicit human scrutiny before merge.Protected files:
.github/workflows/nfv-formal-audit-dispatcher.yml
Category: A — Feature limitation (no code change)
z3's seq theory deliberately treats str.replace_all as an unhandled term whenever its first argument is not a concrete string (or a concatenation of concrete unit values); it never axiomatizes it in that case, so check-sat gives up with unknown. This is a genuine, currently-unimplemented completeness gap, not a bug or seed-dependent instability.
Provenance
- Candidate key:
qf-slia-master::non-incremental-QF_SLIA-20230331-transducer-plus-Commutativity-addslashes-escapeString.smt2 - Origin report discussion: https://github.com/Z3Prover/bench/discussions/4521
- Source stats markdown: (z3prover.github.io/redacted) (job
qf-slia-master, reportsUNKNOWN 182for this run, this query included among them) - Benchmark set:
QF_SLIA - Exact query:
non-incremental/QF_SLIA/20230331-transducer-plus/Commutativity/addslashes-escapeString.smt2 - Input corpus: https://zenodo.org/records/16740866/files/QF_SLIA.tar.zst?download=1
- z3 commit reproduced on:
148e396f0(master)
Reproduction
The benchmark encodes a "commutativity" property of two composed string-escaping functions (addslashes, escapeString), each defined via long chains (~4 and ~130 respectively) of str.replace_all calls over fully symbolic strings x, y, z, w, u, plus a str.at/str.in_re conclusion. No concrete string literal ever pins down x.
$ ./build/z3 non-incremental/QF_SLIA/20230331-transducer-plus/Commutativity/addslashes-escapeString.smt2
unknown- Wall-clock: ~43ms (no timeout or resource limit involved; z3 gives up immediately via the "unhandled expression" bailout, not because of a search budget).
- No special options were required to match the run; default options were used (matching the run-miner's non-incremental
-Tstyle harness, which was not otherwise triggered here since the answer comes back near-instantly).
Seed-sensitivity check (rules out category C)
Re-ran with sat.random_seed, smt.random_seed ∈ {0,1,2,3,4,42,100,12345} and smt.arith.random_initial_value=true: all 8 seeds return unknown, confirming this is not seed-dependent instability but a hard bailout.
Minimized reproducer
A single str.replace_all on a symbolic first argument already triggers the same unknown, even though the answer is trivially sat:
(declare-const y String)
(declare-const w String)
(assert (= w (str.replace_all y "u" "A")))
(assert (= w "A"))
(check-sat)
; z3: unknown (expected: sat, e.g. y = "A" or y = "u")Whereas a fully symbolic case with no concrete anchor (closer to this benchmark's shape, where no literal ever constrains x) also returns unknown:
(declare-const x String)
(declare-const y String)
(assert (= y (str.replace_all x "u" "A")))
(assert (= (str.len x) (str.len y)))
(check-sat)
; z3: unknownA concrete first argument, by contrast, is handled correctly by the rewriter:
(declare-const w String)
(assert (= w (str.replace_all "uXu" "u" "A")))
(check-sat)
(get-value (w))
; z3: sat ((w "AXA"))Responsible source
src/smt/theory_seq.cpp:3520-3524—relevant_ehmarks anystr.replace_all/str.replace_re/str.replace_re_allnode asadd_unhandled_expr(n).src/smt/theory_seq.cpp:3491— the line that would instead enqueue areplace_allaxiom (m_util.str.is_replace_all(n)) is commented out ("uncomment to enable axiomatization").src/smt/theory_seq.cpp:474-476—final_check_ehgives up (FC_GIVEUP, surfacing asunknown) wheneverm_unhandled_expris set.src/ast/rewriter/seq_rewriter.cpp(mk_seq_replace_all, around lines 1790-1856) — only rewritesstr.replace_allwhen the first argument is a concrete string or a concatenation of concrete unit values; for a symbolic first argument it returnsBR_FAILED, leaving the term for the theory to (not) handle.
This matches the exact diagnosis previously made in the now-closed #9928 ("str.replace_all on a symbolic first argument returns unknown", QF_S rna benchmarks) — this is the same underlying incompleteness, independently rediscovered on a different benchmark family (QF_SLIA/20230331-transducer-plus, string-escaping/transducer properties) rather than QF_S/20250403-rna.
Design-space analysis (why no fix is included)
str.replace_all(a, b, c) for symbolic a requires relating a and the result via a recursive relation (informally: either b does not occur in a and the result equals a, or a splits as pre ++ b ++ post with b not occurring earlier in pre, and the result is pre ++ c ++ replace_all(post, b, c)). Z3's own axioms::replace_all_axiom in seq_axioms.cpp is left as NOT_IMPLEMENTED_YET(), with the recursive-relation construction present but disabled under #if 0 — i.e. the authors already scoped this and chose not to ship it.
Candidate approaches, as previously evaluated in #9928:
- Implement the disabled recursive-relation axiomatization (uncomment
theory_seq.cpp:3491, finishseq_axioms.cpp'sreplace_all_axiom). This is the "correct", general fix but is a substantial feature (a new axiom schema plus quantifier/skolem instantiation and careful termination/triggering), not a minimal maintenance change, and risks regressing performance or introducing incompleteness/non-termination elsewhere in the seq solver if done hastily. - Restrict to single-character-to-single-character replace_all, reducing to
seq.mapwith aniteper character (replace_all(s, c1, c2) ≡ seq.map(λch. ite(ch=c1, c2, ch), s)), which is semantically valid for single-char patterns (non-overlapping, length-preserving). #9928 already tried this and found it turns the fastunknowninto a timeout (>60s) on the very benchmark it targeted, and that even a trivialseq.mapidentity is itself sometimesunknownfor unconstrained length — so this narrower special case is not obviously an improvement and doesn't generalize to this benchmark's much longer chains (up to ~130 nestedstr.replace_allcalls inescapeString). - Do nothing / leave as
unknown. Given the benchmark's own:status unknownannotation and the depth of the underlying theoretical gap,unknownis the currently-correct, sound answer. My recommendation, consistent with #9928, is to track this as a known feature-request/limitation and only invest in option 1 as a deliberate feature project (with dedicated regression benchmarks and perf validation) rather than as a one-off maintenance patch.
No code change is included; this issue records the categorization and analysis per the triage workflow's guardrails (changes to ./z3 are made only for confidently-validated basic bugs).
Minimized reproducer
See "Minimized reproducer" above — two small, quickly-obtained SMT2 snippets isolate the exact bailout without needing the full ~130-call escapeString chain.
[!NOTE] This was originally intended as a pull request, but PR creation failed. The changes have been pushed to the branch
coz3-deepunknown/replace-all-symbolic-slia-transducer-e0d03ade55c901d7.Original error: ERR_API: [2026-09-28T00:40:47.441Z] create pull request in Z3Prover/z3 failed (attempt 1)
Original error: Validation Failed: {"resource":"PullRequest","field":"head","code":"invalid"} - https://docs.github.com/rest/pulls/pulls#create-a-pull-request Retryable: false Suggestion: This error cannot be resolved by retrying. Please check the error details and fix the underlying issue.
To create the pull request manually:
gh pr create --title "[coz3-deepunknown] str.replace_all on symbolic first argument returns `unknown` (QF_SLIA transducer-plus benchmark)" --base master --head coz3-deepunknown/replace-all-symbolic-slia-transducer-e0d03ade55c901d7 --repo Z3Prover/z3From eccd8fb9bf1901bc80c5da990c0edb4fccf3adf7 Mon Sep 17 00:00:00 2001
X-GH-AW-Base-Commit: 5f37a766a96f36bc7b59da24affd86857bf54a9e
From: Nikolaj Bjorner <[email protected]>
Date: Sun, 27 Sep 2026 13:15:57 -0700
Subject: [PATCH 1/2] Add 'edited' type to pull_request_target events
---
.github/workflows/nfv-formal-audit-dispatcher.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/nfv-formal-audit-dispatcher.yml b/.github/workflows/nfv-formal-audit-dispatcher.yml
index 4aedaea27..b336d8af6 100644
--- a/.github/workflows/nfv-formal-audit-dispatcher.yml
+++ b/.github/workflows/nfv-formal-audit-dispatcher.yml
@@ -3,7 +3,7 @@ name: Dispatch NFV formal audit
on:
pull_request_target:
branches: [master]
- types: [opened, synchronize, closed]
+ types: [opened, synchronize, edited, closed]
permissions:
contents: read
--
2.54.0
From 148e396f0d6b5d8c1e98429f53653ba5f25ad35b Mon Sep 17 00:00:00 2001
From: Copilot <[email protected]>
Date: Sun, 27 Sep 2026 16:36:56 -0700
Subject: [PATCH 2/2] Restore array extensionality after value-root disequality
shortcut (#10936)
Quantified array queries regressed after `is_diseq` began treating
distinct value roots as disequal. `already_diseq` then skipped
extensionality witnesses needed for E-matching and MBQI progress.
- **Scoped disequality check**
- Keep the value-root shortcut as the default `is_diseq` behavior.
- Add `is_diseq_no_value_check` for callers that require
congruence/atom-based disequality only.
- **Array extensionality**
- Use the no-value-check variant exclusively in
`theory_array_base::already_diseq`.
- Prevent distinct select-value roots from suppressing an extensionality
witness.
```cpp
if (ctx.is_diseq_no_value_check(parent, other)) {
return true;
}- Regression coverage
- Add an SMT-context test asserting that a disequal array pair with selects rooted at distinct values still emits an array extensionality
... (truncated)
</details>
> [!WARNING]
> <details>
> <summary>Firewall blocked 7 domains</summary>
>
> The following domains were blocked by the firewall during workflow execution:
>
> - `api.github.com`
> - `codeload.github.com`
> - `github.com`
> - `objects.githubusercontent.com`
> - `raw.githubusercontent.com`
> - `z3prover.github.io`
> - `zenodo.org`
>
> [!TIP]
> `api.github.com` is blocked because GitHub API access uses the built-in GitHub tools by default. Instead of adding `api.github.com` to `network.allowed`, use `tools.github.mode: gh-proxy` for direct pre-authenticated GitHub CLI access without requiring network access to `api.github.com`:
>
> ```yaml
> tools:
> github:
> mode: gh-proxy
> ```
>
> See [GitHub Tools](https://github.github.com/gh-aw/reference/github-tools/) for more information on `gh-proxy` mode.
>
> To allow these domains, add them to the `network.allowed` list in your workflow frontmatter:
>
> ```yaml
> network:
> allowed:
> - defaults
> - "api.github.com"
> - "codeload.github.com"
> - "github.com"
> - "objects.githubusercontent.com"
> - "raw.githubusercontent.com"
> - "z3prover.github.io"
> - "zenodo.org"
> ```
>
> See [Network Configuration](https://github.github.com/gh-aw/reference/network/) for more information.
>
> </details>
> Generated by [Triage one CoZ3 run-miner unknown query](https://github.com/Z3Prover/bench/actions/runs/36361779560) · copilot · auto · 143.4 AIC · ⌖ 15.4 AIC · ⊞ 11.8K · [◷](https://github.com/search?q=repo%3AZ3Prover%2Fz3+%22gh-aw-workflow-id%3A+coz3-deepunknown%22&type=pullrequests)
<!-- gh-aw-agentic-workflow: Triage one CoZ3 run-miner unknown query, engine: copilot, model: auto, id: 36361779560, workflow_id: coz3-deepunknown, run: https://github.com/Z3Prover/bench/actions/runs/36361779560 -->
<!-- gh-aw-workflow-id: coz3-deepunknown -->
<!-- gh-aw-workflow-call-id: Z3Prover/bench/coz3-deepunknown -->Source: Z3Prover/z3