3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-18 11:58:31 +00:00

theory_str refactor: check_contain_by_eqc_val uses contain_pair_idx_map

This commit is contained in:
Murphy Berzish 2017-02-14 15:19:03 -05:00
parent 5ca4f2a1c8
commit 52eaae9da0

View file

@ -4842,15 +4842,18 @@ void theory_str::check_contain_by_eqc_val(expr * varNode, expr * constNode) {
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.
@ -4966,6 +4969,7 @@ void theory_str::check_contain_by_eqc_val(expr * varNode, expr * constNode) {
} }
} }
} // for (itor1 : contains_map) } // for (itor1 : contains_map)
} // if varNode in contain_pair_idx_map
} }
void theory_str::check_contain_by_substr(expr * varNode, expr_ref_vector & willEqClass) { void theory_str::check_contain_by_substr(expr * varNode, expr_ref_vector & willEqClass) {
@ -5782,7 +5786,6 @@ void theory_str::compute_contains(std::map<expr*, expr*> & varAliasMap,
} }
bool theory_str::can_concat_eq_str(expr * concat, std::string str) { bool theory_str::can_concat_eq_str(expr * concat, std::string str) {
// TODO this method could use some traces and debugging info
int strLen = str.length(); int strLen = str.length();
if (is_concat(to_app(concat))) { if (is_concat(to_app(concat))) {
ptr_vector<expr> args; ptr_vector<expr> args;
@ -5834,7 +5837,6 @@ bool theory_str::can_concat_eq_str(expr * concat, std::string str) {
} }
bool theory_str::can_concat_eq_concat(expr * concat1, expr * concat2) { bool theory_str::can_concat_eq_concat(expr * concat1, expr * concat2) {
// TODO this method could use some traces and debugging info
if (is_concat(to_app(concat1)) && is_concat(to_app(concat2))) { if (is_concat(to_app(concat1)) && is_concat(to_app(concat2))) {
{ {
// Suppose concat1 = (Concat X Y) and concat2 = (Concat M N). // Suppose concat1 = (Concat X Y) and concat2 = (Concat M N).