namespace Minisat {
namespace {
-/*
- * Returns true if the solver should add all clauses at the current assertion
- * level.
- *
- * FIXME: This is a workaround. Currently, our resolution proofs do not
- * handle clauses with a lower-than-assertion-level correctly because the
- * resolution proofs get removed when popping the context but the SAT solver
- * keeps using them.
- */
-bool assertionLevelOnly()
-{
- return (options::produceProofs() || options::unsatCores())
- && options::incrementalSolving();
-}
-
//=================================================================================================
// Helper functions for decision tree tracing
// Writes to Trace macro for decision tree tracing
static inline void dtviewDecisionHelper(size_t level,
const Node& node,
- const char* decisiontype)
+ const char* decisiontype,
+ bool incremental)
{
- Trace("dtview") << std::string(level - (options::incrementalSolving() ? 1 : 0), '*')
- << " " << node << " :" << decisiontype << "-DECISION:" << std::endl;
+ Trace("dtview") << std::string(level - (incremental ? 1 : 0), '*') << " "
+ << node << " :" << decisiontype << "-DECISION:" << std::endl;
}
// Writes to Trace macro for propagation tracing
-static inline void dtviewPropagationHeaderHelper(size_t level)
+static inline void dtviewPropagationHeaderHelper(size_t level, bool incremental)
{
- Trace("dtview::prop") << std::string(level + 1 - (options::incrementalSolving() ? 1 : 0),
- '*')
+ Trace("dtview::prop") << std::string(level + 1 - (incremental ? 1 : 0), '*')
<< " /Propagations/" << std::endl;
}
// Writes to Trace macro for propagation tracing
static inline void dtviewBoolPropagationHelper(size_t level,
Lit& l,
- cvc5::prop::TheoryProxy* proxy)
+ cvc5::prop::TheoryProxy* proxy,
+ bool incremental)
{
- Trace("dtview::prop") << std::string(
- level + 1 - (options::incrementalSolving() ? 1 : 0), ' ')
+ Trace("dtview::prop") << std::string(level + 1 - (incremental ? 1 : 0), ' ')
<< ":BOOL-PROP: "
<< proxy->getNode(MinisatSatSolver::toSatLiteral(l))
<< std::endl;
// Writes to Trace macro for conflict tracing
static inline void dtviewPropConflictHelper(size_t level,
Clause& confl,
- cvc5::prop::TheoryProxy* proxy)
+ cvc5::prop::TheoryProxy* proxy,
+ bool incremental)
{
Trace("dtview::conflict")
- << std::string(level + 1 - (options::incrementalSolving() ? 1 : 0), ' ')
+ << std::string(level + 1 - (incremental ? 1 : 0), ' ')
<< ":PROP-CONFLICT: (or";
for (int i = 0; i < confl.size(); i++)
{
d_context(context),
assertionLevel(0),
d_pfManager(nullptr),
+ d_assertionLevelOnly(
+ (options().smt.produceProofs || options().smt.unsatCores)
+ && options().base.incrementalSolving),
d_enable_incremental(enableIncremental),
minisat_busy(false)
// Parameters (user settable):
// Compute the assertion level for this clause
int explLevel = 0;
- if (assertionLevelOnly())
+ if (d_assertionLevelOnly)
{
explLevel = assertionLevel;
}
Lit p; int i, j;
// Which user-level to assert this clause at
- int clauseLevel = (removable && !assertionLevelOnly()) ? 0 : assertionLevel;
+ int clauseLevel = (removable && !d_assertionLevelOnly) ? 0 : assertionLevel;
// Check the clause for tautologies and similar
int falseLiteralsCount = 0;
for (i = j = 0, p = lit_Undef; i < ps.size(); i++) {
// Update the level
- clauseLevel = assertionLevelOnly()
+ clauseLevel = d_assertionLevelOnly
? assertionLevel
: std::max(clauseLevel, intro_level(var(ps[i])));
// Tautologies are ignored
dtviewDecisionHelper(
d_context->getLevel(),
d_proxy->getNode(MinisatSatSolver::toSatLiteral(nextLit)),
- "THEORY");
+ "THEORY",
+ options().base.incrementalSolving);
}
if (Trace.isOn("dtview::prop"))
{
- dtviewPropagationHeaderHelper(d_context->getLevel());
+ dtviewPropagationHeaderHelper(d_context->getLevel(),
+ options().base.incrementalSolving);
}
return nextLit;
dtviewDecisionHelper(
d_context->getLevel(),
d_proxy->getNode(MinisatSatSolver::toSatLiteral(nextLit)),
- "DE");
+ "DE",
+ options().base.incrementalSolving);
}
if (Trace.isOn("dtview::prop"))
{
- dtviewPropagationHeaderHelper(d_context->getLevel());
+ dtviewPropagationHeaderHelper(d_context->getLevel(),
+ options().base.incrementalSolving);
}
return nextLit;
dtviewDecisionHelper(
d_context->getLevel(),
d_proxy->getNode(MinisatSatSolver::toSatLiteral(decisionLit)),
- "DE");
+ "DE",
+ options().base.incrementalSolving);
}
if (Trace.isOn("dtview::prop"))
{
- dtviewPropagationHeaderHelper(d_context->getLevel());
+ dtviewPropagationHeaderHelper(d_context->getLevel(),
+ options().base.incrementalSolving);
}
return decisionLit;
{
if (confl != CRef_Undef)
{
- dtviewPropConflictHelper(decisionLevel(), ca[confl], d_proxy);
+ dtviewPropConflictHelper(decisionLevel(),
+ ca[confl],
+ d_proxy,
+ options().base.incrementalSolving);
}
}
// Even though in conflict, we still need to discharge the lemmas
// if propagation tracing enabled, print boolean propagation
if (Trace.isOn("dtview::prop"))
{
- dtviewBoolPropagationHelper(decisionLevel(), p, d_proxy);
+ dtviewBoolPropagationHelper(
+ decisionLevel(), p, d_proxy, options().base.incrementalSolving);
}
for (i = j = (Watcher*)ws, end = i + ws.size(); i != end;){
}
else
{
- CRef cr = ca.alloc(assertionLevelOnly() ? assertionLevel : max_level,
+ CRef cr = ca.alloc(d_assertionLevelOnly ? assertionLevel : max_level,
learnt_clause,
true);
clauses_removable.push(cr);
if (lemma.size() > 1) {
// If the lemmas is removable, we can compute its level by the level
int clauseLevel = assertionLevel;
- if (removable && !assertionLevelOnly())
+ if (removable && !d_assertionLevelOnly)
{
clauseLevel = 0;
for (int k = 0; k < lemma.size(); ++k)