diff options
author | ajreynol <andrew.j.reynolds@gmail.com> | 2015-01-26 13:11:01 +0100 |
---|---|---|
committer | ajreynol <andrew.j.reynolds@gmail.com> | 2015-01-26 13:11:01 +0100 |
commit | edd8886e56c8bb84f3fd85fc6f697d870bc0a3b7 (patch) | |
tree | 1fe3e8699f3c4831a302a369b377396ae5a347a4 /src/expr | |
parent | f3045ccce9d30114f6e90cfa72de176da344cb1f (diff) |
Output solutions for synthesis conjectures with --dump-synth. Minor refactor of previous commit.
Diffstat (limited to 'src/expr')
-rw-r--r-- | src/expr/command.cpp | 38 | ||||
-rw-r--r-- | src/expr/command.h | 13 |
2 files changed, 51 insertions, 0 deletions
diff --git a/src/expr/command.cpp b/src/expr/command.cpp index 242e018f6..1c7c1d171 100644 --- a/src/expr/command.cpp +++ b/src/expr/command.cpp @@ -1187,6 +1187,44 @@ std::string GetInstantiationsCommand::getCommandName() const throw() { return "get-instantiations"; } +/* class GetSynthSolutionCommand */ + +GetSynthSolutionCommand::GetSynthSolutionCommand() throw() { +} + +void GetSynthSolutionCommand::invoke(SmtEngine* smtEngine) throw() { + try { + d_smtEngine = smtEngine; + d_commandStatus = CommandSuccess::instance(); + } catch(exception& e) { + d_commandStatus = new CommandFailure(e.what()); + } +} + +void GetSynthSolutionCommand::printResult(std::ostream& out, uint32_t verbosity) const throw() { + if(! ok()) { + this->Command::printResult(out, verbosity); + } else { + d_smtEngine->printSynthSolution(out); + } +} + +Command* GetSynthSolutionCommand::exportTo(ExprManager* exprManager, ExprManagerMapCollection& variableMap) { + GetSynthSolutionCommand* c = new GetSynthSolutionCommand(); + c->d_smtEngine = d_smtEngine; + return c; +} + +Command* GetSynthSolutionCommand::clone() const { + GetSynthSolutionCommand* c = new GetSynthSolutionCommand(); + c->d_smtEngine = d_smtEngine; + return c; +} + +std::string GetSynthSolutionCommand::getCommandName() const throw() { + return "get-instantiations"; +} + /* class GetUnsatCoreCommand */ GetUnsatCoreCommand::GetUnsatCoreCommand() throw() { diff --git a/src/expr/command.h b/src/expr/command.h index cfa00bff4..9165961fb 100644 --- a/src/expr/command.h +++ b/src/expr/command.h @@ -610,6 +610,19 @@ public: std::string getCommandName() const throw(); };/* class GetInstantiationsCommand */ +class CVC4_PUBLIC GetSynthSolutionCommand : public Command { +protected: + SmtEngine* d_smtEngine; +public: + GetSynthSolutionCommand() throw(); + ~GetSynthSolutionCommand() throw() {} + void invoke(SmtEngine* smtEngine) throw(); + void printResult(std::ostream& out, uint32_t verbosity = 2) const throw(); + Command* exportTo(ExprManager* exprManager, ExprManagerMapCollection& variableMap); + Command* clone() const; + std::string getCommandName() const throw(); +};/* class GetSynthSolutionCommand */ + class CVC4_PUBLIC GetUnsatCoreCommand : public Command { protected: UnsatCore d_result; |