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 |
|
* Implementation of proof node utility. |
14 |
|
*/ |
15 |
|
|
16 |
|
#include "expr/proof_node.h" |
17 |
|
|
18 |
|
#include "expr/proof_node_algorithm.h" |
19 |
|
#include "expr/proof_node_to_sexpr.h" |
20 |
|
|
21 |
|
namespace cvc5 { |
22 |
|
|
23 |
20369316 |
ProofNode::ProofNode(PfRule id, |
24 |
|
const std::vector<std::shared_ptr<ProofNode>>& children, |
25 |
20369316 |
const std::vector<Node>& args) |
26 |
|
{ |
27 |
20369316 |
setValue(id, children, args); |
28 |
20369316 |
} |
29 |
|
|
30 |
75553015 |
PfRule ProofNode::getRule() const { return d_rule; } |
31 |
|
|
32 |
35928883 |
const std::vector<std::shared_ptr<ProofNode>>& ProofNode::getChildren() const |
33 |
|
{ |
34 |
35928883 |
return d_children; |
35 |
|
} |
36 |
|
|
37 |
25196994 |
const std::vector<Node>& ProofNode::getArguments() const { return d_args; } |
38 |
|
|
39 |
85640097 |
Node ProofNode::getResult() const { return d_proven; } |
40 |
|
|
41 |
94774 |
bool ProofNode::isClosed() |
42 |
|
{ |
43 |
189548 |
std::vector<Node> assumps; |
44 |
94774 |
expr::getFreeAssumptions(this, assumps); |
45 |
189548 |
return assumps.empty(); |
46 |
|
} |
47 |
|
|
48 |
23600571 |
void ProofNode::setValue( |
49 |
|
PfRule id, |
50 |
|
const std::vector<std::shared_ptr<ProofNode>>& children, |
51 |
|
const std::vector<Node>& args) |
52 |
|
{ |
53 |
23600571 |
d_rule = id; |
54 |
23600571 |
d_children = children; |
55 |
23600571 |
d_args = args; |
56 |
23600571 |
} |
57 |
|
|
58 |
32818 |
void ProofNode::printDebug(std::ostream& os) const |
59 |
|
{ |
60 |
|
// convert to sexpr and print |
61 |
65636 |
ProofNodeToSExpr pnts; |
62 |
65636 |
Node ps = pnts.convertToSExpr(this); |
63 |
32818 |
os << ps; |
64 |
32818 |
} |
65 |
|
|
66 |
1 |
std::ostream& operator<<(std::ostream& out, const ProofNode& pn) |
67 |
|
{ |
68 |
1 |
pn.printDebug(out); |
69 |
1 |
return out; |
70 |
|
} |
71 |
|
|
72 |
28191 |
} // namespace cvc5 |