SatLiteral CnfStream::getLiteral(const TNode& node) {
TranslationCache::iterator find = d_translationCache.find(node);
- SatLiteral literal;
- if(find != d_translationCache.end()) {
- literal = find->second;
- }
+ Assert(find != d_translationCache.end(), "Literal not in the CNF Cache");
+ SatLiteral literal = find->second;
Debug("cnf") << "CnfStream::getLiteral(" << node << ") => " << literal << std::endl;
return literal;
}
trail.shrink(trail.size() - trail_lim[level]);
trail_lim.shrink(trail_lim.size() - level);
}
+ // Now, clear the TheoryEngine queue
+ proxy->clearAssertionQueues();
}
Clause* c = NULL;
SatClause clause;
proxy->theoryCheck(clause);
- if (clause.size() > 0) {
+ int clause_size = clause.size();
+ Assert(clause_size != 1, "Can't handle unit clause explanations");
+ if(clause_size > 0) {
+ // Find the max level of the conflict
+ int max_level = 0;
+ for (int i = 0; i < clause_size; ++i) {
+ int current_level = level[var(clause[i])];
+ Debug("minisat") << "Literal: " << clause[i] << " with reason " << reason[var(clause[i])] << " at level " << current_level << std::endl;
+ Assert(toLbool(assigns[var(clause[i])]) != l_Undef, "Got an unassigned literal in conflict!");
+ if (current_level > max_level) max_level = current_level;
+ }
+ // If smaller than the decision level then pop back so we can analyse
+ Debug("minisat") << "Max-level is " << max_level << " in decision level " << decisionLevel() << std::endl;
+ Assert(max_level <= decisionLevel(), "What is going on, can't get literals of a higher level as conflict!");
+ if (max_level < decisionLevel()) {
+ Debug("minisat") << "Max-level is " << max_level << " in decision level " << decisionLevel() << std::endl;
+ cancelUntil(max_level);
+ }
+ // Create the new clause and attach all the information
c = Clause_new(clause, true);
learnts.push(c);
attachClause(*c);
inline void enqueueTheoryLiteral(const SatLiteral& l);
inline void setCnfStream(CnfStream* cnfStream);
+
+ inline void clearAssertionQueues();
};
}/* CVC4::prop namespace */
}
+void SatSolver::clearAssertionQueues() {
+ d_theoryEngine->clearAssertionQueues();
+}
+
}/* CVC4::prop namespace */
}/* CVC4 namespace */
return d_theoryOut.d_conflictNode;
}
+ /**
+ * Clears the queues of the theories.
+ */
+ void clearAssertionQueues() {
+ d_uf.clearAssertionQueue();
+ }
+
};/* class TheoryEngine */
}/* CVC4 namespace */
:logic QF_UF
:status unsat
:extrafuns ((a U) (b U) (f U U))
- :formula (let (?x a) (not (= ?x a))))
\ No newline at end of file
+ :formula (let (?x a) (and (= a b) (not (= ?x b))))
+)
\ No newline at end of file