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 "proof/proof_node.h" |
17 |
|
|
18 |
|
#include "proof/proof_node_algorithm.h" |
19 |
|
#include "proof/proof_node_to_sexpr.h" |
20 |
|
|
21 |
|
namespace cvc5 { |
22 |
|
|
23 |
20127760 |
ProofNode::ProofNode(PfRule id, |
24 |
|
const std::vector<std::shared_ptr<ProofNode>>& children, |
25 |
20127760 |
const std::vector<Node>& args) |
26 |
20127760 |
: d_provenChecked(false) |
27 |
|
{ |
28 |
20127760 |
setValue(id, children, args); |
29 |
20127760 |
} |
30 |
|
|
31 |
119100016 |
PfRule ProofNode::getRule() const { return d_rule; } |
32 |
|
|
33 |
70765246 |
const std::vector<std::shared_ptr<ProofNode>>& ProofNode::getChildren() const |
34 |
|
{ |
35 |
70765246 |
return d_children; |
36 |
|
} |
37 |
|
|
38 |
30612499 |
const std::vector<Node>& ProofNode::getArguments() const { return d_args; } |
39 |
|
|
40 |
109417609 |
Node ProofNode::getResult() const { return d_proven; } |
41 |
|
|
42 |
82115 |
bool ProofNode::isClosed() |
43 |
|
{ |
44 |
164230 |
std::vector<Node> assumps; |
45 |
82115 |
expr::getFreeAssumptions(this, assumps); |
46 |
164230 |
return assumps.empty(); |
47 |
|
} |
48 |
|
|
49 |
22541394 |
void ProofNode::setValue( |
50 |
|
PfRule id, |
51 |
|
const std::vector<std::shared_ptr<ProofNode>>& children, |
52 |
|
const std::vector<Node>& args) |
53 |
|
{ |
54 |
22541394 |
d_rule = id; |
55 |
22541394 |
d_children = children; |
56 |
22541394 |
d_args = args; |
57 |
22541394 |
} |
58 |
|
|
59 |
42408 |
void ProofNode::printDebug(std::ostream& os) const |
60 |
|
{ |
61 |
|
// convert to sexpr and print |
62 |
84816 |
ProofNodeToSExpr pnts; |
63 |
84816 |
Node ps = pnts.convertToSExpr(this); |
64 |
42408 |
os << ps; |
65 |
42408 |
} |
66 |
|
|
67 |
5 |
std::ostream& operator<<(std::ostream& out, const ProofNode& pn) |
68 |
|
{ |
69 |
5 |
pn.printDebug(out); |
70 |
5 |
return out; |
71 |
|
} |
72 |
|
|
73 |
29577 |
} // namespace cvc5 |