3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 09:05:31 +00:00
This commit is contained in:
Christoph M. Wintersteiger 2017-07-28 20:24:35 +01:00
commit a30c343d7a
87 changed files with 1422 additions and 1356 deletions

View file

@ -403,6 +403,12 @@ inline func_decl * arith_decl_plugin::mk_func_decl(decl_kind k, bool is_real) {
}
}
void arith_decl_plugin::check_arity(unsigned arity, unsigned expected_arity) {
if (arity != expected_arity) {
m_manager->raise_exception("invalid number of arguments passed to function");
}
}
inline decl_kind arith_decl_plugin::fix_kind(decl_kind k, unsigned arity) {
if (k == OP_SUB && arity == 1) {
return OP_UMINUS;

View file

@ -157,6 +157,7 @@ protected:
func_decl * mk_func_decl(decl_kind k, bool is_real);
virtual void set_manager(ast_manager * m, family_id id);
decl_kind fix_kind(decl_kind k, unsigned arity);
void check_arity(unsigned arity, unsigned expected_arity);
func_decl * mk_num_decl(unsigned num_parameters, parameter const * parameters, unsigned arity);
public:

View file

@ -2178,7 +2178,10 @@ app * ast_manager::mk_app(func_decl * decl, unsigned num_args, expr * const * ar
throw ast_exception(buffer.str().c_str());
}
app * r = 0;
if (num_args > 2 && !decl->is_flat_associative()) {
if (num_args == 1 && decl->is_chainable() && decl->get_arity() == 2) {
r = mk_true();
}
else if (num_args > 2 && !decl->is_flat_associative()) {
if (decl->is_right_associative()) {
unsigned j = num_args - 1;
r = mk_app_core(decl, args[j-1], args[j]);