Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #400 #495

Merged
merged 4 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 44 additions & 1 deletion src/mcsat/preprocessor.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,6 @@ term_t preprocessor_apply(preprocessor_t* pre, term_t t, ivector_t* out, bool is
case ARITH_EQ_ATOM: // equality (t == 0)
case ARITH_BINEQ_ATOM: // equality: (t1 == t2) (between two arithmetic terms)
case ARITH_GE_ATOM: // inequality (t >= 0)
case BV_ARRAY:
case BV_DIV:
case BV_REM:
case BV_SMOD:
Expand Down Expand Up @@ -593,6 +592,50 @@ term_t preprocessor_apply(preprocessor_t* pre, term_t t, ivector_t* out, bool is
break;
}

case BV_ARRAY:
{
composite_term_t* desc = get_composite(terms, current_kind, current);
bool children_done = true;
bool children_same = true;

n = desc->arity;

ivector_t children;
init_ivector(&children, n);

for (i = 0; i < n; ++ i) {
term_t child = desc->arg[i];
term_t child_pre = preprocessor_get(pre, child);
if (child_pre == NULL_TERM) {
children_done = false;
ivector_push(pre_stack, child);
} else {
if (is_arithmetic_literal(terms, child_pre)) {
// purify if arithmetic literal, i.e. a = 0 where a is of integer type
child_pre = preprocessor_purify(pre, child_pre, out);
}
if (child_pre != child) {
children_same = false;
}
}
if (children_done) {
ivector_push(&children, child_pre);
}
}

if (children_done) {
if (children_same) {
current_pre = current;
} else {
current_pre = mk_composite(pre, current_kind, n, children.data);
}
}

delete_ivector(&children);

break;
}

case ARITH_ABS:
{
term_t arg = arith_abs_arg(terms, current);
Expand Down
5 changes: 5 additions & 0 deletions tests/regress/mcsat/issue400.smt2
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
(set-logic ALL)
(declare-fun v () (_ BitVec 1))
(declare-fun a () Int)
(assert (distinct (= 0 a) (= v (_ bv1 1))))
(check-sat)
1 change: 1 addition & 0 deletions tests/regress/mcsat/issue400.smt2.gold
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sat
1 change: 1 addition & 0 deletions tests/regress/mcsat/issue400.smt2.options
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--mcsat --incremental
Loading