This PR is the first step in replacing options access via options::foo() to using the environment (via EnvObj and options().module.foo). It replaces all such options accesses in the preprocessing passes.
PreprocessingPassResult Ackermann::applyInternal(
AssertionPipeline* assertionsToPreprocess)
{
- AlwaysAssert(!options::incrementalSolving());
+ AlwaysAssert(!options().base.incrementalSolving);
/* collect all function applications and generate consistency lemmas
* accordingly */
#include "base/map_util.h"
#include "expr/node.h"
+#include "options/bv_options.h"
#include "preprocessing/assertion_pipeline.h"
#include "preprocessing/preprocessing_pass_context.h"
#include "smt/smt_statistics_registry.h"
BoolToBV::BoolToBV(PreprocessingPassContext* preprocContext)
: PreprocessingPass(preprocContext, "bool-to-bv"), d_statistics()
{
- d_boolToBVMode = options::boolToBitvector();
+ d_boolToBVMode = options().bv.boolToBitvector;
};
PreprocessingPassResult BoolToBV::applyInternal(
// operators)
// 3. translating into a sum
uint64_t bvsize = original[0].getType().getBitVectorSize();
- if (options::solveBVAsInt() == options::SolveBVAsIntMode::IAND)
+ if (options().smt.solveBVAsInt == options::SolveBVAsIntMode::IAND)
{
Node iAndOp = d_nm->mkConst(IntAnd(bvsize));
returnNode = d_nm->mkNode(
kind::IAND, iAndOp, translated_children[0], translated_children[1]);
}
- else if (options::solveBVAsInt() == options::SolveBVAsIntMode::BV)
+ else if (options().smt.solveBVAsInt == options::SolveBVAsIntMode::BV)
{
// translate the children back to BV
Node intToBVOp = d_nm->mkConst<IntToBitVector>(IntToBitVector(bvsize));
}
else
{
- Assert(options::solveBVAsInt() == options::SolveBVAsIntMode::SUM);
+ Assert(options().smt.solveBVAsInt == options::SolveBVAsIntMode::SUM);
// Construct a sum of ites, based on granularity.
Assert(translated_children.size() == 2);
returnNode =
d_iandUtils.createSumNode(translated_children[0],
translated_children[1],
bvsize,
- options::BVAndIntegerGranularity());
+ options().smt.BVAndIntegerGranularity);
}
break;
}
* of the bounds that were relevant for the original
* bit-vectors.
*/
- if (childrenTypesChanged(original) && options::ufHo())
+ if (childrenTypesChanged(original) && options().uf.ufHo)
{
throw TypeCheckingExceptionPrivate(
original,
assertionsToPreprocess->replace(
i,
extendedRewrite((*assertionsToPreprocess)[i],
- options::extRewPrepAgg()));
+ options().smt.extRewPrepAgg));
}
return PreprocessingPassResult::NO_CONFLICT;
}
if (cur.isVar())
{
Node ret = cur;
- if (options::hoElim())
+ if (options().quantifiers.hoElim)
{
if (tn.isFunction())
{
else
{
d_visited[cur] = Node::null();
- if (cur.getKind() == APPLY_UF && options::hoElim())
+ if (cur.getKind() == APPLY_UF && options().quantifiers.hoElim)
{
Node op = cur.getOperator();
// convert apply uf with variable arguments eagerly to ho apply
children.insert(children.begin(), retOp);
}
// process ho apply
- if (ret.getKind() == HO_APPLY && options::hoElim())
+ if (ret.getKind() == HO_APPLY && options().quantifiers.hoElim)
{
TypeNode tnr = ret.getType();
tnr = getUSort(tnr);
// extensionality: process all function types
for (const TypeNode& ftn : d_funTypes)
{
- if (options::hoElim())
+ if (options().quantifiers.hoElim)
{
Node h = getHoApplyUf(ftn);
Trace("ho-elim-ax") << "Make extensionality for " << h << std::endl;
// exists another function that acts like the "store" operator for
// arrays, e.g. it is the same function with one I/O pair updated.
// Without this axiom, the translation is model unsound.
- if (options::hoElimStoreAx())
+ if (options().quantifiers.hoElimStoreAx)
{
Node u = nm->mkBoundVar("u", uf);
Node v = nm->mkBoundVar("v", uf);
Trace("ho-elim-ax") << "...store axiom : " << store << std::endl;
}
}
- else if (options::hoElimStoreAx())
+ else if (options().quantifiers.hoElimStoreAx)
{
Node u = nm->mkBoundVar("u", ftn);
Node v = nm->mkBoundVar("v", ftn);
*
* Based on options, this preprocessing pass may apply a subset o the above
* steps. In particular:
- * * If options::hoElim() is true, then step [2] is taken and extensionality
+ * * If hoElim is true, then step [2] is taken and extensionality
* axioms are added in step [3].
- * * If options::hoElimStoreAx() is true, then store axioms are added in step 3.
- * The form of these axioms depends on whether options::hoElim() is true. If it
+ * * If hoElimStoreAx is true, then store axioms are added in step 3.
+ * The form of these axioms depends on whether hoElim is true. If it
* is true, the axiom is given in terms of the uninterpreted functions that
* encode function sorts. If it is false, then the store axiom is given in terms
* of the original function sorts.
Node IntToBV::intToBV(TNode n, NodeMap& cache)
{
- int size = options::solveIntAsBV();
+ int size = options().smt.solveIntAsBV;
AlwaysAssert(size > 0);
- AlwaysAssert(!options::incrementalSolving());
+ AlwaysAssert(!options().base.incrementalSolving);
NodeManager* nm = NodeManager::currentNM();
SkolemManager* sm = nm->getSkolemManager();
Node result = ite_utils->simpITE(assertion);
Node res_rewritten = rewrite(result);
- if (options::simplifyWithCareEnabled())
+ if (options().smt.simplifyWithCareEnabled)
{
Chat() << "starting simplifyWithCare()" << endl;
Node postSimpWithCare = ite_utils->simplifyWithCare(res_rewritten);
bool simpDidALotOfWork = d_iteUtilities.simpIteDidALotOfWorkHeuristic();
if (simpDidALotOfWork)
{
- if (options::compressItes())
+ if (options().smt.compressItes)
{
result = d_iteUtilities.compress(assertionsToPreprocess);
}
{
// if false, don't bother to reclaim memory here.
NodeManager* nm = NodeManager::currentNM();
- if (nm->poolSize() >= options::zombieHuntThreshold())
+ if (nm->poolSize() >= options().smt.zombieHuntThreshold)
{
Chat() << "..ite simplifier did quite a bit of work.. "
<< nm->poolSize() << endl;
<< " nodes before cleanup" << endl;
d_iteUtilities.clear();
d_env.getRewriter()->clearCaches();
- nm->reclaimZombiesUntil(options::zombieHuntThreshold());
+ nm->reclaimZombiesUntil(options().smt.zombieHuntThreshold);
Chat() << "....node manager contains " << nm->poolSize()
<< " nodes after cleanup" << endl;
}
// Do theory specific preprocessing passes
if (logicInfo().isTheoryEnabled(theory::THEORY_ARITH)
- && !options::incrementalSolving())
+ && !options().base.incrementalSolving)
{
if (!simpDidALotOfWork)
{
MipLibTrick::MipLibTrick(PreprocessingPassContext* preprocContext)
: PreprocessingPass(preprocContext, "miplib-trick")
{
- if (!options::incrementalSolving())
+ if (!options().base.incrementalSolving)
{
NodeManager::currentNM()->subscribeEvents(this);
}
MipLibTrick::~MipLibTrick()
{
- if (!options::incrementalSolving())
+ if (!options().base.incrementalSolving)
{
NodeManager::currentNM()->unsubscribeEvents(this);
}
{
Assert(assertionsToPreprocess->getRealAssertionsEnd()
== assertionsToPreprocess->size());
- Assert(!options::incrementalSolving());
+ Assert(!options().base.incrementalSolving);
context::Context fakeContext;
TheoryEngine* te = d_preprocContext->getTheoryEngine();
Assert(top_level_substs.getSubstitution(newAssertion[0])
== newAssertion[1]);
}
- else if (pos.getNumChildren() <= options::arithMLTrickSubstitutions())
+ else if (pos.getNumChildren()
+ <= options().arith.arithMLTrickSubstitutions)
{
top_level_substs.addSubstitution(newAssertion[0], newAssertion[1]);
Debug("miplib") << "addSubs: " << newAssertion[0] << " to "
{
Debug("miplib")
<< "skipSubs: " << newAssertion[0] << " to " << newAssertion[1]
- << " (threshold is " << options::arithMLTrickSubstitutions()
- << ")" << endl;
+ << " (threshold is "
+ << options().arith.arithMLTrickSubstitutions << ")" << endl;
}
newAssertion = rewrite(newAssertion);
Debug("miplib") << " " << newAssertion << endl;
theory::SortInference* si =
d_preprocContext->getTheoryEngine()->getSortInference();
- if (options::sortInference())
+ if (options().smt.sortInference)
{
si->initialize(assertionsToPreprocess->ref());
std::map<Node, Node> model_replace_f;
}
// only need to compute monotonicity on the resulting formula if we are
// using this option
- if (options::ufssFairnessMonotone())
+ if (options().uf.ufssFairnessMonotone)
{
si->computeMonotonicity(assertionsToPreprocess->ref());
}
Trace("srs-input") << "Make synth variables for types..." << std::endl;
// We will generate a fixed number of variables per type. These are the
// variables that appear as free variables in the rewrites we generate.
- unsigned nvars = options::sygusRewSynthInputNVars();
+ unsigned nvars = options().quantifiers.sygusRewSynthInputNVars;
// must have at least one variable per type
nvars = nvars < 1 ? 1 : nvars;
std::map<TypeNode, std::vector<Node> > tvars;
// our input does not contain a Boolean variable, we need not allocate any
// Boolean variables here.
unsigned useNVars =
- (options::sygusRewSynthInputUseBool() || !tn.isBoolean())
+ (options().quantifiers.sygusRewSynthInputUseBool || !tn.isBoolean())
? nvars
: (hasBoolVar ? 1 : 0);
for (unsigned i = 0; i < useNVars; i++)
// we add variable constructors if we are not Boolean, we are interested
// in purely propositional rewrites (via the option), or this term is
// a Boolean variable.
- if (!ctt.isBoolean() || options::sygusRewSynthInputUseBool()
+ if (!ctt.isBoolean() || options().quantifiers.sygusRewSynthInputUseBool
|| ct.getKind() == BOUND_VARIABLE)
{
for (const Node& v : tvars[ctt])