sortedVarNames.begin(), iend = sortedVarNames.end();
i != iend;
++i) {
- terms.push_back(PARSER_STATE->mkVar((*i).first, (*i).second));
+ terms.push_back(PARSER_STATE->mkBoundVar((*i).first, (*i).second));
}
}
term[expr, expr2]
sortedVarNames.begin(), iend = sortedVarNames.end();
i != iend;
++i) {
- terms.push_back(PARSER_STATE->mkVar((*i).first, (*i).second));
+ terms.push_back(PARSER_STATE->mkBoundVar((*i).first, (*i).second));
}
}
term[e,e2]
tryToStream<DeclarationSequence>(out, c) ||
tryToStream<CommandSequence>(out, c) ||
tryToStream<DeclareFunctionCommand>(out, c) ||
- tryToStream<DefineFunctionCommand>(out, c) ||
tryToStream<DeclareTypeCommand>(out, c) ||
tryToStream<DefineTypeCommand>(out, c) ||
tryToStream<DefineNamedFunctionCommand>(out, c) ||
+ tryToStream<DefineFunctionCommand>(out, c) ||
tryToStream<SimplifyCommand>(out, c) ||
tryToStream<GetValueCommand>(out, c) ||
tryToStream<GetModelCommand>(out, c) ||
tryToStream<DeclarationSequence>(out, c) ||
tryToStream<CommandSequence>(out, c) ||
tryToStream<DeclareFunctionCommand>(out, c) ||
- tryToStream<DefineFunctionCommand>(out, c) ||
tryToStream<DeclareTypeCommand>(out, c) ||
tryToStream<DefineTypeCommand>(out, c) ||
tryToStream<DefineNamedFunctionCommand>(out, c) ||
+ tryToStream<DefineFunctionCommand>(out, c) ||
tryToStream<SimplifyCommand>(out, c) ||
tryToStream<GetValueCommand>(out, c) ||
tryToStream<GetModelCommand>(out, c) ||
tryToStream<QuitCommand>(out, c) ||
tryToStream<CommandSequence>(out, c) ||
tryToStream<DeclareFunctionCommand>(out, c) ||
- tryToStream<DefineFunctionCommand>(out, c) ||
tryToStream<DeclareTypeCommand>(out, c) ||
tryToStream<DefineTypeCommand>(out, c) ||
tryToStream<DefineNamedFunctionCommand>(out, c) ||
+ tryToStream<DefineFunctionCommand>(out, c) ||
tryToStream<SimplifyCommand>(out, c) ||
tryToStream<GetValueCommand>(out, c) ||
tryToStream<GetModelCommand>(out, c) ||
const std::vector<Expr>& formals,
Expr formula) {
Trace("smt") << "SMT defineFunction(" << func << ")" << endl;
+ for(std::vector<Expr>::const_iterator i = formals.begin(); i != formals.end(); ++i) {
+ if((*i).getKind() != kind::BOUND_VARIABLE) {
+ stringstream ss;
+ ss << "All formal arguments to defined functions must be BOUND_VARIABLEs, but in the\n"
+ << "definition of function " << func << ", formal\n"
+ << " " << *i << "\n"
+ << "has kind " << (*i).getKind();
+ throw TypeCheckingException(func, ss.str());
+ }
+ }
if(Dump.isOn("declarations")) {
stringstream ss;
ss << Expr::setlanguage(Expr::setlanguage::getLanguage(Dump.getStream()))
if(i != d_smt.d_definedFunctions->end()) {
// replacement must be closed
if((*i).second.getFormals().size() > 0) {
- //throw TypeCheckingException(n.toExpr(), string("Defined function requires arguments: `") + n.toString() + "'");
+ return d_smt.d_nodeManager->mkNode(kind::LAMBDA, d_smt.d_nodeManager->mkNode(kind::BOUND_VAR_LIST, (*i).second.getFormals()), (*i).second.getFormula());
}
// don't bother putting in the cache
return (*i).second.getFormula();
TypeNode bvType = d_nm->mkBitVectorType(32);
TypeNode subrangeType = d_nm->mkSubrangeType(SubrangeBounds(Integer(1), Integer(10)));
- Node x = d_nm->mkVar("x", realType);
+ Node x = d_nm->mkBoundVar("x", realType);
Node xPos = d_nm->mkNode(GT, x, d_nm->mkConst(Rational(0)));
TypeNode funtype = d_nm->mkFunctionType(integerType, booleanType);
Node lambda = d_nm->mkVar("lambda", funtype);