GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/preprocessing/passes/theory_preprocess.cpp Lines: 19 19 100.0 %
Date: 2021-09-17 Branches: 23 50 46.0 %

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
9942
TheoryPreprocess::TheoryPreprocess(PreprocessingPassContext* preprocContext)
34
9942
    : PreprocessingPass(preprocContext, "theory-preprocess"){};
35
36
13799
PreprocessingPassResult TheoryPreprocess::applyInternal(
37
    AssertionPipeline* assertions)
38
{
39
13799
  d_preprocContext->spendResource(Resource::PreprocessStep);
40
41
13799
  IteSkolemMap& imap = assertions->getIteSkolemMap();
42
13799
  prop::PropEngine* propEngine = d_preprocContext->getPropEngine();
43
  // Remove all of the ITE occurrences and normalize
44
119572
  for (unsigned i = 0, size = assertions->size(); i < size; ++i)
45
  {
46
211560
    Node assertion = (*assertions)[i];
47
211560
    std::vector<TrustNode> newAsserts;
48
211560
    std::vector<Node> newSkolems;
49
211560
    TrustNode trn = propEngine->preprocess(assertion, newAsserts, newSkolems);
50
105773
    if (!trn.isNull())
51
    {
52
      // process
53
3031
      assertions->replaceTrusted(i, trn);
54
    }
55
105773
    Assert(newSkolems.size() == newAsserts.size());
56
123829
    for (unsigned j = 0, nnasserts = newAsserts.size(); j < nnasserts; j++)
57
    {
58
18056
      imap[assertions->size()] = newSkolems[j];
59
18056
      assertions->pushBackTrusted(newAsserts[j]);
60
    }
61
  }
62
63
13792
  return PreprocessingPassResult::NO_CONFLICT;
64
}
65
66
67
}  // namespace passes
68
}  // namespace preprocessing
69
29577
}  // namespace cvc5