summaryrefslogtreecommitdiff
path: root/src/smt/command.cpp
diff options
context:
space:
mode:
authormakaimann <makaim@stanford.edu>2019-12-16 01:58:24 -0800
committerAndres Noetzli <andres.noetzli@gmail.com>2019-12-16 01:58:24 -0800
commitc1c8b61a03732cb485e358bc0f78e654242d58de (patch)
treec7943638645ed74976c1e5aa0fe7ddad59d57c0f /src/smt/command.cpp
parent0e5efa8c4ff22925d3fc011a3588a3e67c107d0e (diff)
Trace tags for dumping the decision tree in org-mode format (#2871)
This would add tracing options to print the decision tree in [org-mode](https://orgmode.org/) format which can be viewed with emacs or [vim-orgmode](https://github.com/jceb/vim-orgmode). In the raw format, the number of asterisks denote the decision level of a decision, and within a propagation node, the number of spaces denote the level. Most viewers render the asterisks as indented bullets. There are some options for controlling verbosity: `dtview` - prints the decisions (basic option) `dtview::command` - also prints smt-lib commands as they're issued `dtview::conflict` - also prints conflicts `dtview::prop` - also prints propagations Example usage: `cvc4 -t dtview -t dtview::command -t dtview::conflict -t dtview::prop <example smt2 file> &> example-trace.org` The resulting file when opened with an org-mode viewer has collapsible nodes, where "..." marks a node with children.
Diffstat (limited to 'src/smt/command.cpp')
-rw-r--r--src/smt/command.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/smt/command.cpp b/src/smt/command.cpp
index 76ce1bda9..d8301283f 100644
--- a/src/smt/command.cpp
+++ b/src/smt/command.cpp
@@ -265,6 +265,8 @@ void EchoCommand::invoke(SmtEngine* smtEngine)
void EchoCommand::invoke(SmtEngine* smtEngine, std::ostream& out)
{
out << d_output << std::endl;
+ Trace("dtview::command") << "* ~COMMAND: echo |" << d_output << "|~"
+ << std::endl;
d_commandStatus = CommandSuccess::instance();
printResult(out,
smtEngine->getOption("command-verbosity:" + getCommandName())
@@ -393,6 +395,8 @@ CheckSatCommand::CheckSatCommand(const Expr& expr) : d_expr(expr) {}
Expr CheckSatCommand::getExpr() const { return d_expr; }
void CheckSatCommand::invoke(SmtEngine* smtEngine)
{
+ Trace("dtview::command") << "* ~COMMAND: " << getCommandName() << "~"
+ << std::endl;
try
{
d_result = smtEngine->checkSat(d_expr);
@@ -413,6 +417,7 @@ void CheckSatCommand::printResult(std::ostream& out, uint32_t verbosity) const
}
else
{
+ Trace("dtview::command") << "* RESULT: " << d_result << std::endl;
out << d_result << endl;
}
}
@@ -453,6 +458,8 @@ const std::vector<Expr>& CheckSatAssumingCommand::getTerms() const
void CheckSatAssumingCommand::invoke(SmtEngine* smtEngine)
{
+ Trace("dtview::command") << "* ~COMMAND: (check-sat-assuming ( " << d_terms
+ << " )~" << std::endl;
try
{
d_result = smtEngine->checkSat(d_terms);
@@ -466,6 +473,7 @@ void CheckSatAssumingCommand::invoke(SmtEngine* smtEngine)
Result CheckSatAssumingCommand::getResult() const
{
+ Trace("dtview::command") << "* ~RESULT: " << d_result << "~" << std::endl;
return d_result;
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback