++i) {
terms.push_back(PARSER_STATE->mkBoundVar((*i).first, (*i).second));
}
- Expr bvl = MK_EXPR(kind::BOUND_VAR_LIST, terms);
+ Expr bvl;
+ if( !terms.empty() ){
+ bvl = MK_EXPR(kind::BOUND_VAR_LIST, terms);
+ }
terms.clear();
terms.push_back(bvl);
}
PARSER_STATE->checkDeclaration(name, CHECK_UNDECLARED, SYM_VARIABLE);
std::vector<Type> evalType;
evalType.push_back(dtt);
- for(size_t j = 0; j < terms[0].getNumChildren(); ++j) {
- evalType.push_back(terms[0][j].getType());
+ if( !terms[0].isNull() ){
+ for(size_t j = 0; j < terms[0].getNumChildren(); ++j) {
+ evalType.push_back(terms[0][j].getType());
+ }
}
evalType.push_back(sorts[i]);
Expr eval = PARSER_STATE->mkVar(name, EXPR_MANAGER->mkFunctionType(evalType));
ss << fun << "_v_" << j;
sygusVars.push_back(getExprManager()->mkBoundVar(ss.str(), argTypes[j]));
}
- Type funt = getExprManager()->mkFunctionType(funType, rangeType);
- Debug("parser-sygus") << "...eval function type : " << funt << std::endl;
+ Type funt;
+ if( !funType.empty() ){
+ funt = getExprManager()->mkFunctionType(funType, rangeType);
+ Debug("parser-sygus") << "...eval function type : " << funt << std::endl;
+
+ // copy the bound vars
+ /*
+ std::vector<Expr> sygusVars;
+ //std::vector<Type> types;
+ for(size_t i = 0; i < d_sygusVars.size(); ++i) {
+ std::stringstream ss;
+ ss << d_sygusVars[i];
+ Type type = d_sygusVars[i].getType();
+ sygusVars.push_back(getExprManager()->mkBoundVar(ss.str(), type));
+ //types.push_back(type);
+ }
+ Debug("parser-sygus") << "...made vars, #vars=" << sygusVars.size() << std::endl;
+ */
- // copy the bound vars
- /*
- std::vector<Expr> sygusVars;
- //std::vector<Type> types;
- for(size_t i = 0; i < d_sygusVars.size(); ++i) {
- std::stringstream ss;
- ss << d_sygusVars[i];
- Type type = d_sygusVars[i].getType();
- sygusVars.push_back(getExprManager()->mkBoundVar(ss.str(), type));
- //types.push_back(type);
+ //Type t = getExprManager()->mkFunctionType(types, rangeType);
+ //Debug("parser-sygus") << "...function type : " << t << std::endl;
+ }else{
+ funt = rangeType;
}
- Debug("parser-sygus") << "...made vars, #vars=" << sygusVars.size() << std::endl;
- */
-
- //Type t = getExprManager()->mkFunctionType(types, rangeType);
- //Debug("parser-sygus") << "...function type : " << t << std::endl;
-
Expr lambda = mkFunction(fun, funt, ExprManager::VAR_FLAG_DEFINED);
Debug("parser-sygus") << "...made function : " << lambda << std::endl;
std::vector<Expr> applyv;
bvs.push_back(bv);
extraArgs.push_back(bv);
}
- bvs.insert(bvs.end(), terms[0].begin(), terms[0].end());
- Expr bvl = getExprManager()->mkExpr(kind::BOUND_VAR_LIST, bvs);
+ if( !terms[0].isNull() ){
+ bvs.insert(bvs.end(), terms[0].begin(), terms[0].end());
+ }
+ Expr bvl;
+ if( !bvs.empty() ){
+ bvl = getExprManager()->mkExpr(kind::BOUND_VAR_LIST, bvs);
+ }
Debug("parser-sygus") << "...made bv list " << bvl << std::endl;
std::vector<Expr> patv;
patv.push_back(eval);
Expr cpatv = getExprManager()->mkExpr(kind::APPLY_CONSTRUCTOR, applyv);
Debug("parser-sygus") << "...made eval ctor apply " << cpatv << std::endl;
patv.push_back(cpatv);
- patv.insert(patv.end(), terms[0].begin(), terms[0].end());
+ if( !terms[0].isNull() ){
+ patv.insert(patv.end(), terms[0].begin(), terms[0].end());
+ }
Expr evalApply = getExprManager()->mkExpr(kind::APPLY_UF, patv);
Debug("parser-sygus") << "...made eval apply " << evalApply << std::endl;
std::vector<Expr> builtApply;
std::vector<Expr> patvb;
patvb.push_back(evals[DatatypeType(extraArgs[k].getType())]);
patvb.push_back(extraArgs[k]);
- patvb.insert(patvb.end(), terms[0].begin(), terms[0].end());
+ if( !terms[0].isNull() ){
+ patvb.insert(patvb.end(), terms[0].begin(), terms[0].end());
+ }
builtApply.push_back(getExprManager()->mkExpr(kind::APPLY_UF, patvb));
}
for(size_t k = 0; k < builtApply.size(); ++k) {
}
Debug("parser-sygus") << "...made built term " << builtTerm << std::endl;
Expr assertion = getExprManager()->mkExpr(evalApply.getType().isBoolean() ? kind::IFF : kind::EQUAL, evalApply, builtTerm);
- Expr pattern = getExprManager()->mkExpr(kind::INST_PATTERN, evalApply);
- pattern = getExprManager()->mkExpr(kind::INST_PATTERN_LIST, pattern);
- assertion = getExprManager()->mkExpr(kind::FORALL, bvl, assertion, pattern);
+ if( !bvl.isNull() ){
+ Expr pattern = getExprManager()->mkExpr(kind::INST_PATTERN, evalApply);
+ pattern = getExprManager()->mkExpr(kind::INST_PATTERN_LIST, pattern);
+ assertion = getExprManager()->mkExpr(kind::FORALL, bvl, assertion, pattern);
+ }
Debug("parser-sygus") << "...made assertion " << assertion << std::endl;
//linearize multiplication if possible