3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-07 01:54:08 +00:00
Commit graph

17017 commits

Author SHA1 Message Date
Nikolaj Bjorner ff679e0fce increment version number 2022-09-11 19:02:44 -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
Thomas Pani adf6e98cdf
Handle _out(STRING) parameters in Java API (#6325) 2022-09-06 15:29:12 -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 8e6f17ebd0 inc version
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-09-03 15:47:12 -07:00
Nikolaj Bjorner 1382cdefea release notes
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-09-03 10:04:48 -07: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
John Fleisher f72cdda5fb
Change to 4 digit assembly version (#6297)
* WiP: test build specific version number

* update mk_win_dist for assembly-version

* Add print statements for version

* remove stray semicolon

* undo quote change in projectstr

* nit fixes

* revert print formatting for Mac build

* fix spaces
2022-08-31 06:46:06 -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