diff options
author | Dejan Jovanović <dejan.jovanovic@gmail.com> | 2012-03-22 20:40:41 +0000 |
---|---|---|
committer | Dejan Jovanović <dejan.jovanovic@gmail.com> | 2012-03-22 20:40:41 +0000 |
commit | 8c4495b18e40a406be35baceaf473878bcc375f1 (patch) | |
tree | 2c1e491cbb088e26775572160b31ae2cd250bad8 /src/theory/uf/theory_uf.cpp | |
parent | f40ec39fe48f83e1cc1a31f9e18635687bd63c76 (diff) |
some improvements to the sharing mechanism/interface
Diffstat (limited to 'src/theory/uf/theory_uf.cpp')
-rw-r--r-- | src/theory/uf/theory_uf.cpp | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/src/theory/uf/theory_uf.cpp b/src/theory/uf/theory_uf.cpp index 7f5e11a64..f0694462d 100644 --- a/src/theory/uf/theory_uf.cpp +++ b/src/theory/uf/theory_uf.cpp @@ -396,12 +396,21 @@ void TheoryUF::ppStaticLearn(TNode n, NodeBuilder<>& learned) { }/* TheoryUF::ppStaticLearn() */ EqualityStatus TheoryUF::getEqualityStatus(TNode a, TNode b) { + + Node equality = a.eqNode(b); + Node rewrittenEquality = Rewriter::rewrite(equality); + if (rewrittenEquality.isConst()) { + if (!rewrittenEquality.getConst<bool>()) { + return EQUALITY_FALSE; + } + } + if (d_equalityEngine.areEqual(a, b)) { // The terms are implied to be equal return EQUALITY_TRUE; } if (d_equalityEngine.areDisequal(a, b)) { - // The rems are implied to be dis-equal + // The terms are implied to be dis-equal return EQUALITY_FALSE; } // All other terms we interpret as dis-equal in the model @@ -413,17 +422,19 @@ void TheoryUF::addSharedTerm(TNode t) { d_equalityEngine.addTriggerTerm(t); } -void TheoryUF::computeCareGraph(CareGraph& careGraph) { +void TheoryUF::computeCareGraph() { if (d_sharedTerms.size() > 0) { - std::vector<CarePair> currentPairs; + vector< pair<TNode, TNode> > currentPairs; // Go through the function terms and see if there are any to split on unsigned functionTerms = d_functionsTerms.size(); for (unsigned i = 0; i < functionTerms; ++ i) { + TNode f1 = d_functionsTerms[i]; Node op = f1.getOperator(); + for (unsigned j = i + 1; j < functionTerms; ++ j) { TNode f2 = d_functionsTerms[j]; @@ -462,24 +473,30 @@ void TheoryUF::computeCareGraph(CareGraph& careGraph) { break; } - if (!d_equalityEngine.isTriggerTerm(x) || !d_equalityEngine.isTriggerTerm(y)) { - // Not connected to shared terms, we don't care - continue; - } - if (eqStatusUf == EQUALITY_TRUE) { - // We don't neeed this one + // We don't need this one Debug("uf::sharing") << "TheoryUf::computeCareGraph(): equal" << std::endl; continue; } + if (!d_equalityEngine.isTriggerTerm(x) || !d_equalityEngine.isTriggerTerm(y)) { + // Not connected to shared terms, we don't care + continue; + } + + // Get representative trigger terms + TNode x_shared = d_equalityEngine.getTriggerTermRepresentative(x); + TNode y_shared = d_equalityEngine.getTriggerTermRepresentative(y); + // Otherwise, we need to figure it out Debug("uf::sharing") << "TheoryUf::computeCareGraph(): adding to care-graph" << std::endl; - currentPairs.push_back(CarePair(x, y, THEORY_UF)); + currentPairs.push_back(make_pair(x_shared, y_shared)); } if (!somePairIsDisequal) { - careGraph.insert(careGraph.end(), currentPairs.begin(), currentPairs.end()); + for (unsigned i = 0; i < currentPairs.size(); ++ i) { + addCarePair(currentPairs[i].first, currentPairs[i].second); + } } } } |