3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-26 13:06:05 +00:00
Commit graph

1093 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
47c12f9a18 refactoring to use for-range 2025-05-15 10:57:46 -07:00
Nikolaj Bjorner
7c226f40df fix #4117 2025-03-12 20:14:36 -07:00
Nikolaj Bjorner
07fa36e37a fix #7466
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-03-09 18:50:07 -07:00
Nikolaj Bjorner
80f00f191a fix #7572 and fix #7574
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-03-07 10:46:29 -08:00
Nikolaj Bjorner
83ee21cd22 streamline tracing 2025-02-27 14:42:35 -08:00
Nikolaj Bjorner
c79967b2b6 using iterators
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-02-21 19:20:49 -08:00
Nikolaj Bjorner
b27a2aa7fc remove calls to removed def constructor
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-02-16 10:13:00 -08:00
Nikolaj Bjorner
eee96ec312 bug fixes and cleanup in projection functions
spacer would drop variables of sorts not handled by main loop.
- projection with witness needs to disable qel style preprocessing to ensure witnesses are returned.
- add euf plugin to handle uninterpreted sorts (and then uninterpreted functions)
2025-02-15 14:11:20 -08:00
Nikolaj Bjorner
94d3c591b5 make sure ackermann works with arrays that have more than one argument
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-02-11 21:28:31 -08:00
Nikolaj Bjorner
9ea921ba8e update spacer projection for arrays to allow ackerman reduction for non-integer arrays
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-02-11 17:38:56 -08:00
Hari Govind V K
f574950237
fix #7521 (#7531) 2025-01-26 17:52:06 -08: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
92065462b4 use std::exception as base class to z3_exception
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-11-04 11:08:15 -08:00
Nuno Lopes
3586b613f7 remove default destructors 2024-10-02 22:20:12 +01:00
Nikolaj Bjorner
328616b8b2 fix build warnings 2024-09-30 17:25:19 -07:00
Nikolaj Bjorner
86b97186b0 fix build warnings 2024-09-30 15:51:48 -07:00
Nikolaj Bjorner
551cc53a2f fix un-intialized variable warnings 2024-09-30 15:08:33 -07:00
Nikolaj Bjorner
826835fd7c fixes to build warnings 2024-09-30 08:23:31 -07:00
Nikolaj Bjorner
3df7299d1e update signature of operator==
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-09-26 14:47:51 +01:00
Nikolaj Bjorner
a831fe9609 fix some build warnings
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-09-24 11:15:47 +01:00
Nuno Lopes
499ed5d844 remove unneeded iterator functions 2024-09-23 12:59:04 +01:00
Nuno Lopes
737c2208fa delete more default constructors
reduces code size by 0.1%
2024-09-23 12:59:04 +01:00
Nikolaj Bjorner
4b4a28239f Add const qualifiers to comparison operators and update iterator equality checks in various classes 2024-09-23 11:45:11 +01:00
Nuno Lopes
a62fede64b remove a few default constructors 2024-09-23 08:17:58 +01:00
Nuno Lopes
8061765574 remove default destructors & some default constructors
Another ~700 KB reduction in binary size
2024-09-04 22:30:23 +01:00
Nikolaj Bjorner
84da614de3 make gcc linting happy
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-08-26 11:40:01 -07:00
Nikolaj Bjorner
49ba3bc12f address compiler warnings gcc-13
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-08-26 11:33:54 -07:00
Bruce Mitchener
d66df2616f
Fix some typos. (#7075) 2023-12-29 15:20:06 +00:00
Nuno Lopes
cab3c45863 remove unnecessary parameter copies 2023-12-22 16:11:06 +00:00
Bruce Mitchener
50e0fd3ba6
Use noexcept more. (#7058) 2023-12-16 12:14:53 +00:00
Arie Gurfinkel
51d3c279d0
QEL: Fast Approximated Quantifier Elimination (#6820)
* qe_lite: cleanup and comment

no change to code

* mbp_arrays: refactor out partial equality (peq)

Partial array equality, PEQ, is used as an intermediate
expression during MBP for arrays. We need to factor it out
so that it can be shared between MBP-QEL and existing MBP.

Partial array equality (peq) is used in MBP for arrays.
Factoring this out to be used by multiple MBP implementations.

* rewriter: new rewrite rules

These rules are specializes for terms that are created in QEL.
QEL commit is comming later

* datatype_rw: new rewrite rule for ADTs

The rule handles this special case:

    (cons (head x) (tail x)) --> x

* array_rewriter rules for rewriting PEQs

Special rules to simplify PEQs

* th_rewriter: wire PEQ simplifications

* spacer_iuc: avoid terms with default in IUC

Spacer prfers to not have a term representing default value of an array.
This guides IUC from picking such terms in interpolation

* mbp_term_graph: replace root with repr

* mbp_term_graph: formatting

* mbp_term_graph: class_props, getters, setters

Class properties allow to keep information for an equivalence class.

Getters and setters for terms allow accessing information

* mbp_term_graph: auxiliary methods for qel

QEL commit is comming later in the history

* mbp_term_graph: bug fix

* mbp_term_graph: pick, refine repr, compute cgrnd

* mbp_term_graph: internalize deq

* mbp_term_graph: constructor

* mbp_term_graph: optionally internalize equalities

Reperesent equalities explicitly by nodes in the term_graph

* qel

* formatting

* comments on term_lt

* get terms and other api for mbp_qel

* plugins for mbp_qel

* mbp_qel_util: utilities for mbp_qel

* qe_mbp: QEL-based mbp

* qel: expose QEL API

* spacer: replace qe_lite in qe_project_spacer by qel

This changes the default projection engine that spacer uses.

* cmd_context: debug commands for qel and mbp_qel

New commands are

  mbp-qel -- MBP with term graphs
  qel     -- QEL with term graphs
  qe-lite -- older qelite

* qe_mbp: model-based rewriters for arrays

* qe_mbp: QEL-based projection functions

* qsat: wire in QEL-based mbp

* qsat: debug code

* qsat: maybe a bug fix

Changed the code to follow the paper by adding all predicates above a given
level, not just predicates of immediately preceding level.

* chore: use new api to create solver in qsat

* mbp_term_graph use all_of idiom

* feat: solver for integer multiplication

* array_peq: formatting, no change to code

* mbp_qel_util: block comment + format

* mbt_term_graph: clang-format

* bug fix. Move dt rewrite to qe_mbp

* array_peq: add header

* run clang format on mbp plugins

* clang format on mul solver

* format do-while

* format

* format do-while

* update release notes

---------

Co-authored-by: hgvk94 <hgvk94@gmail.com>
Co-authored-by: Isabel Garcia <igarciac@uwaterloo.ca>
2023-08-02 09:34:06 -07:00
Nikolaj Bjorner
d1482287d4 fix #6793, disable unbound_compressor when used in context of a moel converter
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-07-13 14:03:40 -07:00
Hari Govind V K
f7c9c9ef72
fix unsound slice criteria (#6625)
* rename for readability

* bug fix #6617. Don't slice op args that are values
2023-03-06 19:28:22 -08:00
Hari Govind V K
55d45e0c0c
bug fix. Prevent resetting gg stats #6062 (#6618) 2023-03-03 12:32:23 -08:00
hgvk94
828fff9684 fix #6543. don't assume order on bindings 2023-02-23 17:35:55 -05:00
Nikolaj Bjorner
bc6037464d clean up build warnings
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-02-19 10:08:31 -08:00
Nikolaj Bjorner
6a2d60a6ba fix #6571
most solvers don't support background properties
2023-02-07 11:04:58 -08:00
Nikolaj Bjorner
601e506d54 remove debug out 2023-02-07 10:40:49 -08:00
Nikolaj Bjorner
ed4a84e5d3 compiler warning
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-02-02 19:21:34 -08:00
Nikolaj Bjorner
d263b373ed update release notes
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-31 12:19:33 -08:00
Nikolaj Bjorner
fcea32344e add missing tactic descriptions, add rewrite for tamagochi
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-08 13:32:26 -08: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
d5316e017e add tactic descriptions 2022-12-14 20:38:28 -08:00
Nikolaj Bjorner
dbb4bbe7dc remove debug out 2022-12-13 19:36:55 -08:00
Nikolaj Bjorner
9054e72920 fix #6467 2022-12-13 19:35:20 -08:00
Nikolaj Bjorner
9a656772b4 fix #6446 2022-11-08 18:37:16 -08:00
Nikolaj Bjorner
28668c6efc set up model reconstruction trail 2022-11-04 11:25:39 -07:00
Nikolaj Bjorner
84af521514 fixes #6439 #6436 2022-11-04 09:36:06 -07:00