3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-18 06:39:02 +00:00
Commit graph

14609 commits

Author SHA1 Message Date
Nikolaj Bjorner 95e07ffe8e disable unsound context equality solving
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-11-14 19:14:51 -08:00
Nikolaj Bjorner 6297c001ee remove legacy solve_eqs_tactic entirely
also, bug fixes to elim_unconstrained (elim_uncnstr2) which is to replace legacy tactic for eliminating unconstrained constants.
2022-11-14 18:57:16 -08:00
Nikolaj Bjorner 3f2bbe5589 harness del_object #6452
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-11-14 08:54:08 -08:00
Nikolaj Bjorner 3d2bf13577 streamline statistics, fix bug in updating goals 2022-11-13 20:30:00 -08:00
Nikolaj Bjorner ce6cfeaa68 fix bug in euf-completion relating to missed normalization 2022-11-13 18:01:17 -08:00
Nikolaj Bjorner 3fa81d6527 bug fixes to elim-uncnstr2 tactic
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-11-13 13:25:19 -08:00
Nikolaj Bjorner 38cde14e08 wip missing updates 2022-11-13 12:10:43 -08:00
Nikolaj Bjorner 196788a091 bug fix for equality solving 2022-11-13 12:09:56 -08:00
Nikolaj Bjorner ce76e3138d streamlining expr-inverter code 2022-11-13 11:48:32 -08:00
Nikolaj Bjorner 3d570aaa0a add missing process_eq
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-11-12 18:43:57 -08:00
Nikolaj Bjorner 0b83732b82 missing override specifier 2022-11-12 18:35:41 -08:00
Nikolaj Bjorner 343603f643 fix build
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-11-12 18:34:04 -08:00
Nikolaj Bjorner e33e66212c propagate values should not flatten and/or
also, elim_uncstr should only be disabled on recursive functions
2022-11-12 18:03:47 -08:00
Nikolaj Bjorner f4e17ecc65 add logging and diagnostics 2022-11-12 18:03:47 -08:00
Nikolaj Bjorner 9d09064ad0 add comments to elim_unconstrained and remove unused function 2022-11-12 18:01:38 -08:00
Nikolaj Bjorner efbe0a6554 wip - updated version of elim_uncstr_tactic
- remove reduce_invertible. It is subsumed by reduce_uncstr(2)
- introduce a simplifier for reduce_unconstrained. It uses reference counting to deal with inefficiency bug of legacy reduce_uncstr. It decomposes theory plugins into expr_inverter.

reduce_invertible is a tactic used in most built-in scenarios. It is useful for removing subterms that can be eliminated using "cheap" quantifier elimination. Specifically variables that occur only once can be removed in many cases by computing an expression that represents the effect computing a value for the eliminated occurrence.

