preprocessing/passes/bv_abstraction.h \
preprocessing/passes/bv_ackermann.cpp \
preprocessing/passes/bv_ackermann.h \
+ preprocessing/passes/bv_eager_atoms.cpp \
+ preprocessing/passes/bv_eager_atoms.h \
preprocessing/passes/bv_gauss.cpp \
preprocessing/passes/bv_gauss.h \
preprocessing/passes/bv_intro_pow2.cpp \
--- /dev/null
+/********************* */
+/*! \file bv_eager_atoms.cpp
+ ** \verbatim
+ ** Top contributors (to current version):
+ ** Mathias Preiner
+ ** This file is part of the CVC4 project.
+ ** Copyright (c) 2009-2018 by the authors listed in the file AUTHORS
+ ** in the top-level source directory) and their institutional affiliations.
+ ** All rights reserved. See the file COPYING in the top-level source
+ ** directory for licensing information.\endverbatim
+ **
+ ** \brief Wrap assertions in BITVECTOR_EAGER_ATOM nodes.
+ **
+ ** This preprocessing pass wraps all assertions in BITVECTOR_EAGER_ATOM nodes
+ ** and allows to use eager bit-blasting in the BV solver.
+ **/
+
+
+#include "preprocessing/passes/bv_eager_atoms.h"
+
+#include "theory/theory_model.h"
+
+namespace CVC4 {
+namespace preprocessing {
+namespace passes {
+
+BvEagerAtoms::BvEagerAtoms(PreprocessingPassContext* preprocContext)
+ : PreprocessingPass(preprocContext, "bv-eager-atoms"){};
+
+PreprocessingPassResult BvEagerAtoms::applyInternal(
+ AssertionPipeline* assertionsToPreprocess)
+{
+ theory::TheoryModel* tm = d_preprocContext->getTheoryEngine()->getModel();
+ NodeManager* nm = NodeManager::currentNM();
+ for (unsigned i = 0, size = assertionsToPreprocess->size(); i < size; ++i)
+ {
+ TNode atom = (*assertionsToPreprocess)[i];
+ Node eager_atom = nm->mkNode(kind::BITVECTOR_EAGER_ATOM, atom);
+ tm->addSubstitution(eager_atom, atom);
+ assertionsToPreprocess->replace(i, eager_atom);
+ }
+ return PreprocessingPassResult::NO_CONFLICT;
+}
+
+} // namespace passes
+} // namespace preprocessing
+} // namespace CVC4
--- /dev/null
+/********************* */
+/*! \file bv_eager_atoms.h
+ ** \verbatim
+ ** Top contributors (to current version):
+ ** Mathias Preiner
+ ** This file is part of the CVC4 project.
+ ** Copyright (c) 2009-2018 by the authors listed in the file AUTHORS
+ ** in the top-level source directory) and their institutional affiliations.
+ ** All rights reserved. See the file COPYING in the top-level source
+ ** directory for licensing information.\endverbatim
+ **
+ ** \brief Wrap assertions in BITVECTOR_EAGER_ATOM nodes.
+ **
+ ** This preprocessing pass wraps all assertions in BITVECTOR_EAGER_ATOM nodes
+ ** and allows to use eager bit-blasting in the BV solver.
+ **/
+
+#include "cvc4_private.h"
+
+#ifndef __CVC4__PREPROCESSING__PASSES__BV_EAGER_ATOMS_H
+#define __CVC4__PREPROCESSING__PASSES__BV_EAGER_ATOMS_H
+
+#include "preprocessing/preprocessing_pass.h"
+#include "preprocessing/preprocessing_pass_context.h"
+
+namespace CVC4 {
+namespace preprocessing {
+namespace passes {
+
+class BvEagerAtoms : public PreprocessingPass
+{
+ public:
+ BvEagerAtoms(PreprocessingPassContext* preprocContext);
+
+ protected:
+ PreprocessingPassResult applyInternal(
+ AssertionPipeline* assertionsToPreprocess) override;
+};
+
+} // namespace passes
+} // namespace preprocessing
+} // namespace CVC4
+
+#endif /* __CVC4__PREPROCESSING__PASSES__BV_EAGER_ATOMS_H */
#include "preprocessing/passes/bool_to_bv.h"
#include "preprocessing/passes/bv_abstraction.h"
#include "preprocessing/passes/bv_ackermann.h"
+#include "preprocessing/passes/bv_eager_atoms.h"
#include "preprocessing/passes/bv_gauss.h"
#include "preprocessing/passes/bv_intro_pow2.h"
#include "preprocessing/passes/bv_to_bool.h"
new BoolToBV(d_preprocessingPassContext.get()));
std::unique_ptr<BvAbstraction> bvAbstract(
new BvAbstraction(d_preprocessingPassContext.get()));
+ std::unique_ptr<BvEagerAtoms> bvEagerAtoms(
+ new BvEagerAtoms(d_preprocessingPassContext.get()));
std::unique_ptr<BVAckermann> bvAckermann(
new BVAckermann(d_preprocessingPassContext.get()));
std::unique_ptr<BVGauss> bvGauss(
std::move(bvAbstract));
d_preprocessingPassRegistry.registerPass("bv-ackermann",
std::move(bvAckermann));
+ d_preprocessingPassRegistry.registerPass("bv-eager-atoms",
+ std::move(bvEagerAtoms));
d_preprocessingPassRegistry.registerPass("bv-gauss", std::move(bvGauss));
d_preprocessingPassRegistry.registerPass("bv-intro-pow2",
std::move(bvIntroPow2));
Trace("smt-proc") << "SmtEnginePrivate::processAssertions() : post-theory-preprocessing" << endl;
dumpAssertions("post-theory-preprocessing", d_assertions);
- // If we are using eager bit-blasting wrap assertions in fake atom so that
- // everything gets bit-blasted to internal SAT solver
- if (options::bitblastMode() == theory::bv::BITBLAST_MODE_EAGER) {
- for (unsigned i = 0; i < d_assertions.size(); ++i) {
- TNode atom = d_assertions[i];
- Node eager_atom = NodeManager::currentNM()->mkNode(kind::BITVECTOR_EAGER_ATOM, atom);
- d_assertions.replace(i, eager_atom);
- TheoryModel* m = d_smt.d_theoryEngine->getModel();
- m->addSubstitution(eager_atom, atom);
- }
+ if (options::bitblastMode() == theory::bv::BITBLAST_MODE_EAGER)
+ {
+ d_preprocessingPassRegistry.getPass("bv-eager-atoms")->apply(&d_assertions);
}
//notify theory engine new preprocessed assertions