summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaniel Barbosa <hanielbbarbosa@gmail.com>2021-04-14 09:54:03 -0300
committerGitHub <noreply@github.com>2021-04-14 12:54:03 +0000
commit340380462989ff06d08567147bb16d0df9ddb1bc (patch)
treec1d52ad3ba03bb8c378d761b8c0619657815b928
parentaed4c9e04665598dbcccafcc23b026ebef5b5ad2 (diff)
[proof-new] Miscellaneous improvements to dot printer (#6342)
-rw-r--r--src/proof/dot/dot_printer.cpp65
1 files changed, 52 insertions, 13 deletions
diff --git a/src/proof/dot/dot_printer.cpp b/src/proof/dot/dot_printer.cpp
index 9763bcda3..4f13ef17a 100644
--- a/src/proof/dot/dot_printer.cpp
+++ b/src/proof/dot/dot_printer.cpp
@@ -16,7 +16,11 @@
#include "proof/dot/dot_printer.h"
#include <sstream>
+
+#include "expr/proof_checker.h"
#include "expr/proof_node_manager.h"
+#include "printer/smt2/smt2_printer.h"
+#include "theory/builtin/proof_checker.h"
namespace cvc5 {
namespace proof {
@@ -45,20 +49,18 @@ void DotPrinter::printInternal(std::ostream& out,
uint64_t& ruleID)
{
uint64_t currentRuleID = ruleID;
- std::ostringstream currentArguments, resultStr;
- DotPrinter::ruleArguments(currentArguments, pn);
- const std::vector<std::shared_ptr<ProofNode>>& children = pn->getChildren();
+ PfRule r = pn->getRule();
- out << "\t\"" << currentRuleID << "\" [ shape = \"box\", label = \""
- << pn->getRule() << "(";
+ out << "\t\"" << currentRuleID << "\" [ shape = \"box\", label = \"" << r;
+ std::ostringstream currentArguments, resultStr;
+ const std::vector<std::shared_ptr<ProofNode>>& children = pn->getChildren();
+ DotPrinter::ruleArguments(currentArguments, pn);
// guarantee that arguments do not have unescaped quotes
std::string astring = currentArguments.str();
cleanQuotes(astring);
-
- out << astring << ")\"];\n\t\"" << currentRuleID
+ out << astring << "\"];\n\t\"" << currentRuleID
<< "c\" [ shape = \"ellipse\", label = \"";
-
// guarantee that conclusion does not have unescaped quotes
resultStr << pn->getResult();
astring = resultStr.str();
@@ -79,16 +81,53 @@ void DotPrinter::ruleArguments(std::ostringstream& currentArguments,
const ProofNode* pn)
{
const std::vector<Node>& args = pn->getArguments();
-
- if (args.size())
+ PfRule r = pn->getRule();
+ // don't process arguments of rules whose conclusion is in the arguments
+ if (!args.size() || r == PfRule::ASSUME || r == PfRule::REORDERING
+ || r == PfRule::REFL)
{
- currentArguments << args[0];
+ return;
}
+ currentArguments << " :args [ ";
- for (size_t i = 1, size = args.size(); i < size; i++)
+ // if cong, special process
+ if (r == PfRule::CONG)
+ {
+ AlwaysAssert(args.size() == 1 || args.size() == 2);
+ // if two arguments, ignore first and print second
+ if (args.size() == 2)
+ {
+ currentArguments << args[1];
+ }
+ else
+ {
+ Kind k;
+ ProofRuleChecker::getKind(args[0], k);
+ currentArguments << printer::smt2::Smt2Printer::smtKindString(k);
+ }
+ }
+ // if th_rw, likewise
+ else if (r == PfRule::THEORY_REWRITE)
+ {
+ // print the second argument
+ theory::TheoryId id;
+ theory::builtin::BuiltinProofRuleChecker::getTheoryId(args[1], id);
+ std::ostringstream ss;
+ ss << id;
+ std::string s = ss.str();
+ // delete "THEORY_" prefix
+ s.erase(0, 7);
+ currentArguments << s;
+ }
+ else
{
- currentArguments << ", " << args[i];
+ currentArguments << args[0];
+ for (size_t i = 1, size = args.size(); i < size; i++)
+ {
+ currentArguments << ", " << args[i];
+ }
}
+ currentArguments << " ]";
}
} // namespace proof
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback