3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-06-27 19:08:49 +00:00
Commit graph

22823 commits

Author SHA1 Message Date
Nikolaj Bjorner
8c989f8840 update tptp front-end 2026-05-25 09:31:25 -07:00
Nikolaj Bjorner
24bb93c3e4 nit 2026-05-24 15:48:10 -07:00
Nikolaj Bjorner
bb73d5fc8e remove redundant code
theory_array_full.cpp performs a similar unfolding of lambda definitions.
2026-05-24 15:39:54 -07:00
Nikolaj Bjorner
24248b3300 code nits 2026-05-24 13:14:25 -07:00
Nikolaj Bjorner
459629c662 bugfixes to ho_matcher
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-05-23 18:06:04 -07:00
Nikolaj Bjorner
4a90d31050 Update tptp_frontend.cpp 2026-05-23 13:29:01 -07:00
Nikolaj Bjorner
ea0964d195 enable higher-order matching in mam/smt_quantifier 2026-05-22 17:06:37 -07:00
Nikolaj Bjorner
98d0e7f27c updates to ho-matcher for lambdas 2026-05-22 14:16:06 -07:00
Nikolaj Bjorner
e7eef2432d allow mam work with ground patterns 2026-05-22 14:14:23 -07:00
Nikolaj Bjorner
95b3ffeb25 replace struct by class
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-05-22 14:14:23 -07:00
Nikolaj Bjorner
19166bd0b5 prepare for lambda unfolding in ho-matcher and selectively enable ho matching
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-05-22 13:25:01 -07:00
Nikolaj Bjorner
f40e4759e4 fixes to tptp 2026-05-22 13:25:00 -07:00
CEisenhofer
c18aa647e1 Removed recursion from regex unwinding 2026-05-22 15:15:48 +02:00
CEisenhofer
5dcc5efcdd Remove recursive paths from model construction 2026-05-22 14:56:17 +02:00
CEisenhofer
cedb13d045 First check for conflict and then sat 2026-05-22 14:38:07 +02:00
CEisenhofer
7ede1b9c3d re.plus is a regex as well 2026-05-22 14:03:22 +02:00
Can Cebeci
286b107d7d
Fix oversized enum (#9590)
Co-authored-by: Can Cebeci <t-cancebeci@microsoft.com>
2026-05-21 15:24:35 -07:00
Copilot
ce9cf4ad7b
Fix ARM64 nightly build: dotnet NuGet packaging broken under Ninja/cmake (#9589)
The Windows ARM64 nightly build (`mk_win_dist_cmake.py --arm64-only`)
was failing because the cmake-built `Microsoft.Z3` NuGet package was
produced without any native Windows DLL, causing the downstream dotnet
example build to fail.

## Root causes

- **Wrong DLL path in `Microsoft.Z3.csproj.in`**: Path included
`/$(_DN_CMAKE_CONFIG)/` (e.g., `.../RelWithDebInfo/libz3.dll`), but
`CMakeLists.txt` sets `CMAKE_RUNTIME_OUTPUT_DIRECTORY =
PROJECT_BINARY_DIR` with no config subdir. With Ninja single-config, the
DLL lands at `build-dir/libz3.dll`. The `Exists()` guard silently
excluded the DLL from the package.
- **Wrong runtime identifier**: ARM64 DLL was being packed under
`runtimes\win-x64\native` instead of `runtimes\win-arm64\native`.
- **Legacy copy fires for `net8.0`**: `Microsoft.Z3.targets` excluded
`netstandard`/`netcoreapp` but not modern TFMs like `net8.0`, so
`CopyToOutputDirectory` fired and failed trying to copy the absent
`win-x64` DLL.

## Changes

- **`src/api/dotnet/CMakeLists.txt`**: Introduce `Z3_DOTNET_WIN_RID`
cmake variable (`win-x64` / `win-x86` / `win-arm64`) derived from
`TARGET_ARCHITECTURE`; used at `configure_file` time.
- **`src/api/dotnet/Microsoft.Z3.csproj.in`**: Remove
`/$(_DN_CMAKE_CONFIG)` from the Windows DLL path; replace hardcoded
`runtimes\win-x64\native` with `runtimes\${Z3_DOTNET_WIN_RID}\native`.
- **`src/api/dotnet/Microsoft.Z3.targets`**: Add
`!$(TargetFramework.Contains('.'))` to the legacy-copy condition, which
correctly excludes `net5.0`/`net6.0`/`net7.0`/`net8.0` (all use dotted
TFMs) while keeping `net45`/`net472` etc.
- **`src/api/dotnet/Microsoft.Z3.props`**: Add explicit `arm64`
condition mapping `$(Platform) == 'arm64'` to
`runtimes\win-arm64\native\libz3.dll` for legacy .NET Framework ARM64
consumers.

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
2026-05-21 11:18:03 -07:00
Copilot
b9e62454f4
Publish Pyodide wheels from nightly and release workflows (#9588)
This updates the release and nightly pipelines so the Pyodide wheel is
built alongside the existing Python wheels and carried through the
normal publication flow. As a result, Pyodide wheels are included in
nightly assets and in release-time Python package publishing without
introducing a separate publishing path.

- **Pyodide build in release/nightly**
  - Added a `pyodide-python` job to both `release.yml` and `nightly.yml`
- Reused the existing Pyodide build flow: install
`pyodide-build`/`pyodide-cli`, provision the matching Emscripten
toolchain, build the wheel, and run `z3test.py` against the built
artifact

- **Artifact integration**
- Upload the built wheel as a dedicated workflow artifact:
`PyodidePythonBuild`
- Extend the existing `python-package` aggregation job in both workflows
to depend on and download that artifact

- **Publication path**
  - No new publish logic was added
- The existing downstream steps already publish everything collected in
`src/api/python/dist`, so the Pyodide wheel now flows into:
    - nightly GitHub release assets
    - release GitHub assets
    - release-time PyPI publishing when enabled

```yaml
pyodide-python:
  name: "Python bindings (Pyodide)"
  ...
  - name: Upload artifact
    uses: actions/upload-artifact@v7.0.1
    with:
      name: PyodidePythonBuild
      path: src/api/python/dist/*.whl

python-package:
  needs: [..., pyodide-python]
  ...
  - name: Download Pyodide Build
    uses: actions/download-artifact@v8.0.1
    with:
      name: PyodidePythonBuild
      path: artifacts
```

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
2026-05-21 11:17:23 -07:00
Copilot
34ba2962ef
Fix unsound array equality rewrite for const-array store chains (#9572)
Z3 could return `sat` for an unsatisfiable QF_ABV formula equating two
store chains over distinct constant arrays. The rewrite path for array
equalities was missing a necessary base-value constraint in
finite-domain cases where stores cannot cover all indices.

- **Root cause**
- In `array_rewriter::mk_eq_core`, equality rewriting for nested stores
over const-array bases did not enforce equality of the underlying const
values when the index domain size exceeds the number of updated indices.

- **Rewriter fix**
  - Added a sound rewrite branch for:
    - `store* ((as const ...) v)` vs `store* ((as const ...) w)`
  - When `|domain| > (#stores_lhs + #stores_rhs)`, rewrite now includes:
    - select equalities for touched indices (existing behavior)
    - **and** base-value equality `v = w` (new requirement)
- This prevents spurious models where only updated indices are
constrained.

- **Regression coverage**
- Added a focused regression in `src/test/mod_factor.cpp` that asserts
`unsat` for a minimized constant-array/store-chain BV case with
`(distinct x y)` and one store per side.

```cpp
(assert (distinct x y))
(assert (= (store A0 i0 e0) (store A1 i1 e1)))
(check-sat) ; expected: unsat
```

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
2026-05-21 11:15:42 -07:00
Nikolaj Bjorner
af33dfaa7d detect quantifiers in patterns
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-05-21 10:37:36 -07:00
Nikolaj Bjorner
af7a4de258 update ignore 2026-05-21 10:37:36 -07:00
Filipe Marques
c33a725bd8
Expose Seq.mk_re_diff in ocaml bindings (#9584)
Noticed it was missing
2026-05-21 10:29:08 -07:00
Filipe Marques
ce6abd65db
Expose other mk_seq_replace variants in OCaml bindings (#9586)
Also update the documentation for the base `mk_seq_replace` function to
match the new inline documentation style.
2026-05-21 10:28:48 -07:00
CEisenhofer
2ea1c74071 Make var-nielsen case non-recursive 2026-05-21 19:12:15 +02:00
CEisenhofer
dafa3cf5bd Added feature (?) to SAT core to prefer the Nielsen assumptions during splitting 2026-05-21 19:06:45 +02:00
Lev Nachmanson
1323530001
tptp: share 0-arity decls across sorts to fix bare constant equality (#9587)
Fix the TPTP frontend so that a bare name used in an equality refers to
a single shared `func_decl`, regardless of how the surrounding context
coerces its sort.

## Problem

With the following input the conjecture was not proved:

```tptp
fof(a1,axiom, ! [X] : (X = a)).
fof(c1,conjecture, b = a).
```

`parse_atomic_formula` created bare names as 0-arity **Bool
predicates**, and `coerce_eq` later retyped them by calling
`m.mk_func_decl(...)` directly, without registering the result in
`m_decls`. So the `a` used inside `! [X] : (X = a)` (coerced to sort
`U`) and the `a` used inside `b = a` (left as Bool) ended up as two
unrelated `func_decl`s sharing only the name. The axiom no longer
constrained the conjecture.

## Fix

In `src/cmd_context/tptp_frontend.cpp`:

1. Add `mk_zero_arity_decl(name, range)` / `coerce_zero_arity(app*,
range)` helpers that memoize the 0-arity `func_decl` per `(name, target
sort)` in `m_decls`, delegating to the existing `mk_decl_or_ho_const`
for `U` and Bool targets.
2. Rewrite `coerce_eq` to use the new helpers and add an explicit Bool /
non-Bool retyping branch so a bare-Bool side is recast to the other
side's sort.
3. In `parse_atomic_formula`, when a bare name is immediately followed
by `=` or `!=`, create it as a non-predicate (sort `U`). Terms in
equalities are no longer first introduced as Bool predicates.
4. Reorder the constructor init-list so `m_univ` is initialized before
the pinned ref vectors (matches declaration order; silences
`-Wreorder`).

Net effect: every reference to a given name at a given sort yields the
same `func_decl`, eliminating duplicate-symbol bugs in equalities over
bare TPTP constants.

## Test

Added `fof-bare-constant-equality` to `src/test/tptp.cpp`. Without the
C++ change the new case asserts; with it, `./build/release/test-z3 /seq
tptp` reports `PASS`.

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

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-21 08:55:10 -07:00
CEisenhofer
ca12eae670 WIP: Undid internal constraints 2026-05-21 17:17:49 +02:00
Lev Nachmanson
43791ebf2a
Iss9139 fix (#9577)
Preserve the de-linearization of the linear constraints but fixing the
den bug. @ValentinPromies, that is what you had in mind.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-21 06:33:14 -07:00
Copilot
8e3be3ad1f
Prevent Spacer segfault on ADT CHCs by hardening datatype model-value construction (#9571)
Spacer can crash on small HORN/ADT benchmarks when model construction
reaches datatype enodes without a fully populated constructor state. The
failure manifested as a null/invalid-path dereference inside datatype
model value generation.

- **Root cause area: datatype model extraction path**
- Hardened `theory_datatype::mk_value` to handle incomplete theory state
safely instead of assuming constructor metadata is always present.
  - Added guarded fallback to a factory-provided datatype value when:
    - `th_var` is missing,
    - union-find lookup is invalid,
    - var data/constructor is unavailable.

- **Behavioral change**
- Missing constructor state now degrades to a safe model value
(`expr_wrapper_proc`) instead of crashing during model generation.

- **Regression coverage**
- Added a focused API regression in `src/test/api_datalog.cpp` using a
Spacer + ADT HORN script (with reproducing seed) to ensure the code path
executes without parser/runtime failure.

```cpp
// theory_datatype::mk_value fallback shape
if (v == null_theory_var || invalid_var_data || d->m_constructor == nullptr) {
    app* val = to_app(m_factory->get_some_value(n->get_sort()));
    return alloc(expr_wrapper_proc, val);
}
```

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
2026-05-20 16:04:41 -07:00
Nikolaj Bjorner
eeddc94647 fix tptp errors
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-05-20 15:19:27 -07:00
Nikolaj Bjorner
2ba86c1ac3 benchmark patching
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-05-20 13:32:23 -07:00
CEisenhofer
315a09aea8 [WIP] Try to replace "recursive reusage" of variables by seq.slice 2026-05-20 17:24:57 +02:00
CEisenhofer
dd00dd7362 First step towards not-reusing variables 2026-05-20 10:11:50 +02:00
Copilot
bc6c38e7d3
[code-simplifier] Simplify api_ast.cpp by removing unreachable branch and stray comment (#9570)
This change simplifies recently touched API code in
`src/api/api_ast.cpp` without altering semantics. It removes an
unreachable error path in `Z3_get_index_value` and deletes an empty
comment in `Z3_mk_rec_func_decl`.

- **`Z3_get_index_value`: remove dead branch**
- After validating `a` is non-null and of kind `AST_VAR`, the conversion
to `var*` is already guaranteed by existing AST casting invariants.
- The redundant null-check/error-return branch was removed, leaving a
direct index return.

- **`Z3_mk_rec_func_decl`: remove noise**
  - Deleted a stray empty `//` line.

```cpp
// before
var* va = to_var(_a);
if (va) {
    return va->get_idx();
}
SET_ERROR_CODE(Z3_INVALID_ARG, nullptr);
return 0;

// after
var* va = to_var(_a);
return va->get_idx();
```

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
2026-05-19 13:56:17 -07:00
dependabot[bot]
3eb6efa830
Bump github/gh-aw-actions from 0.72.1 to 0.74.4 (#9568)
Bumps [github/gh-aw-actions](https://github.com/github/gh-aw-actions)
from 0.72.1 to 0.74.4.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/github/gh-aw-actions/releases">github/gh-aw-actions's
releases</a>.</em></p>
<blockquote>
<h2>v0.74.4</h2>
<p>Sync of actions from <a
href="https://github.com/github/gh-aw">gh-aw</a> at
<code>v0.74.4</code>.</p>
<h2>v0.74.3</h2>
<p>Sync of actions from <a
href="https://github.com/github/gh-aw">gh-aw</a> at
<code>v0.74.3</code>.</p>
<h2>v0.74.2</h2>
<p>Sync of actions from <a
href="https://github.com/github/gh-aw">gh-aw</a> at
<code>v0.74.2</code>.</p>
<h2>v0.74.1</h2>
<p>Sync of actions from <a
href="https://github.com/github/gh-aw">gh-aw</a> at
<code>v0.74.1</code>.</p>
<h2>v0.74.0</h2>
<p>Sync of actions from <a
href="https://github.com/github/gh-aw">gh-aw</a> at
<code>v0.74.0</code>.</p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="d3abfe96a1"><code>d3abfe9</code></a>
chore: sync actions from gh-aw@v0.74.4 (<a
href="https://redirect.github.com/github/gh-aw-actions/issues/105">#105</a>)</li>
<li><a
href="8a9a52673c"><code>8a9a526</code></a>
chore: sync actions from gh-aw@v0.74.3 (<a
href="https://redirect.github.com/github/gh-aw-actions/issues/104">#104</a>)</li>
<li><a
href="23453ecc01"><code>23453ec</code></a>
chore: sync actions from gh-aw@v0.74.2 (<a
href="https://redirect.github.com/github/gh-aw-actions/issues/101">#101</a>)</li>
<li><a
href="b07cf98ac5"><code>b07cf98</code></a>
chore: sync actions from gh-aw@v0.74.1 (<a
href="https://redirect.github.com/github/gh-aw-actions/issues/100">#100</a>)</li>
<li><a
href="908c12f51d"><code>908c12f</code></a>
Add daily Copilot runtime threat scan workflow (<a
href="https://redirect.github.com/github/gh-aw-actions/issues/98">#98</a>)</li>
<li><a
href="28ffccfcaa"><code>28ffccf</code></a>
chore: sync actions from gh-aw@v0.74.0 (<a
href="https://redirect.github.com/github/gh-aw-actions/issues/97">#97</a>)</li>
<li><a
href="cc81570b45"><code>cc81570</code></a>
chore: sync actions from gh-aw@v0.73.0 (<a
href="https://redirect.github.com/github/gh-aw-actions/issues/95">#95</a>)</li>
<li>See full diff in <a
href="https://github.com/github/gh-aw-actions/compare/v0.72.1...v0.74.4">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github/gh-aw-actions&package-manager=github_actions&previous-version=0.72.1&new-version=0.74.4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-05-19 12:04:17 -07:00
CEisenhofer
9bb0f7e337 Fix some IDE warnings 2026-05-19 16:03:21 +02:00
CEisenhofer
0d1ee09e62 Keep most of the Nielsen graph and do a hot-restart when only external literals changed 2026-05-19 15:33:20 +02:00
Nikolaj Bjorner
d4babf7181 safe instruction cache 2026-05-18 17:52:31 -07:00
CEisenhofer
6321a7c479 Implemented fast path for still satisfied Nielsen nodes 2026-05-18 14:42:06 +02:00
CEisenhofer
c512dd1de1 Model construction 2026-05-18 11:18:31 +02:00
Nikolaj Bjorner
2a36b9a68e split into context and sub-solver, move length force predicates to context-solver
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-05-17 19:01:03 -07:00
Nikolaj Bjorner
9d4feed0ae remove expr_ref from dependencies, only use literals that are true.
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-05-17 13:28:12 -07:00
Nikolaj Bjorner
b75acc5c14 replace seq::le by generic expr_ref
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-05-16 23:10:44 -07:00
Nikolaj Bjorner
e72c082818 use vector with object destructor 2026-05-16 22:32:29 -07:00
Nikolaj Bjorner
a12be9670c remove print 2026-05-16 17:05:51 -07:00
Nikolaj Bjorner
1198d9aaa5 templatize vector for dependencies 2026-05-16 16:22:56 -07:00
Nikolaj Bjorner
d99f0ce230 use shrink instead of pop in a loop 2026-05-16 16:22:56 -07:00
Nikolaj Bjorner
5ca32d65bd use shrink instead of pop in a loop 2026-05-16 16:22:56 -07:00
Nikolaj Bjorner
b8052d67cb simplification to value reconstruction
use the fact that dependencies are already present in the model-value object.
There is no need for fragile code to reconstruct the mapping from enodes to values.
2026-05-16 16:22:51 -07:00