This makes it so that the decision manager is accessible from TheoryInferenceManager.
This is work towards breaking circular dependencies in quantifiers, and also helps simplify several other dependencies in e.g. UF and datatypes.
{
d_dstratInit = true;
// add the decision strategy, which is user-context-independent
- getDecisionManager()->registerStrategy(
+ d_im.getDecisionManager()->registerStrategy(
DecisionManager::STRAT_ARRAYS,
d_dstrat.get(),
DecisionManager::STRAT_SCOPE_CTX_INDEPENDENT);
SygusExtension::SygusExtension(TheoryState& s,
InferenceManager& im,
- quantifiers::TermDbSygus* tds,
- DecisionManager* dm)
+ quantifiers::TermDbSygus* tds)
: d_state(s),
d_im(im),
d_tds(tds),
- d_dm(dm),
d_ssb(tds),
d_testers(s.getSatContext()),
d_testers_exp(s.getSatContext()),
d_state.getSatContext(),
d_state.getValuation()));
}
- d_dm->registerStrategy(DecisionManager::STRAT_DT_SYGUS_ENUM_ACTIVE,
- d_anchor_to_ag_strategy[e].get());
+ d_im.getDecisionManager()->registerStrategy(
+ DecisionManager::STRAT_DT_SYGUS_ENUM_ACTIVE,
+ d_anchor_to_ag_strategy[e].get());
}
Node m;
if (!ag.isNull())
Trace("sygus-sb") << "Sygus : register measure term : " << m << std::endl;
d_szinfo[m].reset(new SygusSizeDecisionStrategy(d_im, m, d_state));
// register this as a decision strategy
- d_dm->registerStrategy(DecisionManager::STRAT_DT_SYGUS_ENUM_SIZE,
- d_szinfo[m].get());
+ d_im.getDecisionManager()->registerStrategy(
+ DecisionManager::STRAT_DT_SYGUS_ENUM_SIZE, d_szinfo[m].get());
}
}
public:
SygusExtension(TheoryState& s,
InferenceManager& im,
- quantifiers::TermDbSygus* tds,
- DecisionManager* dm);
+ quantifiers::TermDbSygus* tds);
~SygusExtension();
/**
* Notify this class that tester for constructor tindex has been asserted for
InferenceManager& d_im;
/** Pointer to the sygus term database */
quantifiers::TermDbSygus* d_tds;
- /** Pointer to the decision manager */
- DecisionManager* d_dm;
/** the simple symmetry breaking utility */
SygusSimpleSymBreak d_ssb;
/**
{
quantifiers::TermDbSygus* tds =
getQuantifiersEngine()->getTermDatabaseSygus();
- d_sygusExtension.reset(
- new SygusExtension(d_state, d_im, tds, getDecisionManager()));
+ d_sygusExtension.reset(new SygusExtension(d_state, d_im, tds));
// do congruence on evaluation functions
d_equalityEngine->addFunctionKind(kind::DT_SYGUS_EVAL);
}
dlds = itds->second.get();
}
// it is appended to the list of strategies
- d_quantEngine->getDecisionManager()->registerStrategy(
+ d_qim.getDecisionManager()->registerStrategy(
DecisionManager::STRAT_QUANT_CEGQI_FEASIBLE, dlds);
return true;
}else{
QuantifiersState& qs,
QuantifiersInferenceManager& qim,
QuantifiersRegistry& qr,
- TermRegistry& tr,
- DecisionManager* dm)
- : QuantifiersModule(qs, qim, qr, tr, qe), d_dm(dm)
+ TermRegistry& tr)
+ : QuantifiersModule(qs, qim, qr, tr, qe)
{
}
if( bound_success ){
d_bound_quants.push_back( f );
+ DecisionManager* dm = d_qim.getDecisionManager();
for( unsigned i=0; i<d_set[f].size(); i++) {
Node v = d_set[f][i];
std::map< Node, Node >::iterator itr = d_range[f].find( v );
d_qstate.getUserContext(),
d_qstate.getValuation(),
isProxy));
- d_dm->registerStrategy(DecisionManager::STRAT_QUANT_BOUND_INT_SIZE,
- d_rms[r].get());
+ dm->registerStrategy(DecisionManager::STRAT_QUANT_BOUND_INT_SIZE,
+ d_rms[r].get());
}
}
}
QuantifiersState& qs,
QuantifiersInferenceManager& qim,
QuantifiersRegistry& qr,
- TermRegistry& tr,
- DecisionManager* dm);
+ TermRegistry& tr);
virtual ~BoundedIntegers();
void presolve() override;
Node matchBoundVar( Node v, Node t, Node e );
bool getRsiSubsitution( Node q, Node v, std::vector< Node >& vars, std::vector< Node >& subs, RepSetIterator * rsi );
- /** Pointer to the decision manager */
- DecisionManager* d_dm;
};
}
QuantifiersInferenceManager& qim,
QuantifiersRegistry& qr,
TermRegistry& tr,
- DecisionManager* dm,
std::vector<QuantifiersModule*>& modules)
{
// add quantifiers modules
// finite model finding
if (options::fmfBound())
{
- d_bint.reset(new BoundedIntegers(qe, qs, qim, qr, tr, dm));
+ d_bint.reset(new BoundedIntegers(qe, qs, qim, qr, tr));
modules.push_back(d_bint.get());
}
if (options::finiteModelFind() || options::fmfBound())
QuantifiersInferenceManager& qim,
QuantifiersRegistry& qr,
TermRegistry& tr,
- DecisionManager* dm,
std::vector<QuantifiersModule*>& modules);
private:
}
// register this strategy
- d_qe->getDecisionManager()->registerStrategy(
+ d_qim.getDecisionManager()->registerStrategy(
DecisionManager::STRAT_QUANT_CEGIS_UNIF_NUM_ENUMS, this);
// create single condition enumerator for each decision tree strategy
d_feasible_guard,
d_qstate.getSatContext(),
d_qstate.getValuation()));
- d_qe->getDecisionManager()->registerStrategy(
+ d_qim.getDecisionManager()->registerStrategy(
DecisionManager::STRAT_QUANT_SYGUS_FEASIBLE, d_feasible_strategy.get());
// this must be called, both to ensure that the feasible guard is
// decided on with true polariy, but also to ensure that output channel
"CeLiteral", lit, d_qstate.getSatContext(), d_qstate.getValuation());
d_dstrat[q].reset(ds);
- d_quantEngine->getDecisionManager()->registerStrategy(
+ d_qim.getDecisionManager()->registerStrategy(
DecisionManager::STRAT_QUANT_CEGQI_FEASIBLE, ds);
/* Add counterexample lemma (lit => ~P[x_i/eval_i]) */
: d_qstate(qstate),
d_qim(qim),
d_te(nullptr),
- d_decManager(nullptr),
d_pnm(pnm),
d_qreg(qr),
d_treg(tr),
QuantifiersEngine::~QuantifiersEngine() {}
-void QuantifiersEngine::finishInit(TheoryEngine* te, DecisionManager* dm)
+void QuantifiersEngine::finishInit(TheoryEngine* te)
{
d_te = te;
- d_decManager = dm;
// Initialize the modules and the utilities here.
d_qmodules.reset(new quantifiers::QuantifiersModules);
- d_qmodules->initialize(this, d_qstate, d_qim, d_qreg, d_treg, dm, d_modules);
+ d_qmodules->initialize(this, d_qstate, d_qim, d_qreg, d_treg, d_modules);
if (d_qmodules->d_rel_dom.get())
{
d_util.push_back(d_qmodules->d_rel_dom.get());
d_qreg.getQuantifiersBoundInference().finishInit(d_qmodules->d_bint.get());
}
-DecisionManager* QuantifiersEngine::getDecisionManager()
-{
- return d_decManager;
-}
-
quantifiers::QuantifiersState& QuantifiersEngine::getState()
{
return d_qstate;
namespace theory {
-class DecisionManager;
class QuantifiersModule;
class RepSetIterator;
ProofNodeManager* pnm);
~QuantifiersEngine();
//---------------------- external interface
- /** Get the decision manager */
- DecisionManager* getDecisionManager();
/** The quantifiers state object */
quantifiers::QuantifiersState& getState();
/** The quantifiers inference manager */
* @param te The theory engine
* @param dm The decision manager of the theory engine
*/
- void finishInit(TheoryEngine* te, DecisionManager* dm);
+ void finishInit(TheoryEngine* te);
//---------------------- end private initialization
public:
quantifiers::QuantifiersInferenceManager& d_qim;
/** Pointer to theory engine object */
TheoryEngine* d_te;
- /** Reference to the decision manager of the theory engine */
- DecisionManager* d_decManager;
/** Pointer to the proof node manager */
ProofNodeManager* d_pnm;
/** vector of utilities for quantifiers */
d_neg_guard_strategy[g].reset(new DecisionStrategySingleton(
"sep_neg_guard", g, getSatContext(), getValuation()));
DecisionStrategySingleton* ds = d_neg_guard_strategy[g].get();
- getDecisionManager()->registerStrategy(DecisionManager::STRAT_SEP_NEG_GUARD,
- ds);
+ d_im.getDecisionManager()->registerStrategy(
+ DecisionManager::STRAT_SEP_NEG_GUARD, ds);
Node lit = ds->getLiteral(0);
d_neg_guard[slbl][satom] = lit;
Trace("sep-lemma-debug")
d_stringsFmf.presolve();
// This strategy is local to a check-sat call, since we refresh the strategy
// on every call to presolve.
- getDecisionManager()->registerStrategy(
+ d_im.getDecisionManager()->registerStrategy(
DecisionManager::STRAT_STRINGS_SUM_LENGTHS,
d_stringsFmf.getDecisionStrategy(),
DecisionManager::STRAT_SCOPE_LOCAL_SOLVE);
d_factsHead(satContext, 0),
d_sharedTermsIndex(satContext, 0),
d_careGraph(nullptr),
- d_decManager(nullptr),
d_instanceName(name),
d_checkTime(getStatsPrefix(id) + name + "::checkTime"),
d_computeCareGraphTime(getStatsPrefix(id) + name
void Theory::setDecisionManager(DecisionManager* dm)
{
- Assert(d_decManager == nullptr);
Assert(dm != nullptr);
- d_decManager = dm;
+ if (d_inferManager != nullptr)
+ {
+ d_inferManager->setDecisionManager(dm);
+ }
}
void Theory::finishInitStandalone()
return d_quantEngine;
}
- /** Get the decision manager associated to this theory. */
- DecisionManager* getDecisionManager() { return d_decManager; }
-
/**
* @return The theory state associated with this theory.
*/
// special model builder object
if (d_logicInfo.isQuantified())
{
- d_quantEngine->finishInit(this, d_decManager.get());
+ d_quantEngine->finishInit(this);
}
// initialize the theory combination manager, which decides and allocates the
// equality engines to use for all theories.
d_theoryState(state),
d_out(t.getOutputChannel()),
d_ee(nullptr),
+ d_decManager(nullptr),
d_pnm(pnm),
d_cacheLemmas(cacheLemmas),
d_keep(t.getSatContext()),
}
}
+void TheoryInferenceManager::setDecisionManager(DecisionManager* dm)
+{
+ d_decManager = dm;
+}
+
bool TheoryInferenceManager::isProofEnabled() const { return d_pnm != nullptr; }
void TheoryInferenceManager::reset()
return true;
}
+DecisionManager* TheoryInferenceManager::getDecisionManager()
+{
+ return d_decManager;
+}
+
void TheoryInferenceManager::requirePhase(TNode n, bool pol)
{
return d_out.requirePhase(n, pol);
class Theory;
class TheoryState;
+class DecisionManager;
namespace eq {
class EqualityEngine;
class ProofEqEngine;
const std::string& name,
bool cacheLemmas = true);
virtual ~TheoryInferenceManager();
+ //--------------------------------------- initialization
/**
* Set equality engine, ee is a pointer to the official equality engine
* of theory.
*/
void setEqualityEngine(eq::EqualityEngine* ee);
+ /** Set the decision manager */
+ void setDecisionManager(DecisionManager* dm);
+ //--------------------------------------- end initialization
/**
* Are proofs enabled in this inference manager? Returns true if the proof
* node manager pnm provided to the constructor of this class was non-null.
*/
bool isProofEnabled() const;
+ /** Get the underlying proof equality engine */
+ eq::ProofEqEngine* getProofEqEngine();
/**
* Reset, which resets counters regarding the number of added lemmas and
* internal facts. This method should be manually called by the theory at
* since the last call to reset.
*/
bool hasSent() const;
- /** Get the underlying proof equality engine */
- eq::ProofEqEngine* getProofEqEngine();
//--------------------------------------- propagations
/**
* T-propagate literal lit, possibly encountered by equality engine,
/** Have we added a internal fact since the last call to reset? */
bool hasSentFact() const;
//--------------------------------------- phase requirements
+ /** Get the decision manager, which manages decision strategies. */
+ DecisionManager* getDecisionManager();
/**
* Set that literal n has SAT phase requirement pol, that is, it should be
* decided with polarity pol, for details see OutputChannel::requirePhase.
OutputChannel& d_out;
/** Pointer to equality engine of the theory. */
eq::EqualityEngine* d_ee;
+ /** Pointer to the decision manager */
+ DecisionManager* d_decManager;
/** A proof equality engine */
std::unique_ptr<eq::ProofEqEngine> d_pfee;
/** The proof node manager of the theory */
d_initialized = true;
// Strategy is user-context-dependent, since it is in sync with
// user-context-dependent flag d_initialized.
- d_thss->getTheory()->getDecisionManager()->registerStrategy(
- DecisionManager::STRAT_UF_CARD, d_c_dec_strat.get());
+ d_im.getDecisionManager()->registerStrategy(DecisionManager::STRAT_UF_CARD,
+ d_c_dec_strat.get());
}
}
&& !d_initializedCombinedCardinality.get())
{
d_initializedCombinedCardinality = true;
- d_th->getDecisionManager()->registerStrategy(
+ d_im.getDecisionManager()->registerStrategy(
DecisionManager::STRAT_UF_COMBINED_CARD, d_cc_dec_strat.get());
}
}