theory/bv/bitblast/eager_bitblaster.h
theory/bv/bitblast/lazy_bitblaster.cpp
theory/bv/bitblast/lazy_bitblaster.h
+ theory/bv/bitblast/proof_bitblaster.cpp
+ theory/bv/bitblast/proof_bitblaster.h
theory/bv/bitblast/simple_bitblaster.cpp
theory/bv/bitblast/simple_bitblaster.h
theory/bv/bv_eager_solver.cpp
--- /dev/null
+/********************* */
+/*! \file proof_bitblaster.cpp
+ ** \verbatim
+ ** Top contributors (to current version):
+ ** Aina Niemetz
+ ** This file is part of the CVC4 project.
+ ** Copyright (c) 2009-2021 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 A bit-blaster wrapper around BBSimple for proof logging.
+ **/
+#include "theory/bv/bitblast/proof_bitblaster.h"
+
+#include <unordered_set>
+
+#include "theory/theory_model.h"
+
+namespace CVC4 {
+namespace theory {
+namespace bv {
+
+BBProof::BBProof(TheoryState* state) : d_bb(new BBSimple(state)) {}
+
+void BBProof::bbAtom(TNode node)
+{
+ std::vector<TNode> visit;
+ visit.push_back(node);
+ std::unordered_set<TNode, TNodeHashFunction> visited;
+ while (!visit.empty())
+ {
+ TNode n = visit.back();
+ if (hasBBAtom(n) || hasBBTerm(n))
+ {
+ visit.pop_back();
+ continue;
+ }
+
+ if (visited.find(n) == visited.end())
+ {
+ visited.insert(n);
+ if (!Theory::isLeafOf(n, theory::THEORY_BV))
+ {
+ visit.insert(visit.end(), n.begin(), n.end());
+ }
+ }
+ else
+ {
+ if (Theory::isLeafOf(n, theory::THEORY_BV) && !n.isConst())
+ {
+ // unused for now, will be needed for proof logging
+ Bits bits;
+ d_bb->makeVariable(n, bits);
+ }
+ else if (n.getType().isBitVector())
+ {
+ Bits bits;
+ d_bb->bbTerm(n, bits);
+ }
+ else
+ {
+ d_bb->bbAtom(n);
+ }
+ visit.pop_back();
+ }
+ }
+}
+
+bool BBProof::hasBBAtom(TNode atom) const { return d_bb->hasBBAtom(atom); }
+
+bool BBProof::hasBBTerm(TNode atom) const { return d_bb->hasBBTerm(atom); }
+
+Node BBProof::getStoredBBAtom(TNode node)
+{
+ return d_bb->getStoredBBAtom(node);
+}
+
+bool BBProof::collectModelValues(TheoryModel* m,
+ const std::set<Node>& relevantTerms)
+{
+ return d_bb->collectModelValues(m, relevantTerms);
+}
+
+} // namespace bv
+} // namespace theory
+} // namespace CVC4
--- /dev/null
+/********************* */
+/*! \file proof_bitblaster.h
+ ** \verbatim
+ ** Top contributors (to current version):
+ ** Aina Niemetz
+ ** This file is part of the CVC4 project.
+ ** Copyright (c) 2009-2021 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 A bit-blaster wrapper around BBSimple for proof logging.
+ **/
+#include "cvc4_private.h"
+
+#ifndef CVC4__THEORY__BV__BITBLAST__PROOF_BITBLASTER_H
+#define CVC4__THEORY__BV__BITBLAST__PROOF_BITBLASTER_H
+
+#include "theory/bv/bitblast/simple_bitblaster.h"
+
+namespace CVC4 {
+namespace theory {
+namespace bv {
+
+class BBProof
+{
+ using Bits = std::vector<Node>;
+
+ public:
+ BBProof(TheoryState* state);
+ ~BBProof() = default;
+
+ /** Bit-blast atom 'node'. */
+ void bbAtom(TNode node);
+ /** Check if atom was already bit-blasted. */
+ bool hasBBAtom(TNode atom) const;
+ /** Check if term was already bit-blasted. */
+ bool hasBBTerm(TNode node) const;
+ /** Get bit-blasted node stored for atom. */
+ Node getStoredBBAtom(TNode node);
+ /** Collect model values for all relevant terms given in 'relevantTerms'. */
+ bool collectModelValues(TheoryModel* m, const std::set<Node>& relevantTerms);
+
+ private:
+ std::unique_ptr<BBSimple> d_bb;
+};
+
+} // namespace bv
+} // namespace theory
+} // namespace CVC4
+#endif
#ifndef CVC4__THEORY__BV__BITBLAST_SIMPLE_BITBLASTER_H
#define CVC4__THEORY__BV__BITBLAST_SIMPLE_BITBLASTER_H
-#include "theory/bv/bitblast/lazy_bitblaster.h"
+#include "theory/bv/bitblast/bitblaster.h"
namespace CVC4 {
namespace theory {
TheoryInferenceManager& inferMgr,
ProofNodeManager* pnm)
: BVSolver(*s, inferMgr),
- d_bitblaster(new BBSimple(s)),
+ d_bitblaster(new BBProof(s)),
d_epg(pnm ? new EagerProofGenerator(pnm, s->getUserContext(), "")
: nullptr)
{
#include <unordered_map>
-#include "theory/bv/bitblast/simple_bitblaster.h"
+#include "theory/bv/bitblast/proof_bitblaster.h"
#include "theory/bv/bv_solver.h"
#include "theory/bv/proof_checker.h"
#include "theory/eager_proof_generator.h"
void addBBLemma(TNode fact);
/** Bit-blaster used to bit-blast atoms/terms. */
- std::unique_ptr<BBSimple> d_bitblaster;
+ std::unique_ptr<BBProof> d_bitblaster;
/** Proof generator that manages proofs for lemmas generated by this class. */
std::unique_ptr<EagerProofGenerator> d_epg;