summaryrefslogtreecommitdiff
path: root/src/smt
diff options
context:
space:
mode:
authorMathias Preiner <mathias.preiner@gmail.com>2018-08-30 15:49:45 -0700
committerGitHub <noreply@github.com>2018-08-30 15:49:45 -0700
commit45af307478241b1fc8278406549d297f7f80fdb3 (patch)
treed8dcfcfb1e0599b6a8bfc5cb81ac9461891be215 /src/smt
parent6d04d6daff575a7e48eb88124faefadfadf727f4 (diff)
Refactor theory preprocess into preprocessing pass. (#2395)
Diffstat (limited to 'src/smt')
-rw-r--r--src/smt/smt_engine.cpp46
1 files changed, 11 insertions, 35 deletions
diff --git a/src/smt/smt_engine.cpp b/src/smt/smt_engine.cpp
index 2b388275a..914d781d4 100644
--- a/src/smt/smt_engine.cpp
+++ b/src/smt/smt_engine.cpp
@@ -87,7 +87,6 @@
#include "preprocessing/passes/miplib_trick.h"
#include "preprocessing/passes/pseudo_boolean_processor.h"
#include "preprocessing/passes/quantifier_macros.h"
-#include "preprocessing/passes/quantifier_macros.h"
#include "preprocessing/passes/quantifiers_preprocess.h"
#include "preprocessing/passes/real_to_int.h"
#include "preprocessing/passes/rewrite.h"
@@ -98,6 +97,7 @@
#include "preprocessing/passes/symmetry_breaker.h"
#include "preprocessing/passes/symmetry_detect.h"
#include "preprocessing/passes/synth_rew_rules.h"
+#include "preprocessing/passes/theory_preprocess.h"
#include "preprocessing/passes/unconstrained_simplifier.h"
#include "preprocessing/preprocessing_pass.h"
#include "preprocessing/preprocessing_pass_context.h"
@@ -202,8 +202,6 @@ struct SmtEngineStatistics {
TimerStat d_nonclausalSimplificationTime;
/** number of constant propagations found during nonclausal simp */
IntStat d_numConstantProps;
- /** time spent in theory preprocessing */
- TimerStat d_theoryPreprocessTime;
/** time spent converting to CNF */
TimerStat d_cnfConversionTime;
/** Num of assertions before ite removal */
@@ -232,7 +230,6 @@ struct SmtEngineStatistics {
d_definitionExpansionTime("smt::SmtEngine::definitionExpansionTime"),
d_nonclausalSimplificationTime("smt::SmtEngine::nonclausalSimplificationTime"),
d_numConstantProps("smt::SmtEngine::numConstantProps", 0),
- d_theoryPreprocessTime("smt::SmtEngine::theoryPreprocessTime"),
d_cnfConversionTime("smt::SmtEngine::cnfConversionTime"),
d_numAssertionsPre("smt::SmtEngine::numAssertionsPreITERemoval", 0),
d_numAssertionsPost("smt::SmtEngine::numAssertionsPostITERemoval", 0),
@@ -248,7 +245,6 @@ struct SmtEngineStatistics {
smtStatisticsRegistry()->registerStat(&d_definitionExpansionTime);
smtStatisticsRegistry()->registerStat(&d_nonclausalSimplificationTime);
smtStatisticsRegistry()->registerStat(&d_numConstantProps);
- smtStatisticsRegistry()->registerStat(&d_theoryPreprocessTime);
smtStatisticsRegistry()->registerStat(&d_cnfConversionTime);
smtStatisticsRegistry()->registerStat(&d_numAssertionsPre);
smtStatisticsRegistry()->registerStat(&d_numAssertionsPost);
@@ -266,7 +262,6 @@ struct SmtEngineStatistics {
smtStatisticsRegistry()->unregisterStat(&d_definitionExpansionTime);
smtStatisticsRegistry()->unregisterStat(&d_nonclausalSimplificationTime);
smtStatisticsRegistry()->unregisterStat(&d_numConstantProps);
- smtStatisticsRegistry()->unregisterStat(&d_theoryPreprocessTime);
smtStatisticsRegistry()->unregisterStat(&d_cnfConversionTime);
smtStatisticsRegistry()->unregisterStat(&d_numAssertionsPre);
smtStatisticsRegistry()->unregisterStat(&d_numAssertionsPost);
@@ -2638,6 +2633,8 @@ void SmtEnginePrivate::finishInit()
new SynthRewRulesPass(d_preprocessingPassContext.get()));
std::unique_ptr<SepSkolemEmp> sepSkolemEmp(
new SepSkolemEmp(d_preprocessingPassContext.get()));
+ std::unique_ptr<TheoryPreprocess> theoryPreprocess(
+ new TheoryPreprocess(d_preprocessingPassContext.get()));
std::unique_ptr<UnconstrainedSimplifier> unconstrainedSimplifier(
new UnconstrainedSimplifier(d_preprocessingPassContext.get()));
d_preprocessingPassRegistry.registerPass("apply-substs",
@@ -2684,6 +2681,8 @@ void SmtEnginePrivate::finishInit()
std::move(sygusInfer));
d_preprocessingPassRegistry.registerPass("sym-break", std::move(sbProc));
d_preprocessingPassRegistry.registerPass("synth-rr", std::move(srrProc));
+ d_preprocessingPassRegistry.registerPass("theory-preprocess",
+ std::move(theoryPreprocess));
d_preprocessingPassRegistry.registerPass("quantifier-macros",
std::move(quantifierMacros));
d_preprocessingPassRegistry.registerPass("unconstrained-simplifier",
@@ -3274,25 +3273,13 @@ bool SmtEnginePrivate::simplifyAssertions()
// before ppRewrite check if only core theory for BV theory
d_smt.d_theoryEngine->staticInitializeBVOptions(d_assertions.ref());
- dumpAssertions("pre-theorypp", d_assertions);
-
// Theory preprocessing
- if (d_smt.d_earlyTheoryPP) {
- Chat() << "...doing early theory preprocessing..." << endl;
- TimerStat::CodeTimer codeTimer(d_smt.d_stats->d_theoryPreprocessTime);
- // Call the theory preprocessors
- d_smt.d_theoryEngine->preprocessStart();
- for (unsigned i = 0; i < d_assertions.size(); ++ i) {
- Assert(Rewriter::rewrite(d_assertions[i]) == d_assertions[i]);
- d_assertions.replace(i, d_smt.d_theoryEngine->preprocess(d_assertions[i]));
- Assert(Rewriter::rewrite(d_assertions[i]) == d_assertions[i]);
- }
+ if (d_smt.d_earlyTheoryPP)
+ {
+ d_preprocessingPassRegistry.getPass("theory-preprocess")
+ ->apply(&d_assertions);
}
- dumpAssertions("post-theorypp", d_assertions);
- Trace("smt") << "POST theoryPP" << endl;
- Debug("smt") << " d_assertions : " << d_assertions.size() << endl;
-
// ITE simplification
if (options::doITESimp()
&& (d_simplifyAssertionsDepth <= 1 || options::doITESimpOnRepeat()))
@@ -3821,19 +3808,8 @@ void SmtEnginePrivate::processAssertions() {
Debug("smt") << "SmtEnginePrivate::processAssertions() POST SIMPLIFICATION" << endl;
Debug("smt") << " d_assertions : " << d_assertions.size() << endl;
- Trace("smt-proc") << "SmtEnginePrivate::processAssertions() : pre-theory-preprocessing" << endl;
- dumpAssertions("pre-theory-preprocessing", d_assertions);
- {
- Chat() << "theory preprocessing..." << endl;
- TimerStat::CodeTimer codeTimer(d_smt.d_stats->d_theoryPreprocessTime);
- // Call the theory preprocessors
- d_smt.d_theoryEngine->preprocessStart();
- for (unsigned i = 0; i < d_assertions.size(); ++ i) {
- d_assertions.replace(i, d_smt.d_theoryEngine->preprocess(d_assertions[i]));
- }
- }
- Trace("smt-proc") << "SmtEnginePrivate::processAssertions() : post-theory-preprocessing" << endl;
- dumpAssertions("post-theory-preprocessing", d_assertions);
+ d_preprocessingPassRegistry.getPass("theory-preprocess")
+ ->apply(&d_assertions);
if (options::bitblastMode() == theory::bv::BITBLAST_MODE_EAGER)
{
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback