* `args` and the corresponding values `vals`. The function returns a null
* node if there is a subterm that is not constant under the substitution or
* if an operator is not supported by the evaluator.
+ *
+ * The nodes in the vals must be constant values, that is, they must return
+ * true for isConst().
*/
Node eval(TNode n,
const std::vector<Node>& args,
for (const Node& res : base_results)
{
TNode tres = res;
- std::vector<Node> vals;
- vals.push_back(tres);
Node sres;
- if (tryEval)
+ // It may not be constant, e.g. if we involve a partial operator
+ // like datatype selectors. In this case, we avoid using the evaluator,
+ // which expects a constant substitution.
+ if (tres.isConst())
{
- sres = ev->eval(templ, args, vals);
+ std::vector<Node> vals;
+ vals.push_back(tres);
+ if (tryEval)
+ {
+ sres = ev->eval(templ, args, vals);
+ }
}
if (sres.isNull())
{
void SygusUnifStrategy::initializeType(TypeNode tn)
{
+ Trace("sygus-unif") << "SygusUnifStrategy: initialize : " << tn << " for "
+ << d_candidate << std::endl;
d_tinfo[tn].d_this_type = tn;
}
EnumTypeInfo& SygusUnifStrategy::getEnumTypeInfo(TypeNode tn)
{
+ Trace("sygus-unif") << "SygusUnifStrategy: get : " << tn << " for "
+ << d_candidate << std::endl;
std::map<TypeNode, EnumTypeInfo>::iterator it = d_tinfo.find(tn);
Assert(it != d_tinfo.end());
return it->second;
EnumRole erole_c = getEnumeratorRoleForNodeRole(nrole_c);
// make the enumerator
Node et;
+ // Build the strategy recursively, regardless of whether the
+ // enumerator is templated.
+ buildStrategyGraph(ct, nrole_c);
if (cop_to_child_templ[cop].find(j) != cop_to_child_templ[cop].end())
{
// it is templated, allocate a fresh variable
<< "...child type enumerate "
<< ((DatatypeType)ct.toType()).getDatatype().getName()
<< ", node role = " << nrole_c << std::endl;
- buildStrategyGraph(ct, nrole_c);
// otherwise use the previous
Assert(d_tinfo[ct].d_enum.find(erole_c)
!= d_tinfo[ct].d_enum.end());