3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-23 06:13:40 +00:00

add some notes to regex

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2020-05-26 13:29:44 -07:00
parent 5e79eb62fd
commit a1991d803f

View file

@ -237,9 +237,11 @@ namespace smt {
literal_vector lits; literal_vector lits;
for (unsigned i = 0; i < m_s_in_re.size(); ++i) { for (unsigned i = 0; i < m_s_in_re.size(); ++i) {
auto const& entry = m_s_in_re[i]; auto const& entry = m_s_in_re[i];
enode* n1 = th.ensure_enode(entry.m_s);
enode* n2 = th.ensure_enode(s);
if (!entry.m_active) if (!entry.m_active)
continue; continue;
if (th.get_root(entry.m_s) != th.get_root(s)) if (n1->get_root() != n2->get_root())
continue; continue;
if (entry.m_re == regex) if (entry.m_re == regex)
continue; continue;
@ -251,19 +253,16 @@ namespace smt {
regex = re().mk_inter(entry.m_re, regex); regex = re().mk_inter(entry.m_re, regex);
rewrite(regex); rewrite(regex);
lits.push_back(~entry.m_lit); lits.push_back(~entry.m_lit);
enode* n1 = th.ensure_enode(entry.m_s); if (n1 != n2)
enode* n2 = th.ensure_enode(s);
if (n1 != n2) {
lits.push_back(~th.mk_eq(n1->get_owner(), n2->get_owner(), false)); lits.push_back(~th.mk_eq(n1->get_owner(), n2->get_owner(), false));
} }
}
m_s_in_re.push_back(s_in_re(lit, s, regex)); m_s_in_re.push_back(s_in_re(lit, s, regex));
th.get_trail_stack().push(push_back_vector<theory_seq, vector<s_in_re>>(m_s_in_re)); th.get_trail_stack().push(push_back_vector<theory_seq, vector<s_in_re>>(m_s_in_re));
if (lits.empty()) if (lits.empty())
return false; return false;
lits.push_back(~lit); lits.push_back(~lit);
lits.push_back(th.mk_literal(re().mk_in_re(s, regex))); lits.push_back(th.mk_literal(re().mk_in_re(s, regex)));
ctx.mk_th_axiom(th.get_id(), lits.size(), lits.c_ptr()); th.add_axiom(lits);
return true; return true;
} }