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

14646 commits

Author SHA1 Message Date
Nikolaj Bjorner 6e05162df0 update solver only if there is a manager
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-10-03 15:27:26 -04:00
Nikolaj Bjorner b03d4e4fc2 update solver only if there is a manager
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-10-03 15:26:10 -04:00
Nikolaj Bjorner 5b71f7cf9e Merge branch 'master' of https://github.com/z3prover/z3 2022-10-03 15:19:01 -04:00
Nuno Lopes be3c7d7115 delete dead code 2022-10-02 21:44:08 +01:00
Nuno Lopes 1eed058b98 use std::move 2022-10-02 21:34:17 +01:00
Nikolaj Bjorner ad49dd739b initialize variables to avoid warning messages whether real or spurious
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-10-01 17:08:02 -04:00
Nikolaj Bjorner cffe5fe1a5 remove debug print
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-10-01 17:05:36 -04:00
Nuno Lopes 24ff0f2d36 attempt to fix cmake build 2022-10-01 21:48:27 +01:00
Naxaes 49ebca6c1c
Fix clang build (#6378) 2022-10-01 14:01:36 +01:00
Nuno Lopes 47e44c5538 fix build 2022-10-01 12:17:15 +01:00
Nikolaj Bjorner 903cddcaaa fix build
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-09-30 17:10:18 -04:00
Nikolaj Bjorner ab045f0645 fix build
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-09-30 16:52:19 -04:00
Nikolaj Bjorner 876ca2f1a5 fix #6371 2022-09-30 14:51:28 -04:00
Nikolaj Bjorner b9cba82531 work on proof checking
- add outline of trim routine
- streamline how proof terms are checked and how residue units are extracted.
2022-09-30 13:04:19 -04:00
Nikolaj Bjorner ccda49bad5 fix #6376
have solver throw an exception when user supplies a non-propositional assumption
2022-09-30 13:03:34 -04: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
Nikolaj Bjorner 9782d4a730 #5261
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-09-26 05:04:02 -07:00
Nikolaj Bjorner 7b982a812e fix build
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-09-25 18:09:32 -07:00
Nikolaj Bjorner 3df8b9c7e2 Merge branch 'master' of https://github.com/z3prover/z3 2022-09-25 18:03:26 -07:00
Nikolaj Bjorner d7b9cc70d0 smc
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-09-25 18:03:16 -07:00
Nikolaj Bjorner 9be8fc7857 Add EUF (congruence closure) proof hints and checker to the new core
EUF proofs are checked modulo union-find.
Equalities are added to to union-find if they are assumptions or if they can be derived using congruence closure. The congruence closure assumptions are added as proof-hints.
Note that this proof format does not track equality inferences, symmetry and transitivity. Instead they are handled by assuming a union-find based checker.
2022-09-25 14:26:20 -07:00
Nikolaj Bjorner 6f2fde87d1 move has-default up before merge of parents
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-09-24 14:40:30 -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 3dfff3d7a1 tracing for fpa 2022-09-23 22:48:54 -07:00
Nikolaj Bjorner 1f150ecd52 #6319
#6319 - fix incompleteness in propagation of default to all array terms in the equivalence class.

Fix bug with q_mbi where domain restrictions are not using values because the current model does not evaluate certain bound variables to values. Set model completion when adding these bound variables to the model to ensure their values are not missed.

Add better propagation of diagnostics when tactics and the new solver return unknown. The reason for unknown can now be traced to what theory was culprit (currently no additional information)
2022-09-23 22:22:34 -05:00
Nikolaj Bjorner 6226875283 fix regression with uninitialized variable 2022-09-23 15:51:26 -05:00
Nikolaj Bjorner c41b6da6bb #6319
using a queue for disequality propagaiton was a regression: values of numerals can change along the same stack so prior passing the filter does not mean it passes later.
2022-09-23 14:47:48 -05:00
Nikolaj Bjorner 79b4357442 #6363 2022-09-23 14:32:01 -05:00
Nikolaj Bjorner 3d9512b93c fix #6363 2022-09-23 14:32:01 -05:00
Nikolaj Bjorner de74e342c6
#5261 2022-09-23 13:19:55 -05:00
Nikolaj Bjorner 4c6d7158cb extended debugging for sat.euf 2022-09-22 17:05:32 -05:00
Nikolaj Bjorner c24d445886 fix #6355
conversion from AIG to expressions should always use the optimized conversion function.

the aig-tactic should throttle regarding output bloat from AIG.
If the expression after AIG simpification, for whatever reason, is bloated the rewrite does not take place.
2022-09-22 17:05:32 -05:00
gmh5225 b0d0c36b11
Add option 'MSVC_STATIC' (#6358)
* Add option 'MSVC_STATIC'

* Update CMakeLists.txt

* Update CMakeLists.txt

* Upload msvc-static-build.yml
2022-09-22 15:55:40 -05:00
Clemens Eisenhofer a67fe054d5
Memory leak in .NET user-propagator (#6360)
The user-propagator object has to be manually disposed (IDisposable), otherwise it stays in memory forever, as it cannot be garbage collected automatically
2022-09-22 13:26:08 -05:00
Peter Bruch 58fad41dfa
Dotnet Api: Fix infinite finalization of Context (#6361)
* Dotnet Api: suppress GC finalization of dotnet context in favor of re-registering finalization

* Dotnet Api: enable concurrent dec-ref even if context is created without parameters.

* Dotnet Api: removed dead code.
2022-09-22 13:25:17 -05:00
Nikolaj Bjorner 42945de240 #6319
align use of optsmt and the new core (they should not be used together)
2022-09-21 12:09:31 -07:00
Nikolaj Bjorner eba5a5d141 Merge branch 'master' of https://github.com/z3prover/z3 2022-09-20 20:32:07 -07:00
Nikolaj Bjorner 4518f4fe02 fix #6352
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-09-20 20:31:55 -07:00
Nikolaj Bjorner 20250b200f #6319
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-09-19 20:31:36 -07:00
Nikolaj Bjorner 7caf6a682b #6319 resolve for unsat core when using assumptions 2022-09-19 20:10:53 -07:00
Nikolaj Bjorner f4bea58852 #6319
ensure unknown when a lambda is not in beta redex
2022-09-19 03:19:47 -07:00
Nikolaj Bjorner fce4d2ad90 #6319 2022-09-19 03:07:51 -07:00
Nikolaj Bjorner d6d34a8962 #6319 2022-09-19 02:32:04 -07:00
Nikolaj Bjorner 13f43ea107 bug fix for #6319
literals that are replayed need to be registered with respective theories, otherwise, they will not propagate with the theories (the enode have to be attached with relevant theory variables).
2022-09-18 17:23:00 -07:00
Nikolaj Bjorner e54635e0ed rename statistics to something more meaningful: instantiations from MBQI are tagged with mbi 2022-09-18 17:23:00 -07:00
Nikolaj Bjorner 2b4ba5e170 updated header file for arithmetic solver 2022-09-18 17:23:00 -07:00
Nikolaj Bjorner 0b9c9cbbce add a queue head to delay propagation
delay propagation on each disequality/equality should suffice once. It adds relevant inequalities to ensure the arithmetic solver is coherent about disequalities.
2022-09-18 17:23:00 -07:00
Nikolaj Bjorner d479bd9c53 formatting 2022-09-18 17:22:59 -07:00
Nikolaj Bjorner c11bd79484 add assertions 2022-09-18 17:22:59 -07:00
Nikolaj Bjorner 9a987237d5 don't rename uint_set but keep the original name 2022-09-18 17:22:59 -07:00
Nikolaj Bjorner bd4db4c41f add option to rewrite and for arithmetic simplification 2022-09-18 17:22:59 -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 af258d1720 add method for accessing i'th domain sort in array #6344 2022-09-15 07:38:02 -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 a6a5985f8e fix #6341
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-09-13 17:19:48 -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 a5ad109707 suppress debug warnings when concurrent dec-ref is enabled. The contract with the client is that it doesn't invoke methods on auxiliary objects after the context is deleted. The client is not required to decrement reference counts
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-09-11 19:06:23 -07:00
Nikolaj Bjorner edeeded4ea
remove DecRefQueue, use Z3_enable_concurrent_dec_ref (#6332)
The notion of reference counted contexts never worked.
The reference count to a context only ends up being 0 if the GC kicks in and disposes the various z3 objects. A call to Dispose on Context should free up all resources associated with that context. In exchange none of the resources are allowed any other operation than DecRef. The invocations of DecRef are protected by a lock and test on the context that the native pointer associated with the context is non-zero. Dispose sets the native pointer to zero.

Z3_enable_concurrent_dec_ref ensures that:

- calls to decref are thread safe. Other threads can operate on the context without interference.

The Z3_context ensures that
- z3objects allocated, but not disposed during the lifetime of Z3_context are freed when Z3_context is deleted (it triggers a debug warning, but this is now benign).
2022-09-11 18:59:00 -07:00
Nikolaj Bjorner 3c8c80bbac fix #6336 2022-09-11 12:22:49 -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 53611f47df modify clauses used by not-contains
The literal "emp" can be true in the current assignment, in which case the clause
cnt or emp or ~postf is true and does not contribute to propagation.
This saves, potentially, for generating lemmas for postf.

Add a lemma a = "" or |s| >= idx when a = tail(s, idx)
The lemma ensures that length bounding on s is enforced
(the branch that expands not-contains for long sequences s is closed).
2022-09-11 05:48:17 -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 3900c03b72 make error message more descriptive 2022-09-11 05:43:33 -07:00
Nikolaj Bjorner 6df711254b fix type error when mapping over the empty sequence 2022-09-10 16:03:52 -07:00
Nikolaj Bjorner 8311525472 map and fold cannot be treated as variables 2022-09-10 16:03:24 -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 0629353fdc add match for foldli 2022-09-10 16:02:11 -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
Clemens Eisenhofer 25b5b985e6
Missing overload for conflict (#6329) 2022-09-07 09:02:06 -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 5322d4f241 fix #6326 2022-09-06 23:48:21 -07:00
Nikolaj Bjorner 9732169b04 #6320 2022-09-05 13:44:27 -07:00
Nuno Lopes 9717dadd9f
Use glibc's malloc_usable_size when available (#6321) 2022-09-05 13:40:02 -07:00
Nikolaj Bjorner 6a61efbf99 add missing override
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-09-05 13:35:53 -07:00
Nikolaj Bjorner fcc6e6c899 doc bug 2022-09-05 03:17:13 -07:00
Nikolaj Bjorner 8dc8de8ccd lazy multiplier experiment
this update provides a use case for and allows testing incremental multiplier compilation.
2022-09-05 03:09:18 -07:00
Nikolaj Bjorner 616fc2cbd5 fix #6314
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-09-04 16:23:11 -07:00
Nikolaj Bjorner b49ffb8a87 indentation 2022-09-04 16:23:11 -07:00
Nuno Lopes b9ddb11701 add static love 2022-09-04 11:57:43 +01:00
Nikolaj Bjorner 85c8168af5 use for pattern instead of iterators 2022-09-02 22:45:50 -07:00
Nikolaj Bjorner 60967efd38 fix wrong condition for delayed bit-blasting 2022-09-02 18:39:21 -07:00
Nikolaj Bjorner 0bdb2f1691 add verbose=1 log for mbp failure 2022-09-02 18:03:56 -07:00
Nikolaj Bjorner 7e1e64d027 fix #6313
remaining new issues
2022-09-02 17:48:00 -07:00
JohnLyu2 9dca8d18ed
fix negative contains bug (#6312) 2022-09-02 13:36:11 -07:00
Nikolaj Bjorner e4ef1717e3 fix variable tracking bug in explanations with literals 2022-09-01 23:26:38 -07:00
Nikolaj Bjorner eb1ea9482e detect nested as-array in model values 2022-09-01 23:26:38 -07:00
Arie Gurfinkel eb2b95e5fe spacer: trying to make C++ happy 2022-09-01 15:44:22 -07:00
Nikolaj Bjorner f2afb369bd extend distinct check to ADT 2022-09-01 14:18:13 -07:00
Nikolaj Bjorner 61f7dc3513 remove creation of trivial testers 2022-09-01 10:23:21 -07:00
Nikolaj Bjorner 46383a0811 AG - unary datatypes, tester always is true. 2022-09-01 09:45:56 -07:00
Nikolaj Bjorner ac5b190a72 track instantiations from MBQI in proof logging for new solver
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-09-01 08:51:53 -07:00
Nikolaj Bjorner d3e6ba9f98 remove union
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-31 19:09:13 -07:00
Nikolaj Bjorner 3011b34b3b log E-matching based quantifier instantiations as hints 2022-08-31 18:59:02 -07:00
Nikolaj Bjorner 6077c4154a #6116 bv2int bug fix 2022-08-31 17:31:54 -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 36d76a5bb2 fix #6304
Conditionals are used to guard unfolding of recursive functions.
This is, as shown in #6304, incompatible with the case where recursive functions are used inside if-then-else guards.
We address this by disabling if-conditions as guards if they contain a recursive definition.
The approach is simplistic: if a recursive function, defined prior (not mutually recursive) is used in a guard it should be fine and the condition can guard the current recursive unfolding.
2022-08-30 09:50:58 -07:00
Nikolaj Bjorner 45d8d73fce #6303
handle more array instantiation cases for quantifier instantiation
2022-08-30 09:46:19 -07:00
Nikolaj Bjorner 0f475f45b5 Add RUP checking mode to proof checker. 2022-08-30 09:45:19 -07:00
Nikolaj Bjorner 8cb118235a add missing status case for cancelation 2022-08-30 09:43:10 -07:00
Nikolaj Bjorner cd0af999a8 fix #6302
crash due to not checking for dead rows.
non-termination due to solving div and mod separately.
To ensure termination one needs to at least process them simultaneously, otherwise the metric of number-of-terms x under number of mod/div does not decrease. Substituting in K*y + z under either a mod or div increases the number of terms under a mod/div when eliminating only one of the kinds.
Currently handling divides constraints separately because pre-existing solution uses the model to determine z as a constant between 0 and K-1. The treatment of mod/div is supposed to be more general and use a variable while at the same time reducing the mod/div terms where the eliminated variable is used (the variable z is not added under the mod/div terms, but instead the model is used to determine cut-offs to calculate mod/div directly.
2022-08-29 14:32:13 -07:00
Nikolaj Bjorner dd90689339 build fixes
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-28 18:54:36 -07:00
Nikolaj Bjorner 6f2a6da600 address unused variable warnings
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-28 18:50:54 -07:00
Nikolaj Bjorner 4d29925c3f build fixes
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-28 18:43:50 -07:00
Nikolaj Bjorner 8b8caf9ded re-add smt-solver for proof_cmds
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-28 18:19:30 -07:00
Nikolaj Bjorner 37fab88de0 respect dependencies, move proof_cmds to extra_cmds
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-28 18:16:43 -07:00
Nikolaj Bjorner f65a244385 move proof_cmds
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-28 18:11:26 -07:00
J Sailor f5d2b9b89a
fix typo in comment defining macros (#6306)
The existing comment describes macros as "formulas of the form
`(forall X (= (f X) T[X]))` ... where `T[X]` does not contain `X`". This is
incorrect; of course the macros' definitions are allowed to be in terms of
the macros' arguments. The comment should say "...does not contain `f`" because
macros can't be recursive.
2022-08-28 17:49:52 -07:00
Clemens Eisenhofer a0ca5d745e
Fixed nested user-propagator callbacks in .NET (#6307)
* Fixed nested user-propagator callbacks in .NET

* Typo
2022-08-28 17:49:15 -07:00
Nikolaj Bjorner e2f4fc2307 overhaul of proof format for new solver
This commit overhauls the proof format (in development) for the new core.

NOTE: this functionality is work in progress with a long way to go.
It is shielded by the sat.euf option, which is off by default and in pre-release state.
It is too early to fuzz or use it. It is pushed into master to shed light on road-map for certifying inferences of sat.euf.

It retires the ad-hoc extension of DRUP used by the SAT solver.
Instead it relies on SMT with ad-hoc extensions for proof terms.
It adds the following commands (consumed by proof_cmds.cpp):

- assume  - for input clauses
- learn   - when a clause is learned (or redundant clause is added)
- del     - when a clause is deleted.

The commands take a list of expressions of type Bool and the
last argument can optionally be of type Proof.
When the last argument is of type Proof it is provided as a hint
to justify the learned clause.

Proof hints can be checked using a self-contained proof
checker. The sat/smt/euf_proof_checker.h class provides
a plugin dispatcher for checkers.
It is instantiated with a checker for arithmetic lemmas,
so far for Farkas proofs.

Use example:
```
(set-option :sat.euf true)
(set-option :tactic.default_tactic smt)
(set-option :sat.smt.proof f.proof)
(declare-const x Int)
(declare-const y Int)
(declare-const z Int)
(declare-const u Int)
(assert (< x y))
(assert (< y z))
(assert (< z x))
(check-sat)
```

Run z3 on a file with above content.
Then run z3 on f.proof

```
(verified-smt)
(verified-smt)
(verified-smt)
(verified-farkas)
(verified-smt)
```
2022-08-28 17:44:33 -07:00
Nikolaj Bjorner 9922c766b9 add extra information for type error message
a recent opened and closed bug report was due to an error of taking bit-wise or between two bit-vectors of different size. The error message was not understood by the user. Adding a little extra generic information to see if it helps.
2022-08-28 17:39:14 -07:00
Nikolaj Bjorner dd91fab6f4 Merge branch 'master' of https://github.com/Z3Prover/z3 2022-08-26 10:44:40 -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 458f417f44 move drat functionality into euf 2022-08-25 19:19:13 -07:00
Nikolaj Bjorner 1ffbe23ee3 add virtual destructor to fix build
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-25 18:37:24 -07:00
Nikolaj Bjorner 1894c86ee0 virtual
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-25 18:27:30 -07:00
Nikolaj Bjorner ca0a82952f add function pointer to class to see how MacOs build reacts
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-25 16:15:34 -07:00
Nikolaj Bjorner 0d7b7a417a selectively re-add solver_params
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-25 13:29:42 -07:00
Nikolaj Bjorner 5f2387b3be revert some changes that coincide with breaking macos build 2022-08-25 11:22:35 -07:00
Nikolaj Bjorner a628e4c4e5 updates to printer to get instantiations, take 1 2022-08-25 11:22:35 -07:00
Nikolaj Bjorner f0eee41ab9 include depenency 2022-08-25 09:09:04 -07:00
Nikolaj Bjorner 6c165e89dc #6299 2022-08-24 20:25:01 -07:00
Nikolaj Bjorner f6e151a49c assert 2022-08-24 17:16:47 -07:00
Nikolaj Bjorner d975886cdc fix #6300
several boundary cases with repeated rows being retired twice and non-termination for K = 1 where decomposition is just identity.
2022-08-24 17:16:47 -07:00
Nikolaj Bjorner fb8532bf55 succinct logging
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-23 21:06:04 -07:00
Nikolaj Bjorner 74c61f49b4 move std::function to header of sat-drat - alignment?
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-23 20:20:51 -07:00
Nikolaj Bjorner c6263587c3 fix validator bug returning true for unprocessed case, bug reported in #6116 2022-08-23 20:17:32 -07:00
Nikolaj Bjorner ce1f3987d9 fix unsoundness in quantifier propagation #6116 and add initial lemma logging 2022-08-23 19:10:01 -07:00
Nikolaj Bjorner 912b284602 disable validate_hint too permissive 2022-08-23 19:07:55 -07:00
Nikolaj Bjorner 2f8b13368d add redirect for warnings
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-23 15:55:55 -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 0eea021dc3 include global parameters and fixup for HTML meta-characters 2022-08-22 14:25:18 -07:00
Nikolaj Bjorner f6e4a45f4b Merge branch 'master' of https://github.com/z3prover/z3 2022-08-21 18:28:19 -07:00
Nikolaj Bjorner 64e0e785e7 #5953 2022-08-21 18:28:07 -07:00
Nikolaj Bjorner 09ab575d29 parens 2022-08-21 18:27:14 -07:00
Nikolaj Bjorner daa24ef4ce add missing error check 2022-08-21 18:26:53 -07:00
Nikolaj Bjorner 9eb4237dfe fix #6292
this patches a case where macro-finder is used with arrays. It doesn't work so macro quantifiers have to be re-instated to ensure correctness
2022-08-21 16:32:01 -07: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 17fc438476 don't have bv-ackerman influence simplification
previous scheme has Ackmerman module instrument main solver to backjump and simplify when reaching a threshold.
This destroys overall performance: simplification does many more things than invoking Ackerman axioms.
Having a dependency between simplification (in-processing) and depleting a priority queue of auxiliary axioms therefore hurts overall performance. It has to be decoupled. The current approach is now to empty the axiom queue on occasion.
It is still not ideal - it should be coupled with the search level - axioms don't survive higher levels where redundant clauses get garbage collected as they don't have a chance of being used.
2022-08-21 15:25:18 -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
Clemens Eisenhofer 56fb161532
ADT-constructor generation crashed in .NET/Java when no (= default) fields are given (#6287) 2022-08-21 12:40:38 -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
Nuno Lopes d5d77dfe64 minor code simplifications 2022-08-20 12:56:45 +01:00
Nikolaj Bjorner 08bf7a6293 fix name
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-19 18:22:42 -07:00
Nikolaj Bjorner 665ef2c6ba add missing new
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-19 18:21:03 -07:00
Nikolaj Bjorner bb5d81195c use equalities 2022-08-19 18:17:16 -07:00
Nikolaj Bjorner b26420ed99 #6285 2022-08-19 18:17:16 -07:00
Nikolaj Bjorner e83a70f9ad add newlines for description
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-19 06:57:39 -07:00
Nikolaj Bjorner 540e36e6cb roll version number
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-18 15:47:08 -07:00
Nikolaj Bjorner 19da3c7086 fix closing parnetheses
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-18 13:26:29 -07:00
Nikolaj Bjorner d094f6a856 fixing interface and test'
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-18 13:00:46 -07:00
Nikolaj Bjorner c7eda4e687 fixing interface and test'
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-18 12:59:00 -07:00
Nikolaj Bjorner c3d635cf77 handle build warning
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-18 12:50:30 -07:00
Nikolaj Bjorner 6fb7a049ea test fromString
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-18 12:41:02 -07:00
Nikolaj Bjorner 53e168879a add fromString method 2022-08-18 12:33:10 -07:00
Nikolaj Bjorner 4be26eb543 #6116
handle also nan/oo/0+ as numerals
2022-08-18 04:26:14 -07:00
Nikolaj Bjorner 8e167aa213 #6116
fix unsoundness issue due to book-keeping changes for whether the solver uses assumptions.
2022-08-18 03:58:06 -07:00
Nikolaj Bjorner 1a5503c87b enable new code path for mod handling 2022-08-17 07:31:26 -07:00
Nikolaj Bjorner cb272bd7a8 fix missing removal of x in solve_mod 2022-08-17 07:31:26 -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 9d6de2f873 parameters neatified
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-16 09:14:34 -07:00
Nikolaj Bjorner b169292743 add parameter descriptions
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-16 08:26:53 -07:00
Nikolaj Bjorner 583dae2e27 enable nested division
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-15 16:11:00 -07:00
Nikolaj Bjorner 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 138f0d269c fix regression found by fuzzers fix #6271 2022-08-14 12:26:33 -07:00
Nikolaj Bjorner 1d87592b13 fixes to mod/div elimination
elimination of mod/div should be applied to all occurrences of x under mod/div at the same time. It affects performance and termination to perform elimination on each occurrence since substituting in two new variables for eliminated x doubles the number of variables under other occurrences.

Also generalize inequality resolution to use div.

The new features are still disabled.
2022-08-14 11:34:03 -07:00
Nikolaj Bjorner f014e30d46 disable case1
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-13 08:53:19 -07:00
Nikolaj Bjorner d80e2fb61d fix build
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-13 08:49:07 -07:00
Nikolaj Bjorner 16a948683f Merge branch 'master' of https://github.com/z3prover/z3 2022-08-13 07:07:34 -07:00
Nikolaj Bjorner fa91a644d3 make extensionality commutative 2022-08-13 07:07:14 -07:00
Nikolaj Bjorner 5669cf65bc bug fixes to mod/div quantifier elimination features 2022-08-13 06:18:13 -07:00
Nikolaj Bjorner 88b6c4a30d pdate decl collection to include functions under arrays
Signedoff-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-12 13:45:16 -07:00
Bruce Mitchener 72f4ee9230 api: Correctly map OP_BSREM0 to Z3_BSREM0. 2022-08-12 14:40:16 -04:00
Nikolaj Bjorner 550d6914b1 updates to div/mod handling in quantifier projection
note: the new code remains disabled at this point.
2022-08-12 14:39:33 -04:00
Nikolaj Bjorner d272becade fixes for division 2022-08-12 11:54:26 -04:00
Nikolaj Bjorner f989521a8c add initial skeleton for xor-solver 2022-08-12 11:54:10 -04:00
Nikolaj Bjorner b6d71fccd8 fix #6265 2022-08-12 10:22:22 -04:00
Nikolaj Bjorner 03385bf78d improve quantifier elimination for arithmetic
This update changes the handling of mod and adds support for nested div terms.

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

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

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

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

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

The functionality is disabled in this push.
2022-08-12 10:20:43 -04:00
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 49064252ac fix issues for user-propagator from new core 2022-08-09 14:56:27 +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 77a313ff76 redo #6242
revert to byte based high watermark
add mb based high watermark
2022-08-08 11:26:18 +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 410eed9bd5 #6116 2022-08-07 11:09:43 +03:00
Nikolaj Bjorner 8e077d8ef9 #6116 2022-08-07 10:25:04 +03:00
Nikolaj Bjorner 539d44464f #6196
map can be simplified
2022-08-07 10:17:24 +03:00
Nikolaj Bjorner f34317d604 #6196 2022-08-07 09:44:10 +03:00
Nikolaj Bjorner a4ea281602 fix #6260 2022-08-06 08:21:52 +03:00
Bruce Mitchener 5014b1a34d Use = default for virtual constructors. 2022-08-05 18:11:46 +03:00
Arie Gurfinkel aa0719abae model_based_opt: fix enabling complete resolution
a bug prevented an optimization to be enabled
2022-08-05 18:11:23 +03:00
Nikolaj Bjorner 80c516bb50 squash stores 2022-08-05 13:57:35 +03:00
Bruce Mitchener 6835522a7f z3++.h: No longer include unused sstream.
This makes some code using the C++ API have to include `<sstream>`
if they used the functionality but didn't include it themselves.
2022-08-05 09:41:49 +03:00
Nikolaj Bjorner e48474ec0e Merge branch 'master' of https://github.com/z3prover/z3 2022-08-05 09:20:00 +03:00
Nikolaj Bjorner c51af91256 #6257
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-05 09:19:49 +03:00
Arie Gurfinkel a9b7348b4b (cmake): fix visibility on shell z3 binary
Commit #b361226 changed symbol visibility from a global to a local option.
This creates inconsistency for shell that is compiled as an executable rather
than as z3 component.

This commit adds same local options to shell target in cmake.

Prior to the fix, clang on OSX complains with lots of warnings about symbol visibility
being different in different translation units that are linked together
2022-08-05 09:00:40 +03:00
Nikolaj Bjorner 78a0f57398 for #6257
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-05 08:09:39 +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
Bruce Mitchener 8a3556e5ba cmake: Remove dep on mk_util.py for update_api.py calls.
update_api.py doesn't depend on mk_util.py any longer, so these
dependencies can go away.
2022-08-04 07:54:26 +03:00
Saloed d908ebec4c fix memory_high_watermark parameter according to documentation 2022-08-03 18:50:54 +03:00
Bruce Mitchener d8c99480c6 test/lp: Replace if linux with if not windows.
This is stuff that works on posix, so we can flip the check.
2022-08-03 08:22:54 +03:00
Bruce Mitchener 112dba559f Remove unused private member from smaller_pattern. 2022-08-03 08:21:32 +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
Bruce Mitchener 42f5047463 cmake: Cleanup remnants of workaround for USES_TERMINAL.
In older versions, this was dependent upon the version of cmake,
but when it was updated for newer cmake, these remnants were
left.
2022-08-02 17:39:10 +03:00
Bruce Mitchener 8313282cda Use char version of find_last_of when possible. 2022-08-02 17:38:11 +03:00
Bruce Mitchener 886c3abec1 Remove remnants of _MP_MSBIGNUM checks. 2022-08-02 09:28:57 +03:00
Bruce Mitchener 9a99c78ffb Enable thread_local code more broadly.
This was only being enabled on Windows, Linux, and FreeBSD. (FreeBSD
only had it enabled in the legacy build system, not in cmake.)

`thread_local` is part of C++11, so now that we require C++17
or later and more recent compilers, this should work everywhere
that threading does, so only disable it within a `SINGLE_THREAD`
build.
2022-08-02 09:24:51 +03:00
Bruce Mitchener 82d853e5f8 Use = delete to delete special methods.
This provides a better experience than just marking them as
private and leaving them as undefined symbols.
2022-08-02 09:23:14 +03:00
Jakob Rath 2c2ab0d57a Additional BV matchers 2022-08-01 18:37:11 +03:00
Jakob Rath 5d858da58a union_find::reserve 2022-08-01 18:37:11 +03:00
Jakob Rath e8e64d3098 dlist::insert_before/after 2022-08-01 18:37:11 +03:00
Jakob Rath de6a0ab1a7 PDD operations 2022-08-01 18:37:11 +03:00
Jakob Rath 42233ab5c8 Additional BDD operations; BDD vectors and finite domain abstraction 2022-08-01 18:37:11 +03:00
Jakob Rath 9275d1e57a sparse_matrix iterators 2022-08-01 18:37:11 +03:00
Jakob Rath 6eae27ffad numeral helper functions 2022-08-01 18:37:11 +03:00
Jakob Rath e31926d132 var_queue display 2022-08-01 18:37:11 +03:00
Jakob Rath 6a929f91c8 scoped_ptr_vector usability 2022-08-01 18:37:11 +03:00
Jakob Rath d2fe174320 Add SASSERT_EQ and VERIFY_EQ 2022-08-01 18:37:11 +03:00
Jakob Rath 79ee543d25 Move tbv to util 2022-08-01 18:37:11 +03:00
Bruce Mitchener a89be68050 Use false instead of 0. 2022-08-01 18:28:07 +03:00
Bruce Mitchener fe1e301735 Remove Z3_bool, Z3_TRUE, Z3_FALSE from the API.
These have just been aliases for the standard type `bool` and
values `true` and `false` for a long time now.
2022-08-01 14:25:00 +03:00
Bruce Mitchener 77e5d6ab19 Use nullptr consistently instead of 0 or NULL. 2022-08-01 14:24:32 +03:00
Nikolaj Bjorner bf282b05c8 fix #6213
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-31 18:40:59 +03:00
Nikolaj Bjorner 4a1baa7d2d fix #6165 2022-07-30 17:10:01 +02:00
Bruce Mitchener 5d0dea05aa
Remove empty leaf destructors. (#6211) 2022-07-30 10:07:03 +01:00
Bruce Mitchener fc40e3c510 Remove usages of Z3_bool, just use bool. 2022-07-30 05:49:05 +02:00
Nikolaj Bjorner 2a8e73f34f Merge branch 'master' of https://github.com/z3prover/z3 2022-07-29 23:30:37 +02:00
Nikolaj Bjorner 6d71d9e816 update coding style to C++11
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-29 23:30:33 +02:00
Bruce Mitchener 1eb84fe4b9
Mark override methods appropriately. (#6207) 2022-07-29 23:29:15 +02:00
Bruce Mitchener 8e0d9bf42d
Remove remainder workaround for pre-MSVC2013. (#6204)
This workaround was built for _MSC_VER <= 1700. 1700 was
Visual Studio 2012, which is no longer supported for
building Z3.
2022-07-29 11:50:31 +02:00
Bruce Mitchener eba29a280d
Use std::hexfloat more. (#6203)
Previously, we were only using std::hexfloat on Windows on VS2013
and later.

Since std::hexfloat is part of C++11 and we require C++11 to build
the Z3 library, this should be supported everywhere.
2022-07-29 11:49:56 +02:00
Bruce Mitchener 75339c6db7
Fix doxygen warnings in C API docs. (#6202) 2022-07-29 11:49:24 +02:00
Bruce Mitchener 78237578f3
Enable more tests on non-Windows. (#6199)
Some tests were `#ifdef _WINDOWS` even though they compiled
and ran on other platforms. Remove the #ifdef protections
in these cases.
2022-07-29 11:48:27 +02:00
Nikolaj Bjorner ee80414e55 sketch initial for mpz/mpq numeral creation 2022-07-27 10:46:03 +02:00
Nikolaj Bjorner 8551b217ce fix #6194 2022-07-27 08:03:57 +02:00
Nikolaj Bjorner b6c80e8b00 fix #6193 2022-07-27 04:28:41 +02:00
Nikolaj Bjorner cd7ef11593 add decide callbacks to propagator API
this is an intermediary state. The decide_eh is only partially implemented.
2022-07-27 04:28:41 +02:00
JohnLyu2 3e8daa5965
fix re.range symbolic argument bug in z3str3 (#6189) 2022-07-27 04:24:20 +02:00
Bruce Mitchener 70895b2375
Improve intra-doc linking. (#6191) 2022-07-25 23:14:10 +02:00
Nikolaj Bjorner 43f2b848d4 fix typo
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-25 03:44:12 +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 1155ea69a1 add await
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-22 12:42:19 -07:00
Nikolaj Bjorner 212a0657a2 try .ast
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-22 12:34:07 -07:00
Nikolaj Bjorner 7c0ec21af8 try to add basic expression simplification
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-22 12:21:25 -07:00
Nikolaj Bjorner 4368ec9953 startswith
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-22 11:53:07 -07:00
Nikolaj Bjorner 1e0f71c971 add way to access range bounds directly #6186
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-22 09:35:37 -07:00
Nikolaj Bjorner 87dd837b55 Merge branch 'master' of https://github.com/Z3Prover/z3 2022-07-21 23:22:37 -07:00
Nikolaj Bjorner 89af9df02d add IEnumerable for distinct
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-21 23:22:24 -07:00
Nikolaj Bjorner 0f9684e1f8 make fresh_eh() work for Python bindings of user-propagator 2022-07-21 21:44:02 -07:00
Nikolaj Bjorner 907dc2c2d2 adding toString() to model object
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-21 20:45:45 -07:00
Nikolaj Bjorner efa74fe6c6 fix #6180
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-21 12:20:36 -07:00
Nikolaj Bjorner cf5a8fd248 fix validation code for pb
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-21 08:58:32 -07:00
Nikolaj Bjorner a66095bb08 fix the path to ../build/z3-built
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-20 22:36:34 -07:00
Nikolaj Bjorner dc9565990c did I mess up wasm paths in jest - or not?
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-20 22:15:22 -07:00
Nikolaj Bjorner 37008226c3 did I mess up wasm paths in jest?
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-20 22:14:21 -07:00
Nikolaj Bjorner 32c0d1f636 fix #6168 2022-07-20 21:48:47 -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 32614722ef fix #6176
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-20 21:19:20 -07:00
Nikolaj Bjorner 1b83a4556b fix #6178
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-20 20:48:23 -07:00
Nikolaj Bjorner 5b219aab76 add mutual recursive datatypes to c++ API #6179
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-20 20:32:00 -07:00
Nikolaj Bjorner 2e13c0bf41 add API and example for one dimensional algebraic datatype #6179 2022-07-20 19:43:18 -07:00
Nikolaj Bjorner 81cb575c22 simplify
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-19 22:58:12 -07:00
Nikolaj Bjorner 2e52029114 add command-line overwrite capability to setup.py
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-19 22:53:25 -07:00
Nikolaj Bjorner 2c8df54b70 enable fresh for python wrapper for user-propagator
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-19 13:48:44 -07:00
Nikolaj Bjorner 111d27cbee remove dependency on pragma
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-19 09:36:22 -07:00
Nikolaj Bjorner dead0c9de2 reverting relative path
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-18 11:47:57 -07:00
Nikolaj Bjorner afcfc80c42 the relative path seems out of sync with how it is set up in node.ts 2022-07-18 11:21:16 -07:00
Nikolaj Bjorner 7f1893d781 add missing MkSub to NativeContext
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-18 10:21:27 -07:00
Nikolaj Bjorner 393c63fe0c fix #6114 2022-07-18 09:33:39 -07:00
Nikolaj Bjorner 527914db05 update documentation to use latest conventions
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-17 11:49:28 -07:00
Nikolaj Bjorner b5a89eb4ab add missing generation of z3.z3 for pydoc and add some explanations to logging function declaration 2022-07-17 11:03:55 -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
Nuno Lopes 6e5ced0080 optimizations to api ctx ref counting 2022-07-17 11:44:35 +01:00
Nikolaj Bjorner eb2ee34dfe fix typo
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-16 16:58:57 -07:00
Nikolaj Bjorner aefd336c18 set OCaml default behaivor to enable concurrent dec ref #6160
Add Z3_enable_concurrent_dec_ref to the API.
It is enables behavior of dec_ref functions that are exposed over the API to work with concurrent GC. The API calls to dec_ref are queued and processed in the main thread where context operations take place (in a way that is assumed thread safe as context operations are only allowed to be serialized on one thread at a time).
2022-07-16 16:49:39 -07:00
Nikolaj Bjorner 6c5747a80e guard against lemmas that are already true
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-15 10:03:31 -07:00
Nikolaj Bjorner 4ecb61aeaa neatify
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-07-15 09:53:56 -07:00
Nikolaj Bjorner 2696775088 remove stale assertion
with support for substitutions we allow the simplifier to change the state of equations.
2022-07-15 04:03:25 -07:00
Nikolaj Bjorner 6688c1d62a prepare for #6160
The idea is to set _concurrent_dec_ref from the API
(function not yet provided externally, but you can experiment with it by setting the default of m_concurrent_dec_ref to true).
It then provides concurrency support for dec_ref operations.
2022-07-15 03:53:15 -07:00
Nikolaj Bjorner b29cdca936 integrate factorization to Grobner 2022-07-14 21:24:27 -07:00
Nikolaj Bjorner 7c177584f3 add propagators to grobner 2022-07-14 15:45:07 -07:00
Andrea Lattuada af80bd18ce
Flush the trace stream before displaying sat results (#6162) 2022-07-14 13:43:57 -07:00
Stefan Muenzel 2f5fef92b7
Cache param descrs when modifying solver params (#6156) 2022-07-14 11:11:56 -07:00
Nikolaj Bjorner 4a192850f2 add var_factors
Add routine to partially factor polynomials. It factors out variables.
2022-07-14 11:06:53 -07:00
Nikolaj Bjorner 981c82c814 fix initialization order 2022-07-13 18:11:18 -07:00