3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-02-19 15:04:42 +00:00
Commit graph

4463 commits

Author SHA1 Message Date
Copilot
de825be4c7 Replace fall-through comments with Z3_fallthrough macro (#8219)
* Initial plan

* Fix switch fall-through warnings with Z3_fallthrough attribute

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-02-18 20:57:31 -08:00
Copilot
11970f9203 Fix 13 compiler warnings: sign-comparison and unused parameters (#8215)
* Initial plan

* Fix 13 compiler warnings: sign-comparison and unused parameters

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-02-18 20:57:31 -08:00
Ilana Shapiro
6f41e9fc29 Fix UNKNOWN bug in search tree about inconsistent end state (#8214)
* restore more aggressive pruning in search tree

* restore where we close children to be correct

* add core strengthening check

* fix recursion bug

* less strict core propagation

* old search tree version

* restore search tree patch

* remove flag

* debugging inconsistent end state with search, some changes need to be made in search tree, only backtrack should be closing nodes, I think the bug is when we do find_highest_attach for nonchronological backjumping, you might get to a point where the sibling is closed, so then we need to resolve further up the tree

* clean up code, fix deadlock

* delete test files

* clean up

---------

Co-authored-by: Ilana Shapiro <ilanashapiro@Mac.localdomain>
Co-authored-by: Ilana Shapiro <ilanashapiro@Ilanas-MacBook-Pro.local>
Co-authored-by: Ilana Shapiro <ilanashapiro@Ilanas-MBP.lan1>
2026-02-18 20:57:31 -08:00
Copilot
317dd92105 Standardize for-loop increments to prefix form (++i) (#8199)
* Initial plan

* Convert postfix to prefix increment in for loops

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

* Fix member variable increment conversion bug

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

* Update API generator to produce prefix increments

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-02-18 20:57:29 -08:00
Copilot
851b8ea31c Replace manual pair unpacking with structured bindings (#8197)
* Initial plan

* Apply structured bindings to enode_bool_pair usage

Replace manual unpacking of pairs with C++17 structured bindings in:
- src/ast/euf/euf_egraph.cpp
- src/smt/smt_internalizer.cpp
- src/smt/smt_context.cpp (2 locations)

This improves code readability and reduces boilerplate code.

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-02-18 20:57:27 -08:00
Copilot
a3c10c68a7 Remove redundant overridden default destructors (#8191)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
2026-02-18 20:57:13 -08:00
Nikolaj Bjorner
1a37a73172 coerce bool
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-02-18 20:57:13 -08:00
Nikolaj Bjorner
b3c1de6643 update iterator pattern
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-02-18 20:57:12 -08:00
Simon Jeanteur
9ca6580e38 Subterms Theory (#8115)
* somewhaat failed attempt at declaring subterm predicate

I can't really figure out how to link the smt parser to the rest of the
machinenery, so I will stop here and try from the other side. I'll start
implmenting the logic and see if it brings me back to the parser.

* initial logic implmentation

Very primitive, but I don't like have that much work uncommitted.

* parser implementation

* more theory

* Working base

* subterm reflexivity

* a few optimization

Skip adding obvious equalities or disequality

* removed some optimisations

* better handling of backtracking

* stupid segfault

Add m_subterm to the trail

* Update src/smt/theory_datatype.h

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

* Update src/ast/rewriter/datatype_rewriter.cpp

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

* Update src/smt/theory_datatype.cpp

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

* Update src/smt/theory_datatype.cpp

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

* Update src/smt/theory_datatype.cpp

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

* review

* forgot to update `iterate_subterm`'s signature

* fix iterator segfault

* Remove duplicate include statement

Removed duplicate include of 'theory_datatype.h'.

* Replace 'optional' with 'std::option' in datatype_decl_plugin.h

* Add is_subterm_predicate matcher to datatype_decl_plugin

* Change std::option to std::optional for m_subterm

* Update pdecl.h

* Change has_subterm to use has_value method

* Update pdecl.cpp

---------

Co-authored-by: Nikolaj Bjorner <nbjorner@microsoft.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-18 20:57:12 -08:00
Copilot
a6c1d32074 Replace empty destructors with = default for compiler optimization (#8189)
* Initial plan

* Replace empty destructors with = default

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-02-18 20:57:12 -08:00
Copilot
0cc16b63c2 Replace custom util/optional with std::optional (#8162)
* Initial plan

* Replace optional with std::optional in source files

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

* Fix array_map contains() and remove optional_benchmark test

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

* Address code review feedback - simplify array_map and test

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-02-18 20:57:09 -08:00
Copilot
d68837693c Adopt C++17 structured bindings for map/pair iteration (#8159)
* Initial plan

* Adopt structured bindings for map iteration

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

* Fix DEBUG_CODE macro issue with structured bindings

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-02-18 20:57:09 -08:00
Nikolaj Bjorner
767f7eeace fix #8116
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-02-18 20:57:07 -08:00
Simon Sobisch
b2db2c8b23 AIX compat (#8113)
* fix name conflict for struct proc

* aix compat
2026-02-18 20:57:04 -08:00
Nikolaj Bjorner
d0add7e3d8 fix #8045 2026-02-18 20:57:03 -08:00
Nikolaj Bjorner
7151c5ac6e fixes to finite domain arrays
- relevancy could be off and array solver doesn't compensate, #7544
- enforce equalities across store for small domain axioms #8065
2026-02-18 20:57:03 -08:00
Ilana Shapiro
6d61efa6b8 Some changes to improve LIA performance (#8101)
* add user params

* inprocessing flag

* playing around with clause sharing with some arith constraints (complicated version commented out)

* collect shared clauses inside share units after pop to base level (might help NIA)

* dont collect clauses twice

* dont pop to base level when sharing units, manual filter

* clean up code

---------

Co-authored-by: Ilana Shapiro <ilanashapiro@Mac.localdomain>
2026-02-18 20:57:03 -08:00
Nikolaj Bjorner
5be3c6b4e8 fix indentation 2026-02-18 20:57:01 -08:00
Nikolaj Bjorner
d533260445 use new arithmetic solver for AUFLIA, fixes #8090
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-02-18 20:57:00 -08:00
Ilana Shapiro
34a40c7747 Search tree core resolution optimization (#8066)
* Add cube tree optimization about resolving cores recursively up the path, to prune. Also integrate asms into the tree so they're not tracked separately (#7960)

* draft attempt at optimizing cube tree with resolvents. have not tested/ran yet

* adding comments

* fix bug about needing to bubble resolvent upwards to highest ancestor

* fix bug where we need to cover the whole resolvent in the path when bubbling up

* clean up comments

* close entire tree when sibling resolvent is empty

* integrate asms directly into cube tree, remove separate tracking

* try to fix bug about redundant resolutions, merging close and try_resolve_upwards into once function

* separate the logic again to avoid mutual recursion

* Refactor search tree closure and resolution logic

Refactor close_with_core to simplify logic and remove unnecessary parameters. Update sibling resolvent computation and try_resolve_upwards for clarity.

* apply formatting

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* Refactor close_with_core to use current node in lambda

* Fix formatting issues in search_tree.h

* fix build issues

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* Update smt_parallel.cpp

* Change loop variable type in unsat core processing

* Change method to retrieve unsat core from root

---------

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
Co-authored-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-02-18 20:56:58 -08:00
Nikolaj Bjorner
b6e8f2b033 disable preprocessing only after formulas are internalized 2026-02-18 20:56:57 -08:00
Nikolaj Bjorner
e76d477ab0 refine givup conditions
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-02-18 20:56:56 -08:00
Nikolaj Bjorner
b8b6d96fba insert theory only once
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-02-18 20:56:56 -08:00
Nikolaj Bjorner
e4697fe18e remove set cardinality operators from array theory. Make final-check use priority levels
Issue #7502 shows that running nlsat eagerly during final check can block quantifier instantiation.
To give space for quantifier instances we introduce two levels for final check such that nlsat is only applied in the second and final level.
2026-02-18 20:56:51 -08:00
Nikolaj Bjorner
08babfff60 fix build warnings
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-02-18 20:56:02 -08:00
Nikolaj Bjorner
f26b408cec strengthen filter for unknown by checking relevancy of parents #8022
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-02-18 20:55:57 -08:00
Nikolaj Bjorner
b443e90e24 add back statistics to smt-parallel
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-02-18 20:55:57 -08:00
Nikolaj Bjorner
d070296ae5 nits
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-01-21 11:44:18 -08:00
Copilot
2f8342a1b3
Add smt.finite_set.lattice_refutation parameter to control lattice refutation code path (#8247)
* Initial plan

* Add finite_set.lattice_refutation parameter to smt_params_helper.pyg

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

* Add finite_set.lattice_refutation parameter implementation

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-01-20 17:20:52 -08:00
Nikolaj Bjorner
40efe27066 add formatting
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2026-01-18 17:48:20 -08:00
lorenzwinkler1
31cbb4b144
Lattice based refutation (#8211)
* add examples

* add lattice refutation solver class

* store partial order in vector

* capture partial order relations

* begin with the incremental reachability data structure

* implement data structure for incremental reachability

* fix bug in subset propagation

* add trace

* only propagate if new value was added

* begin implementing bitvector variant of reachability matrix

* fix path creation and cycle detection

* fix bug

* make conflict triggering more conservative

* check if theory vars are in bounds

* add cycle detection (including equality propagation)

* add examples

* remove example

* remove traces

* remove sln file
2026-01-18 17:42:40 -08:00
Nikolaj Bjorner
ba13460511 add functions that create unique sets for model construction based on solving cardinality constraints
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-12-29 11:57:48 -08:00
Nikolaj Bjorner
1d3f6a7c70 remove incorrect assertion, make sat case for range + size conservative
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-12-06 13:07:14 -08:00
Alexander Stromberger
e90512388c
simplify expressions before range local check (#8061)
Co-authored-by: Alexander Stromberger <alexander.stromberger@alturos.com>
2025-12-06 11:37:47 -08:00
Nikolaj Bjorner
7d5d6a2b38 fix crashes
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-24 11:32:17 -08:00
Nikolaj Bjorner
7d2c84465c update handling for set membership
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-24 03:57:01 -08:00
Nikolaj Bjorner
7bc592749d fixes to cardinality solver
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-23 11:55:49 -08:00
Nikolaj Bjorner
896b3ccf69 enable inequalities that are not normal form
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-21 21:02:44 -08:00
Nikolaj Bjorner
8c224ccf03 fix crashes based on z3test\regressions\finite-sets\ in the finite-sets branch
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-11-21 20:31:44 -08:00
Nikolaj Bjorner
ba28e85f04 add sketch for incremental algorithm
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-30 02:53:29 -07:00
Nikolaj Bjorner
4536985bf7 enable post setup parameter tweaking in theory solvers, update azure-pipeline
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-28 15:11:35 -07:00
Nikolaj Bjorner
b8cadfac56 don't add boolean disequality . 2025-10-27 14:08:12 -07:00
Nikolaj Bjorner
a82af886eb formatting 2025-10-27 14:01:30 -07:00
Nikolaj Bjorner
2f06bcc731 add finite_set to quantifieed theories in smt_setup, fix type signature for map-inverse axioms
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-27 20:34:13 +01:00
Nikolaj Bjorner
4464ab9431 fix empty set declaration, add axioms and rewrites
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-27 18:18:46 +01:00
Nikolaj Bjorner
4630373a97 add finite sets to datatype recursion, delay initialize finite_set plugin, fix bugs in are_distinct and equality simplification
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-27 10:37:19 +01:00
Nikolaj Bjorner
d847a28589 bug fixes
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-27 05:51:42 +01:00
Nikolaj Bjorner
c832802183 disable tracking literals, they are not used
added trivial rewrites for set.size
2025-10-26 16:21:33 +01:00
Nikolaj Bjorner
f8b2268424 base implementation for cardinality constraints
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-26 10:35:37 +01:00
Nikolaj Bjorner
4068460a0f fix bogus axioms
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-24 13:35:41 +02:00