3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-03-31 08:39:01 +00:00
Commit graph

22050 commits

Author SHA1 Message Date
Lev Nachmanson
e760eabd2b revert clear() additions that cause heap corruption
The m_cache.reset(), m_assignment.reset(), m_lo.reset(), m_hi.reset()
calls added to clear() in commit 481eb0327 cause heap corruption when
clear() is called from the destructor. The cache reset frees polynomials
while the polynomial manager still holds references to them, corrupting
the heap. This manifests as 'corrupted double-linked list' crashes
during nlsat solver destruction in the nra check path.

The reset() method already has these calls for solver reuse. The
destructor path via clear() should not duplicate them, as implicit
member destruction handles cleanup in the correct order.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-30 04:57:08 -10:00
Lev Nachmanson
78d70fea37 simplify scoped_numeral_vector copy constructor loop
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-30 04:57:08 -10:00
Lev Nachmanson
75baedb314 fix nlsat clear() and scoped_numeral_vector copy ctor crashes
Reset polynomial cache and assignments in nlsat::solver:👿:clear()
to prevent use-after-free when the solver is destroyed. The missing
resets caused heap corruption when check_assignment's
compute_linear_explanation created cached polynomials and root atoms
that outlived the solver's other data structures during destruction.

Also fix _scoped_numeral_vector copy constructor to read from other
instead of uninitialized self.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-30 04:57:08 -10:00
Copilot
00418e7368
fix riscv64 nightly: install MPFR 4.x before using Ubuntu 20.04 RISC-V toolchain (#9157)
Agent-Logs-Url: https://github.com/Z3Prover/z3/sessions/41c35acf-fab8-4cd1-8bff-7cceb9ba43f5

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
2026-03-28 15:36:44 -07:00
Copilot
8969921cab
Add riscv64 wheel builds to nightly and release PyPI publishing (#9153)
* Initial plan

* Add riscv64 PyPI wheel builds to nightly, release, and validation workflows

Agent-Logs-Url: https://github.com/Z3Prover/z3/sessions/c22657c9-a5a9-4dad-b5d7-002209b7afe1

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
2026-03-28 15:26:59 -07:00
dependabot[bot]
d7f8fb5a1c
Bump picomatch from 2.3.1 to 2.3.2 in /src/api/js (#9130)
Bumps [picomatch](https://github.com/micromatch/picomatch) from 2.3.1 to 2.3.2.
- [Release notes](https://github.com/micromatch/picomatch/releases)
- [Changelog](https://github.com/micromatch/picomatch/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/picomatch/compare/2.3.1...2.3.2)

---
updated-dependencies:
- dependency-name: picomatch
  dependency-version: 2.3.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-28 15:03:44 -07:00
Lev Nachmanson
456b99ced2 Fix nightly-validation: NuGet macOS ARM64 failure + add build script tests
- Remove .csproj overwrite in macOS x64 and ARM64 NuGet jobs that
  replaced the versioned PackageReference with Version="*", causing
  FileNotFoundException for Microsoft.Z3 assembly
- Add validate-build-script-tests job to run scripts/tests/test_*.py,
  ensuring JNI arch flag tests from PR #8896 are exercised nightly

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-24 06:28:05 -10:00
Lev Nachmanson
44e84dc5d0 refactor try_bivar_hensel_lift and outline the algorithm
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-03-24 06:25:29 -10:00
Lev Nachmanson
117da362f0 add checkpoints() in upolinomial
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-03-24 06:25:29 -10:00
Lev Nachmanson
31c6c3ee79 make the new multivariate factorization more resilient
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-03-24 06:25:29 -10:00
Lev Nachmanson
09339c82ab Fix crashes: avoid re-entering factor_sqf_pp from factor_n_sqf_pp
Calling factor_sqf_pp recursively on Hensel-lifted factors corrupts
shared mutable state in the polynomial manager, m_m2pos, m_som_buffer,
m_cheap_som_buffer, m_tmp1, etc., causing assertion violations:
  - polynomial.cpp:473 id < m_m2pos.size()
  - upolynomial.cpp:2624 sign_a == -sign_b

Use factor_1_sqf_pp/factor_2_sqf_pp for small degrees, push directly
for larger degrees. These don't conflict with the outer call's buffers.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-24 06:25:29 -10:00
Lev Nachmanson
5bae864d6e Address review comments on multivariate factorization
- Fix memory leaks: use scoped_numeral instead of raw numeral for
  evaluation points, ensuring cleanup on exceptions
- Precompute lc_inv before the Hensel lifting loop instead of
  recomputing each iteration
- Use scoped_numeral_vector for eval_vals for consistency with codebase
- Move eval_values and candidate_primes to static constexpr class-level
- Document limitations: single-prime Hensel lifting, contiguous factor
  splits only, pseudo-division lc-power caveat
- Condense Bezout derivation comment to 4-line summary
- Fix README to say Hensel lifting instead of GCD recovery

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-24 06:25:29 -10:00
Lev Nachmanson
3e5e9026d8 Implement multivariate polynomial factorization via Hensel lifting
Replace the stub factor_n_sqf_pp (TODO: invoke Dejan's procedure) with a
working implementation using bivariate Hensel lifting:

- Evaluate away extra variables to reduce to bivariate
- Factor the univariate specialization
- Lift univariate factors to bivariate via linear Hensel lifting in Zp[x]
- Verify lifted factors multiply to original over Z[x,y]
- For >2 variables, check bivariate factors divide the original polynomial

Tests: (x0+x1)(x0+2x1)(x0+3x1) now correctly factors into 3 linear factors.
All 89 unit tests pass in both release and debug builds.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-24 06:25:29 -10:00
Nikolaj Bjorner
a00ac9be84 udpated wf
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-03-24 09:15:08 -07:00
dependabot[bot]
81a86c2102
Bump actions/checkout from 5.0.1 to 6.0.2 (#9111)
Bumps [actions/checkout](https://github.com/actions/checkout) from 5.0.1 to 6.0.2.
- [Release notes](https://github.com/actions/checkout/releases)
- [Commits](https://github.com/actions/checkout/compare/v5.0.1...v6.0.2)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 6.0.2
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-23 16:33:40 -07:00
dependabot[bot]
fd91695b91
Bump microsoft/setup-msbuild from 2 to 3 (#9109)
Bumps [microsoft/setup-msbuild](https://github.com/microsoft/setup-msbuild) from 2 to 3.
- [Release notes](https://github.com/microsoft/setup-msbuild/releases)
- [Commits](https://github.com/microsoft/setup-msbuild/compare/v2...v3)

---
updated-dependencies:
- dependency-name: microsoft/setup-msbuild
  dependency-version: '3'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-23 16:33:25 -07:00
dependabot[bot]
01e0cf8e2c
Bump github/gh-aw from 0.57.2 to 0.62.5 (#9110)
Bumps [github/gh-aw](https://github.com/github/gh-aw) from 0.57.2 to 0.62.5.
- [Release notes](https://github.com/github/gh-aw/releases)
- [Commits](https://github.com/github/gh-aw/compare/v0.57.2...v0.62.5)

---
updated-dependencies:
- dependency-name: github/gh-aw
  dependency-version: 0.62.5
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-23 16:33:13 -07:00
dependabot[bot]
c6dbe003ad
Bump actions/cache from 5.0.3 to 5.0.4 (#9112)
Bumps [actions/cache](https://github.com/actions/cache) from 5.0.3 to 5.0.4.
- [Release notes](https://github.com/actions/cache/releases)
- [Commits](https://github.com/actions/cache/compare/v5.0.3...v5.0.4)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: 5.0.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-23 16:33:01 -07:00
dependabot[bot]
ae90696e50
Bump actions/download-artifact from 8.0.0 to 8.0.1 (#9113)
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 8.0.0 to 8.0.1.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v8...v8.0.1)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: 8.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-23 16:32:49 -07:00
Nikolaj Bjorner
4258768d77 reduce number of benchmarks to 200
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-03-23 03:03:59 -07:00
Nikolaj Bjorner
19827a8599 remove stale aw files
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-03-22 20:04:18 -07:00
Copilot
a320a98489
ZIPT benchmark: scale to 500 files, fix seq timeout to 5s (#9099)
* Update ZIPT benchmark: 500 benchmarks, fix seq timeout description to 5s

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Z3Prover/z3/sessions/4df0700d-bb5b-4bd6-85a4-34ed56c8f40c

* Update qf-s-benchmark.md

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
Co-authored-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-03-22 19:58:23 -07:00
Copilot
40485e69be
Simplify extract_var_bound via operator normalization (#9062)
* Initial plan

* simplify extract_var_bound in qe_lite_tactic.cpp via operator normalization

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

* Add defensive check for integer type in lhs

Added a defensive check for integer type in lhs before proceeding with inequality checks.

* Update qe_lite_tactic.cpp

* Fix utility function call for integer check

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
Co-authored-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-03-22 16:01:12 -07:00
Copilot
acd5a4cd59
Update README.md status badges: remove disabled specbot/deeptest, add new active workflows (#9081)
Agent-Logs-Url: https://github.com/Z3Prover/z3/sessions/77922efd-7471-4264-bf14-5fe5e643618d

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
2026-03-21 15:20:35 -07:00
Lev Nachmanson
c2a17dac0b Update .github/workflows/ci.yml
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-21 06:16:46 -10:00
Lev Nachmanson
b8736991f3 Update .github/workflows/ci.yml
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-21 06:16:46 -10:00
Lev Nachmanson
748fbd96f2 Use -j$(nproc) instead of -j3 in CI make builds
Replace hardcoded -j3 with -j$(nproc) in ci.yml, nightly.yml, and
release.yml to utilize all available cores on GitHub Actions runners.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-21 06:16:46 -10:00
Nikolaj Bjorner
ccdfdbb176 recompiled
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-03-20 16:32:44 -07:00
Nikolaj Bjorner
488c02711d updated workflows
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-03-20 16:32:25 -07:00
Copilot
8b7507c062
fix: forbid background ninja builds in ostrich-benchmark prompt to prevent OOM (exit 137) (#9069)
Agent-Logs-Url: https://github.com/Z3Prover/z3/sessions/919c0bc0-0f86-411e-aa7f-99ebf547eeb0

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
2026-03-20 14:59:09 -07:00
Copilot
bb1c8ab230
Fix ostrich workflow OOM kill: use ninja -j1 to limit compilation memory (#9068)
Agent-Logs-Url: https://github.com/Z3Prover/z3/sessions/8c8cf73c-a94f-4bcf-b238-d35f8cdbb731

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
2026-03-20 14:17:31 -07:00
Copilot
33dfce0507
Fix Ostrich Benchmark OOM kill: switch to Release build (#9066)
* Initial plan

* Fix OOM kill in Ostrich Benchmark workflow: use Release instead of Debug build

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Z3Prover/z3/sessions/3c146cc1-cdf8-4a25-90ad-31c366dbce40

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
2026-03-20 13:02:41 -07:00
Copilot
4a8c9729bf
Add ostrich-benchmark agentic workflow for ZIPT/Z3 c3 branch benchmarking (#9064)
Agent-Logs-Url: https://github.com/Z3Prover/z3/sessions/bfaec259-86d9-4b56-ab04-182835e3563b

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
2026-03-20 11:19:37 -07:00
Lev Nachmanson
fc94e3dcdf remove a not successful workflow
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-03-20 07:39:20 -10:00
Mark DenHoed
43009600d4
Fix documentation for Z3_solver_to_dimacs_string (#9053)
Corrected the function name in the documentation comment.
2026-03-20 10:18:13 -07:00
Copilot
afe4bfcab2
chore: update RELEASE_NOTES.md for 4.17.0 per discussion #9023 (#9051)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
2026-03-20 00:17:55 -07:00
Nikolaj Bjorner
1137d23725 fix bug reported in API coherence report
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-03-19 23:20:55 -07:00
Lev Nachmanson
8cc75d444e fix box mode: reset bounds before each objective
update_lower_lex updates m_lower for subsequent objectives with saved
values from the current model. Reset m_lower[i] and m_upper[i] to
their initial values before optimizing each objective so earlier
objectives do not contaminate later ones.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-19 17:07:21 -10:00
Lev Nachmanson
fbbb582650 fix test: copy Z3_ast_to_string results before next call
Z3_ast_to_string returns a pointer to an internal buffer that is
overwritten on the next call. Store results in std::string immediately
to avoid reading a stale, garbled buffer.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-19 17:07:21 -10:00
Lev Nachmanson
1c70b9e6ee fix box mode: isolate m_lower/m_upper between objectives
geometric_lex's update_lower_lex updates m_lower for all subsequent
objectives with saved values from the current model. In box mode this
contaminates later objectives' starting bounds, causing platform-dependent
results. Save and restore m_lower/m_upper across iterations so each
objective starts from a clean state.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-19 17:07:21 -10:00
Lev Nachmanson
acd2e9475d fix #9030: box mode objectives are now optimized independently
In box mode (opt.priority=box), each objective should be optimized
independently. Previously, box() called geometric_opt() which optimizes
all objectives together using a shared disjunction of bounds. This caused
adding/removing an objective to change the optimal values of other
objectives.

Fix: Rewrite box() to optimize each objective in its own push/pop scope
using geometric_lex, ensuring complete isolation between objectives.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-19 17:07:21 -10:00
Lev Nachmanson
e351266ecb remove dead code in nlsat_explain
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2026-03-19 12:02:21 -10:00
Copilot
cf6c8810ee
Update qf-s-benchmark to run twice daily at midnight and noon UTC (#9047)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
2026-03-19 14:52:29 -07:00
Lev Nachmanson
996dc72300 Fix assertion violation in isolate_roots for nested calls (#6871)
resultant vanishes during a nested isolate_roots call. The mathematical
invariant that the resultant cannot vanish again after recovery does not
hold in all cases, e.g. with certain nonlinear real arithmetic formulas.

The algebraic_exception propagates cleanly through the nlsat solver and
tactic layers which already catch z3_exception.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-19 11:30:49 -10:00
Lev Nachmanson
47cbc746b5 fix #9036: expand bounded integer quantifiers in qe-light
After qe-light's equation solver (eq_der) eliminates variables from
linear equations, remaining bounded integer quantifiers may still have
non-unit coefficients that prevent Fourier-Motzkin elimination.

Add a bounded quantifier expansion step: when the remaining quantified
integer variables all have explicit finite bounds and the product of
domain sizes is <= 10000, expand the quantifier into a finite
disjunction. This turns e.g. exists y0 in [0,10), y1 in [0,15): P(x,y0,y1)
into P(x,0,0) | P(x,0,1) | ... | P(x,9,14), which is 150 disjuncts.

The SMT solver handles the resulting quantifier-free formula instantly,
whereas the previous QSAT/MBP approach timed out due to weak integer
projections from the (|a|-1)*(|b|-1) slack in Fourier-Motzkin resolution
with non-unit coefficients.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-19 08:29:35 -10:00
Lev Nachmanson
20bcf67155 Print full child output for all tests in parallel mode
Always print each test's captured output, not just for failures.
This preserves backward compatibility:
- PASS appears on its own line per test, as before
- ASAN/UBSAN reports from any test appear in captured logs
- timeit output is preserved for all tests

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-19 06:37:22 -10:00
Lev Nachmanson
04d2e66aab Make parallel execution the default for test-z3
Parallel mode (/j) is now the default. Use /seq to force serial execution.
Child processes are invoked with /seq to prevent recursive parallelism.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-19 06:37:22 -10:00
Lev Nachmanson
9fea91d0eb Add parallel test execution to test-z3 (/j flag)
Refactor src/test/main.cpp to support parallel test execution:
- Add /j[:N] flag to run tests in parallel using N jobs (default: number of cores)
- Use process-based parallelism: each test runs as a child process,
  avoiding thread-safety issues with global state like enable_debug/enable_trace
- Output is captured per-test and printed atomically, so different tests never mix
- Provide summary with pass/fail counts, wall time, and failed test names
- Refactor test list into X-macros for single source of truth
- Fix pre-existing bug where serial /a mode ran each test argc times

Platform support:
- Unix (Linux/macOS/FreeBSD): popen/pclose with WEXITSTATUS
- Windows: _popen/_pclose
- Emscripten: parallel disabled (no threading support)
- Works with both SINGLE_THREAD and multi-threaded builds

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-19 06:37:22 -10:00
Lev Nachmanson
b5bf4be87e fix: move m_fixed insertion after check_long_strings guard
m_fixed.insert(e) was placed before the check_long_strings guard,
causing check_fixed_length(false, false) to mark variables with
len > 20 as processed without actually decomposing them. The
subsequent check_fixed_length(false, true) then skipped them.

Move the insertion after the guard so variables are only marked
as fixed once they are actually decomposed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-17 20:19:12 -10:00
copilot-swe-agent[bot]
960ab8e67a perf: move check_fixed_length(false,true) before check_contains in final_check_eh
Co-authored-by: levnach <5377127+levnach@users.noreply.github.com>
2026-03-17 20:19:12 -10:00