#include "theory/quantifiers/instantiate.h"
#include "theory/quantifiers/quant_util.h"
+#include "theory/quantifiers/quantifiers_state.h"
#include "theory/quantifiers/term_database.h"
#include "theory/quantifiers_engine.h"
namespace theory {
namespace inst {
-bool InstMatchTrie::addInstMatch(QuantifiersEngine* qe,
+bool InstMatchTrie::addInstMatch(quantifiers::QuantifiersState& qs,
Node f,
std::vector<Node>& m,
bool modEq,
if (it != d_data.end())
{
bool ret =
- it->second.addInstMatch(qe, f, m, modEq, imtio, onlyExist, index + 1);
+ it->second.addInstMatch(qs, f, m, modEq, imtio, onlyExist, index + 1);
if (!onlyExist || !ret)
{
return ret;
}
if (modEq)
{
- quantifiers::QuantifiersState& qs = qe->getState();
// check modulo equality if any other instantiation match exists
if (!n.isNull() && qs.hasTerm(n))
{
if (itc != d_data.end())
{
if (itc->second.addInstMatch(
- qe, f, m, modEq, imtio, true, index + 1))
+ qs, f, m, modEq, imtio, true, index + 1))
{
return false;
}
}
if (!onlyExist)
{
- d_data[n].addInstMatch(qe, f, m, modEq, imtio, false, index + 1);
+ d_data[n].addInstMatch(qs, f, m, modEq, imtio, false, index + 1);
}
return true;
}
d_data.clear();
}
-bool CDInstMatchTrie::addInstMatch(QuantifiersEngine* qe,
+bool CDInstMatchTrie::addInstMatch(quantifiers::QuantifiersState& qs,
Node f,
std::vector<Node>& m,
- context::Context* c,
bool modEq,
unsigned index,
bool onlyExist)
std::map<Node, CDInstMatchTrie*>::iterator it = d_data.find(n);
if (it != d_data.end())
{
- bool ret =
- it->second->addInstMatch(qe, f, m, c, modEq, index + 1, onlyExist);
+ bool ret = it->second->addInstMatch(qs, f, m, modEq, index + 1, onlyExist);
if (!onlyExist || !ret)
{
return reset || ret;
if (modEq)
{
// check modulo equality if any other instantiation match exists
- quantifiers::QuantifiersState& qs = qe->getState();
if (!n.isNull() && qs.hasTerm(n))
{
eq::EqClassIterator eqc(qs.getRepresentative(n), qs.getEqualityEngine());
std::map<Node, CDInstMatchTrie*>::iterator itc = d_data.find(en);
if (itc != d_data.end())
{
- if (itc->second->addInstMatch(qe, f, m, c, modEq, index + 1, true))
+ if (itc->second->addInstMatch(qs, f, m, modEq, index + 1, true))
{
return false;
}
if (!onlyExist)
{
- // std::map< Node, CDInstMatchTrie* >::iterator it = d_data.find( n );
- CDInstMatchTrie* imt = new CDInstMatchTrie(c);
+ CDInstMatchTrie* imt = new CDInstMatchTrie(qs.getUserContext());
Assert(d_data.find(n) == d_data.end());
d_data[n] = imt;
- imt->addInstMatch(qe, f, m, c, modEq, index + 1, false);
+ imt->addInstMatch(qs, f, m, modEq, index + 1, false);
}
return true;
}
class QuantifiersEngine;
+namespace {
+class QuantifiersState;
+}
+
namespace inst {
/** trie for InstMatch objects
* The domain of m is the bound variables of quantified formula q.
* It returns true if (the suffix) of m exists in this trie.
* If modEq is true, we check for duplication modulo equality the current
- * equalities in the active equality engine of qe.
+ * equalities in the equality engine of qs.
*/
- bool existsInstMatch(QuantifiersEngine* qe,
+ bool existsInstMatch(quantifiers::QuantifiersState& qs,
Node q,
InstMatch& m,
bool modEq = false,
ImtIndexOrder* imtio = NULL,
unsigned index = 0)
{
- return !addInstMatch(qe, q, m, modEq, imtio, true, index);
+ return !addInstMatch(qs, q, m, modEq, imtio, true, index);
}
/** exists inst match, vector version */
- bool existsInstMatch(QuantifiersEngine* qe,
+ bool existsInstMatch(quantifiers::QuantifiersState& qs,
Node q,
std::vector<Node>& m,
bool modEq = false,
ImtIndexOrder* imtio = NULL,
unsigned index = 0)
{
- return !addInstMatch(qe, q, m, modEq, imtio, true, index);
+ return !addInstMatch(qs, q, m, modEq, imtio, true, index);
}
/** add inst match
*
* trie, and returns true if and only if m did not already occur in this trie.
* The domain of m is the bound variables of quantified formula q.
* If modEq is true, we check for duplication modulo equality the current
- * equalities in the active equality engine of qe.
+ * equalities in the equality engine of qs.
*/
- bool addInstMatch(QuantifiersEngine* qe,
+ bool addInstMatch(quantifiers::QuantifiersState& qs,
Node q,
InstMatch& m,
bool modEq = false,
bool onlyExist = false,
unsigned index = 0)
{
- return addInstMatch(qe, q, m.d_vals, modEq, imtio, onlyExist, index);
+ return addInstMatch(qs, q, m.d_vals, modEq, imtio, onlyExist, index);
}
/** add inst match, vector version */
- bool addInstMatch(QuantifiersEngine* qe,
+ bool addInstMatch(quantifiers::QuantifiersState& qs,
Node f,
std::vector<Node>& m,
bool modEq = false,
* The domain of m is the bound variables of quantified formula q.
* It returns true if (the suffix) of m exists in this trie.
* If modEq is true, we check for duplication modulo equality the current
- * equalities in the active equality engine of qe.
+ * equalities in the equality engine of qs.
* It additionally takes a context c, for which the entry is valid in.
*/
- bool existsInstMatch(QuantifiersEngine* qe,
+ bool existsInstMatch(quantifiers::QuantifiersState& qs,
Node q,
InstMatch& m,
- context::Context* c,
bool modEq = false,
unsigned index = 0)
{
- return !addInstMatch(qe, q, m, c, modEq, index, true);
+ return !addInstMatch(qs, q, m, modEq, index, true);
}
/** exists inst match, vector version */
- bool existsInstMatch(QuantifiersEngine* qe,
+ bool existsInstMatch(quantifiers::QuantifiersState& qs,
Node q,
std::vector<Node>& m,
- context::Context* c,
bool modEq = false,
unsigned index = 0)
{
- return !addInstMatch(qe, q, m, c, modEq, index, true);
+ return !addInstMatch(qs, q, m, modEq, index, true);
}
/** add inst match
*
* trie, and returns true if and only if m did not already occur in this trie.
* The domain of m is the bound variables of quantified formula q.
* If modEq is true, we check for duplication modulo equality the current
- * equalities in the active equality engine of qe.
+ * equalities in the equality engine of qs.
* It additionally takes a context c, for which the entry is valid in.
*/
- bool addInstMatch(QuantifiersEngine* qe,
+ bool addInstMatch(quantifiers::QuantifiersState& qs,
Node q,
InstMatch& m,
- context::Context* c,
bool modEq = false,
unsigned index = 0,
bool onlyExist = false)
{
- return addInstMatch(qe, q, m.d_vals, c, modEq, index, onlyExist);
+ return addInstMatch(qs, q, m.d_vals, modEq, index, onlyExist);
}
/** add inst match, vector version */
- bool addInstMatch(QuantifiersEngine* qe,
+ bool addInstMatch(quantifiers::QuantifiersState& qs,
Node q,
std::vector<Node>& m,
- context::Context* c,
bool modEq = false,
unsigned index = 0,
bool onlyExist = false);
*
* This method returns true if the match m was not previously added to this
* class. If modEq is true, we consider duplicates modulo the current
- * equalities stored in the active equality engine of quantifiers engine.
+ * equalities stored in the equality engine of qs.
*/
- bool addInstMatch(QuantifiersEngine* qe,
+ bool addInstMatch(quantifiers::QuantifiersState& qs,
Node q,
InstMatch& m,
bool modEq = false)
{
- return d_imt.addInstMatch(qe, q, m, modEq, d_imtio);
+ return d_imt.addInstMatch(qs, q, m, modEq, d_imtio);
}
/** returns true if this trie contains m
*
* This method returns true if the match m exists in this
* class. If modEq is true, we consider duplicates modulo the current
- * equalities stored in the active equality engine of quantifiers engine.
+ * equalities stored in the equality engine of qs.
*/
- bool existsInstMatch(QuantifiersEngine* qe,
+ bool existsInstMatch(quantifiers::QuantifiersState& qs,
Node q,
InstMatch& m,
bool modEq = false)
{
- return d_imt.existsInstMatch(qe, q, m, modEq, d_imtio);
+ return d_imt.existsInstMatch(qs, q, m, modEq, d_imtio);
}
private:
d_c_inst_match_trie.find(q);
if (it != d_c_inst_match_trie.end())
{
- return it->second->existsInstMatch(
- d_qe, q, terms, d_qstate.getUserContext(), modEq);
+ return it->second->existsInstMatch(d_qstate, q, terms, modEq);
}
}
else
d_inst_match_trie.find(q);
if (it != d_inst_match_trie.end())
{
- return it->second.existsInstMatch(d_qe, q, terms, modEq);
+ return it->second.existsInstMatch(d_qstate, q, terms, modEq);
}
}
return false;
d_c_inst_match_trie[q] = imt;
}
d_c_inst_match_trie_dom.insert(q);
- return imt->addInstMatch(d_qe, q, terms, d_qstate.getUserContext(), modEq);
+ return imt->addInstMatch(d_qstate, q, terms, modEq);
}
Trace("inst-add-debug") << "Adding into inst trie" << std::endl;
- return d_inst_match_trie[q].addInstMatch(d_qe, q, terms, modEq);
+ return d_inst_match_trie[q].addInstMatch(d_qstate, q, terms, modEq);
}
bool Instantiate::removeInstantiationInternal(Node q, std::vector<Node>& terms)