3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-23 19:47:52 +00:00
Commit graph

613 commits

Author SHA1 Message Date
Nikolaj Bjorner
4405fa1156 add handling of misc operations
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-06-18 14:30:56 -07:00
Nikolaj Bjorner
3da37f4fb5 add unit test driver
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-06-18 10:58:42 -07:00
Nikolaj Bjorner
d72724f7fd merge master
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-06-18 10:04:38 -07:00
Jakob Rath
c4963f4381
Polysat: add two more prototype rules (#5355)
* Add try_div to PDDs

* x>y is false when x==y

* First version of the other two prototype rules

* More band-aid fixes...
2021-06-18 08:48:50 -07:00
Jakob Rath
1fe7dc40fe
Polysat: add simpler monotonicity unit test + minor changes (#5348)
* Add simpler versions of monotonicity puzzle

* band-aid fix to conflicts during revert_decision

* minor changes
2021-06-15 12:18:37 -05:00
Jakob Rath
9cc78ef98e
Polysat: unit testing minor changes (#5326)
* Use check instead of check_sat in tests

* First steps at standalone entry point
2021-06-01 10:12:51 -07:00
Nikolaj Bjorner
5ad486901e na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-05-21 18:03:05 -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
alexandernutz
49e9782238
Fixedpoint unit tests and transcribed bv puzzle (#5291)
* simple fixed point arithmetic tests

* transcribe puzzle
2021-05-21 09:24:25 -07:00
Nikolaj Bjorner
26893005c7 Merge branch 'master' of https://github.com/z3prover/z3 into polysat 2021-05-20 15:28:32 -07:00
Nikolaj Bjorner
03d2c5f3d0 consolidate literals 2021-05-20 12:58:27 -07:00
alexandernutz
8a5addd891
make the two monotonicity tests into one using push/pop; fix division modelling (#5220)
* make the two monotonicity tests into one using push/pop

* whitespace...

* proper division modelling for monotonicity test -- overflow checks still missing, though

* double bitwidth for overflow checking in monotonicity example
2021-05-20 10:00:13 -07:00
Nikolaj Bjorner
0d776ecf88 eliminate basic variables from new rows
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-05-12 15:58:35 -07:00
Nikolaj Bjorner
62b7719d5a separate into self-contained mod interval
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-05-11 11:22:55 -07:00
Nikolaj Bjorner
04c0db75bf test eqs1
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-05-10 21:21:50 -07:00
Nikolaj Bjorner
be7b964206 fix row pivot/del
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-05-10 19:53:34 -07:00
Nikolaj Bjorner
0b6c7cd7b4 na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-05-09 20:13:33 -07:00
Nikolaj Bjorner
e3e2860198 move to interval arithmetic
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-05-07 15:32:56 -07:00
Nikolaj Bjorner
d33b9f2698 a test
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-05-06 19:09:31 -07:00
Nikolaj Bjorner
b5d1b0336a na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-05-06 19:00:51 -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
Nikolaj Bjorner
5791b41133 more testing of fixplex
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-05-03 16:31:00 -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
57a7bef96b na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-05-01 13:58:34 -07:00
Nikolaj Bjorner
20277f4a3f test 1
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-05-01 13:10:34 -07:00
Nikolaj Bjorner
82a364ed7b compile
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-04-30 17:53:09 -07:00
Jakob Rath
0c4824f194
Polysat: forbidden intervals updates (#5230)
* Pop assign_eh

* Fix scoped_ptr_vector constructors, add detach()

* Need to copy the returned lemma

* Add test

* Basic inequality tests

* Return disjunctive lemma to caller
2021-04-30 08:41:50 -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
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
Nikolaj Bjorner
fc60690742 tidy, initial polysat
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-04-20 12:21:50 -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
alexandernutz
bc695a5a97
monotonicity unit tests (#5202)
* monotonicity unit tests

* indentation
2021-04-20 09:09:17 -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
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
549b984c88 move to self-contained trail instructions
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-04-15 17:38:36 -07:00
Jakob Rath
cb9dda19dd
Polysat (#5187)
* test_l2 works now

* Linear propagation: test whether a is odd

* Linear propagation with even coefficients (wip)
2021-04-15 08:37:14 -07:00
Jakob Rath
7067fc16ae
Test and fix PDD subst_val (#5185) 2021-04-15 08:35:46 -07:00
Nikolaj Bjorner
9a2b7677bf na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-04-14 22:03:28 -07:00
Nikolaj Bjorner
a45687d5db add very basic unit tests
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-04-14 05:03:44 -07:00
Jakob Rath
324d9ed461
Add more PDD utilities (div, pow) (#5180)
* Expose 'inv' on rationals to get reciprocal value

* Align parameter names with implementation

* Add cached operation that divides PDD by a constant

* Fix display for constant PDDs

* operator^ should probably call ^ instead of + (mk_xor instead of add)

* Add helper function 'pow' on PDDs
2021-04-14 04:48:42 -07:00
Nikolaj Bjorner
2f7069a8b7 move include path in test
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-04-14 04:06:50 -07:00
Nikolaj Bjorner
21baa2a70a Merge branch 'master' of https://github.com/z3prover/z3 into polysat 2021-04-14 03:51:12 -07:00
Nikolaj Bjorner
4a6083836a call it data instead of c_ptr for approaching C++11 std::vector convention. 2021-04-13 18:17:35 -07:00
Jakob Rath
0e9fc4762a Fix PDD factor cache in case GC happens while factoring (#5170)
* Add method to find largest power of two that is a divisor

* Binary resolve on PDDs

* Add unit tests for binary resolve

* Fix factor cache access in case GC happens while factoring

* Coding conventions

* Change to gc_generation
2021-04-12 11:20:40 -07:00
Jakob Rath
75c87a2869 Test and memoize pdd factoring (#5163)
* Test and fix pdd_manager::factor

* Memoize pdd_manager::factor

* Fix Windows build (maybe)
2021-04-12 11:20:40 -07:00
Jakob Rath
f8562380d6 Fix pdd_manager::degree(PDD, unsigned) and add unit tests (#5155)
* Fix pdd_manager::degree(PDD, unsigned) and add unit tests

* Another marking opportunity
2021-04-12 11:20:40 -07:00
Nikolaj Bjorner
446654b680 na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-04-12 11:20:39 -07:00
Nikolaj Bjorner
52d37f131d na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-04-12 11:20:38 -07:00
Nikolaj Bjorner
bd04b5e8bd add testing stubs
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-04-12 11:20:36 -07:00
Nikolaj Bjorner
23ae7e59d6 add unit test stub
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
2021-04-12 11:20:35 -07:00