mirror of
https://github.com/Z3Prover/z3
synced 2025-04-24 09:35:32 +00:00
remove using insert_if_not_there2
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
9ea1cf3c5c
commit
a884201d62
47 changed files with 172 additions and 208 deletions
|
@ -60,12 +60,10 @@ class fix_dl_var_tactic : public tactic {
|
|||
|
||||
void inc_occ(expr * n, bool nested) {
|
||||
if (is_uninterp_const(n) && is_arith(n)) {
|
||||
obj_map<app, unsigned>::obj_map_entry * entry = m_occs.insert_if_not_there2(to_app(n), 0);
|
||||
entry->get_data().m_value++;
|
||||
m_occs.insert_if_not_there(to_app(n), 0)++;
|
||||
|
||||
if (!nested) {
|
||||
entry = m_non_nested_occs.insert_if_not_there2(to_app(n), 0);
|
||||
entry->get_data().m_value++;
|
||||
m_non_nested_occs.insert_if_not_there(to_app(n), 0)++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,9 +101,9 @@ class recover_01_tactic : public tactic {
|
|||
}
|
||||
|
||||
if (x != nullptr) {
|
||||
var2clauses::obj_map_entry * entry = m_var2clauses.insert_if_not_there2(x, ptr_vector<app>());
|
||||
if (entry->get_data().m_value.empty() || entry->get_data().m_value.back()->get_num_args() == cls->get_num_args()) {
|
||||
entry->get_data().m_value.push_back(cls);
|
||||
auto& value = m_var2clauses.insert_if_not_there(x, ptr_vector<app>());
|
||||
if (value.empty() || value.back()->get_num_args() == cls->get_num_args()) {
|
||||
value.push_back(cls);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,39 +68,39 @@ public:
|
|||
|
||||
void update_signed_lower(app * v, numeral const & k) {
|
||||
// k <= v
|
||||
obj_map<app, numeral>::obj_map_entry * entry = m_signed_lowers.insert_if_not_there2(v, k);
|
||||
if (entry->get_data().m_value < k) {
|
||||
auto& value = m_signed_lowers.insert_if_not_there(v, k);
|
||||
if (value < k) {
|
||||
// improve bound
|
||||
entry->get_data().m_value = k;
|
||||
value = k;
|
||||
}
|
||||
}
|
||||
|
||||
void update_signed_upper(app * v, numeral const & k) {
|
||||
// v <= k
|
||||
obj_map<app, numeral>::obj_map_entry * entry = m_signed_uppers.insert_if_not_there2(v, k);
|
||||
if (k < entry->get_data().m_value) {
|
||||
auto& value = m_signed_uppers.insert_if_not_there(v, k);
|
||||
if (k < value) {
|
||||
// improve bound
|
||||
entry->get_data().m_value = k;
|
||||
value = k;
|
||||
}
|
||||
}
|
||||
|
||||
void update_unsigned_lower(app * v, numeral const & k) {
|
||||
SASSERT(k > numeral(0));
|
||||
// k <= v
|
||||
obj_map<app, numeral>::obj_map_entry * entry = m_unsigned_lowers.insert_if_not_there2(v, k);
|
||||
if (entry->get_data().m_value < k) {
|
||||
auto& value = m_unsigned_lowers.insert_if_not_there(v, k);
|
||||
if (value < k) {
|
||||
// improve bound
|
||||
entry->get_data().m_value = k;
|
||||
value = k;
|
||||
}
|
||||
}
|
||||
|
||||
void update_unsigned_upper(app * v, numeral const & k) {
|
||||
SASSERT(k > numeral(0));
|
||||
// v <= k
|
||||
obj_map<app, numeral>::obj_map_entry * entry = m_unsigned_uppers.insert_if_not_there2(v, k);
|
||||
if (k < entry->get_data().m_value) {
|
||||
auto& value = m_unsigned_uppers.insert_if_not_there(v, k);
|
||||
if (k < value) {
|
||||
// improve bound
|
||||
entry->get_data().m_value = k;
|
||||
value = k;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ private:
|
|||
tree_t m_tree;
|
||||
|
||||
void add_edge(tree_t& tree, expr * src, expr* dst) {
|
||||
tree.insert_if_not_there2(src, ptr_vector<expr>())->get_data().m_value.push_back(dst);
|
||||
tree.insert_if_not_there(src, ptr_vector<expr>()).push_back(dst);
|
||||
}
|
||||
|
||||
void compute_post_order();
|
||||
|
|
|
@ -196,7 +196,7 @@ struct reduce_args_tactic::imp {
|
|||
expr* base;
|
||||
if (it == m_decl2args.end()) {
|
||||
m_decl2args.insert(d, bit_vector());
|
||||
svector<expr*>& bases = m_decl2base.insert_if_not_there2(d, svector<expr*>())->get_data().m_value;
|
||||
svector<expr*>& bases = m_decl2base.insert_if_not_there(d, svector<expr*>());
|
||||
bases.resize(j);
|
||||
it = m_decl2args.find_iterator(d);
|
||||
SASSERT(it != m_decl2args.end());
|
||||
|
@ -347,13 +347,13 @@ struct reduce_args_tactic::imp {
|
|||
return BR_FAILED;
|
||||
|
||||
bit_vector & bv = it->m_value;
|
||||
arg2func *& map = m_decl2arg2funcs.insert_if_not_there2(f, 0)->get_data().m_value;
|
||||
arg2func *& map = m_decl2arg2funcs.insert_if_not_there(f, 0);
|
||||
if (!map) {
|
||||
map = alloc(arg2func, arg2func_hash_proc(bv), arg2func_eq_proc(bv));
|
||||
}
|
||||
|
||||
app_ref tmp(m.mk_app(f, num, args), m);
|
||||
func_decl *& new_f = map->insert_if_not_there2(tmp, nullptr)->get_data().m_value;
|
||||
func_decl *& new_f = map->insert_if_not_there(tmp, nullptr);
|
||||
if (!new_f) {
|
||||
// create fresh symbol
|
||||
ptr_buffer<sort> domain;
|
||||
|
|
|
@ -968,15 +968,14 @@ class solve_eqs_tactic : public tactic {
|
|||
void collect_num_occs(expr * t, expr_fast_mark1 & visited) {
|
||||
ptr_buffer<expr, 128> stack;
|
||||
|
||||
#define VISIT(ARG) { \
|
||||
if (is_uninterp_const(ARG)) { \
|
||||
obj_map<expr, unsigned>::obj_map_entry * entry = m_num_occs.insert_if_not_there2(ARG, 0); \
|
||||
entry->get_data().m_value++; \
|
||||
} \
|
||||
if (!visited.is_marked(ARG)) { \
|
||||
visited.mark(ARG, true); \
|
||||
stack.push_back(ARG); \
|
||||
} \
|
||||
#define VISIT(ARG) { \
|
||||
if (is_uninterp_const(ARG)) { \
|
||||
m_num_occs.insert_if_not_there(ARG, 0)++; \
|
||||
} \
|
||||
if (!visited.is_marked(ARG)) { \
|
||||
visited.mark(ARG, true); \
|
||||
stack.push_back(ARG); \
|
||||
} \
|
||||
}
|
||||
|
||||
VISIT(t);
|
||||
|
|
|
@ -282,8 +282,7 @@ private:
|
|||
app* t = kv.m_key;
|
||||
unsigned n = kv.m_value;
|
||||
if (is_uninterpreted(t)) {
|
||||
inv_app_map::entry* e = inv_map.insert_if_not_there2(n, ptr_vector<app>());
|
||||
e->get_data().m_value.push_back(t);
|
||||
inv_map.insert_if_not_there(n, ptr_vector<app>()).push_back(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -346,9 +345,9 @@ private:
|
|||
for (unsigned i = 0; i < sz; ++i) {
|
||||
expr* e = n->get_arg(i);
|
||||
if (is_app(e)) {
|
||||
app_parents::obj_map_entry* entry = m_use_funs.insert_if_not_there2(to_app(e), 0);
|
||||
if (!entry->get_data().m_value) entry->get_data().m_value = alloc(fun_set);
|
||||
entry->get_data().m_value->insert(f);
|
||||
auto& value = m_use_funs.insert_if_not_there(to_app(e), 0);
|
||||
if (!value) value = alloc(fun_set);
|
||||
value->insert(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -373,14 +372,14 @@ private:
|
|||
for (unsigned i = 0; i < sz; ++i) {
|
||||
expr* e = n->get_arg(i);
|
||||
if (!is_app(e)) continue;
|
||||
app_siblings::obj_map_entry* entry = m_sibs.insert_if_not_there2(to_app(e), 0);
|
||||
if (!entry->get_data().get_value()) entry->get_data().m_value = alloc(uint_set);
|
||||
auto& value = m_sibs.insert_if_not_there(to_app(e), 0);
|
||||
if (!value) value = alloc(uint_set);
|
||||
for (unsigned j = 0; j < sz; ++j) {
|
||||
expr* f = n->get_arg(j);
|
||||
if (is_app(f) && i != j) {
|
||||
unsigned c1 = 0;
|
||||
m_colors.find(to_app(f), c1);
|
||||
entry->get_data().m_value->insert(c1);
|
||||
value->insert(c1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -517,13 +516,12 @@ private:
|
|||
num_occurrences(app_map& occs): m_occs(occs) {}
|
||||
void operator()(app* n) {
|
||||
app_map::obj_map_entry* e;
|
||||
m_occs.insert_if_not_there2(n, 0);
|
||||
m_occs.insert_if_not_there(n, 0);
|
||||
unsigned sz = n->get_num_args();
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
expr* arg = n->get_arg(i);
|
||||
if (is_app(arg)) {
|
||||
e = m_occs.insert_if_not_there2(to_app(arg), 0);
|
||||
e->get_data().m_value++;
|
||||
m_occs.insert_if_not_there(to_app(arg), 0)++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -309,8 +309,7 @@ public:
|
|||
unsigned na = n->get_num_args();
|
||||
for (unsigned i = 0; i < na; i++) {
|
||||
expr * c = n->get_arg(i);
|
||||
uplinks_type::obj_map_entry * entry = m_uplinks.insert_if_not_there2(c, ptr_vector<expr>());
|
||||
entry->get_data().m_value.push_back(n);
|
||||
m_uplinks.insert_if_not_there(c, ptr_vector<expr>()).push_back(n);
|
||||
}
|
||||
|
||||
func_decl * d = n->get_decl();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue