3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-02-10 11:00:52 +00:00
Commit graph

56 commits

Author SHA1 Message Date
Copilot
2436943794
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-01-14 19:55:31 -08: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
3e5abef145 fix #7549 2025-02-18 21:38:06 -08:00
Nikolaj Bjorner
79b7d8a9e2 throttle squash-store #7134
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-02-21 10:00:11 -08: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
30e0f78c16 remove exit
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-09 10:00:36 -08:00
Nikolaj Bjorner
49ee570b09 split into separate function
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-08 19:16:46 -08:00
Nuno Lopes
5899fe3cea
Add rewrite for array selects of chain of stores of a same value (#6526)
* Add rewrite for array selects of chain of stores of a same value

Example:
```smt
(declare-fun mem () (Array (_ BitVec 4) (_ BitVec 4)))
(declare-const x (_ BitVec 4))
(declare-const y (_ BitVec 4))
; simplifies to #x1
(simplify (select (store (store (store mem #x1 #x1) y #x1) x #x1) #x1))
```

* Update array_rewriter.cpp

* Update array_rewriter.cpp
2023-01-08 19:09:01 -08:00
Nuno Lopes
e448191212 array rewriter: expand select of store with const array into an ite
This:
(simplify (select (store ((as const (Array (_ BitVec 4) (_ BitVec 4))) #x0) x #x1) y))
=>
(ite (= x y) #x1 #x0)
2023-01-03 11:08:57 +00:00
Nikolaj Bjorner
80c516bb50 squash stores 2022-08-05 13:57:35 +03:00
Nuno Lopes
41deed59a3 fix bug in array rewriter introduced in 202ce1e 2022-06-21 22:40:40 +01:00
Nikolaj Bjorner
36a1f758bc mask regression 2022-06-21 14:34:47 -07:00
Nikolaj Bjorner
202ce1edf0 #6100 - two perf fixes
remaining perf bug is dealing with very large bit-widths. mod 2^n should be computed natively based on n instead of 2^n because we pre-populate an array with all values up to n. Suppose n is 10000, the array has size 10000.
2022-06-21 12:45:29 -07:00
Nikolaj Bjorner
f77037e9a5 expand select/store when I/J are values #6053
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-05-25 20:23:43 -04:00
Nikolaj Bjorner
bc2020a39b #5604
retain array interpretation when available
2021-10-17 20:24:26 -07:00
Nikolaj Bjorner
be4df46f6f #5532 remove unsound rewrite rule that was recently added 2021-09-07 06:42:24 +02:00
Nikolaj Bjorner
72f6271d82 #5532
bugs in:
- rewriting of 0-ary expressions was incomplete
- sharing annotations when a node has two theories attached it is shared
- sharing of const of an array

Remove unreadable part of pretty printer for lp solver.
2021-09-06 19:14:03 +02:00
Nikolaj Bjorner
cf9e55fa96 #5516
expose ability to expand select/store and select/ite (lambdas are always expanded) during pre-processing for N.P. Lopes.
2021-09-01 17:44:17 -07:00
Nikolaj Bjorner
f03d756e08 missing rewrite exposed by #5498 2021-08-25 06:34:27 -07:00
Nikolaj Bjorner
c50e6bdbb1 fix #5229 2021-04-30 02:32:16 -07:00
Nikolaj Bjorner
4a6083836a call it data instead of c_ptr for approaching C++11 std::vector convention. 2021-04-13 18:17:35 -07:00
Nikolaj Bjorner
3ae4c6e9de refactor get_sort 2021-02-02 04:45:54 -08:00
Nikolaj Bjorner
864eaf8bf8 remove unsound rewrite #4778 2020-11-08 17:48:51 -08:00
Nikolaj Bjorner
f354671465 add parameter for scenario from #4743 2020-10-30 01:14:34 -07:00
Nikolaj Bjorner
11c90cc142 move parameters from ast/rewriter to params
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-08-29 11:11:16 -07:00
Nikolaj Bjorner
f7b2407a11 for #4588 2020-07-28 10:14:56 -07:00
Nikolaj Bjorner
ebce0b3612 fix #4577
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-07-20 14:40:45 -07:00
Nikolaj Bjorner
52df98f9ca na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-04-08 16:31:47 -07:00
Nikolaj Bjorner
e1d2480a8b fix #3860 fix #3861
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-04-08 16:26:11 -07:00
Nikolaj Bjorner
8428970a1f fix #3006
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2020-02-16 23:46:58 -10:00
Nikolaj Bjorner
ebb7d60c75 fix #2792
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-12-09 07:50:57 +03:00
Nikolaj Bjorner
1eab774b91 fix #2774
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-12-02 15:22:03 -08:00
Nikolaj Bjorner
a78f899225 expand deep stores by lambdas to avoid expanding select/store axioms
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-11-03 10:29:10 +01:00
Nikolaj Bjorner
16d4ccd396 na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-10-31 10:06:09 -07:00
Nikolaj Bjorner
604e6b2705 fix #2418, change types in sat_solver to avoid cast
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-07-24 11:52:28 -07:00
Nikolaj Bjorner
3a90de1cbe fix #2419
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-07-24 10:09:34 -07:00
Nikolaj Bjorner
4deb9d2af2 use array interpretations whenever possible for #2378. Also strengthen equality test for lambda
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-07-14 09:23:29 -04:00
Nikolaj Bjorner
84990ffa27 fixing #2378
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-07-12 14:21:22 +01:00
Nikolaj Bjorner
f128398bf9 add clause proof module, small improvements to bapa
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-05-30 15:57:19 -07:00
Nikolaj Bjorner
dd4b8b9ff8 select/map rewrite
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-05-17 00:00:00 +03:00
Nikolaj Bjorner
fa88bdb075 fix #2251 thanks to Clark
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-04-27 09:44:18 -07:00
Nikolaj Bjorner
7e2afca2c6 add card operator to bapa
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-04-20 13:24:07 -07:00
Nikolaj Bjorner
62ec02e50f extend rewriting features for arrays, #2151
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-03-22 12:29:50 -07:00
Nikolaj Bjorner
7b4c919fcf stubs for stronger array equality rewriting
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-03-03 14:11:05 -08:00
Nikolaj Bjorner
e51b5fd99c fix t154 regression
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-03-03 13:10:11 -08:00
Nikolaj Bjorner
3ee5c0e7d9 fix #2164 address some of simplification shortcommings from #2151 #2152 #2153
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-03-03 11:33:44 -08:00
Nikolaj Bjorner
773c613694 fix #2149
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2019-02-23 11:10:01 +01:00
Nikolaj Bjorner
520ce9a5ee integrate lambda expressions
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2018-06-26 07:23:04 -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