while (ret.getKind() == DT_SYGUS_EVAL
&& ret[0].getKind() == APPLY_CONSTRUCTOR)
{
+ if (ret == n && ret[0].isConst())
+ {
+ Trace("dt-eval-unfold-debug")
+ << "Optimize: evaluate constant head " << ret << std::endl;
+ // can just do direct evaluation here
+ std::vector<Node> args;
+ bool success = true;
+ for (unsigned i = 1, nchild = ret.getNumChildren(); i < nchild; i++)
+ {
+ if (!ret[i].isConst())
+ {
+ success = false;
+ break;
+ }
+ args.push_back(ret[i]);
+ }
+ if (success)
+ {
+ TypeNode rt = ret[0].getType();
+ Node bret = sygusToBuiltin(ret[0], rt);
+ Node rete = evaluateBuiltin(rt, bret, args);
+ visited[n] = rete;
+ Trace("dt-eval-unfold-debug")
+ << "Return " << rete << " for " << n << std::endl;
+ return rete;
+ }
+ }
ret = unfold( ret );
}
if( ret.getNumChildren()>0 ){