3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-27 10:55:50 +00:00
Commit graph

2054 commits

Author SHA1 Message Date
Jakob Rath
6caa3ba1b7 Skip redundant intervals in viable::resolve (disabled for now) 2022-10-03 11:03:05 +02:00
Jakob Rath
0b560e5117 Improve sharing 2022-10-03 10:57:56 +02:00
Jakob Rath
cd2d197bb9 Add compact version of std::all_of 2022-10-03 10:55:13 +02:00
Jakob Rath
05442e8788 lemma_invariant 2022-09-30 13:12:47 +02:00
Jakob Rath
5e54cd3e44 Add basic support for not, or, xor, nand, nor via rewriting 2022-09-30 13:02:32 +02:00
Jakob Rath
9b907d709f minor 2022-09-29 18:25:28 +02:00
Jakob Rath
8242069ba6 One more case for ule_constraint::is_always_false 2022-09-29 18:22:31 +02:00
Jakob Rath
6218931dde We only need one of is_true/is_false 2022-09-29 17:19:47 +02:00
Jakob Rath
79c82a3d97 update ule_constraint::is_currently_true 2022-09-29 17:02:30 +02:00
Jakob Rath
8d803a1266 Move unfinished make_asserting code 2022-09-28 19:19:33 +02:00
Jakob Rath
0dae3bad6a Fix subsumption terminology 2022-09-28 15:35:05 +02:00
Jakob Rath
7be82a36f2 Recognize x != k among new literals in lemma 2022-09-28 15:16:05 +02:00
Jakob Rath
6715058876 Simplify equations into canonical form
Also simplify constraints that are always false due to parity
2022-09-28 13:22:17 +02:00
Jakob Rath
480ba01cb0 Log ule rewrites 2022-09-28 11:01:23 +02:00
Jakob Rath
e08e124790 Expand always-false check 2022-09-28 10:57:40 +02:00
Jakob Rath
27b31c88d2 re-enable ule rewrite 2022-09-28 10:53:55 +02:00
Jakob Rath
d09e3eaa37 Update notes 2022-09-27 18:00:30 +02:00
Jakob Rath
0f993e3977 New constraints need to be eval'd 2022-09-27 17:56:26 +02:00
Jakob Rath
74d8497ed9 Fix subsumption for unilinear case 2022-09-27 17:53:45 +02:00
Jakob Rath
1df749ad33 Merge branch 'master' into polysat 2022-09-23 17:14:26 +02:00
Jakob Rath
49590e0e01 Conflict from viable_fallback also depends on the current assignment 2022-09-23 16:45:56 +02:00
Jakob Rath
4e4b4fdd06 subsumption notes 2022-09-23 16:45:23 +02:00
Jakob Rath
3c60c418e7 fix assertion 2022-09-23 16:15:38 +02:00
Jakob Rath
0a0953ae78 Reduce log output 2022-09-23 16:12:39 +02:00
Jakob Rath
8ed6938cbe remove/update comment 2022-09-23 16:06:14 +02:00
Jakob Rath
4312611bd6 nicer lit_pp 2022-09-23 16:06:14 +02:00
Jakob Rath
a4f0e3a228 Add level to conflict
- reset conflict at correct level when popping user scopes
- functions as flag when handling inconsistent input (e.g., opposite literals)
- now all constraints in the conflict core should have bvalue == l_true
2022-09-23 16:06:14 +02:00
Jakob Rath
86d00b536a move todo notes to cpp file 2022-09-23 15:45:53 +02:00
Nikolaj Bjorner
0888f92efd remove 'change' just return
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-09-21 08:53:00 -07:00
Jakob Rath
1020f38e1a reconnect saturation 2022-09-21 16:47:16 +02:00
Jakob Rath
6abe0c9be8 set, lemma, minor 2022-09-21 16:29:36 +02:00
Jakob Rath
2f65ce1026 try to fix build 2022-09-21 14:03:07 +02:00
Jakob Rath
b43971bb4a Connect conflict2 2022-09-21 12:14:44 +02:00
Jakob Rath
a978604a7e move files (conflict2 -> conflict) 2022-09-20 10:26:38 +02:00
Nikolaj Bjorner
48d5a98edc meeting notes
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-09-19 09:10:11 -07:00
Jakob Rath
806571d2cd backjumping/notes 2022-09-19 16:43:11 +02:00
Jakob Rath
a416e16566 conflict2 2022-09-19 16:01:45 +02:00
Nikolaj Bjorner
a6a5985f8e fix #6341
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-09-13 17:19:48 -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
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
6f2a6da600 address unused variable warnings
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2022-08-28 18:50:54 -07:00
Jakob Rath
68e313ed24 use unsat_core from viable_fallback 2022-08-26 16:36:26 +02:00
Jakob Rath
acf9976df9 make it compile 2022-08-26 16:28:52 +02:00
Jakob Rath
f819c2bad8 conflict2 stub 2022-08-25 17:04:07 +02:00
Jakob Rath
b31931bb9f disable assertions for now; some notes 2022-08-25 16:40:38 +02:00
Jakob Rath
41b74ab215 newline is implicit 2022-08-25 16:37:38 +02:00
Jakob Rath
e39e1dcc49 Extract inference_logger 2022-08-25 16:03:17 +02: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