d_lastStatistics = ossCurStats.str();
}
- // dump the model/proof if option is set
+ // dump the model/proof/unsat core if option is set
if(status) {
- Command * g = NULL;
+ Command* g = NULL;
if( d_options[options::produceModels] &&
d_options[options::dumpModels] &&
( res.asSatisfiabilityResult() == Result::SAT ||
res.asSatisfiabilityResult() == Result::UNSAT ) {
g = new GetUnsatCoreCommand();
}
- if( g ){
- //set no time limit during dumping if applicable
+ if(g != NULL) {
+ // set no time limit during dumping if applicable
if( d_options[options::forceNoLimitCpuWhileDump] ){
setNoLimitCPU();
}
bool status = portfolioReturn.second;
- // dump the model/proof if option is set
+ // dump the model/proof/unsat core if option is set
if(status) {
if( d_options[options::produceModels] &&
d_options[options::dumpModels] &&
}
}/* Printer::toStream(Model) */
+void Printer::toStream(std::ostream& out, const UnsatCore& core) const throw() {
+ for(UnsatCore::iterator i = core.begin(); i != core.end(); ++i) {
+ toStream(out, Node::fromExpr(*i), -1, false, -1);
+ out << std::endl;
+ }
+}/* Printer::toStream(UnsatCore) */
+
}/* CVC4 namespace */
/** Write a Model out to a stream with this Printer. */
virtual void toStream(std::ostream& out, const Model& m) const throw();
+ /** Write an UnsatCore out to a stream with this Printer. */
+ virtual void toStream(std::ostream& out, const UnsatCore& core) const throw();
+
};/* class Printer */
/**
}/* Smt2Printer::toStream(CommandStatus*) */
+void Smt2Printer::toStream(std::ostream& out, const UnsatCore& core) const throw() {
+ out << "(" << endl;
+ this->Printer::toStream(out, core);
+ out << ")" << endl;
+}
+
+
void Smt2Printer::toStream(std::ostream& out, const Model& m) const throw() {
out << "(model" << endl;
this->Printer::toStream(out, m);
void toStream(std::ostream& out, TNode n, int toDepth, bool types) const throw();
void toStream(std::ostream& out, const Model& m, const Command* c) const throw();
- void toStream(std::ostream& out, const Model& m) const throw();
public:
Smt2Printer(Variant variant = no_variant) : d_variant(variant) { }
using CVC4::Printer::toStream;
void toStream(std::ostream& out, const CommandStatus* s) const throw();
void toStream(std::ostream& out, const Result& r) const throw();
void toStream(std::ostream& out, const SExpr& sexpr) const throw();
+ void toStream(std::ostream& out, const Model& m) const throw();
+ void toStream(std::ostream& out, const UnsatCore& core) const throw();
};/* class Smt2Printer */
}/* CVC4::printer::smt2 namespace */
}
d_proofManager->getProof(this);// just to trigger core creation
- return UnsatCore(d_proofManager->begin_unsat_core(), d_proofManager->end_unsat_core());
+ return UnsatCore(this, d_proofManager->begin_unsat_core(), d_proofManager->end_unsat_core());
#else /* CVC4_PROOF */
throw ModalException("This build of CVC4 doesn't have proof support (required for unsat cores).");
#endif /* CVC4_PROOF */
#include "util/unsat_core.h"
#include "expr/command.h"
+#include "smt/smt_engine_scope.h"
+#include "printer/printer.h"
namespace CVC4 {
}
std::ostream& operator<<(std::ostream& out, const UnsatCore& core) {
- core.toStream(out);
+ smt::SmtScope smts(core.d_smt);
+ Expr::dag::Scope scope(out, false);
+ Printer::getPrinter(options::outputLanguage())->toStream(out, core);
return out;
}
namespace CVC4 {
+class SmtEngine;
+class UnsatCore;
+
+std::ostream& operator<<(std::ostream& out, const UnsatCore& core) CVC4_PUBLIC;
+
class CVC4_PUBLIC UnsatCore {
+ friend std::ostream& operator<<(std::ostream&, const UnsatCore&);
+
+ /** The SmtEngine we're associated with */
+ SmtEngine* d_smt;
+
std::vector<Expr> d_core;
public:
- UnsatCore() {}
+ UnsatCore() : d_smt(NULL) {}
template <class T>
- UnsatCore(T begin, T end) : d_core(begin, end) {}
+ UnsatCore(SmtEngine* smt, T begin, T end) : d_smt(smt), d_core(begin, end) {}
~UnsatCore() {}
+ /** get the smt engine that this unsat core is hooked up to */
+ SmtEngine* getSmtEngine() { return d_smt; }
+
typedef std::vector<Expr>::const_iterator iterator;
typedef std::vector<Expr>::const_iterator const_iterator;
};/* class UnsatCore */
-std::ostream& operator<<(std::ostream& out, const UnsatCore& core) CVC4_PUBLIC;
-
}/* CVC4 namespace */
#endif /* __CVC4__UNSAT_CORE_H */