/**
* Create a new, fresh variable for use in a binder expression
- * (the BOUND_VAR_LIST of a FORALL, EXISTS, or LAMBDA). It is
+ * (the BOUND_VAR_LIST of a FORALL, EXISTS, LAMBDA, or CHOICE). It is
* an error for this bound variable to exist outside of a binder,
* and it should also only be used in a single binder expression.
* That is, two distinct FORALL expressions should use entirely
/**
* Create a (nameless) new, fresh variable for use in a binder
- * expression (the BOUND_VAR_LIST of a FORALL, EXISTS, or LAMBDA).
+ * expression (the BOUND_VAR_LIST of a FORALL, EXISTS, LAMBDA, or CHOICE).
* It is an error for this bound variable to exist outside of a
* binder, and it should also only be used in a single binder
* expression. That is, two distinct FORALL expressions should use
return getMetaKind() == kind::metakind::NULLARY_OPERATOR;
}
+ /**
+ * Returns true if this node represents a closure, that is an expression
+ * that binds variables.
+ */
inline bool isClosure() const {
assertTNodeNotExpired();
return getKind() == kind::LAMBDA || getKind() == kind::FORALL
continue;
}
Kind k = cur.getKind();
- bool isQuant = k == kind::FORALL || k == kind::EXISTS || k == kind::LAMBDA
- || k == kind::CHOICE;
+ bool isQuant = cur.isClosure();
std::unordered_map<TNode, bool, TNodeHashFunction>::iterator itv =
visited.find(cur);
if (itv == visited.end())
Trace("srs-input-debug") << "...preprocess " << cur << std::endl;
visited[cur] = false;
Kind k = cur.getKind();
- bool isQuant = k == FORALL || k == EXISTS || k == LAMBDA || k == CHOICE;
+ bool isQuant = cur.isClosure();
// we recurse on this node if it is not a quantified formula
if (!isQuant)
{
bool DagificationVisitor::alreadyVisited(TNode current, TNode parent) {
Kind ck = current.getKind();
- if (ck == kind::FORALL || ck == kind::EXISTS || ck == kind::LAMBDA
- || ck == kind::CHOICE)
+ if (current.isClosure())
{
// for quantifiers, we visit them but we don't recurse on them
visit(current, parent);
return skolem;
}
- if (node.getKind() == kind::FORALL || node.getKind() == kind::EXISTS
- || node.getKind() == kind::LAMBDA
- || node.getKind() == kind::CHOICE)
+ if (node.isClosure())
{
// Remember if we're inside a quantifier
inQuant = true;
return cached.isNull() ? Node(node) : cached;
}
- if (node.getKind() == kind::FORALL || node.getKind() == kind::EXISTS
- || node.getKind() == kind::LAMBDA
- || node.getKind() == kind::CHOICE)
+ if (node.isClosure())
{
// Remember if we're inside a quantifier
inQuant = true;
d_iclosure_processed.insert(n);
rec = true;
}
- if (rec && n.getKind() != FORALL)
+ if (rec && !n.isClosure())
{
for (const Node& nc : n)
{
continue;
}
- if (!d_substituteUnderQuantifiers &&
- (current.getKind() == kind::FORALL || current.getKind() == kind::EXISTS)) {
+ if (!d_substituteUnderQuantifiers && current.isClosure())
+ {
Debug("substitution::internal") << "--not substituting under quantifier" << endl;
cache[current] = current;
toVisit.pop_back();
Debug("register::internal") << "PreRegisterVisitor::alreadyVisited(" << current << "," << parent << ")" << std::endl;
- if ((parent.getKind() == kind::FORALL || parent.getKind() == kind::EXISTS
- || parent.getKind() == kind::LAMBDA
- || parent.getKind() == kind::CHOICE
- || parent.getKind() == kind::REWRITE_RULE
+ if ((parent.isClosure() || parent.getKind() == kind::REWRITE_RULE
|| parent.getKind() == kind::SEP_STAR
|| parent.getKind() == kind::SEP_WAND
|| (parent.getKind() == kind::SEP_LABEL && current.getType().isBoolean())
Debug("register::internal") << "SharedTermsVisitor::alreadyVisited(" << current << "," << parent << ")" << std::endl;
- if ((parent.getKind() == kind::FORALL || parent.getKind() == kind::EXISTS
- || parent.getKind() == kind::LAMBDA
- || parent.getKind() == kind::CHOICE
- || parent.getKind() == kind::REWRITE_RULE
+ if ((parent.isClosure() || parent.getKind() == kind::REWRITE_RULE
|| parent.getKind() == kind::SEP_STAR
|| parent.getKind() == kind::SEP_WAND
|| (parent.getKind() == kind::SEP_LABEL && current.getType().isBoolean())
Node newTerm;
// do not rewrite inside quantifiers
- if (term.getKind() == kind::FORALL || term.getKind() == kind::EXISTS
- || term.getKind() == kind::CHOICE
- || term.getKind() == kind::LAMBDA)
+ if (term.isClosure())
{
newTerm = Rewriter::rewrite(term);
}
TheoryModel* tm,
NodeSet& cache)
{
- if (n.getKind() == FORALL || n.getKind() == EXISTS)
+ if (n.isClosure())
{
return;
}
while(!workList.empty()) {
n = workList.back();
- if(n.getKind() == kind::FORALL || n.getKind() == kind::EXISTS) {
+ if (n.isClosure())
+ {
// unsafe to go under quantifiers; we might pull bound vars out of scope!
processed.insert(n);
workList.pop_back();