diff options
author | Mathias Preiner <mathias.preiner@gmail.com> | 2020-09-03 18:34:19 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-03 18:34:19 -0700 |
commit | c9e23f66383a4d490aca6d082d40117fe799ee4b (patch) | |
tree | 21c4aaf67d7d1b0c188d9e99d3b364883618b479 /src/theory/bv/bitblast | |
parent | a5b834d5af88e372d9c6340653f831a09daf1d39 (diff) |
Split lazy bit-vector solver from TheoryBV (#5009)
This commit separates the lazy bit-vector solver from TheoryBV, which is now a thin wrapper around a bit-vector solver d_internal . This will allow us to easily swap out the bit-vector solver in the future.
Diffstat (limited to 'src/theory/bv/bitblast')
-rw-r--r-- | src/theory/bv/bitblast/eager_bitblaster.cpp | 6 | ||||
-rw-r--r-- | src/theory/bv/bitblast/eager_bitblaster.h | 6 | ||||
-rw-r--r-- | src/theory/bv/bitblast/lazy_bitblaster.cpp | 20 | ||||
-rw-r--r-- | src/theory/bv/bitblast/lazy_bitblaster.h | 10 |
4 files changed, 23 insertions, 19 deletions
diff --git a/src/theory/bv/bitblast/eager_bitblaster.cpp b/src/theory/bv/bitblast/eager_bitblaster.cpp index 627a17bc5..6417740fd 100644 --- a/src/theory/bv/bitblast/eager_bitblaster.cpp +++ b/src/theory/bv/bitblast/eager_bitblaster.cpp @@ -14,14 +14,14 @@ ** Bitblaster for the eager bv solver. **/ -#include "cvc4_private.h" - #include "theory/bv/bitblast/eager_bitblaster.h" +#include "cvc4_private.h" #include "options/bv_options.h" #include "prop/cnf_stream.h" #include "prop/sat_solver_factory.h" #include "smt/smt_statistics_registry.h" +#include "theory/bv/bv_solver_lazy.h" #include "theory/bv/theory_bv.h" #include "theory/theory_model.h" @@ -29,7 +29,7 @@ namespace CVC4 { namespace theory { namespace bv { -EagerBitblaster::EagerBitblaster(TheoryBV* theory_bv, context::Context* c) +EagerBitblaster::EagerBitblaster(BVSolverLazy* theory_bv, context::Context* c) : TBitblaster<Node>(), d_context(c), d_satSolver(), diff --git a/src/theory/bv/bitblast/eager_bitblaster.h b/src/theory/bv/bitblast/eager_bitblaster.h index da9488d43..b57f1ee0b 100644 --- a/src/theory/bv/bitblast/eager_bitblaster.h +++ b/src/theory/bv/bitblast/eager_bitblaster.h @@ -31,12 +31,12 @@ namespace theory { namespace bv { class BitblastingRegistrar; -class TheoryBV; +class BVSolverLazy; class EagerBitblaster : public TBitblaster<Node> { public: - EagerBitblaster(TheoryBV* theory_bv, context::Context* context); + EagerBitblaster(BVSolverLazy* theory_bv, context::Context* context); ~EagerBitblaster(); void addAtom(TNode atom); @@ -61,7 +61,7 @@ class EagerBitblaster : public TBitblaster<Node> std::unique_ptr<prop::SatSolver> d_satSolver; std::unique_ptr<BitblastingRegistrar> d_bitblastingRegistrar; - TheoryBV* d_bv; + BVSolverLazy* d_bv; TNodeSet d_bbAtoms; TNodeSet d_variables; diff --git a/src/theory/bv/bitblast/lazy_bitblaster.cpp b/src/theory/bv/bitblast/lazy_bitblaster.cpp index 3109d6ed7..3e32b4cc3 100644 --- a/src/theory/bv/bitblast/lazy_bitblaster.cpp +++ b/src/theory/bv/bitblast/lazy_bitblaster.cpp @@ -14,16 +14,16 @@ ** Bitblaster for the lazy bv solver. **/ -#include "cvc4_private.h" - #include "theory/bv/bitblast/lazy_bitblaster.h" +#include "cvc4_private.h" #include "options/bv_options.h" #include "prop/cnf_stream.h" #include "prop/sat_solver.h" #include "prop/sat_solver_factory.h" #include "smt/smt_statistics_registry.h" #include "theory/bv/abstraction.h" +#include "theory/bv/bv_solver_lazy.h" #include "theory/bv/theory_bv.h" #include "theory/bv/theory_bv_utils.h" #include "theory/rewriter.h" @@ -58,7 +58,7 @@ uint64_t numNodes(TNode node, utils::NodeSet& seen) } TLazyBitblaster::TLazyBitblaster(context::Context* c, - bv::TheoryBV* bv, + bv::BVSolverLazy* bv, const std::string name, bool emptyNotify) : TBitblaster<Node>(), @@ -292,8 +292,12 @@ bool TLazyBitblaster::assertToSat(TNode lit, bool propagate) { markerLit = ~markerLit; } - Debug("bitvector-bb") << "TheoryBV::TLazyBitblaster::assertToSat asserting node: " << atom <<"\n"; - Debug("bitvector-bb") << "TheoryBV::TLazyBitblaster::assertToSat with literal: " << markerLit << "\n"; + Debug("bitvector-bb") + << "BVSolverLazy::TLazyBitblaster::assertToSat asserting node: " << atom + << "\n"; + Debug("bitvector-bb") + << "BVSolverLazy::TLazyBitblaster::assertToSat with literal: " + << markerLit << "\n"; prop::SatValue ret = d_satSolver->assertAssumption(markerLit, propagate); @@ -410,9 +414,9 @@ void TLazyBitblaster::MinisatNotify::notify(prop::SatClause& clause) { lemmab << d_cnf->getNode(clause[i]); } Node lemma = lemmab; - d_bv->d_out->lemma(lemma); + d_bv->d_inferManager.lemma(lemma); } else { - d_bv->d_out->lemma(d_cnf->getNode(clause[0])); + d_bv->d_inferManager.lemma(d_cnf->getNode(clause[0])); } } @@ -423,7 +427,7 @@ void TLazyBitblaster::MinisatNotify::spendResource(ResourceManager::Resource r) void TLazyBitblaster::MinisatNotify::safePoint(ResourceManager::Resource r) { - d_bv->d_out->safePoint(r); + d_bv->d_inferManager.safePoint(r); } EqualityStatus TLazyBitblaster::getEqualityStatus(TNode a, TNode b) diff --git a/src/theory/bv/bitblast/lazy_bitblaster.h b/src/theory/bv/bitblast/lazy_bitblaster.h index bc930aec4..e53f1697d 100644 --- a/src/theory/bv/bitblast/lazy_bitblaster.h +++ b/src/theory/bv/bitblast/lazy_bitblaster.h @@ -32,7 +32,7 @@ namespace CVC4 { namespace theory { namespace bv { -class TheoryBV; +class BVSolverLazy; class TLazyBitblaster : public TBitblaster<Node> { @@ -45,7 +45,7 @@ class TLazyBitblaster : public TBitblaster<Node> bool hasBBAtom(TNode atom) const override; TLazyBitblaster(context::Context* c, - TheoryBV* bv, + BVSolverLazy* bv, const std::string name = "", bool emptyNotify = false); ~TLazyBitblaster(); @@ -108,11 +108,11 @@ class TLazyBitblaster : public TBitblaster<Node> class MinisatNotify : public prop::BVSatSolverNotify { prop::CnfStream* d_cnf; - TheoryBV* d_bv; + BVSolverLazy* d_bv; TLazyBitblaster* d_lazyBB; public: - MinisatNotify(prop::CnfStream* cnf, TheoryBV* bv, TLazyBitblaster* lbv) + MinisatNotify(prop::CnfStream* cnf, BVSolverLazy* bv, TLazyBitblaster* lbv) : d_cnf(cnf), d_bv(bv), d_lazyBB(lbv) { } @@ -123,7 +123,7 @@ class TLazyBitblaster : public TBitblaster<Node> void safePoint(ResourceManager::Resource r) override; }; - TheoryBV* d_bv; + BVSolverLazy* d_bv; context::Context* d_ctx; std::unique_ptr<prop::NullRegistrar> d_nullRegistrar; |