void EagerProofGenerator::setProofFor(Node f, std::shared_ptr<ProofNode> pf)
{
// pf should prove f
- Assert(pf->getResult() == f);
+ Assert(pf->getResult() == f)
+ << "EagerProofGenerator::setProofFor: unexpected result" << std::endl
+ << "Expected: " << f << std::endl
+ << "Actual: " << pf->getResult() << std::endl;
d_proofs[f] = pf;
}
void EagerProofGenerator::setProofForConflict(Node conf,
}
}
-Rewriter::Rewriter()
+Rewriter::Rewriter() : d_tpg(nullptr)
{
for (size_t i = 0; i < kind::LAST_KIND; ++i)
{
d_satContext(satContext),
d_userContext(userContext),
d_logicInfo(logicInfo),
- d_pnm(pnm),
d_facts(satContext),
d_factsHead(satContext, 0),
d_sharedTermsIndex(satContext, 0),
d_equalityEngine(nullptr),
d_allocEqualityEngine(nullptr),
d_theoryState(nullptr),
- d_inferManager(nullptr)
+ d_inferManager(nullptr),
+ d_pnm(pnm)
{
smtStatisticsRegistry()->registerStat(&d_checkTime);
smtStatisticsRegistry()->registerStat(&d_computeCareGraphTime);
if (in[0].isVar() && isLegalElimination(in[0], in[1])
&& in[0].getKind() != kind::BOOLEAN_TERM_VARIABLE)
{
- outSubstitutions.addSubstitution(in[0], in[1]);
+ outSubstitutions.addSubstitutionSolved(in[0], in[1], tin);
return PP_ASSERT_STATUS_SOLVED;
}
if (in[1].isVar() && isLegalElimination(in[1], in[0])
&& in[1].getKind() != kind::BOOLEAN_TERM_VARIABLE)
{
- outSubstitutions.addSubstitution(in[1], in[0]);
+ outSubstitutions.addSubstitutionSolved(in[1], in[0], tin);
return PP_ASSERT_STATUS_SOLVED;
}
if (in[0].isConst() && in[1].isConst())
/** Information about the logic we're operating within. */
const LogicInfo& d_logicInfo;
- /** Pointer to proof node manager */
- ProofNodeManager* d_pnm;
-
/**
* The assertFact() queue.
*
*/
TheoryInferenceManager* d_inferManager;
+ /** Pointer to proof node manager */
+ ProofNodeManager* d_pnm;
+
/**
* Returns the next assertion in the assertFact() queue.
*
{
if (isProofEnabled())
{
- // enable proofs in the term formula remover
- d_tfr.setProofNodeManager(pnm);
// push the proof context, since proof steps may be cleared on calls to
// clearCache() below.
d_pfContext.push();
{
}
+bool TheoryProofStepBuffer::applyEqIntro(Node src,
+ Node tgt,
+ const std::vector<Node>& exp,
+ MethodId ids,
+ MethodId idr)
+{
+ std::vector<Node> args;
+ args.push_back(src);
+ builtin::BuiltinProofRuleChecker::addMethodIds(args, ids, idr);
+ Node res = tryStep(PfRule::MACRO_SR_EQ_INTRO, exp, args);
+ if (res.isNull())
+ {
+ // failed to apply
+ return false;
+ }
+ // should have concluded the expected equality
+ Node expected = src.eqNode(tgt);
+ if (res != expected)
+ {
+ // did not provide the correct target
+ popStep();
+ return false;
+ }
+ // successfully proved src == tgt.
+ return true;
+}
+
bool TheoryProofStepBuffer::applyPredTransform(Node src,
Node tgt,
const std::vector<Node>& exp,
TheoryProofStepBuffer(ProofChecker* pc = nullptr);
~TheoryProofStepBuffer() {}
//---------------------------- utilities builtin proof rules
+ /**
+ * Apply equality introduction. If this method returns true, it adds proof
+ * step(s) to the buffer that conclude (= src tgt) from premises exp. In
+ * particular, it may attempt to apply the rule MACRO_SR_EQ_INTRO. This
+ * method should be applied when tgt is equivalent to src assuming exp.
+ */
+ bool applyEqIntro(Node src,
+ Node tgt,
+ const std::vector<Node>& exp,
+ MethodId ids = MethodId::SB_DEFAULT,
+ MethodId idr = MethodId::RW_REWRITE);
/**
* Apply predicate transform. If this method returns true, it adds (at most
* one) proof step to the buffer that conclude tgt from premises src, exp. In
void safePoint(ResourceManager::Resource r) override {}
void conflict(TNode n) override { push(CONFLICT, n); }
+ void trustedConflict(TrustNode n) override { push(CONFLICT, n.getNode()); }
+
bool propagate(TNode n) override {
push(PROPAGATE, n);
return true;
return LemmaStatus(Node::null(), 0);
}
+ LemmaStatus trustedLemma(TrustNode n, LemmaProperty p) override
+ {
+ push(LEMMA, n.getNode());
+ return LemmaStatus(Node::null(), 0);
+ }
+
void requirePhase(TNode, bool) override {}
void setIncomplete() override {}
void handleUserAttribute(const char* attr, theory::Theory* t) override {}
std::ostream& operator<<(std::ostream& out, TrustNode n)
{
- out << "(" << n.getKind() << " " << n.getProven() << ")";
+ out << "(" << n.getKind() << " " << n.getProven() << " "
+ << n.identifyGenerator() << ")";
return out;
}