Trace("pfcheck") << " expected: " << expected << std::endl;
std::stringstream out;
// we use trusted (null) checkers here, since we want the proof generation to
- // proceed without failing here.
- Node res = checkInternal(id, cchildren, args, expected, out, true);
+ // proceed without failing here. We always enable output since a failure
+ // implies that we will exit with the error message below.
+ Node res = checkInternal(id, cchildren, args, expected, out, true, true);
if (res.isNull())
{
Trace("pfcheck") << "ProofChecker::check: failed" << std::endl;
const char* traceTag)
{
std::stringstream out;
- // since we are debugging, we want to treat trusted (null) checkers as
- // a failure.
- Node res = checkInternal(id, cchildren, args, expected, out, false);
- if (Trace.isOn(traceTag))
+ bool traceEnabled = Trace.isOn(traceTag);
+ // Since we are debugging, we want to treat trusted (null) checkers as
+ // a failure. We only enable output if the trace is enabled for efficiency.
+ Node res =
+ checkInternal(id, cchildren, args, expected, out, false, traceEnabled);
+ if (traceEnabled)
{
Trace(traceTag) << "ProofChecker::checkDebug: " << id;
if (res.isNull())
const std::vector<Node>& args,
Node expected,
std::stringstream& out,
- bool useTrustedChecker)
+ bool useTrustedChecker,
+ bool enableOutput)
{
std::map<PfRule, ProofRuleChecker*>::iterator it = d_checker.find(id);
if (it == d_checker.end())
{
// no checker for the rule
- out << "no checker for rule " << id << std::endl;
+ if (enableOutput)
+ {
+ out << "no checker for rule " << id << std::endl;
+ }
return Node::null();
}
else if (it->second == nullptr)
}
else
{
- out << "trusted checker for rule " << id << std::endl;
+ if (enableOutput)
+ {
+ out << "trusted checker for rule " << id << std::endl;
+ }
return Node::null();
}
}
Node expectedw = expected;
if (res != expectedw)
{
- out << "result does not match expected value." << std::endl
- << " PfRule: " << id << std::endl;
- for (const Node& c : cchildren)
- {
- out << " child: " << c << std::endl;
- }
- for (const Node& a : args)
+ if (enableOutput)
{
- out << " arg: " << a << std::endl;
+ out << "result does not match expected value." << std::endl
+ << " PfRule: " << id << std::endl;
+ for (const Node& c : cchildren)
+ {
+ out << " child: " << c << std::endl;
+ }
+ for (const Node& a : args)
+ {
+ out << " arg: " << a << std::endl;
+ }
+ out << " result: " << res << std::endl
+ << " expected: " << expected << std::endl;
}
- out << " result: " << res << std::endl
- << " expected: " << expected << std::endl;
// it did not match the given expectation, fail
return Node::null();
}
}
// fails if pedantic level is not met
- if (options::proofNewPedanticEager())
+ if (options::proofNewEagerChecking())
{
std::stringstream serr;
- if (isPedanticFailure(id, serr))
+ if (isPedanticFailure(id, serr, enableOutput))
{
- out << serr.str() << std::endl;
+ if (enableOutput)
+ {
+ out << serr.str() << std::endl;
+ if (Trace.isOn("proof-new-pedantic"))
+ {
+ Trace("proof-new-pedantic")
+ << "Failed pedantic check for " << id << std::endl;
+ Trace("proof-new-pedantic") << "Expected: " << expected << std::endl;
+ out << "Expected: " << expected << std::endl;
+ }
+ }
return Node::null();
}
}
return 0;
}
-bool ProofChecker::isPedanticFailure(PfRule id, std::ostream& out) const
+bool ProofChecker::isPedanticFailure(PfRule id,
+ std::ostream& out,
+ bool enableOutput) const
{
if (d_pclevel == 0)
{
{
if (itp->second <= d_pclevel)
{
- out << "pedantic level for " << id << " not met (rule level is "
- << itp->second << " which is at or below the pedantic level "
- << d_pclevel << ")";
+ if (enableOutput)
+ {
+ out << "pedantic level for " << id << " not met (rule level is "
+ << itp->second << " which is at or below the pedantic level "
+ << d_pclevel << ")";
+ bool pedanticTraceEnabled = Trace.isOn("proof-new-pedantic");
+ if (!pedanticTraceEnabled)
+ {
+ out << ", use -t proof-new-pedantic for details";
+ }
+ }
return true;
}
}
/**
* Is pedantic failure? If so, we return true and write a debug message on the
- * output stream out.
+ * output stream out if enableOutput is true.
*/
- bool isPedanticFailure(PfRule id, std::ostream& out) const;
+ bool isPedanticFailure(PfRule id,
+ std::ostream& out,
+ bool enableOutput = true) const;
private:
/** statistics class */
uint32_t d_pclevel;
/**
* Check internal. This is used by check and checkDebug above. It writes
- * checking errors on out. We treat trusted checkers (nullptr in the range
- * of the map d_checker) as failures if useTrustedChecker = false.
+ * checking errors on out when enableOutput is true. We treat trusted checkers
+ * (nullptr in the range of the map d_checker) as failures if
+ * useTrustedChecker = false.
*/
Node checkInternal(PfRule id,
const std::vector<Node>& cchildren,
const std::vector<Node>& args,
Node expected,
std::stringstream& out,
- bool useTrustedChecker);
+ bool useTrustedChecker,
+ bool enableOutput);
};
} // namespace CVC4