3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-04-02 18:08:57 +00:00
Commit graph

18136 commits

Author SHA1 Message Date
Nikolaj Bjorner
1f8773ea7d nits
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-03-31 20:12:59 -07:00
Nikolaj Bjorner
2cec2dadf9 cleanup
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-03-31 18:30:59 -07:00
Nikolaj Bjorner
013d6b3063 na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-03-31 18:21:38 -07:00
Nikolaj Bjorner
860bd43559 remove reference to arith_solver
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-03-31 16:16:53 -07:00
Nikolaj Bjorner
7ec3f7f107 add split function for unit_regex
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-03-31 08:56:36 -07:00
CEisenhofer
14f71ea852 Reuse power variables and symbolic characters 2026-03-31 16:36:10 +02:00
Nikolaj Bjorner
54d52d882f remove indirect references to ast_manager
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-03-30 20:00:02 -07:00
Nikolaj Bjorner
6d2321e6fe edits to seq_nielsen
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-03-30 17:36:27 -07:00
Nikolaj Bjorner
9aceaf3cac reviewing seq_nielsen, detect repeated final-check to avoid rebuilding nielsen graph
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-03-30 00:01:24 -07:00
Nikolaj Bjorner
a79a48ed2a add comment about fresh variable
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-03-29 20:16:07 -07:00
Nikolaj Bjorner
684cb23b40 turn on constraint integrity checking
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-03-29 19:30:13 -07:00
Nikolaj Bjorner
d7ee475bc3 ensure equalities are propagated
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-03-29 16:47:05 -07:00
Nikolaj Bjorner
6d31bdcc21 use sk.mk_seq_eq to avoid disequality propagations
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-03-29 15:45:54 -07:00
Copilot
09cde1f80c
Port propagate_eq from theory_seq for sk().is_eq in theory_nseq (#9165)
Agent-Logs-Url: https://github.com/Z3Prover/z3/sessions/7c0a330f-3f9f-4c5d-99f2-47fad013538f

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-29 15:44:18 -07:00
Nikolaj Bjorner
3db734d249 add note about propagate-eq
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-03-29 15:19:36 -07:00
CEisenhofer
ebd35bc5a3 Avoid doing extensions steps twice, as the bounds are recognized too late 2026-03-26 17:32:41 +01:00
CEisenhofer
dcc85cf9ef Bug in power elimination 2026-03-26 17:18:38 +01:00
Nikolaj Bjorner
2a72faf15e make sure conflict literal is negated
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-03-26 08:01:00 -07:00
CEisenhofer
3b5b53126e Bug fixing with unit replacement 2026-03-26 15:56:58 +01:00
CEisenhofer
17ca44b351 Readded depth limit 2026-03-26 11:30:54 +01:00
Nikolaj Bjorner
fa4cd37c07 add the false literal callback
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-03-25 13:35:25 -07:00
Nikolaj Bjorner
77d86343d0 add the false literal callback
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-03-25 13:35:18 -07:00
CEisenhofer
ed403efefd Readded subsolver bound computation (something went wrong with git) 2026-03-25 20:26:30 +01:00
CEisenhofer
910c68cd42 Missing internalization 2026-03-25 20:21:54 +01:00
CEisenhofer
495921ca17 Fixed splitting on symbolic character 2026-03-25 20:21:54 +01:00
CEisenhofer
813a06fa38 Use subsolvers bounds rather than computing them inside nseq 2026-03-25 20:21:49 +01:00
Nikolaj Bjorner
af4677950b add code for adding assumptions after sat
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-03-25 11:45:43 -07:00
Nikolaj Bjorner
a0ba950987 fix type errors
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-03-25 11:19:53 -07:00
Nikolaj Bjorner
9d2244798d fix insertions into subst.
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-03-25 09:00:37 -07:00
Copilot
46c76d89e0
Make dep_mgr private in seq_nielsen; expose conflict sources vector (#9129)
* make dep_mgr private in seq_nielsen, expose conflict_sources vector

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Z3Prover/z3/sessions/998d8021-4808-4feb-afc5-b2447c6a64e5

* move deps_to_lits to seq namespace in seq_nielsen

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Z3Prover/z3/sessions/8d736478-8f9b-4451-8d1f-539ce72525c7

---------

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-25 08:05:00 -07:00
Copilot
49f2eb0e49
seq_nielsen: use arith binary match overloads in get_const_power_diff (#9125)
* refactor get_const_power_diff to use is_add/is_sub binary overloads

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Z3Prover/z3/sessions/1d71a642-bb8f-43ca-88fd-9dc48f5aab24

* fix build: remove unnecessary arith_solver.h include from seq_nielsen.cpp

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Z3Prover/z3/sessions/bb09a786-4445-4645-9930-e80494d96dbf

---------

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-25 06:51:51 -07:00
Nikolaj Bjorner
8eaa9d9e6b add back cur_path as a local variable
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-03-25 06:30:52 -07:00
Nikolaj Bjorner
9893a09fad na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-03-25 06:11:08 -07:00
CEisenhofer
c91b485fcf Int Bounds where not updated properly 2026-03-25 12:47:52 +01:00
CEisenhofer
178d7439f2 Fixed to_dot for integer constraints 2026-03-25 11:25:07 +01:00
Copilot
e3e235aa7f
Refactor: replace int_constraint with constraint struct, promote cur_path to member, expose path leaf side constraints (#9124)
* chore: update plan with cur_path and side constraints requirements

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Z3Prover/z3/sessions/1523cf0a-b7a4-41a6-b792-7cd41b4dcd3b

* Refactor: rename int_constraint to constraint, remove int_constraint_kind enum

- Rename int_constraint struct to constraint with fields fml/dep
- Remove int_constraint_kind enum; pre-build formula expressions instead
- nielsen_edge: add_side_int/side_int() -> add_side_constraint/side_constraints()
- nielsen_node: add_int_constraint/int_constraints() -> add_constraint/constraints()
- nielsen_graph: mk_int_constraint(lhs,rhs,kind,dep) -> mk_constraint(fml,dep)
- Remove int_constraint_to_expr (no longer needed)
- search_dfs/simplify_and_init/check_int_feasibility/check_lp_le: drop cur_path param
- Add m_cur_path member to nielsen_graph; m_cur_path.reset() in solve()
- Add get_path_leaf_side_constraints() implementation
- Update seq_parikh.h/cpp and seq_nielsen_pp.cpp to use new constraint API

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

* refactor: constraint struct, promote cur_path, expose path leaf side constraints

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Z3Prover/z3/sessions/1523cf0a-b7a4-41a6-b792-7cd41b4dcd3b

* fix: remove spurious includes from seq_nielsen.cpp

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Z3Prover/z3/sessions/aa283d79-cd42-4b87-aaf0-4273a8327b76

* fix: update test files to use renamed constraint API and fix inverted root guard

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Z3Prover/z3/sessions/b09bbc56-9617-4277-8e0c-27fa7e588037

---------

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: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-03-24 22:18:30 -07:00
Nikolaj Bjorner
9f6eb4f455 remove unused fields
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-03-24 19:57:43 -07:00
Nikolaj Bjorner
6a6f9b1892 Merge remote-tracking branch 'origin/master' into c3
# Conflicts:
#	.github/workflows/qf-s-benchmark.lock.yml
#	.github/workflows/qf-s-benchmark.md
#	.github/workflows/zipt-code-reviewer.lock.yml
#	.github/workflows/zipt-code-reviewer.md
#	.gitignore
#	src/ast/rewriter/seq_rewriter.cpp
#	src/test/main.cpp
2026-03-24 17:44:48 -07:00
Nikolaj Bjorner
bc5818e12d fix bogus decompose_ite
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-03-24 14:43:56 -07:00
Nikolaj Bjorner
a5c0ecafda fixes to model generation
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-03-24 13:27:28 -07:00
Nikolaj Bjorner
5803c6f202 fix bug in non-emptiness witness extraction
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-03-24 13:27:28 -07: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
CEisenhofer
da9d8c8694 Asserting character constraints 2026-03-24 16:51:01 +01:00
CEisenhofer
48273ca0ed Fixed unit substitution 2026-03-24 16:24:28 +01:00
CEisenhofer
aab96dbd29 Rule for unwinding powers in membership constraints 2026-03-24 14:58:10 +01:00