GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/preprocessing/passes/theory_preprocess.cpp Lines: 17 17 100.0 %
Date: 2021-11-07 Branches: 21 34 61.8 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Andrew Reynolds, Mathias Preiner, Andres Noetzli
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 TheoryPreprocess preprocessing pass.
14
 *
15
 * Calls Theory::preprocess(...) on every assertion of the formula.
16
 */
17
18
#include "preprocessing/passes/theory_preprocess.h"
19
20
#include "options/smt_options.h"
21
#include "preprocessing/assertion_pipeline.h"
22
#include "preprocessing/preprocessing_pass_context.h"
23
#include "prop/prop_engine.h"
24
#include "theory/rewriter.h"
25
#include "theory/theory_engine.h"
26
27
namespace cvc5 {
28
namespace preprocessing {
29
namespace passes {
30
31
using namespace cvc5::theory;
32
33
15340
TheoryPreprocess::TheoryPreprocess(PreprocessingPassContext* preprocContext)
34
15340
    : PreprocessingPass(preprocContext, "theory-preprocess"){};
35
36
19107
PreprocessingPassResult TheoryPreprocess::applyInternal(
37
    AssertionPipeline* assertions)
38
{
39
19107
  d_preprocContext->spendResource(Resource::PreprocessStep);
40
41
19107
  IteSkolemMap& imap = assertions->getIteSkolemMap();
42
19107
  prop::PropEngine* propEngine = d_preprocContext->getPropEngine();
43
  // Remove all of the ITE occurrences and normalize
44
136724
  for (unsigned i = 0, size = assertions->size(); i < size; ++i)
45
  {
46
235258
    Node assertion = (*assertions)[i];
47
235258
    std::vector<SkolemLemma> newAsserts;
48
235258
    TrustNode trn = propEngine->preprocess(assertion, newAsserts);
49
117617
    if (!trn.isNull())
50
    {
51
      // process
52
3118
      assertions->replaceTrusted(i, trn);
53
    }
54
135839
    for (const SkolemLemma& lem : newAsserts)
55
    {
56
18222
      imap[assertions->size()] = lem.d_skolem;
57
18222
      assertions->pushBackTrusted(lem.d_lemma);
58
    }
59
  }
60
61
19095
  return PreprocessingPassResult::NO_CONFLICT;
62
}
63
64
65
}  // namespace passes
66
}  // namespace preprocessing
67
31137
}  // namespace cvc5