#include "options/base_options.h"
#include "options/smt_options.h"
#include "preprocessing/assertion_pipeline.h"
+#include "preprocessing/preprocessing_pass_context.h"
#include "theory/rewriter.h"
#include "theory/theory.h"
#include "util/bitvector.h"
using namespace std;
using namespace cvc5::theory;
-using NodeMap = std::unordered_map<Node, Node>;
namespace {
}
return cache[n];
}
+} // namespace
-Node intToBV(TNode n, NodeMap& cache)
+Node IntToBV::intToBV(TNode n, NodeMap& cache)
{
int size = options::solveIntAsBV();
AlwaysAssert(size > 0);
result = sm->mkDummySkolem("__intToBV_var",
nm->mkBitVectorType(size),
"Variable introduced in intToBV pass");
+ Node bv2nat = nm->mkNode(kind::BITVECTOR_TO_NAT, result);
+ d_preprocContext->addSubstitution(current, bv2nat);
}
}
else if (current.isConst())
cache[current] = result;
}
}
+ Trace("int-to-bv-debug") << "original: " << n << std::endl;
+ Trace("int-to-bv-debug") << "binary: " << n_binary << std::endl;
+ Trace("int-to-bv-debug") << "result: " << cache[n_binary] << std::endl;
return cache[n_binary];
}
-} // namespace
IntToBV::IntToBV(PreprocessingPassContext* preprocContext)
: PreprocessingPass(preprocContext, "int-to-bv"){};
#ifndef CVC5__PREPROCESSING__PASSES__INT_TO_BV_H
#define CVC5__PREPROCESSING__PASSES__INT_TO_BV_H
+#include "expr/node.h"
#include "preprocessing/preprocessing_pass.h"
namespace cvc5 {
namespace preprocessing {
namespace passes {
+using NodeMap = std::unordered_map<Node, Node>;
+
class IntToBV : public PreprocessingPass
{
public:
IntToBV(PreprocessingPassContext* preprocContext);
+ Node intToBV(TNode n, NodeMap& cache);
protected:
PreprocessingPassResult applyInternal(
regress0/bv/inequality04.smt2
regress0/bv/inequality05.smt2
regress0/bv/int_to_bv_err_on_demand_1.smt2
+ regress0/bv/int_to_bv_model.smt2
regress0/bv/issue-4075.smt2
regress0/bv/issue-4076.smt2
regress0/bv/issue-4130.smt2