diff options
author | makaimann <makaim@stanford.edu> | 2020-03-09 21:13:21 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-09 21:13:21 -0700 |
commit | 5cbc35e70c2a80094dade1a58605882e3eb1d326 (patch) | |
tree | 5ec95a56e934b8aeb119ba8ad289ae720401013c /test | |
parent | 0e09af0be57ec4df28869e4383a40d847c0a6b5a (diff) |
Enhancement: make the bool-to-bv pass more robust and targeted (#3021)
This pull request is an improvement to the bool-to-bv preprocessing pass. The existing pass is both too weak and too strong, depending on the circumstance. Throughout this description, "lower" refers to lowering a boolean to a bit-vector.
Diffstat (limited to 'test')
-rw-r--r-- | test/regress/CMakeLists.txt | 3 | ||||
-rw-r--r-- | test/regress/regress0/bv/bool-to-bv-all-array-bool.smt2 | 21 | ||||
-rw-r--r-- | test/regress/regress0/bv/bool-to-bv-all-test.smt2 | 20 | ||||
-rw-r--r-- | test/regress/regress0/bv/bool-to-bv-ite-array-bool.smt2 | 21 |
4 files changed, 65 insertions, 0 deletions
diff --git a/test/regress/CMakeLists.txt b/test/regress/CMakeLists.txt index 046b073ff..e0e8b236e 100644 --- a/test/regress/CMakeLists.txt +++ b/test/regress/CMakeLists.txt @@ -189,6 +189,9 @@ set(regress_0_tests regress0/bv/ackermann8.smt2 regress0/bv/bool-model.smt2 regress0/bv/bool-to-bv-all.smt2 + regress0/bv/bool-to-bv-all-array-bool.smt2 + regress0/bv/bool-to-bv-ite-array-bool.smt2 + regress0/bv/bool-to-bv-all-test.smt2 regress0/bv/bool-to-bv-ite.smt2 regress0/bv/bug260a.smtv1.smt2 regress0/bv/bug260b.smtv1.smt2 diff --git a/test/regress/regress0/bv/bool-to-bv-all-array-bool.smt2 b/test/regress/regress0/bv/bool-to-bv-all-array-bool.smt2 new file mode 100644 index 000000000..2a0c9d7b1 --- /dev/null +++ b/test/regress/regress0/bv/bool-to-bv-all-array-bool.smt2 @@ -0,0 +1,21 @@ +; COMMAND-LINE: --bool-to-bv=all --simplification=none +; EXPECT: sat +; checks that bool-to-bv pass handles arrays over booleans correctly +(set-logic QF_ABV) + +(declare-const A (Array Bool Bool)) +(declare-const B (Array Bool Bool)) +(declare-const b1 Bool) +(declare-const b2 Bool) +(declare-const b3 Bool) +(declare-const b4 Bool) + +(assert (= A (store B b1 b2))) +(assert (= b3 (select A (select B b2)))) +(assert (=> b1 b2)) +(assert (not (and b2 (ite b3 b1 b2)))) +(assert (=> b3 b1)) +(assert (= b4 (select B b2))) +(assert (xor b4 b2)) + +(check-sat)
\ No newline at end of file diff --git a/test/regress/regress0/bv/bool-to-bv-all-test.smt2 b/test/regress/regress0/bv/bool-to-bv-all-test.smt2 new file mode 100644 index 000000000..d1ebf24ff --- /dev/null +++ b/test/regress/regress0/bv/bool-to-bv-all-test.smt2 @@ -0,0 +1,20 @@ +; COMMAND-LINE: --bool-to-bv=all +; EXPECT: sat +; checks for a bug that can occur when forcing booleans to +; bit-vectors when other sorts are present +(set-logic QF_ABV) + +(declare-const A (Array (_ BitVec 32) (_ BitVec 32))) +(declare-const B (Array (_ BitVec 32) (_ BitVec 32))) +(declare-const sel Bool) +(declare-const idx (_ BitVec 32)) +(declare-const val (_ BitVec 32)) + +(assert (=> sel (bvult idx (_ bv15 32)))) +(assert (=> (= A (store B idx val)) sel)) +(assert (=> (= A (store B idx val)) (not (= idx val)))) +(assert (not (= A B))) +(assert (=> (not (= A (store B idx val))) (not sel))) +(assert (=> (not (= A (store B idx val))) (bvugt idx val))) + +(check-sat) diff --git a/test/regress/regress0/bv/bool-to-bv-ite-array-bool.smt2 b/test/regress/regress0/bv/bool-to-bv-ite-array-bool.smt2 new file mode 100644 index 000000000..2a0c9d7b1 --- /dev/null +++ b/test/regress/regress0/bv/bool-to-bv-ite-array-bool.smt2 @@ -0,0 +1,21 @@ +; COMMAND-LINE: --bool-to-bv=all --simplification=none +; EXPECT: sat +; checks that bool-to-bv pass handles arrays over booleans correctly +(set-logic QF_ABV) + +(declare-const A (Array Bool Bool)) +(declare-const B (Array Bool Bool)) +(declare-const b1 Bool) +(declare-const b2 Bool) +(declare-const b3 Bool) +(declare-const b4 Bool) + +(assert (= A (store B b1 b2))) +(assert (= b3 (select A (select B b2)))) +(assert (=> b1 b2)) +(assert (not (and b2 (ite b3 b1 b2)))) +(assert (=> b3 b1)) +(assert (= b4 (select B b2))) +(assert (xor b4 b2)) + +(check-sat)
\ No newline at end of file |