3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-02-20 07:24:40 +00:00
Commit graph

4434 commits

Author SHA1 Message Date
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
Nikolaj Bjorner
4c67a7271e extend proof logging
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-23 09:48:43 +02:00
Nikolaj Bjorner
b96624727d remove ad-hoc membership axioms, enable boundary point saturatino
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-23 09:42:25 +02:00
Nikolaj Bjorner
2e4402c8f3 add interpretations when there are ranges
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-20 23:21:30 +02:00
Nikolaj Bjorner
65f38eac16 fixup proof log annotations of rules
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-19 10:04:18 +02:00
Nikolaj Bjorner
6485808b49 adding proof hint output
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-18 19:26:19 +02:00
Copilot
eb10ab1633
Rename set.select to set.filter and OP_FINITE_SET_SELECT to OP_FINITE_SET_FILTER (#7989)
* Initial plan

* Rename set.select to set.filter and OP_FINITE_SET_SELECT to OP_FINITE_SET_FILTER

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>
Co-authored-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-18 17:16:32 +02:00
Nikolaj Bjorner
7d585b5cfd fix build
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-18 13:30:46 +02:00
Nikolaj Bjorner
af432668be fix build
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-18 12:58:27 +02:00
Nikolaj Bjorner
43d40ac142 revise axiom instantiation scheme for finite-sets
Instead of asserting theory axioms lazily we create them on the fly and allow propagation eagerly.
The approach uses a waterfall model as follows:
- terms are created: they are inserted into an index for (set.in x S) axiom creation.
- two terms are merged by an equality.
  Loop over all new opportunities for axiom instantiation
  New axioms are added to a queue of recently created axioms.
- an atomic formula was asserted by the SAT solver.
  Update the watch list to find new propagations.

During propagation recently created axioms are either inserted into a propagation queue, or inserted into a watch list.
They are inserted into a propagation queue all or all but one literal is assigned to false.
They are inserted into a watch list if at least two literals are unassigned
They are dropped if the axiom contains a literal that is assigned to true

The propagation queue is processed by by asserting the theory axiom to the core.

Also add some elementary statistics.

A breaking change is to change the datatype for undo-trail in smt_context to not use a custom data-structure.
This can likely cause regressions. For example, the region allocator now comes from the stack_trail instead of being
owned within smt_context with a different declaration order. smt_context could crash during destruction or maybe even pop.
We take the risk as the change is overdue.

Add swap method to ref_vector.
2025-10-18 12:08:39 +02:00
Nikolaj Bjorner
aa1f1f56b6 prepare for incremental axiom propagation
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-17 16:54:12 +02:00
Nikolaj Bjorner
5169e552fa rename finite_set_value_factor to finite_set_factory. Fix type bugs when creating unions of values 2025-10-17 15:09:12 +02:00
Nikolaj Bjorner
df62e5e9e6 add assume-eqs and extensionality
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-17 09:37:11 +02:00
Nikolaj Bjorner
981c7d27ea adding factory for model initialization 2025-10-16 22:43:20 +02:00
Nikolaj Bjorner
1b918ce4ec restructure base class struct_factory so that enumeration of values for a sort comes together with hash-table access. This allows to use the enumeration view during value creations for finite sets
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-16 13:15:23 +02:00
Nikolaj Bjorner
b53e87dcba updated with immediate axioms
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-16 09:20:46 +02:00
Nikolaj Bjorner
d0a7b19806 add comments
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-16 08:53:38 +02:00
Nikolaj Bjorner
4225f1a0f1 prove your first finite set theorem
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-15 18:33:35 +02:00
Nikolaj Bjorner
54980a38d4 fixup theory_finite_set
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-15 15:02:58 +02:00
Copilot
b4d41ffe81
Complete theory_finite_set.h header and implement finite set theory solver (#7976)
* Initial plan

* Implement theory_finite_set header and implementation

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

* Add theory registration to smt_setup

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

* Update theory_finite_set.cpp

* Refactor membership_atoms and add elements list

Renamed membership_atoms to membership_elements and added elements list.

* Change membership elements to use enode type

* Update theory_finite_set.cpp

* Fix typo in internalize_atom function

* Update theory_finite_set.cpp

* Refactor final_check_eh by removing comments

Removed redundant comments and cleaned up code.

* Add m_lemmas member to theory_finite_set class

* Improve clause management and instantiation logic

Refactor clause handling and instantiate logic in finite set theory.

* Add friend class declaration for testing

* Add placeholder methods for lemma instantiation

Added placeholder methods for lemma instantiation.

---------

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>
2025-10-15 14:55:08 +02:00
Nikolaj Bjorner
f674d22ec8 update description for signature of the theory solver
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-15 08:54:00 +02:00
Nikolaj Bjorner
7356b5ff88 outline finite_set theory solver
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-10-05 16:22:28 -07:00
Nikolaj Bjorner
0e6b3a922a Add commands for forcing preferences during search
Add commands:

(prefer <formula>)
- will instruct case split queue to assign formula to true.
- prefer commands added within a scope are forgotten after leaving the scope.

(reset-preferences)
- resets asserted preferences. Has to be invoked at base level.

This provides functionality related to MathSAT and based on an ask by Tomáš Kolárik who is integrating the functionality with OpenSMT2
2025-10-02 10:47:10 -07:00
Nikolaj Bjorner
6173a0d025 propagate value initialization to atoms 2025-09-24 11:01:24 +03:00
Nikolaj Bjorner
04ddade2dd remove stale comment 2025-09-22 04:43:41 +03:00
Nikolaj Bjorner
f5c28a0b76 household cleanup
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-09-22 03:58:04 +03:00
Nikolaj Bjorner
e26f7b900c fix unsound axiom for lower-bounding 2025-09-21 19:24:13 +03:00
Nikolaj Bjorner
ce53e06e29
Par (#7945)
* port parallel

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

* updates

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

* update smt-parallel

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

* cleanup

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

* neat

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

* configuration parameter renaming

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

* config parameters

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

---------

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-09-21 10:11:04 +03:00
Nikolaj Bjorner
0d0dd0315a evaluate unhandled arithmetic operators based on an initialized model #7876
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-09-14 06:45:36 -07:00
Nuno Lopes
c350ddf990 remove a few useless dynamic casts 2025-09-13 21:06:55 +01:00