summaryrefslogtreecommitdiff
path: root/src/theory/bv
diff options
context:
space:
mode:
authorHaniel Barbosa <hanielbbarbosa@gmail.com>2020-09-01 19:08:23 -0300
committerGitHub <noreply@github.com>2020-09-01 19:08:23 -0300
commit8ad308b23c705e73507a42d2425289e999d47f86 (patch)
tree29e3ac78844bc57171e0d122d758a8371a292a93 /src/theory/bv
parent62ec0666dd4d409ee85603ae94d7ab1a2b4c9dcc (diff)
Removes old proof code (#4964)
This deletes much of the old proof code. Basically everything but the minimal necessary infra-structure for producing unsat cores. That includes dependency tracking in preprocessing, the prop engine proof and the unsat core computation code in the old proof manager. These should also go once we fully integrate into master the new proof infrastructure. It also cleans interfaces that were using old-proof-code-specific constructs (such as LemmaProofRecipe). When possible or when it made sense standalone local proof production code was kept, but deactivated (such is in the equality engine and in the arithmetic solver).
Diffstat (limited to 'src/theory/bv')
-rw-r--r--src/theory/bv/bitblast/aig_bitblaster.h6
-rw-r--r--src/theory/bv/bitblast/bitblaster.h21
-rw-r--r--src/theory/bv/bitblast/eager_bitblaster.cpp19
-rw-r--r--src/theory/bv/bitblast/eager_bitblaster.h2
-rw-r--r--src/theory/bv/bitblast/lazy_bitblaster.cpp19
-rw-r--r--src/theory/bv/bitblast/lazy_bitblaster.h1
-rw-r--r--src/theory/bv/bv_eager_solver.cpp12
-rw-r--r--src/theory/bv/bv_eager_solver.h3
-rw-r--r--src/theory/bv/bv_subtheory.h9
-rw-r--r--src/theory/bv/bv_subtheory_bitblast.cpp7
-rw-r--r--src/theory/bv/bv_subtheory_bitblast.h5
-rw-r--r--src/theory/bv/theory_bv.cpp57
-rw-r--r--src/theory/bv/theory_bv.h17
13 files changed, 45 insertions, 133 deletions
diff --git a/src/theory/bv/bitblast/aig_bitblaster.h b/src/theory/bv/bitblast/aig_bitblaster.h
index 1e1b5bab4..fef45cdf5 100644
--- a/src/theory/bv/bitblast/aig_bitblaster.h
+++ b/src/theory/bv/bitblast/aig_bitblaster.h
@@ -89,12 +89,6 @@ class AigBitblaster : public TBitblaster<Abc_Obj_t*>
prop::SatSolver* getSatSolver() override { return d_satSolver.get(); }
- void setProofLog(proof::BitVectorProof* bvp) override
- {
- // Proofs are currently not supported with ABC
- Unimplemented();
- }
-
class Statistics
{
public:
diff --git a/src/theory/bv/bitblast/bitblaster.h b/src/theory/bv/bitblast/bitblaster.h
index defc66b74..74e3c3f56 100644
--- a/src/theory/bv/bitblast/bitblaster.h
+++ b/src/theory/bv/bitblast/bitblaster.h
@@ -24,8 +24,8 @@
#include <vector>
#include "expr/node.h"
-#include "proof/bitvector_proof.h"
#include "prop/bv_sat_solver_notify.h"
+#include "prop/sat_solver.h"
#include "prop/sat_solver_types.h"
#include "smt/smt_engine_scope.h"
#include "theory/bv/bitblast/bitblast_strategies_template.h"
@@ -64,7 +64,6 @@ class TBitblaster
// sat solver used for bitblasting and associated CnfStream
std::unique_ptr<context::Context> d_nullContext;
std::unique_ptr<prop::CnfStream> d_cnfStream;
- proof::BitVectorProof* d_bvp;
void initAtomBBStrategies();
void initTermBBStrategies();
@@ -91,7 +90,6 @@ class TBitblaster
bool hasBBTerm(TNode node) const;
void getBBTerm(TNode node, Bits& bits) const;
virtual void storeBBTerm(TNode term, const Bits& bits);
- virtual void setProofLog(proof::BitVectorProof* bvp);
/**
* Return a constant representing the value of a in the model.
@@ -186,8 +184,7 @@ TBitblaster<T>::TBitblaster()
: d_termCache(),
d_modelCache(),
d_nullContext(new context::Context()),
- d_cnfStream(),
- d_bvp(nullptr)
+ d_cnfStream()
{
initAtomBBStrategies();
initTermBBStrategies();
@@ -218,20 +215,6 @@ void TBitblaster<T>::invalidateModelCache()
}
template <class T>
-void TBitblaster<T>::setProofLog(proof::BitVectorProof* bvp)
-{
- if (THEORY_PROOF_ON())
- {
- d_bvp = bvp;
- prop::SatSolver* satSolver = getSatSolver();
- bvp->attachToSatSolver(*satSolver);
- prop::SatVariable t = satSolver->trueVar();
- prop::SatVariable f = satSolver->falseVar();
- bvp->initCnfProof(d_cnfStream.get(), d_nullContext.get(), t, f);
- }
-}
-
-template <class T>
Node TBitblaster<T>::getTermModel(TNode node, bool fullModel)
{
if (d_modelCache.find(node) != d_modelCache.end()) return d_modelCache[node];
diff --git a/src/theory/bv/bitblast/eager_bitblaster.cpp b/src/theory/bv/bitblast/eager_bitblaster.cpp
index 4acd1d2f8..627a17bc5 100644
--- a/src/theory/bv/bitblast/eager_bitblaster.cpp
+++ b/src/theory/bv/bitblast/eager_bitblaster.cpp
@@ -72,7 +72,7 @@ EagerBitblaster::EagerBitblaster(TheoryBV* theory_bv, context::Context* c)
d_bitblastingRegistrar.get(),
d_nullContext.get(),
rm,
- options::proof(),
+ false,
"EagerBitblaster"));
}
@@ -87,8 +87,7 @@ void EagerBitblaster::bbFormula(TNode node)
}
else
{
- d_cnfStream->convertAndAssert(
- node, false, false, RULE_INVALID, TNode::null());
+ d_cnfStream->convertAndAssert(node, false, false);
}
}
@@ -116,10 +115,7 @@ void EagerBitblaster::bbAtom(TNode node)
? d_atomBBStrategies[normalized.getKind()](normalized, this)
: normalized;
- if (!options::proof())
- {
- atom_bb = Rewriter::rewrite(atom_bb);
- }
+ atom_bb = Rewriter::rewrite(atom_bb);
// asserting that the atom is true iff the definition holds
Node atom_definition =
@@ -127,21 +123,14 @@ void EagerBitblaster::bbAtom(TNode node)
AlwaysAssert(options::bitblastMode() == options::BitblastMode::EAGER);
storeBBAtom(node, atom_bb);
- d_cnfStream->convertAndAssert(
- atom_definition, false, false, RULE_INVALID, TNode::null());
+ d_cnfStream->convertAndAssert(atom_definition, false, false);
}
void EagerBitblaster::storeBBAtom(TNode atom, Node atom_bb) {
- if (d_bvp) {
- d_bvp->registerAtomBB(atom.toExpr(), atom_bb.toExpr());
- }
d_bbAtoms.insert(atom);
}
void EagerBitblaster::storeBBTerm(TNode node, const Bits& bits) {
- if (d_bvp) {
- d_bvp->registerTermBB(node.toExpr());
- }
d_termCache.insert(std::make_pair(node, bits));
}
diff --git a/src/theory/bv/bitblast/eager_bitblaster.h b/src/theory/bv/bitblast/eager_bitblaster.h
index a8b7ccbe5..da9488d43 100644
--- a/src/theory/bv/bitblast/eager_bitblaster.h
+++ b/src/theory/bv/bitblast/eager_bitblaster.h
@@ -23,8 +23,6 @@
#include "theory/bv/bitblast/bitblaster.h"
-#include "proof/bitvector_proof.h"
-#include "proof/resolution_bitvector_proof.h"
#include "prop/cnf_stream.h"
#include "prop/sat_solver.h"
diff --git a/src/theory/bv/bitblast/lazy_bitblaster.cpp b/src/theory/bv/bitblast/lazy_bitblaster.cpp
index 83e286f10..3109d6ed7 100644
--- a/src/theory/bv/bitblast/lazy_bitblaster.cpp
+++ b/src/theory/bv/bitblast/lazy_bitblaster.cpp
@@ -19,7 +19,6 @@
#include "theory/bv/bitblast/lazy_bitblaster.h"
#include "options/bv_options.h"
-#include "proof/proof_manager.h"
#include "prop/cnf_stream.h"
#include "prop/sat_solver.h"
#include "prop/sat_solver_factory.h"
@@ -84,7 +83,7 @@ TLazyBitblaster::TLazyBitblaster(context::Context* c,
d_nullRegistrar.get(),
d_nullContext.get(),
rm,
- options::proof(),
+ false,
"LazyBitblaster"));
d_satSolverNotify.reset(
@@ -161,8 +160,7 @@ void TLazyBitblaster::bbAtom(TNode node)
Assert(!atom_bb.isNull());
Node atom_definition = nm->mkNode(kind::EQUAL, node, atom_bb);
storeBBAtom(node, atom_bb);
- d_cnfStream->convertAndAssert(
- atom_definition, false, false, RULE_INVALID, TNode::null());
+ d_cnfStream->convertAndAssert(atom_definition, false, false);
return;
}
@@ -173,28 +171,19 @@ void TLazyBitblaster::bbAtom(TNode node)
? d_atomBBStrategies[normalized.getKind()](normalized, this)
: normalized;
- if (!options::proof())
- {
- atom_bb = Rewriter::rewrite(atom_bb);
- }
+ atom_bb = Rewriter::rewrite(atom_bb);
// asserting that the atom is true iff the definition holds
Node atom_definition = nm->mkNode(kind::EQUAL, node, atom_bb);
storeBBAtom(node, atom_bb);
- d_cnfStream->convertAndAssert(
- atom_definition, false, false, RULE_INVALID, TNode::null());
+ d_cnfStream->convertAndAssert(atom_definition, false, false);
}
void TLazyBitblaster::storeBBAtom(TNode atom, Node atom_bb) {
- // No need to store the definition for the lazy bit-blaster (unless proofs are enabled).
- if( d_bvp != NULL ){
- d_bvp->registerAtomBB(atom.toExpr(), atom_bb.toExpr());
- }
d_bbAtoms.insert(atom);
}
void TLazyBitblaster::storeBBTerm(TNode node, const Bits& bits) {
- if( d_bvp ){ d_bvp->registerTermBB(node.toExpr()); }
d_termCache.insert(std::make_pair(node, bits));
}
diff --git a/src/theory/bv/bitblast/lazy_bitblaster.h b/src/theory/bv/bitblast/lazy_bitblaster.h
index a355d42c4..bc930aec4 100644
--- a/src/theory/bv/bitblast/lazy_bitblaster.h
+++ b/src/theory/bv/bitblast/lazy_bitblaster.h
@@ -19,7 +19,6 @@
#ifndef CVC4__THEORY__BV__BITBLAST__LAZY_BITBLASTER_H
#define CVC4__THEORY__BV__BITBLAST__LAZY_BITBLASTER_H
-#include "proof/resolution_bitvector_proof.h"
#include "theory/bv/bitblast/bitblaster.h"
#include "context/cdhashmap.h"
diff --git a/src/theory/bv/bv_eager_solver.cpp b/src/theory/bv/bv_eager_solver.cpp
index 36aa72da3..d1490374d 100644
--- a/src/theory/bv/bv_eager_solver.cpp
+++ b/src/theory/bv/bv_eager_solver.cpp
@@ -33,8 +33,7 @@ EagerBitblastSolver::EagerBitblastSolver(context::Context* c, TheoryBV* bv)
d_bitblaster(),
d_aigBitblaster(),
d_useAig(options::bitvectorAig()),
- d_bv(bv),
- d_bvp(nullptr)
+ d_bv(bv)
{
}
@@ -55,10 +54,6 @@ void EagerBitblastSolver::initialize() {
#endif
} else {
d_bitblaster.reset(new EagerBitblaster(d_bv, d_context));
- THEORY_PROOF(if (d_bvp) {
- d_bitblaster->setProofLog(d_bvp);
- d_bvp->setBitblaster(d_bitblaster.get());
- });
}
}
@@ -127,11 +122,6 @@ bool EagerBitblastSolver::collectModelInfo(TheoryModel* m, bool fullModel)
return d_bitblaster->collectModelInfo(m, fullModel);
}
-void EagerBitblastSolver::setProofLog(proof::BitVectorProof* bvp)
-{
- d_bvp = bvp;
-}
-
} // namespace bv
} // namespace theory
} // namespace CVC4
diff --git a/src/theory/bv/bv_eager_solver.h b/src/theory/bv/bv_eager_solver.h
index 6182832e9..e0b55c23b 100644
--- a/src/theory/bv/bv_eager_solver.h
+++ b/src/theory/bv/bv_eager_solver.h
@@ -23,7 +23,6 @@
#include <vector>
#include "expr/node.h"
-#include "proof/resolution_bitvector_proof.h"
#include "theory/bv/theory_bv.h"
#include "theory/theory_model.h"
@@ -48,7 +47,6 @@ class EagerBitblastSolver {
bool isInitialized();
void initialize();
bool collectModelInfo(theory::TheoryModel* m, bool fullModel);
- void setProofLog(proof::BitVectorProof* bvp);
private:
context::CDHashSet<Node, NodeHashFunction> d_assertionSet;
@@ -61,7 +59,6 @@ class EagerBitblastSolver {
bool d_useAig;
TheoryBV* d_bv;
- proof::BitVectorProof* d_bvp;
}; // class EagerBitblastSolver
} // namespace bv
diff --git a/src/theory/bv/bv_subtheory.h b/src/theory/bv/bv_subtheory.h
index 725b61f95..f4b88b719 100644
--- a/src/theory/bv/bv_subtheory.h
+++ b/src/theory/bv/bv_subtheory.h
@@ -25,10 +25,6 @@
namespace CVC4 {
-namespace proof {
-class BitVectorProof;
-}
-
namespace theory {
class TheoryModel;
@@ -72,7 +68,6 @@ class SubtheorySolver {
SubtheorySolver(context::Context* c, TheoryBV* bv)
: d_context(c),
d_bv(bv),
- d_bvp(nullptr),
d_assertionQueue(c),
d_assertionIndex(c, 0) {}
virtual ~SubtheorySolver() {}
@@ -93,7 +88,7 @@ class SubtheorySolver {
return res;
}
virtual void assertFact(TNode fact) { d_assertionQueue.push_back(fact); }
- virtual void setProofLog(proof::BitVectorProof* bvp) {}
+
AssertionQueue::const_iterator assertionsBegin() {
return d_assertionQueue.begin();
}
@@ -107,8 +102,6 @@ class SubtheorySolver {
/** The bit-vector theory */
TheoryBV* d_bv;
- /** proof log */
- proof::ResolutionBitVectorProof* d_bvp;
AssertionQueue d_assertionQueue;
context::CDO<uint32_t> d_assertionIndex;
}; /* class SubtheorySolver */
diff --git a/src/theory/bv/bv_subtheory_bitblast.cpp b/src/theory/bv/bv_subtheory_bitblast.cpp
index 8f87bc4b8..28c70a5b8 100644
--- a/src/theory/bv/bv_subtheory_bitblast.cpp
+++ b/src/theory/bv/bv_subtheory_bitblast.cpp
@@ -18,7 +18,6 @@
#include "decision/decision_attributes.h"
#include "options/bv_options.h"
#include "options/decision_options.h"
-#include "proof/proof_manager.h"
#include "smt/smt_statistics_registry.h"
#include "theory/bv/abstraction.h"
#include "theory/bv/bitblast/lazy_bitblaster.h"
@@ -276,12 +275,6 @@ void BitblastSolver::setConflict(TNode conflict) {
d_bv->setConflict(final_conflict);
}
-void BitblastSolver::setProofLog(proof::BitVectorProof* bvp)
-{
- d_bitblaster->setProofLog( bvp );
- bvp->setBitblaster(d_bitblaster.get());
-}
-
}/* namespace CVC4::theory::bv */
}/* namespace CVC4::theory */
}/* namespace CVC4 */
diff --git a/src/theory/bv/bv_subtheory_bitblast.h b/src/theory/bv/bv_subtheory_bitblast.h
index a2b099609..60ef08d93 100644
--- a/src/theory/bv/bv_subtheory_bitblast.h
+++ b/src/theory/bv/bv_subtheory_bitblast.h
@@ -24,10 +24,6 @@
namespace CVC4 {
-namespace proof {
-class ResolutionBitVectorProof;
-}
-
namespace theory {
namespace bv {
@@ -79,7 +75,6 @@ public:
void bitblastQueue();
void setAbstraction(AbstractionModule* module);
uint64_t computeAtomWeight(TNode atom);
- void setProofLog(proof::BitVectorProof* bvp) override;
};
} /* namespace CVC4::theory::bv */
diff --git a/src/theory/bv/theory_bv.cpp b/src/theory/bv/theory_bv.cpp
index 1696d6185..d6492f177 100644
--- a/src/theory/bv/theory_bv.cpp
+++ b/src/theory/bv/theory_bv.cpp
@@ -18,8 +18,6 @@
#include "expr/node_algorithm.h"
#include "options/bv_options.h"
#include "options/smt_options.h"
-#include "proof/proof_manager.h"
-#include "proof/theory_proof.h"
#include "smt/smt_statistics_registry.h"
#include "theory/bv/abstraction.h"
#include "theory/bv/bv_eager_solver.h"
@@ -83,19 +81,19 @@ TheoryBV::TheoryBV(context::Context* c,
return;
}
- if (options::bitvectorEqualitySolver() && !options::proof())
+ if (options::bitvectorEqualitySolver())
{
d_subtheories.emplace_back(new CoreSolver(c, this, d_extTheory.get()));
d_subtheoryMap[SUB_CORE] = d_subtheories.back().get();
}
- if (options::bitvectorInequalitySolver() && !options::proof())
+ if (options::bitvectorInequalitySolver())
{
d_subtheories.emplace_back(new InequalitySolver(c, u, this));
d_subtheoryMap[SUB_INEQUALITY] = d_subtheories.back().get();
}
- if (options::bitvectorAlgebraicSolver() && !options::proof())
+ if (options::bitvectorAlgebraicSolver())
{
d_subtheories.emplace_back(new AlgebraicSolver(c, this));
d_subtheoryMap[SUB_ALGEBRAIC] = d_subtheories.back().get();
@@ -230,8 +228,11 @@ TrustNode TheoryBV::expandDefinition(Node node)
TNode num = node[0], den = node[1];
Node den_eq_0 = nm->mkNode(kind::EQUAL, den, utils::mkZero(width));
- Node divTotalNumDen = nm->mkNode(node.getKind() == kind::BITVECTOR_UDIV ? kind::BITVECTOR_UDIV_TOTAL :
- kind::BITVECTOR_UREM_TOTAL, num, den);
+ Node divTotalNumDen = nm->mkNode(node.getKind() == kind::BITVECTOR_UDIV
+ ? kind::BITVECTOR_UDIV_TOTAL
+ : kind::BITVECTOR_UREM_TOTAL,
+ num,
+ den);
Node divByZero = getBVDivByZero(node.getKind(), width);
Node divByZeroNum = nm->mkNode(kind::APPLY_UF, divByZero, num);
ret = nm->mkNode(kind::ITE, den_eq_0, divByZeroNum, divTotalNumDen);
@@ -327,7 +328,7 @@ void TheoryBV::check(Effort e)
if (done() && e<Theory::EFFORT_FULL) {
return;
}
-
+
//last call : do reductions on extended bitvector functions
if (e == Theory::EFFORT_LAST_CALL) {
std::vector<Node> nred = d_extTheory->getActive();
@@ -410,7 +411,7 @@ void TheoryBV::check(Effort e)
break;
}
}
-
+
//check extended functions
if (Theory::fullEffort(e)) {
//do inferences (adds external lemmas) TODO: this can be improved to add internal inferences
@@ -431,7 +432,9 @@ void TheoryBV::check(Effort e)
if( doExtfReductions( nred ) ){
return;
}
- }else{
+ }
+ else
+ {
d_needsLastCallCheck = true;
}
}
@@ -726,11 +729,13 @@ TrustNode TheoryBV::ppRewrite(TNode t)
} else if (RewriteRule<UltPlusOne>::applies(t)) {
Node result = RewriteRule<UltPlusOne>::run<false>(t);
res = Rewriter::rewrite(result);
- } else if( res.getKind() == kind::EQUAL &&
- ((res[0].getKind() == kind::BITVECTOR_PLUS &&
- RewriteRule<ConcatToMult>::applies(res[1])) ||
- (res[1].getKind() == kind::BITVECTOR_PLUS &&
- RewriteRule<ConcatToMult>::applies(res[0])))) {
+ }
+ else if (res.getKind() == kind::EQUAL
+ && ((res[0].getKind() == kind::BITVECTOR_PLUS
+ && RewriteRule<ConcatToMult>::applies(res[1]))
+ || (res[1].getKind() == kind::BITVECTOR_PLUS
+ && RewriteRule<ConcatToMult>::applies(res[0]))))
+ {
Node mult = RewriteRule<ConcatToMult>::applies(res[0])?
RewriteRule<ConcatToMult>::run<false>(res[0]) :
RewriteRule<ConcatToMult>::run<true>(res[1]);
@@ -743,9 +748,13 @@ TrustNode TheoryBV::ppRewrite(TNode t)
} else {
res = t;
}
- } else if (RewriteRule<SignExtendEqConst>::applies(t)) {
+ }
+ else if (RewriteRule<SignExtendEqConst>::applies(t))
+ {
res = RewriteRule<SignExtendEqConst>::run<false>(t);
- } else if (RewriteRule<ZeroExtendEqConst>::applies(t)) {
+ }
+ else if (RewriteRule<ZeroExtendEqConst>::applies(t))
+ {
res = RewriteRule<ZeroExtendEqConst>::run<false>(t);
}
else if (RewriteRule<NormalizeEqPlusNeg>::applies(t))
@@ -960,20 +969,6 @@ bool TheoryBV::applyAbstraction(const std::vector<Node>& assertions, std::vector
return changed;
}
-void TheoryBV::setProofLog(proof::BitVectorProof* bvp)
-{
- if (options::bitblastMode() == options::BitblastMode::EAGER)
- {
- d_eagerSolver->setProofLog(bvp);
- }
- else
- {
- for( unsigned i=0; i< d_subtheories.size(); i++ ){
- d_subtheories[i]->setProofLog( bvp );
- }
- }
-}
-
void TheoryBV::setConflict(Node conflict)
{
if (options::bvAbstraction())
diff --git a/src/theory/bv/theory_bv.h b/src/theory/bv/theory_bv.h
index c6e9282f4..2f63f1a52 100644
--- a/src/theory/bv/theory_bv.h
+++ b/src/theory/bv/theory_bv.h
@@ -32,12 +32,7 @@
#include "util/hash.h"
#include "util/statistics_registry.h"
-// Forward declarations, needed because the BV theory and the BV Proof classes
-// are cyclically dependent
namespace CVC4 {
-namespace proof {
-class BitVectorProof;
-}
namespace theory {
@@ -123,8 +118,6 @@ class TheoryBV : public Theory {
bool applyAbstraction(const std::vector<Node>& assertions,
std::vector<Node>& new_assertions);
- void setProofLog(proof::BitVectorProof* bvp);
-
private:
class Statistics
{
@@ -197,7 +190,7 @@ class TheoryBV : public Theory {
std::unique_ptr<EagerBitblastSolver> d_eagerSolver;
std::unique_ptr<AbstractionModule> d_abstractionModule;
bool d_calledPreregister;
-
+
//for extended functions
bool d_needsLastCallCheck;
context::CDHashSet<Node, NodeHashFunction> d_extf_range_infer;
@@ -225,7 +218,7 @@ class TheoryBV : public Theory {
* (ite ((_ extract 1 0) x) 1 0)
*/
bool doExtfReductions( std::vector< Node >& terms );
-
+
bool wasPropagatedBySubtheory(TNode literal) const {
return d_propagatedBy.find(literal) != d_propagatedBy.end();
}
@@ -266,7 +259,11 @@ class TheoryBV : public Theory {
void sendConflict();
- void lemma(TNode node) { d_out->lemma(node, RULE_CONFLICT); d_lemmasAdded = true; }
+ void lemma(TNode node)
+ {
+ d_out->lemma(node);
+ d_lemmasAdded = true;
+ }
void checkForLemma(TNode node);
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback