summaryrefslogtreecommitdiff
path: root/src/printer
diff options
context:
space:
mode:
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>2020-11-19 06:42:04 -0600
committerGitHub <noreply@github.com>2020-11-19 06:42:04 -0600
commitb0130a1e032c201fab3c4b19f25871428b761967 (patch)
treef18039906a287a4d55345b1c4bd0ac86cf5232c5 /src/printer
parent2901ee18f824d1f9e4338ef2853da0ab4ccbff0e (diff)
Use symbol manager for unsat cores (#5468)
This PR uses the symbol manager for handling names for unsat cores. This replaces interfaces in SmtEngine for managing expression names. It removes the SetExpressionName command.
Diffstat (limited to 'src/printer')
-rw-r--r--src/printer/smt2/smt2_printer.cpp23
-rw-r--r--src/printer/tptp/tptp_printer.cpp23
2 files changed, 28 insertions, 18 deletions
diff --git a/src/printer/smt2/smt2_printer.cpp b/src/printer/smt2/smt2_printer.cpp
index bed6a890b..9eb5569e3 100644
--- a/src/printer/smt2/smt2_printer.cpp
+++ b/src/printer/smt2/smt2_printer.cpp
@@ -1319,15 +1319,20 @@ void Smt2Printer::toStream(std::ostream& out, const CommandStatus* s) const
void Smt2Printer::toStream(std::ostream& out, const UnsatCore& core) const
{
out << "(" << std::endl;
- SmtEngine * smt = core.getSmtEngine();
- Assert(smt != NULL);
- for(UnsatCore::const_iterator i = core.begin(); i != core.end(); ++i) {
- std::string name;
- if (smt->getExpressionName(*i,name)) {
- // Named assertions always get printed
- out << CVC4::quoteSymbol(name) << endl;
- } else if (options::dumpUnsatCoresFull()) {
- // Unnamed assertions only get printed if the option is set
+ if (core.useNames())
+ {
+ // use the names
+ const std::vector<std::string>& cnames = core.getCoreNames();
+ for (const std::string& cn : cnames)
+ {
+ out << CVC4::quoteSymbol(cn) << std::endl;
+ }
+ }
+ else
+ {
+ // otherwise, use the formulas
+ for (UnsatCore::const_iterator i = core.begin(); i != core.end(); ++i)
+ {
out << *i << endl;
}
}
diff --git a/src/printer/tptp/tptp_printer.cpp b/src/printer/tptp/tptp_printer.cpp
index 92bbc52e8..c93f3593a 100644
--- a/src/printer/tptp/tptp_printer.cpp
+++ b/src/printer/tptp/tptp_printer.cpp
@@ -71,15 +71,20 @@ void TptpPrinter::toStream(std::ostream& out,
void TptpPrinter::toStream(std::ostream& out, const UnsatCore& core) const
{
out << "% SZS output start UnsatCore " << std::endl;
- SmtEngine * smt = core.getSmtEngine();
- Assert(smt != NULL);
- for(UnsatCore::const_iterator i = core.begin(); i != core.end(); ++i) {
- std::string name;
- if (smt->getExpressionName(*i, name)) {
- // Named assertions always get printed
- out << name << endl;
- } else if (options::dumpUnsatCoresFull()) {
- // Unnamed assertions only get printed if the option is set
+ if (core.useNames())
+ {
+ // use the names
+ const std::vector<std::string>& cnames = core.getCoreNames();
+ for (const std::string& cn : cnames)
+ {
+ out << cn << std::endl;
+ }
+ }
+ else
+ {
+ // otherwise, use the formulas
+ for (UnsatCore::const_iterator i = core.begin(); i != core.end(); ++i)
+ {
out << *i << endl;
}
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback