1 |
|
/****************************************************************************** |
2 |
|
* Top contributors (to current version): |
3 |
|
* Caleb Donovick, Andrew Reynolds, Gereon Kremer |
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 |
|
* Remove rewrite rules, apply pre-skolemization to existential quantifiers. |
14 |
|
* |
15 |
|
* Calls the quantifier rewriter, removing rewrite rules and applying |
16 |
|
* pre-skolemization to existential quantifiers |
17 |
|
*/ |
18 |
|
|
19 |
|
#include "preprocessing/passes/quantifiers_preprocess.h" |
20 |
|
|
21 |
|
#include "base/output.h" |
22 |
|
#include "preprocessing/assertion_pipeline.h" |
23 |
|
#include "theory/quantifiers/quantifiers_rewriter.h" |
24 |
|
#include "theory/rewriter.h" |
25 |
|
|
26 |
|
namespace cvc5 { |
27 |
|
namespace preprocessing { |
28 |
|
namespace passes { |
29 |
|
|
30 |
|
using namespace std; |
31 |
|
using namespace cvc5::theory; |
32 |
|
|
33 |
9927 |
QuantifiersPreprocess::QuantifiersPreprocess(PreprocessingPassContext* preprocContext) |
34 |
9927 |
: PreprocessingPass(preprocContext, "quantifiers-preprocess"){}; |
35 |
|
|
36 |
8177 |
PreprocessingPassResult QuantifiersPreprocess::applyInternal( |
37 |
|
AssertionPipeline* assertionsToPreprocess) |
38 |
|
{ |
39 |
8177 |
size_t size = assertionsToPreprocess->size(); |
40 |
61959 |
for (size_t i = 0; i < size; ++i) |
41 |
|
{ |
42 |
107564 |
Node prev = (*assertionsToPreprocess)[i]; |
43 |
107564 |
TrustNode trn = quantifiers::QuantifiersRewriter::preprocess(prev); |
44 |
53782 |
if (!trn.isNull()) |
45 |
|
{ |
46 |
32 |
Node next = trn.getNode(); |
47 |
16 |
assertionsToPreprocess->replace(i, Rewriter::rewrite(next)); |
48 |
16 |
Trace("quantifiers-preprocess") << "*** Pre-skolemize " << prev << endl; |
49 |
32 |
Trace("quantifiers-preprocess") |
50 |
16 |
<< " ...got " << (*assertionsToPreprocess)[i] << endl; |
51 |
|
} |
52 |
|
} |
53 |
|
|
54 |
8177 |
return PreprocessingPassResult::NO_CONFLICT; |
55 |
|
} |
56 |
|
|
57 |
|
|
58 |
|
} // namespace passes |
59 |
|
} // namespace preprocessing |
60 |
29505 |
} // namespace cvc5 |