Node TermCanonize::getCanonicalTerm(TNode n,
bool apply_torder,
+ bool doHoVar,
std::map<TypeNode, unsigned>& var_count,
std::map<TNode, Node>& visited)
{
Trace("canon-term-debug") << "Make canonical children" << std::endl;
for (unsigned i = 0, size = cchildren.size(); i < size; i++)
{
- cchildren[i] =
- getCanonicalTerm(cchildren[i], apply_torder, var_count, visited);
+ cchildren[i] = getCanonicalTerm(
+ cchildren[i], apply_torder, doHoVar, var_count, visited);
}
if (n.getMetaKind() == metakind::PARAMETERIZED)
{
Node op = n.getOperator();
- op = getCanonicalTerm(op, apply_torder, var_count, visited);
+ if (doHoVar)
+ {
+ op = getCanonicalTerm(op, apply_torder, doHoVar, var_count, visited);
+ }
Trace("canon-term-debug") << "Insert operator " << op << std::endl;
cchildren.insert(cchildren.begin(), op);
}
return n;
}
-Node TermCanonize::getCanonicalTerm(TNode n, bool apply_torder)
+Node TermCanonize::getCanonicalTerm(TNode n, bool apply_torder, bool doHoVar)
{
std::map<TypeNode, unsigned> var_count;
std::map<TNode, Node> visited;
- return getCanonicalTerm(n, apply_torder, var_count, visited);
+ return getCanonicalTerm(n, apply_torder, doHoVar, var_count, visited);
}
} // namespace quantifiers
*
* This returns a canonical (alpha-equivalent) version of n, where
* bound variables in n may be replaced by other ones, and arguments of
- * commutative operators of n may be sorted (if apply_torder is true).
+ * commutative operators of n may be sorted (if apply_torder is true). If
+ * doHoVar is true, we also canonicalize bound variables that occur in
+ * operators.
+ *
* In detail, we replace bound variables in n so the the leftmost occurrence
* of a bound variable for type T is the first canonical free variable for T,
* the second leftmost is the second, and so on, for each type T.
*/
- Node getCanonicalTerm(TNode n, bool apply_torder = false);
+ Node getCanonicalTerm(TNode n,
+ bool apply_torder = false,
+ bool doHoVar = true);
private:
/** the number of ids we have allocated for operators */
*/
Node getCanonicalTerm(TNode n,
bool apply_torder,
+ bool doHoVar,
std::map<TypeNode, unsigned>& var_count,
std::map<TNode, Node>& visited);
};