GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/proof/proof_node.cpp Lines: 28 28 100.0 %
Date: 2021-09-18 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
20122815
ProofNode::ProofNode(PfRule id,
24
                     const std::vector<std::shared_ptr<ProofNode>>& children,
25
20122815
                     const std::vector<Node>& args)
26
20122815
    : d_provenChecked(false)
27
{
28
20122815
  setValue(id, children, args);
29
20122815
}
30
31
119097499
PfRule ProofNode::getRule() const { return d_rule; }
32
33
70765216
const std::vector<std::shared_ptr<ProofNode>>& ProofNode::getChildren() const
34
{
35
70765216
  return d_children;
36
}
37
38
30612473
const std::vector<Node>& ProofNode::getArguments() const { return d_args; }
39
40
109413844
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
22536448
void ProofNode::setValue(
50
    PfRule id,
51
    const std::vector<std::shared_ptr<ProofNode>>& children,
52
    const std::vector<Node>& args)
53
{
54
22536448
  d_rule = id;
55
22536448
  d_children = children;
56
22536448
  d_args = args;
57
22536448
}
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
29574
}  // namespace cvc5