ProofGenerator* defGen,
bool defRec,
const std::string& name)
- : d_manager(pnm),
+ : CDProof(pnm, c, name, false),
+ d_manager(pnm),
d_cyclic(cyclic),
d_defRec(defRec),
d_context(),
Trace("lazy-cdproofchain")
<< "LazyCDProofChain::getProofFor: check " << cur << "\n";
Assert(toConnect.find(cur) == toConnect.end());
+ // The current fact may be justified by concrete steps added to this
+ // proof, in which case we do not use the generators.
bool rec = true;
- ProofGenerator* pg = getGeneratorForInternal(cur, rec);
- if (!pg)
- {
- Trace("lazy-cdproofchain")
- << "LazyCDProofChain::getProofFor: nothing to do\n";
- // nothing to do for this fact, it'll be a leaf in the final proof
- // node, don't post-traverse.
- visited[cur] = true;
- continue;
- }
- Trace("lazy-cdproofchain")
- << "LazyCDProofChain::getProofFor: Call generator " << pg->identify()
- << " for chain link " << cur << "\n";
- std::shared_ptr<ProofNode> curPfn = pg->getProofFor(cur);
+ std::shared_ptr<ProofNode> curPfn = getProofForInternal(cur, rec);
if (curPfn == nullptr)
{
Trace("lazy-cdproofchain")
visited[cur] = true;
continue;
}
- // map node whose proof node must be expanded to the respective poof node
+ // map node whose proof node must be expanded to the respective poof
+ // node
toConnect[cur] = curPfn;
// We may not want to recursively connect this proof so we skip.
if (!rec)
return nullptr;
}
+std::shared_ptr<ProofNode> LazyCDProofChain::getProofForInternal(Node fact,
+ bool& rec)
+{
+ std::shared_ptr<ProofNode> pfn = CDProof::getProofFor(fact);
+ Assert(pfn != nullptr);
+ // If concrete proof, save it, otherwise try generators.
+ if (pfn->getRule() != PfRule::ASSUME)
+ {
+ return pfn;
+ }
+ ProofGenerator* pg = getGeneratorForInternal(fact, rec);
+ if (!pg)
+ {
+ return nullptr;
+ }
+ Trace("lazy-cdproofchain")
+ << "LazyCDProofChain::getProofFor: Call generator " << pg->identify()
+ << " for chain link " << fact << "\n";
+ return pg->getProofFor(fact);
+}
+
std::string LazyCDProofChain::identify() const { return d_name; }
} // namespace cvc5
#include <vector>
-#include "context/cdhashmap.h"
-#include "proof/proof_generator.h"
+#include "proof/proof.h"
namespace cvc5 {
* connecting, for the proof generated to one fact, assumptions to the proofs
* generated for those assumptinos that are registered in the chain.
*/
-class LazyCDProofChain : public ProofGenerator
+class LazyCDProofChain : public CDProof
{
public:
/** Constructor
* it is required to do so. This mapping is maintained in the remainder of
* the current context (according to the context c provided to this class).
*
+ * It is important to note that pg is asked to provide a proof for expected
+ * only when no other call for the fact expected is provided via the addStep
+ * method of this class. In particular, pg is asked to prove expected when it
+ * appears as the conclusion of an ASSUME leaf within CDProof::getProofFor.
+ *
* Moreover the lazy steps of this class are expected to fulfill the
* requirement that pg.getProofFor(expected) generates a proof node closed
* with relation to
* true if we should recurse on its proof.
*/
ProofGenerator* getGeneratorForInternal(Node fact, bool& rec);
+ /**
+ * Get internal proof for fact from the underlying CDProof, if any, otherwise
+ * via a call to the above method.
+ *
+ * Returns a nullptr when no internal proof stored.
+ */
+ std::shared_ptr<ProofNode> getProofForInternal(Node fact, bool& rec);
+
/** The proof manager, used for allocating new ProofNode objects */
ProofNodeManager* d_manager;
/** Whether this instance is robust to cycles in the chain. */