mirror of
https://github.com/Z3Prover/z3
synced 2025-12-07 04:22:24 +00:00
Merge branch 'master' of https://github.com/z3prover/z3 into polysat
This commit is contained in:
commit
57df45dc16
162 changed files with 2885 additions and 1941 deletions
|
|
@ -1661,6 +1661,8 @@ namespace {
|
|||
|
||||
if (m_incompatible.empty()) {
|
||||
// sequence starting at head is fully compatible
|
||||
if (!curr)
|
||||
return;
|
||||
SASSERT(curr != 0);
|
||||
SASSERT(curr->m_opcode == CHOOSE);
|
||||
choose * first_child = static_cast<choose *>(curr);
|
||||
|
|
|
|||
|
|
@ -1113,11 +1113,14 @@ bool theory_seq::is_unit_eq(expr_ref_vector const& ls, expr_ref_vector const& rs
|
|||
|
||||
|
||||
struct remove_obj_pair_map : public trail {
|
||||
ast_manager& m;
|
||||
obj_pair_hashtable<expr, expr> & m_map;
|
||||
expr* a, *b;
|
||||
remove_obj_pair_map(obj_pair_hashtable<expr, expr> & map, expr* a, expr* b):
|
||||
m_map(map), a(a), b(b) {}
|
||||
remove_obj_pair_map(ast_manager& m, obj_pair_hashtable<expr, expr> & map, expr* a, expr* b):
|
||||
m(m), m_map(map), a(a), b(b) {}
|
||||
void undo() override {
|
||||
m.dec_ref(a);
|
||||
m.dec_ref(b);
|
||||
m_map.erase(std::make_pair(a, b));
|
||||
}
|
||||
};
|
||||
|
|
@ -1138,8 +1141,10 @@ bool theory_seq::solve_nth_eq(expr_ref_vector const& ls, expr_ref_vector const&
|
|||
expr_ref rhs = mk_concat(rs.size(), rs.data(), ls[0]->get_sort());
|
||||
if (m_nth_eq2_cache.contains(std::make_pair(rhs, ls[0])))
|
||||
return false;
|
||||
m.inc_ref(rhs);
|
||||
m.inc_ref(ls[0]);
|
||||
m_nth_eq2_cache.insert(std::make_pair(rhs, ls[0]));
|
||||
ctx.push_trail(remove_obj_pair_map(m_nth_eq2_cache, rhs, ls[0]));
|
||||
ctx.push_trail(remove_obj_pair_map(m, m_nth_eq2_cache, rhs, ls[0]));
|
||||
ls1.push_back(s);
|
||||
if (!idx_is_zero) rs1.push_back(m_sk.mk_pre(s, idx));
|
||||
rs1.push_back(m_util.str.mk_unit(rhs));
|
||||
|
|
|
|||
|
|
@ -4582,31 +4582,8 @@ namespace smt {
|
|||
}
|
||||
|
||||
void context::add_rec_funs_to_model() {
|
||||
if (!m_model) return;
|
||||
recfun::util u(m);
|
||||
func_decl_ref_vector recfuns = u.get_rec_funs();
|
||||
for (func_decl* f : recfuns) {
|
||||
auto& def = u.get_def(f);
|
||||
expr* rhs = def.get_rhs();
|
||||
if (!rhs) continue;
|
||||
if (f->get_arity() == 0) {
|
||||
m_model->register_decl(f, rhs);
|
||||
continue;
|
||||
}
|
||||
|
||||
func_interp* fi = alloc(func_interp, m, f->get_arity());
|
||||
// reverse argument order so that variable 0 starts at the beginning.
|
||||
expr_ref_vector subst(m);
|
||||
for (unsigned i = 0; i < f->get_arity(); ++i) {
|
||||
subst.push_back(m.mk_var(i, f->get_domain(i)));
|
||||
}
|
||||
var_subst sub(m, true);
|
||||
expr_ref bodyr = sub(rhs, subst.size(), subst.data());
|
||||
|
||||
fi->set_else(bodyr);
|
||||
m_model->register_decl(f, fi);
|
||||
}
|
||||
TRACE("model", tout << *m_model << "\n";);
|
||||
if (m_model)
|
||||
m_model->add_rec_funs();
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -808,7 +808,6 @@ namespace smt {
|
|||
if (t_val && !m.is_unique_value(t_val))
|
||||
for (expr* v : values)
|
||||
found |= m.are_equal(v, t_val);
|
||||
|
||||
if (t_val && !found && !already_found.contains(t_val)) {
|
||||
values.push_back(t_val);
|
||||
already_found.insert(t_val);
|
||||
|
|
@ -1113,9 +1112,14 @@ namespace smt {
|
|||
mk_inverses();
|
||||
complete_partial_funcs(partial_funcs);
|
||||
TRACE("model_finder", tout << "after auf_solver fixing the model\n";
|
||||
display_nodes(tout);
|
||||
tout << "NEW MODEL:\n";
|
||||
model_pp(tout, *m_model););
|
||||
display_nodes(tout);
|
||||
tout << "NEW MODEL:\n";
|
||||
model_pp(tout, *m_model););
|
||||
}
|
||||
|
||||
bool is_default_representative(expr* t) {
|
||||
app* tt = nullptr;
|
||||
return t && m_sort2k.find(t->get_sort(), tt) && (tt == t);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -1185,15 +1189,15 @@ namespace smt {
|
|||
node* n1 = s.get_A_f_i(m_f, m_arg_i);
|
||||
node* n2 = s.get_uvar(q, m_var_j);
|
||||
CTRACE("model_finder", n1->get_sort() != n2->get_sort(),
|
||||
tout << "sort bug:\n" << mk_ismt2_pp(q->get_expr(), m) << "\n" << mk_ismt2_pp(q, m) << "\n";
|
||||
tout << "decl(0): " << q->get_decl_name(0) << "\n";
|
||||
tout << "f: " << m_f->get_name() << " i: " << m_arg_i << "\n";
|
||||
tout << "v: " << m_var_j << "\n";
|
||||
n1->get_root()->display(tout, m);
|
||||
n2->get_root()->display(tout, m);
|
||||
tout << "f signature: ";
|
||||
for (unsigned i = 0; i < m_f->get_arity(); i++) tout << mk_pp(m_f->get_domain(i), m) << " ";
|
||||
tout << "-> " << mk_pp(m_f->get_range(), m) << "\n";
|
||||
tout << "sort bug:\n" << mk_ismt2_pp(q->get_expr(), m) << "\n" << mk_ismt2_pp(q, m) << "\n";
|
||||
tout << "decl(0): " << q->get_decl_name(0) << "\n";
|
||||
tout << "f: " << m_f->get_name() << " i: " << m_arg_i << "\n";
|
||||
tout << "v: " << m_var_j << "\n";
|
||||
n1->get_root()->display(tout, m);
|
||||
n2->get_root()->display(tout, m);
|
||||
tout << "f signature: ";
|
||||
for (unsigned i = 0; i < m_f->get_arity(); i++) tout << mk_pp(m_f->get_domain(i), m) << " ";
|
||||
tout << "-> " << mk_pp(m_f->get_range(), m) << "\n";
|
||||
);
|
||||
|
||||
n1->merge(n2);
|
||||
|
|
@ -2511,6 +2515,8 @@ namespace smt {
|
|||
if (s == nullptr)
|
||||
return nullptr;
|
||||
expr* t = s->get_inv(val);
|
||||
if (m_auf_solver->is_default_representative(t))
|
||||
return val;
|
||||
if (t != nullptr) {
|
||||
generation = s->get_generation(t);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -293,6 +293,7 @@ namespace smt {
|
|||
obj_map<enode, model_value_proc *> root2proc;
|
||||
ptr_vector<enode> roots;
|
||||
ptr_vector<model_value_proc> procs;
|
||||
scoped_reset _scoped_reset(*this, procs);
|
||||
svector<source> sources;
|
||||
buffer<model_value_dependency> dependencies;
|
||||
expr_ref_vector dependency_values(m);
|
||||
|
|
@ -315,7 +316,6 @@ namespace smt {
|
|||
m_context->display(tout);
|
||||
);
|
||||
|
||||
scoped_reset _scoped_reset(*this, procs);
|
||||
|
||||
for (source const& curr : sources) {
|
||||
if (curr.is_fresh_value()) {
|
||||
|
|
|
|||
|
|
@ -106,7 +106,6 @@ namespace smt {
|
|||
|
||||
class quantifier_manager_plugin {
|
||||
public:
|
||||
quantifier_manager_plugin() {}
|
||||
virtual ~quantifier_manager_plugin() {}
|
||||
|
||||
virtual void set_manager(quantifier_manager & qm) = 0;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ namespace smt {
|
|||
void mark_as_relevant(relevancy_propagator & rp, expr * n);
|
||||
void mark_args_as_relevant(relevancy_propagator & rp, app * n);
|
||||
public:
|
||||
relevancy_eh() {}
|
||||
virtual ~relevancy_eh() {}
|
||||
/**
|
||||
\brief This method is invoked when n is marked as relevant.
|
||||
|
|
@ -49,7 +48,6 @@ namespace smt {
|
|||
expr * m_target;
|
||||
public:
|
||||
simple_relevancy_eh(expr * t):m_target(t) {}
|
||||
~simple_relevancy_eh() override {}
|
||||
void operator()(relevancy_propagator & rp) override;
|
||||
};
|
||||
|
||||
|
|
@ -62,7 +60,6 @@ namespace smt {
|
|||
expr * m_target;
|
||||
public:
|
||||
pair_relevancy_eh(expr * s1, expr * s2, expr * t):m_source1(s1), m_source2(s2), m_target(t) {}
|
||||
~pair_relevancy_eh() override {}
|
||||
void operator()(relevancy_propagator & rp) override;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ namespace smt {
|
|||
ptr_vector<enode> m_consts;
|
||||
ptr_vector<enode> m_as_arrays;
|
||||
ptr_vector<enode> m_parent_maps;
|
||||
var_data_full() {}
|
||||
};
|
||||
|
||||
ptr_vector<var_data_full> m_var_data_full;
|
||||
|
|
|
|||
|
|
@ -77,7 +77,6 @@ namespace smt {
|
|||
m_pos(pos),
|
||||
m_neg(neg) {
|
||||
}
|
||||
~atom() {}
|
||||
bool_var get_bool_var() const { return m_bvar; }
|
||||
bool is_true() const { return m_true; }
|
||||
void assign_eh(bool is_true) { m_true = is_true; }
|
||||
|
|
@ -383,24 +382,21 @@ namespace smt {
|
|||
static const bool m_int_theory = true;
|
||||
typedef rational numeral;
|
||||
typedef rational fin_numeral;
|
||||
numeral m_epsilon;
|
||||
idl_ext() : m_epsilon(1) {}
|
||||
numeral m_epsilon { 1 };
|
||||
};
|
||||
|
||||
struct sidl_ext {
|
||||
static const bool m_int_theory = true;
|
||||
typedef s_integer numeral;
|
||||
typedef s_integer fin_numeral;
|
||||
numeral m_epsilon;
|
||||
sidl_ext() : m_epsilon(1) {}
|
||||
numeral m_epsilon { 1 };
|
||||
};
|
||||
|
||||
struct rdl_ext {
|
||||
static const bool m_int_theory = false;
|
||||
typedef inf_int_rational numeral;
|
||||
typedef rational fin_numeral;
|
||||
numeral m_epsilon;
|
||||
rdl_ext() : m_epsilon(rational(), true) {}
|
||||
numeral m_epsilon { rational(), true };
|
||||
};
|
||||
|
||||
//
|
||||
|
|
|
|||
|
|
@ -1541,8 +1541,8 @@ public:
|
|||
|
||||
switch (is_sat) {
|
||||
case l_true:
|
||||
TRACE("arith", /*display(tout);*/
|
||||
ctx().display(tout);
|
||||
TRACE("arith", display(tout);
|
||||
/* ctx().display(tout);*/
|
||||
);
|
||||
|
||||
switch (check_lia()) {
|
||||
|
|
|
|||
|
|
@ -77,7 +77,6 @@ namespace smt {
|
|||
atom(bool_var bv, int pos, int neg) :
|
||||
m_bvar(bv), m_true(false),
|
||||
m_pos(pos), m_neg(neg) {}
|
||||
~atom() {}
|
||||
bool_var get_bool_var() const { return m_bvar; }
|
||||
void assign_eh(bool is_true) { m_true = is_true; }
|
||||
int get_asserted_edge() const { return this->m_true?m_pos:m_neg; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue