3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-24 09:35:32 +00:00
Commit graph

71 commits

Author SHA1 Message Date
Nikolaj Bjorner
50f9fddfd2 Add unification based projection function
Heuristic for EMBPR is to unify terms that occur in uninterpreted contents. Walk partitions that are pure f(t) and an impure f(s)
and attempt to unify t with s ensuring that merges from s preserves satisfiability.
2025-02-16 13:18:21 -08:00
Nikolaj Bjorner
a703cf81b1 replace model_ref by model* in tg_project,
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2025-02-15 19:34:52 -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
a3f7541719 fix #7517 2025-01-20 19:04:36 -08:00
Nikolaj Bjorner
d2411567b5 add projection with witnesses
expose model based projection with witness creation
2024-11-27 10:26:34 -08:00
Nikolaj Bjorner
eb8c63080a Refactor and fix uninitialized variables and improve function consistency across multiple modules 2024-09-23 13:34:33 +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
49ba3bc12f address compiler warnings gcc-13
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-08-26 11:33:54 -07:00
Hari Govind V K
0c16d34eb0
fix #7292 (#7316) 2024-07-30 11:35:33 -07:00
Bruce Mitchener
53f89a81c1
Fix some typos. (#7115) 2024-02-07 23:06:43 -08:00
Bruce Mitchener
b5e8f59eae
mbp: term: Fix reorder ctor warning. (#7016)
Initialize members in same order they are defined.
2023-11-26 16:34:08 +01:00
Nikolaj Bjorner
a9f9d3ddf4 build fixes
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-11-17 10:15:01 -08:00
Nikolaj Bjorner
b9455c3692 #6999 deal with implicit assumptions, more robust pattern matching
The code is making some assumptions that arrays are 1-dimensional. This is not generally true.
Introducing pattern matching to ensure the assumption is met.
Avoid get_arg(..) especially when there is an approach based on pattern matching recognizers.
2023-11-17 10:06:20 -08:00
Nikolaj Bjorner
6d6d6b8ed0 build issue
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-11-17 09:20:17 -08:00
Hari Govind V K
f94a475da3
Qel fixes (#6999)
* dont use qel for sequences. fix #6950

* handle negation of read-write. fix #6991

* handle neg-peq terms produced by distinct. fix #6889

* dbg print
2023-11-17 09:18:04 -08:00
Nikolaj Bjorner
1b6c7d6541 fix #6996 2023-11-16 18:58:24 -08:00
Hari Govind V K
ba6c23bbc5
bug fix #6934 (#6940) 2023-10-14 01:06:15 -07:00
Nikolaj Bjorner
6445d01557 normalize newlines for if 2023-10-10 13:43:49 -07:00
Hari Govind V K
5ba06f4e28
print deq in lits2pure. fix #6877 (#6878) 2023-08-26 20:53:15 -07:00
Hari Govind V K
b8d8553c41
support or, and, implies, distinct in mbp_basic (#6867) 2023-08-20 15:36:22 -07:00
Nikolaj Bjorner
c3b344ec47 fix #6865
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-08-18 16:51:58 -07:00
Hari Govind V K
1be692002d
split on all ite terms. fix #6852 (#6859) 2023-08-16 10:07:30 -07:00
Hari Govind V K
dd0b0b47b8
fix #5925 (#6846) 2023-08-04 15:18:16 -07:00
Nikolaj Bjorner
5b287bff09 nits
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-08-02 16:59:59 -07:00
Nikolaj Bjorner
09dd7688ce fix build
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-08-02 11:19:41 -07:00
Nikolaj Bjorner
9b5727adde enable arm for non-osx
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-08-02 10:51:52 -07:00
Nikolaj Bjorner
606940e60c nits
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-08-02 10:29:48 -07: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
0da0fa2b27 #6429 2022-10-29 13:43:07 -07:00
Nikolaj Bjorner
4a1d76cf49 #6418 - add best-effort for nested and/or (from ite literals) 2022-10-23 11:03:51 -07:00
Nikolaj Bjorner
e3a44254c9 fix #6415 2022-10-22 11:18:16 -07:00
Nikolaj Bjorner
31914d8ecf simplify purified expressions 2022-10-21 03:47:57 -07:00
Nikolaj Bjorner
d4885abdc0 fix #6400
bi-implication was treated as an atomic formula leading to incorrect projection.
2022-10-17 11:00:21 -07:00
Nikolaj Bjorner
9bf5e3f5fc fixes for #6388 2022-10-13 15:22:19 +02:00
Nikolaj Bjorner
0bdb2f1691 add verbose=1 log for mbp failure 2022-09-02 18:03:56 -07:00
Nikolaj Bjorner
7e1e64d027 fix #6313
remaining new issues
2022-09-02 17:48:00 -07:00
Nikolaj Bjorner
61f7dc3513 remove creation of trivial testers 2022-09-01 10:23:21 -07:00
Nikolaj Bjorner
6c165e89dc #6299 2022-08-24 20:25:01 -07:00
Nikolaj Bjorner
64e0e785e7 #5953 2022-08-21 18:28:07 -07:00
Nikolaj Bjorner
c3d635cf77 handle build warning
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-18 12:50:30 -07:00
Nikolaj Bjorner
1a5503c87b enable new code path for mod handling 2022-08-17 07:31:26 -07:00
Nikolaj Bjorner
b169292743 add parameter descriptions
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-16 08:26:53 -07:00
Nikolaj Bjorner
583dae2e27 enable nested division
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-15 16:11:00 -07:00
Nikolaj Bjorner
138f0d269c fix regression found by fuzzers fix #6271 2022-08-14 12:26:33 -07:00
Nikolaj Bjorner
550d6914b1 updates to div/mod handling in quantifier projection
note: the new code remains disabled at this point.
2022-08-12 14:39:33 -04:00
Nikolaj Bjorner
03385bf78d improve quantifier elimination for arithmetic
This update changes the handling of mod and adds support for nested div terms.

Simple use cases that are handled using small results are given below.

```
(declare-const x Int)
(declare-const y Int)
(declare-const z Int)
(assert (exists ((x Int)) (and (<= y (* 10 x)) (<= (* 10 x) z))))
(apply qe2)
(reset)

(declare-const y Int)
(assert (exists ((x Int)) (and (> x 0) (= (div x 41) y))))
(apply qe2)
(reset)

(declare-const y Int)
(assert (exists ((x Int)) (= (mod x 41) y)))
(apply qe2)
(reset)
```

The main idea is to introduce definition rows for mod/div terms.
Elimination of variables under mod/div is defined by rewriting the variable to multiples of the mod/divisior and remainder.

The functionality is disabled in this push.
2022-08-12 10:20:43 -04:00
Bruce Mitchener
5014b1a34d Use = default for virtual constructors. 2022-08-05 18:11:46 +03:00
Nikolaj Bjorner
51ed13f96a update topological sort to use arrays instead of hash tables, expose Context over Z3Object for programmability
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-06-08 06:28:24 -07:00
Nikolaj Bjorner
d0fb3cba15 #5641 - projection that skips interpreted functions can violate model evaluation. 2022-01-02 17:45:43 -08:00
Nikolaj Bjorner
fea14245a0 #5454 2021-08-11 19:43:42 -07:00