summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>2019-04-29 16:40:31 -0500
committerGitHub <noreply@github.com>2019-04-29 16:40:31 -0500
commitb351cce04bc13e00b4b63f1bba403b5d549d56bf (patch)
tree43b7a293cda47de9519374549350e9ff8a652fbb
parent78ae0a579b91af102b48f7ac1db60afc09ccf727 (diff)
Optimization for evaluation with unfolding (#2979)
-rw-r--r--src/theory/quantifiers/sygus/term_database_sygus.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/theory/quantifiers/sygus/term_database_sygus.cpp b/src/theory/quantifiers/sygus/term_database_sygus.cpp
index b1e6dc96d..af820b0fc 100644
--- a/src/theory/quantifiers/sygus/term_database_sygus.cpp
+++ b/src/theory/quantifiers/sygus/term_database_sygus.cpp
@@ -1633,6 +1633,33 @@ Node TermDbSygus::evaluateWithUnfolding(
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 ){
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback