3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-26 15:53:41 +00:00
Commit graph

59 commits

Author SHA1 Message Date
Nikolaj Bjorner
c387b20ac6 move smt params to params directory, update release.yml 2025-06-09 10:47:22 -07:00
LeeYoungJoon
0a93ff515d
Centralize and document TRACE tags using X-macros (#7657)
* Introduce X-macro-based trace tag definition
- Created trace_tags.def to centralize TRACE tag definitions
- Each tag includes a symbolic name and description
- Set up enum class TraceTag for type-safe usage in TRACE macros

* Add script to generate Markdown documentation from trace_tags.def
- Python script parses trace_tags.def and outputs trace_tags.md

* Refactor TRACE_NEW to prepend TraceTag and pass enum to is_trace_enabled

* trace: improve trace tag handling system with hierarchical tagging

- Introduce hierarchical tag-class structure: enabling a tag class activates all child tags
- Unify TRACE, STRACE, SCTRACE, and CTRACE under enum TraceTag
- Implement initial version of trace_tag.def using X(tag, tag_class, description)
  (class names and descriptions to be refined in a future update)

* trace: replace all string-based TRACE tags with enum TraceTag
- Migrated all TRACE, STRACE, SCTRACE, and CTRACE macros to use enum TraceTag values instead of raw string literals

* trace : add cstring header

* trace : Add Markdown documentation generation from trace_tags.def via mk_api_doc.py

* trace : rename macro parameter 'class' to 'tag_class' and remove Unicode comment in trace_tags.h.

* trace : Add TODO comment for future implementation of tag_class activation

* trace : Disable code related to tag_class until implementation is ready (#7663).
2025-05-28 14:31:25 +01:00
Nikolaj Bjorner
87f7a20e14 Add (updated and general) solve_for functionality for arithmetic, add congruence_explain to API to retrieve explanation for why two terms are congruent Tweak handling of smt.qi.max_instantations
Add API solve_for(vars).
It takes a list of variables and returns a triangular solved form for the variables.
Currently for arithmetic. The solved form is a list with elements of the form (var, term, guard).
Variables solved in the tail of the list do not occur before in the list.
For example it can return a solution [(x, z, True), (y, x + z, True)] because first x was solved to be z,
then y was solved to be x + z which is the same as 2z.

Add congruent_explain that retuns an explanation for congruent terms.
Terms congruent in the final state after calling SimpleSolver().check() can be queried for
an explanation, i.e., a list of literals that collectively entail the equality under congruence closure.
The literals are asserted in the final state of search.

Adjust smt_context cancellation for the smt.qi.max_instantiations parameter.
It gets checked when qi-queue elements are consumed.
Prior it was checked on insertion time, which didn't allow for processing as many
instantations as there were in the queue. Moreover, it would not cancel the solver.
So it would keep adding instantations to the queue when it was full / depleted the
configuration limit.
2024-12-19 23:27:57 +01:00
Nikolaj Bjorner
05e053247d add facility to solve for a linear term over API 2024-11-30 09:34:27 -08:00
Nikolaj Bjorner
48712b4f60 Add initial value setting for variables in Z3 API, solver, and optimize modules 2024-09-18 16:13:15 +03:00
Nikolaj Bjorner
adad468cd7 allow copy within a user scope #6827
this will allow copying the solver state within a scope.
The new solver state has its state at level 0. It is not possible to pop scopes from the new solver (you can still pop scopes from the original solver). The reason for this semantics is the relative difficulty of implementing (getting it right) of a state copy that preserves scopes.
2023-07-31 19:46:08 -07:00
Nikolaj Bjorner
f6d411d54b experimental feature to access congruence closure of SimpleSolver
This update includes an experimental feature to access a congruence closure data-structure after search.
It comes with several caveats as pre-processing is free to eliminate terms. It is therefore necessary to use a solver that does not eliminate the terms you want to track for congruence of. This is partially addressed by using SimpleSolver or incremental mode solving.

```python
from z3 import *
s = SimpleSolver()
x, y, z = Ints('x y z')
s.add(x == y)
s.add(y == z)
s.check()
print(s.root(x), s.root(y), s.root(z))
print(s.next(x), s.next(y), s.next(z))
```
2022-12-30 21:41:27 -08:00
Nikolaj Bjorner
07dd1065db added API to monitor clause inferences
See RELEASE_NOTES for more information
examples pending.
2022-10-19 08:34:55 -07:00
Clemens Eisenhofer
e11496bc65
Added decide-callback to user-propagator (#5978)
* Fixed registering expressions in push/pop

* Reused existing function

* Reverted reusing can_propagate

* Added decide-callback to user-propagator

* Refactoring

* Fixed index
2022-04-15 20:07:17 +02:00
Nikolaj Bjorner
3cc9d7f443 improve pre-processing 2022-04-15 12:55:26 +02:00
Nikolaj Bjorner
2e00f2f32d
Propagator (#5845)
* user propagator without ids

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

* user propagator without ids

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

* fix signature

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

* references #5818

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

* fix c++ build

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

* switch to vs 2022

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

* switch 2022

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

* Update propagator example (I) (#5835)

* fix #5829

* na

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

* switch to vs 2022

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

* Adapted the example to the changes in the propagator

Co-authored-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* context goes out of scope in stack allocation, so can't used scoped context when passing objects around

* parameter check

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

* add rewriter

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

* Fixed bug in user-propagator "created" (#5843)

Co-authored-by: Clemens Eisenhofer <56730610+CEisenhofer@users.noreply.github.com>
2022-02-17 09:21:41 +02:00
Nikolaj Bjorner
3f3d058567 extract also units from search state 2022-02-07 06:16:22 +02:00
Nikolaj Bjorner
4b813bac1c na 2021-12-19 12:31:47 -08:00
Nikolaj Bjorner
f0740bdf60 move user propagte declare to context level
declaration of user propagate functions are declared at context level instead of at solver scope.
2021-12-18 10:56:42 -08:00
Nikolaj Bjorner
4856581b68 na 2021-12-17 16:40:19 -08:00
Nikolaj Bjorner
9c8800bdde adding a new toy for Clemens
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-12-17 10:45:59 -08:00
Nikolaj Bjorner
6cc9aa3562 prepare user propagator declared functions for likely Clemens use case 2021-12-16 19:37:30 -08:00
Nikolaj Bjorner
5857236f2f introducing base namespace for user propagator 2021-11-29 19:41:30 -08:00
Nikolaj Bjorner
367e5fdd52
delay internalize (#4714)
* adding array solver

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

* use default in model construction

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

* debug delay internalization

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

* bv

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

* arrays

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

* get rid of implied values and bounds

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

* redo egraph

* remove out

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

* remove files

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-09-28 19:24:16 -07:00
Nikolaj Bjorner
96f10b8c1c user propagator
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-08-22 19:01:04 -07:00
Nikolaj Bjorner
2d5b749745 extend solver callbacks with methods
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-08-21 19:24:59 -07:00
Nikolaj Bjorner
080be7a2af merge
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-08-21 12:14:28 -07:00
Nikolaj Bjorner
4857d60c99 user propagator over the API 2020-08-18 21:53:02 -07:00
Nikolaj Bjorner
0c93c7aa08 adding user propagation to API
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-08-18 10:30:10 -07:00
Nikolaj Bjorner
152c95f72a adding user-propagator ability
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-08-17 22:39:55 -07:00
Nikolaj Bjorner
ca3ec22b7a handle better cancellation for parallel, switch between cube mode and base level mode in smt.threads, expose parameters to control theory_bv and phase caching
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-08-16 23:29:24 -07:00
Nikolaj Bjorner
59d8895d15 add accessors for implied values to API
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-07-28 19:46:39 -07:00
Nikolaj Bjorner
2d59b81353 delay evaluation of model, throttle propagation, introduce LUT results into cutset
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-02-05 12:33:42 -08:00
Nikolaj Bjorner
2bee9a062f merge more from csp
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-06-12 20:24:37 -07:00
Nikolaj Bjorner
9262908ebb mux
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-06-05 09:06:17 +01:00
Nikolaj Bjorner
d2dcb39c11 add smt lookahead
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-05-17 20:24:29 +03:00
Nikolaj Bjorner
4c76d43670 add binary_merge encoding option
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-02-28 08:35:22 -08:00
Nikolaj Bjorner
f84de9400e also deal with initializing boolean variables in smt context
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-02-15 17:58:26 -08:00
Nikolaj Bjorner
89bf2d4368 add API for setting variable activity
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-02-15 12:05:24 -08:00
Nikolaj Bjorner
8d20310758 adding trail/levels
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-01-29 14:45:51 -08:00
Nikolaj Bjorner
bfeb15b876 move to list of clauses
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-06-14 16:08:50 -07:00
Nikolaj Bjorner
b73aa3642a check with cube and clause
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-06-14 16:08:49 -07:00
Nikolaj Bjorner
859c68c2ac merge with opt
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-04-30 08:27:54 -07:00
Nikolaj Bjorner
012a96fd81 adding smt parallel solving
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-04-15 16:16:48 -07:00
Nikolaj Bjorner
534a31f74e inherit solver parameters in asserted formulas rewriter. #1511
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-03-04 05:06:36 -08:00
Nikolaj Bjorner
2897b98ed2 remove simplify dependencies
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2017-08-26 00:37:22 -07:00
Nikolaj Bjorner
2b82fd5d0c updated include directives
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2017-08-01 10:51:47 -07:00
Nikolaj Bjorner
b19f94ae5b make include paths uniformly use path relative to src. #534
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2017-07-31 13:24:11 -07:00
Nikolaj Bjorner
024082a45f adding preferred sat, currently disabled, to wmax. Fixing issue #815
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2016-11-30 09:52:05 -08:00
Nikolaj Bjorner
3778048eb4 add bounded-int and pb2bv solvers to fd_solver, use sorting networks for pb2bv rewriter when applicable, hoist to pb2bv_rewriter module and remove it from the pb2bv_tactic
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2016-10-23 20:31:59 -07:00
Nikolaj Bjorner
8d2b70a5e2 better encodings for at-most-1, #755
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2016-10-10 23:46:03 -07:00
Nikolaj Bjorner
3b70dd6678 tuning by using get_consequences2
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2016-09-06 14:29:40 +08:00
Nikolaj Bjorner
491b3b34aa tune consequence finding. Factor solver pretty-printing as SMT-LIB into top-level
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2016-08-03 11:14:29 -07:00
Nikolaj Bjorner
8221a09659 fast path for antecedent extraction in smt_context
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2016-07-28 16:49:19 -07:00
Nikolaj Bjorner
85d44c5d66 fix axioms for extract, add extensionality checking for shared variables, convert exceptions to unknown status per #419
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2016-01-18 11:09:41 +05:30