This commit changes BV proof logging to record coarse-grained bit-blast steps during solving and expanding these steps on-demand in the proof post processor.
d_pfpp->setEliminateRule(PfRule::THEORY_REWRITE);
}
}
+ d_pfpp->setEliminateRule(PfRule::BV_BITBLAST);
}
d_false = NodeManager::currentNM()->mkConst(false);
}
#include "smt/smt_engine.h"
#include "smt/smt_statistics_registry.h"
#include "theory/builtin/proof_checker.h"
+#include "theory/bv/bitblast/proof_bitblaster.h"
#include "theory/rewriter.h"
#include "theory/theory.h"
#include "util/rational.h"
<< std::endl;
return sumBounds;
}
+ else if (id == PfRule::BV_BITBLAST)
+ {
+ bv::BBProof bb(nullptr, d_pnm, true);
+ Node eq = args[0];
+ Assert(eq.getKind() == EQUAL);
+ bb.bbAtom(eq[0]);
+ Node bbAtom = bb.getStoredBBAtom(eq[0]);
+ bb.getProofGenerator()->addProofTo(eq[0].eqNode(bbAtom), cdp);
+ return eq;
+ }
// TRUST, PREPROCESS, THEORY_LEMMA, THEORY_PREPROCESS?
#include <unordered_set>
-#include "options/proof_options.h"
#include "proof/conv_proof_generator.h"
#include "theory/theory_model.h"
{kind::BITVECTOR_ROTATE_LEFT, PfRule::BV_BITBLAST_ROTATE_LEFT},
};
-BBProof::BBProof(TheoryState* state,
- ProofNodeManager* pnm,
- TConvProofGenerator* tcpg)
- : d_bb(new BBSimple(state)), d_pnm(pnm), d_tcpg(tcpg)
+BBProof::BBProof(TheoryState* state, ProofNodeManager* pnm, bool fineGrained)
+ : d_bb(new BBSimple(state)),
+ d_pnm(pnm),
+ d_tcpg(pnm ? new TConvProofGenerator(
+ pnm,
+ nullptr,
+ /* ONCE to visit each term only once, post-order. FIXPOINT
+ * could lead to infinite loops due to terms being rewritten
+ * to terms that contain themselves */
+ TConvPolicy::ONCE,
+ /* STATIC to get the same ProofNode for a shared subterm. */
+ TConvCachePolicy::STATIC,
+ "BBProof::TConvProofGenerator",
+ nullptr,
+ false)
+ : nullptr),
+ d_recordFineGrainedProofs(fineGrained)
{
}
visit.push_back(node);
std::unordered_set<TNode> visited;
- bool fproofs =
- options::proofGranularityMode() != options::ProofGranularityMode::OFF;
- bool fpenabled = isProofsEnabled() && fproofs;
+ bool fpenabled = isProofsEnabled() && d_recordFineGrainedProofs;
NodeManager* nm = NodeManager::currentNM();
visit.pop_back();
}
}
- if (isProofsEnabled() && !fproofs)
+ /* Record coarse-grain bit-blast proof step. */
+ if (isProofsEnabled() && !d_recordFineGrainedProofs)
{
Node node_tobv = getStoredBBAtom(node);
d_tcpg->addRewriteStep(node,
return d_bb->collectModelValues(m, relevantTerms);
}
+TConvProofGenerator* BBProof::getProofGenerator() { return d_tcpg.get(); }
+
bool BBProof::isProofsEnabled() const { return d_pnm != nullptr; }
} // namespace bv
using Bits = std::vector<Node>;
public:
- BBProof(TheoryState* state, ProofNodeManager* pnm, TConvProofGenerator* tcpg);
+ BBProof(TheoryState* state, ProofNodeManager* pnm, bool fineGrained);
~BBProof();
/** Bit-blast atom 'node'. */
/** Collect model values for all relevant terms given in 'relevantTerms'. */
bool collectModelValues(TheoryModel* m, const std::set<Node>& relevantTerms);
+ TConvProofGenerator* getProofGenerator();
+
private:
/** Map node kinds to proof rules. */
static std::unordered_map<Kind, PfRule, kind::KindHashFunction>
/** The associated proof node manager. */
ProofNodeManager* d_pnm;
/** The associated term conversion proof generator. */
- TConvProofGenerator* d_tcpg;
+ std::unique_ptr<TConvProofGenerator> d_tcpg;
/** Map bit-vector nodes to bit-blasted nodes. */
std::unordered_map<Node, Node> d_bbMap;
+
+ bool d_recordFineGrainedProofs;
};
} // namespace bv
TheoryInferenceManager& inferMgr,
ProofNodeManager* pnm)
: BVSolver(*s, inferMgr),
- d_tcpg(pnm ? new TConvProofGenerator(
- pnm,
- nullptr,
- /* ONCE to visit each term only once, post-order. FIXPOINT
- * could lead to infinite loops due to terms being rewritten
- * to terms that contain themselves */
- TConvPolicy::ONCE,
- /* STATIC to get the same ProofNode for a shared subterm. */
- TConvCachePolicy::STATIC,
- "BVSolverSimple::TConvProofGenerator",
- nullptr,
- false)
- : nullptr),
- d_bitblaster(new BBProof(s, pnm, d_tcpg.get()))
+ d_pnm(pnm),
+ d_bitblaster(new BBProof(s, pnm, false))
{
}
Node atom_bb = d_bitblaster->getStoredBBAtom(fact);
Node lemma = nm->mkNode(kind::EQUAL, fact, atom_bb);
- if (d_tcpg == nullptr)
+ if (d_pnm == nullptr)
{
d_im.lemma(lemma, InferenceId::BV_SIMPLE_BITBLAST_LEMMA);
}
else
{
- TrustNode tlem = TrustNode::mkTrustLemma(lemma, d_tcpg.get());
+ TrustNode tlem =
+ TrustNode::mkTrustLemma(lemma, d_bitblaster->getProofGenerator());
d_im.trustedLemma(tlem, InferenceId::BV_SIMPLE_BITBLAST_LEMMA);
}
}
NodeManager* nm = NodeManager::currentNM();
Node lemma = nm->mkNode(kind::EQUAL, fact, n);
- if (d_tcpg == nullptr)
+ if (d_pnm == nullptr)
{
d_im.lemma(lemma, InferenceId::BV_SIMPLE_LEMMA);
}
else
{
- TrustNode tlem = TrustNode::mkTrustLemma(lemma, d_tcpg.get());
+ TrustNode tlem =
+ TrustNode::mkTrustLemma(lemma, d_bitblaster->getProofGenerator());
d_im.trustedLemma(tlem, InferenceId::BV_SIMPLE_LEMMA);
}
*/
void addBBLemma(TNode fact);
- /** Proof generator. */
- std::unique_ptr<TConvProofGenerator> d_tcpg;
+ /** Proof node manager. */
+ ProofNodeManager* d_pnm;
/** Bit-blaster used to bit-blast atoms/terms. */
std::unique_ptr<BBProof> d_bitblaster;
/** Proof rule checker */
{
if (id == PfRule::BV_BITBLAST)
{
- BBSimple bb(nullptr);
Assert(children.empty());
Assert(args.size() == 1);
- bb.bbAtom(args[0]);
- Node n = bb.getStoredBBAtom(args[0]);
- return args[0].eqNode(n);
+ Assert(args[0].getKind() == kind::EQUAL);
+ return args[0];
}
else if (id == PfRule::BV_BITBLAST_CONST || id == PfRule::BV_BITBLAST_VAR
|| id == PfRule::BV_BITBLAST_EQUAL || id == PfRule::BV_BITBLAST_ULT