diff options
author | makaimann <makaim@stanford.edu> | 2020-12-07 13:39:15 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-07 22:39:15 +0100 |
commit | e7caa82b1def3cab78a95b38841242264124efe7 (patch) | |
tree | 5a05c7f7341c1fd068ec8eb143c9ac4f954878a3 /test/regress/regress1 | |
parent | c94d59516c62b481c7984830cf26753af16100a8 (diff) |
Add bitwise refinement mode for IAND (#5328)
Adds an option to do "bitwise" comparisons in the lazy IAND solver. Instead of creating an exact match for the value of a term using a sum, this would lazily fix groups of bits using integer extracts (divs and mods) when the abstract and concrete values differ at those bits.
For example, with a 1-bit granularity, you might learn a lemma like:
((_ iand 4) x y), value = 1
actual (2, 3) = 2
bv-value = #b0001
bv-actual (#b0010, #b0011) = #b0010
IAndSolver::Lemma: (let ((_let_1 ((_ iand 4) x y)))
(and (and true
(= (mod _let_1 2) (ite (and (= (mod x 2) 1) (= (mod y 2) 1)) 1 0)))
(= (mod (div _let_1 2) 2) (ite (and (= (mod (div x 2) 2) 1) (= (mod (div y 2) 2) 1)) 1 0))))
; BITWISE_REFINE
which is just forcing the bottom two bits of the iand operator result to implement bitwise-AND semantics.
Diffstat (limited to 'test/regress/regress1')
-rw-r--r-- | test/regress/regress1/nl/iand-native-1.smt2 | 6 | ||||
-rw-r--r-- | test/regress/regress1/nl/iand-native-2.smt2 | 1 | ||||
-rw-r--r-- | test/regress/regress1/nl/iand-native-granularities.smt2 | 22 |
3 files changed, 29 insertions, 0 deletions
diff --git a/test/regress/regress1/nl/iand-native-1.smt2 b/test/regress/regress1/nl/iand-native-1.smt2 index 0f50dcaed..051264cfc 100644 --- a/test/regress/regress1/nl/iand-native-1.smt2 +++ b/test/regress/regress1/nl/iand-native-1.smt2 @@ -1,5 +1,11 @@ ; COMMAND-LINE: --iand-mode=value --no-check-models ; COMMAND-LINE: --iand-mode=sum --bvand-integer-granularity=1 --finite-model-find --no-check-models +; COMMAND-LINE: --iand-mode=bitwise +; COMMAND-LINE: --iand-mode=bitwise --bvand-integer-granularity=1 +; COMMAND-LINE: --iand-mode=bitwise --bvand-integer-granularity=2 +; COMMAND-LINE: --iand-mode=bitwise --bvand-integer-granularity=4 +; COMMAND-LINE: --iand-mode=bitwise --bvand-integer-granularity=5 +; COMMAND-LINE: --iand-mode=bitwise --bvand-integer-granularity=6 ; EXPECT: sat (set-logic QF_NIA) (set-info :status sat) diff --git a/test/regress/regress1/nl/iand-native-2.smt2 b/test/regress/regress1/nl/iand-native-2.smt2 index 6b39598ea..a3474784b 100644 --- a/test/regress/regress1/nl/iand-native-2.smt2 +++ b/test/regress/regress1/nl/iand-native-2.smt2 @@ -1,5 +1,6 @@ ; COMMAND-LINE: --iand-mode=value ; COMMAND-LINE: --iand-mode=sum --bvand-integer-granularity=1 +; COMMAND-LINE: --solve-bv-as-int=iand --iand-mode=bitwise ; EXPECT: unsat (set-logic QF_NIA) (set-info :status unsat) diff --git a/test/regress/regress1/nl/iand-native-granularities.smt2 b/test/regress/regress1/nl/iand-native-granularities.smt2 new file mode 100644 index 000000000..92cdfb1ab --- /dev/null +++ b/test/regress/regress1/nl/iand-native-granularities.smt2 @@ -0,0 +1,22 @@ +; COMMAND-LINE: --iand-mode=value --no-check-models +; COMMAND-LINE: --iand-mode=sum --bvand-integer-granularity=1 --finite-model-find --no-check-models +; COMMAND-LINE: --iand-mode=bitwise +; COMMAND-LINE: --iand-mode=bitwise --bvand-integer-granularity=1 +; COMMAND-LINE: --iand-mode=bitwise --bvand-integer-granularity=3 +; COMMAND-LINE: --iand-mode=bitwise --bvand-integer-granularity=4 +; EXPECT: unsat +(set-logic QF_NIA) +(set-info :status unsat) +(declare-fun x () Int) +(declare-fun y () Int) + +(assert (>= x 0)) +(assert (>= y 0)) + +(assert (<= (+ x y) 32)) + +(assert (or + (>= ((_ iand 5) x y) 32) + (>= ((_ iand 6) x y) 32))) + +(check-sat)
\ No newline at end of file |