3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-15 05:18:44 +00:00
Commit graph

3307 commits

Author SHA1 Message Date
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 7da58b9e84 fix build warnings 2024-09-30 10:34:26 -07:00
Nikolaj Bjorner 5413018d86 Update euf_ac_plugin.cpp 2024-09-30 08:43:17 -07:00
Nikolaj Bjorner 826835fd7c fixes to build warnings 2024-09-30 08:23:31 -07:00
Nikolaj Bjorner d047b86439 pypi publish
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-09-26 21:35:28 +01:00
Nikolaj Bjorner f4452a0348 pypi publish
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-09-26 21:34:55 +01: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 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
Nuno Lopes a62fede64b remove a few default constructors 2024-09-23 08:17:58 +01:00
Nuno Lopes 22d9bfad35 fix warning with iterators due to non-const comparator 2024-09-23 08:10:56 +01:00
Nikolaj Bjorner 1e580a7f12 update to c++20, remove debug output
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-09-22 21:30:44 +01:00
Nikolaj Bjorner 96c1375786 #7391
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-09-22 19:35:03 +01:00
Nikolaj Bjorner a9f8ec1bcb updated handling of value initialization for bit-vectors 2024-09-22 21:30:11 +03:00
Nikolaj Bjorner ba5cec7704 additional rewrites for bv2int 2024-09-22 21:29:12 +03:00
Nikolaj Bjorner fa7fc8ef5e Refactor bv_rewriter functions using unified variable assignment and early break logic 2024-09-22 13:04:49 +03:00
Nikolaj Bjorner d66609ea14 fix #7389
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-09-22 02:41:11 +03:00
Nikolaj Bjorner 0c48a50d59 Add support for initializing variable values in solver and optimize contexts in Z3 2024-09-20 18:28:26 +03:00
Nikolaj Bjorner 8349ee0069 Add support for const array in all logics as per issue #7383 2024-09-19 11:44:18 +03: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
Nuno Lopes ef58376c14 replace a few old-school constructors for a 0.5% reduction in code size
don't waste those 128 KB!
2024-09-02 16:13:46 +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
Nikolaj Bjorner 3e518b9e8b fix #7331 2024-08-06 03:54:25 -07:00
Nikolaj Bjorner 25e683e4e1 fix finalize method
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-07-28 19:10:30 -07:00
Nikolaj Bjorner ac7014a68b expose public
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-07-29 03:18:20 +02:00
Nikolaj Bjorner f94500c3ca fix #7309 2024-07-28 13:18:08 +02:00
Nikolaj Bjorner ef86f5fcc2 add partial evaluation cases for algebraic data-types for recursive functions. 2024-06-16 16:07:16 -07:00
Nikolaj Bjorner 81ebd52f61 #7207
the utility that computes case analysis is brittle when the body of a function contains ite expressions that are not relevant to recursive unfolding.
The fold-rec occurrences that get inserted to harness large case splits work against throttling case generation: they get treated as recursive functions that have to be guarded.
2024-06-16 15:04:42 -07:00
Nikolaj Bjorner 972d35204c reshuffle priorities on multiplication allow non-determinism. 2024-06-15 10:47:10 -07:00
Nikolaj Bjorner a6b502779b fix #7252
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-06-13 17:52:17 -07:00
Nikolaj Bjorner b831a589e5 fixes to #7250 2024-06-12 08:50:24 -07:00
Nikolaj Bjorner 2ad9f220f2 add logging 2024-04-30 16:57:59 -07:00
Nikolaj Bjorner bebcd94703 enable logging nla lemmas
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-04-25 10:29:34 -04:00
Nikolaj Bjorner 2a4f0e785b tidy 2024-04-20 18:04:10 -04:00
Nikolaj Bjorner 2682c2ef2b sls updates
- add SINGLE_THREAD mode
- add interface to retrieve "best" model so far
2024-04-13 16:42:26 +02:00
Nikolaj Bjorner c0bdc7cdd6 enable concurrent sls with new solver core
allow using sls engine (for bit-vectors) with the new core.

