3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-04-15 08:44:10 +00:00

Some more bug fixes

This commit is contained in:
CEisenhofer 2026-04-09 13:47:29 +02:00
parent 38d725dc5a
commit a36254f104
5 changed files with 22 additions and 19 deletions

View file

@ -35,6 +35,7 @@ NSB review:
#include "ast/rewriter/th_rewriter.h"
#include "ast/rewriter/seq_skolem.h"
#include "ast/rewriter/var_subst.h"
#include "smt/smt_enode.h"
#include "util/statistics.h"
#include <algorithm>
#include <cstdlib>
@ -247,6 +248,18 @@ namespace seq {
return false;
}
void nielsen_node::add_str_eq(str_eq const& eq) {
SASSERT(eq.m_lhs != nullptr);
SASSERT(eq.m_rhs != nullptr);
m_str_eq.push_back(eq);
}
void nielsen_node::add_str_mem(str_mem const& mem) {
SASSERT(mem.m_str != nullptr);
SASSERT(mem.m_regex != nullptr);
m_str_mem.push_back(mem);
}
void nielsen_node::add_constraint(constraint const &c) {
auto& m = graph().get_manager();
if (m.is_and(c.fml)) {
@ -1137,7 +1150,7 @@ namespace seq {
dep_tracker dep = mem.m_dep;
if (m_graph.check_regex_widening(*this, mem.m_str, mem.m_regex, dep)) {
set_general_conflict();
set_conflict(backtrack_reason::regex, dep);
set_conflict(backtrack_reason::regex_widening, dep);
return simplify_result::conflict;
}
}

View file

@ -560,17 +560,8 @@ namespace seq {
vector<str_mem> const& str_mems() const { return m_str_mem; }
vector<str_mem>& str_mems() { return m_str_mem; }
void add_str_eq(str_eq const& eq) {
SASSERT(eq.m_lhs != nullptr);
SASSERT(eq.m_rhs != nullptr);
m_str_eq.push_back(eq);
}
void add_str_mem(str_mem const& mem) {
SASSERT(mem.m_str != nullptr);
SASSERT(mem.m_regex != nullptr);
m_str_mem.push_back(mem);
}
void add_str_eq(str_eq const& eq);
void add_str_mem(str_mem const& mem);
void add_constraint(constraint const &ic);
vector<constraint> const& constraints() const { return m_constraints; }

View file

@ -287,7 +287,7 @@ namespace seq {
std::string res;
if (ap->get_num_args() == 0)
return "&#8709;";
res = regex_expr_html(ap->get_arg(1), m, seq);
res = regex_expr_html(ap->get_arg(0), m, seq);
for (unsigned i = 1; i < ap->get_num_args(); ++i) {
res += " | ";
res += regex_expr_html(ap->get_arg(i), m, seq);

View file

@ -577,7 +577,6 @@ namespace seq {
}
}
}
return l_true;
}
@ -667,8 +666,7 @@ namespace seq {
euf::snode* result = nullptr;
for (auto const& mem : node.str_mems()) {
if (!mem.m_str || !mem.m_regex)
continue;
SASSERT(mem.m_str && mem.m_regex);
// Primitive constraint: str is a single variable
if (!mem.is_primitive())
continue;
@ -679,6 +677,7 @@ namespace seq {
if (!result) {
result = mem.m_regex;
dep = dep_mgr.mk_join(dep, mem.m_dep);
}
else {
expr* r1 = result->get_expr();

View file

@ -239,7 +239,7 @@ namespace smt {
void theory_nseq::assign_eh(bool_var v, bool is_true) {
expr* e = ctx.bool_var2expr(v);
// std::cout << "assigned " << mk_pp(e, m) << " = " << is_true << std::endl;
// std::cout << "assigned [" << sat::literal(v, is_true) << "] " << mk_pp(e, m) << " = " << is_true << std::endl;
expr *s = nullptr, *re = nullptr, *a = nullptr, *b = nullptr;
TRACE(seq, tout << (is_true ? "" : "¬") << mk_bounded_pp(e, m, 3) << "\n";);
if (m_seq.str.is_in_re(e, s, re)) {
@ -687,7 +687,7 @@ namespace smt {
v.reset();
}
};
std::cout << "Nielsen assumptions:\n";
//std::cout << "Nielsen assumptions:\n";
ctx.push_trail(reset_vector(m_nielsen_literals));
for (auto const& c : m_nielsen.sat_node()->constraints()) {
bool was_internalized = ctx.e_internalized(c.fml);
@ -715,7 +715,7 @@ namespace smt {
break;
}
}
std::cout << std::endl;
// std::cout << std::endl;
if (has_undef)
return false;
return true;