diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/preprocessing/passes/bv_to_int.cpp | 8 | ||||
-rw-r--r-- | src/smt/set_defaults.cpp | 19 | ||||
-rw-r--r-- | src/theory/bv/theory_bv_rewriter.cpp | 13 |
3 files changed, 30 insertions, 10 deletions
diff --git a/src/preprocessing/passes/bv_to_int.cpp b/src/preprocessing/passes/bv_to_int.cpp index b6f53f8c2..ad2707035 100644 --- a/src/preprocessing/passes/bv_to_int.cpp +++ b/src/preprocessing/passes/bv_to_int.cpp @@ -408,6 +408,14 @@ Node BVToInt::translateWithChildren(Node original, returnNode = translated_children[0]; break; } + case kind::INT_TO_BITVECTOR: + { + // ((_ int2bv n) t) ---> (mod t 2^n) + size_t sz = original.getOperator().getConst<IntToBitVector>().d_size; + returnNode = d_nm->mkNode( + kind::INTS_MODULUS_TOTAL, translated_children[0], pow2(sz)); + } + break; case kind::BITVECTOR_AND: { // We support three configurations: diff --git a/src/smt/set_defaults.cpp b/src/smt/set_defaults.cpp index b9095c91b..31d14c569 100644 --- a/src/smt/set_defaults.cpp +++ b/src/smt/set_defaults.cpp @@ -163,15 +163,6 @@ void setDefaults(LogicInfo& logic, bool isInternalSubsolver) } } - /* Only BVSolver::LAZY natively supports int2bv and nat2bv, for other solvers - * we need to eagerly eliminate the operators. */ - if (options::bvSolver() == options::BVSolver::SIMPLE - || options::bvSolver() == options::BVSolver::BITBLAST) - { - opts.bv.bvLazyReduceExtf = false; - opts.bv.bvLazyRewriteExtf = false; - } - /* Disable bit-level propagation by default for the BITBLAST solver. */ if (options::bvSolver() == options::BVSolver::BITBLAST) { @@ -198,6 +189,8 @@ void setDefaults(LogicInfo& logic, bool isInternalSubsolver) if (options::solveBVAsInt() != options::SolveBVAsIntMode::OFF) { + // do not rewrite bv2nat eagerly + opts.bv.bvLazyRewriteExtf = true; if (options::boolToBitvector() != options::BoolToBVMode::OFF) { throw OptionException( @@ -222,6 +215,14 @@ void setDefaults(LogicInfo& logic, bool isInternalSubsolver) logic.lock(); } } + else if (options::bvSolver() == options::BVSolver::SIMPLE + || options::bvSolver() == options::BVSolver::BITBLAST) + { + // Only BVSolver::LAZY natively supports int2bv and nat2bv, for other + // solvers we need to eagerly eliminate the operators. Note this is only + // applied if we are not eliminating BV (e.g. with solveBVAsInt). + opts.bv.bvLazyReduceExtf = false; + } // set options about ackermannization if (options::ackermann() && options::produceModels() diff --git a/src/theory/bv/theory_bv_rewriter.cpp b/src/theory/bv/theory_bv_rewriter.cpp index 476803c59..4e1076763 100644 --- a/src/theory/bv/theory_bv_rewriter.cpp +++ b/src/theory/bv/theory_bv_rewriter.cpp @@ -64,7 +64,18 @@ TrustNode TheoryBVRewriter::expandDefinition(Node node) case kind::BITVECTOR_SDIV: case kind::BITVECTOR_SREM: case kind::BITVECTOR_SMOD: ret = eliminateBVSDiv(node); break; - + case kind::BITVECTOR_TO_NAT: + if (!options::bvLazyReduceExtf()) + { + ret = utils::eliminateBv2Nat(node); + } + break; + case kind::INT_TO_BITVECTOR: + if (!options::bvLazyReduceExtf()) + { + ret = utils::eliminateInt2Bv(node); + } + break; default: break; } if (!ret.isNull() && node != ret) |