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

fix negative contains bug #6312

Merged
merged 1 commit into from
Sep 2, 2022
Merged
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
19 changes: 13 additions & 6 deletions src/smt/theory_str.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8436,6 +8436,14 @@ namespace smt {
}
}

bool existNegativeContains = false;
expr_ref_vector assignments(m);
ctx.get_assignments(assignments);
for (expr * a : assignments) {
expr * subterm;
if (m.is_not(a, subterm) && u.str.is_contains(subterm)) existNegativeContains = true;
}

if (!needToAssignFreeVars) {

// check string-int terms
Expand Down Expand Up @@ -8506,9 +8514,11 @@ namespace smt {
// we're not done if some variable in a regex membership predicate was unassigned
if (regexOK) {
if (unused_internal_variables.empty()) {
TRACE("str", tout << "All variables are assigned. Done!" << std::endl;);
m_stats.m_solved_by = 2;
return FC_DONE;
if (!existNegativeContains) {
TRACE("str", tout << "All variables are assigned. Done!" << std::endl;);
m_stats.m_solved_by = 2;
return FC_DONE;
}
} else {
TRACE("str", tout << "Assigning decoy values to free internal variables." << std::endl;);
for (auto const &var : unused_internal_variables) {
Expand Down Expand Up @@ -8561,9 +8571,6 @@ namespace smt {
}
TRACE("str", tout << "arithmetic solver done in final check" << std::endl;);

expr_ref_vector assignments(m);
ctx.get_assignments(assignments);

expr_ref_vector precondition(m);
expr_ref_vector cex(m);
lbool model_status = fixed_length_model_construction(assignments, precondition, free_variables, candidate_model, cex);
Expand Down