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

4345 commits

Author SHA1 Message Date
Lev Nachmanson f423642e9b try the lemma scheme 2023-09-21 12:18:21 -07:00
Lev Nachmanson e31cecf5db transfer propagate monomial bounds to nla_solver 2023-09-21 11:27:53 -07:00
Lev Nachmanson 536930b4a1 make m_ibounds inside of lp_bound_propagator
a reference
2023-09-20 17:13:25 -07:00
Nikolaj Bjorner 7a74b099ba remove experimental code
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-09-20 15:04:24 -07:00
Nikolaj Bjorner 4d742001ab formatting of else
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-09-19 14:36:21 -07:00
Lev Nachmanson c5cfd62e0a remove dead code related to nla unit propagation
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2023-09-19 10:56:09 -07:00
Lev Nachmanson b621c9fa1c remove an extrac check in bound_is_interesting 2023-09-15 17:42:18 -07:00
Lev Nachmanson 762ade2a79 check m_unassigned_bounds in bound_is_interesting 2023-09-15 06:15:22 -07:00
Lev Nachmanson c309d52283 runs a simple test 2023-09-13 08:12:00 -07:00
Lev Nachmanson c050af922f fixing the bugs 2023-09-07 15:59:20 -07:00
Lev Nachmanson 41f59cb1ed propagate monomial is nla 2023-09-05 18:49:59 -07:00
Lev Nachmanson 5509b468e9 handle monomial_bounds::unit_propagate() 2023-08-31 17:35:41 -07:00
Nikolaj Bjorner 38b131386d add stubs for monomial unit propagation 2023-08-30 17:21:48 -07:00
Lev Nachmanson 9aeaed8f53
Merge branch 'master' into nl_branches 2023-08-21 16:15:20 -07:00
Nikolaj Bjorner 37ddaaef69 make destructors virtual
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-08-20 15:30:57 -07:00
Nuno Lopes dda0c8ff42 array theory: use expr_ref for mk_default() so it doesnt leak if internalize throws
like on timeout/memout
2023-08-20 22:28:57 +01:00
Nuno Lopes a694d27557 revert removal of virtual destructor of relevancy_eh since clang doesnt play along 2023-08-20 14:20:20 +01:00
Nuno Lopes c469c6e1d5 attempt to fix clang buildbots 2023-08-20 13:39:15 +01:00
Nuno Lopes 28884b398c remove unneeded virtual destructor (optimization) 2023-08-20 12:57:47 +01:00
Nuno Lopes 3b546b2348 smt_context: we can't assert that the resource limits were exceeded on cancel_exception
It happens sometimes that e.g. the internalizer goes above the soft memory limit
But since it's only by a small amount, when the exception propagates back to the context, some stuff
has been freed already and we are not longer above the memory threshold
Just delete these asserts
2023-08-20 10:34:28 +01:00
Nuno Lopes 5d33805c8b optimize ~relevancy_propagator_imp() so it just dec refs the exprs in the trail
It avoid doing all the funky watch stuff
One extreme Alive2 test case goes from 40s to 28s :)
2023-08-20 10:07:56 +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
Lev Nachmanson 610313946d split free vars in nla 2023-08-18 12:36:14 -07:00
Nikolaj Bjorner 73724f9cab lines that go away
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-08-17 18:45:49 -07:00
Lev Nachmanson 252a30e727
use param_ref in nla_solver (#6862)
* use param_ref in nla_solver

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>

* add parameters

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

* add parameters

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

* replace nla_setting by command line parameters

* delete nla_setting.h

---------

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
Co-authored-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-08-17 18:44:27 -07:00
Nikolaj Bjorner 125787c458 remove dead code 2023-08-07 11:22:34 -07:00
Nikolaj Bjorner 84520d53ea remove out
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-08-04 11:33:39 -07:00
Nikolaj Bjorner b0055df4ab revert arithmetic final check to original order
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-08-04 10:48:44 -07:00
Lev Nachmanson f58b703ac5
u_set replaced by indexed_uint_set (#6841)
* replace u_set by indexed_uint_set

* replace u_set by indexed_uint_set

* create insert-fresh and insert for indexed_uint_set to make use cases with non-fresh inserts easier

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

* update nightly to pull arm

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

* update nightly to pull arm

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

* fixing the build of lp_tst

* update nightly to pull arm

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

* replace u_set by indexed_uint_set

* replace u_set by indexed_uint_set

* fixing the build of lp_tst

* remove unnecessery call to contains() before
insert to indexed_uint_set

* formatting, no check for contains()
 in indexed_uint_set, always init m_touched_rows to nullptr

---------

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
Co-authored-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-08-03 16:01:27 -07:00
Nikolaj Bjorner 4637339091 update model validate to include arithmetic
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-08-03 15:51:29 -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 adad468cd7 allow copy within a user scope #6827
this will allow copying the solver state within a scope.
The new solver state has its state at level 0. It is not possible to pop scopes from the new solver (you can still pop scopes from the original solver). The reason for this semantics is the relative difficulty of implementing (getting it right) of a state copy that preserves scopes.
2023-07-31 19:46:08 -07:00
Nikolaj Bjorner 3d8f75b3d8 enable on-clause with dependencies
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-07-18 16:59:02 -07:00
Lev Nachmanson 401ec04ec3
code cleaning around m_touched_rows of lar_solver (#6814) 2023-07-14 20:19:13 -07:00
Nikolaj Bjorner 4a9c4ca2ce initialize poly solver in incremental mode
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-07-13 14:12:29 -07:00
Nikolaj Bjorner 08599177d0 fix #6808
remove bv_eq_axioms as an external option to toggle.
Diseqalities have to be enforced for extensionality.
There are no internal code paths where the option is set to false.
2023-07-13 10:47:55 -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
Lev Nachmanson e091a2e775 remove the line with clang-format off 2023-07-10 12:05:59 -07:00
Clemens Eisenhofer 4cb158a79b
User Propagator: Return if propagated lemma is redundant (#6791)
* Give users ability to see if propagation failed

* Skip propagations in the new core if they are already satisfied
2023-07-07 09:58:41 -07:00
Nikolaj Bjorner f450bc4ae0 Merge branch 'master' of https://github.com/z3prover/z3 2023-07-07 09:29:49 -07:00
Nikolaj Bjorner 8c7525c97f revert log addition
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-07-07 09:29:38 -07:00
Nikolaj Bjorner 0ab102cbec fix coefficient extraction and passing in Farkas lemmas, thanks to H. F. Bryant
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-07-07 09:28:47 -07:00
Lev Nachmanson 4e327babda remove dead code 2023-07-06 15:07:26 -07:00
Lev Nachmanson 5ed2a82893
set clang format off for lp files (#6795)
* adding // clang-format off

* set clang-format off at the beginning of  lp files

* set clang-format off

* remove dead code
2023-07-03 17:35:16 -07:00
Lev Nachmanson f5d9ffaca1 clean up and add clang-format off
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2023-06-30 11:57:42 -07:00
Nikolaj Bjorner b451735aa0 fix #6778
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-06-25 21:08:13 -07:00
Nikolaj Bjorner eb1caee18a compile constants into different variables instead of reusing a single variable 1 and coefficients. It delays introducing large coefficients and allows more efficient bounds propagation
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-06-20 16:09:34 -07:00
Nikolaj Bjorner df77541aae #6758
check-assumptions with compound formulas create fresh proxy variables both during compilation to internal format and for the assumptions. These fresh variables may occur in lemmas that are created during search. The lemmas are garbage for future check-sats, but the solver needs to be allowed to invoke GC. Adding a GC call before a check-sat with assumptions allows removing some lemmas every time a new assumptions are used. Eager GC when using assumptions is used elsewhere, for example in cube&conquer scenarios where lemmas learned from one set of assumptions are less likely to be useful for other assumptions.

With the GC invocation memory grows at a lesser pace. However, it is not entirely free of memory increases. To avoid memory bloat, have the solver pre-compile the assumptions by defining them as propositional variables, add assertions that the propositional variables are equivalent to the compound formulas and use the propositional variables as assumptions. The same propositional variables come with no extra overhead when invoking check-assumptions. The lemmas are then over the same fixed vocabulary. It is generally a good idea to recycle useful lemmas during the enumeration pass.
2023-06-18 16:21:41 -07:00
Nikolaj Bjorner cc4ac0e65a add guard for eq adapter 2023-06-13 16:39:53 -07:00
Nikolaj Bjorner 1d62964c58 avoid name clash for multiple special relations #6743 2023-06-07 17:55:11 -07:00
Nikolaj Bjorner ab4b7c50ed fix #6749 2023-06-07 16:09:50 -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
Nikolaj Bjorner 2bff0a6b8a regression on quantifier weight computation when weights are 0 vs non-0. It modifies a change made for the fix of #2667. That fix caused a regression in F*. Reported @mtzguido
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-06-06 16:35:37 -07:00
Clemens Eisenhofer 82667bd86b
Fix UP's decide callback (#6707)
* Query Boolean Assignment in the UP

* UP's decide ref arguments => next_split

* Fixed wrapper

* More fixes
2023-06-02 09:52:54 +02:00
Nikolaj Bjorner 5e1869d8eb fix #6734
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-05-26 09:48:58 +01:00
Nikolaj Bjorner 046b80f6a4 remove output
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-05-11 12:31:05 -07:00
Nikolaj Bjorner f6ab5a61ac reformat code to remove brackets 2023-05-11 12:31:05 -07:00
Nikolaj Bjorner 2e441e38c9 fix #6713 fix #6714
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-05-08 12:24:20 -07:00
Nikolaj Bjorner d5231f8b33 fix regressions #6703
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-04-27 08:43:59 -07:00
Nikolaj Bjorner c48dc69050 adding stubs to find fixed variables
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-04-26 19:39:42 -07:00
Nikolaj Bjorner ef943347ee ensure assume-eqs is invoked after check-lia statically
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-04-26 11:16:15 -07:00
Nikolaj Bjorner d2e3e4895e add instrumentation to theory_lra for shuffling final check 2023-04-26 10:05:00 -07:00
Nikolaj Bjorner 3029fb24a1 remove references to validating 2023-04-26 10:05:00 -07:00
Nikolaj Bjorner 50c855e2eb count gcd conflicts, log row id in rows 2023-04-26 10:05:00 -07:00
Nikolaj Bjorner 59bc070268 count gcd conflicts 2023-04-26 10:05:00 -07:00
Nikolaj Bjorner ace6e8eea1 add gcd-conflicts stats, formatting updates 2023-04-26 10:04:59 -07:00
Nikolaj Bjorner ec1480b12a fix #6693 2023-04-18 08:40:29 -07:00
Nikolaj Bjorner b75d81f3c2 fix #6690 2023-04-14 16:38:33 -07:00
Nikolaj Bjorner 0b5c38dea5 fix #6676 get rid of rem0 declare it to be mod0 semantics to simplify code paths 2023-04-11 16:46:43 -07:00
Nikolaj Bjorner 368d60f553 add branch / cut selection heuristic from solver=2
disabled for testing.
2023-04-10 22:14:16 -07:00
Clemens Eisenhofer 98d3fabc24
Bugfix relevancy propagation + UP (old core) (#6678)
* Some UP bugfixes in the new core

* Bugfix relevancy propagation + UP (old core)

* Revert smt_context.cpp
2023-04-10 12:57:59 -07:00
Nikolaj Bjorner e6ea81546e fix #6662 2023-04-08 17:14:39 -07:00
Nikolaj Bjorner af9c760a68 fix #6670 2023-04-08 16:55:23 -07:00
Nikolaj Bjorner ccb250c32b fix #6671 2023-04-08 16:39:40 -07:00
Nikolaj Bjorner f8242c58dd fix regression from Grobner port
- scan_for_linear returns true if it finds a new linear equation. It then should break GB.
- if scan_for_linear returns false, it should still allow try_modify_eqs.
This behavior was masked by requiring scan_for_linear to always be true before
allowing try_to_modify_eqs.

based on repro from Guido Martinez @mtzguido
2023-04-04 22:29:22 -07:00
Nikolaj Bjorner 5b385bd2fe fix #6665
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-04-02 10:58:21 -07:00
Nikolaj Bjorner e0a066efa3 #6654
fix reflexivity for tree-order
2023-03-31 15:38:29 -07:00
Nikolaj Bjorner a62e4b2893 extract multi-patterns when pattern can be decomposed
deals with fluke regression for F* reported by Guido Martinez

Background:
The automatic pattern inference facility looks for terms that contains all bound variables of a quantifier. It may end up with a term that contains all bound variables but the extracted term can be simplified.

Example. The pattern

(ApplyTT (ApplyTT @x3!1 (ApplyTT @x4!0 (:var 1))) (ApplyTT @x4!0 (:var 0)))
can be decomposed into a multi-pattern
(ApplyTT @x4!0 (:var 1))) (ApplyTT @x4!0 (:var 0))
The multi-pattern may enable a quantifier instantiation while the original pattern does not. The multi-pattern should be preferred.

The regression showed up based on a change that should not be considered harmful but turned out to be noticeable.
The change was a simplification of and-or expressions based on sorting. This played with the case split queue used by F* (smt.case_split = 3) that uses a top-level case split of clauses to avoid redundant branches. The net effect was that without sorting, the benchmarks would always choose the opportune branch that enabled matching against the larger term. With sorting it would mostly choose inopportune branches.
2023-03-31 12:45:51 -07:00
Nikolaj Bjorner ce501e0b6e #6646
- always enable special-relations theory to deal with default setting and push
- fix bugs related to equality and transitivity.
2023-03-25 17:37:59 -07:00
Nikolaj Bjorner 50bd6efea4 fix #6624 2023-03-22 14:00:09 +01:00
Nikolaj Bjorner 03a44803b6 fix #6635 2023-03-22 13:38:02 +01:00
Nikolaj Bjorner c6e3fb446a print lemmas2console faster
- add option pp.no_lets (default = false) to print formulas without let (used by the low-level SMT2 printer).
- print lemmas2console faster by using the low level printer
2023-03-20 17:07:04 +01:00
Nikolaj Bjorner a9e6e567b0 make generation of "some" Boolean value fair 2023-03-20 17:07:04 +01:00
Nuno Lopes a0f3727e90 BV: add missing neg internalizer
usually bvneg is eliminated during rewriting, but it can be left behind during e.g. a badly-timed timeout
2023-03-12 19:26:47 +00:00
Lev Nachmanson 377ceba6d5 rm lu 2023-03-08 10:27:05 -08:00
Lev Nachmanson ea16f6608c before rm lu
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2023-03-08 10:27:05 -08:00
Lev Nachmanson 92fe8c5968 restore the previous state
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2023-03-03 18:30:17 -08:00
Lev Nachmanson ff1dc0424c rm lp_solver 2023-03-03 16:32:49 -08:00
Lev Nachmanson 2dd30fa350 rm lp_primal_simplex 2023-03-03 15:44:50 -08:00
Lev Nachmanson d2e8297d41 remove includes of lp_dual_simplex 2023-03-03 15:38:47 -08:00
Nikolaj Bjorner 79d47eb302 add preprocessor parameter whether to use bound simplifier 2023-02-28 17:40:08 -08:00
Nikolaj Bjorner 76aad689c6 Update smt_context_pp.cpp
print units in statistics
2023-02-28 17:40:08 -08:00
Nikolaj Bjorner 0758c93086 fix #6591
- add check for lambdas similar to as-array in context of quantifiers. MBQI is not a decision procedure for this combination and can then incorrectly conclude satisfiabiltiy.

Scenario

The formula contains assertions
 - bv = (map or (lambda ..) t)
 - forall y (not (select bv (pair s y)))

Since bv is extensionally equal to a term that depends on a lambda, MBQI cannot just take the current finite approximation of bv when checking the quantifier for satisfiability.
2023-02-19 11:09:52 -08:00
Nikolaj Bjorner 6352340478 update do logging 2023-02-19 09:59:33 -08:00
Nikolaj Bjorner c0f80f92ba deal with compiler warnings (unused variables etc) 2023-02-18 17:53:37 -08:00
Nikolaj Bjorner 7c08e53e94 fixes for #6590 2023-02-15 15:11:44 -08:00
Nikolaj Bjorner bb81bc5452 fix #6580
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-02-12 20:21:53 -08:00
Nikolaj Bjorner 1b0c76e3f0 fixes to mbqi in the new core based on #6575 2023-02-10 16:56:06 -08:00
Nikolaj Bjorner efbecb19b1 compiler warning
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-02-02 19:23:30 -08:00
Nikolaj Bjorner 304b316314 move bounded division lemmas to nla solver/ nla_divisions. 2023-01-30 11:11:04 -08:00
Nikolaj Bjorner 2c4a9c2f5c fix division filter
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-30 08:20:26 -08:00
Nikolaj Bjorner 8e37e2f913 handle non-linear division axioms, consolidate backtracking state in nla_core
this update enables new incremental linear axioms based on division terms.
It also consolidates some of the backtracking state in nla_core / emons to use stack traces instead of custom backtracking state.
2023-01-29 17:22:57 -08:00
Nikolaj Bjorner 8ea49eed8e convert reduce-args to a simplifier
- convert reduce-args to a simplifier. Currently exposed as reduce-args2 tactic until the old tactic code gets removed.
- bug fixes in model_reconstruction trail
  - allow multiple defs to be added with same pool of removed formulas
  - fix tracking of function symbols instead of expressions to filter replay
- add nla_divisions to track (cheap) divisibility lemmas.
-
2023-01-28 20:12:14 -08:00
Nikolaj Bjorner ae24b73b19 bugfixes to incremental linearization for expanding power
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-26 21:19:45 -08:00
Nikolaj Bjorner eac7d7576f force to_fp to disambiguate +zero and -zero, #6548, filter unsupported on relevancy
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-24 12:29:42 -08:00
Nikolaj Bjorner 4601d1d664 fix #6550
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-24 03:37:09 -08:00
Nikolaj Bjorner 2ae476416c initial outline of exponentiation
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-23 17:38:34 -08:00
Nikolaj Bjorner 83662701b6
Update theory_lra.cpp
remove spurious output
2023-01-22 16:27:48 -08:00
Nikolaj Bjorner 806a4772bc revert effect of filtering unsupported
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-20 17:28:24 -08:00
Nikolaj Bjorner 4e6d498a60 adding placeholder for refining power of 2 2023-01-20 14:37:05 -08:00
Nikolaj Bjorner 0f4f32c5d0 apply relevancy filtering on unsupported ops, fix term construction bug in bv2fpa_converter fix #6548 2023-01-20 13:05:01 -08:00
Nikolaj Bjorner f3d6856736 remove msf example, add option to make model converter not reduce models
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-19 20:24:31 -08:00
Nikolaj Bjorner 7368f9f7d3 increase build version, better propagation in euf-egraph, handle assumptions in sat.smt
- increase build version to 4.12.1. This prepares updated release for MacOs-11 build on x86
- move literal propagation mode in euf-egraph to a callback and traversal of equivalence class. Track antecedent by newest equality instead of root. This makes equality propagation to literals have similar behavior as in legacy solver and appears to result in a speedup (10% fewer conflicts on QF_UF/QG-classification/qg5/iso_icl478.smt2 in preliminary testing)
- fix interaction of pre-processing and assumptions. Pre-processing has to freeze assumption literals so they don't get eliminated. This is similar to dependencies that are already frozen.
2023-01-17 14:07:07 -08:00
Nikolaj Bjorner dde5218b29 fix mbqi value caching issue raised by Clemens and Martin 2023-01-15 22:47:34 -05:00
Nikolaj Bjorner 4f7f4376b8 fix bug in new core not detecting conflict, fix #6525, add tactic doc
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-14 17:20:43 -05:00
Nikolaj Bjorner 8970a54eaa expose parameters to control behavior for #5660 2023-01-10 22:06:19 -08:00
Nikolaj Bjorner d415f07386 memory leak on proof justifications
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-10 18:58:25 -08:00
Nikolaj Bjorner c3e31149a5 fix #6530
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-10 13:43:17 -08:00
Nikolaj Bjorner 1ddef117a2 several fixes to proof logging in legacy solver
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2023-01-08 16:11:31 -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
Nuno Lopes d30cb55bae don't flush stream when printing param vals 2023-01-03 09:35:17 +00: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 c0f1f33898 dampen second setup of theory_bv 2022-12-30 18:47:32 -08:00
Nuno Lopes 47324af210 be nicer when memout is reached in SMT internalize: return undef rather than crashing 2022-12-29 11:08:57 +00:00
Nikolaj Bjorner fe8034731d fix #6501 2022-12-19 21:02:55 -08:00
Nuno Lopes d308b8f555 simplify code + remove unused file 2022-12-11 22:11:19 +00:00
Nikolaj Bjorner 847aec1d30 update dependencies 2022-11-30 22:48:10 -08:00
Nikolaj Bjorner 529f116be0 disable new code until pre-condition gets fixed
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-11-30 22:29:59 -08:00
Nikolaj Bjorner 85f9c7eefa replace restore_size_trail by more generic restore_vector
other updates:
- change signature of advance_qhead to simplify call sites
- have model reconstruction replay work on a tail of dependent_expr state, while adding formulas to the tail.
2022-11-28 11:45:56 +07:00
Nikolaj Bjorner 0a671f2f44 fix #6464 2022-11-23 17:21:51 +07:00
Nikolaj Bjorner 0a28bacd0f remove debug out 2022-11-23 16:42:36 +07:00
Nikolaj Bjorner 6188c536ef add logging of propagations to smt core
log theory propagations with annotation "smt".
It allows tracking theory propagations (when used in conflicts) in the clause logs similar to the new core.
2022-11-23 11:37:23 +07:00
Nikolaj Bjorner 5374142e3e continue updates for adding proof-log to smt core 2022-11-23 11:37:23 +07:00
Nikolaj Bjorner bfae8b2162 set flat_and_or to false in bv rewriter 2022-11-15 05:47:28 -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 84af521514 fixes #6439 #6436 2022-11-04 09:36:06 -07:00
Nikolaj Bjorner 1dca6402fb move model and proof converters to self-contained module 2022-11-03 05:23:01 -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 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 842e8057bc log also quantifier generation (besides binding)
We add also logging for quantifier generation.
It is auxiliary information that is of use for diagnostics (axiom profiler).
2022-10-20 17:49:15 -07:00
Nikolaj Bjorner fc30461828 unused variables
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-10-20 09:09:06 -07:00
Nikolaj Bjorner 07dd1065db added API to monitor clause inferences
See RELEASE_NOTES for more information
examples pending.
2022-10-19 08:34:55 -07:00
Nikolaj Bjorner 464d52babe fix #6410
regression after introducing beta-redex optimization
2022-10-18 12:34:45 -07:00
Nikolaj Bjorner 2449ba93c5 add (disabled) experiment to use quot-rem instead of division circuit 2022-10-13 15:20:43 +02:00
Nikolaj Bjorner 93e1db0b0b fix #6398 2022-10-13 11:16:14 +02:00
Nikolaj Bjorner ace727ee0f fix #6391 2022-10-12 09:34:49 +02:00
Nikolaj Bjorner 4623117af8 wip - proof hints 2022-10-08 20:12:57 +02:00
Nikolaj Bjorner 9f78a96c1d wip - trim 2022-10-06 18:19:03 +02:00
Nikolaj Bjorner 107981f099 update proof formats for new core
- update proof format for quantifier instantiation to track original literals
- update proof replay tools with ability to extract proof object

The formats and features are subject to heavy revisions.

Example
```
(set-option :sat.euf true)
(set-option :sat.smt.proof eufproof.smt2)
(declare-fun f (Int) Int)
(declare-const x Int)
(assert (or (= (f (f (f x))) x) (= (f (f x)) x)))
(assert (not (= (f (f (f (f (f (f x)))))) x)))
(check-sat)
```

eufproof.smt2 is:
```
(declare-fun x () Int)
(declare-fun f (Int) Int)
(define-const $24 Int (f x))
(define-const $25 Int (f $24))
(define-const $26 Int (f $25))
(define-const $27 Bool (= $26 x))
(define-const $28 Bool (= $25 x))
(assume $27 $28)
(define-const $30 Int (f $26))
(define-const $31 Int (f $30))
(define-const $32 Int (f $31))
(define-const $33 Bool (= $32 x))
(assume (not $33))
(declare-fun rup () Proof)
(infer (not $33) rup)
(declare-fun euf (Bool Bool Proof Proof Proof Proof) Proof)
(declare-fun cc (Bool) Proof)
(define-const $42 Bool (= $32 $30))
(define-const $43 Proof (cc $42))
(define-const $40 Bool (= $31 $24))
(define-const $41 Proof (cc $40))
(define-const $38 Bool (= $30 $25))
(define-const $39 Proof (cc $38))
(define-const $36 Bool (= $24 $26))
(define-const $37 Proof (cc $36))
(define-const $34 Bool (not $33))
(define-const $44 Proof (euf $34 $28 $37 $39 $41 $43))
(infer (not $28) $33 $44)
(infer (not $28) rup)
(infer $27 rup)
(declare-fun euf (Bool Bool Proof Proof Proof) Proof)
(define-const $49 Bool (= $32 $26))
(define-const $50 Proof (cc $49))
(define-const $47 Bool (= $31 $25))
(define-const $48 Proof (cc $47))
(define-const $45 Bool (= $24 $30))
(define-const $46 Proof (cc $45))
(define-const $51 Proof (euf $34 $27 $46 $48 $50))
(infer $33 $51)
(infer rup)
```

Example of inspecting proof from Python:

```
from z3 import *

def parse(file):
    s = Solver()
    set_option("solver.proof.save", True)
    set_option("solver.proof.check", False)
    s.from_file(file)
    for step in s.proof().children():
        print(step)

parse("../eufproof.smt2")
```

Proof checking (self-validation) is on by default.
Proof saving is off by default.

You can use the proof logs and the proof terms to retrieve quantifier instantiations from the new core.

The self-checker contains a few built-in tuned checkers but falls back to self-checking inferred clauses using SMT.
2022-09-28 10:40:43 -07:00
Clemens Eisenhofer 5ca53f37c0
Throw an exception if the variable in decide-callback is already assigned (#6362)
* 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
2022-09-24 09:54:14 -07:00
Nikolaj Bjorner 088898834c filter length limits to be non-skolems and under concat/""/unit 2022-09-15 07:41:13 -07:00
Nikolaj Bjorner c47ca341b7 fix #6343
The bug was that axiom generation was not enabled on last_index, so no axioms got created to constrain last-index.
With default settings the solver is now very slow on this example. It is related to that the smallest size of a satisfying assignment is above 24. Pending a good heuristic to find initial seeds and increments for iterative deepening, I am adding another parameter smt.seq.min_unfolding that when set to 30 helps for this example.
2022-09-14 10:17:25 -07:00
Nuno Lopes 16ef89905d fix infinite loop in internalize 2022-09-14 11:50:53 +01:00
Nikolaj Bjorner 34969b71ee #6340 again - reduce new assertions in fresh iteration
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-09-13 19:58:32 -07:00
Nikolaj Bjorner fd5448d26b fix #6340 - again
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-09-13 17:01:51 -07:00
Nikolaj Bjorner c30b884247 fix #6340
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-09-12 11:01:24 -07:00
Nikolaj Bjorner 809838fede solve for fold, expand rewrites under fold/map
Occurrences of map and fold are interpreted.
They are defined when the seq argument is expanded into a finite
concatenation. The ensure this expansion takes place, each fold/map term
is registered and defined through rewrites when the seq argument simplifies.
2022-09-11 11:32:18 -07:00
Nikolaj Bjorner 7a55bd5687 beta redex check is used in array theory to filter out safe as-arrays 2022-09-11 05:44:11 -07:00
Nikolaj Bjorner 4a652a4c0c relax giveup condition for as-array when it occurs only in beta redex positions. 2022-09-10 16:02:58 -07:00
Nikolaj Bjorner 660bdc33e3 fix #6330 2022-09-09 08:18:30 -07:00
Nikolaj Bjorner 058ed3de56 fix #6331 2022-09-07 12:37:50 -07:00
Nikolaj Bjorner 55d5af00cc disable bv delay until it is debugged #6324
regression introduced when filter for when to apply delay was fixed, but then it exercises delay tactic that isn't tested.
2022-09-07 00:04:57 -07:00
Nikolaj Bjorner 85c8168af5 use for pattern instead of iterators 2022-09-02 22:45:50 -07:00
JohnLyu2 9dca8d18ed
fix negative contains bug (#6312) 2022-09-02 13:36:11 -07:00
Nikolaj Bjorner 4abff18e8d fill in missing pieces of proof hint checker for Farkas and RUP
The proof validator based on SMT format proof logs uses RUP to check propositional inferences and has plugins for theory axioms/lemmas.
2022-08-31 05:29:15 -07:00
Arie Gurfinkel d2b618df23
Spacer Global Guidance (#6026)
* Make spacer_sem_matcher::reset() public

* Add .clang-format for src/muz/spacer

* Mark substitution::get_bindings() as const

* Fix in spacer_antiunify

* Various helper methods in spacer_util

Minor functions to compute number of free variables, detect presence of certain
sub-expressions, etc.

The diff is ugly because of clang-format

* Add spacer_cluster for clustering lemmas

A cluster of lemmas is a set of lemmas that are all instances of the same
pattern, where a pattern is a qff formula with free variables.

Currently, the instances are required to be explicit, that is, they are all
obtained by substituting concrete values (i.e., numbers) for free variables of
the pattern.

Lemmas are clustered in cluster_db in each predicate transformer.

* Integrate spacer_cluster into spacer_context

* Custom clang-format pragmas for spacer_context

spacer_context.(cpp|h) are large and have inconsistent formatting. Disable
clang-format for them until merge with main z3 branch and re-format.

* Computation of convex closure and matrix kernel

Various LA functions. The implementations are somewhat preliminary.

Convex closure is simplemented via syntactic convex closure procedure.
Kernel computation considers many common cases.

spacer_arith_kernel_sage implements kernel computation by call external
Sage binary. It is used only for debugging and experiments. There is no
link dependence on Sage. If desired, it can be removed.

* Add spacer_concretize

* Utility methods for spacer conjecture rule

* Add spacer_expand_bnd_generalizer

Generalizes arithmetic inequality literals of the form x <= c,
by changing constant c to other constants found in the problem.

* Add spacer_global_generalizer

Global generalizer checks every new lemma against a cluster
of previously learned lemmas, and, if possible, conjectures
a new pob, that, when blocked, generalizes multiple existing
lemmas.

* Remove fp.spacer.print_json option

The option is used to dump state of spacer into json for debugging.

It has been replaced by `fp.spacer.trace_file` that allows dumping an execution
of spacer. The json file can be reconstructed from the trace file elsewhere.

* Workaround for segfault in spacer_proof_utils

Issue #3 in hgvk94/z3

Segfault in some proof reduction. Avoid by bailing out on reduction.

* Revert bug for incomplete models

* Use local fresh variables in spacer_global_generalizer

* Cleanup of spacer_convex_closure

* Allow arbitrary expressions to name cols in convex_closure

* WIP: convex closure

* WIP: convex closure

* Fix bindings order in spacer_global_generalizer

The matcher creates substitution using std_order, which is
reverse of expected order (variable 0 is last). Adjust the code
appropriately for that.

* Increase verbosity level for smt_context stats

* Dead code in qe_mbp

* bug fixes in spacer_global_generalizer::subsumer

* Partially remove dependence of size of m_alphas

I want m_alphas to potentially be greater than currently used alpha variables.
This is helpful for reusing them across multiple calls to convex closure

* Subtle bug in kernel computation

Coefficient was being passed by reference and, therefore, was
being changed indirectly.

In the process, updated the code to be more generic to avoid rational
computation in the middle of matrix manipulation.

* another test for sparse_matrix_ops::kernel

* Implementation of matrix kernel using Fraction Free Elimination

Ensures that the kernel is int for int matrices. All divisions are exact.

* clang-format sparse_matrix_ops.h

* another implementation of ffe kernel in sparse_matrix_ops

* Re-do arith_kernel and convex_closure

* update spacer_global_generalization for new subsumer

* remove spacer.gg.use_sage parameter

* cleanup of spacer_global_generalizer

* Removed dependency on sage

* fix in spacer_convex_closure

* spacer_sem_matcher: consider an additional semantic matching

disabled until it is shown useful

* spacer_global_generalizer: improve do_conjecture

 - if conjecture does not apply to pob, use lemma instead
 - better normalization
 - improve debug prints

* spacer_conjecture: formatting

* spacer_cluster: improve debug prints

* spacer_context: improve debug prints

* spacer_context: re-queue may pobs

enabled even if global re-queue is disabled

* spacer_cluster print formatting

* reset methods on pob

* cleanup of print and local variable names

* formatting

* reset generalization data once it has been used

* refactored extra pob creation during global guidance

* fix bug copying sparse matrix into spacer matrix

* bug fix in spacer_convex_closure

* formatting change in spacer_context

* spacer_cluster: get_min_lvl

chose level based on pob as well as lemmas

* spacer_context: add desired_level to pob

desired_level indicates at which level pob should be proved.
A pob will be pushed to desired_level if necessary

* spacer_context: renamed subsume stats

the name of success/failed was switched

* spacer_convex_closure: fix prototype of is_congruent_mod()

* spacer_convex_closure: hacks in infer_div_pred()

* spacer_util: do not expand literals with mod

By default, equality literal t=p is expanded into t<=p && t>=p

Disable the expansion in case t contains 'mod' operator since such
expansion is usually not helpful for divisibility

* spacer_util: rename m_util into m_arith

* spacer_util: cleanup normalize()

* spacer_util: formatting

* spacer_context: formatting cleanup on subsume and conjecture

* spacer_context: fix handling may pobs when abs_weakness is enabled

A pob might be undef, so weakness must be bumped up

* spacer_arith_kernel: enhance debug print

* spacer_global_generalizer: improve matching on conjecture

* spacer_global_generalizer: set desired level on conjecture pob

* spacer_global_generalizer: debug print

* spacer_global_generalizer: set min level on new pobs

the new level should not be higher than the pob that was generalized

* spacer_global_generalizer: do no re-create closed pobs

If a generalized pob exist and closed, do not re-create it.

* spacer_context: normalize twice

* spacer_context: forward propagate only same kind of pobs

* sketch of inductive generalizer

A better implementation of inductive generalizer that in addition to dropping
literals also attempts to weaken them.

Current implementation is a sketch to be extended based on examples/requirements.

* fix ordering in spacer_cluster_util

* fix resetting of substitution matcher in spacer_conjecture

Old code would forget to reset the substitution provided to the sem_matcher.
Thus, if the substitution was matched once (i.e., one literal of interest is
found), no other literal would be matched.

* add spacer_util is_normalized() method

used for debugging only

* simplify normalization of pob expressions

pob expressions are normalized to increase syntactic matching.
Some of the normalization rules seem out of place, so removing them for now.

* fix in spacer_global_generalizer

If conjecture fails, do not try other generalization strategies -- they will not apply.

* fix in spacer_context

do not check that may pob is blocked by existing lemmas.
It is likely to be blocked. Our goal is to block it again and generalize
to a new lemma.

This can be further improved by moving directly to generalization when pob is
blocked by existing lemmas...

Co-authored-by: hgvk94 <hgvk94@gmail.com>
2022-08-30 15:47:00 -07:00
Nikolaj Bjorner 1a79d92f3a revert last ditch array
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-30 12:56:21 -07:00
Nikolaj Bjorner 45d8d73fce #6303
handle more array instantiation cases for quantifier instantiation
2022-08-30 09:46:19 -07:00
Nikolaj Bjorner 159026b5e8 regression fix to ackerman gc and memory smash, perf fix for handling bv2int axioms, perf fix for filtering ackerman
this update addresses some perf regressions introduced when handling axioms for bv2int and a memory smash regression when decoupling bv-ackerman from in-processing. It adds a filter based on bv_eq_axioms for disabling ackerman reductions on disequalities.
2022-08-26 10:44:33 -07:00
Nikolaj Bjorner a628e4c4e5 updates to printer to get instantiations, take 1 2022-08-25 11:22:35 -07:00
Nuno Lopes 916d1dbb13 fix default parameter regression
bug introduced in commit 63f48f8fd4
2022-08-23 15:26:29 +01:00
Nuno Lopes 7ab904bfc6 remove spurious file 2022-08-23 14:39:44 +01:00
Nikolaj Bjorner a38308792e #6288
floating points may also track bit-literals.
Since the legacy solver doesn't handle dual tracking of literals we just let the floating point solver track.
2022-08-21 15:47:19 -07:00
Nikolaj Bjorner 4092302590 use interface for creating unary equalities
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-21 15:37:43 -07:00
Nikolaj Bjorner be0cd74c71 #6289 2022-08-21 15:25:17 -07:00
Nikolaj Bjorner 2181a0ff74 #6289 2022-08-21 15:25:17 -07:00
Bruce Mitchener 6ba9ada1e2
Fix typos. (#6291) 2022-08-21 12:40:07 -07:00
Bruce Mitchener 706f7fbdc7
Fix some warnings about unused stuff. (#6290) 2022-08-21 12:39:30 -07:00
Nikolaj Bjorner 48b13291d1 add bv-size reduce #6137
- add option smt.bv.reduce_size.
  - it allows to apply incremental pre-processing of bit-vectors by identifying ranges that are known to be constant.
    This rewrite is beneficial, for instance, when bit-vectors are constrained to have many high-level bits set to 0.
2022-08-16 16:35:14 -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 e0aa32e6c5 fix #6270
MBQI asserts auxiliary function definitions to handle models of arrays. This is unsound if the definition contains a model value.
2022-08-15 00:13:32 -07:00
Nikolaj Bjorner a0d4a8c21c update diagnostics 2022-08-15 00:12:44 -07:00
Nikolaj Bjorner b6d71fccd8 fix #6265 2022-08-12 10:22:22 -04:00
Nikolaj Bjorner 786280c646 print skolem declarations only for lemma tracing 2022-08-11 11:34:54 +03:00
Nikolaj Bjorner b55ad5f20e fix #6267 2022-08-11 09:31:54 +03:00
Nikolaj Bjorner f27485dae7 avoid push/pop if diseq/eq are not defined 2022-08-09 11:33:29 +03:00
Nikolaj Bjorner 78eaefe5a8 move solver-params to params 2022-08-08 11:34:41 +03:00
Nikolaj Bjorner 63f48f8fd4 add options for logging learned lemmas and theory axioms
- add solver.axioms2files
  - prints negated theory axioms to files. Each file should be unsat
- add solver.lemmas2console
  - prints lemmas to the console.
- remove option smt.arith.dump_lemmas. It is replaced by solver.axioms2files
2022-08-08 11:18:56 +03:00
Nikolaj Bjorner f34317d604 #6196 2022-08-07 09:44:10 +03:00
Bruce Mitchener 5014b1a34d Use = default for virtual constructors. 2022-08-05 18:11:46 +03:00
Bruce Mitchener 1d9345c3de Fix typos. 2022-08-05 07:40:50 +03:00
Bruce Mitchener 08165f5367 No need to return a const bool. 2022-08-05 07:40:19 +03:00
Nikolaj Bjorner 9da6895276 add option to select with folding 2022-08-04 16:59:26 +03:00
Nikolaj Bjorner a8ff976bcc max maximal unfolding configurable 2022-08-04 16:59:26 +03:00
Nikolaj Bjorner 774ce3d7ab create special case for osx arm
shortcut when store/select are distinct

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-03 07:56:02 +03:00
Jakob Rath 9275d1e57a sparse_matrix iterators 2022-08-01 18:37:11 +03:00
Bruce Mitchener 77e5d6ab19 Use nullptr consistently instead of 0 or NULL. 2022-08-01 14:24:32 +03:00
Bruce Mitchener 5d0dea05aa
Remove empty leaf destructors. (#6211) 2022-07-30 10:07:03 +01:00
Bruce Mitchener 1eb84fe4b9
Mark override methods appropriately. (#6207) 2022-07-29 23:29:15 +02:00
Nikolaj Bjorner 8551b217ce fix #6194 2022-07-27 08:03:57 +02:00
JohnLyu2 3e8daa5965
fix re.range symbolic argument bug in z3str3 (#6189) 2022-07-27 04:24:20 +02:00
Nikolaj Bjorner 5c2c0ae900 force-push on new_eq, new_diseq in user propagator, other fixes to Python bindings for user propagator
This update allows the python bindings for user-propagator to handle functions that are declared to be registered with the user propagator plugin. It fixes a bug in UserPropagateBase.add to allow registering terms dynamically during search.
It also fixes a bug in theory_user_propagate as scopes were not fully pushed when the solver gets the callbacks for new equalities and new disequalities.
It also adds equality and disequality interfaces to the sat/smt solver version (which isn't being exercised in earnest yet)
2022-07-25 03:42:29 +02:00
Bruce Mitchener 3e38bbb009
Make sure all headers do #pragma once. (#6188) 2022-07-23 10:41:14 -07:00
Nikolaj Bjorner 7f983e7d9e fix #6174
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-20 21:22:41 -07:00
Nikolaj Bjorner 1b83a4556b fix #6178
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-20 20:48:23 -07:00
Clemens Eisenhofer 95c3dd9224
Added missing decide-callback for tactics (#6166)
* Added function to select the next variable to split on

* Fixed typo

* Small fixes

* uint -> int

* Fixed missing assignment for binary clauses

* Added missing decide-callback for tactics
2022-07-17 10:07:52 -07:00
Nikolaj Bjorner b253db2c0a redundant parenthesis 2022-07-13 16:20:03 -07:00
Nikolaj Bjorner 1378e713ba fix #6157 2022-07-13 14:37:04 -07:00
Nikolaj Bjorner 8e23af33d7 fix build
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-13 14:20:21 -07:00
Nikolaj Bjorner 7d0c789af0 propagate has-length over map/mapi 2022-07-12 20:50:28 -07:00
Nikolaj Bjorner ca80d99617 fix #6153 2022-07-12 15:49:57 -07:00
Nikolaj Bjorner 43cf053066 fix #6128 2022-07-12 15:43:12 -07:00
Nikolaj Bjorner 49b7e9084f Merge branch 'master' of https://github.com/z3prover/z3 2022-07-11 09:26:34 -07:00
Clemens Eisenhofer 1f2346073a
Fixed missing assignment for binary clauses (#6148)
* Added function to select the next variable to split on

* Fixed typo

* Small fixes

* uint -> int

* Fixed missing assignment for binary clauses
2022-07-11 09:24:03 -07:00
Nikolaj Bjorner b68af0c1e5 working on reconciling perf for arithmetic solvers
this update integrates inferences to smt.arith.solver=6 related to grobner basis computation and handling of div/mod axioms to reconcile performance with smt.arith.solver=2.

The default of smt.arth.nl.grobner_subs_fixed is changed to 1 to make comparison with solver=2 more direct.

The selection of cluster equalities for solver=6 was reconciled with how it is done for solver=2.
2022-07-11 07:38:51 -07:00
Nikolaj Bjorner 0c42d3b079 small format update
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-06 11:41:48 -07:00
Nikolaj Bjorner 580ed31afd fix types and incompleteness for feature #6104 2022-07-06 01:08:54 -07:00
Nikolaj Bjorner d7472f0726 fix #6124
expression pointers were changed within a function, but not pinned. So the pointers got stale. To enforce their life-time within the function body (for use in logging) pin the expressions.
2022-07-05 12:48:21 -07:00
Nikolaj Bjorner de41cfd277 fix #6104
add equality reasoning to bit-vector solver to instantiate int2bv(bv2int(x)) = x identity on demand.
2022-07-05 12:23:24 -07:00
Nikolaj Bjorner 71fc83c051 Move out equality use out of the loop 2022-07-04 12:42:39 -07:00
Nikolaj Bjorner 6ed2b444b5 probably won't fix #6127
recfun decl plugin does not get copied so recursive functions are lost when cloning.
Fix is risky and use case is limited to threads + recursive definitions
2022-07-03 18:10:52 -07:00
Nikolaj Bjorner 1e8f9078e3 fix unsoundness in explanation handling for nested datatypes and sequences 2022-07-03 17:00:39 -07:00
Nikolaj Bjorner 1a9122663c remove unsound axioms, fix #6115 2022-06-29 11:16:10 -07:00
Nikolaj Bjorner ff265235c1 adjust trace output 2022-06-29 08:20:01 -07:00
Nikolaj Bjorner fd8ee34564 add logging 2022-06-29 08:20:01 -07:00
Nikolaj Bjorner 30165ed40a fix #6105
non-linear division axioms appear incomplete.
Fixed for legacy arithmetic. Fix pending for new arithmetic solver.
2022-06-26 20:37:18 -07:00
Nikolaj Bjorner 56aa4261b6 fix #6082 2022-06-23 07:43:06 -07:00
Clemens Eisenhofer 2fa60aa43c
Added function to select the next variable to split on (User-Propagator) (#6096)
* Added function to select the next variable to split on

* Fixed typo

* Small fixes

* uint -> int
2022-06-19 10:49:25 -07:00
Nuno Lopes 73a24ca0a9 remove '#include <iostream>' from headers and from unneeded places
It's harmful to have iostream everywhere as it injects functions in the compiled files
2022-06-17 14:10:19 +01:00
Nuno Lopes 70bcf0b51d reduce sizeof(enode) from 120 to 112 bytes by swapping the order of fields
Yes, those 8 bytes are yours now, use responsibly.
2022-06-17 12:07:15 +01:00
Nikolaj Bjorner 99b606b861 add logging 2022-06-16 15:40:00 -07:00
Nikolaj Bjorner 637120ced5 Treat arguments to recursive functions as beta redexes
An argument to a recursive function would escape the scope of the function application when the recursive function definitions are unfolded. Therefore, such argument occurrences need not be considered for extensional equality / equality sharing.

This filter is mostly relevant for recursive functions that take a lambda expression as argument. Lambda expressions / arrays that occur in shared occurrences are checked for extensionality.
2022-06-14 09:51:06 -07:00
Nikolaj Bjorner 04f94d818f fix #6091 2022-06-14 09:51:06 -07:00
Nikolaj Bjorner 8efa3c8ade introduce notion of beta redex to deal with lambdas in non-extensional positions
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-06-10 17:35:01 -07:00
Nikolaj Bjorner b9b5377c69 add a way to supress lambdas
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-06-10 14:37:25 -07:00
Nikolaj Bjorner 5db133f875 add a way to supress lambdas
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-06-10 14:35:20 -07:00
Nikolaj Bjorner 6a1193eebd reorg if-then-else structure 2022-06-08 10:00:45 -07: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 a9d70fca1a fix #6061
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-05-31 19:09:10 -07:00
Nikolaj Bjorner ca2497eecb na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-05-15 12:00:41 -07:00
Nikolaj Bjorner 7497856ded add ignore int to new arithmetic solvers
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-05-11 15:14:22 -07:00
Nikolaj Bjorner 54648f6b50 add stats for binary clause creation
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-05-10 14:58:15 -07:00
Nikolaj Bjorner 7def610a69 build warnings
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-05-08 10:31:11 -07:00
JohnLyu2 5a9b0dd747
Z3str3 Debug (#6000)
* z3str3 debug

* add comments of reference to bugs in the report

Co-authored-by: John Lu <z52lu@uwaterloo.ca>
2022-04-27 12:37:07 +02:00
Nikolaj Bjorner 81d97a81af enable nested ADT and sequences
add API to define forward reference to recursively defined datatype.
The forward reference should be used only when passed to constructor declarations that are used in a datatype definition (Z3_mk_datatypes). The call to Z3_mk_datatypes ensures that the forward reference can be resolved with respect to constructors.
2022-04-27 09:58:38 +01:00
Nikolaj Bjorner 8e2f09b517 #5778 - ensure arrays used inside of extensionality function are treated as shared
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-04-25 17:17:59 +01:00
Clemens Eisenhofer 81189d6fdd
Added bit2bool to the API (#5992)
* Fixed registering expressions in push/pop

* Reused existing function

* Reverted reusing can_propagate

* Added decide-callback to user-propagator

* Refactoring

* Fixed index

* Added bit2bool to the API
Fixed bug in user-propagator's decide callback

* Fixed typo
2022-04-22 09:54:21 +01:00
Nikolaj Bjorner a1ead5f47d #5986
add memory limit check to internalize
2022-04-19 07:31:40 +02:00