summaryrefslogtreecommitdiff
path: root/src/prop/cnf_stream.cpp
diff options
context:
space:
mode:
authorAbdalrhman Mohamed <32971963+abdoo8080@users.noreply.github.com>2020-09-16 12:45:01 -0500
committerGitHub <noreply@github.com>2020-09-16 12:45:01 -0500
commit2c2f05c96e021006275a2bc70b9ede70b280616d (patch)
treedb702d7b8fbd14dd8003b1f03c02b77c89d2fced /src/prop/cnf_stream.cpp
parent0534ea1bbee9a3a7049580449ab25025a4f92a9a (diff)
Dump commands in internal code using command printing functions. (#5040)
This is work towards migrating commands to the new API. Internal code that creates command objects just for dumping is replaced with direct calls to functions that print the those commands.
Diffstat (limited to 'src/prop/cnf_stream.cpp')
-rw-r--r--src/prop/cnf_stream.cpp37
1 files changed, 26 insertions, 11 deletions
diff --git a/src/prop/cnf_stream.cpp b/src/prop/cnf_stream.cpp
index c46cd5136..203ed34e9 100644
--- a/src/prop/cnf_stream.cpp
+++ b/src/prop/cnf_stream.cpp
@@ -31,7 +31,9 @@
#include "prop/minisat/minisat.h"
#include "prop/prop_engine.h"
#include "prop/theory_proxy.h"
-#include "smt/command.h"
+#include "smt/dump.h"
+#include "smt/smt_engine.h"
+#include "printer/printer.h"
#include "smt/smt_engine_scope.h"
#include "theory/theory.h"
#include "theory/theory_engine.h"
@@ -42,10 +44,14 @@ using namespace CVC4::kind;
namespace CVC4 {
namespace prop {
-CnfStream::CnfStream(SatSolver* satSolver, Registrar* registrar,
- context::Context* context, bool fullLitToNodeMap,
+CnfStream::CnfStream(SatSolver* satSolver,
+ Registrar* registrar,
+ context::Context* context,
+ OutputManager* outMgr,
+ bool fullLitToNodeMap,
std::string name)
: d_satSolver(satSolver),
+ d_outMgr(outMgr),
d_booleanVariables(context),
d_nodeToLiteralMap(context),
d_literalToNodeMap(context),
@@ -54,32 +60,41 @@ CnfStream::CnfStream(SatSolver* satSolver, Registrar* registrar,
d_registrar(registrar),
d_name(name),
d_cnfProof(NULL),
- d_removable(false) {
+ d_removable(false)
+{
}
TseitinCnfStream::TseitinCnfStream(SatSolver* satSolver,
Registrar* registrar,
context::Context* context,
+ OutputManager* outMgr,
ResourceManager* rm,
bool fullLitToNodeMap,
std::string name)
- : CnfStream(satSolver, registrar, context, fullLitToNodeMap, name),
+ : CnfStream(satSolver, registrar, context, outMgr, fullLitToNodeMap, name),
d_resourceManager(rm)
{}
void CnfStream::assertClause(TNode node, SatClause& c) {
Debug("cnf") << "Inserting into stream " << c << " node = " << node << endl;
- if(Dump.isOn("clauses")) {
- if(c.size() == 1) {
- Dump("clauses") << AssertCommand(Expr(getNode(c[0]).toExpr()));
- } else {
+ if (Dump.isOn("clauses") && d_outMgr != nullptr)
+ {
+ const Printer& printer = d_outMgr->getPrinter();
+ std::ostream& out = d_outMgr->getDumpOut();
+ if (c.size() == 1)
+ {
+ printer.toStreamCmdAssert(out, getNode(c[0]));
+ }
+ else
+ {
Assert(c.size() > 1);
NodeBuilder<> b(kind::OR);
- for(unsigned i = 0; i < c.size(); ++i) {
+ for (unsigned i = 0; i < c.size(); ++i)
+ {
b << getNode(c[i]);
}
Node n = b;
- Dump("clauses") << AssertCommand(Expr(n.toExpr()));
+ printer.toStreamCmdAssert(out, n);
}
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback