case TrustNodeKind::CONFLICT: return "CONFLICT";
case TrustNodeKind::LEMMA: return "LEMMA";
case TrustNodeKind::PROP_EXP: return "PROP_EXP";
+ case TrustNodeKind::REWRITE: return "REWRITE";
default: return "?";
}
}
return TrustNode(TrustNodeKind::PROP_EXP, pekey, g);
}
+TrustNode TrustNode::mkTrustRewrite(TNode n, Node nr, ProofGenerator* g)
+{
+ Node rkey = getRewriteProven(n, nr);
+ Assert(g == nullptr || g->hasProofFor(rkey));
+ return TrustNode(TrustNodeKind::REWRITE, rkey, g);
+}
+
TrustNode TrustNode::null()
{
return TrustNode(TrustNodeKind::INVALID, Node::null());
Node TrustNode::getNode() const
{
- return d_tnk == TrustNodeKind::LEMMA ? d_proven : d_proven[0];
+ switch (d_tnk)
+ {
+ // the node of lemma is the node itself
+ case TrustNodeKind::LEMMA: return d_proven;
+ // the node of the rewrite is the right hand side of EQUAL
+ case TrustNodeKind::REWRITE: return d_proven[1];
+ // the node of an explained propagation is the antecendant of an IMPLIES
+ // the node of a conflict is underneath a NOT
+ default: return d_proven[0];
+ }
}
Node TrustNode::getProven() const { return d_proven; }
return NodeManager::currentNM()->mkNode(kind::IMPLIES, exp, lit);
}
+Node TrustNode::getRewriteProven(TNode n, Node nr) { return n.eqNode(nr); }
+
std::ostream& operator<<(std::ostream& out, TrustNode n)
{
out << "(trust " << n.getNode() << ")";
CONFLICT,
LEMMA,
PROP_EXP,
+ REWRITE,
INVALID
};
/**
static TrustNode mkTrustPropExp(TNode lit,
Node exp,
ProofGenerator* g = nullptr);
+ /** Make a proven node for rewrite */
+ static TrustNode mkTrustRewrite(TNode n,
+ Node nr,
+ ProofGenerator* g = nullptr);
/** The null proven node */
static TrustNode null();
~TrustNode() {}
*
* This is the node that is used in a common interface, either:
* (1) A T-unsat conjunction conf to pass to OutputChannel::conflict,
- * (2) A valid T-formula lem to pass to OutputChannel::lemma, or
- * (3) A conjunction of literals exp to return in Theory::explain(lit).
+ * (2) A valid T-formula lem to pass to OutputChannel::lemma,
+ * (3) A conjunction of literals exp to return in Theory::explain(lit), or
+ * (4) A result of rewriting a term n into an equivalent one nr.
*
* Notice that this node does not necessarily correspond to a valid formula.
* The call getProven() below retrieves a valid formula corresponding to
* for the above cases:
* (1) (not conf), for conflicts,
* (2) lem, for lemmas,
- * (3) (=> exp lit), for propagations from explanations.
+ * (3) (=> exp lit), for propagations from explanations,
+ * (4) (= n nr), for results of rewriting.
*
* When constructing this trust node, the proof generator should be able to
* provide a proof for this fact.
static Node getConflictProven(Node conf);
/** Get the proven formula corresponding to a lemma call */
static Node getLemmaProven(Node lem);
- /** Get the proven formula corresponding to explanations for propagation*/
+ /** Get the proven formula corresponding to explanations for propagation */
static Node getPropExpProven(TNode lit, Node exp);
+ /** Get the proven formula corresponding to a rewrite */
+ static Node getRewriteProven(TNode n, Node nr);
private:
TrustNode(TrustNodeKind tnk, Node p, ProofGenerator* g = nullptr);