GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/expr/proof_node_to_sexpr.h Lines: 1 1 100.0 %
Date: 2021-05-24 Branches: 0 0 0.0 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Andrew Reynolds, Haniel Barbosa, Gereon Kremer
4
 *
5
 * This file is part of the cvc5 project.
6
 *
7
 * Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
8
 * in the top-level source directory and their institutional affiliations.
9
 * All rights reserved.  See the file COPYING in the top-level source
10
 * directory for licensing information.
11
 * ****************************************************************************
12
 *
13
 * Conversion from ProofNode to s-expressions.
14
 */
15
16
#include "cvc5_private.h"
17
18
#ifndef CVC5__EXPR__PROOF_NODE_TO_SEXPR_H
19
#define CVC5__EXPR__PROOF_NODE_TO_SEXPR_H
20
21
#include <map>
22
23
#include "expr/node.h"
24
#include "expr/proof_rule.h"
25
26
namespace cvc5 {
27
28
class ProofNode;
29
30
/** A class to convert ProofNode objects to s-expressions */
31
class ProofNodeToSExpr
32
{
33
 public:
34
  ProofNodeToSExpr();
35
32818
  ~ProofNodeToSExpr() {}
36
  /** Convert the given proof node to an s-expression
37
   *
38
   * This is useful for operations where it is useful to view a ProofNode as
39
   * a Node. Printing is one such example, where a ProofNode can be printed
40
   * as a dag after this conversion.
41
   *
42
   * The s-expression for a ProofNode has the form:
43
   *   (SEXPR (VAR "<d_rule>") S1 ... Sn (VAR ":args") (SEXPR <d_args>))
44
   * where S1, ..., Sn are the s-expressions for its <d_children>.
45
   */
46
  Node convertToSExpr(const ProofNode* pn);
47
48
 private:
49
  /** map proof rules to a variable */
50
  std::map<PfRule, Node> d_pfrMap;
51
  /** Dummy ":args" marker */
52
  Node d_argsMarker;
53
  /** Dummy ":conclusion" marker */
54
  Node d_conclusionMarker;
55
  /** map proof nodes to their s-expression */
56
  std::map<const ProofNode*, Node> d_pnMap;
57
  /**
58
   * map nodes to a bound variable, used for nodes that have special AST status
59
   * like builtin operators
60
   */
61
  std::map<Node, Node> d_nodeMap;
62
  /** get or make pf rule variable */
63
  Node getOrMkPfRuleVariable(PfRule r);
64
  /** get or make node variable */
65
  Node getOrMkNodeVariable(Node n);
66
};
67
68
}  // namespace cvc5
69
70
#endif /* CVC5__EXPR__PROOF_RULE_H */