template <typename NotifyClass>
void EqualityEngine<NotifyClass>::getExplanation(TNode t1, TNode t2, std::vector<TNode>& equalities) const {
- Assert(getRepresentative(t1) == getRepresentative(t2));
-
Debug("equality") << "EqualityEngine::getExplanation(" << t1 << "," << t2 << ")" << std::endl;
+ Assert(getRepresentative(t1) == getRepresentative(t2));
+
// Backtrack if necessary
const_cast<EqualityEngine*>(this)->backtrack();
}
}
-bool TheoryUF::propagate(TNode atom, bool isTrue) {
- Debug("uf") << "TheoryUF::propagate(" << atom << ", " << (isTrue ? "true" : "false" ) << ")" << std::endl;
+bool TheoryUF::propagate(TNode literal) {
+ Debug("uf") << "TheoryUF::propagate(" << literal << ")" << std::endl;
// If already in conflict, no more propagation
if (d_conflict) {
- Debug("uf") << "TheoryUF::propagate(" << atom << ", " << (isTrue ? "true" : "false" ) << "): already in conflict" << std::endl;
+ Debug("uf") << "TheoryUF::propagate(" << literal << "): already in conflict" << std::endl;
return false;
}
- // The literal
- TNode literal = isTrue ? (Node) atom : atom.notNode();
-
// See if the literal has been asserted already
bool satValue = false;
bool isAsserted = literal == d_false || d_valuation.hasSatValue(literal, satValue);
// If asserted, we're done or in conflict
if (isAsserted) {
if (satValue) {
- Debug("uf") << "TheoryUF::propagate(" << atom << ", " << (isTrue ? "true" : "false" ) << ") => already known" << std::endl;
+ Debug("uf") << "TheoryUF::propagate(" << literal << ") => already known" << std::endl;
return true;
} else {
- Debug("uf") << "TheoryUF::propagate(" << atom << ", " << (isTrue ? "true" : "false" ) << ") => conflict" << std::endl;
+ Debug("uf") << "TheoryUF::propagate(" << literal << ") => conflict" << std::endl;
std::vector<TNode> assumptions;
if (literal != d_false) {
- TNode negatedLiteral = isTrue ? atom.notNode() : (Node) atom;
+ TNode negatedLiteral = literal.getKind() == kind::NOT ? literal[0] : (TNode) literal.notNode();
assumptions.push_back(negatedLiteral);
}
explain(literal, assumptions);
}
// Nothing, just enqueue it for propagation and mark it as asserted already
- Debug("uf") << "TheoryUF::propagate(" << atom << ", " << (isTrue ? "true" : "false" ) << ") => enqueuing for propagation" << std::endl;
+ Debug("uf") << "TheoryUF::propagate(" << literal << ") => enqueuing for propagation" << std::endl;
d_literalsToPropagate.push_back(literal);
return true;
case kind::NOT:
lhs = literal[0];
rhs = d_false;
+ break;
case kind::CONST_BOOLEAN:
// we get to explain true = false, since we set false to be the trigger of this
lhs = d_true;
public:
NotifyClass(TheoryUF& uf): d_uf(uf) {}
- bool notifyEquality(TNode eq) {
- Debug("uf") << "NotifyClass::notifyEquality(" << eq << ")" << std::endl;
+ bool notifyEquality(TNode reason) {
+ Debug("uf") << "NotifyClass::notifyEquality(" << reason << ")" << std::endl;
// Just forward to uf
- return d_uf.propagate(eq, true);
+ return d_uf.propagate(reason);
}
};
Node d_conflictNode;
/**
- * Should be called to propagate the atom. If isTrue is true, the atom should be propagated,
- * otherwise the negated atom should be propagated.
+ * Should be called to propagate the literal.
*/
- bool propagate(TNode atom, bool isTrue);
+ bool propagate(TNode literal);
/**
* Explain why this literal is true by adding assumptions