This PR removes some more calls like options::foo() in favor of options().module.foo.
BVToInt::BVToInt(PreprocessingPassContext* preprocContext)
: PreprocessingPass(preprocContext, "bv-to-int"),
d_intBlaster(preprocContext->getEnv(),
- options::solveBVAsInt(),
- options::BVAndIntegerGranularity()) {}
+ options().smt.solveBVAsInt,
+ options().smt.BVAndIntegerGranularity) {}
PreprocessingPassResult BVToInt::applyInternal(
AssertionPipeline* assertionsToPreprocess)
Trace("sygus-enum") << "SygusEnumerator::initialize " << e << std::endl;
d_enum = e;
// allocate the default callback
- if (d_sec == nullptr && options::sygusSymBreakDynamic())
+ if (d_sec == nullptr && options().datatypes.sygusSymBreakDynamic)
{
d_secd =
std::make_unique<SygusEnumeratorCallbackDefault>(d_env, e, d_stats);
Assert(d_etype.isDatatype());
Assert(d_etype.getDType().isSygus());
d_tlEnum = getMasterEnumForType(d_etype);
- d_abortSize = options::sygusAbortSize();
+ d_abortSize = options().datatypes.sygusAbortSize;
// if we don't have a term database, we don't register symmetry breaking
// lemmas
if (cs > d_abortSize)
{
std::stringstream ss;
- ss << "Maximum term size (" << options::sygusAbortSize()
+ ss << "Maximum term size (" << options().datatypes.sygusAbortSize
<< ") for enumerative SyGuS exceeded.";
throw LogicException(ss.str());
}
void SygusEvalUnfold::registerEvalTerm(Node n)
{
- Assert(options::sygusEvalUnfold());
+ Assert(options().quantifiers.sygusEvalUnfold);
// is this a sygus evaluation function application?
if (n.getKind() != DT_SYGUS_EVAL)
{
Node expn;
// should we unfold?
bool do_unfold = false;
- if (options::sygusEvalUnfoldBool())
+ if (options().quantifiers.sygusEvalUnfoldBool)
{
Node bTermUse = bTerm;
if (bTerm.getKind() == APPLY_UF)
// if normalization option is not enabled, we do not infer the transformations
// below
- if (!options::sygusGrammarNorm())
+ if (!options().quantifiers.sygusGrammarNorm)
{
return nullptr;
}
NodeManager* nm = NodeManager::currentNM();
SkolemManager* sm = NodeManager::currentNM()->getSkolemManager();
Random& rnd = Random::getRandom();
- double p = options::sygusActiveGenRandomP();
+ double p = options().quantifiers.sygusActiveGenRandomP;
Node mainSkolem = sm->mkDummySkolem("sygus_rand", d_tn);
// List of skolems with no corresponding constructor.
* @param cache: Caches visited nodes.
* @param skip_quant: Do not traverse quantified formulas (skip quantifiers).
*/
-void getMaxGroundTerms(TNode n,
+void getMaxGroundTerms(const Options& options,
+ TNode n,
TypeNode tn,
std::unordered_set<Node>& terms,
std::unordered_set<TNode>& cache,
bool skip_quant = false)
{
- if (options::sygusInstTermSel() != options::SygusInstTermSelMode::MAX
- && options::sygusInstTermSel() != options::SygusInstTermSelMode::BOTH)
+ if (options.quantifiers.sygusInstTermSel != options::SygusInstTermSelMode::MAX
+ && options.quantifiers.sygusInstTermSel
+ != options::SygusInstTermSelMode::BOTH)
{
return;
}
* term was already found in a subterm.
* @param skip_quant: Do not traverse quantified formulas (skip quantifiers).
*/
-void getMinGroundTerms(TNode n,
+void getMinGroundTerms(const Options& options,
+ TNode n,
TypeNode tn,
std::unordered_set<Node>& terms,
std::unordered_map<TNode, std::pair<bool, bool>>& cache,
bool skip_quant = false)
{
- if (options::sygusInstTermSel() != options::SygusInstTermSelMode::MIN
- && options::sygusInstTermSel() != options::SygusInstTermSelMode::BOTH)
+ if (options.quantifiers.sygusInstTermSel != options::SygusInstTermSelMode::MIN
+ && options.quantifiers.sygusInstTermSel
+ != options::SygusInstTermSelMode::BOTH)
{
return;
}
std::unordered_set<TNode> cache_max;
std::unordered_map<TNode, std::pair<bool, bool>> cache_min;
- getMinGroundTerms(q, tn, terms, cache_min);
- getMaxGroundTerms(q, tn, terms, cache_max);
+ getMinGroundTerms(options(), q, tn, terms, cache_min);
+ getMaxGroundTerms(options(), q, tn, terms, cache_max);
relevant_terms.emplace(tn, terms);
}
for (const Node& a : d_notified_assertions)
{
- getMinGroundTerms(a, tn, terms, cache_min, true);
- getMaxGroundTerms(a, tn, terms, cache_max, true);
+ getMinGroundTerms(options(), a, tn, terms, cache_min, true);
+ getMaxGroundTerms(options(), a, tn, terms, cache_max, true);
}
d_global_terms.insert(tn, terms);
}
namespace quantifiers {
SygusSampler::SygusSampler(Env& env)
- : d_env(env), d_tds(nullptr), d_use_sygus_type(false), d_is_valid(false)
+ : EnvObj(env), d_tds(nullptr), d_use_sygus_type(false), d_is_valid(false)
{
}
<< vt << std::endl;
}
std::map<unsigned, std::map<Node, std::vector<TypeNode> >::iterator> sts;
- if (options::sygusSampleGrammar())
+ if (options().quantifiers.sygusSampleGrammar)
{
for (unsigned j = 0, size = types.size(); j < size; j++)
{
{
Node v = d_vars[j];
Node r;
- if (options::sygusSampleGrammar())
+ if (options().quantifiers.sygusSampleGrammar)
{
// choose a random start sygus type, if possible
if (sts[j] != d_var_sygus_types.end())
{
unsigned e = tn.getFloatingPointExponentSize();
unsigned s = tn.getFloatingPointSignificandSize();
- return nm->mkConst(options::sygusSampleFpUniform()
+ return nm->mkConst(options().quantifiers.sygusSampleFpUniform
? Sampler::pickFpUniform(e, s)
: Sampler::pickFpBiased(e, s));
}
Assert(bve != bvre);
out << "where they evaluate to " << bve << " and " << bvre << std::endl;
- if (options::sygusRewVerifyAbort())
+ if (options().quantifiers.sygusRewVerifyAbort)
{
AlwaysAssert(false)
<< "--sygus-rr-verify detected unsoundness in the rewriter!";
#define CVC5__THEORY__QUANTIFIERS__SYGUS_SAMPLER_H
#include <map>
+
+#include "smt/env_obj.h"
#include "theory/quantifiers/lazy_trie.h"
#include "theory/quantifiers/term_enumeration.h"
* Notice that the number of sample points can be configured for the above
* options using sygus-samples=N.
*/
-class SygusSampler : public LazyTrieEvaluator
+class SygusSampler : protected EnvObj, public LazyTrieEvaluator
{
public:
SygusSampler(Env& env);
void checkEquivalent(Node bv, Node bvr, std::ostream& out);
protected:
- /** The environment we are using to evaluate terms and samples */
- Env& d_env;
/** sygus term database of d_qe */
TermDbSygus* d_tds;
/** term enumerator object (used for random sampling) */
{
SkolemManager* sm = NodeManager::currentNM()->getSkolemManager();
std::stringstream ss;
- options::ioutils::applyOutputLang(ss, options::outputLanguage());
+ options::ioutils::applyOutputLang(ss, options().base.outputLanguage);
ss << "e_" << tn;
Node k = sm->mkDummySkolem(ss.str(), tn, "is a termDb fresh variable");
Trace("mkVar") << "TermDb:: Make variable " << k << " : " << tn