summaryrefslogtreecommitdiff
path: root/src/proof/dot/dot_printer.h
blob: 9aefcffff5264c7bacf434331ad1f09439d27399 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/******************************************************************************
 * Top contributors (to current version):
 *   Diego Della Rocca de Camargos
 *
 * This file is part of the cvc5 project.
 *
 * Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
 * in the top-level source directory and their institutional affiliations.
 * All rights reserved.  See the file COPYING in the top-level source
 * directory for licensing information.
 * ****************************************************************************
 *
 * The module for printing dot proofs.
 */

#include "cvc4_private.h"

#ifndef CVC5__PROOF__DOT__DOT_PRINTER_H
#define CVC5__PROOF__DOT__DOT_PRINTER_H

#include <iostream>

#include "expr/proof_node.h"

namespace cvc5 {
namespace proof {

class DotPrinter
{
 public:
  DotPrinter();
  ~DotPrinter() {}

  /**
   * Print the full proof of assertions => false by pn using the dot format.
   * @param out the output stream
   * @param pn the root node of the proof to print
   */
  static void print(std::ostream& out, const ProofNode* pn);

 private:
  /**
   * Print the rule in the format:
   * "$RULE_ID $RULE_NAME($RULE_ARGUMENTS)" [ shape = "box"];
   * "$RULE_ID $RULE_NAME($RULE_ARGUMENTS)" -> "$RULE_ID $RULE_CONCLUSION";
   * and then for each child of the rule print
   * "$CHILD_ID $CHILD_CONCLUSION" -> "$RULE_ID $RULE_NAME($RULE_ARGUMENTS)";
   * and then recursively call the function with the child as argument.
   * @param out the output stream
   * @param pn the proof node to print
   * @param ruleID the id of the rule to print
   */
  static void printInternal(std::ostream& out,
                            const ProofNode* pn,
                            uint64_t& ruleID);

  /**
   * Return the arguments of a ProofNode
   * @param currentArguments an ostringstream that will store the arguments of
   * pn formatted as "$ARG[0], $ARG[1], ..., $ARG[N-1]"
   * @param pn a ProofNode
   */
  static void ruleArguments(std::ostringstream& currentArguments,
                            const ProofNode* pn);

  /** Replace all quotes but escaped quotes in given string
   * @param s The string to have the quotes processed.
   */
  static void cleanQuotes(std::string& s);
};

}  // namespace proof
}  // namespace cvc5

#endif
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback