Skip to content

Commit d21911c

Browse files
committed
z3str3: fix support for re.complement and re.intersection
1 parent 470e87a commit d21911c

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/smt/theory_str.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2069,6 +2069,18 @@ namespace smt {
20692069
return zstring("(.*)");
20702070
} else if (u.re.is_full_char(a_regex)) {
20712071
return zstring("str.allchar");
2072+
} else if (u.re.is_intersection(a_regex)) {
2073+
expr * a0;
2074+
expr * a1;
2075+
u.re.is_intersection(a_regex, a0, a1);
2076+
zstring a0str = get_std_regex_str(a0);
2077+
zstring a1str = get_std_regex_str(a1);
2078+
return zstring("(") + a0str + zstring("&&") + a1str + zstring(")");
2079+
} else if (u.re.is_complement(a_regex)) {
2080+
expr * body;
2081+
u.re.is_complement(a_regex, body);
2082+
zstring bodyStr = get_std_regex_str(body);
2083+
return zstring("(^") + bodyStr + zstring(")");
20722084
} else {
20732085
TRACE("str", tout << "BUG: unrecognized regex term " << mk_pp(regex, get_manager()) << std::endl;);
20742086
UNREACHABLE(); return zstring("");

src/smt/theory_str_regex.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,11 @@ namespace smt {
902902
return true;
903903
} else if (u.re.is_complement(re)) {
904904
// TODO can we do better?
905-
return false;
905+
return false;
906+
} else if (u.re.is_intersection(re)) {
907+
return false;
908+
} else if (u.re.is_complement(re)) {
909+
return false;
906910
} else if (u.re.is_loop(re, sub1, lo, hi) || u.re.is_loop(re, sub1, lo)) {
907911
return check_regex_length_linearity_helper(sub1, already_star);
908912
} else {

0 commit comments

Comments
 (0)