3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-31 23:34:55 +00:00

Merge branch 'master' of https://github.com/z3prover/z3 into polysat

This commit is contained in:
Nikolaj Bjorner 2021-08-04 14:02:41 -07:00
commit 0249d009f1
109 changed files with 1692 additions and 1097 deletions

View file

@ -121,7 +121,7 @@ namespace {
struct instruction {
opcode m_opcode;
instruction * m_next;
instruction* m_next = nullptr;
#ifdef _PROFILE_MAM
unsigned m_counter; // how often it was executed
#endif
@ -1224,9 +1224,10 @@ namespace {
return;
SASSERT(head->m_next == 0);
m_seq.push_back(m_ct_manager.mk_yield(m_qa, m_mp, m_qa->get_num_decls(), reinterpret_cast<unsigned*>(m_vars.begin())));
for (instruction * curr : m_seq) {
for (instruction* curr : m_seq) {
head->m_next = curr;
head = curr;
}
@ -2309,7 +2310,10 @@ namespace {
main_loop:
if (!m_pc)
goto backtrack;
TRACE("mam_int", display_pc_info(tout););
#ifdef _PROFILE_MAM
const_cast<instruction*>(m_pc)->m_counter++;
#endif

View file

@ -213,11 +213,12 @@ void proto_model::cleanup() {
TRACE("model_bug", model_v2_pp(tout, *this););
func_decl_set found_aux_fs;
expr_ref_vector trail(m);
for (auto const& kv : m_finterp) {
TRACE("model_bug", tout << kv.m_key->get_name() << "\n";);
func_interp * fi = kv.m_value;
ptr_buffer<func_interp> finterps;
for (auto const& kv : m_finterp)
finterps.push_back(kv.m_value);
for (auto* fi : finterps)
cleanup_func_interp(trail, fi, found_aux_fs);
}
for (unsigned i = 0; i < m_const_decls.size(); ++i) {
func_decl* d = m_const_decls[i];
expr* e = m_interp[d].second;

View file

@ -81,6 +81,7 @@ namespace smt {
void add_itos_axiom(expr* s, unsigned k) { m_ax.itos_axiom(s, k); }
void add_ubv2s_axiom(expr* b, unsigned k) { m_ax.ubv2s_axiom(b, k); }
void add_ubv2s_len_axiom(expr* b, unsigned k) { m_ax.ubv2s_len_axiom(b, k); }
void add_ubv2s_len_axiom(expr* b) { m_ax.ubv2s_len_axiom(b); }
void add_ubv2ch_axioms(sort* s) { m_ax.ubv2ch_axiom(s); }
void add_lt_axiom(expr* n) { m_ax.lt_axiom(n); }
void add_le_axiom(expr* n) { m_ax.le_axiom(n); }

View file

@ -272,13 +272,15 @@ namespace smt {
<< "PA(" << mk_pp(s, m) << "@" << idx
<< "," << state_str(r) << ") ";);
if (re().is_empty(r)) {
auto info = re().get_info(r);
//if the minlength of the regex is UINT_MAX then the regex is a deadend
if (re().is_empty(r) || info.min_length == UINT_MAX) {
STRACE("seq_regex_brief", tout << "(empty) ";);
th.add_axiom(~lit);
return;
}
auto info = re().get_info(r);
if (info.interpreted) {
update_state_graph(r);

View file

@ -315,7 +315,7 @@ namespace smt {
void conflict_resolution::process_antecedent(literal antecedent, unsigned & num_marks) {
bool_var var = antecedent.var();
unsigned lvl = m_ctx.get_assign_level(var);
SASSERT(var < static_cast<int>(m_ctx.get_num_bool_vars()));
SASSERT(var < m_ctx.get_num_bool_vars());
TRACE("conflict_", tout << "processing antecedent (level " << lvl << "):";
m_ctx.display_literal(tout, antecedent);
m_ctx.display_detailed_literal(tout << " ", antecedent) << "\n";);

View file

@ -389,8 +389,7 @@ namespace smt {
if (fid == null_family_id) return !m_hidden_ufs.contains(f);
if (fid == m.get_basic_family_id()) return false;
theory * th = m_context->get_theory(fid);
if (!th) return true;
return th->include_func_interp(f);
return !th || th->include_func_interp(f);
}
/**

View file

@ -1542,6 +1542,7 @@ void theory_seq::add_ubv_string(expr* e) {
}
if (!has_sort)
m_ax.add_ubv2ch_axioms(b->get_sort());
m_ax.add_ubv2s_len_axiom(b);
m_ubv_string.push_back(e);
m_trail_stack.push(push_back_vector<expr_ref_vector>(m_ubv_string));
add_length_to_eqc(e);
@ -1557,7 +1558,6 @@ bool theory_seq::check_ubv_string() {
}
bool theory_seq::check_ubv_string(expr* e) {
expr* n = nullptr;
if (ctx.inconsistent())
return true;
if (m_has_ubv_axiom.contains(e))

View file

@ -903,7 +903,7 @@ namespace smt {
m.mk_app(memf, x, m.mk_app(tl, S))));
recfun_replace rep(m);
var* vars[2] = { xV, SV };
p.set_definition(rep, mem, 2, vars, mem_body);
p.set_definition(rep, mem, false, 2, vars, mem_body);
}
sort_ref tup(dt.mk_pair_datatype(listS, listS, fst, snd, pair), m);
@ -926,7 +926,7 @@ namespace smt {
recfun_replace rep(m);
var* vars[5] = { aV, bV, AV, SV, tupV };
p.set_definition(rep, nxt, 5, vars, next_body);
p.set_definition(rep, nxt, false, 5, vars, next_body);
}
{
@ -961,7 +961,7 @@ namespace smt {
TRACE("special_relations", tout << connected_body << "\n";);
recfun_replace rep(m);
var* vars[3] = { AV, dstV, SV };
p.set_definition(rep, connected, 3, vars, connected_body);
p.set_definition(rep, connected, false, 3, vars, connected_body);
}
{

View file

@ -1859,18 +1859,18 @@ namespace smt {
axiomatized_terms.insert(ex);
TRACE("str", tout << "instantiate str.from_code axiom for " << mk_pp(ex, m) << std::endl;);
expr * arg;
u.str.is_from_code(ex, arg);
expr * arg = nullptr;
VERIFY(u.str.is_from_code(ex, arg));
// (str.from_code N) == "" if N is not in the range [0, max_char].
{
expr_ref premise(m.mk_or(m_autil.mk_le(arg, mk_int(-1)), m_autil.mk_ge(arg, mk_int(u.max_char() + 1))), m);
expr_ref premise(m.mk_or(m_autil.mk_le(arg, mk_int(-1)), m_autil.mk_ge(arg, mk_int(u.max_char() + 1))), m);
expr_ref conclusion(ctx.mk_eq_atom(ex, mk_string("")), m);
expr_ref axiom(rewrite_implication(premise, conclusion), m);
assert_axiom_rw(axiom);
}
// len (str.from_code N) == 1 if N is in the range [0, max_char].
{
expr_ref premise(m.mk_and(m_autil.mk_ge(arg, mk_int(0)), m_autil.mk_le(arg, mk_int(u.max_char() + 1))), m);
expr_ref premise(m.mk_and(m_autil.mk_ge(arg, mk_int(0)), m_autil.mk_le(arg, mk_int(u.max_char() + 1))), m);
expr_ref conclusion(ctx.mk_eq_atom(mk_strlen(ex), mk_int(1)), m);
expr_ref axiom(rewrite_implication(premise, conclusion), m);
assert_axiom_rw(axiom);
@ -1895,8 +1895,8 @@ namespace smt {
axiomatized_terms.insert(ex);
TRACE("str", tout << "instantiate str.to_code axiom for " << mk_pp(ex, m) << std::endl;);
expr * arg;
u.str.is_to_code(ex, arg);
expr * arg = nullptr;
VERIFY(u.str.is_to_code(ex, arg));
// (str.to_code S) == -1 if len(S) != 1.
{
expr_ref premise(m.mk_not(ctx.mk_eq_atom(mk_strlen(arg), mk_int(1))), m);
@ -5523,6 +5523,7 @@ namespace smt {
TRACE("str", tout << mk_pp(node, get_manager()) << std::endl;);
if (groundedMap.find(node) != groundedMap.end()) {
for (auto const &itor : groundedMap[node]) {
(void) itor;
TRACE("str",
tout << "\t[grounded] ";
for (auto const &vIt : itor.first) {