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 |
15338 |
TheoryPreprocess::TheoryPreprocess(PreprocessingPassContext* preprocContext) |
34 |
15338 |
: PreprocessingPass(preprocContext, "theory-preprocess"){}; |
35 |
|
|
36 |
19105 |
PreprocessingPassResult TheoryPreprocess::applyInternal( |
37 |
|
AssertionPipeline* assertions) |
38 |
|
{ |
39 |
19105 |
d_preprocContext->spendResource(Resource::PreprocessStep); |
40 |
|
|
41 |
19105 |
IteSkolemMap& imap = assertions->getIteSkolemMap(); |
42 |
19105 |
prop::PropEngine* propEngine = d_preprocContext->getPropEngine(); |
43 |
|
// Remove all of the ITE occurrences and normalize |
44 |
136737 |
for (unsigned i = 0, size = assertions->size(); i < size; ++i) |
45 |
|
{ |
46 |
235288 |
Node assertion = (*assertions)[i]; |
47 |
235288 |
std::vector<SkolemLemma> newAsserts; |
48 |
235288 |
TrustNode trn = propEngine->preprocess(assertion, newAsserts); |
49 |
117632 |
if (!trn.isNull()) |
50 |
|
{ |
51 |
|
// process |
52 |
3126 |
assertions->replaceTrusted(i, trn); |
53 |
|
} |
54 |
135816 |
for (const SkolemLemma& lem : newAsserts) |
55 |
|
{ |
56 |
18184 |
imap[assertions->size()] = lem.d_skolem; |
57 |
18184 |
assertions->pushBackTrusted(lem.d_lemma); |
58 |
|
} |
59 |
|
} |
60 |
|
|
61 |
19093 |
return PreprocessingPassResult::NO_CONFLICT; |
62 |
|
} |
63 |
|
|
64 |
|
|
65 |
|
} // namespace passes |
66 |
|
} // namespace preprocessing |
67 |
31125 |
} // namespace cvc5 |