definition-expansion fixed for get-model, resolves bug 411
authorMorgan Deters <mdeters@gmail.com>
Sat, 1 Dec 2012 00:31:38 +0000 (00:31 +0000)
committerMorgan Deters <mdeters@gmail.com>
Sat, 1 Dec 2012 00:31:38 +0000 (00:31 +0000)
src/smt/smt_engine.cpp

index 0f755aa01670be29e5a9da0665ea7aaee48ef9d7..fb8b787594db737378f16983b3723cd6b770c0fd 100644 (file)
@@ -1219,6 +1219,15 @@ Node SmtEnginePrivate::expandDefinitions(TNode n, hash_map<Node, Node, NodeHashF
   Kind k = n.getKind();
 
   if(k != kind::APPLY && n.getNumChildren() == 0) {
+    SmtEngine::DefinedFunctionMap::const_iterator i = d_smt.d_definedFunctions->find(n);
+    if(i != d_smt.d_definedFunctions->end()) {
+      // replacement must be closed
+      if((*i).second.getFormals().size() > 0) {
+        throw TypeCheckingException(n.toExpr(), std::string("Defined function requires arguments: `") + n.toString() + "'");
+      }
+      // don't bother putting in the cache
+      return (*i).second.getFormula();
+    }
     // don't bother putting in the cache
     return n;
   }