Examples

z3 sat.smt=true tactic.default_tactic=smt /v:1 smt.sls.enable=true smt.bv.solver=0 /st C:\QF_BV_SAT\bench_10.smt2
z3 sat.smt=true tactic.default_tactic=smt /v:1 smt.sls.enable=true smt.bv.solver=2 /st C:\QF_BV_SAT\bench_10.smt2
z3 C:\QF_BV_SAT\bench_11100.smt2 sat.smt=true tactic.default_tactic=smt /v:1 smt.sls.enable=true smt.bv.solver=2 /st
2024-04-11 10:49:30 +02:00
Nikolaj Bjorner 510534dbd4 cleanup 2024-04-10 19:09:30 -07:00
Nikolaj Bjorner 974ea7b68d maintain ownership of dependency 2024-04-10 17:57:14 -07:00
Nikolaj Bjorner 9a681b1a37 reorg sls
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-04-09 10:44:53 -07:00
Nikolaj Bjorner bab7ca2b70 fixes to bv-sls 2024-04-07 14:24:13 -07:00
Nikolaj Bjorner d7c0e17f96 fixes to tighten-range 2024-04-02 21:12:09 -07:00
Nikolaj Bjorner 2ce202db75 add special handling of lshr, ashr 2024-04-02 21:09:18 -07:00
Nikolaj Bjorner 84092cbd96 add engine-init to control model transfer
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-03-30 15:12:32 -07:00
Nikolaj Bjorner 51f1e2655c updates to sls
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-03-30 12:59:05 -07:00
Nikolaj Bjorner 6455de9dd3 fix #7179
Ensure that flat associative rewriting is disabled if rewriter.flat is set to false.
2024-03-21 09:39:13 -07:00
someplaceguy 7bbe3fb2b6
fix (get-proof) command to respect option pp.simplify_implies (#7157) 2024-03-09 15:13:42 -08:00
Nikolaj Bjorner dcaacf5e9b add rewrite glue for instantiating equalities, #7154
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-03-07 15:21:26 -08:00
Nikolaj Bjorner d6f522e205 na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-03-05 12:28:31 -08:00
Nikolaj Bjorner 531bda39ac fix alias bug 2024-03-05 12:28:31 -08:00
Nikolaj Bjorner 657aaf9a0f na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-03-05 12:28:31 -08:00
Nikolaj Bjorner 22616da63b updates 2024-03-05 12:28:31 -08:00
Nikolaj Bjorner 5be8872d6a na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-03-05 12:28:31 -08:00
Nikolaj Bjorner dfd5c27fec na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-03-05 12:28:31 -08:00
Nikolaj Bjorner 803f0f0c65 na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-03-05 12:28:31 -08:00
Nikolaj Bjorner 5455603910 na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-03-05 12:28:31 -08:00
Nikolaj Bjorner 9888d87294 na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-03-05 12:28:31 -08:00
Nikolaj Bjorner f46c3782d6 bugfixes 2024-03-05 12:28:31 -08:00
Nikolaj Bjorner d774f07eb3 add eval field to sls-valuation to track temporary values. 2024-03-05 12:28:31 -08:00
Nikolaj Bjorner 8f139e862c updates to multiplication 2024-03-05 12:28:31 -08:00
Nikolaj Bjorner 2590d672f4 na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-03-05 12:28:31 -08:00
Nikolaj Bjorner 58474df438 na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-03-05 12:28:31 -08:00
Nikolaj Bjorner 0e5b504c30 remove bw setting 2024-03-05 12:28:30 -08:00
Nikolaj Bjorner a328366c7d move to single path mode for search
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-03-05 12:28:30 -08:00
Nikolaj Bjorner c451e4e50b na 2024-03-05 12:28:30 -08:00
Nikolaj Bjorner 63804c5296 na 2024-03-05 12:28:30 -08:00
Nikolaj Bjorner 74e73f2b84 reorg to use datatypes 2024-03-05 12:28:30 -08:00
Nikolaj Bjorner 48026edd7f move to hide bits
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-03-05 12:28:30 -08:00
Nikolaj Bjorner acc9c21653 move to hide bits
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-03-05 12:28:30 -08:00
Nikolaj Bjorner cfa6bd4534 update python build dependencies
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-03-05 12:28:30 -08:00
Nikolaj Bjorner b14499f230 prepare for sls experiment
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-03-05 12:28:30 -08:00
Nikolaj Bjorner cf72a916f8 bugfixes, adding plugin solver 2024-03-05 12:28:30 -08:00
Nikolaj Bjorner 659e384ee7 bugfixes
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-03-05 12:28:30 -08:00
Nikolaj Bjorner cd6382f1c8 fix alias bug
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-03-05 12:28:30 -08:00
Nikolaj Bjorner 9cde4f7e05 bugfixes 2024-03-05 12:28:30 -08:00
Nikolaj Bjorner d7e419b7ed fixes and checks
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-03-05 12:28:30 -08:00
Nikolaj Bjorner ab0459e5aa bugfixes 2024-03-05 12:28:30 -08:00
Nikolaj Bjorner 7dc4ce8259 use tuned gcd to compute mult inverse 2024-03-05 12:28:30 -08:00
Nikolaj Bjorner 4391c90960 na 2024-03-05 12:28:30 -08:00
Nikolaj Bjorner 991537836b fixes based on unit tests 2024-03-05 12:28:30 -08:00
Nikolaj Bjorner 046db662f9 na 2024-03-05 12:28:30 -08:00
Nikolaj Bjorner 388b2f5eec n/a 2024-03-05 12:28:30 -08:00
Nikolaj Bjorner ddf2d28350 add tests for evaluation 2024-03-05 12:28:30 -08:00
Nikolaj Bjorner 1cf008dd0a updates 2024-03-05 12:28:29 -08:00
Nikolaj Bjorner bd323d6fab save 2024-03-05 12:28:29 -08:00
Nikolaj Bjorner f39756c74b initial stab at new bv-sls based on repair actions 2024-03-05 12:28:29 -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
Nikolaj Bjorner 84d592c1f2 fix #7121
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-02-16 09:59:57 +07:00
Bruce Mitchener 53f89a81c1
Fix some typos. (#7115) 2024-02-07 23:06:43 -08:00
Nikolaj Bjorner bc70282a18 mute some compiler warnings
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-02-03 15:42:06 -08:00
Nikolaj Bjorner 9425c419ad port remaining egraph update
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-02-03 15:38:05 -08:00
Nikolaj Bjorner a5a819c291 port updates to egraph from poly
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-02-03 12:48:58 -08:00
Nikolaj Bjorner 36453c5949 use while (true) in do loops with continue
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-01-23 14:56:57 -08:00
Nikolaj Bjorner 7486e8724f track quantifier instantiation method in proof hint #7080
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-01-20 17:44:07 -08:00
Nikolaj Bjorner 4ff352fcac fix #7084
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-01-15 08:49:14 -08:00
Nikolaj Bjorner ddf2eb57d6 deleted parameter
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-01-12 10:42:08 -08:00
Nikolaj Bjorner 59b18d4a14 create as_bin as_hex wrappers for display
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-01-12 09:19:22 -08:00
Nikolaj Bjorner 955c80e98b import updates from poly branch
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-01-10 19:42:58 -08:00
Nikolaj Bjorner 696b70fddb fix
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-01-04 11:00:07 -08:00
Nikolaj Bjorner b75367ffc7 port improvements to arith rewriter
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2024-01-03 13:57:09 -08:00
Bruce Mitchener d66df2616f
Fix some typos. (#7075) 2023-12-29 15:20:06 +00:00
Jakob Rath ec2b8eb4ca
Merge shared parts from polysat branch (#7063)
* sat_literal: make constants constexpr

* dlist: rename elem -> list

* tbv: use get_bit

* additional pdd and rational tests

* egraph: callback setters take functions by value

This allows to set callbacks without defining a separate variable for
the callback lambda.

(previous usage does one copy of the function, exactly as before)

* cmake: enable compiler error when non-void function does not return value
2023-12-28 11:11:53 -08:00
Nikolaj Bjorner ad07e0e18d add sub and super-slice functionality directory to euf-bv-plugin 2023-12-23 10:27:54 -08:00
Nikolaj Bjorner cd331b8a56 remove reference to tactic.h
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-12-22 13:17:04 -08:00
Nikolaj Bjorner 7adb402a3f add missing dependencies
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-12-22 12:06:30 -08:00
Nikolaj Bjorner 5f451182f7 missing cmake list
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-12-22 12:02:24 -08:00
Nikolaj Bjorner e321643bf5 move sls core functionality to be independent of tactic
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-12-22 12:00:52 -08:00
Nuno Lopes cab3c45863 remove unnecessary parameter copies 2023-12-22 16:11:06 +00:00
Nuno Lopes c4fa719751 revert last two commits; MSVC doesn't like to statically allocate flexible arrays 2023-12-20 19:10:05 +00:00
Nuno Lopes c9c53b7c65 tmp_enode: don't heap allocate an app. store it inline instead.
Saves heap allocations and double indirections
2023-12-20 18:19:20 +00:00
Nuno Lopes 4898a156d8 shrink ast's app by 8 bytes on 64-bit platforms when number of args > 0 2023-12-20 16:58:45 +00:00
Nuno Lopes b2d5c24c1d remove a few string copies 2023-12-20 16:55:09 +00:00
Nikolaj Bjorner ea44c110bb gc expressions in the scope of updates, not old expressions 2023-12-18 20:08:29 -08:00
Nikolaj Bjorner 13be3c3fbb reset model converter between rounds to elim-unconstrained. 2023-12-18 16:57:52 -08:00
Nikolaj Bjorner 0daa05aab2 add ability to log selected bv rewrites 2023-12-18 16:57:52 -08:00
Nikolaj Bjorner 2f2bf749b9 fixes to intblast encoding and more arithmetic rewriters
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-12-17 18:15:51 -08:00
Nikolaj Bjorner bb99f44214 fix bugs in elim-unconstr2 and fix bugs in intblast_solver
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-12-17 17:42:55 -08:00
Nikolaj Bjorner 4867073290 remove windowsArm64 from nightly
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-12-17 10:04:49 -08:00
Nikolaj Bjorner d0a59f3740 intblast with lazy expansion of shl, ashr, lshr
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-12-16 15:12:57 -08:00
Bruce Mitchener 50e0fd3ba6
Use noexcept more. (#7058) 2023-12-16 12:14:53 +00:00
Nikolaj Bjorner b44ab2f620 add rewriters for and
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-12-15 14:55:02 -08:00
Nikolaj Bjorner 9293923b8a Add intblast solver 2023-12-15 13:50:38 -08:00
Christoph M. Wintersteiger 2e83352d42
Fix bug in fp.round_to_integral (#7060) 2023-12-15 08:34:27 -08:00
Bruce Mitchener e90a844508
Use override more. (#7059) 2023-12-15 08:44:57 +00:00
Nikolaj Bjorner 8e26c2af17 fix #7049
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-12-08 13:05:21 -08:00
Christoph M. Wintersteiger 6910a4e18c
Fix to_fp_signed (#7034) 2023-12-03 16:38:06 -08:00
Nikolaj Bjorner ea3628e50b remove hoist functionality
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-12-03 16:28:43 -08:00
Nikolaj Bjorner 1de25ed09c pending files 2023-12-02 19:43:51 -08:00
Nikolaj Bjorner ba8d8f0af7 Disable hoist entirely, it is bad on QF_LIA and does not help on other observed cases 2023-12-02 15:40:47 -08:00
Nikolaj Bjorner 5c1e7f7112 fix #7029 2023-12-02 10:48:40 -08:00
Nikolaj Bjorner a15a7cee7b touch
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-12-01 14:13:05 -08:00
Nikolaj Bjorner faf14012ba Regressions reported by Guido 2023-12-01 13:32:13 -08:00
Nikolaj Bjorner b52fd8d954 add EUF plugin framework.
plugin setting allows adding equality saturation within the E-graph propagation without involving externalizing theory solver dispatch. It makes equality saturation independent of SAT integration.
Add a special relation operator to support ad-hoc AC symbols.
2023-11-30 13:58:30 -08:00
Nikolaj Bjorner 26440ed3d8 deal with ubuntu/clang warnings
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-11-29 15:45:19 -08:00
Nikolaj Bjorner e9abdbb7a4 fix #7011
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-11-29 15:08:08 -08:00
Nikolaj Bjorner 2f01b5b567 re-enable delayed literal propagation 2023-11-29 14:00:17 -08:00
Nikolaj Bjorner 4289cfac8d revert some fixes to euf
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-11-29 13:47:59 -08:00
Nikolaj Bjorner d469c1054e remove separate to_add_literal queue 2023-11-29 12:45:43 -08:00
Nikolaj Bjorner e972eb33b2 #6523 - contains_ptr bug regarding etable reinserts 2023-11-29 10:44:36 -08:00
Nikolaj Bjorner 79bbbf76d0 fix #7006 2023-11-28 15:06:27 -08:00
Bruce Mitchener 9d1ceab1f2
cmake: Use FindPython3. (#7019)
`FindPythonInterp` has been deprecated for a long time and is more
verbal about that deprecation now.

The build system no longer uses `PYTHON_EXECUTABLE` but instead uses
`Python3_EXECUTABLE`.
2023-11-27 11:20:21 +01: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 ad2107f079 fix #6978 2023-11-14 08:45:22 -08:00
Nikolaj Bjorner f97dd34028 tests
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-10-30 14:54:04 -07:00
Christoph M. Wintersteiger 9d57bdd2ef
Assorted fixes for floats (#6968)
* Improve 4be26eb543

* Add-on to 0f4f32c5d0

* Fix mk_numeral

* Fix corner-case in fp.div

* Fixes for corner-cases in mk_to_fp_(un)signed

* Fix out-of-range results in mpf_manager::fma

* Further adjustments for fp.to_fp_(un)signed

* fp.to_fp from real can't be NaN

* fp.to_fp from reals: add bounds

* Fix NaN encodings in theory_fpa.

* Fix fp.fma rounding with tiny floats

* Fix literal creation order in theory_fpa
2023-10-29 17:29:42 -07:00
Nikolaj Bjorner 93427f1175 regression test 2447
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-10-26 08:48:58 -07:00
Nikolaj Bjorner 0b8d7b755d useful string rewrites
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-10-26 03:48:50 -07:00
Nikolaj Bjorner 7b490543ca add missing simplification; handle nit #6952
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-10-25 10:00:15 -07:00
Nikolaj Bjorner 0859be5649 #6953
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-10-25 09:07:04 -07:00
Nikolaj Bjorner 8fac89cdcc enable more simplification in case inequality triggers a change. 2023-10-21 19:58:39 -07:00
Nikolaj Bjorner 5942dc24bd #6523 2023-10-15 11:41:25 -07:00
Nikolaj Bjorner 61319ffd85 cache is_shared information in the enode
observed perf overhead for QF_NIA is that assume_eqs in theory_lra incurs significant overhead when calling is_relevant_and_shared. The call to context::is_shared and the loop checking for beta redexes is a main bottleneck. The bottleneck is avoided by caching the result if is_shared inside the enode. It is invalidated for every merge/unmerge.
2023-09-23 17:19:06 -07:00
Nikolaj Bjorner 643512613a simplify last_index function 2023-09-18 12:52:59 -07:00
Nuno Lopes b1c52c0b16 don't crash when a function doesn't have a model when converting a solver to string 2023-09-18 10:16:19 +01:00
Nikolaj Bjorner b87a91379c fix #6894
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-09-14 17:14:14 -07:00
Nikolaj Bjorner 50d76a2fe3 fix #6894
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-09-14 17:14:14 -07:00
Nikolaj Bjorner 4d9af7848d add parameter to disable pattern inference #6884
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-09-03 15:27:37 -07:00
Nikolaj Bjorner 99239068ba some template instantiations #6869
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-09-03 15:21:49 -07:00
Nuno Lopes 00593609c5 minor code simplification 2023-08-30 12:50:29 +01:00
Nikolaj Bjorner 63467f9dfa fix #6876
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-08-25 17:14:35 -07:00
Nikolaj Bjorner 1d9e0feb84 Merge branch 'master' of https://github.com/z3prover/z3 2023-08-21 09:19:16 -07:00
Nikolaj Bjorner 79aa317af4 remove if-def inside cpp file that should not be there #6869
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-08-21 09:19:06 -07:00
Nuno Lopes 57c667e355 remove unused code 2023-08-20 15:16:47 +01:00
Nuno Lopes 8210aafb69 ast compare_nodes: fail faster when comparing quantifier expressions 2023-08-20 14:09:04 +01:00
Nikolaj Bjorner 5e3df9ee77
Arith min max (#6864)
* prepare for dependencies

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

* snapshot

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

* more refactoring

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

* more refactoring

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

* build

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

* pass in u_dependency_manager

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

* address NYIs

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

* more refactoring names

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

* eq_explanation update

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

* add outline of bounds improvement functionality

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

* fix unit tests

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

* remove unused structs

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

* more bounds

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

* more bounds

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

* convert more internals to use u_dependency instead of constraint_index

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

* convert more internals to use u_dependency instead of constraint_index

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

* remember to push/pop scopes

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

* use the main function for updating bounds

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

* na

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

* na

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

* remove reset of shared dep manager

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

* disable improve-bounds, add statistics

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

---------

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-08-19 17:44:09 -07:00
Nikolaj Bjorner 63ea8efcfb remove output
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-08-17 15:20:12 -07:00
Nikolaj Bjorner 51df7b75ce fix 6800
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-08-17 15:18:22 -07:00
Nikolaj Bjorner 6366f8f6b2 na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-08-13 14:05:07 -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 5b2519d7a3 #6523
attach original variable to pb expression.
2023-08-01 08:41:26 -07:00
Nikolaj Bjorner c6aab89662 add rewrite for partially interpreted arithmetic functions 2023-07-25 14:57:27 -07:00
Nikolaj Bjorner d0f2b00f96 fix build warnings
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-07-22 12:24:30 -07:00
Lev Nachmanson 0a91465e13 comment out debug output 2023-07-16 18:40:53 -10:00
Nikolaj Bjorner 305c1c1dc2 fix build
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-07-15 17:52:33 -07:00
Nikolaj Bjorner 30e8330907 fix #6813
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-07-15 17:03:44 -07:00
Nikolaj Bjorner 8a913981f6 fix #6813 - proofs terms are fragile with respect to simplificiation of not(not(e)). It would be better if proof terms didn't have to track this level of detail, but the legacy proof format assumes strictly checkable proofs. A patch is to fixup terms within the mk_transitivity constructor
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-07-15 17:03:04 -07:00
Nikolaj Bjorner a8da0a6851 #6696
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-07-13 21:48:46 -07:00
Nikolaj Bjorner dda9242616 revert lt change
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-07-13 21:39:04 -07:00
Nikolaj Bjorner 3727f70363 fix #6742
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-07-13 19:22:31 -07:00
Nikolaj Bjorner d0d434e4f1 fix #6807 2023-07-13 10:23:28 -07:00
Nikolaj Bjorner 3e58f0cff1 build fixes 2023-07-13 09:25:20 -07:00
Nikolaj Bjorner b909b87acc build fixes
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-07-13 09:13:41 -07:00
Nikolaj Bjorner 939bf1c725 wip - alpha support for polymorphism
An initial update to support polymorphism from SMTLIB3 and the API (so far C, Python).

The WIP SMTLIB3 format is assumed to be supporting the following declaration

```
(declare-type-var A)
```
Whenever A is used in a type signature of a function/constant or bound quantified variable, it is taken to mean that all instantiations of A are included in the signature and assertions.
For example, if the function f is declared with signature A -> A, then there is a version of f for all instances of A.
The semantics of polymorphism appears to follow previous proposals: the instances are effectively different functions.
This may clash with some other notions, such as the type signature forall 'a . 'a -> 'a would be inhabited by a unique function (the identity), while this is not enforced in this version (and hopefully never because it is more busy work).

The C API has the function 'Z3_mk_type_variable' to create a type variable and applying functions modulo polymorphic type signatures is possible.
The kind Z3_TYPE_VAR is added to sort discriminators.

This version is considered as early alpha. It passes a first rudimentary unit test involving quantified axioms, declare-fun, define-fun, and define-fun-rec.
2023-07-12 18:09:02 -07:00
Nikolaj Bjorner d6f2c23627 #6805 2023-07-11 09:41:29 -07:00
Nikolaj Bjorner 241e845da8 fix #6802
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-07-09 12:07:43 -07:00
THE Spellchecker dc0887db5a
Typo Fixes (#6803) 2023-07-09 11:56:10 -07:00
Nikolaj Bjorner 5806869ae4 fix #6792, add scaffolding for type variables
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-07-07 17:22:56 -07:00
Nikolaj Bjorner f645bcf605 add direct detection for integer expressions
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-07-07 09:54:18 -07:00
Nikolaj Bjorner f4b87b3763 fix memory smash in euf completion
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-07-05 13:04:49 -07:00
Guido Martínez 7c380fd6a0
bool_rewriter: fix possible segfault when disabling rewriter.sort_disjunctions (#6779)
After introducing the rewriter.sort_disjunctions option (#6774), I
noticed a segfault in a Z3 run that was working fine for me before the
PR.

I traced the difference to a slight discrepancy between the first patch
I submitted and the one we ended up merging: my first version would skip
sorting the disjuncts in mk_nflat_core, but still return BR_DONE, while
the patch in master returns BR_FAILED instead.

This patch fixes that problem, and it makes slightly more sense to me to
return a BR_DONE since, if `s` is true, some disjunct (e.g. a `false`
or a repeat) might have been simplified away. However I don't fully
understand this code.

... and I can't say I understand why the segfault happens. Perhaps that
is a separate issue?

This is the file to reproduce:
 https://gist.github.com/mtzguido/b7360c74d3d2e42d89f1bd9149ad26f6

Here's a stack trace of the failure, mk_nflat_or_core is not involved.
```
 (gdb) where
 #0  0x0000555555b98497 in smt::context::get_lit_assignment(unsigned int) const ()
 #1  0x0000555555b984cb in smt::context::get_assignment(sat::literal) const ()
 #2  0x0000555555b98504 in smt::context::get_assignment(unsigned int) const ()
 #3  0x0000555555ca83b8 in smt::context::get_assignment_core(expr*) const ()
 #4  0x0000555555c9af5a in smt::context::get_assignment(expr*) const ()
 #5  0x0000555555d7bd1d in (anonymous namespace)::has_child_assigned_to(smt::context&, app*, lbool, expr*&, unsigned int) ()
 #6  0x0000555555d7c413 in (anonymous namespace)::rel_case_split_queue::next_case_split_core(ptr_vector<expr>&, unsigned int&, unsigned int&, lbool&) ()
 #7  0x0000555555d7c589 in (anonymous namespace)::rel_case_split_queue::next_case_split(unsigned int&, lbool&) ()
 #8  0x0000555555c9c1b7 in smt::context::decide() ()
 #9  0x0000555555ca39fd in smt::context::bounded_search() ()
 #10 0x0000555555ca30c2 in smt::context::search() ()
 #11 0x0000555555ca273d in smt::context::check(unsigned int, expr* const*, bool) ()
 #12 0x0000555555cb166a in smt::kernel::check(unsigned int, expr* const*) ()
 #13 0x0000555555cb9695 in (anonymous namespace)::smt_solver::check_sat_core2(unsigned int, expr* const*) ()
 #14 0x00005555560dc0c6 in solver_na2as::check_sat_core(unsigned int, expr* const*) ()
 #15 0x00005555560d73f3 in combined_solver::check_sat_core(unsigned int, expr* const*) ()
 #16 0x00005555560d34e3 in solver::check_sat(unsigned int, expr* const*) ()
 #17 0x0000555556097b26 in cmd_context::check_sat(unsigned int, expr* const*) ()
 #18 0x0000555556082ff0 in smt2::parser::parse_check_sat() ()
 #19 0x0000555556084dc0 in smt2::parser::parse_cmd() ()
 #20 0x00005555560861b6 in smt2::parser::operator()() ()
 #21 0x00005555560757e6 in parse_smt2_commands(cmd_context&, std::basic_istream<char, std::char_traits<char> >&, bool, params_ref const&, char const*) ()
 #22 0x00005555555e8f68 in read_smtlib2_commands(char const*) ()
 #23 0x00005555555ee6f6 in main ()
 (gdb)
```
2023-06-23 11:45:29 -07:00
Guido Martínez 3517361a73
Adding some options in support of F* (#6774)
* patterns: add option for pattern decomposition (pi.decompose_patterns)

True by default, retaining current behavior.

* rewriter: add option for sorting of disjunctions (rewriter.sort_disjunctions)

True by default, retaining current behavior.
2023-06-20 16:10:37 -07:00
tcely b93171de78
pattern_inference.h: include rewriter_def.h (#6765)
Needed to use the `rewriter_tpl` constructor.
2023-06-16 08:46:40 -07:00
Nikolaj Bjorner ac00306355 fix context simplification
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-06-09 11:30:56 -07:00
Nikolaj Bjorner d0085b41c1 disable breaking change
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-06-09 11:15:54 -07:00
Nikolaj Bjorner 555ccc8aab simplify bounds by subsumption checks
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-06-09 10:21:45 -07:00
Nikolaj Bjorner 06a8987314 fix #6748
destructive equality resolution uses an occurs check function that is only safe for quantifier-free formulas. In the special case where a bound variable is Boolean and occurs on a side of an equality the other side cannot have a quantifier.
2023-06-07 15:59:39 -07:00
Jakob Rath 57e92b2a59
Fix bvnego (#6750) 2023-06-07 11:24:40 -07:00
Nikolaj Bjorner 73c3f34d66 remove debug output
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-06-06 16:37:24 -07:00
Nikolaj Bjorner 68f43ac7a4 make der selective to configuration. For F*, quantifiers are hand or machine generated in specific formats and the tool depends on e-matching to use precisely the format of the quantifiers that have been entered. For other cases of quantifiers, destructive equality resolution (der) can be expected to offer simplifications
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-06-06 16:15:04 -07:00
Nikolaj Bjorner a68f91f0a6 fix #6729
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-05-22 14:07:12 +01:00