GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/preprocessing/preprocessing_pass_context.cpp Lines: 30 33 90.9 %
Date: 2021-11-07 Branches: 16 34 47.1 %

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 "theory/theory_engine.h"
21
#include "theory/theory_model.h"
22
23
namespace cvc5 {
24
namespace preprocessing {
25
26
15414
PreprocessingPassContext::PreprocessingPassContext(
27
    Env& env,
28
    TheoryEngine* te,
29
    prop::PropEngine* pe,
30
15414
    theory::booleans::CircuitPropagator* circuitPropagator)
31
    : EnvObj(env),
32
      d_theoryEngine(te),
33
      d_propEngine(pe),
34
      d_circuitPropagator(circuitPropagator),
35
      d_llm(env),
36
15414
      d_symsInAssertions(userContext())
37
{
38
15414
}
39
40
theory::TrustSubstitutionMap&
41
52318
PreprocessingPassContext::getTopLevelSubstitutions() const
42
{
43
52318
  return d_env.getTopLevelSubstitutions();
44
}
45
46
465530
TheoryEngine* PreprocessingPassContext::getTheoryEngine() const
47
{
48
465530
  return d_theoryEngine;
49
}
50
19108
prop::PropEngine* PreprocessingPassContext::getPropEngine() const
51
{
52
19108
  return d_propEngine;
53
}
54
55
291346
void PreprocessingPassContext::spendResource(Resource r)
56
{
57
291346
  d_env.getResourceManager()->spendResource(r);
58
291346
}
59
10256
void PreprocessingPassContext::recordSymbolsInAssertions(
60
    const std::vector<Node>& assertions)
61
{
62
20512
  std::unordered_set<TNode> visited;
63
20512
  std::unordered_set<Node> syms;
64
42393
  for (TNode cn : assertions)
65
  {
66
32137
    expr::getSymbols(cn, syms, visited);
67
  }
68
48789
  for (const Node& s : syms)
69
  {
70
38533
    d_symsInAssertions.insert(s);
71
  }
72
10256
}
73
74
64237
void PreprocessingPassContext::notifyLearnedLiteral(TNode lit)
75
{
76
64237
  d_llm.notifyLearnedLiteral(lit);
77
64237
}
78
79
2
std::vector<Node> PreprocessingPassContext::getLearnedLiterals() const
80
{
81
2
  return d_llm.getLearnedLiterals();
82
}
83
84
420
void PreprocessingPassContext::addSubstitution(const Node& lhs,
85
                                               const Node& rhs,
86
                                               ProofGenerator* pg)
87
{
88
420
  getTopLevelSubstitutions().addSubstitution(lhs, rhs, pg);
89
420
}
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
}  // namespace preprocessing
100
31137
}  // namespace cvc5