GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/preprocessing/preprocessing_pass_context.cpp Lines: 32 35 91.4 %
Date: 2021-09-15 Branches: 19 40 47.5 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Aina Niemetz, Andrew Reynolds, Mathias Preiner
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
 * The preprocessing pass context for passes.
14
 */
15
16
#include "preprocessing/preprocessing_pass_context.h"
17
18
#include "expr/node_algorithm.h"
19
#include "smt/env.h"
20
#include "smt/smt_engine.h"
21
#include "theory/theory_engine.h"
22
#include "theory/theory_model.h"
23
24
namespace cvc5 {
25
namespace preprocessing {
26
27
10016
PreprocessingPassContext::PreprocessingPassContext(
28
    SmtEngine* smt,
29
    Env& env,
30
10016
    theory::booleans::CircuitPropagator* circuitPropagator)
31
    : EnvObj(env),
32
      d_smt(smt),
33
      d_circuitPropagator(circuitPropagator),
34
      d_llm(
35
          env.getTopLevelSubstitutions(), userContext(), getProofNodeManager()),
36
10016
      d_symsInAssertions(userContext())
37
{
38
10016
}
39
40
theory::TrustSubstitutionMap&
41
38170
PreprocessingPassContext::getTopLevelSubstitutions() const
42
{
43
38170
  return d_env.getTopLevelSubstitutions();
44
}
45
46
325070
TheoryEngine* PreprocessingPassContext::getTheoryEngine() const
47
{
48
325070
  return d_smt->getTheoryEngine();
49
}
50
13800
prop::PropEngine* PreprocessingPassContext::getPropEngine() const
51
{
52
13800
  return d_smt->getPropEngine();
53
}
54
55
249930
void PreprocessingPassContext::spendResource(Resource r)
56
{
57
249930
  d_env.getResourceManager()->spendResource(r);
58
249930
}
59
6155
void PreprocessingPassContext::recordSymbolsInAssertions(
60
    const std::vector<Node>& assertions)
61
{
62
12310
  std::unordered_set<TNode> visited;
63
12310
  std::unordered_set<Node> syms;
64
31523
  for (TNode cn : assertions)
65
  {
66
25368
    expr::getSymbols(cn, syms, visited);
67
  }
68
40108
  for (const Node& s : syms)
69
  {
70
33953
    d_symsInAssertions.insert(s);
71
  }
72
6155
}
73
74
59964
void PreprocessingPassContext::notifyLearnedLiteral(TNode lit)
75
{
76
59964
  d_llm.notifyLearnedLiteral(lit);
77
59964
}
78
79
2
std::vector<Node> PreprocessingPassContext::getLearnedLiterals() const
80
{
81
2
  return d_llm.getLearnedLiterals();
82
}
83
84
450
void PreprocessingPassContext::addSubstitution(const Node& lhs,
85
                                               const Node& rhs,
86
                                               ProofGenerator* pg)
87
{
88
450
  getTopLevelSubstitutions().addSubstitution(lhs, rhs, pg);
89
450
}
90
91
void PreprocessingPassContext::addSubstitution(const Node& lhs,
92
                                               const Node& rhs,
93
                                               PfRule id,
94
                                               const std::vector<Node>& args)
95
{
96
  getTopLevelSubstitutions().addSubstitution(lhs, rhs, id, {}, args);
97
}
98
99
19958
ProofNodeManager* PreprocessingPassContext::getProofNodeManager() const
100
{
101
19958
  return d_env.getProofNodeManager();
102
}
103
104
}  // namespace preprocessing
105
29577
}  // namespace cvc5