3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-08-02 12:13:25 +00:00

guard against arity mismatch

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2026-08-01 09:35:52 -07:00
parent 1ba30df028
commit 516a413559
2 changed files with 13 additions and 0 deletions

View file

@ -2210,6 +2210,9 @@ app * ast_manager::mk_app(func_decl * decl, unsigned num_args, expr * const * ar
if (num_args == 1 && decl->is_chainable() && decl->get_arity() == 2) {
r = mk_true();
}
// riskier fix:
// else if (num_args == 1 && decl->is_left_associative() && is_app(args[0]))
// r = to_app(args[0]);
else if (num_args > 2 && !decl->is_flat_associative()) {
if (decl->is_right_associative()) {
unsigned j = num_args - 1;

View file

@ -1695,14 +1695,20 @@ seq_util::rex::info seq_util::rex::mk_info_rec(app* e) const {
//TBD: check if the character predicate contains uninterpreted symbols or is nonground or is unsat
return info(true, l_false, 1, false);
case OP_RE_CONCAT:
if (e->get_num_args() != 2)
return unknown_info;
i1 = get_info_rec(e->get_arg(0));
i2 = get_info_rec(e->get_arg(1));
return i1.concat(i2, u.re.is_concat(e->get_arg(0)));
case OP_RE_UNION:
if (e->get_num_args() != 2)
return unknown_info;
i1 = get_info_rec(e->get_arg(0));
i2 = get_info_rec(e->get_arg(1));
return i1.disj(i2);
case OP_RE_INTERSECT:
if (e->get_num_args() != 2)
return unknown_info;
i1 = get_info_rec(e->get_arg(0));
i2 = get_info_rec(e->get_arg(1));
return i1.conj(i2);
@ -1727,10 +1733,14 @@ seq_util::rex::info seq_util::rex::mk_info_rec(app* e) const {
upper_bound = e->get_decl()->get_parameter(1).get_int();
return i1.loop(lower_bound, upper_bound);
case OP_RE_DIFF:
if (e->get_num_args() != 2)
return unknown_info;
i1 = get_info_rec(e->get_arg(0));
i2 = get_info_rec(e->get_arg(1));
return i1.diff(i2);
case OP_RE_XOR:
if (e->get_num_args() != 2)
return unknown_info;
i1 = get_info_rec(e->get_arg(0));
i2 = get_info_rec(e->get_arg(1));
return i1.xor_(i2);