GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/proof/proof_node.cpp Lines: 27 27 100.0 %
Date: 2021-08-16 Branches: 9 18 50.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
19818627
ProofNode::ProofNode(PfRule id,
24
                     const std::vector<std::shared_ptr<ProofNode>>& children,
25
19818627
                     const std::vector<Node>& args)
26
{
27
19818627
  setValue(id, children, args);
28
19818627
}
29
30
84583868
PfRule ProofNode::getRule() const { return d_rule; }
31
32
36772029
const std::vector<std::shared_ptr<ProofNode>>& ProofNode::getChildren() const
33
{
34
36772029
  return d_children;
35
}
36
37
27842970
const std::vector<Node>& ProofNode::getArguments() const { return d_args; }
38
39
80999296
Node ProofNode::getResult() const { return d_proven; }
40
41
75147
bool ProofNode::isClosed()
42
{
43
150294
  std::vector<Node> assumps;
44
75147
  expr::getFreeAssumptions(this, assumps);
45
150294
  return assumps.empty();
46
}
47
48
22192373
void ProofNode::setValue(
49
    PfRule id,
50
    const std::vector<std::shared_ptr<ProofNode>>& children,
51
    const std::vector<Node>& args)
52
{
53
22192373
  d_rule = id;
54
22192373
  d_children = children;
55
22192373
  d_args = args;
56
22192373
}
57
58
37859
void ProofNode::printDebug(std::ostream& os) const
59
{
60
  // convert to sexpr and print
61
75718
  ProofNodeToSExpr pnts;
62
75718
  Node ps = pnts.convertToSExpr(this);
63
37859
  os << ps;
64
37859
}
65
66
5
std::ostream& operator<<(std::ostream& out, const ProofNode& pn)
67
{
68
5
  pn.printDebug(out);
69
5
  return out;
70
}
71
72
29340
}  // namespace cvc5