3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-05-05 23:05:46 +00:00
Commit graph

58 commits

Author SHA1 Message Date
Nikolaj Bjorner
bf258ee29d add bit shorthand 2021-12-09 15:25:44 -08:00
Nikolaj Bjorner
a4fc63c542 initial overflow test
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-12-09 14:39:00 -08:00
Nikolaj Bjorner
0dcaf9b9f9 add ovfl constraint
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-12-09 09:05:23 -08:00
Nikolaj Bjorner
57c40e480b na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-11-08 05:08:57 -08:00
Nikolaj Bjorner
813674087e wip 2021-10-04 14:43:33 -07:00
Nikolaj Bjorner
95e2d174c7 fixes
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-09-25 17:26:18 -07:00
Nikolaj Bjorner
a574eebd05 fixes, tests 2021-09-25 08:38:48 -07:00
Nikolaj Bjorner
e6c413b249 add variable minimization 2021-09-22 14:27:05 -07:00
Nikolaj Bjorner
c82bbaad7d update todos, working on assignment minimization 2021-09-22 13:29:36 -07:00
Nikolaj Bjorner
ce12c51083 remove last references to unit clauses
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-09-20 17:36:07 -07:00
Nikolaj Bjorner
8ee54c665a removing unit clauses and dependency manager, use minisat approach by tracking assumption literals directly also in clauses
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-09-20 15:10:03 -07:00
Nikolaj Bjorner
bb5ff8db24 rename conflict_core to conflict:
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-09-20 14:05:55 -07:00
Nikolaj Bjorner
c69c316b27 enable reduce_by, more tests 2021-09-19 13:41:39 -04:00
Nikolaj Bjorner
58c66ffee8 remove propagate_bool_at, it is technically not propagating but assigning 2021-09-19 08:47:14 -04:00
Nikolaj Bjorner
02a38009b9 remove disjunctive lemma feature 2021-09-19 07:33:20 -04:00
Nikolaj Bjorner
fa3886136b adding Boolean propagation, watch; and factoring 2021-09-18 22:18:15 -04:00
Nikolaj Bjorner
689c5b4e12 generalize level
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-09-15 16:46:30 +01:00
Jakob Rath
43fef8e8ba External constraints need to remember their sign 2021-09-14 09:50:07 +02:00
Jakob Rath
18710a86d7 print clauses 2021-09-13 17:44:19 +02:00
Nikolaj Bjorner
c082ea4357 update dep
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-09-13 17:35:36 +02:00
Nikolaj Bjorner
b36bc11b85 remove eq constraint, fix gc for external constraints
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-09-11 20:09:28 +02:00
Nikolaj Bjorner
f8a3857adb comments
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-09-11 16:55:49 +02:00
Nikolaj Bjorner
516ca06c28 levels take 1
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-09-10 15:40:25 +02:00
Nikolaj Bjorner
cfe4b30419 admit inequalities as premises
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-09-09 17:06:32 +02:00
Jakob Rath
56b33b1b3e resolve_bailout etc. 2021-09-06 14:08:07 +02:00
Jakob Rath
9f387f5738
Polysat: conflict resolution updates (#5534)
* variable elimination / saturation sketch

* conflict resolution updates
2021-09-03 10:17:06 -07:00
Jakob Rath
dc547510db
Polysat: conflict resolution wip (#5529)
* conflict_core doesn't need gc() anymore

* update comments, ensure_bvar for new constraints

* Make sure constraints can only be created through constraint_manager

* fix constraint::display if no boolean variable is assigned

* Move clause into separate file

* Add conflict_core binary resolution

* conflict_core additions

* reactivate conflict resolution outer loop

* wip

* seems commented includes break CI build
2021-09-01 09:10:10 -07:00
Nikolaj Bjorner
978bd9e560 remove scoped
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-08-31 08:55:48 -07:00
Jakob Rath
dde8fb0c37
Polysat updates (#5524)
* Move boolean resolution into conflict_core

* Move store() into dedup functionality

* comments

* Call gc()

* Add inference_engine sketch
2021-08-31 08:16:45 -07:00
Nikolaj Bjorner
d1118cb178 cc
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-08-30 11:45:41 -07:00
Nikolaj Bjorner
7cff3d4236 more code review
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-08-30 11:37:08 -07:00
Nikolaj Bjorner
7ea1bf12b6 add code review to constraint
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-08-30 11:11:55 -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
Jakob Rath
8a773d2bee
Polysat updates (#5444)
* Simplify adding lemmas

* Remove misleading constructor from tmp_assign.

The idea is that tmp_assign is only created on the stack and
short-lived.  Instead of having a convenience constructor that takes a
constraint_ref, it's clearer to have an explicit .get() at the call
site.

* Remove some log messages

* bugfix

* fix

* Add stub for conflict_core

* wip

* Add example by Clemens
2021-07-30 11:14:19 -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
dec37aee34 na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-06-22 21:01:17 -07:00
Nikolaj Bjorner
01c81405af remove var-constraint alltogether
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-06-22 20:58:32 -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
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
Nikolaj Bjorner
b22928bfc9 na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-05-22 14:16:50 -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
Nikolaj Bjorner
88bbe9d54e na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-05-15 10:12:11 -07:00
Nikolaj Bjorner
683ce27c8f linear solver
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-05-14 17:10:01 -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
Jakob Rath
f83705bf9f
Polysat: first pass at forbidden intervals (not yet fully integrated into solver) (#5227)
* Add interval class

* Take dependency as const reference

* Compute forbidden intervals for ule-constraints

* Add class for evaluated interval

* We need the evaluated bounds as well

* Don't add constraint to cjust multiple times (hack, to be improved later)

* typo

* More interval helpers

* Add constraint::ult factory function

* Fix forbidden interval condition

* Add solver::has_viable

* Add conflict explanation using forbidden intervals (not yet fully integrated into solver)
2021-04-29 10:12:54 -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