namespace theory {
namespace arith {
-TheoryArith::TheoryArith(context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo, QuantifiersEngine* qe)
- : Theory(THEORY_ARITH, c, u, out, valuation, logicInfo, qe)
- , d_internal(new TheoryArithPrivate(*this, c, u, out, valuation, logicInfo, qe))
+TheoryArith::TheoryArith(context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo)
+ : Theory(THEORY_ARITH, c, u, out, valuation, logicInfo)
+ , d_internal(new TheoryArithPrivate(*this, c, u, out, valuation, logicInfo))
{}
TheoryArith::~TheoryArith(){
d_internal->setMasterEqualityEngine(eq);
}
+void TheoryArith::setQuantifiersEngine(QuantifiersEngine* qe) {
+ this->Theory::setQuantifiersEngine(qe);
+ d_internal->setQuantifiersEngine(qe);
+}
+
void TheoryArith::addSharedTerm(TNode n){
d_internal->addSharedTerm(n);
}
KEEP_STATISTIC(TimerStat, d_ppRewriteTimer, "theory::arith::ppRewriteTimer");
public:
- TheoryArith(context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo, QuantifiersEngine* qe);
+ TheoryArith(context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo);
virtual ~TheoryArith();
/**
void preRegisterTerm(TNode n);
void setMasterEqualityEngine(eq::EqualityEngine* eq);
+ void setQuantifiersEngine(QuantifiersEngine* qe);
void check(Effort e);
void propagate(Effort e);
namespace theory {
namespace arith {
-TheoryArithPrivate::TheoryArithPrivate(TheoryArith& containing, context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo, QuantifiersEngine* qe) :
+TheoryArithPrivate::TheoryArithPrivate(TheoryArith& containing, context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo) :
d_containing(containing),
d_nlIncomplete( false),
d_rowTracking(),
d_unknownsInARow(0),
d_hasDoneWorkSinceCut(false),
d_learner(u),
- d_quantEngine(qe),
+ d_quantEngine(NULL),
d_assertionsThatDoNotMatchTheirLiterals(c),
d_nextIntegerCheckVar(0),
d_constantIntegerVariables(c),
d_congruenceManager.setMasterEqualityEngine(eq);
}
+void TheoryArithPrivate::setQuantifiersEngine(QuantifiersEngine* qe) {
+ d_quantEngine = qe;
+}
+
Node TheoryArithPrivate::getRealDivideBy0Func(){
Assert(!getLogicInfo().isLinear());
Assert(getLogicInfo().areRealsUsed());
Node ppRewriteTerms(TNode atom);
public:
- TheoryArithPrivate(TheoryArith& containing, context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo, QuantifiersEngine* qe);
+ TheoryArithPrivate(TheoryArith& containing, context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo);
~TheoryArithPrivate();
/**
void preRegisterTerm(TNode n);
void setMasterEqualityEngine(eq::EqualityEngine* eq);
+ void setQuantifiersEngine(QuantifiersEngine* qe);
void check(Theory::Effort e);
void propagate(Theory::Effort e);
//bool d_lazyRIntro1 = true;
//bool d_eagerIndexSplitting = false;
-TheoryArrays::TheoryArrays(context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo, QuantifiersEngine* qe) :
- Theory(THEORY_ARRAY, c, u, out, valuation, logicInfo, qe),
+TheoryArrays::TheoryArrays(context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo) :
+ Theory(THEORY_ARRAY, c, u, out, valuation, logicInfo),
d_numRow("theory::arrays::number of Row lemmas", 0),
d_numExt("theory::arrays::number of Ext lemmas", 0),
d_numProp("theory::arrays::number of propagations", 0),
public:
- TheoryArrays(context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo, QuantifiersEngine* qe);
+ TheoryArrays(context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo);
~TheoryArrays();
void setMasterEqualityEngine(eq::EqualityEngine* eq);
class TheoryBool : public Theory {
public:
- TheoryBool(context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo, QuantifiersEngine* qe) :
- Theory(THEORY_BOOL, c, u, out, valuation, logicInfo, qe) {
+ TheoryBool(context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo) :
+ Theory(THEORY_BOOL, c, u, out, valuation, logicInfo) {
}
PPAssertStatus ppAssert(TNode in, SubstitutionMap& outSubstitutions);
class TheoryBuiltin : public Theory {
public:
- TheoryBuiltin(context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo, QuantifiersEngine* qe) :
- Theory(THEORY_BUILTIN, c, u, out, valuation, logicInfo, qe) {}
+ TheoryBuiltin(context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo) :
+ Theory(THEORY_BUILTIN, c, u, out, valuation, logicInfo) {}
std::string identify() const { return std::string("TheoryBuiltin"); }
};/* class TheoryBuiltin */
using namespace std;
using namespace CVC4::theory::bv::utils;
-TheoryBV::TheoryBV(context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo, QuantifiersEngine* qe)
- : Theory(THEORY_BV, c, u, out, valuation, logicInfo, qe),
+TheoryBV::TheoryBV(context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo)
+ : Theory(THEORY_BV, c, u, out, valuation, logicInfo),
d_context(c),
d_alreadyPropagatedSet(c),
d_sharedTermsSet(c),
__gnu_cxx::hash_map<SubTheory, SubtheorySolver*, std::hash<int> > d_subtheoryMap;
public:
- TheoryBV(context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo, QuantifiersEngine* qe);
+ TheoryBV(context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo);
~TheoryBV();
void setMasterEqualityEngine(eq::EqualityEngine* eq);
using namespace CVC4::theory::datatypes;
-TheoryDatatypes::TheoryDatatypes(Context* c, UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo, QuantifiersEngine* qe) :
- Theory(THEORY_DATATYPES, c, u, out, valuation, logicInfo, qe),
+TheoryDatatypes::TheoryDatatypes(Context* c, UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo) :
+ Theory(THEORY_DATATYPES, c, u, out, valuation, logicInfo),
d_cycle_check(c),
d_hasSeenCycle(c, false),
d_infer(c),
/** compute care graph */
void computeCareGraph();
public:
- TheoryDatatypes(context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation,
- const LogicInfo& logicInfo, QuantifiersEngine* qe);
+ TheoryDatatypes(context::Context* c, context::UserContext* u,
+ OutputChannel& out, Valuation valuation,
+ const LogicInfo& logicInfo);
~TheoryDatatypes();
void setMasterEqualityEngine(eq::EqualityEngine* eq);
using namespace CVC4::theory::uf;
using namespace CVC4::theory::uf::tim;
-TheoryUFTim::TheoryUFTim(Context* c, UserContext* u, OutputChannel& out, Valuation valuation, QuantifiersEngine* qe) :
- Theory(THEORY_UF, c, u, out, valuation, qe),
+TheoryUFTim::TheoryUFTim(Context* c, UserContext* u, OutputChannel& out, Valuation valuation) :
+ Theory(THEORY_UF, c, u, out, valuation),
d_assertions(c),
d_pending(c),
d_currentPendingIdx(c,0),
public:
/** Constructs a new instance of TheoryUF w.r.t. the provided context.*/
- TheoryUFTim(context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, QuantifiersEngine* qe);
+ TheoryUFTim(context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation);
/** Destructor for the TheoryUF object. */
~TheoryUFTim();
using namespace idl;
TheoryIdl::TheoryIdl(context::Context* c, context::UserContext* u, OutputChannel& out,
- Valuation valuation, const LogicInfo& logicInfo, QuantifiersEngine* qe)
-: Theory(THEORY_ARITH, c, u, out, valuation, logicInfo, qe)
+ Valuation valuation, const LogicInfo& logicInfo)
+: Theory(THEORY_ARITH, c, u, out, valuation, logicInfo)
, d_model(c)
, d_assertionsDB(c)
{}
/** Theory constructor. */
TheoryIdl(context::Context* c, context::UserContext* u, OutputChannel& out,
- Valuation valuation, const LogicInfo& logicInfo, QuantifiersEngine* qe);
+ Valuation valuation, const LogicInfo& logicInfo);
/** Pre-processing of input atoms */
Node ppRewrite(TNode atom);
using namespace CVC4::theory;
using namespace CVC4::theory::quantifiers;
-TheoryQuantifiers::TheoryQuantifiers(Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo, QuantifiersEngine* qe) :
- Theory(THEORY_QUANTIFIERS, c, u, out, valuation, logicInfo, qe),
+TheoryQuantifiers::TheoryQuantifiers(Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo) :
+ Theory(THEORY_QUANTIFIERS, c, u, out, valuation, logicInfo),
d_numRestarts(0),
d_masterEqualityEngine(0)
{
eq::EqualityEngine* d_masterEqualityEngine;
public:
- TheoryQuantifiers(context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo, QuantifiersEngine* qe);
+ TheoryQuantifiers(context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo);
~TheoryQuantifiers();
void setMasterEqualityEngine(eq::EqualityEngine* eq);
context::UserContext* u,
OutputChannel& out,
Valuation valuation,
- const LogicInfo& logicInfo,
- QuantifiersEngine* qe) :
- Theory(THEORY_REWRITERULES, c, u, out, valuation, logicInfo, qe),
+ const LogicInfo& logicInfo) :
+ Theory(THEORY_REWRITERULES, c, u, out, valuation, logicInfo),
d_rules(c), d_ruleinsts(c), d_guardeds(c), d_checkLevel(c,0),
d_explanations(c), d_ruleinsts_to_add(), d_ppAssert_on(false)
- {
+{
d_true = NodeManager::currentNM()->mkConst<bool>(true);
d_false = NodeManager::currentNM()->mkConst<bool>(false);
}
context::UserContext* u,
OutputChannel& out,
Valuation valuation,
- const LogicInfo& logicInfo,
- QuantifiersEngine* qe);
+ const LogicInfo& logicInfo);
/** Usual function for theories */
void check(Theory::Effort e);
namespace theory {
namespace strings {
-TheoryStrings::TheoryStrings(context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo, QuantifiersEngine* qe)
- : Theory(THEORY_STRINGS, c, u, out, valuation, logicInfo, qe),
+TheoryStrings::TheoryStrings(context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo)
+ : Theory(THEORY_STRINGS, c, u, out, valuation, logicInfo),
d_notify( *this ),
d_equalityEngine(d_notify, c, "theory::strings::TheoryStrings"),
d_conflict( c, false ),
typedef context::CDHashMap<Node, int, NodeHashFunction> NodeIntMap;
public:
- TheoryStrings(context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo, QuantifiersEngine* qe);
+ TheoryStrings(context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo);
~TheoryStrings();
void setMasterEqualityEngine(eq::EqualityEngine* eq);
* Construct a Theory.
*/
Theory(TheoryId id, context::Context* satContext, context::UserContext* userContext,
- OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo,
- QuantifiersEngine* qe, eq::EqualityEngine* master = 0) throw()
+ OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo) throw()
: d_id(id)
, d_satContext(satContext)
, d_userContext(userContext)
, d_facts(satContext)
, d_factsHead(satContext, 0)
, d_sharedTermsIndex(satContext, 0)
- , d_careGraph(0)
- , d_quantEngine(qe)
+ , d_careGraph(NULL)
+ , d_quantEngine(NULL)
, d_computeCareGraphTime(statName(id, "computeCareGraphTime"))
, d_sharedTerms(satContext)
, d_out(&out)
return d_quantEngine;
}
+ /**
+ * Finish theory initialization. At this point, options and the logic
+ * setting are final, and the master equality engine and quantifiers
+ * engine (if any) are initialized. This base class implementation
+ * does nothing.
+ */
+ virtual void finishInit() { }
+
/**
* Pre-register a term. Done one time for a Node, ever.
*/
*/
virtual void setMasterEqualityEngine(eq::EqualityEngine* eq) { }
+ /**
+ * Called to set the quantifiers engine.
+ */
+ virtual void setQuantifiersEngine(QuantifiersEngine* qe) {
+ d_quantEngine = qe;
+ }
+
/**
* Return the current theory care graph. Theories should overload computeCareGraph to do
* the actual computation, and use addCarePair to add pairs to the care graph.
using namespace CVC4::theory;
void TheoryEngine::finishInit() {
+ // initialize the quantifiers engine
+ d_quantEngine = new QuantifiersEngine(d_context, d_userContext, this);
+
if (d_logicInfo.isQuantified()) {
d_quantEngine->finishInit();
Assert(d_masterEqualityEngine == 0);
for(TheoryId theoryId = theory::THEORY_FIRST; theoryId != theory::THEORY_LAST; ++ theoryId) {
if (d_theoryTable[theoryId]) {
+ d_theoryTable[theoryId]->setQuantifiersEngine(d_quantEngine);
d_theoryTable[theoryId]->setMasterEqualityEngine(d_masterEqualityEngine);
}
}
}
+
+ for(TheoryId theoryId = theory::THEORY_FIRST; theoryId != theory::THEORY_LAST; ++ theoryId) {
+ if (d_theoryTable[theoryId]) {
+ d_theoryTable[theoryId]->finishInit();
+ }
+ }
}
void TheoryEngine::eqNotifyNewClass(TNode t){
d_theoryOut[theoryId] = NULL;
}
- // initialize the quantifiers engine
- d_quantEngine = new QuantifiersEngine(context, userContext, this);
-
// build model information if applicable
d_curr_model = new theory::TheoryModel(userContext, "DefaultModel", true);
d_curr_model_builder = new theory::TheoryEngineModelBuilder(this);
inline void addTheory(theory::TheoryId theoryId) {
Assert(d_theoryTable[theoryId] == NULL && d_theoryOut[theoryId] == NULL);
d_theoryOut[theoryId] = new EngineOutputChannel(this, theoryId);
- d_theoryTable[theoryId] = new TheoryClass(d_context, d_userContext, *d_theoryOut[theoryId], theory::Valuation(this), d_logicInfo, getQuantifiersEngine());
+ d_theoryTable[theoryId] = new TheoryClass(d_context, d_userContext, *d_theoryOut[theoryId], theory::Valuation(this), d_logicInfo);
}
inline void setPropEngine(prop::PropEngine* propEngine) {
using namespace CVC4::theory::uf;
/** Constructs a new instance of TheoryUF w.r.t. the provided context.*/
-TheoryUF::TheoryUF(context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo, QuantifiersEngine* qe) :
- Theory(THEORY_UF, c, u, out, valuation, logicInfo, qe),
+TheoryUF::TheoryUF(context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo) :
+ Theory(THEORY_UF, c, u, out, valuation, logicInfo),
d_notify(*this),
/* The strong theory solver can be notified by EqualityEngine::init(),
* so make sure it's initialized first. */
- d_thss(options::finiteModelFind() ? new StrongSolverTheoryUF(c, u, out, this) : NULL),
+ d_thss(NULL),
d_equalityEngine(d_notify, c, "theory::uf::TheoryUF"),
d_conflict(c, false),
d_literalsToPropagate(c),
d_equalityEngine.setMasterEqualityEngine(eq);
}
+void TheoryUF::finishInit() {
+ // initialize the strong solver
+ if (options::finiteModelFind()) {
+ d_thss = new StrongSolverTheoryUF(getSatContext(), getUserContext(), *d_out, this);
+ }
+}
+
static Node mkAnd(const std::vector<TNode>& conjunctions) {
Assert(conjunctions.size() > 0);
public:
/** Constructs a new instance of TheoryUF w.r.t. the provided context.*/
- TheoryUF(context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo, QuantifiersEngine* qe);
+ TheoryUF(context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo);
~TheoryUF() {
// destruct all ppRewrite() callbacks
}
void setMasterEqualityEngine(eq::EqualityEngine* eq);
+ void finishInit();
void check(Effort);
void preRegisterTerm(TNode term);
d_smt->d_theoryEngine->d_theoryTable[THEORY_ARITH] = NULL;
d_smt->d_theoryEngine->d_theoryOut[THEORY_ARITH] = NULL;
- d_arith = new TheoryArith(d_ctxt, d_uctxt, d_outputChannel, Valuation(NULL), d_logicInfo, d_smt->d_theoryEngine->d_quantEngine);
+ d_arith = new TheoryArith(d_ctxt, d_uctxt, d_outputChannel, Valuation(NULL), d_logicInfo);
preregistered = new std::set<Node>();
// static std::deque<RewriteItem> s_expected;
public:
- FakeTheory(context::Context* ctxt, context::UserContext* uctxt, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo, QuantifiersEngine* qe) :
- Theory(theoryId, ctxt, uctxt, out, valuation, logicInfo, qe)
+ FakeTheory(context::Context* ctxt, context::UserContext* uctxt, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo) :
+ Theory(theoryId, ctxt, uctxt, out, valuation, logicInfo)
{ }
/** Register an expected rewrite call */
set<Node> d_registered;
vector<Node> d_getSequence;
- DummyTheory(Context* ctxt, UserContext* uctxt, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo, QuantifiersEngine* qe) :
- Theory(theory::THEORY_BUILTIN, ctxt, uctxt, out, valuation, logicInfo, qe) {
+ DummyTheory(Context* ctxt, UserContext* uctxt, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo) :
+ Theory(theory::THEORY_BUILTIN, ctxt, uctxt, out, valuation, logicInfo) {
}
void registerTerm(TNode n) {
d_smt->d_theoryEngine->d_theoryTable[THEORY_BUILTIN] = NULL;
d_smt->d_theoryEngine->d_theoryOut[THEORY_BUILTIN] = NULL;
- d_dummy = new DummyTheory(d_ctxt, d_uctxt, d_outputChannel, Valuation(NULL), *d_logicInfo, NULL);
+ d_dummy = new DummyTheory(d_ctxt, d_uctxt, d_outputChannel, Valuation(NULL), *d_logicInfo);
d_outputChannel.clear();
atom0 = d_nm->mkConst(true);
atom1 = d_nm->mkConst(false);