mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 09:05:31 +00:00
fixes to dt_solver and related
This commit is contained in:
parent
f7b1469462
commit
830f314a3f
20 changed files with 250 additions and 187 deletions
|
@ -458,7 +458,7 @@ namespace smt {
|
|||
TRACE("add_eq", tout << "assigning: #" << n1->get_owner_id() << " = #" << n2->get_owner_id() << "\n";);
|
||||
TRACE("add_eq_detail", tout << "assigning\n" << enode_pp(n1, *this) << "\n" << enode_pp(n2, *this) << "\n";
|
||||
tout << "kind: " << js.get_kind() << "\n";);
|
||||
SASSERT(n1->get_owner()->get_sort() == n2->get_owner()->get_sort());
|
||||
SASSERT(n1->get_sort() == n2->get_sort());
|
||||
|
||||
m_stats.m_num_add_eq++;
|
||||
enode * r1 = n1->get_root();
|
||||
|
@ -1099,14 +1099,14 @@ namespace smt {
|
|||
context.
|
||||
*/
|
||||
bool context::is_diseq(enode * n1, enode * n2) const {
|
||||
SASSERT(n1->get_owner()->get_sort() == n2->get_owner()->get_sort());
|
||||
SASSERT(n1->get_sort() == n2->get_sort());
|
||||
context * _this = const_cast<context*>(this);
|
||||
if (!m_is_diseq_tmp) {
|
||||
app * eq = m.mk_eq(n1->get_owner(), n2->get_owner());
|
||||
m.inc_ref(eq);
|
||||
_this->m_is_diseq_tmp = enode::mk_dummy(m, m_app2enode, eq);
|
||||
}
|
||||
else if (m_is_diseq_tmp->get_owner()->get_arg(0)->get_sort() != n1->get_owner()->get_sort()) {
|
||||
else if (m_is_diseq_tmp->get_owner()->get_arg(0)->get_sort() != n1->get_sort()) {
|
||||
m.dec_ref(m_is_diseq_tmp->get_owner());
|
||||
app * eq = m.mk_eq(n1->get_owner(), n2->get_owner());
|
||||
m.inc_ref(eq);
|
||||
|
@ -4475,7 +4475,7 @@ namespace smt {
|
|||
}
|
||||
|
||||
bool context::get_value(enode * n, expr_ref & value) {
|
||||
sort * s = n->get_owner()->get_sort();
|
||||
sort * s = n->get_sort();
|
||||
family_id fid = s->get_family_id();
|
||||
theory * th = get_theory(fid);
|
||||
if (th == nullptr)
|
||||
|
|
|
@ -171,13 +171,10 @@ namespace smt {
|
|||
unsigned get_owner_id() const { return m_owner->get_id(); }
|
||||
unsigned get_expr_id() const { return m_owner->get_id(); }
|
||||
|
||||
func_decl * get_decl() const {
|
||||
return m_owner->get_decl();
|
||||
}
|
||||
func_decl * get_decl() const { return m_owner->get_decl(); }
|
||||
unsigned get_decl_id() const { return m_owner->get_decl()->get_decl_id(); }
|
||||
|
||||
unsigned get_decl_id() const {
|
||||
return m_owner->get_decl()->get_decl_id();
|
||||
}
|
||||
sort* get_sort() const { return m_owner->get_sort(); }
|
||||
|
||||
unsigned hash() const {
|
||||
return m_owner->hash();
|
||||
|
|
|
@ -94,7 +94,7 @@ namespace smt {
|
|||
for (enode * r : m_context->enodes()) {
|
||||
if (r == r->get_root() && (m_context->is_relevant(r) || m.is_value(r->get_expr()))) {
|
||||
roots.push_back(r);
|
||||
sort * s = r->get_owner()->get_sort();
|
||||
sort * s = r->get_sort();
|
||||
model_value_proc * proc = nullptr;
|
||||
if (m.is_bool(s)) {
|
||||
CTRACE("model", m_context->get_assignment(r) == l_undef,
|
||||
|
@ -117,7 +117,7 @@ namespace smt {
|
|||
}
|
||||
else {
|
||||
TRACE("model", tout << "creating fresh value for #" << r->get_owner_id() << "\n";);
|
||||
proc = alloc(fresh_value_proc, mk_extra_fresh_value(r->get_owner()->get_sort()));
|
||||
proc = alloc(fresh_value_proc, mk_extra_fresh_value(r->get_sort()));
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -136,7 +136,7 @@ namespace smt {
|
|||
SASSERT(r == r->get_root());
|
||||
expr * n = r->get_owner();
|
||||
if (!m.is_model_value(n)) {
|
||||
sort * s = r->get_owner()->get_sort();
|
||||
sort * s = r->get_sort();
|
||||
n = m_model->get_fresh_value(s);
|
||||
CTRACE("model", n == 0,
|
||||
tout << mk_pp(r->get_owner(), m) << "\nsort:\n" << mk_pp(s, m) << "\n";
|
||||
|
@ -183,12 +183,12 @@ namespace smt {
|
|||
return true;
|
||||
bool visited = true;
|
||||
for (enode * r : roots) {
|
||||
if (r->get_owner()->get_sort() != s)
|
||||
if (r->get_sort() != s)
|
||||
continue;
|
||||
SASSERT(r == r->get_root());
|
||||
if (root2proc[r]->is_fresh())
|
||||
continue; // r is associated with a fresh value...
|
||||
TRACE("mg_top_sort", tout << "fresh!" << src.get_value()->get_idx() << " -> #" << r->get_owner_id() << " " << mk_pp(r->get_owner()->get_sort(), m) << "\n";);
|
||||
TRACE("mg_top_sort", tout << "fresh!" << src.get_value()->get_idx() << " -> #" << r->get_owner_id() << " " << mk_pp(r->get_sort(), m) << "\n";);
|
||||
visit_child(source(r), colors, todo, visited);
|
||||
TRACE("mg_top_sort", tout << "visited: " << visited << ", todo.size(): " << todo.size() << "\n";);
|
||||
}
|
||||
|
@ -307,7 +307,7 @@ namespace smt {
|
|||
enode * n = curr.get_enode();
|
||||
SASSERT(n->get_root() == n);
|
||||
tout << mk_pp(n->get_owner(), m) << "\n";
|
||||
sort * s = n->get_owner()->get_sort();
|
||||
sort * s = n->get_sort();
|
||||
tout << curr << " " << mk_pp(s, m);
|
||||
tout << " is_fresh: " << root2proc[n]->is_fresh() << "\n";
|
||||
}
|
||||
|
|
|
@ -274,7 +274,7 @@ namespace smt {
|
|||
assert_update_field_axioms(n);
|
||||
}
|
||||
else {
|
||||
sort * s = n->get_owner()->get_sort();
|
||||
sort * s = n->get_sort();
|
||||
if (m_util.get_datatype_num_constructors(s) == 1) {
|
||||
func_decl * c = m_util.get_datatype_constructors(s)->get(0);
|
||||
assert_is_constructor_axiom(n, c, null_literal);
|
||||
|
@ -333,7 +333,7 @@ namespace smt {
|
|||
//
|
||||
for (unsigned i = 0; i < num_args; i++) {
|
||||
enode * arg = e->get_arg(i);
|
||||
sort * s = arg->get_owner()->get_sort();
|
||||
sort * s = arg->get_sort();
|
||||
if (m_autil.is_array(s) && m_util.is_datatype(get_array_range(s))) {
|
||||
app_ref def(m_autil.mk_default(arg->get_owner()), m);
|
||||
if (!ctx.e_internalized(def)) {
|
||||
|
@ -528,7 +528,7 @@ namespace smt {
|
|||
}
|
||||
found = true;
|
||||
}
|
||||
sort * s = arg->get_owner()->get_sort();
|
||||
sort * s = arg->get_sort();
|
||||
if (m_autil.is_array(s) && m_util.is_datatype(get_array_range(s))) {
|
||||
for (enode* aarg : get_array_args(arg)) {
|
||||
if (aarg->get_root() == child->get_root()) {
|
||||
|
@ -610,7 +610,7 @@ namespace smt {
|
|||
occurs_check_explain(parent, aarg);
|
||||
return true;
|
||||
}
|
||||
if (m_util.is_datatype(aarg->get_owner()->get_sort())) {
|
||||
if (m_util.is_datatype(aarg->get_sort())) {
|
||||
m_parent.insert(aarg->get_root(), parent);
|
||||
oc_push_stack(aarg);
|
||||
}
|
||||
|
@ -853,7 +853,7 @@ namespace smt {
|
|||
}
|
||||
return;
|
||||
}
|
||||
SASSERT(val == l_undef || (val == l_false && d->m_constructor == 0));
|
||||
SASSERT(val == l_undef || (val == l_false && d->m_constructor == nullptr));
|
||||
d->m_recognizers[c_idx] = recognizer;
|
||||
m_trail_stack.push(set_vector_idx_trail<enode>(d->m_recognizers, c_idx));
|
||||
if (val == l_false) {
|
||||
|
@ -872,7 +872,7 @@ namespace smt {
|
|||
unsigned num_unassigned = 0;
|
||||
unsigned unassigned_idx = UINT_MAX;
|
||||
enode * n = get_enode(v);
|
||||
sort * dt = n->get_owner()->get_sort();
|
||||
sort * dt = n->get_sort();
|
||||
var_data * d = m_var_data[v];
|
||||
if (d->m_recognizers.empty()) {
|
||||
theory_var w = recognizer->get_arg(0)->get_th_var(get_id());
|
||||
|
@ -955,7 +955,7 @@ namespace smt {
|
|||
void theory_datatype::mk_split(theory_var v) {
|
||||
v = m_find.find(v);
|
||||
enode * n = get_enode(v);
|
||||
sort * s = n->get_owner()->get_sort();
|
||||
sort * s = n->get_sort();
|
||||
func_decl * non_rec_c = m_util.get_non_rec_constructor(s);
|
||||
unsigned non_rec_idx = m_util.get_constructor_idx(non_rec_c);
|
||||
var_data * d = m_var_data[v];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue