Currently, the int-blaster translates shifts using an ite whose size is the bit-width.
This PR adds an option to use the internal pow2 operator instead.
name = "bitwise"
help = "Introduce a UF operator for bvand, and eagerly add bitwise lemmas"
+[[option]]
+ name = "bvToIntUsePow2"
+ category = "undocumented"
+ long = "bv-to-int-use-pow2"
+ type = "bool"
+ default = "false"
+ help = "use internal pow2 operator when translating shift notes"
+
[[option]]
name = "BVAndIntegerGranularity"
category = "expert"
Node y = children[1];
// shifting by const is eliminated by the theory rewriter
Assert(!y.isConst());
+
+ // if we use the internal pow2 operator, the translation does not
+ // have any ites
+ if (options().smt.bvToIntUsePow2)
+ {
+ Node pow2Node = d_nm->mkNode(kind::POW2, y);
+ if (isLeftShift)
+ {
+ return d_nm->mkNode(kind::INTS_MODULUS_TOTAL,
+ d_nm->mkNode(kind::MULT, x, pow2Node),
+ pow2(bvsize));
+ }
+ else
+ {
+ return d_nm->mkNode(kind::INTS_DIVISION_TOTAL, x, pow2Node);
+ }
+ }
+
+ // if we do not use the internal pow2 operator, we use ites.
Node ite = d_zero;
Node body;
for (uint64_t i = 0; i < bvsize; i++)
; COMMAND-LINE: --solve-bv-as-int=sum --bvand-integer-granularity=1
-; COMMAND-LINE: --solve-bv-as-int=bitwise --bvand-integer-granularity=1
+; COMMAND-LINE: --solve-bv-as-int=sum --bv-to-int-use-pow2 --bvand-integer-granularity=1
; EXPECT: unsat
(set-logic QF_BV)
(declare-fun a () (_ BitVec 8))
; COMMAND-LINE: --solve-bv-as-int=sum --bvand-integer-granularity=1 --no-check-unsat-cores
+; COMMAND-LINE: --solve-bv-as-int=sum --bv-to-int-use-pow2 --bvand-integer-granularity=1 --no-check-unsat-cores
; COMMAND-LINE: --solve-bv-as-int=bitwise --bvand-integer-granularity=1 --no-check-unsat-cores
; COMMAND-LINE: --solve-bv-as-int=sum --bvand-integer-granularity=5 --no-check-unsat-cores
; COMMAND-LINE: --solve-bv-as-int=bitwise --bvand-integer-granularity=5 --no-check-unsat-cores
; COMMAND-LINE: --solve-bv-as-int=sum --bvand-integer-granularity=1
-; COMMAND-LINE: --solve-bv-as-int=bitwise --bvand-integer-granularity=1
+; COMMAND-LINE: --solve-bv-as-int=sum --bvand-integer-granularity=1 --bv-to-int-use-pow2
; EXPECT: sat
(set-logic QF_BV)
(declare-fun s () (_ BitVec 4))
; COMMAND-LINE: --solve-bv-as-int=sum --no-check-models
+; COMMAND-LINE: --solve-bv-as-int=sum --bv-to-int-use-pow2 --no-check-models
; EXPECT: sat
(set-logic BV)
(declare-fun s () (_ BitVec 3))
; COMMAND-LINE: --solve-bv-as-int=bv
; COMMAND-LINE: --solve-bv-as-int=sum
+; COMMAND-LINE: --solve-bv-as-int=sum --bv-to-int-use-pow2
; COMMAND-LINE: --solve-bv-as-int=iand --iand-mode=sum
; COMMAND-LINE: --solve-bv-as-int=iand --iand-mode=bitwise
; COMMAND-LINE: --solve-bv-as-int=iand --iand-mode=value
; COMMAND-LINE: --cegqi-all --full-saturate-quant --bvand-integer-granularity=1 --solve-bv-as-int=sum
+; COMMAND-LINE: --cegqi-all --full-saturate-quant --bvand-integer-granularity=1 --solve-bv-as-int=sum --bv-to-int-use-pow2
; EXPECT: unsat
(set-logic BV)
(declare-fun s () (_ BitVec 4))