summaryrefslogtreecommitdiff
path: root/src/theory/theory_engine.cpp
diff options
context:
space:
mode:
authorDejan Jovanović <dejan.jovanovic@gmail.com>2012-01-23 04:19:38 +0000
committerDejan Jovanović <dejan.jovanovic@gmail.com>2012-01-23 04:19:38 +0000
commit3b3c5597a926cf6f2056fe237bcac7c4d2596a75 (patch)
tree7cbd06f2e08caded4b254e49ae5885187a31f76d /src/theory/theory_engine.cpp
parentb0ac192fd4e8b1ff707e0e3cc9df92ab385f1fd4 (diff)
fix for bug295
Diffstat (limited to 'src/theory/theory_engine.cpp')
-rw-r--r--src/theory/theory_engine.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/theory/theory_engine.cpp b/src/theory/theory_engine.cpp
index d08e79c8e..0a9670678 100644
--- a/src/theory/theory_engine.cpp
+++ b/src/theory/theory_engine.cpp
@@ -193,11 +193,15 @@ void TheoryEngine::assertSharedEqualities() {
for (unsigned i = 0; i < d_propagatedEqualities.size(); ++ i) {
const SharedEquality& eq = d_propagatedEqualities[i];
// Check if the theory already got this one
- // TODO: the real shared (non-sat) equalities
if (d_sharedAssertions.find(eq.toAssert) == d_sharedAssertions.end()) {
- Debug("sharing") << "TheoryEngine::assertSharedEqualities(): asserting " << eq.toAssert.node << " to " << eq.toAssert.theory << " from " << eq.toExplain.theory << std::endl;
+ Debug("sharing") << "TheoryEngine::assertSharedEqualities(): asserting " << eq.toAssert.node << " to " << eq.toAssert.theory << std::endl;
+ Debug("sharing") << "TheoryEngine::assertSharedEqualities(): orignal " << eq.toExplain.node << " from " << eq.toExplain.theory << std::endl;
d_sharedAssertions[eq.toAssert] = eq.toExplain;
- theoryOf(eq.toAssert.theory)->assertFact(eq.toAssert.node, false);
+ if (eq.toAssert.theory == theory::THEORY_LAST) {
+ d_propagatedLiterals.push_back(eq.toAssert.node);
+ } else {
+ theoryOf(eq.toAssert.theory)->assertFact(eq.toAssert.node, false);
+ }
}
}
// Clear the equalities
@@ -238,10 +242,10 @@ void TheoryEngine::combineTheories() {
if (isTrivial || (d_propEngine->isSatLiteral(normalizedEquality) && d_propEngine->hasValue(normalizedEquality, value))) {
Debug("sharing") << "TheoryEngine::combineTheories(): has a literal or is trivial" << std::endl;
- if (isTrivial) {
- // if the equality is trivial, we assert it back to the theory saying the sat solver should explain
- value = normalizedEquality.getConst<bool>();
- }
+ if (isTrivial) {
+ // if the equality is trivial, we assert it back to the theory saying the sat solver should explain
+ value = normalizedEquality.getConst<bool>();
+ }
// Normalize the equality to the theory that requested it
Node toAssert = Rewriter::rewriteEquality(carePair.theory, equality);
@@ -432,9 +436,9 @@ void TheoryEngine::shutdown() {
theory::Theory::SolveStatus TheoryEngine::solve(TNode literal, SubstitutionMap& substitutionOut) {
TNode atom = literal.getKind() == kind::NOT ? literal[0] : literal;
- Trace("theory") << "TheoryEngine::solve(" << literal << "): solving with " << theoryOf(atom)->getId() << endl;
+ Trace("theory::solve") << "TheoryEngine::solve(" << literal << "): solving with " << theoryOf(atom)->getId() << endl;
Theory::SolveStatus solveStatus = theoryOf(atom)->solve(literal, substitutionOut);
- Trace("theory") << "TheoryEngine::solve(" << literal << ") => " << solveStatus << endl;
+ Trace("theory::solve") << "TheoryEngine::solve(" << literal << ") => " << solveStatus << endl;
return solveStatus;
}
@@ -448,7 +452,7 @@ struct preprocess_stack_element {
Node TheoryEngine::preprocess(TNode assertion) {
- Trace("theory") << "TheoryEngine::preprocess(" << assertion << ")" << endl;
+ Trace("theory::preprocess") << "TheoryEngine::preprocess(" << assertion << ")" << endl;
// Do a topological sort of the subexpressions and substitute them
vector<preprocess_stack_element> toVisit;
@@ -579,7 +583,8 @@ void TheoryEngine::propagate(TNode literal, theory::TheoryId theory) {
Debug("theory") << "literal " << literal << " (" << normalizedLiteral << ") propagated by " << theory << " but already has a sat value " << (value ? "true" : "false") << std::endl;
Assert(value);
} else {
- d_propagatedLiterals.push_back(normalizedLiteral);
+ SharedEquality sharedEquality(normalizedLiteral, literal, theory, theory::THEORY_LAST);
+ d_propagatedEqualities.push_back(sharedEquality);
}
}
// Otherwise, we assert it to all interested theories
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback