3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 09:05:31 +00:00

align semantics of re.allchar with string proposal. #1475

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2018-02-07 20:08:15 -08:00
parent 1ee7871bbf
commit 61934d8106
7 changed files with 67 additions and 31 deletions

View file

@ -2271,7 +2271,8 @@ bool theory_seq::internalize_re(expr* e) {
m_util.re.is_concat(e, e1, e2)) {
return internalize_re(e1) && internalize_re(e2);
}
if (m_util.re.is_full(e) ||
if (m_util.re.is_full_seq(e) ||
m_util.re.is_full_char(e) ||
m_util.re.is_empty(e)) {
return true;
}

View file

@ -1689,8 +1689,10 @@ namespace smt {
u.str.is_string(range1, range1val);
u.str.is_string(range2, range2val);
return zstring("[") + range1val + zstring("-") + range2val + zstring("]");
} else if (u.re.is_full(a_regex)) {
} else if (u.re.is_full_seq(a_regex)) {
return zstring("(.*)");
} else if (u.re.is_full_char(a_regex)) {
return zstring("str.allchar");
} else {
TRACE("str", tout << "BUG: unrecognized regex term " << mk_pp(regex, get_manager()) << std::endl;);
UNREACHABLE(); return zstring("");
@ -1806,9 +1808,12 @@ namespace smt {
expr_ref finalAxiom(m.mk_iff(ex, rhs), m);
SASSERT(finalAxiom);
assert_axiom(finalAxiom);
} else if (u.re.is_full(regex)) {
} else if (u.re.is_full_seq(regex)) {
// trivially true for any string!
assert_axiom(ex);
} else if (u.re.is_full_char(regex)) {
TRACE("str", tout << "ERROR: unknown regex expression " << mk_pp(regex, m) << "!" << std::endl;);
NOT_IMPLEMENTED_YET();
} else {
TRACE("str", tout << "ERROR: unknown regex expression " << mk_pp(regex, m) << "!" << std::endl;);
NOT_IMPLEMENTED_YET();
@ -6309,7 +6314,7 @@ namespace smt {
}
TRACE("str", tout << "range NFA: start = " << start << ", end = " << end << std::endl;);
} else if (u.re.is_full(e)) {
} else if (u.re.is_full_seq(e)) {
// effectively the same as .* where . can be any single character
// start --e--> tmp
// tmp --e--> end