GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/proof/proof_node.cpp Lines: 27 27 100.0 %
Date: 2021-08-01 Branches: 9 20 45.0 %

Line Exec Source
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
20797832
ProofNode::ProofNode(PfRule id,
24
                     const std::vector<std::shared_ptr<ProofNode>>& children,
25
20797832
                     const std::vector<Node>& args)
26
{
27
20797832
  setValue(id, children, args);
28
20797832
}
29
30
77153657
PfRule ProofNode::getRule() const { return d_rule; }
31
32
34003263
const std::vector<std::shared_ptr<ProofNode>>& ProofNode::getChildren() const
33
{
34
34003263
  return d_children;
35
}
36
37
28254001
const std::vector<Node>& ProofNode::getArguments() const { return d_args; }
38
39
81313710
Node ProofNode::getResult() const { return d_proven; }
40
41
72728
bool ProofNode::isClosed()
42
{
43
145456
  std::vector<Node> assumps;
44
72728
  expr::getFreeAssumptions(this, assumps);
45
145456
  return assumps.empty();
46
}
47
48
23771990
void ProofNode::setValue(
49
    PfRule id,
50
    const std::vector<std::shared_ptr<ProofNode>>& children,
51
    const std::vector<Node>& args)
52
{
53
23771990
  d_rule = id;
54
23771990
  d_children = children;
55
23771990
  d_args = args;
56
23771990
}
57
58
37589
void ProofNode::printDebug(std::ostream& os) const
59
{
60
  // convert to sexpr and print
61
75178
  ProofNodeToSExpr pnts;
62
75178
  Node ps = pnts.convertToSExpr(this);
63
37589
  os << ps;
64
37589
}
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
29280
}  // namespace cvc5