The theory plugins for variable elimination are very partial and should be augmented by extensions, esp. for the case of bit-vectors where the invertibility conditions are thoroughly documented by Niemetz and Preiner.
2022-11-12 17:56:45 -08:00
Nikolaj Bjorner 689af3b4df add comments to elim_unconstr_tactic
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-11-10 16:42:09 -08:00
Nikolaj Bjorner 15be80c954 remove dependency on hash_compare 2022-11-09 09:06:34 -08:00
Nikolaj Bjorner 8da13ae24a add statistics to verbose output of asserted formulas 2022-11-08 18:37:30 -08:00
Nikolaj Bjorner 9a656772b4 fix #6446 2022-11-08 18:37:16 -08:00
Nikolaj Bjorner ff68df3451 update output of z3 doc 2022-11-08 16:10:50 -08:00
Nikolaj Bjorner 254f7b97ef cleanup state to clear model trail during calls. 2022-11-08 15:56:10 -08:00
Nikolaj Bjorner 3faca52c40 re-enable new solve_eqs with bug fixes 2022-11-08 14:17:17 -08:00
Nikolaj Bjorner 9ef78fcfa7 revert new solve-eqs
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-11-08 13:57:58 -08:00
Nikolaj Bjorner 3a37cfca30 switch to solve_eqs2 tactic 2022-11-08 12:23:36 -08:00
Nikolaj Bjorner f769e2f1f6 have bool rewriter use flat_and_or, and integrate hoist rewriter 2022-11-08 12:21:50 -08:00
Nikolaj Bjorner 238ea0a264 add shorthands for concatentation 2022-11-08 12:21:25 -08:00
Nikolaj Bjorner 3a4b8e2334 add rewrite rules to bv-rewriter 2022-11-08 12:20:51 -08:00
Nikolaj Bjorner a34701471f clean up hoist rewriter 2022-11-08 12:20:25 -08:00
Nikolaj Bjorner ab36f86843 add handler for reporting statistics 2022-11-08 12:19:48 -08:00
Nikolaj Bjorner 8afec86fe8 add option for flat_and_or 2022-11-08 12:19:27 -08:00
Nikolaj Bjorner 10fb71cf93 better error description for configuring restart 2022-11-08 12:18:45 -08:00
Nikolaj Bjorner cbc5b1f4f6 have theory_recfun use recursive function discriminator to control when it is enabled 2022-11-06 12:09:45 -08:00
Nikolaj Bjorner f004478565 produce tseitin justification for clause proofs when a clause is a "gate". 2022-11-06 12:00:25 -08:00
Nikolaj Bjorner 53b6059276 bypass built-in proof objects for clause trail
the build-in proof constructors are not flexible when it comes to allowing alternation of justified lemmas and lemmas without justifications.
2022-11-06 11:59:56 -08:00
Nikolaj Bjorner 8ff1e44a95 add discriminator to whether context contains recursive functions to avoid enabling recursive function solver when there are just macros 2022-11-06 11:58:21 -08:00
Nikolaj Bjorner a4c2a2b22c use ast_util::mk_not to avoid redundant double negations during nff 2022-11-06 11:57:46 -08:00
Nikolaj Bjorner 78f9e6b31a extend error type message with more information - display the arguments that are passed 2022-11-06 11:57:21 -08:00
Nikolaj Bjorner 4c1a3fab64 fix #6442 2022-11-05 23:15:03 -07:00
Nikolaj Bjorner d8133a47c2 Update solve_eqs.cpp 2022-11-05 22:47:46 -07:00
Nikolaj Bjorner 6c12aaad74 wip - testing solve-eqs2, added as tactic 2022-11-05 22:42:59 -07:00
Nikolaj Bjorner 4d8860c0bc wip - adding context equation solver
the solve_eqs_tactic is to be replaced by a re-implementation that uses solve_eqs in the simplifiers directory.
The re-implementation should address efficiency issues with the previous code.
At this point it punts on low level proofs. The plan is to use coarser
dependency tracking instead of low level proofs for pre-processing. Dependencies can be converted into a proof hint representation that can be checked using a stronger checker.
2022-11-05 10:34:57 -07:00
Nikolaj Bjorner ae2672f132 fix build
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-11-04 14:11:24 -07:00
Nikolaj Bjorner 154b09309b fixing build, wip on model reconstruction integration into dependent-expr-state 2022-11-04 14:04:44 -07:00
Nikolaj Bjorner 7bb962d934 add ad-hoc any-of for cross compatibility and simplifying interface
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-11-04 12:49:55 -07:00
Nikolaj Bjorner 49d1490454 add ad-hoc any-of for cross compatibility and simplifying interface
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-11-04 12:48:30 -07:00
Nikolaj Bjorner de9368bab0 Update expr_replacer.h 2022-11-04 11:25:39 -07: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
Nikolaj Bjorner 626380b3c7 fixing build
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-11-03 22:08:21 -07:00
Nikolaj Bjorner e8112a6564 add initial stubs for model reconstruction trail 2022-11-03 21:35:07 -07:00
Nikolaj Bjorner 9007bdf780 move horn_subsume_model_converter to ast/converters 2022-11-03 20:26:02 -07:00
Nikolaj Bjorner 25bb935793 move more converters 2022-11-03 20:18:21 -07:00
Nikolaj Bjorner 06eb460c75 move tactic_params to params 2022-11-03 05:50:46 -07:00
Nikolaj Bjorner ba6b21d7d4 Create solve_eqs2_tactic.h 2022-11-03 05:23:38 -07:00
Nikolaj Bjorner 1dca6402fb move model and proof converters to self-contained module 2022-11-03 05:23:01 -07:00
Nikolaj Bjorner 7b12a5c5a8 build fix 2022-11-03 04:49:20 -07:00
Nikolaj Bjorner 90490cb22f make visited_helper independent of literals
re-introduce shorthands in sat::solver for visited and have them convert literals to unsigned.
2022-11-03 03:54:39 -07:00
Nikolaj Bjorner 070c5c624a wip - converting the equation solver as a simplifier 2022-11-03 03:35:30 -07:00
Nikolaj Bjorner c0f483528d working on solve_eqs 2022-11-03 03:35:29 -07:00
Nikolaj Bjorner e141759768 init solve_eqs 2022-11-03 03:35:29 -07:00
Clemens Eisenhofer 6790f18132
Added limit to "visit" to allow detecting multiple visits (#6435)
* Memory leak in .NET user-propagator
The user-propagator object has to be manually disposed (IDisposable), otherwise it stays in memory forever, as it cannot be garbage collected automatically

* Throw an exception if variable passed to decide is already assigned instead of running in an assertion violation

* Added limit to "visit" to allow detecting multiple visits

* Putting visit in a separate class
(Reason: We will probably need two of them in the sat::solver)

* Bugfix
2022-11-03 03:34:52 -07:00
Nikolaj Bjorner e0bbe8dfc0 Merge branch 'master' of https://github.com/z3prover/z3 2022-11-02 17:32:32 -07:00
Nikolaj Bjorner df71e83428 remove incorrect assertion
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-11-02 17:32:09 -07:00
Clemens Eisenhofer ae707ffff7
Added 64-bit "1" counting (#6434)
* Memory leak in .NET user-propagator
The user-propagator object has to be manually disposed (IDisposable), otherwise it stays in memory forever, as it cannot be garbage collected automatically

* Throw an exception if variable passed to decide is already assigned instead of running in an assertion violation

* Added 64-bit "1" counting
2022-11-02 10:02:29 -07:00
Nikolaj Bjorner 0d97d2214c adding virtual destructor
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-11-02 09:37:55 -07:00
Nikolaj Bjorner 41b87b4c42 Create bv_slice_tactic.cpp
missing file
2022-11-02 08:51:43 -07:00
Nikolaj Bjorner e57674490f adding simplifiers layer
simplifiers layer is a common substrate for global non-incremental and incremental processing.
The first two layers are new, but others are to be ported form tactics.

- bv::slice - rewrites equations to cut-dice-slice bit-vector extractions until they align. It creates opportunities for rewriting portions of bit-vectors to common sub-expressions, including values.
- euf::completion - generalizes the KB simplifcation from asserted formulas to use the E-graph to establish a global and order-independent canonization.

The interface dependent_expr_simplifier is amenable to forming tactics. Plugins for asserted-formulas is also possible but not yet realized.
2022-11-02 08:51:30 -07:00
Nikolaj Bjorner 1646a41b2f minor fixes
- ensure mk_extract performs simplification to distribute over extract and removing extract if the range is the entire bit-vector
- ensure bool_rewriter simplifeis disjunctions when applicable.
2022-11-02 08:44:55 -07:00
Nikolaj Bjorner 9fc4015c46 remove ternary clause optimization
Removing ternary clause optimization from sat_solver simplifies special case handling of ternary clauses throughout the sat solver and dependent solvers (pb_solver). Benchmarking on QF_BV suggests the ternary clause optimization does not have any effect. While removing ternary clause optimization two bugs in unit propagation were also uncovered: it missed propagations when the only a single undef literal remained in the non-watched literals and it did not update blocked literals in cases where it could in the watch list. These performance bugs were for general clauses, ternary clause propagation did not miss propagations (and don't use blocked literals), but fixing these issues for general clauses appear to have made ternary clause optimization irrelevant based on what was measured.
2022-10-30 03:57:39 -07:00
Nikolaj Bjorner 0da0fa2b27 #6429 2022-10-29 13:43:07 -07:00
Nikolaj Bjorner 0e651eee04 #6421 2022-10-28 14:12:28 -07:00
Facundo Domínguez 91cdc082c4
Optimize calls to Z3_eval_smtlib2_string (#6422)
* Allow reseting the stream of smt2::scanner

* Put the parser of parse_smt2_commands in the cmd_context

* Move parser streams to cmd_context

* Move parser fields from cmd_context to api::context

* Move forward declarations from cmd_context.h to api_context.h

* Change parse_smt2_commands_with_parser to use *& instead of **

* Add tests for Z3_eval_smtlib2_string

* Don't reuse the streams in Z3_eval_smtlib2_string

* Fix indentation

* Add back unnecessary deleted line

Co-authored-by: Nuno Lopes <nuno.lopes@tecnico.ulisboa.pt>
2022-10-28 13:57:22 -07:00
Nikolaj Bjorner a409a4a677 enforce flat within QF_BV tactic, cap in-processing var-elim loops 2022-10-27 20:10:55 -07:00
Nikolaj Bjorner 1fae3aa152 rename set-flat to set-flat-and-or to allow to differentiate parameters 2022-10-27 11:22:57 -07:00
Nikolaj Bjorner fe1b4bf5ce disable ternary, fixes to propagation, make bv_rewrites for multiplier n-ary 2022-10-26 23:44:38 -07:00
Nikolaj Bjorner 5352a0106d fix #6426 2022-10-26 12:20:55 -07:00
Nikolaj Bjorner 2258b9b9b6 #6423 2022-10-26 12:06:11 -07:00
Nuno Lopes 1720addc4e remove a bunch of string copies in the API
thanks to C++20
2022-10-26 18:22:55 +01:00
Nikolaj Bjorner a4ece21461 toggle enable-ternary to true 2022-10-25 10:44:23 -07:00
Nikolaj Bjorner 154fed7783 introduce globally visible macro for controlling use of ternary, turn them off 2022-10-25 10:30:18 -07:00
Nikolaj Bjorner c62c5e9d23 add opportunistic, missing, bv rewrites
- x >> x logical = 0
- ~x = -1 -x
- x * (y << z) = (x * y) << z
2022-10-25 10:29:48 -07:00
Nikolaj Bjorner 09a2ba4931 remove artificial usage of function, it causes another compiler warning to refer to a function without arguments. 2022-10-25 10:28:25 -07:00
Nikolaj Bjorner c672c3a250 fix regression introduced in #6143 2022-10-25 09:39:11 -07:00
Nikolaj Bjorner e1a00f4917 remove unused experimental feature - diff 2022-10-24 16:13:24 -07:00
Nikolaj Bjorner 280887cc5a remove deprecated theory aware drat functionality
it is handled by the on-clause callback that is owned by the smt solver.
2022-10-24 08:32:10 -07:00
Nuno Lopes cb3c86736c fix build 2022-10-24 10:23:50 +01:00
Nuno Lopes 4431fd17ce memory_manager: add support for MacOS & Windows to the new size tracking system 2022-10-24 10:09:56 +01:00
Nikolaj Bjorner a24b5a64e1 #6364 proviso for ignore int 2022-10-24 00:48:57 -07:00
Nikolaj Bjorner 5c7eaec566 #6364 - remove option of redundant clauses from internalization
gc-ing definitions leads to unsoundness when they are not replayed.
Instead of attempting to replay definitions theory internalization is irredundant by default.
This is also the old solver behavior where TH_LEMMA is essentially never used, but is valid for top-level theory lemmas.
2022-10-24 00:38:31 -07:00
Nikolaj Bjorner c8e1e180ea prefix Boolean variables in log with b 2022-10-23 11:05:50 -07:00
Nikolaj Bjorner 6393ed78d7 remove useless log 2022-10-23 11:05:33 -07:00
Nikolaj Bjorner ddbca68270 minor formatting update 2022-10-23 11:05:09 -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 071a1447e3 fix #6418 2022-10-23 11:03:00 -07:00
Nikolaj Bjorner e3a44254c9 fix #6415 2022-10-22 11:18:16 -07:00
Nikolaj Bjorner 7eee7914bd align format of quantifier instantiation with new core
So far the format is

(forall ((x Int)) body) (not (body[t/x]))

The alternative could be the clause

(not (forall ((x Int)) body)) body[t/x]

they just better be consistent between engines
2022-10-21 15:26:00 -07:00
Nikolaj Bjorner 53adc2afee update debugging information for new core 2022-10-21 15:24:44 -07:00
Nikolaj Bjorner ad5fa9433f add experiment with quot-rem encoding
experiment seeks to determine whether quot-rem encoding can substitute the division circuit encoding.
A first test suggests it makes no difference.
2022-10-21 09:25:45 -07:00
Nikolaj Bjorner 31914d8ecf simplify purified expressions 2022-10-21 03:47:57 -07:00