This PR makes the IntBlaster class inherit from EnvObj, along with derived modifications.
#include "options/option_exception.h"
#include "options/uf_options.h"
#include "theory/bv/theory_bv_utils.h"
-#include "theory/rewriter.h"
+#include "theory/logic_info.h"
#include "util/bitvector.h"
#include "util/iand.h"
#include "util/rational.h"
} // namespace
-IntBlaster::IntBlaster(context::Context* c,
+IntBlaster::IntBlaster(Env& env,
options::SolveBVAsIntMode mode,
uint64_t granularity,
bool introduceFreshIntVars)
- : d_binarizeCache(c),
- d_intblastCache(c),
- d_rangeAssertions(c),
- d_bitwiseAssertions(c),
+ : EnvObj(env),
+ d_binarizeCache(userContext()),
+ d_intblastCache(userContext()),
+ d_rangeAssertions(userContext()),
+ d_bitwiseAssertions(userContext()),
d_mode(mode),
d_granularity(granularity),
- d_context(c),
+ d_context(userContext()),
d_introduceFreshIntVars(introduceFreshIntVars)
{
d_nm = NodeManager::currentNM();
d_one = d_nm->mkConst<Rational>(1);
};
+IntBlaster::~IntBlaster() {}
+
void IntBlaster::addRangeConstraint(Node node,
uint64_t size,
std::vector<Node>& lemmas)
std::map<Node, Node>& skolems)
{
// make sure the node is re-written
- n = Rewriter::rewrite(n);
+ n = rewrite(n);
// helper vector for traversal.
std::vector<Node> toVisit;
* of the bounds that were relevant for the original
* bit-vectors.
*/
- if (childrenTypesChanged(original) && options::ufHo())
+ if (childrenTypesChanged(original) && logicInfo().isHigherOrder())
{
throw OptionException("bv-to-int does not support higher order logic ");
}
#include "context/cdhashmap.h"
#include "context/cdhashset.h"
#include "context/cdo.h"
-#include "context/context.h"
#include "options/smt_options.h"
+#include "smt/env_obj.h"
#include "theory/arith/nl/iand_utils.h"
namespace cvc5 {
** op.
**
**/
-class IntBlaster
+class IntBlaster : protected EnvObj
{
using CDNodeMap = context::CDHashMap<Node, Node>;
* translated to integer variables, or are directly casted using `bv2nat`
* operator. not purely bit-vector nodes.
*/
- IntBlaster(context::Context* context,
+ IntBlaster(Env& env,
options::SolveBVAsIntMode mode,
uint64_t granluarity = 1,
bool introduceFreshIntVars = true);
+ ~IntBlaster();
+
/**
* The result is an integer term and is computed
* according to the translation specified above.
Node bv7_4 = d_nodeManager->mkConst<BitVector>(c1);
// translating it to integers should yield 7.
+ Options opts;
+ Env env(d_nodeManager, &opts);
+ env.d_logic.setLogicString("QF_UFBV");
+ env.d_logic.lock();
IntBlaster intBlaster(
- d_slvEngine->getContext(), options::SolveBVAsIntMode::SUM, 1, false);
+ env, options::SolveBVAsIntMode::SUM, 1, false);
Node result = intBlaster.translateNoChildren(bv7_4, lemmas, skolems);
Node seven = d_nodeManager->mkConst(Rational(7));
ASSERT_EQ(seven, result);
Node bv = d_nodeManager->mkVar("bv1", bvType);
// translating it to integers should yield an integer variable.
+ Options opts;
+ Env env(d_nodeManager, &opts);
+ env.d_logic.setLogicString("QF_UFBV");
+ env.d_logic.lock();
IntBlaster intBlaster(
- d_slvEngine->getContext(), options::SolveBVAsIntMode::SUM, 1, true);
+ env, options::SolveBVAsIntMode::SUM, 1, true);
Node result = intBlaster.translateNoChildren(bv, lemmas, skolems);
ASSERT_TRUE(result.isVar() && result.getType().isInteger());
Node f = d_nodeManager->mkVar("f", funType);
// translating it to integers should yield an Int x Int -> Bool function
+ Options opts;
+ Env env(d_nodeManager, &opts);
+ env.d_logic.setLogicString("QF_UFBV");
+ env.d_logic.lock();
IntBlaster intBlaster(
- d_slvEngine->getContext(), options::SolveBVAsIntMode::SUM, 1, true);
+ env, options::SolveBVAsIntMode::SUM, 1, true);
Node result = intBlaster.translateNoChildren(f, lemmas, skolems);
TypeNode resultType = result.getType();
std::vector<TypeNode> resultDomain = resultType.getArgTypes();
// place holders for lemmas and skolem
std::vector<Node> lemmas;
std::map<Node, Node> skolems;
+ Options opts;
+ Env env(d_nodeManager, &opts);
+ env.d_logic.setLogicString("QF_UFBV");
+ env.d_logic.lock();
IntBlaster intBlaster(
- d_slvEngine->getContext(), options::SolveBVAsIntMode::SUM, 1, true);
+ env, options::SolveBVAsIntMode::SUM, 1, true);
// bit-vector variables
TypeNode bvType = d_nodeManager->mkBitVectorType(4);