This PR removes some more static accesses to options from strings and solver engine.
/**
* Make a new (or return an existing) abstract value for a node.
- * Can only use this if options::abstractValues() is on.
+ * Can only use this if abstractValues option is on.
*/
Node mkAbstractValue(TNode n);
/**
* A map of AbsractValues to their actual constants. Only used if
- * options::abstractValues() is on.
+ * abstractValues option is on.
*/
theory::SubstitutionMap d_abstractValueMap;
* A mapping of all abstract values (actual value |-> abstract) that
* we've handed out. This is necessary to ensure that we give the
* same AbstractValues for the same real constants. Only used if
- * options::abstractValues() is on.
+ * abstractValues option is on.
*/
NodeToNodeHashMap d_abstractValues;
};
return res;
}
+const Options& SolverEngine::options() const { return d_env->getOptions(); }
+
std::vector<Node> SolverEngine::getExpandedAssertions()
{
std::vector<Node> easserts = getAssertions();
Assert(pe != nullptr);
std::shared_ptr<ProofNode> pepf;
- if (options::unsatCoresMode() == options::UnsatCoresMode::ASSUMPTIONS)
+ if (options().smt.unsatCoresMode == options::UnsatCoresMode::ASSUMPTIONS)
{
pepf = pe->getRefutation();
}
std::shared_ptr<ProofNode> pfn = d_pfManager->getFinalProof(pepf, *d_asserts);
std::vector<Node> core;
d_ucManager->getUnsatCore(pfn, *d_asserts, core);
- if (options::minimalUnsatCores())
+ if (options().smt.minimalUnsatCores)
{
core = reduceUnsatCore(core);
}
std::vector<Node> SolverEngine::reduceUnsatCore(const std::vector<Node>& core)
{
- Assert(options::unsatCores())
+ Assert(options().smt.unsatCores)
<< "cannot reduce unsat core if unsat cores are turned off";
d_env->verbose(1) << "SolverEngine::reduceUnsatCore(): reducing unsat core"
Assert(m != nullptr);
// check the model with the theory engine for debugging
- if (options::debugCheckModels())
+ if (options().smt.debugCheckModels)
{
TheoryEngine* te = getTheoryEngine();
Assert(te != nullptr);
&& getSmtMode() == SmtMode::UNSAT)
{
// minimize instantiations based on proof manager
- getRelevantInstantiationTermVectors(rinsts,
- options::dumpInstantiationsDebug());
+ getRelevantInstantiationTermVectors(
+ rinsts, options().driver.dumpInstantiationsDebug);
}
else
{
* changes.
*/
std::vector<Node> getAssertionsInternal();
+
+ /**
+ * Return a reference to options like for `EnvObj`.
+ */
+ const Options& options() const;
+
/* Members -------------------------------------------------------------- */
/** Solver instance that owns this SolverEngine instance. */
return out;
}
-Strategy::Strategy() : d_strategy_init(false) {}
+Strategy::Strategy(Env& env) : EnvObj(env), d_strategy_init(false) {}
Strategy::~Strategy() {}
d_strategy_init = true;
// beginning indices
step_begin[Theory::EFFORT_FULL] = 0;
- if (options::stringEager())
+ if (options().strings.stringEager)
{
step_begin[Theory::EFFORT_STANDARD] = 0;
}
addStrategyStep(CHECK_EXTF_EVAL, 0);
// we must check cycles before using flat forms
addStrategyStep(CHECK_CYCLES);
- if (options::stringFlatForms())
+ if (options().strings.stringFlatForms)
{
addStrategyStep(CHECK_FLAT_FORMS);
}
addStrategyStep(CHECK_EXTF_REDUCTION, 1);
- if (options::stringEager())
+ if (options().strings.stringEager)
{
// do only the above inferences at standard effort, if applicable
step_end[Theory::EFFORT_STANDARD] = d_infer_steps.size() - 1;
}
- if (!options::stringEagerLen())
+ if (!options().strings.stringEagerLen)
{
addStrategyStep(CHECK_REGISTER_TERMS_PRE_NF);
}
addStrategyStep(CHECK_NORMAL_FORMS_EQ);
addStrategyStep(CHECK_EXTF_EVAL, 1);
- if (!options::stringEagerLen() && options::stringLenNorm())
+ if (!options().strings.stringEagerLen && options().strings.stringLenNorm)
{
addStrategyStep(CHECK_LENGTH_EQC, 0, false);
addStrategyStep(CHECK_REGISTER_TERMS_NF);
}
addStrategyStep(CHECK_NORMAL_FORMS_DEQ);
addStrategyStep(CHECK_CODES);
- if (options::stringEagerLen() && options::stringLenNorm())
+ if (options().strings.stringEagerLen && options().strings.stringLenNorm)
{
addStrategyStep(CHECK_LENGTH_EQC);
}
- if (options::stringExp())
+ if (options().strings.stringExp)
{
addStrategyStep(CHECK_EXTF_REDUCTION, 2);
}
addStrategyStep(CHECK_MEMBERSHIP);
addStrategyStep(CHECK_CARDINALITY);
step_end[Theory::EFFORT_FULL] = d_infer_steps.size() - 1;
- if (options::stringModelBasedReduction())
+ if (options().strings.stringModelBasedReduction)
{
step_begin[Theory::EFFORT_LAST_CALL] = d_infer_steps.size();
addStrategyStep(CHECK_EXTF_EVAL, 3);
- if (options::stringExp())
+ if (options().strings.stringExp)
{
addStrategyStep(CHECK_EXTF_REDUCTION, 3);
}
* This stores a sequence of the above enum that indicates the calls to
* runInferStep to make on the theory of strings, given by parent.
*/
-class Strategy
+class Strategy : protected EnvObj
{
public:
- Strategy();
+ Strategy(Env& env);
~Strategy();
/** is this strategy initialized? */
bool isStrategyInit() const;
d_rsolver(
env, d_state, d_im, d_termReg, d_csolver, d_esolver, d_statistics),
d_regexp_elim(options().strings.regExpElimAgg, d_pnm, userContext()),
- d_stringsFmf(env, valuation, d_termReg)
+ d_stringsFmf(env, valuation, d_termReg),
+ d_strat(d_env)
{
d_termReg.finishInit(&d_im);