}
break;
}
+ case kind::CONST_BOOLEAN:
+ // the default would print "1" or "0" for bool, that's not correct
+ // for our purposes
+ out << (n.getConst<bool>() ? "true" : "false");
+ break;
default:
// fall back on whatever operator<< does on underlying type; we
// might luck out and be SMT-LIB v2 compliant
namespace prop {
void SatSolver::theoryCheck(theory::Theory::Effort effort, SatClause& conflict) {
+ Assert(conflict.size() == 0);
// Try theory propagation
bool ok = d_theoryEngine->check(effort);
// If in conflict construct the conflict clause
// We have a conflict, get it
Node conflictNode = d_theoryEngine->getConflict();
Debug("prop") << "SatSolver::theoryCheck() => conflict: " << conflictNode << std::endl;
- // Go through the literals and construct the conflict clause
- Node::const_iterator literal_it = conflictNode.begin();
- Node::const_iterator literal_end = conflictNode.end();
- while (literal_it != literal_end) {
+ if(conflictNode.getKind() == kind::AND) {
+ // Go through the literals and construct the conflict clause
+ Node::const_iterator literal_it = conflictNode.begin();
+ Node::const_iterator literal_end = conflictNode.end();
+ while (literal_it != literal_end) {
+ // Get the literal corresponding to the node
+ SatLiteral l = d_cnfStream->getLiteral(*literal_it);
+ // Add the negation to the conflict clause and continue
+ conflict.push(~l);
+ literal_it ++;
+ }
+ } else { // unit conflict
// Get the literal corresponding to the node
- SatLiteral l = d_cnfStream->getLiteral(*literal_it);
- // Add the negation to the conflict clause and continue
+ SatLiteral l = d_cnfStream->getLiteral(conflictNode);
+ // construct the unit conflict clause
conflict.push(~l);
- literal_it ++;
}
}
}
* @param n - a conflict at the current decision level. This should
* be an AND-kinded node of literals that are TRUE in the current
* assignment and are in conflict (i.e., at least one must be
- * assigned false).
+ * assigned false), or else a literal by itself (in the case of a
+ * unit conflict) which is assigned TRUE (and T-conflicting) in the
+ * current assignment.
*
* @param safe - whether it is safe to be interrupted
*/
}
static RewriteResponse preRewrite(TNode node) {
+ if(node.getKind() == kind::EQUAL || node.getKind() == kind::IFF) {
+ if(node[0] == node[1]) {
+ return RewriteResponse(REWRITE_DONE, NodeManager::currentNM()->mkConst(true));
+ }
+ }
return RewriteResponse(REWRITE_DONE, node);
}