return newId;
}
-void EqualityEngine::addFunctionKind(Kind fun, bool interpreted) {
+void EqualityEngine::addFunctionKind(Kind fun, bool interpreted, bool extOperator) {
d_congruenceKinds |= fun;
- if (interpreted && fun != kind::EQUAL) {
- Debug("equality::evaluation") << d_name << "::eq::addFunctionKind(): " << fun << " is interpreted " << std::endl;
- d_congruenceKindsInterpreted |= fun;
+ if (fun != kind::EQUAL) {
+ if (interpreted) {
+ Debug("equality::evaluation") << d_name << "::eq::addFunctionKind(): " << fun << " is interpreted " << std::endl;
+ d_congruenceKindsInterpreted |= fun;
+ }
+ if (extOperator) {
+ Debug("equality::extoperator") << d_name << "::eq::addFunctionKind(): " << fun << " is an external operator kind " << std::endl;
+ d_congruenceKindsExtOperators |= fun;
+ }
}
}
} else if (t.getNumChildren() > 0 && d_congruenceKinds[t.getKind()]) {
TNode tOp = t.getOperator();
// Add the operator
- addTermInternal(tOp, true);
+ addTermInternal(tOp, !isExternalOperatorKind(t.getKind()));
result = getNodeId(tOp);
// Add all the children and Curryfy
bool isInterpreted = isInterpretedFunctionKind(t.getKind());
/** The map of kinds to be treated as interpreted function applications (for evaluation of constants) */
KindMap d_congruenceKindsInterpreted;
+ /** The map of kinds with operators to be considered external (for higher-order) */
+ KindMap d_congruenceKindsExtOperators;
+
/** Objects that need to be notified during equality path reconstruction */
std::map<unsigned, const PathReconstructionNotify*> d_pathReconstructionTriggers;
}
/**
- * Add a kind to treat as function applications.
+ * Add a kind to treat as function applications.
+ * When extOperator is true, this equality engine will treat the operators of this kind
+ * as "external" e.g. not internal nodes (see d_isInternal). This means that we will
+ * consider equivalence classes containing the operators of such terms, and "hasTerm" will
+ * return true.
*/
- void addFunctionKind(Kind fun, bool interpreted = false);
+ void addFunctionKind(Kind fun, bool interpreted = false, bool extOperator = false);
/**
* Returns true if this kind is used for congruence closure.
return d_congruenceKindsInterpreted.tst(fun);
}
+ /**
+ * Returns true if this kind has an operator that is considered external (e.g. not internal).
+ */
+ bool isExternalOperatorKind(Kind fun) const {
+ return d_congruenceKindsExtOperators.tst(fun);
+ }
+
/**
* Check whether the node is already in the database.
*/