1 |
|
/****************************************************************************** |
2 |
|
* Top contributors (to current version): |
3 |
|
* Andrew Reynolds |
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 |
|
* Utilities for printing expressions in proofs |
14 |
|
*/ |
15 |
|
|
16 |
|
#include "cvc5_private.h" |
17 |
|
|
18 |
|
#ifndef CVC5__PROOF__PRINT_EXPR_H |
19 |
|
#define CVC5__PROOF__PRINT_EXPR_H |
20 |
|
|
21 |
|
#include <iostream> |
22 |
|
#include <map> |
23 |
|
|
24 |
|
#include "expr/node.h" |
25 |
|
#include "proof/proof_node.h" |
26 |
|
|
27 |
|
namespace cvc5 { |
28 |
|
namespace proof { |
29 |
|
|
30 |
|
/** |
31 |
|
* A term, type or a proof. This class is used for printing combinations of |
32 |
|
* proofs terms and types. |
33 |
|
*/ |
34 |
1656 |
class PExpr |
35 |
|
{ |
36 |
|
public: |
37 |
78 |
PExpr() : d_node(), d_pnode(nullptr), d_typeNode() {} |
38 |
32 |
PExpr(Node n) : d_node(n), d_pnode(nullptr), d_typeNode() {} |
39 |
172 |
PExpr(const ProofNode* pn) : d_node(), d_pnode(pn), d_typeNode() {} |
40 |
|
PExpr(TypeNode tn) : d_node(), d_pnode(nullptr), d_typeNode(tn) {} |
41 |
1674 |
~PExpr() {} |
42 |
|
/** The node, if this p-exression is a node */ |
43 |
|
Node d_node; |
44 |
|
/** The proof node, if this p-expression is a proof */ |
45 |
|
const ProofNode* d_pnode; |
46 |
|
/** The type node, if this p-expression is a type */ |
47 |
|
TypeNode d_typeNode; |
48 |
|
}; |
49 |
|
|
50 |
|
/** |
51 |
|
* A stream of p-expressions, which appends p-expressions to a reference vector. |
52 |
|
* That vector can then be used when printing a proof. |
53 |
|
*/ |
54 |
78 |
class PExprStream |
55 |
|
{ |
56 |
|
public: |
57 |
|
/** |
58 |
|
* Takes a reference to a stream (vector of p-expressions), and the |
59 |
|
* representation true/false (tt/ff). |
60 |
|
*/ |
61 |
|
PExprStream(std::vector<PExpr>& stream, |
62 |
|
Node tt = Node::null(), |
63 |
|
Node ff = Node::null()); |
64 |
|
/** Append a proof node */ |
65 |
|
PExprStream& operator<<(const ProofNode* pn); |
66 |
|
/** Append a node */ |
67 |
|
PExprStream& operator<<(Node n); |
68 |
|
/** Append a type node */ |
69 |
|
PExprStream& operator<<(TypeNode tn); |
70 |
|
/** Append a Boolean */ |
71 |
|
PExprStream& operator<<(bool b); |
72 |
|
/** Append a pexpr */ |
73 |
|
PExprStream& operator<<(PExpr p); |
74 |
|
|
75 |
|
private: |
76 |
|
/** Reference to the stream */ |
77 |
|
std::vector<PExpr>& d_stream; |
78 |
|
/** Builtin nodes for true and false */ |
79 |
|
Node d_tt; |
80 |
|
Node d_ff; |
81 |
|
}; |
82 |
|
|
83 |
|
} // namespace proof |
84 |
|
} // namespace cvc5 |
85 |
|
|
86 |
|
#endif |