CVC5_API_TRY_CATCH_BEGIN;
CVC5_API_SOLVER_CHECK_CODOMAIN_SORT(sort);
CVC5_API_SOLVER_CHECK_TERM(term);
- CVC5_API_CHECK(term.getSort() == sort)
+ // We are permissive with subtypes so that integers are allowed to define
+ // the body of a function whose codomain is real. This is to accomodate
+ // SMT-LIB inputs in the Reals theory, where NUMERAL can be used to specify
+ // reals. Instead of making our parser for numerals dependent on the logic,
+ // we instead allow integers here in this case.
+ CVC5_API_CHECK(term.d_node->getType().isSubtypeOf(*sort.d_type))
<< "Invalid sort of function body '" << term << "', expected '" << sort
<< "'";
CVC5_API_SOLVER_CHECK_TERM(term);
CVC5_API_SOLVER_CHECK_CODOMAIN_SORT(sort);
- CVC5_API_CHECK(sort == term.getSort())
+ // we are permissive with subtypes, similar to defineFun
+ CVC5_API_CHECK(term.d_node->getType().isSubtypeOf(*sort.d_type))
<< "Invalid sort of function body '" << term << "', expected '" << sort
<< "'";
std::vector<Sort> domain_sorts = fun.getSort().getFunctionDomainSorts();
CVC5_API_SOLVER_CHECK_BOUND_VARS_DEF_FUN(fun, bound_vars, domain_sorts);
Sort codomain = fun.getSort().getFunctionCodomainSort();
- CVC5_API_CHECK(codomain == term.getSort())
+ // we are permissive with subtypes, similar to defineFun
+ CVC5_API_CHECK(codomain.d_type->isSubtypeOf(term.d_node->getType()))
<< "Invalid sort of function body '" << term << "', expected '"
<< codomain << "'";
}
regress0/parser/named-attr.smt2
regress0/parser/proj-issue370-push-pop-global.smt2
regress0/parser/quoted-define-fun.smt2
+ regress0/parser/real-numerals.smt2
regress0/parser/shadow_fun_symbol_all.smt2
regress0/parser/shadow_fun_symbol_nirat.smt2
regress0/parser/strings20.smt2