This allows single step proofs to have premises, closed by a SCOPE. This will be useful for array lemmas.
Debug("combineTheories")
<< "TheoryEngine::combineTheories(): requesting a split " << std::endl;
- Node split = equality.orNode(equality.notNode());
TrustNode tsplit;
if (isProofEnabled())
{
// make proof of splitting lemma
- tsplit = d_cmbsPg->mkTrustNode(split, PfRule::SPLIT, {equality});
+ tsplit = d_cmbsPg->mkTrustNodeSplit(equality);
}
else
{
+ Node split = equality.orNode(equality.notNode());
tsplit = TrustNode::mkTrustLemma(split, nullptr);
}
sendLemma(tsplit, carePair.d_theory);
#include "theory/eager_proof_generator.h"
+#include "expr/proof.h"
#include "expr/proof_node_manager.h"
namespace CVC4 {
return TrustNode::mkTrustLemma(n, this);
}
-TrustNode EagerProofGenerator::mkTrustNode(Node n,
+TrustNode EagerProofGenerator::mkTrustNode(Node conc,
PfRule id,
+ const std::vector<Node>& exp,
const std::vector<Node>& args,
bool isConflict)
{
- std::shared_ptr<ProofNode> pf = d_pnm->mkNode(id, {}, args, n);
- return mkTrustNode(n, pf, isConflict);
+ // if no children, its easy
+ if (exp.empty())
+ {
+ std::shared_ptr<ProofNode> pf = d_pnm->mkNode(id, {}, args, conc);
+ return mkTrustNode(conc, pf, isConflict);
+ }
+ // otherwise, we use CDProof + SCOPE
+ CDProof cdp(d_pnm);
+ cdp.addStep(conc, id, exp, args);
+ std::shared_ptr<ProofNode> pf = cdp.getProofFor(conc);
+ // We use mkNode instead of mkScope, since there is no reason to check
+ // whether the free assumptions of pf are in exp, since they are by the
+ // construction above.
+ std::shared_ptr<ProofNode> pfs = d_pnm->mkNode(PfRule::SCOPE, {pf}, exp);
+ return mkTrustNode(pfs->getResult(), pfs, isConflict);
}
TrustNode EagerProofGenerator::mkTrustedPropagation(
{
// make the lemma
Node lem = f.orNode(f.notNode());
- return mkTrustNode(lem, PfRule::SPLIT, {f}, false);
+ return mkTrustNode(lem, PfRule::SPLIT, {}, {f}, false);
}
std::string EagerProofGenerator::identify() const { return d_name; }
std::shared_ptr<ProofNode> pf,
bool isConflict = false);
/**
- * Make trust node from a single step proof (with no premises). This is a
- * convenience function that avoids the need to explictly construct ProofNode
- * by the caller.
+ * Make trust node from a single step proof. This is a convenience function
+ * that avoids the need to explictly construct ProofNode by the caller.
*
- * @param n The proven node,
- * @param id The rule of the proof concluding n
- * @param args The arguments to the proof concluding n,
+ * @param conc The conclusion of the rule,
+ * @param id The rule of the proof concluding conc
+ * @param exp The explanation (premises) to the proof concluding conc,
+ * @param args The arguments to the proof concluding conc,
* @param isConflict Whether the returned trust node is a conflict (otherwise
* it is a lemma),
* @return The trust node corresponding to the fact that this generator has
- * a proof of n.
+ * a proof of (children => exp), or of exp if children is empty.
*/
- TrustNode mkTrustNode(Node n,
+ TrustNode mkTrustNode(Node conc,
PfRule id,
+ const std::vector<Node>& exp,
const std::vector<Node>& args,
bool isConflict = false);
/**
d_proxyVar(s.getUserContext()),
d_proxyVarToLength(s.getUserContext()),
d_lengthLemmaTermsCache(s.getUserContext()),
- d_epg(nullptr)
+ d_epg(pnm ? new EagerProofGenerator(
+ pnm,
+ s.getUserContext(),
+ "strings::TermRegistry::EagerProofGenerator")
+ : nullptr)
{
NodeManager* nm = NodeManager::currentNM();
d_zero = nm->mkConst(Rational(0));
if (d_epg != nullptr)
{
regTermLem = d_epg->mkTrustNode(
- eagerRedLemma, PfRule::STRING_EAGER_REDUCTION, {n});
+ eagerRedLemma, PfRule::STRING_EAGER_REDUCTION, {}, {n});
}
else
{
// it is a simple rewrite to justify this
if (d_epg != nullptr)
{
- return d_epg->mkTrustNode(ret, PfRule::MACRO_SR_PRED_INTRO, {ret});
+ return d_epg->mkTrustNode(ret, PfRule::MACRO_SR_PRED_INTRO, {}, {ret});
}
return TrustNode::mkTrustLemma(ret, nullptr);
}
if (d_epg != nullptr)
{
- return d_epg->mkTrustNode(lenLemma, PfRule::STRING_LENGTH_POS, {n});
+ return d_epg->mkTrustNode(lenLemma, PfRule::STRING_LENGTH_POS, {}, {n});
}
return TrustNode::mkTrustLemma(lenLemma, nullptr);
}