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_preprocess.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 |
15338 |
QuantifiersPreprocess::QuantifiersPreprocess(PreprocessingPassContext* preprocContext) |
34 |
15338 |
: PreprocessingPass(preprocContext, "quantifiers-preprocess"){}; |
35 |
|
|
36 |
13442 |
PreprocessingPassResult QuantifiersPreprocess::applyInternal( |
37 |
|
AssertionPipeline* assertionsToPreprocess) |
38 |
|
{ |
39 |
13442 |
size_t size = assertionsToPreprocess->size(); |
40 |
26884 |
quantifiers::QuantifiersPreprocess qp(d_env); |
41 |
79839 |
for (size_t i = 0; i < size; ++i) |
42 |
|
{ |
43 |
132794 |
Node prev = (*assertionsToPreprocess)[i]; |
44 |
132794 |
TrustNode trn = qp.preprocess(prev); |
45 |
66397 |
if (!trn.isNull()) |
46 |
|
{ |
47 |
32 |
Node next = trn.getNode(); |
48 |
16 |
assertionsToPreprocess->replace(i, rewrite(next)); |
49 |
16 |
Trace("quantifiers-preprocess") << "*** Pre-skolemize " << prev << endl; |
50 |
32 |
Trace("quantifiers-preprocess") |
51 |
16 |
<< " ...got " << (*assertionsToPreprocess)[i] << endl; |
52 |
|
} |
53 |
|
} |
54 |
|
|
55 |
26884 |
return PreprocessingPassResult::NO_CONFLICT; |
56 |
|
} |
57 |
|
|
58 |
|
|
59 |
|
} // namespace passes |
60 |
|
} // namespace preprocessing |
61 |
31125 |
} // namespace cvc5 |