GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/proof/proof_node.cpp Lines: 28 28 100.0 %
Date: 2021-09-29 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
445482
ProofNode::ProofNode(PfRule id,
24
                     const std::vector<std::shared_ptr<ProofNode>>& children,
25
445482
                     const std::vector<Node>& args)
26
445482
    : d_provenChecked(false)
27
{
28
445482
  setValue(id, children, args);
29
445482
}
30
31
881256
PfRule ProofNode::getRule() const { return d_rule; }
32
33
418241
const std::vector<std::shared_ptr<ProofNode>>& ProofNode::getChildren() const
34
{
35
418241
  return d_children;
36
}
37
38
477741
const std::vector<Node>& ProofNode::getArguments() const { return d_args; }
39
40
479543
Node ProofNode::getResult() const { return d_proven; }
41
42
5690
bool ProofNode::isClosed()
43
{
44
11380
  std::vector<Node> assumps;
45
5690
  expr::getFreeAssumptions(this, assumps);
46
11380
  return assumps.empty();
47
}
48
49
488476
void ProofNode::setValue(
50
    PfRule id,
51
    const std::vector<std::shared_ptr<ProofNode>>& children,
52
    const std::vector<Node>& args)
53
{
54
488476
  d_rule = id;
55
488476
  d_children = children;
56
488476
  d_args = args;
57
488476
}
58
59
4034
void ProofNode::printDebug(std::ostream& os) const
60
{
61
  // convert to sexpr and print
62
8068
  ProofNodeToSExpr pnts;
63
8068
  Node ps = pnts.convertToSExpr(this);
64
4034
  os << ps;
65
4034
}
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
22746
}  // namespace cvc5