3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-06-27 19:08:49 +00:00

Give up with we have nasty replace_all or friends (otw. we would be unsound due to Nielsen saturation)

This commit is contained in:
CEisenhofer 2026-06-26 15:14:44 +02:00
parent ff7cbe9406
commit 63a668a71f
5 changed files with 68 additions and 0 deletions

View file

@ -1833,6 +1833,26 @@ namespace seq {
return true;
}
static bool snode_has_rigid(euf::snode const* s) {
for (euf::snode const* t : s->collect_tokens())
if (t->is_rigid())
return true;
return false;
}
bool nielsen_node::references_rigid() const {
for (str_eq const& eq : m_str_eq)
if (snode_has_rigid(eq.m_lhs) || snode_has_rigid(eq.m_rhs))
return true;
for (str_deq const& dq : m_str_deq)
if (snode_has_rigid(dq.m_lhs) || snode_has_rigid(dq.m_rhs))
return true;
for (str_mem const& mem : m_str_mem)
if (snode_has_rigid(mem.m_str) || snode_has_rigid(mem.m_regex))
return true;
return false;
}
euf::snode const* nielsen_graph::mk_rewrite(expr* e) const {
expr_ref er(e, m);
th_rewriter rw(m);
@ -1945,6 +1965,7 @@ namespace seq {
if (r == search_result::unsat) {
++m_stats.m_num_unsat;
const auto deps = collect_conflict_deps();
m_conflict_sources.reset();
m_dep_mgr.linearize(deps, m_conflict_sources);
TRACE(seq, display(tout, m_root));
return r;

View file

@ -654,6 +654,14 @@ namespace seq {
// true if all str_eqs are trivial and there are no str_mems
bool is_satisfied() const;
// true if ANY equality/disequality/membership references a rigid (defined) op
// snode (str.replace, str.replace_all, str.replace_re*). Used to defer to the
// axiom layer (FC_GIVEUP) before searching: these terms are not free variables
// but are pinned by the recfun/axiom layer, and the Nielsen modifiers would
// substitute/unify them as if free, discarding their definition and producing
// invalid models.
bool references_rigid() const;
// render constraint set as an HTML fragment for DOT node labels.
// mirrors ZIPT's NielsenNode.ToHtmlString()
std::ostream& to_html(std::ostream& out, obj_map<expr, std::string>& names, uint64_t& next_id, ast_manager& m) const;