3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-30 20:35:51 +00:00
Commit graph

33 commits

Author SHA1 Message Date
Nikolaj Bjorner
146d107961 na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-09-07 17:04:32 +02:00
Nikolaj Bjorner
a6643955e6 forbidden interval update
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-09-07 17:00:46 +02:00
Nikolaj Bjorner
978bd9e560 remove scoped
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-08-31 08:55:48 -07:00
Jakob Rath
0c1e44da77
Polysat: constraint refactor cont'd, deduplicate constraints (#5520)
* Assign boolean variables only to long-lived constraints, and deduplicate constraints when they are created

* scoped_signed_constraint

* update other classes

* fix

* Don't use scoped_ptr<constraint> with dedup()
2021-08-30 10:00:27 -07:00
Jakob Rath
ebaea2159e
Polysat: use constraint_literal and begin move to core-based conflict representation (#5489)
* Rename solver_scope for fixplex tests

(otherwise the wrong constructor is called for polysat's solver_scope)

* Update conflict_core

* simplify

* Be clearer about constraint_literal lifetime

* remove old comment

* Remove status (positive/negative) from constraint

* Use constraint_literal in the solver

* Fix build (constraint -> get_constraint)
2021-08-18 11:02:46 -07:00
Nikolaj Bjorner
04ce8ca5ef u256, separate viable_set
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-07-04 23:47:12 -07:00
Nikolaj Bjorner
9e69e1614e na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-07-02 03:33:51 -07:00
Nikolaj Bjorner
788de7d614 na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-07-02 02:48:45 -07:00
Jakob Rath
3436b52c4a
Polysat: refactor constraints (#5372)
* Refactor: remove sign and dep from constraint

* fix some bugs

* improve log messages

* Add missing premises to lemma

* Rename getter in an attempt to fix linux build
2021-06-25 11:04:25 -07:00
Nikolaj Bjorner
db242c28c6 make it C++17 friendly
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-06-23 15:20:59 -07:00
Jakob Rath
20a5baeb70
Polysat: expand conflict explanation rules (#5366)
* update example to match slides

* Add normalized view of inequalities

* workaround

* Add a conflict explanation rule

* unit clauses should be asserted at the base level

* Add src constraint to interval

* support non-strict case in first rule

* print conflict constraints only once

* update second rule

* update third rule as well
2021-06-23 10:12:39 -07:00
Jakob Rath
d7b8ea2f7f
Polysat: minor fixes (#5364)
* update include paths

* bdd fixes

* update/fix some tests

* work around assertion failure when constraint from clause becomes unit

* Remove old code

* use clause_builder

* Verify model when returning SAT

* log

* fix
2021-06-22 09:27:18 -07:00
Nikolaj Bjorner
ce5c8b3066 rename to some saner name
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-06-21 16:19:37 -07:00
Nikolaj Bjorner
63f3c841d8 remove var_constraint to get rid of bdd dependencies
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-06-21 16:14:30 -07:00
Nikolaj Bjorner
6f93ed8dc2 moving out viable functionality
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-06-21 15:50:04 -07:00
Nikolaj Bjorner
19099244c4 na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-06-20 12:38:20 -07:00
Nikolaj Bjorner
4066087138 pretty printing
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-06-20 09:49:31 -07:00
Jakob Rath
3e1cfcd538
Polysat: conflict explanation prototype (#5353)
* display constraint's extra info in one place

* Add stub for conflict explainer

* Add helper functions to check whether constraint is active at base level

* Add helper class tmp_assign

* Add clause_builder; it skips unnecessary literals during clause creation

* some fixes

* Use clause_builder for forbidden intervals

* remove old comments

* fixes/comments in solver

* print redundant clauses

* First pass at conflict_explainer

* remove unused model class

* Choose value for k

* also print min/max k
2021-06-17 10:35:32 -05:00
Jakob Rath
8757f04d20
Polysat: disjunctive lemmas (#5311)
* Add macro to disable linear solver for development

* Move new_* and add_* to header

* Add ref_vector_core::push_back(ref<T>&&)

* Attempt to simplify lifetime handling

* Make operator bool() explicit

* clause improvements

* display boolean assignment

* clause::resolve

* bug fixes

* more fixes

* final case of backtrack
2021-05-28 13:53:08 -07:00
Jakob Rath
28996429df
Polysat disjunctive lemmas (WIP) (#5275)
* Extend search state by boolean literals

* Only resolve against positive equality

* mk_dep_ref

* Make clause non-owning

* scoped_clause

* Use scoped_clause

* minor

* scoped_ptr move assignment

* WIP: internal handling of disjunctive constraints

* leaf_value

* disjunctive constraints continued

* Fix bool_lit

* Actually add constraints to storage

* Some fixes

* more fixes

* constraint should have a bool_lit instead of a bool_var

* propagate(bool_lit)

* updates

* interface changes

* small fixes

* Make sat::dimacs_lit's constructor explicit

(otherwise, calling operator<< with sat::literal is ambiguous)

* Use sat::literal

* Print test name at the beginning

* Convention: constraint corresponds to the positive boolean literal

* Make constraint ownership more explicit

* clause stores literals
2021-05-21 13:50:25 -07:00
Jakob Rath
fd1758ffab
Polysat: check test results, forbidden intervals for coefficient -1 (#5241)
* Use scoped_ptr for condition

* Check solver result in unit tests

* Add test for unusual cjust

* Add solver::get_value

* Broken assertion

* Support forbidden interval for coefficient -1
2021-05-04 09:33:55 -07:00
Jakob Rath
f7e476a4a0
Polysat: fixes in solver, forbidden intervals for eq_constraint (#5240)
* Rename to neg_cond

* Add some logging utilities

* Implement case of forbidden interval covering the whole domain

* Implement diseq_narrow

* Do not activate constraint if we are in a conflict state

* comments

* Assert that lemma isn't undefined

* Update revert_decision to work in the case where narrowing causes propagation

* Fix case of non-disjunctive lemma from forbidden intervals

* Conflict should not leak outside user scope

* Add guard to decide(), some notes

* Add test case

* Add constraints to watchlist of unassigned variable during propagation

* Move common propagation functionality into base class

* Combine eq/diseq narrow

* Compute forbidden interval for equality constraints by considering them as p <=u 0 (or p >u 0 for disequalities)
2021-05-03 09:30:17 -07:00
Nikolaj Bjorner
efbb382646 na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-04-27 22:52:59 -07:00
Jakob Rath
9e505d60f0
Separate constraint creation from activation; add sign/polarity to constraints (#5217)
* Separate constraint creation from activation

* Basic recursive handling of disjunctive lemmas for unit tests

* Set learned constraint to true immediately

* Preliminary support for negated constraints
2021-04-26 09:55:58 -07:00
Jakob Rath
2fac9e6e66
Add propagate/narrow for ule_constraint (#5214)
* Add helper to check whether pdd is univariate and linear

* Reorganize propagate/narrow of eq_constraint

* Implement propagate/narrow for ule constraints

* Also push trail instruction in push_viable
2021-04-23 08:41:02 -07:00
Jakob Rath
12444c7e8b
Phase saving and some minor changes (#5209)
* Implement phase saving

* Implement signed comparison on BDD vectors

* Add fdd::non_zero

* Simplify construction of fdds over disjoint variables

* Minor changes to adding constraint
2021-04-22 09:47:46 -07:00
Jakob Rath
77350d97da
BDD vectors: add subtract and quot_rem, move finite domain abstraction out of bdd_manager (#5201)
* Coding style

* Simplify bddv class

* mk_eq: run loop from below

* Add unit test for bddv unsigned comparison

* Add test that shows contains_num/find_num fail after reordering

* Add BDD vector subtraction

* Call apply_rec in mk_ite_rec instead of apply

* Question about mk_quant

* Implement quot_rem over BDD vectors

* Move shl/shr to bddv

* Make unit test smaller

* Add class dd::fdd to manage association between BDDs and numbers

* Remove contains_num/find_num from bdd_manager
2021-04-20 09:09:32 -07:00
Jakob Rath
4da1b7b03c
Add functionality for BDD vectors (#5198)
* Fix XOR over BDDs

* Add operator<< for find_int_t

* Add equality assertion macro that prints expression values on failure

* Adapt contains_int and find_int to take externally-defined bits

* Add more operations on BDD vectors

* Remove old functions

* Additional bddv functions

* Rename some things

* Make bddv a class and add operators

* Fix find_num/contains_num calls
2021-04-19 09:05:19 -07:00
Nikolaj Bjorner
572197aede add some code review comments, stubs for ule
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-04-16 12:43:23 -07:00
Jakob Rath
f72e30e539
Add BDD utilities; use them for narrowing/propagation of linear equality constraints (#5192)
* Add a few helper methods for encoding sets of integers as BDDs

* Use BDD functions in solver

* Add bdd::find_int

* Use bdd::find_int in solver

* Add narrowing for linear equality constraints

* Simplify code for linear propagation

* Add test for later

* Narrowing can only handle linear constraints with a single variable

* Need to push_cjust
2021-04-16 08:44:18 -07:00
Nikolaj Bjorner
e970fe5034 sketch bit-constraints
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-04-15 23:04:25 -07:00
Nikolaj Bjorner
549b984c88 move to self-contained trail instructions
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-04-15 17:38:36 -07:00
Nikolaj Bjorner
2eadcd586a add new file for eq_constraint
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-04-15 14:34:01 -07:00