// forward declaration
class TheoryBV;
-typedef context::CDQueue<TNode> AssertionQueue;
+typedef context::CDQueue<Node> AssertionQueue;
/**
* Abstract base class for bit-vector subtheory solvers
*
: SubtheorySolver(c, bv),
d_notify(*this),
d_equalityEngine(d_notify, c, "theory::bv::TheoryBV"),
- d_assertions(c),
d_slicer(new Slicer(c, this)),
- d_isCoreTheory(c, true)
+ d_isCoreTheory(c, true),
+ d_reasons(c)
{
if (d_useEqualityEngine) {
explanation.push_back(fact);
Node reason = utils::mkAnd(explanation);
-
+ d_reasons.insert(reason);
+
Assert (utils::getSize(new_a) == utils::getSize(new_b) &&
utils::getSize(new_a) == utils::getSize(a));
// FIXME: do we still need to assert these?
Node a_eq_new_a = nm->mkNode(kind::EQUAL, a, new_a);
Node b_eq_new_b = nm->mkNode(kind::EQUAL, b, new_b);
+ d_reasons.insert(a_eq_new_a);
+ d_reasons.insert(b_eq_new_b);
+
bool ok = true;
ok = assertFactToEqualityEngine(a_eq_new_a, utils::mkTrue());
if (!ok) return false;
for (unsigned i = 0; i < new_a.getNumChildren(); ++i) {
Node eq_i = nm->mkNode(kind::EQUAL, new_a[i], new_b[i]);
ok = assertFactToEqualityEngine(eq_i, reason);
+ d_reasons.insert(eq_i);
if (!ok) return false;
}
}
void CoreSolver::collectModelInfo(TheoryModel* m) {
if (Debug.isOn("bitvector-model")) {
- context::CDList<TNode>::const_iterator it = d_assertions.begin();
- for (; it!= d_assertions.end(); ++it) {
+ context::CDQueue<Node>::const_iterator it = d_assertionQueue.begin();
+ for (; it!= d_assertionQueue.end(); ++it) {
Debug("bitvector-model") << "CoreSolver::collectModelInfo (assert "
<< *it << ")\n";
}
#include "cvc4_private.h"
#include "theory/bv/bv_subtheory.h"
#include "context/cdhashmap.h"
+#include "context/cdhashset.h"
namespace CVC4 {
namespace theory {
/** Store a conflict from merging two constants */
void conflict(TNode a, TNode b);
- /** FIXME: for debugging purposes only */
- context::CDList<TNode> d_assertions;
Slicer* d_slicer;
context::CDO<bool> d_isCoreTheory;
-
+ /** To make sure we keep the explanations */
+ context::CDHashSet<Node, NodeHashFunction> d_reasons;
bool assertFactToEqualityEngine(TNode fact, TNode reason);
bool decomposeFact(TNode fact);
Node getBaseDecomposition(TNode a, std::vector<TNode>& explanation);
}
void UnionFind::backtrack() {
- return;
int size = d_undoStack.size();
for (int i = size; i > (int)d_undoStackIndex.get(); --i) {
Operation op = d_undoStack.back();
}
TermId Slicer::getId(TNode node) const {
- __gnu_cxx::hash_map<TNode, TermId, TNodeHashFunction >::const_iterator it = d_nodeToId.find(node);
+ __gnu_cxx::hash_map<Node, TermId, NodeHashFunction >::const_iterator it = d_nodeToId.find(node);
Assert (it != d_nodeToId.end());
return it->second;
}
}
}
-void Slicer::getBaseDecomposition(TNode node, std::vector<Node>& decomp, std::vector<TNode>& explanation) {
+void Slicer::getBaseDecomposition(TNode node, std::vector<Node>& decomp, std::vector<Node>& explanation) {
Debug("bv-slicer") << "Slicer::getBaseDecomposition " << node << endl;
Index high = utils::getSize(node) - 1;
for (unsigned i = 0; i < explanation_ids.size(); ++i) {
Assert (hasExplanation(explanation_ids[i]));
- TNode exp = getExplanation(explanation_ids[i]);
+ Node exp = getExplanation(explanation_ids[i]);
explanation.push_back(exp);
}
class Slicer {
__gnu_cxx::hash_map<TermId, TNode, __gnu_cxx::hash<TermId> > d_idToNode;
- __gnu_cxx::hash_map<TNode, TermId, TNodeHashFunction> d_nodeToId;
- __gnu_cxx::hash_map<TNode, bool, TNodeHashFunction> d_coreTermCache;
- __gnu_cxx::hash_map<TNode, ExplanationId, TNodeHashFunction> d_explanationToId;
- std::vector<TNode> d_explanations;
+ __gnu_cxx::hash_map<Node, TermId, NodeHashFunction> d_nodeToId;
+ __gnu_cxx::hash_map<Node, bool, NodeHashFunction> d_coreTermCache;
+ __gnu_cxx::hash_map<Node, ExplanationId, NodeHashFunction> d_explanationToId;
+ std::vector<Node> d_explanations;
UnionFind d_unionFind;
context::CDQueue<Node> d_newSplits;