mirror of
https://github.com/Z3Prover/z3
synced 2025-06-22 05:43:39 +00:00
theory_str refactor: check_contain_by_substr uses contain_pair_idx_map
This commit is contained in:
parent
52eaae9da0
commit
3e714075c4
1 changed files with 53 additions and 49 deletions
|
@ -4977,15 +4977,18 @@ void theory_str::check_contain_by_substr(expr * varNode, expr_ref_vector & willE
|
||||||
ast_manager & m = get_manager();
|
ast_manager & m = get_manager();
|
||||||
expr_ref_vector litems(m);
|
expr_ref_vector litems(m);
|
||||||
|
|
||||||
// TODO refactor to use the new contain_pair_idx_map
|
if (contain_pair_idx_map.find(varNode) != contain_pair_idx_map.end()) {
|
||||||
|
std::set<std::pair<expr*, expr*> >::iterator itor1 = contain_pair_idx_map[varNode].begin();
|
||||||
|
for (; itor1 != contain_pair_idx_map[varNode].end(); ++itor1) {
|
||||||
|
expr * strAst = itor1->first;
|
||||||
|
expr * substrAst = itor1->second;
|
||||||
|
|
||||||
expr_ref_vector::iterator itor1 = contains_map.begin();
|
expr * boolVar;
|
||||||
for (; itor1 != contains_map.end(); ++itor1) {
|
if (!contain_pair_bool_map.find(strAst, substrAst, boolVar)) {
|
||||||
expr * boolVar = *itor1;
|
TRACE("t_str_detail", tout << "warning: no entry for boolVar in contain_pair_bool_map" << std::endl;);
|
||||||
|
}
|
||||||
// boolVar is actually a Contains term
|
// boolVar is actually a Contains term
|
||||||
app * containsApp = to_app(boolVar);
|
app * containsApp = to_app(boolVar);
|
||||||
expr * strAst = containsApp->get_arg(0);
|
|
||||||
expr * substrAst = containsApp->get_arg(1);
|
|
||||||
|
|
||||||
// we only want to inspect the Contains terms where either of strAst or substrAst
|
// we only want to inspect the Contains terms where either of strAst or substrAst
|
||||||
// are equal to varNode.
|
// are equal to varNode.
|
||||||
|
@ -5038,6 +5041,7 @@ void theory_str::check_contain_by_substr(expr * varNode, expr_ref_vector & willE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} // varNode in contain_pair_idx_map
|
||||||
}
|
}
|
||||||
|
|
||||||
bool theory_str::in_contain_idx_map(expr * n) {
|
bool theory_str::in_contain_idx_map(expr * n) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue