summaryrefslogtreecommitdiff
path: root/src/smt
diff options
context:
space:
mode:
authorAndres Noetzli <andres.noetzli@gmail.com>2018-04-19 11:47:38 -0700
committerGitHub <noreply@github.com>2018-04-19 11:47:38 -0700
commit70046d35f2aff41867cbb6490e5bf6d026dc55a1 (patch)
treea6903beb73a028ea159b07bb5c773386c1e5c5f5 /src/smt
parent4af9af22f728ebb12afe48c587cfe665fc8cb123 (diff)
Refactor pbRewrites preprocessing pass (#1767)
This commit refactors the pbRewrites preprocessing pass into the new style. This commit is essentially just a code move and adds a regression test for the preprocessing pass. It also makes use of the AssertionPipeline::replace function to do proper dependency tracking.
Diffstat (limited to 'src/smt')
-rw-r--r--src/smt/smt_engine.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/smt/smt_engine.cpp b/src/smt/smt_engine.cpp
index 57cf3ac8c..65d3697b7 100644
--- a/src/smt/smt_engine.cpp
+++ b/src/smt/smt_engine.cpp
@@ -68,8 +68,9 @@
#include "options/strings_options.h"
#include "options/theory_options.h"
#include "options/uf_options.h"
-#include "preprocessing/passes/int_to_bv.h"
#include "preprocessing/passes/bv_gauss.h"
+#include "preprocessing/passes/int_to_bv.h"
+#include "preprocessing/passes/pseudo_boolean_processor.h"
#include "preprocessing/preprocessing_pass.h"
#include "preprocessing/preprocessing_pass_context.h"
#include "preprocessing/preprocessing_pass_registry.h"
@@ -90,7 +91,6 @@
#include "smt_util/nary_builder.h"
#include "smt_util/node_visitor.h"
#include "theory/arith/arith_msum.h"
-#include "theory/arith/pseudoboolean_proc.h"
#include "theory/booleans/circuit_propagator.h"
#include "theory/bv/bvintropow2.h"
#include "theory/bv/theory_bv_rewriter.h"
@@ -571,7 +571,6 @@ public:
private:
std::unique_ptr<PreprocessingPassContext> d_preprocessingPassContext;
PreprocessingPassRegistry d_preprocessingPassRegistry;
- theory::arith::PseudoBooleanProcessor d_pbsProcessor;
/** The top level substitutions */
SubstitutionMap d_topLevelSubstitutions;
@@ -597,8 +596,6 @@ public:
void removeITEs();
Node realToInt(TNode n, NodeToNodeHashMap& cache, std::vector< Node >& var_eq);
- Node intToBV(TNode n, NodeToNodeHashMap& cache);
- Node intToBVMakeBinary(TNode n, NodeToNodeHashMap& cache);
Node purifyNlTerms(TNode n, NodeToNodeHashMap& cache, NodeToNodeHashMap& bcache, std::vector< Node >& var_eq, bool beneathMult = false);
/**
@@ -685,7 +682,6 @@ public:
d_exprNames(smt.d_userContext),
d_iteSkolemMap(),
d_iteRemover(smt.d_userContext),
- d_pbsProcessor(smt.d_userContext),
d_topLevelSubstitutions(smt.d_userContext)
{
d_smt.d_nodeManager->subscribeEvents(this);
@@ -2552,10 +2548,15 @@ void SmtEnginePrivate::finishInit() {
d_preprocessingPassContext.reset(new PreprocessingPassContext(&d_smt));
// TODO: register passes here (this will likely change when we add support for
// actually assembling preprocessing pipelines).
- std::unique_ptr<IntToBV> intToBV(new IntToBV(d_preprocessingPassContext.get()));
std::unique_ptr<BVGauss> bvGauss(new BVGauss(d_preprocessingPassContext.get()));
- d_preprocessingPassRegistry.registerPass("int-to-bv", std::move(intToBV));
+ std::unique_ptr<IntToBV> intToBV(new IntToBV(d_preprocessingPassContext.get()));
+ std::unique_ptr<PseudoBooleanProcessor> pbProc(
+ new PseudoBooleanProcessor(d_preprocessingPassContext.get()));
+
d_preprocessingPassRegistry.registerPass("bv-gauss", std::move(bvGauss));
+ d_preprocessingPassRegistry.registerPass("int-to-bv", std::move(intToBV));
+ d_preprocessingPassRegistry.registerPass("pseudo-boolean-processor",
+ std::move(pbProc));
}
Node SmtEnginePrivate::expandDefinitions(TNode n, unordered_map<Node, Node, NodeHashFunction>& cache, bool expandOnly)
@@ -4268,10 +4269,8 @@ void SmtEnginePrivate::processAssertions() {
}
if( options::pbRewrites() ){
- d_pbsProcessor.learn(d_assertions.ref());
- if(d_pbsProcessor.likelyToHelp()){
- d_pbsProcessor.applyReplacements(d_assertions.ref());
- }
+ d_preprocessingPassRegistry.getPass("pseudo-boolean-processor")
+ ->apply(&d_assertions);
}
Trace("smt-proc") << "SmtEnginePrivate::processAssertions() : pre-simplify" << endl;
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback