std::map<Node, Node> dmapp = dmap;
dmap.clear();
std::vector<Node> ppAsserts;
+ std::vector<Node> asserts;
+ getAssertions(as, asserts);
for (const std::pair<const Node, Node>& ppa : dmapp)
{
Trace("difficulty") << " preprocess difficulty: " << ppa.second << " for "
<< ppa.first << std::endl;
- ppAsserts.push_back(ppa.first);
+ // Ensure that only input assertions are marked as having a difficulty.
+ // In some cases, a lemma may be marked as having a difficulty
+ // internally, e.g. for lemmas that require justification, which we should
+ // skip or otherwise we end up with an open proof below.
+ if (std::find(asserts.begin(), asserts.end(), ppa.first) != asserts.end())
+ {
+ ppAsserts.push_back(ppa.first);
+ }
}
// assume a SAT refutation from all input assertions that were marked
// as having a difficulty
bool pol = nc.getKind() != kind::NOT;
TNode atom = pol ? nc : nc[0];
it = rse.find(atom);
+ Trace("diff-man-debug")
+ << "Check literal: " << atom << ", has reason = " << (it != rse.end())
+ << std::endl;
if (it != rse.end())
{
incrementDifficulty(it->second);
: d_val(val),
d_input(lemContext),
d_computed(false),
- d_inFullEffortCheck(false),
d_success(false),
d_trackRSetExp(false),
d_miniscopeTopLevel(true)
void RelevanceManager::beginRound()
{
d_computed = false;
- d_inFullEffortCheck = true;
}
-void RelevanceManager::endRound() { d_inFullEffortCheck = false; }
-
void RelevanceManager::computeRelevance()
{
d_computed = true;
d_rsetExp.clear();
Trace("rel-manager") << "RelevanceManager::computeRelevance..." << std::endl;
std::unordered_map<TNode, int> cache;
+ d_success = true;
for (const Node& node: d_input)
{
TNode n = node;
int val = justify(n, cache);
if (val != 1)
{
- std::stringstream serr;
- serr << "RelevanceManager::computeRelevance: WARNING: failed to justify "
- << n;
- Trace("rel-manager") << serr.str() << std::endl;
- Assert(false) << serr.str();
+ if (Trace.isOn("rel-manager"))
+ {
+ std::stringstream serr;
+ serr
+ << "RelevanceManager::computeRelevance: WARNING: failed to justify "
+ << n;
+ Trace("rel-manager") << serr.str() << std::endl;
+ }
d_success = false;
- d_rset.clear();
- return;
+ // If we fail to justify an assertion, we set success to false and
+ // continue to try to justify the remaining assertions. This is important
+ // for cases where the difficulty manager is measuring based on lemmas
+ // that are being sent at STANDARD effort, before all assertions are
+ // satisfied.
}
}
+ if (!d_success)
+ {
+ d_rset.clear();
+ return;
+ }
Trace("rel-manager") << "...success, size = " << d_rset.size() << std::endl;
- d_success = true;
}
bool RelevanceManager::isBooleanConnective(TNode cur)
{
// only consider lemmas that were sent at full effort, when we have a
// complete SAT assignment.
- if (d_dman != nullptr && d_inFullEffortCheck)
+ if (d_dman != nullptr)
{
// ensure we know which literals are relevant, and why
computeRelevance();
/** Singleton version of above */
void notifyPreprocessedAssertion(Node n);
/**
- * Begin round, called at the beginning of a full effort check in
- * TheoryEngine.
+ * Begin round, called at the beginning of a check in TheoryEngine.
*/
void beginRound();
- /** End round, called at the end of a full effort check in TheoryEngine. */
- void endRound();
/**
* Is lit part of the current relevant selection? This computes the set of
* relevant assertions if not already done so. This call is valid during a
Debug("theory") << "TheoryEngine::check(" << effort << "): d_factsAsserted = " << (d_factsAsserted ? "true" : "false") << endl;
+ // Reset round for the relevance manager, which notice only sets a flag
+ // to indicate that its information must be recomputed.
+ if (d_relManager != nullptr)
+ {
+ d_relManager->beginRound();
+ }
// If in full effort, we have a fake new assertion just to jumpstart the checking
if (Theory::fullEffort(effort)) {
d_factsAsserted = true;
- // Reset round for the relevance manager, which notice only sets a flag
- // to indicate that its information must be recomputed.
- if (d_relManager != nullptr)
- {
- d_relManager->beginRound();
- }
d_tc->resetRound();
}
if (Theory::fullEffort(effort))
{
- if (d_relManager != nullptr)
- {
- d_relManager->endRound();
- }
if (!d_inConflict && !needCheck())
{
// Do post-processing of model from the theories (e.g. used for
std::vector<Node> sks;
Node retLemma =
d_propEngine->getPreprocessedTerm(tlemma.getProven(), skAsserts, sks);
- if (isLemmaPropertyNeedsJustify(p))
+ if (options().theory.relevanceFilter && isLemmaPropertyNeedsJustify(p))
{
d_relManager->notifyPreprocessedAssertion(retLemma);
d_relManager->notifyPreprocessedAssertions(skAsserts);