This PR is a step towards enabling raw-benchmark for cvc5 regressions. cvc5 fails to reparse 57 regressions (in regress0) printed be raw-benchmark because they contain multi-line strings in set-info that we don't print between vertical bars right now. This PR fixes that bug and removes 2 commands (derived from set-info commands) that are not used by the parsers anymore.
out << "GetUnsatCore()" << std::endl;
}
-void AstPrinter::toStreamCmdSetBenchmarkStatus(std::ostream& out,
- Result::Sat status) const
-{
- out << "SetBenchmarkStatus(" << status << ')' << std::endl;
-}
-
void AstPrinter::toStreamCmdSetBenchmarkLogic(std::ostream& out,
const std::string& logic) const
{
out << "])" << std::endl;
}
-void AstPrinter::toStreamCmdComment(std::ostream& out,
- const std::string& comment) const
-{
- out << "CommentCommand([" << comment << "])" << std::endl;
-}
-
void AstPrinter::toStreamWithLetify(std::ostream& out,
Node n,
int toDepth,
/** Print get-assertions command */
void toStreamCmdGetAssertions(std::ostream& out) const override;
- /** Print set-info :status command */
- void toStreamCmdSetBenchmarkStatus(std::ostream& out,
- Result::Sat status) const override;
-
/** Print set-logic command */
void toStreamCmdSetBenchmarkLogic(std::ostream& out,
const std::string& logic) const override;
/** Print quit command */
void toStreamCmdQuit(std::ostream& out) const override;
- /** Print comment command */
- void toStreamCmdComment(std::ostream& out,
- const std::string& comment) const override;
-
/** Print command sequence command */
void toStreamCmdCommandSequence(
std::ostream& out, const std::vector<Command*>& sequence) const override;
printUnknownCommand(out, "get-assertions");
}
-void Printer::toStreamCmdSetBenchmarkStatus(std::ostream& out,
- Result::Sat status) const
-{
- printUnknownCommand(out, "set-info");
-}
-
void Printer::toStreamCmdSetBenchmarkLogic(std::ostream& out,
const std::string& logic) const
{
printUnknownCommand(out, "quit");
}
-void Printer::toStreamCmdComment(std::ostream& out,
- const std::string& comment) const
-{
- printUnknownCommand(out, "comment");
-}
-
void Printer::toStreamCmdDeclareHeap(std::ostream& out,
TypeNode locType,
TypeNode dataType) const
/** Print get-assertions command */
virtual void toStreamCmdGetAssertions(std::ostream& out) const;
- /** Print set-info :status command */
- virtual void toStreamCmdSetBenchmarkStatus(std::ostream& out,
- Result::Sat status) const;
-
/** Print set-logic command */
virtual void toStreamCmdSetBenchmarkLogic(std::ostream& out,
const std::string& logic) const;
/** Print quit command */
virtual void toStreamCmdQuit(std::ostream& out) const;
- /** Print comment command */
- virtual void toStreamCmdComment(std::ostream& out,
- const std::string& comment) const;
/** Declare heap command */
virtual void toStreamCmdDeclareHeap(std::ostream& out,
TypeNode locType,
out << "(get-difficulty)" << std::endl;
}
-void Smt2Printer::toStreamCmdSetBenchmarkStatus(std::ostream& out,
- Result::Sat status) const
-{
- out << "(set-info :status " << status << ')' << std::endl;
-}
-
void Smt2Printer::toStreamCmdSetBenchmarkLogic(std::ostream& out,
const std::string& logic) const
{
const std::string& flag,
const std::string& value) const
{
- out << "(set-info :" << flag << ' ' << value << ')' << std::endl;
+ out << "(set-info :" << flag << " |" << value << "|)" << std::endl;
}
void Smt2Printer::toStreamCmdGetInfo(std::ostream& out,
out << ")" << std::endl;
}
-void Smt2Printer::toStreamCmdComment(std::ostream& out,
- const std::string& comment) const
-{
- std::string s = comment;
- size_t pos = 0;
- while ((pos = s.find_first_of('"', pos)) != string::npos)
- {
- s.replace(pos, 1, "\"\"");
- pos += 2;
- }
- out << "(set-info :notes \"" << s << "\")" << std::endl;
-}
-
void Smt2Printer::toStreamCmdDeclareHeap(std::ostream& out,
TypeNode locType,
TypeNode dataType) const
/** Print get-assertions command */
void toStreamCmdGetAssertions(std::ostream& out) const override;
- /** Print set-info :status command */
- void toStreamCmdSetBenchmarkStatus(std::ostream& out,
- Result::Sat status) const override;
-
/** Print set-logic command */
void toStreamCmdSetBenchmarkLogic(std::ostream& out,
const std::string& logic) const override;
/** Print quit command */
void toStreamCmdQuit(std::ostream& out) const override;
- /** Print comment command */
- void toStreamCmdComment(std::ostream& out,
- const std::string& comment) const override;
-
/** Print declare-heap command */
void toStreamCmdDeclareHeap(std::ostream& out,
TypeNode locType,
Printer::getPrinter(language)->toStreamCmdQuit(out);
}
-/* -------------------------------------------------------------------------- */
-/* class CommentCommand */
-/* -------------------------------------------------------------------------- */
-
-CommentCommand::CommentCommand(std::string comment) : d_comment(comment) {}
-std::string CommentCommand::getComment() const { return d_comment; }
-void CommentCommand::invoke(api::Solver* solver, SymbolManager* sm)
-{
- Dump("benchmark") << *this;
- d_commandStatus = CommandSuccess::instance();
-}
-
-Command* CommentCommand::clone() const { return new CommentCommand(d_comment); }
-std::string CommentCommand::getCommandName() const { return "comment"; }
-
-void CommentCommand::toStream(std::ostream& out,
- int toDepth,
- size_t dag,
- Language language) const
-{
- Printer::getPrinter(language)->toStreamCmdComment(out, d_comment);
-}
-
/* -------------------------------------------------------------------------- */
/* class CommandSequence */
/* -------------------------------------------------------------------------- */
Printer::getPrinter(language)->toStreamCmdGetAssertions(out);
}
-/* -------------------------------------------------------------------------- */
-/* class SetBenchmarkStatusCommand */
-/* -------------------------------------------------------------------------- */
-
-SetBenchmarkStatusCommand::SetBenchmarkStatusCommand(BenchmarkStatus status)
- : d_status(status)
-{
-}
-
-BenchmarkStatus SetBenchmarkStatusCommand::getStatus() const
-{
- return d_status;
-}
-
-void SetBenchmarkStatusCommand::invoke(api::Solver* solver, SymbolManager* sm)
-{
- try
- {
- stringstream ss;
- ss << d_status;
- solver->setInfo("status", ss.str());
- d_commandStatus = CommandSuccess::instance();
- }
- catch (exception& e)
- {
- d_commandStatus = new CommandFailure(e.what());
- }
-}
-
-Command* SetBenchmarkStatusCommand::clone() const
-{
- return new SetBenchmarkStatusCommand(d_status);
-}
-
-std::string SetBenchmarkStatusCommand::getCommandName() const
-{
- return "set-info";
-}
-
-void SetBenchmarkStatusCommand::toStream(std::ostream& out,
- int toDepth,
- size_t dag,
- Language language) const
-{
- Result::Sat status = Result::SAT_UNKNOWN;
- switch (d_status)
- {
- case BenchmarkStatus::SMT_SATISFIABLE: status = Result::SAT; break;
- case BenchmarkStatus::SMT_UNSATISFIABLE: status = Result::UNSAT; break;
- case BenchmarkStatus::SMT_UNKNOWN: status = Result::SAT_UNKNOWN; break;
- }
-
- Printer::getPrinter(language)->toStreamCmdSetBenchmarkStatus(out, status);
-}
-
/* -------------------------------------------------------------------------- */
/* class SetBenchmarkLogicCommand */
/* -------------------------------------------------------------------------- */
Language language = Language::LANG_AUTO) const override;
}; /* class GetAssertionsCommand */
-class CVC5_EXPORT SetBenchmarkStatusCommand : public Command
-{
- protected:
- BenchmarkStatus d_status;
-
- public:
- SetBenchmarkStatusCommand(BenchmarkStatus status);
-
- BenchmarkStatus getStatus() const;
-
- void invoke(api::Solver* solver, SymbolManager* sm) override;
- Command* clone() const override;
- std::string getCommandName() const override;
- void toStream(std::ostream& out,
- int toDepth = -1,
- size_t dag = 1,
- Language language = Language::LANG_AUTO) const override;
-}; /* class SetBenchmarkStatusCommand */
-
class CVC5_EXPORT SetBenchmarkLogicCommand : public Command
{
protected:
Language language = Language::LANG_AUTO) const override;
}; /* class QuitCommand */
-class CVC5_EXPORT CommentCommand : public Command
-{
- std::string d_comment;
-
- public:
- CommentCommand(std::string comment);
-
- std::string getComment() const;
-
- void invoke(api::Solver* solver, SymbolManager* sm) override;
- Command* clone() const override;
- std::string getCommandName() const override;
- void toStream(std::ostream& out,
- int toDepth = -1,
- size_t dag = 1,
- Language language = Language::LANG_AUTO) const override;
-}; /* class CommentCommand */
-
class CVC5_EXPORT CommandSequence : public Command
{
protected:
DeclareFunctionNodeCommand c(id, n, n.getType());
if (Dump.isOn("skolems") && comment != "")
{
- d_outMgr.getPrinter().toStreamCmdComment(d_outMgr.getDumpOut(),
- id + " is " + comment);
+ d_outMgr.getPrinter().toStreamCmdSetInfo(
+ d_outMgr.getDumpOut(), "notes", id + " is " + comment);
}
d_dm.addToDump(c, "skolems");
}
{
LogicInfo everything;
everything.lock();
- getPrinter().toStreamCmdComment(
+ getPrinter().toStreamCmdSetInfo(
d_env->getDumpOut(),
+ "notes",
"cvc5 always dumps the most general, all-supported logic (below), as "
"some internals might require the use of a logic more general than "
"the input.");
if (Dump.isOn("benchmark"))
{
- if (key == "status")
- {
- Result::Sat status =
- (value == "sat")
- ? Result::SAT
- : ((value == "unsat") ? Result::UNSAT : Result::SAT_UNKNOWN);
- getPrinter().toStreamCmdSetBenchmarkStatus(d_env->getDumpOut(), status);
- }
- else
- {
- getPrinter().toStreamCmdSetInfo(d_env->getDumpOut(), key, value);
- }
+ getPrinter().toStreamCmdSetInfo(d_env->getDumpOut(), key, value);
}
if (key == "filename")
if (Dump.isOn(tag)) {
const Printer& printer = d_env.getPrinter();
std::ostream& out = d_env.getDumpOut();
- printer.toStreamCmdComment(out, "Starting completeness check");
+ printer.toStreamCmdSetInfo(out, "notes", "Starting completeness check");
for (TheoryId theoryId = THEORY_FIRST; theoryId < THEORY_LAST; ++theoryId) {
Theory* theory = d_theoryTable[theoryId];
if (theory && d_logicInfo.isTheoryEnabled(theoryId)) {
- printer.toStreamCmdComment(out, "Completeness check");
+ printer.toStreamCmdSetInfo(out, "notes", "Completeness check");
printer.toStreamCmdPush(out);
// Dump the shared terms
if (d_logicInfo.isSharingEnabled()) {
- printer.toStreamCmdComment(out, "Shared terms");
+ printer.toStreamCmdSetInfo(out, "notes", "Shared terms");
context::CDList<TNode>::const_iterator it = theory->shared_terms_begin(), it_end = theory->shared_terms_end();
for (unsigned i = 0; it != it_end; ++ it, ++i) {
stringstream ss;
ss << (*it);
- printer.toStreamCmdComment(out, ss.str());
+ printer.toStreamCmdSetInfo(out, "notes", ss.str());
}
}
// Dump the assertions
- printer.toStreamCmdComment(out, "Assertions");
+ printer.toStreamCmdSetInfo(out, "notes", "Assertions");
context::CDList<Assertion>::const_iterator it = theory->facts_begin(), it_end = theory->facts_end();
for (; it != it_end; ++ it) {
// Get the assertion
if ((*it).d_isPreregistered)
{
- printer.toStreamCmdComment(out, "Preregistered");
+ printer.toStreamCmdSetInfo(out, "notes", "Preregistered");
}
else
{
- printer.toStreamCmdComment(out, "Shared assertion");
+ printer.toStreamCmdSetInfo(out, "notes", "Shared assertion");
}
printer.toStreamCmdAssert(out, assertionNode);
}
Node n = lemma.negate();
const Printer& printer = d_env.getPrinter();
std::ostream& out = d_env.getDumpOut();
- printer.toStreamCmdComment(out, "theory lemma: expect valid");
+ printer.toStreamCmdSetInfo(out, "notes", "theory lemma: expect valid");
printer.toStreamCmdCheckSat(out, n);
}
if(Dump.isOn("t-conflicts")) {
const Printer& printer = d_env.getPrinter();
std::ostream& out = d_env.getDumpOut();
- printer.toStreamCmdComment(out, "theory conflict: expect unsat");
+ printer.toStreamCmdSetInfo(out, "notes", "theory conflict: expect unsat");
printer.toStreamCmdCheckSat(out, conflict);
}