Use Result::Sat instead of BenchmarkStatus in printers. (#5026)
authorAbdalrhman Mohamed <32971963+abdoo8080@users.noreply.github.com>
Fri, 4 Sep 2020 15:42:33 +0000 (10:42 -0500)
committerGitHub <noreply@github.com>
Fri, 4 Sep 2020 15:42:33 +0000 (10:42 -0500)
This PR modifies the printers to use Result::Sat, "internal" version of BenchmarkStatus, for printing benchmark status commands.

src/printer/ast/ast_printer.cpp
src/printer/ast/ast_printer.h
src/printer/cvc/cvc_printer.cpp
src/printer/cvc/cvc_printer.h
src/printer/printer.cpp
src/printer/printer.h
src/printer/smt2/smt2_printer.cpp
src/printer/smt2/smt2_printer.h
src/smt/command.cpp

index f235721f11a5fe234ee9740ee44cea5496f4a524..f776d07dbc3a62d6a08c60e38524b90d7cc5d63b 100644 (file)
@@ -341,7 +341,7 @@ void AstPrinter::toStreamCmdGetUnsatCore(std::ostream& out) const
 }
 
 void AstPrinter::toStreamCmdSetBenchmarkStatus(std::ostream& out,
-                                               BenchmarkStatus status) const
+                                               Result::Sat status) const
 {
   out << "SetBenchmarkStatus(" << status << ')';
 }
index 969240930142e16310ea532fcbb89fa5bf9698af..35ec43adba5e73f07b23976fdc5511243feebc95 100644 (file)
@@ -122,7 +122,7 @@ class AstPrinter : public CVC4::Printer
 
   /** Print set-info :status command */
   void toStreamCmdSetBenchmarkStatus(std::ostream& out,
-                                     BenchmarkStatus status) const override;
+                                     Result::Sat status) const override;
 
   /** Print set-logic command */
   void toStreamCmdSetBenchmarkLogic(std::ostream& out,
index b94977cfeb27ede92d7144d3ca2feae5b82fba8a..2d59bff715c6e3cabe0d5c8a6fc76e827a8b9b14 100644 (file)
@@ -1436,7 +1436,7 @@ void CvcPrinter::toStreamCmdGetUnsatCore(std::ostream& out) const
 }
 
 void CvcPrinter::toStreamCmdSetBenchmarkStatus(std::ostream& out,
-                                               BenchmarkStatus status) const
+                                               Result::Sat status) const
 {
   out << "% (set-info :status " << status << ')';
 }
index 3c61fb74f342fda4cf806ab787b0428ebb06219f..b1af1af3eeeebe254ef4872f9e383b4316dccc5d 100644 (file)
@@ -123,7 +123,7 @@ class CvcPrinter : public CVC4::Printer
 
   /** Print set-info :status command */
   void toStreamCmdSetBenchmarkStatus(std::ostream& out,
-                                     BenchmarkStatus status) const override;
+                                     Result::Sat status) const override;
 
   /** Print set-logic command */
   void toStreamCmdSetBenchmarkLogic(std::ostream& out,
index d13fc55f137507ad84f68f38cf7031d238cfdb59..65c88d660f6bd17aa3211da632b20e8292ba9659 100644 (file)
@@ -23,6 +23,7 @@
 #include "printer/cvc/cvc_printer.h"
 #include "printer/smt2/smt2_printer.h"
 #include "printer/tptp/tptp_printer.h"
+#include "smt/command.h"
 #include "smt/node_command.h"
 
 using namespace std;
@@ -346,7 +347,7 @@ void Printer::toStreamCmdGetAssertions(std::ostream& out) const
 }
 
 void Printer::toStreamCmdSetBenchmarkStatus(std::ostream& out,
-                                            BenchmarkStatus status) const
+                                            Result::Sat status) const
 {
   printUnknownCommand(out, "set-info");
 }
index 8c95e3e9b43ff3fa9b63591baf3f8423f234e081..af280cb4094390bafc22301a96ede848e6abb571 100644 (file)
 
 #include "expr/node.h"
 #include "options/language.h"
-#include "smt/command.h"
 #include "smt/model.h"
+#include "util/result.h"
 #include "util/sexpr.h"
 
 namespace CVC4 {
 
+class Command;
+class CommandStatus;
 class NodeCommand;
+class UnsatCore;
 
 class Printer
 {
@@ -212,7 +215,7 @@ class Printer
 
   /** Print set-info :status command */
   virtual void toStreamCmdSetBenchmarkStatus(std::ostream& out,
-                                             BenchmarkStatus status) const;
+                                             Result::Sat status) const;
 
   /** Print set-logic command */
   virtual void toStreamCmdSetBenchmarkLogic(std::ostream& out,
index da0423956088bdeadbcfc4812078042e8ba40a4f..6c43c9eb17d23033360e4cb20b5d35a5e7dcdc17 100644 (file)
@@ -31,6 +31,7 @@
 #include "options/printer_options.h"
 #include "options/smt_options.h"
 #include "printer/dagification_visitor.h"
+#include "smt/command.h"
 #include "smt/node_command.h"
 #include "smt/smt_engine.h"
 #include "smt_util/boolean_simplification.h"
@@ -1775,7 +1776,7 @@ void Smt2Printer::toStreamCmdGetUnsatCore(std::ostream& out) const
 }
 
 void Smt2Printer::toStreamCmdSetBenchmarkStatus(std::ostream& out,
-                                                BenchmarkStatus status) const
+                                                Result::Sat status) const
 {
   out << "(set-info :status " << status << ')';
 }
index 0cf06dd6ba5bc5102bd38cd84a116e57b3cd170f..11f12a6403f80a5ad0648076ed294e5e4421ddb2 100644 (file)
@@ -178,7 +178,7 @@ class Smt2Printer : public CVC4::Printer
 
   /** Print set-info :status command */
   void toStreamCmdSetBenchmarkStatus(std::ostream& out,
-                                     BenchmarkStatus status) const override;
+                                     Result::Sat status) const override;
 
   /** Print set-logic command */
   void toStreamCmdSetBenchmarkLogic(std::ostream& out,
index cb95cf3482ddcb4f41e1153f5384a79214b08aad..64ef60906a515f0d5928dd95f6d35a1762e3f5a8 100644 (file)
@@ -2977,7 +2977,15 @@ void SetBenchmarkStatusCommand::toStream(std::ostream& out,
                                          size_t dag,
                                          OutputLanguage language) const
 {
-  Printer::getPrinter(language)->toStreamCmdSetBenchmarkStatus(out, d_status);
+  Result::Sat status;
+  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);
 }
 
 /* -------------------------------------------------------------------------- */