mirror of
https://github.com/Z3Prover/z3
synced 2025-05-02 13:27:01 +00:00
refactor get_sort
This commit is contained in:
parent
4455f6caf8
commit
3ae4c6e9de
129 changed files with 362 additions and 362 deletions
|
@ -73,7 +73,7 @@ namespace {
|
|||
SASSERT (m_arr_u.is_array (m_lhs) &&
|
||||
m_arr_u.is_array (m_rhs) &&
|
||||
m.get_sort(m_lhs) == m.get_sort(m_rhs));
|
||||
unsigned arity = get_array_arity(m.get_sort(m_lhs));
|
||||
unsigned arity = get_array_arity(m_lhs->get_sort());
|
||||
for (unsigned i = 2; i < p->get_num_args (); i += arity) {
|
||||
SASSERT(arity + i <= p->get_num_args());
|
||||
expr_ref_vector vec(m);
|
||||
|
@ -95,12 +95,12 @@ namespace {
|
|||
m_arr_u.is_array (rhs) &&
|
||||
m.get_sort(lhs) == m.get_sort(rhs));
|
||||
ptr_vector<sort> sorts;
|
||||
sorts.push_back (m.get_sort (m_lhs));
|
||||
sorts.push_back (m.get_sort (m_rhs));
|
||||
sorts.push_back (m_lhs->get_sort ());
|
||||
sorts.push_back (m_rhs->get_sort ());
|
||||
for (auto const& v : diff_indices) {
|
||||
SASSERT(v.size() == get_array_arity(m.get_sort(m_lhs)));
|
||||
for (expr* e : v)
|
||||
sorts.push_back (m.get_sort(e));
|
||||
sorts.push_back (e->get_sort());
|
||||
}
|
||||
m_decl = m.mk_func_decl (symbol (PARTIAL_EQ), sorts.size (), sorts.c_ptr (), m.mk_bool_sort ());
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ namespace {
|
|||
std::swap (lhs, rhs);
|
||||
}
|
||||
// lhs = (...(store (store rhs i0 v0) i1 v1)...)
|
||||
sort* val_sort = get_array_range (m.get_sort (lhs));
|
||||
sort* val_sort = get_array_range (lhs->get_sort());
|
||||
for (expr_ref_vector const& diff : m_diff_indices) {
|
||||
ptr_vector<expr> store_args;
|
||||
store_args.push_back (rhs);
|
||||
|
@ -311,7 +311,7 @@ namespace mbp {
|
|||
// if a_new is select on m_v, introduce new constant
|
||||
if (m_arr_u.is_select (a) &&
|
||||
(args.get (0) == m_v || m_has_stores_v.is_marked (args.get (0)))) {
|
||||
sort* val_sort = get_array_range (m.get_sort (m_v));
|
||||
sort* val_sort = get_array_range (m_v->get_sort());
|
||||
app_ref val_const (m.mk_fresh_const ("sel", val_sort), m);
|
||||
m_aux_vars.push_back (val_const);
|
||||
// extend M to include val_const
|
||||
|
@ -804,7 +804,7 @@ namespace mbp {
|
|||
expr* reduce_core (app *a) {
|
||||
if (!m_arr_u.is_store (a->get_arg (0))) return a;
|
||||
expr* array = a->get_arg(0);
|
||||
unsigned arity = get_array_arity(m.get_sort(array));
|
||||
unsigned arity = get_array_arity(array->get_sort());
|
||||
|
||||
expr* const* js = a->get_args() + 1;
|
||||
|
||||
|
@ -1015,7 +1015,7 @@ namespace mbp {
|
|||
if (sel_terms.empty ()) return;
|
||||
|
||||
expr* v = sel_terms.get (0)->get_arg (0); // array variable
|
||||
sort* v_sort = m.get_sort (v);
|
||||
sort* v_sort = v->get_sort ();
|
||||
sort* val_sort = get_array_range (v_sort);
|
||||
unsigned arity = get_array_arity(v_sort);
|
||||
bool is_numeric = true;
|
||||
|
@ -1083,7 +1083,7 @@ namespace mbp {
|
|||
for (expr * x : m_idxs[0].idx) {
|
||||
std::stringstream name;
|
||||
name << "get" << (i++);
|
||||
acc.push_back(mk_accessor_decl(m, symbol(name.str()), type_ref(m.get_sort(x))));
|
||||
acc.push_back(mk_accessor_decl(m, symbol(name.str()), type_ref(x->get_sort())));
|
||||
}
|
||||
constructor_decl* constrs[1] = { mk_constructor_decl(symbol("tuple"), symbol("is-tuple"), acc.size(), acc.c_ptr()) };
|
||||
datatype::def* dts = mk_datatype_decl(dt, symbol("tuple"), 0, nullptr, 1, constrs);
|
||||
|
@ -1409,14 +1409,14 @@ namespace mbp {
|
|||
obj_map<sort, app_ref_vector*> m_arrays;
|
||||
|
||||
void add_index_sort(expr* n) {
|
||||
sort* s = m.get_sort(n);
|
||||
sort* s = n->get_sort();
|
||||
if (!m_indices.contains(s)) {
|
||||
m_indices.insert(s, alloc(app_ref_vector, m));
|
||||
}
|
||||
}
|
||||
|
||||
void add_array(app* n) {
|
||||
sort* s = m.get_sort(n);
|
||||
sort* s = n->get_sort();
|
||||
app_ref_vector* vs = nullptr;
|
||||
if (!m_arrays.find(s, vs)) {
|
||||
vs = alloc(app_ref_vector, m);
|
||||
|
@ -1427,7 +1427,7 @@ namespace mbp {
|
|||
|
||||
app_ref_vector* is_index(expr* n) {
|
||||
app_ref_vector* result = nullptr;
|
||||
m_indices.find(m.get_sort(n), result);
|
||||
m_indices.find(n->get_sort(), result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace mbp {
|
|||
|
||||
|
||||
try {
|
||||
if (dt.is_recursive(m.get_sort(var))) {
|
||||
if (dt.is_recursive(var->get_sort())) {
|
||||
project_rec(model, vars, lits);
|
||||
}
|
||||
else {
|
||||
|
@ -198,7 +198,7 @@ namespace mbp {
|
|||
bool inserted = false;
|
||||
for (app* v : vars) {
|
||||
if (m.is_bool(v)) continue;
|
||||
if (dt.is_datatype(m.get_sort(v))) continue;
|
||||
if (dt.is_datatype(v->get_sort())) continue;
|
||||
inserted = true;
|
||||
has_var.mark(v);
|
||||
visited.mark(v);
|
||||
|
|
|
@ -1044,7 +1044,7 @@ namespace mbp {
|
|||
expr_ref_vector result(m);
|
||||
for (term *t : m_tg.m_terms) {
|
||||
expr* e = t->get_expr();
|
||||
if (m.get_sort(e)->get_family_id() != fid) continue;
|
||||
if (e->get_sort()->get_family_id() != fid) continue;
|
||||
for (term * p : term::parents(t->get_root())) {
|
||||
expr* pe = p->get_expr();
|
||||
if (!is_app(pe)) continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue