GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/preprocessing/learned_literal_manager.cpp Lines: 18 18 100.0 %
Date: 2021-11-07 Branches: 29 56 51.8 %

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
 * Learned literal manager
14
 */
15
16
#include "preprocessing/learned_literal_manager.h"
17
18
#include "smt/env.h"
19
#include "theory/rewriter.h"
20
#include "theory/trust_substitutions.h"
21
22
namespace cvc5 {
23
namespace preprocessing {
24
25
15414
LearnedLiteralManager::LearnedLiteralManager(Env& env)
26
15414
    : EnvObj(env), d_learnedLits(userContext())
27
{
28
15414
}
29
30
64237
void LearnedLiteralManager::notifyLearnedLiteral(TNode lit)
31
{
32
64237
  d_learnedLits.insert(lit);
33
64237
  Trace("pp-llm") << "LLM:notifyLearnedLiteral: " << lit << std::endl;
34
64237
}
35
36
2
std::vector<Node> LearnedLiteralManager::getLearnedLiterals() const
37
{
38
2
  theory::TrustSubstitutionMap& tls = d_env.getTopLevelSubstitutions();
39
2
  std::vector<Node> currLearnedLits;
40
10
  for (const auto& lit: d_learnedLits)
41
  {
42
    // update based on substitutions
43
16
    Node tlsNode = tls.get().apply(lit);
44
8
    tlsNode = rewrite(tlsNode);
45
8
    currLearnedLits.push_back(tlsNode);
46
16
    Trace("pp-llm") << "Learned literal : " << tlsNode << " from " << lit
47
8
                    << std::endl;
48
  }
49
2
  return currLearnedLits;
50
}
51
52
}  // namespace preprocessing
53
31137
}  // namespace cvc5