3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-05-24 02:49:38 +00:00

Standardize for-loop increments to prefix form (++i) (#8199)

* Initial plan

* Convert postfix to prefix increment in for loops

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

* Fix member variable increment conversion bug

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

* Update API generator to produce prefix increments

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
This commit is contained in:
Copilot 2026-01-14 19:55:31 -08:00 committed by Nikolaj Bjorner
parent 851b8ea31c
commit 317dd92105
475 changed files with 3237 additions and 3237 deletions

View file

@ -638,7 +638,7 @@ namespace datalog {
SASSERT(is_fact(head));
relation_fact fact(get_manager());
unsigned n = head->get_num_args();
for (unsigned i = 0; i < n; i++) {
for (unsigned i = 0; i < n; ++i) {
fact.push_back(to_app(head->get_arg(i)));
}
add_fact(head->get_decl(), fact);

View file

@ -108,7 +108,7 @@ namespace datalog {
var_idx_set& rule_manager::collect_tail_vars(rule * r) {
reset_collect_vars();
unsigned n = r->get_tail_size();
for (unsigned i=0;i<n;i++) {
for (unsigned i=0;i<n;++i) {
accumulate_vars(r->get_tail(i));
}
return finalize_collect_vars();
@ -118,7 +118,7 @@ namespace datalog {
reset_collect_vars();
unsigned n = r->get_tail_size();
accumulate_vars(r->get_head());
for (unsigned i=0;i<n;i++) {
for (unsigned i=0;i<n;++i) {
if (r->get_tail(i) != t) {
accumulate_vars(r->get_tail(i));
}
@ -130,7 +130,7 @@ namespace datalog {
reset_collect_vars();
unsigned n = r->get_tail_size();
accumulate_vars(r->get_head());
for (unsigned i=0;i<n;i++) {
for (unsigned i=0;i<n;++i) {
accumulate_vars(r->get_tail(i));
}
return finalize_collect_vars();
@ -305,7 +305,7 @@ namespace datalog {
body.push_back(to_app(q));
flatten_body(body);
func_decl* body_pred = nullptr;
for (unsigned i = 0; i < body.size(); i++) {
for (unsigned i = 0; i < body.size(); ++i) {
if (is_uninterp(body[i].get())) {
body_pred = body[i]->get_decl();
break;
@ -330,7 +330,7 @@ namespace datalog {
}
expr_ref_vector qhead_args(m);
for (unsigned i = 0; i < vars.size(); i++) {
for (unsigned i = 0; i < vars.size(); ++i) {
qhead_args.push_back(m.mk_var(vars.size()-i-1, vars[i]));
}
app_ref qhead(m.mk_app(qpred, qhead_args.data()), m);
@ -475,7 +475,7 @@ namespace datalog {
bool has_neg = false;
for (unsigned i = 0; i < n; i++) {
for (unsigned i = 0; i < n; ++i) {
bool is_neg = (is_negated != nullptr && is_negated[i]);
app * curr = tail[i];
@ -544,7 +544,7 @@ namespace datalog {
r->m_uninterp_cnt = source->m_uninterp_cnt;
r->m_proof = nullptr;
m.inc_ref(r->m_head);
for (unsigned i = 0; i < n; i++) {
for (unsigned i = 0; i < n; ++i) {
r->m_tail[i] = source->m_tail[i];
m.inc_ref(r->get_tail(i));
}
@ -554,7 +554,7 @@ namespace datalog {
void rule_manager::to_formula(rule const& r, expr_ref& fml) {
ast_manager & m = fml.get_manager();
expr_ref_vector body(m);
for (unsigned i = 0; i < r.get_tail_size(); i++) {
for (unsigned i = 0; i < r.get_tail_size(); ++i) {
body.push_back(r.get_tail(i));
if (r.is_neg_tail(i)) {
body[body.size()-1] = m.mk_not(body.back());
@ -663,7 +663,7 @@ namespace datalog {
vctr.count_vars(head);
for (unsigned i = 0; i < ut_len; i++) {
for (unsigned i = 0; i < ut_len; ++i) {
app * t = r->get_tail(i);
vctr.count_vars(t);
tail.push_back(t);
@ -673,12 +673,12 @@ namespace datalog {
var_idx_set unbound_vars;
expr_ref_vector tails_with_unbound(m);
for (unsigned i = ut_len; i < t_len; i++) {
for (unsigned i = ut_len; i < t_len; ++i) {
app * t = r->get_tail(i);
m_free_vars(t);
bool has_unbound = false;
unsigned iv_size = m_free_vars.size();
for (unsigned i=0; i<iv_size; i++) {
for (unsigned i=0; i<iv_size; ++i) {
if (!m_free_vars[i]) { continue; }
if (vctr.get(i)==0) {
has_unbound = true;
@ -730,7 +730,7 @@ namespace datalog {
SASSERT(q_idx == q_var_cnt);
svector<symbol> qnames;
for (unsigned i = 0; i < q_var_cnt; i++) {
for (unsigned i = 0; i < q_var_cnt; ++i) {
qnames.push_back(symbol(i));
}
//quantifiers take this reversed
@ -838,7 +838,7 @@ namespace datalog {
throw default_exception(out.str());
}
unsigned num_args = to_app(head)->get_num_args();
for (unsigned i = 0; i < num_args; i++) {
for (unsigned i = 0; i < num_args; ++i) {
expr * arg = to_app(head)->get_arg(i);
if (!is_var(arg) && !m.is_value(arg)) {
std::ostringstream out;
@ -850,7 +850,7 @@ namespace datalog {
bool rule_manager::is_fact(app * head) const {
unsigned num_args = head->get_num_args();
for (unsigned i = 0; i < num_args; i++) {
for (unsigned i = 0; i < num_args; ++i) {
if (!m.is_value(head->get_arg(i)))
return false;
}
@ -860,7 +860,7 @@ namespace datalog {
void rule::deallocate(ast_manager & m) {
m.dec_ref(m_head);
unsigned n = get_tail_size();
for (unsigned i = 0; i < n; i++) {
for (unsigned i = 0; i < n; ++i) {
m.dec_ref(get_tail(i));
}
if (m_proof) {
@ -882,7 +882,7 @@ namespace datalog {
bool rule::is_in_tail(const func_decl * p, bool only_positive) const {
unsigned len = only_positive ? get_positive_tail_size() : get_uninterpreted_tail_size();
for (unsigned i = 0; i < len; i++) {
for (unsigned i = 0; i < len; ++i) {
if (get_tail(i)->get_decl()==p) {
return true;
}
@ -1003,7 +1003,7 @@ namespace datalog {
m.dec_ref(m_head);
m_head = new_head_a;
for (unsigned i = 0; i < m_tail_size; i++) {
for (unsigned i = 0; i < m_tail_size; ++i) {
app * old_tail = get_tail(i);
app_ref new_tail_a = rm.ensure_app(vs(old_tail, subst_vals.size(), subst_vals.data()));
bool sign = is_neg_tail(i);
@ -1025,7 +1025,7 @@ namespace datalog {
return;
}
out << " :- ";
for (unsigned i = 0; i < m_tail_size; i++) {
for (unsigned i = 0; i < m_tail_size; ++i) {
if (i > 0)
out << ",";
if (!compact)

View file

@ -89,7 +89,7 @@ namespace datalog {
void rule_dependencies::populate(unsigned n, rule * const * rules) {
SASSERT(m_data.empty());
for (unsigned i=0; i<n; i++) {
for (unsigned i=0; i<n; ++i) {
populate(rules[i]);
}
}
@ -393,11 +393,11 @@ namespace datalog {
bool rule_set::stratified_negation() {
ptr_vector<rule>::const_iterator it = m_rules.data();
ptr_vector<rule>::const_iterator end = m_rules.data() + m_rules.size();
for (; it != end; it++) {
for (; it != end; ++it) {
rule * r = *it;
func_decl * head_decl = r->get_decl();
unsigned n = r->get_uninterpreted_tail_size();
for (unsigned i = r->get_positive_tail_size(); i < n; i++) {
for (unsigned i = r->get_positive_tail_size(); i < n; ++i) {
SASSERT(r->is_neg_tail(i));
func_decl * tail_decl = r->get_decl(i);
unsigned neg_strat = get_predicate_strat(tail_decl);
@ -423,7 +423,7 @@ namespace datalog {
void rule_set::add_rules(const rule_set & src) {
SASSERT(!is_closed());
unsigned n = src.get_num_rules();
for (unsigned i = 0; i < n; i++) {
for (unsigned i = 0; i < n; ++i) {
add_rule(src.get_rule(i));
}
inherit_predicates(src);
@ -639,7 +639,7 @@ namespace datalog {
// We put components whose indegree is zero to m_strats and assign its
// m_components entry to zero.
unsigned comp_cnt = m_components.size();
for (unsigned i = 0; i < comp_cnt; i++) {
for (unsigned i = 0; i < comp_cnt; ++i) {
if (in_degrees[i] == 0) {
m_strats.push_back(m_components[i]);
m_components[i] = 0;
@ -681,7 +681,7 @@ namespace datalog {
SASSERT(m_pred_strat_nums.empty());
unsigned strat_cnt = m_strats.size();
for (unsigned strat_index=0; strat_index < strat_cnt; strat_index++) {
for (unsigned strat_index=0; strat_index < strat_cnt; ++strat_index) {
item_set * comp = m_strats[strat_index];
for (T * el : *comp) {
m_pred_strat_nums.insert(el, strat_index);

View file

@ -71,7 +71,7 @@ namespace datalog {
SASSERT(is_uninterp(pred));
unsigned res = 0;
unsigned n = pred->get_num_args();
for (unsigned i = 0; i < n; i++) {
for (unsigned i = 0; i < n; ++i) {
expr * arg = pred->get_arg(i);
if (is_var(arg)) {
res++;
@ -84,7 +84,7 @@ namespace datalog {
sort_ref_buffer & new_rule_domain, expr_ref_buffer & new_rule_args, app_ref & new_pred) {
expr_ref_buffer new_args(m);
unsigned n = pred->get_num_args();
for (unsigned i = 0; i < n; i++) {
for (unsigned i = 0; i < n; ++i) {
expr * arg = pred->get_arg(i);
if (m.is_value(arg)) {
new_args.push_back(arg);
@ -135,7 +135,7 @@ namespace datalog {
out << pred_decl->get_name() << '(';
for (unsigned i = 0; i < arity; i++) {
for (unsigned i = 0; i < arity; ++i) {
expr * arg = f->get_arg(i);
if (i != 0) {
out << ',';
@ -163,7 +163,7 @@ namespace datalog {
out << "\t(";
for(unsigned i = 0; i < arity; i++) {
for(unsigned i = 0; i < arity; ++i) {
if (i != 0) {
out << ',';
}
@ -198,7 +198,7 @@ namespace datalog {
bool variable_intersection::args_match(const app * f1, const app * f2)
{
unsigned n=size();
for (unsigned i = 0; i < n; i++) {
for (unsigned i = 0; i < n; ++i) {
unsigned f1_index, f2_index;
get(i, f1_index, f2_index);
if (!values_match(f1->get_arg(f1_index),f2->get_arg(f2_index))) {
@ -215,7 +215,7 @@ namespace datalog {
}
unsigned n = m_const_indexes.size();
for(unsigned i=0; i<n; i++) {
for(unsigned i=0; i<n; ++i) {
unsigned f_index = m_const_indexes[i];
if(!values_match(f->get_arg(f_index), m_consts[i].get())) {
return false;
@ -231,11 +231,11 @@ namespace datalog {
//TODO: optimize quadratic complexity
//TODO: optimize number of checks when variable occurs multiple times
unsigned arity = a->get_num_args();
for(unsigned i1=0; i1<arity; i1++) {
for(unsigned i1=0; i1<arity; ++i1) {
expr * e1=a->get_arg(i1);
if(is_var(e1)) {
var* v1=to_var(e1);
for(unsigned i2=i1+1; i2<arity; i2++) {
for(unsigned i2=i1+1; i2<arity; ++i2) {
expr * e2=a->get_arg(i2);
if(!is_var(e2)) {
continue;
@ -264,7 +264,7 @@ namespace datalog {
reset();
count_vars(r->get_head(), 1);
unsigned n = r->get_tail_size();
for (unsigned i = 0; i < n; i++) {
for (unsigned i = 0; i < n; ++i) {
count_vars(r->get_tail(i), coef);
}
}
@ -274,7 +274,7 @@ namespace datalog {
m_scopes.push_back(0);
unsigned n = r.get_tail_size();
bool has_var = false;
for (unsigned i = 0; i < n; i++) {
for (unsigned i = 0; i < n; ++i) {
m_todo.push_back(r.get_tail(i));
m_scopes.push_back(0);
}
@ -432,7 +432,7 @@ namespace datalog {
unsigned src_ofs = src_sz - 1;
unsigned max_var_idx = 0;
for(unsigned i=0; i<src_sz; i++) {
for(unsigned i=0; i<src_sz; ++i) {
if (!src[i]) {
continue;
}
@ -445,7 +445,7 @@ namespace datalog {
unsigned tgt_sz = max_var_idx+1;
unsigned tgt_ofs = tgt_sz - 1;
tgt.resize(tgt_sz, nullptr);
for(unsigned i = 0; i < src_sz; i++) {
for(unsigned i = 0; i < src_sz; ++i) {
var* v = src[src_ofs-i];
if (!v) {
continue;
@ -490,7 +490,7 @@ namespace datalog {
SASSERT(permutation.empty() || ctr.get_positive_count()==permutation.size());
);
unsigned sz = permutation.size();
for(unsigned i=0; i<sz; i++) {
for(unsigned i=0; i<sz; ++i) {
if(i==permutation[i]) {
continue;
}
@ -514,7 +514,7 @@ namespace datalog {
SASSERT(res.empty());
identity = true;
unsigned sz = permutation.size();
for(unsigned new_i=0; new_i<sz; new_i++) {
for(unsigned new_i=0; new_i<sz; ++new_i) {
unsigned idx = permutation[new_i];
bool is_selected = translation[idx]!=UINT_MAX;
if(is_selected) {
@ -546,7 +546,7 @@ namespace datalog {
void add_sequence(unsigned start, unsigned count, unsigned_vector & v) {
unsigned after_last = start+count;
for(unsigned i=start; i<after_last; i++) {
for(unsigned i=start; i<after_last; ++i) {
v.push_back(i);
}
}

View file

@ -85,7 +85,7 @@ namespace datalog {
void copy_nonvariables(app * src, T& tgt)
{
unsigned n = src->get_num_args();
for (unsigned i = 0; i < n; i++) {
for (unsigned i = 0; i < n; ++i) {
expr * arg = src->get_arg(i);
if (!is_var(arg)) {
tgt[i] = arg;
@ -193,7 +193,7 @@ namespace datalog {
template<typename T>
void fill_into_second(const app * f1, T & tgt) const {
unsigned n = size();
for (unsigned i = 0; i < n; i++) {
for (unsigned i = 0; i < n; ++i) {
unsigned f1_index, tgt_index;
get(i, f1_index, tgt_index);
tgt[tgt_index] = f1->get_arg(f1_index);
@ -216,13 +216,13 @@ namespace datalog {
//TODO: optimize number of checks when variable occurs multiple times
unsigned a1num = expr_cont_get_size(a1);
unsigned a2num = expr_cont_get_size(a2);
for (unsigned i1 = 0; i1<a1num; i1++) {
for (unsigned i1 = 0; i1<a1num; ++i1) {
expr * e1 = expr_cont_get(a1,i1);
if (!is_var(e1)) {
continue;
}
var* v1 = to_var(e1);
for (unsigned i2 = 0; i2<a2num; i2++) {
for (unsigned i2 = 0; i2<a2num; ++i2) {
expr * e2 = expr_cont_get(a2,i2);
if (!is_var(e2)) {
continue;
@ -250,7 +250,7 @@ namespace datalog {
unsigned n = container.size();
unsigned ofs = 1;
unsigned r_i = 1;
for (unsigned i=removed_cols[0]+1; i<n; i++) {
for (unsigned i=removed_cols[0]+1; i<n; ++i) {
if (r_i!=removed_col_cnt && removed_cols[r_i]==i) {
r_i++;
ofs++;
@ -279,7 +279,7 @@ namespace datalog {
unsigned n = container.size();
unsigned ofs = 1;
unsigned r_i = 1;
for (unsigned i=removed_cols[0]+1; i<n; i++) {
for (unsigned i=removed_cols[0]+1; i<n; ++i) {
if (r_i!=removed_col_cnt && removed_cols[r_i]==i) {
r_i++;
ofs++;
@ -324,7 +324,7 @@ namespace datalog {
if (cycle_len < 2)
return;
auto aux = container[permutation_cycle[0]];
for (unsigned i = 1; i < cycle_len; i++)
for (unsigned i = 1; i < cycle_len; ++i)
container[permutation_cycle[i-1]] = container[permutation_cycle[i]];
container[permutation_cycle[cycle_len-1]] = aux;
}
@ -333,7 +333,7 @@ namespace datalog {
if (cycle_len < 2)
return;
T * aux = container.get(permutation_cycle[0]);
for (unsigned i=1; i < cycle_len; i++) {
for (unsigned i=1; i < cycle_len; ++i) {
container.set(permutation_cycle[i-1], container.get(permutation_cycle[i]));
}
container.set(permutation_cycle[cycle_len-1], aux);
@ -477,7 +477,7 @@ namespace datalog {
template<class T>
bool remove_from_vector(T & v, const typename T::data_t & el) {
unsigned sz = v.size();
for (unsigned i=0; i<sz; i++) {
for (unsigned i=0; i<sz; ++i) {
if (v[i]==el) {
std::swap(v[i], v.back());
v.pop_back();
@ -523,12 +523,12 @@ namespace datalog {
return;
}
unsigned_vector numbers;
for (unsigned i=0; i<len; i++) {
for (unsigned i=0; i<len; ++i) {
numbers.push_back(i);
}
aux__index_comparator<T> cmp(keys);
std::sort(numbers.begin(), numbers.end(), cmp);
for (unsigned i=0; i<len; i++) {
for (unsigned i=0; i<len; ++i) {
unsigned prev_i = i;
for (;;) {
unsigned src_i = numbers[prev_i];
@ -562,7 +562,7 @@ namespace datalog {
template<class Container>
void add_sequence_without_set(unsigned start, unsigned count, const Container & complement, unsigned_vector & v) {
unsigned after_last = start+count;
for (unsigned i=start; i<after_last; i++) {
for (unsigned i=start; i<after_last; ++i) {
if (!complement.contains(i)) {
v.push_back(i);
}

View file

@ -1401,7 +1401,7 @@ private:
bool fact_fail = false;
fact.reset();
for(unsigned i=0;i<pred_arity; i++) {
for(unsigned i=0;i<pred_arity; ++i) {
uint64_t const_num = args[i];
table_element c;
if(!inp_num_to_element(arg_sorts[i], const_num, c)) {

View file

@ -198,7 +198,7 @@ class horn_tactic : public tactic {
m_ctx.reset();
m_ctx.ensure_opened();
for (unsigned i = 0; i < sz; i++) {
for (unsigned i = 0; i < sz; ++i) {
f = g->form(i);
formula_kind k = get_formula_kind(f);
switch(k) {

View file

@ -50,7 +50,7 @@ namespace datalog {
unsigned sz = map.size();
unsigned ofs = sz-1;
renaming_arg.resize(sz, static_cast<expr *>(nullptr));
for (unsigned i = 0; i < sz; i++) {
for (unsigned i = 0; i < sz; ++i) {
if (map[i] != UINT_MAX) {
renaming_arg.set(ofs-i, m.mk_var(map[i], orig_sig[i]));
}
@ -74,7 +74,7 @@ namespace datalog {
void relation_signature::output(ast_manager & m, std::ostream & out) const {
unsigned sz = size();
out << "(";
for (unsigned i = 0; i < sz; i++) {
for (unsigned i = 0; i < sz; ++i) {
if (i != 0) out << ",";
out << mk_pp((*this)[i], m);
}
@ -104,16 +104,16 @@ namespace datalog {
unsigned s2sz=s2.size();
unsigned s1first_func=s1sz-s1.functional_columns();
unsigned s2first_func=s2sz-s2.functional_columns();
for (unsigned i=0; i<s1first_func; i++) {
for (unsigned i=0; i<s1first_func; ++i) {
result.push_back(s1[i]);
}
for (unsigned i=0; i<s2first_func; i++) {
for (unsigned i=0; i<s2first_func; ++i) {
result.push_back(s2[i]);
}
for (unsigned i=s1first_func; i<s1sz; i++) {
for (unsigned i=s1first_func; i<s1sz; ++i) {
result.push_back(s1[i]);
}
for (unsigned i=s2first_func; i<s2sz; i++) {
for (unsigned i=s2first_func; i<s2sz; ++i) {
result.push_back(s2[i]);
}
result.set_functional_columns(s1.functional_columns()+s2.functional_columns());
@ -185,20 +185,20 @@ namespace datalog {
union_find_default_ctx uf_ctx;
union_find<> uf(uf_ctx); //the numbers in uf correspond to column indexes after the join
for (unsigned i=0; i<join_sig_sz; i++) {
for (unsigned i=0; i<join_sig_sz; ++i) {
VERIFY(uf.mk_var() == i);
}
for (unsigned i=0; i<joined_col_cnt; i++) {
for (unsigned i=0; i<joined_col_cnt; ++i) {
unsigned idx1 = (s1_first_func>cols1[i]) ? cols1[i] : (first_func_ofs+cols1[i]-s1_first_func);
unsigned idx2 = (s2_first_func>cols2[i]) ? (second_ofs+cols2[i]) : (second_func_ofs+cols2[i]-s2_first_func);
uf.merge(idx1, idx2);
}
for (unsigned i=0; i<first_func_ofs; i++) { //we only count the non-functional columns
for (unsigned i=0; i<first_func_ofs; ++i) { //we only count the non-functional columns
remaining_in_equivalence_class[uf.find(i)]++;
}
for (unsigned i=0; i<removed_col_cnt; i++) {
for (unsigned i=0; i<removed_col_cnt; ++i) {
unsigned rc = removed_cols[i];
if (rc>=first_func_ofs) {
//removing functional columns won't make us merge rows
@ -238,13 +238,13 @@ namespace datalog {
}
void table_base::remove_facts(unsigned fact_cnt, const table_fact * facts) {
for (unsigned i = 0; i < fact_cnt; i++) {
for (unsigned i = 0; i < fact_cnt; ++i) {
remove_fact(facts[i]);
}
}
void table_base::remove_facts(unsigned fact_cnt, const table_element * facts) {
for (unsigned i = 0; i < fact_cnt; i++) {
for (unsigned i = 0; i < fact_cnt; ++i) {
remove_fact(facts + i*get_signature().size());
}
}
@ -282,7 +282,7 @@ namespace datalog {
for (auto& k : *this) {
k.get_fact(row);
bool differs = false;
for (unsigned i=0; i<non_func_cnt; i++) {
for (unsigned i=0; i<non_func_cnt; ++i) {
if (row[i]!=f[i]) {
differs = true;
}
@ -290,7 +290,7 @@ namespace datalog {
if (differs) {
continue;
}
for (unsigned i=non_func_cnt; i<sig_sz; i++) {
for (unsigned i=non_func_cnt; i<sig_sz; ++i) {
f[i]=row[i];
}
return true;
@ -377,7 +377,7 @@ namespace datalog {
warning_msg("%s", str.c_str());
}
for (table_element i = 0; i < upper_bound; i++) {
for (table_element i = 0; i < upper_bound; ++i) {
fact[0] = i;
if (empty_table || !contains_fact(fact)) {
res->add_fact(fact);
@ -429,7 +429,7 @@ namespace datalog {
void table_base::row_interface::get_fact(table_fact & result) const {
result.reset();
unsigned n = size();
for (unsigned i = 0; i < n; i++) {
for (unsigned i = 0; i < n; ++i) {
result.push_back((*this)[i]);
}
}

View file

@ -99,7 +99,7 @@ namespace datalog {
return false;
}
return memcmp(this->data(), o.data(), n*sizeof(sort))==0;
/*for (unsigned i=0; i<n; i++) {
/*for (unsigned i=0; i<n; ++i) {
if ((*this)[i]!=o[i]) {
return false;
}
@ -116,15 +116,15 @@ namespace datalog {
result.reset();
unsigned s1sz=s1.size();
for (unsigned i=0; i<s1sz; i++) {
for (unsigned i=0; i<s1sz; ++i) {
result.push_back(s1[i]);
}
unsigned s2sz=s2.size();
for (unsigned i=0; i<s2sz; i++) {
for (unsigned i=0; i<s2sz; ++i) {
result.push_back(s2[i]);
}
#if Z3DEBUG
for (unsigned i=0; i<col_cnt; i++) {
for (unsigned i=0; i<col_cnt; ++i) {
SASSERT(cols1[i]<s1sz);
SASSERT(cols2[i]<s2sz);
}
@ -170,7 +170,7 @@ namespace datalog {
const unsigned * permutation, signature & result) {
result.reset();
unsigned n = src.size();
for (unsigned i=0; i<n; i++) {
for (unsigned i=0; i<n; ++i) {
result.push_back(src[permutation[i]]);
}
}
@ -587,7 +587,7 @@ namespace datalog {
unsigned neg_sig_size = neg_t.get_signature().size();
m_overlap = false;
m_bound.resize(neg_sig_size, false);
for (unsigned i=0; i<joined_col_cnt; i++) {
for (unsigned i=0; i<joined_col_cnt; ++i) {
if (m_bound[negated_cols[i]]) {
m_overlap = true;
}
@ -607,13 +607,13 @@ namespace datalog {
void make_neg_bindings(T & tgt_neg, const U & src) const {
SASSERT(m_all_neg_bound);
SASSERT(!m_overlap);
for (unsigned i=0; i<m_joined_col_cnt; i++) {
for (unsigned i=0; i<m_joined_col_cnt; ++i) {
tgt_neg[m_cols2[i]]=src[m_cols1[i]];
}
}
template<typename T, typename U>
bool bindings_match(const T & tgt_neg, const U & src) const {
for (unsigned i=0; i<m_joined_col_cnt; i++) {
for (unsigned i=0; i<m_joined_col_cnt; ++i) {
if (tgt_neg[m_cols2[i]]!=src[m_cols1[i]]) {
return false;
}
@ -984,7 +984,7 @@ namespace datalog {
#if Z3DEBUG
unsigned first_src_fun = src.size()-src.functional_columns();
bool in_func = permutation_cycle[0]>=first_src_fun;
for (unsigned i=1;i<cycle_len;i++) {
for (unsigned i=1;i<cycle_len;++i) {
SASSERT(in_func == (permutation_cycle[i]>=first_src_fun));
}
#endif
@ -1002,7 +1002,7 @@ namespace datalog {
#if Z3DEBUG
unsigned sz = src.size();
unsigned first_src_fun = sz-src.functional_columns();
for (unsigned i=first_src_fun;i<sz;i++) {
for (unsigned i=first_src_fun;i<sz;++i) {
SASSERT(permutation[i]>=first_src_fun);
}
#endif

View file

@ -240,7 +240,7 @@ namespace datalog {
}
else {
unsigned_vector removed_cols;
for(unsigned i=0; i<src_col_cnt; i++) {
for(unsigned i=0; i<src_col_cnt; ++i) {
if(i!=col) {
removed_cols.push_back(i);
}
@ -292,7 +292,7 @@ namespace datalog {
//first remove unused source columns
int_set referenced_src_cols;
for(unsigned i=0; i<col_cnt; i++) {
for(unsigned i=0; i<col_cnt; ++i) {
if(acis[i].kind==ACK_BOUND_VAR) {
SASSERT(acis[i].source_column<src_col_cnt); //we refer only to existing columns
referenced_src_cols.insert(acis[i].source_column);
@ -304,7 +304,7 @@ namespace datalog {
unsigned_vector new_src_col_offset;
unsigned_vector src_cols_to_remove;
for(unsigned i=0; i<src_col_cnt; i++) {
for(unsigned i=0; i<src_col_cnt; ++i) {
if(!referenced_src_cols.contains(i)) {
src_cols_to_remove.push_back(i);
}
@ -316,7 +316,7 @@ namespace datalog {
curr_sig = & m_reg_signatures[curr];
//update ACK_BOUND_VAR references
for(unsigned i=0; i<col_cnt; i++) {
for(unsigned i=0; i<col_cnt; ++i) {
if(acis[i].kind==ACK_BOUND_VAR) {
unsigned col = acis[i].source_column;
acis[i].source_column = col-new_src_col_offset[col];
@ -325,7 +325,7 @@ namespace datalog {
}
//convert all result columns into bound variables by extending the source table
for(unsigned i=0; i<col_cnt; i++) {
for(unsigned i=0; i<col_cnt; ++i) {
if(acis[i].kind==ACK_BOUND_VAR) {
continue;
}
@ -352,7 +352,7 @@ namespace datalog {
//duplicate needed source columns
int_set used_cols;
for(unsigned i=0; i<col_cnt; i++) {
for(unsigned i=0; i<col_cnt; ++i) {
SASSERT(acis[i].kind==ACK_BOUND_VAR);
unsigned col=acis[i].source_column;
if(!used_cols.contains(col)) {
@ -369,7 +369,7 @@ namespace datalog {
//reorder source columns to match target
SASSERT(curr_sig->size()==col_cnt); //now the intermediate table is a permutation
for(unsigned i=0; i<col_cnt; i++) {
for(unsigned i=0; i<col_cnt; ++i) {
if(acis[i].source_column==i) {
continue;
}
@ -404,7 +404,7 @@ namespace datalog {
unsigned_vector & res) {
// TODO: this can be optimized to avoid renames in some cases
unsigned n = t->get_num_args();
for(unsigned i = 0; i<n; i++) {
for(unsigned i = 0; i<n; ++i) {
expr * e = t->get_arg(i);
if (is_var(e) && globals.get(to_var(e)->get_idx()) > 0) {
globals.update(to_var(e)->get_idx(), -1);
@ -494,7 +494,7 @@ namespace datalog {
unsigned rem_index = 0;
unsigned rem_sz = removed_cols.size();
unsigned a1len=a1->get_num_args();
for(unsigned i=0; i<a1len; i++) {
for(unsigned i=0; i<a1len; ++i) {
SASSERT(rem_index==rem_sz || removed_cols[rem_index]>=i);
if(rem_index<rem_sz && removed_cols[rem_index]==i) {
rem_index++;
@ -504,7 +504,7 @@ namespace datalog {
}
second_tail_arg_ofs = single_res_expr.size();
unsigned a2len=a2->get_num_args();
for(unsigned i=0; i<a2len; i++) {
for(unsigned i=0; i<a2len; ++i) {
SASSERT(rem_index==rem_sz || removed_cols[rem_index]>=i+a1len);
if(rem_index<rem_sz && removed_cols[rem_index]==i+a1len) {
rem_index++;
@ -523,7 +523,7 @@ namespace datalog {
SASSERT(m_reg_signatures[single_res].size() == a->get_num_args());
unsigned n=a->get_num_args();
for(unsigned i=0; i<n; i++) {
for(unsigned i=0; i<n; ++i) {
expr * arg = a->get_arg(i);
if(is_app(arg)) {
app * c = to_app(arg); //argument is a constant
@ -556,7 +556,7 @@ namespace datalog {
//enforce equality to constants
unsigned srlen=single_res_expr.size();
SASSERT((single_res==execution_context::void_register) ? (srlen==0) : (srlen==m_reg_signatures[single_res].size()));
for(unsigned i=0; i<srlen; i++) {
for(unsigned i=0; i<srlen; ++i) {
expr * exp = single_res_expr[i].get();
if(is_app(exp)) {
SASSERT(m_context.get_decl_util().is_numeral_ext(exp));
@ -642,7 +642,7 @@ namespace datalog {
}
//enforce negative predicates
for (unsigned i = pt_len; i<ut_len; i++) {
for (unsigned i = pt_len; i<ut_len; ++i) {
app * neg_tail = r->get_tail(i);
func_decl * neg_pred = neg_tail->get_decl();
variable_intersection neg_intersection(m_context.get_manager());
@ -651,7 +651,7 @@ namespace datalog {
unsigned_vector neg_cols(neg_intersection.size(), neg_intersection.get_cols2());
unsigned neg_len = neg_tail->get_num_args();
for (unsigned i = 0; i<neg_len; i++) {
for (unsigned i = 0; i<neg_len; ++i) {
expr * e = neg_tail->get_arg(i);
if (is_var(e)) {
continue;
@ -737,7 +737,7 @@ namespace datalog {
// since it constraints each unbound column at a time (reducing the
// size of intermediate results).
unsigned ft_len=r->get_tail_size(); //full tail
for(unsigned tail_index=ut_len; tail_index<ft_len; tail_index++) {
for(unsigned tail_index=ut_len; tail_index<ft_len; ++tail_index) {
app * t = r->get_tail(tail_index);
m_free_vars(t);
@ -808,7 +808,7 @@ namespace datalog {
relation_signature & head_sig = m_reg_signatures[head_reg];
svector<assembling_column_info> head_acis;
unsigned_vector head_src_cols;
for(unsigned i=0; i<head_len; i++) {
for(unsigned i=0; i<head_len; ++i) {
assembling_column_info aci;
aci.domain=head_sig[i];
@ -910,7 +910,7 @@ namespace datalog {
svector<reg_idx> tail_regs;
tail_delta_infos tail_deltas;
for(unsigned j=0;j<rule_len;j++) {
for(unsigned j=0;j<rule_len;++j) {
func_decl * tail_pred = r->get_tail(j)->get_decl();
reg_idx tail_reg = m_pred_regs.find(tail_pred);
tail_regs.push_back(tail_reg);
@ -1296,12 +1296,12 @@ namespace datalog {
//load predicate data
for(unsigned i=0;i<rule_cnt;i++) {
for(unsigned i=0;i<rule_cnt;++i) {
const rule * r = m_rule_set.get_rule(i);
ensure_predicate_loaded(r->get_decl(), acc);
unsigned rule_len = r->get_uninterpreted_tail_size();
for(unsigned j=0;j<rule_len;j++) {
for(unsigned j=0;j<rule_len;++j) {
ensure_predicate_loaded(r->get_tail(j)->get_decl(), acc);
}
}

View file

@ -100,7 +100,7 @@ namespace datalog {
const relation_signature & s, bool_vector & table_columns) {
SASSERT(table_columns.empty());
unsigned s_sz = s.size();
for(unsigned i=0; i<s_sz; i++) {
for(unsigned i=0; i<s_sz; ++i) {
table_sort t_sort;
//we don't care about the result of the conversion, just that it can be converted
bool can_be_table_column = rmgr.relation_sort_to_table(s[i], t_sort);
@ -112,7 +112,7 @@ namespace datalog {
table_signature & table_sig, relation_signature & remaining_sig) {
relation_manager & rmgr = get_manager();
unsigned n = s.size();
for(unsigned i=0; i<n; i++) {
for(unsigned i=0; i<n; ++i) {
table_sort t_sort;
if(rmgr.relation_sort_to_table(s[i], t_sort)) {
table_sig.push_back(t_sort);
@ -127,7 +127,7 @@ namespace datalog {
table_signature & table_sig, relation_signature & remaining_sig) {
relation_manager & rmgr = get_manager();
unsigned n = s.size();
for(unsigned i=0; i<n; i++) {
for(unsigned i=0; i<n; ++i) {
if(table_columns[i]) {
table_sort t_sort;
VERIFY( rmgr.relation_sort_to_table(s[i], t_sort) );
@ -153,7 +153,7 @@ namespace datalog {
#ifndef _EXTERNAL_RELEASE
unsigned s_sz = s.size();
unsigned rel_col_cnt = 0;
for(unsigned i=0; i<s_sz; i++) {
for(unsigned i=0; i<s_sz; ++i) {
if(!table_columns[i]) {
rel_col_cnt++;
}
@ -165,7 +165,7 @@ namespace datalog {
unsigned rel_sig_sz = s.size()-rel_sig_ofs;
candidate_rel_sig.append(rel_sig_sz, s.data()+rel_sig_ofs);
if(m_inner_plugin.can_handle_signature(candidate_rel_sig)) {
for(unsigned i=rel_sig_ofs; i<s_sz; i++) {
for(unsigned i=rel_sig_ofs; i<s_sz; ++i) {
table_columns[i] = false;
}
}
@ -406,7 +406,7 @@ namespace datalog {
: convenient_relation_join_fn(r1.get_signature(), r2.get_signature(), col_cnt, cols1, cols2) {
unsigned second_table_after_join_ofs = r1.m_table2sig.size();
unsigned second_inner_rel_after_join_ofs = r1.m_other2sig.size();
for(unsigned i=0;i<col_cnt; i++) {
for(unsigned i=0;i<col_cnt; ++i) {
if(!r1.is_table_column(cols1[i]) && !r2.is_table_column(cols2[i])) {
m_r_joined_cols1.push_back(r1.m_sig2other[cols1[i]]);
m_r_joined_cols2.push_back(r2.m_sig2other[cols2[i]]);
@ -432,10 +432,10 @@ namespace datalog {
unsigned r1_sig_sz = r1.get_signature().size();
unsigned r2_sig_sz = r2.get_signature().size();
for(unsigned i=0; i<r1_sig_sz; i++) {
for(unsigned i=0; i<r1_sig_sz; ++i) {
m_res_table_columns.push_back(r1.is_table_column(i));
}
for(unsigned i=0; i<r2_sig_sz; i++) {
for(unsigned i=0; i<r2_sig_sz; ++i) {
m_res_table_columns.push_back(r2.is_table_column(i));
}
@ -534,7 +534,7 @@ namespace datalog {
project_fn(const finite_product_relation & r, unsigned col_cnt, const unsigned * removed_cols)
: convenient_relation_project_fn(r.get_signature(), col_cnt, removed_cols) {
SASSERT(col_cnt>0);
for(unsigned i=0; i<col_cnt; i++) {
for(unsigned i=0; i<col_cnt; ++i) {
unsigned col = removed_cols[i];
if(r.is_table_column(col)) {
m_removed_table_cols.push_back(r.m_sig2table[col]);
@ -546,7 +546,7 @@ namespace datalog {
unsigned sig_sz = r.get_signature().size();
unsigned removed_idx = 0;
for(unsigned i=0; i<sig_sz; i++) {
for(unsigned i=0; i<sig_sz; ++i) {
if(removed_idx<col_cnt && removed_cols[removed_idx]==i) {
removed_idx++;
continue;
@ -587,7 +587,7 @@ namespace datalog {
r.garbage_collect(false);
relation_vector res_relations;
unsigned orig_rel_cnt = r.m_others.size();
for(unsigned i=0; i<orig_rel_cnt; i++) {
for(unsigned i=0; i<orig_rel_cnt; ++i) {
relation_base * orig_rel = r.m_others[i];
res_relations.push_back(orig_rel ? orig_rel->clone() : nullptr);
}
@ -611,7 +611,7 @@ namespace datalog {
if(!m_removed_rel_cols.empty()) {
unsigned res_rel_cnt = res_relations.size();
for(unsigned i=0; i<res_rel_cnt; i++) {
for(unsigned i=0; i<res_rel_cnt; ++i) {
if(res_relations[i]==0) {
continue;
}
@ -680,7 +680,7 @@ namespace datalog {
bool table_identity = true;
m_rel_identity = true;
for(unsigned new_i=0; new_i<sig_sz; new_i++) {
for(unsigned new_i=0; new_i<sig_sz; ++new_i) {
unsigned idx = permutation[new_i];
bool is_orig_table = r.is_table_column(idx);
m_res_table_columns.push_back(is_orig_table);
@ -702,14 +702,14 @@ namespace datalog {
r.garbage_collect(false);
relation_vector res_relations;
unsigned orig_rel_cnt = r.m_others.size();
for(unsigned i=0; i<orig_rel_cnt; i++) {
for(unsigned i=0; i<orig_rel_cnt; ++i) {
relation_base * orig_rel = r.m_others[i];
res_relations.push_back(orig_rel ? orig_rel->clone() : nullptr);
}
if(!m_rel_identity) {
unsigned res_rel_cnt = res_relations.size();
for(unsigned i=0; i<res_rel_cnt; i++) {
for(unsigned i=0; i<res_rel_cnt; ++i) {
if(res_relations[i]==0) {
continue;
}
@ -873,7 +873,7 @@ namespace datalog {
if(!m_common_join) {
unsigned data_cols_cnt = tgt.m_table_sig.size()-1;
for(unsigned i=0; i<data_cols_cnt; i++) {
for(unsigned i=0; i<data_cols_cnt; ++i) {
m_data_cols.push_back(i);
}
m_common_join = rmgr.mk_join_project_fn(tgt.get_table(), tgt.get_table(), m_data_cols, m_data_cols,
@ -1130,7 +1130,7 @@ namespace datalog {
filter_identical_fn(const finite_product_relation & r, unsigned col_cnt, const unsigned * identical_cols)
: m_table_filter(nullptr), m_rel_filter(nullptr), m_tr_filter(nullptr) {
finite_product_relation_plugin & plugin = r.get_plugin();
for(unsigned i=0; i<col_cnt; i++) {
for(unsigned i=0; i<col_cnt; ++i) {
unsigned col = identical_cols[i];
if(r.is_table_column(col)) {
m_table_cols.push_back(r.m_sig2table[col]);
@ -1171,7 +1171,7 @@ namespace datalog {
if(m_rel_cols.size()>1) {
r.garbage_collect(true);
unsigned rel_cnt = r.m_others.size();
for(unsigned rel_idx=0; rel_idx<rel_cnt; rel_idx++) {
for(unsigned rel_idx=0; rel_idx<rel_cnt; ++rel_idx) {
if(r.m_others[rel_idx]==0) {
continue;
}
@ -1219,7 +1219,7 @@ namespace datalog {
r.garbage_collect(false);
relation_vector & inner_rels = r.m_others;
unsigned rel_cnt = inner_rels.size();
for(unsigned i=0; i<rel_cnt; i++) {
for(unsigned i=0; i<rel_cnt; ++i) {
if(inner_rels[i]==0) {
continue;
}
@ -1292,7 +1292,7 @@ namespace datalog {
idx_set& cond_columns = rm.collect_vars(m_cond);
unsigned sig_sz = r.get_signature().size();
for(unsigned i=0; i<sig_sz; i++) {
for(unsigned i=0; i<sig_sz; ++i) {
if(r.is_table_column(i)) {
m_table_cond_columns.insert(i);
}
@ -1320,7 +1320,7 @@ namespace datalog {
//the rest of the condition on the inner relations.
unsigned_vector removed_cols;
unsigned table_data_col_cnt = r.m_table_sig.size()-1;
for(unsigned i=0; i<table_data_col_cnt; i++) {
for(unsigned i=0; i<table_data_col_cnt; ++i) {
if(m_table_local_cond_columns.contains(i)) {
m_global_origins_of_projected_columns.push_back(r.m_table2sig[i]);
}
@ -1351,7 +1351,7 @@ namespace datalog {
if(m_table_cond_columns.empty()) {
r.garbage_collect(false);
unsigned rel_cnt = r.m_others.size();
for(unsigned i=0; i<rel_cnt; i++) {
for(unsigned i=0; i<rel_cnt; ++i) {
relation_base * inner = r.m_others[i];
if(inner==nullptr) {
continue;
@ -1396,7 +1396,7 @@ namespace datalog {
const relation_base & old_rel = r.get_inner_rel(old_rel_idx);
//put the table values into the substitution
for(unsigned i=0; i<projected_data_cols; i++) {
for(unsigned i=0; i<projected_data_cols; ++i) {
unsigned orig_col_idx = m_global_origins_of_projected_columns[i];
relation_element r_el;
rmgr.table_to_relation(osig[orig_col_idx], f[i], r_el);
@ -1432,7 +1432,7 @@ namespace datalog {
if(!m_assembling_join_project) {
unsigned_vector table_cond_columns_vect;
for(unsigned i=0; i<rsig_sz; i++) {
for(unsigned i=0; i<rsig_sz; ++i) {
if(m_table_local_cond_columns.contains(i)) {
table_cond_columns_vect.push_back(i);
}
@ -1488,7 +1488,7 @@ namespace datalog {
const table_base & rtable = r.get_table();
relation_manager & rmgr = r.get_manager();
for(unsigned i=0; i<joined_col_cnt; i++) {
for(unsigned i=0; i<joined_col_cnt; ++i) {
if(r.is_table_column(r_cols[i]) && neg.is_table_column(neg_cols[i])) {
m_r_shared_table_cols.push_back(r.m_sig2table[r_cols[i]]);
m_neg_shared_table_cols.push_back(neg.m_sig2table[neg_cols[i]]);
@ -1696,7 +1696,7 @@ namespace datalog {
unsigned old_rel_idx = static_cast<unsigned>(f.back());
const relation_base & old_rel = r.get_inner_rel(old_rel_idx);
relation_base * new_rel = old_rel.clone();
for(unsigned i=0; i<m_col_cnt; i++) {
for(unsigned i=0; i<m_col_cnt; ++i) {
relation_element_ref r_el(m);
rmgr.table_to_relation(osig[m_rel_cols[i]], f[i], r_el);
scoped_ptr<relation_mutator_fn> filter = rmgr.mk_filter_equal_fn(*new_rel, r_el, m_rel_cols[i]);
@ -1783,7 +1783,7 @@ namespace datalog {
unsigned sz = rel_sig.size();
m_sig2table.resize(sz, UINT_MAX);
m_sig2other.resize(sz, UINT_MAX);
for(unsigned i=0; i<sz; i++) {
for(unsigned i=0; i<sz; ++i) {
if(table_columns[i]) {
m_sig2table[i]=m_table_sig.size();
table_sort srt;
@ -1826,7 +1826,7 @@ namespace datalog {
m_empty_rel_removal_filter() {
//m_others is now just a shallow copy, we need use clone of the relations that in it now
unsigned other_sz = m_others.size();
for(unsigned i=0; i<other_sz; i++) {
for(unsigned i=0; i<other_sz; ++i) {
if(m_others[i]==0) {
//unreferenced relation index
continue;
@ -1916,7 +1916,7 @@ namespace datalog {
if(!contiguous) {
unsigned rel_cnt = m_others.size();
for(unsigned i=0; i<rel_cnt; i++) {
for(unsigned i=0; i<rel_cnt; ++i) {
if(m_others[i]==0) {
m_available_rel_indexes.push_back(i);
}
@ -1931,7 +1931,7 @@ namespace datalog {
tf.reset();
//this is m_table_sig.size()-1 since the last column in table signature if index of the other relation
unsigned t_rel_sz = m_table2sig.size();
for(unsigned i=0; i<t_rel_sz; i++) {
for(unsigned i=0; i<t_rel_sz; ++i) {
table_element el;
unsigned sig_idx = m_table2sig[i];
rmgr.relation_to_table(sig[sig_idx], rf[sig_idx], el);
@ -1943,7 +1943,7 @@ namespace datalog {
void finite_product_relation::extract_other_fact(const relation_fact & rf, relation_fact & of) const {
of.reset();
unsigned o_sz = m_other_sig.size();
for(unsigned i=0; i<o_sz; i++) {
for(unsigned i=0; i<o_sz; ++i) {
unsigned sig_idx = m_other2sig[i];
of.push_back(rf[sig_idx]);
}
@ -2015,7 +2015,7 @@ namespace datalog {
void finite_product_relation::complement_self(func_decl* p) {
unsigned other_sz = m_others.size();
for(unsigned i=0; i<other_sz; i++) {
for(unsigned i=0; i<other_sz; ++i) {
if(m_others[i]==0) {
//unreferenced relation index
continue;
@ -2067,7 +2067,7 @@ namespace datalog {
if(!m_live_rel_collection_project) {
buffer<unsigned, false> removed_cols;
removed_cols.resize(table_data_col_cnt);
for(unsigned i=0; i<table_data_col_cnt; i++) {
for(unsigned i=0; i<table_data_col_cnt; ++i) {
removed_cols[i] = i;
}
live_rel_collection_reducer * reducer = alloc(live_rel_collection_reducer, m_live_rel_collection_acc);
@ -2102,7 +2102,7 @@ namespace datalog {
#if Z3DEBUG
unsigned encountered_live_indexes = 0;
#endif
for(unsigned rel_idx=0; rel_idx<rel_cnt; rel_idx++) {
for(unsigned rel_idx=0; rel_idx<rel_cnt; ++rel_idx) {
if(m_others[rel_idx]==0) {
continue;
}
@ -2162,7 +2162,7 @@ namespace datalog {
ptr_vector<finite_product_relation>::iterator end = rels.end();
for(; it!=end; ++it) {
finite_product_relation & rel = **it;
for(unsigned i=0; i<sig_sz; i++) {
for(unsigned i=0; i<sig_sz; ++i) {
table_cols[i] &= rel.is_table_column(i);
}
}
@ -2185,7 +2185,7 @@ namespace datalog {
unsigned_vector to_project_away; //in table signature
relation_signature moved_cols_sig;
unsigned sig_sz = get_signature().size();
for(unsigned i=0; i<sig_sz; i++) {
for(unsigned i=0; i<sig_sz; ++i) {
if(table_cols[i] && !is_table_column(i)) {
//we cannot move columns from relation into the table, only the other way round
return false;
@ -2246,7 +2246,7 @@ namespace datalog {
unsigned moved_cols_cnt = new_rel_columns.size();
unsigned next_replaced_idx = 0;
unsigned next_orig_idx = 0;
for(unsigned i=0; i<sig_sz; i++) {
for(unsigned i=0; i<sig_sz; ++i) {
if(next_replaced_idx<moved_cols_cnt && new_rel_columns[next_replaced_idx]==i) {
permutation.push_back(sig_sz-moved_cols_cnt+next_replaced_idx);
next_replaced_idx++;
@ -2283,7 +2283,7 @@ namespace datalog {
get_table().display(out);
unsigned other_sz = m_others.size();
for(unsigned i=0; i<other_sz; i++) {
for(unsigned i=0; i<other_sz; ++i) {
if(m_others[i]==0) {
//unreferenced relation index
continue;
@ -2321,7 +2321,7 @@ namespace datalog {
oit->get_fact(ofact);
out << "\t(";
for(unsigned i=0; i<sig_sz; i++) {
for(unsigned i=0; i<sig_sz; ++i) {
if(i!=0) {
out << ',';
}

View file

@ -73,7 +73,7 @@ namespace datalog {
unsigned n = register_count();
svector<std::pair<unsigned, unsigned> > sizes;
size_t total_bytes = 0;
for(unsigned i = 0; i < n; i++) {
for(unsigned i = 0; i < n; ++i) {
unsigned sz = reg(i) ? reg(i)->get_size_estimate_bytes() : 0;
total_bytes += sz;
sizes.push_back(std::make_pair(i, sz));
@ -82,7 +82,7 @@ namespace datalog {
out << "bytes " << total_bytes << "\n";
out << "bytes\trows\tannotation\n";
for(unsigned i = 0; i < n; i++) {
for(unsigned i = 0; i < n; ++i) {
unsigned sz = sizes[i].second;
unsigned rg = sizes[i].first;
unsigned rows = reg(rg) ? reg(rg)->get_size_estimate_rows() : 0;

View file

@ -77,7 +77,7 @@ namespace datalog {
bool can_handle_signature(const relation_signature & s) override {
unsigned n=s.size();
for (unsigned i=0; i<n; i++)
for (unsigned i=0; i<n; ++i)
if (!get_context().get_decl_util().is_rule_sort(s[i]))
return false;
return true;
@ -138,7 +138,7 @@ namespace datalog {
DEBUG_CODE(
unsigned sz = s.size();
for (unsigned i=0;i<sz; i++) {
for (unsigned i=0;i<sz; ++i) {
SASSERT( p.get_context().get_decl_util().is_rule_sort(s[i]) );
}
);
@ -165,7 +165,7 @@ namespace datalog {
}
unsigned n = get_signature().size();
SASSERT(f.size()==n);
for (unsigned i=0; i<n; i++) {
for (unsigned i=0; i<n; ++i) {
SASSERT(!is_undefined(i));
m_data[i] = get_plugin().mk_union(m_data[i], f[i]);
}
@ -194,7 +194,7 @@ namespace datalog {
return true;
}
unsigned n = get_signature().size();
for (unsigned i=0; i<n; i++) {
for (unsigned i=0; i<n; ++i) {
if (is_undefined(i)) {
return false;
}
@ -251,7 +251,7 @@ namespace datalog {
return;
}
unsigned sz = get_signature().size();
for (unsigned i=0; i<sz; i++) {
for (unsigned i=0; i<sz; ++i) {
if (i!=0) {
out << ", ";
}
@ -469,7 +469,7 @@ namespace datalog {
ptr_vector<expr> subst_arg;
subst_arg.resize(sz);
unsigned ofs = sz-1;
for (unsigned i=0; i<sz; i++) {
for (unsigned i=0; i<sz; ++i) {
if (r.is_undefined(i) && contains_var(m_new_rule, i))
not_handled();
subst_arg[ofs-i] = r.m_data.get(i);
@ -549,7 +549,7 @@ namespace datalog {
return;
}
unsigned sz = tgt.get_signature().size();
for (unsigned i=0; i<sz; i++) {
for (unsigned i=0; i<sz; ++i) {
if (src.is_undefined(i)) {
continue;
}
@ -720,13 +720,13 @@ namespace datalog {
app_ref_vector e_tail(m_manager);
bool_vector neg_flags;
unsigned pos_tail_sz = r->get_positive_tail_size();
for (unsigned i=0; i<pos_tail_sz; i++) {
for (unsigned i=0; i<pos_tail_sz; ++i) {
unsigned e_var = next_var++;
e_tail.push_back(get_e_lit(r->get_tail(i), e_var));
neg_flags.push_back(false);
}
unsigned tail_sz = r->get_tail_size();
for (unsigned i=pos_tail_sz; i<tail_sz; i++) {
for (unsigned i=pos_tail_sz; i<tail_sz; ++i) {
e_tail.push_back(r->get_tail(i));
neg_flags.push_back(r->is_neg_tail(i));
}
@ -734,7 +734,7 @@ namespace datalog {
symbol rule_repr = get_rule_symbol(r);
expr_ref_vector rule_expr_args(m_manager);
for (unsigned tail_idx=0; tail_idx<pos_tail_sz; tail_idx++) {
for (unsigned tail_idx=0; tail_idx<pos_tail_sz; ++tail_idx) {
app * tail = e_tail.get(tail_idx);
if (true || m_relation_level) {
//this adds the explanation term of the tail
@ -776,7 +776,7 @@ namespace datalog {
lit_args.reset();
unsigned arity = orig_decl->get_arity();
for (unsigned i=0; i<arity; i++) {
for (unsigned i=0; i<arity; ++i) {
lit_args.push_back(m_manager.mk_var(i, orig_decl->get_domain(i)));
}
app_ref orig_lit(m_manager.mk_app(orig_decl, lit_args.data()), m_manager);

View file

@ -64,7 +64,7 @@ namespace datalog {
SASSERT(t1->get_num_args()==t2->get_num_args());
int res;
unsigned n = t1->get_num_args();
for (unsigned i = 0; i < n; i++) {
for (unsigned i = 0; i < n; ++i) {
expr * a1 = t1->get_arg(i);
expr * a2 = t2->get_arg(i);
res = aux_compare(is_var(a1), is_var(a2));
@ -85,7 +85,7 @@ namespace datalog {
SASSERT(t1->get_num_args()==t2->get_num_args());
int res;
unsigned n = t1->get_num_args();
for (unsigned i=0; i<n; i++) {
for (unsigned i=0; i<n; ++i) {
if (is_var(t1->get_arg(i))) {
SASSERT(t1->get_arg(i) == t2->get_arg(i));
continue;
@ -115,7 +115,7 @@ namespace datalog {
if (res!=0) { return res; }
int pos_tail_sz = r1->get_positive_tail_size();
for (int i=-1; i<pos_tail_sz; i++) {
for (int i=-1; i<pos_tail_sz; ++i) {
app * t1 = get_by_tail_index(r1, i);
app * t2 = get_by_tail_index(r2, i);
res = aux_compare(t1->get_decl()->get_id(), t2->get_decl()->get_id());
@ -125,7 +125,7 @@ namespace datalog {
}
unsigned tail_sz = r1->get_tail_size();
for (unsigned i=pos_tail_sz; i<tail_sz; i++) {
for (unsigned i=pos_tail_sz; i<tail_sz; ++i) {
res = aux_compare(r1->get_tail(i)->get_id(), r2->get_tail(i)->get_id());
if (res!=0) { return res; }
}
@ -140,7 +140,7 @@ namespace datalog {
static int total_compare(rule * r1, rule * r2, int skipped_arg_index = INT_MAX) {
SASSERT(rough_compare(r1, r2)==0);
int pos_tail_sz = r1->get_positive_tail_size();
for (int i=-1; i<pos_tail_sz; i++) {
for (int i=-1; i<pos_tail_sz; ++i) {
int res = compare_args(get_by_tail_index(r1, i), get_by_tail_index(r2, i), skipped_arg_index);
if (res!=0) { return res; }
}
@ -175,7 +175,7 @@ namespace datalog {
static void collect_const_indexes(app * t, int tail_index, info_vector & res) {
unsigned n = t->get_num_args();
for (unsigned i=0; i<n; i++) {
for (unsigned i=0; i<n; ++i) {
if (is_var(t->get_arg(i))) {
continue;
}
@ -186,7 +186,7 @@ namespace datalog {
static void collect_const_indexes(rule * r, info_vector & res) {
collect_const_indexes(r->get_head(), -1, res);
unsigned pos_tail_sz = r->get_positive_tail_size();
for (unsigned i=0; i<pos_tail_sz; i++) {
for (unsigned i=0; i<pos_tail_sz; ++i) {
collect_const_indexes(r->get_tail(i), i, res);
}
}
@ -195,7 +195,7 @@ namespace datalog {
static void collect_orphan_consts(rule * r, const info_vector & const_infos, T & tgt) {
unsigned const_cnt = const_infos.size();
tgt.reset();
for (unsigned i=0; i<const_cnt; i++) {
for (unsigned i=0; i<const_cnt; ++i) {
const_info inf = const_infos[i];
if (inf.has_parent()) {
continue;
@ -209,7 +209,7 @@ namespace datalog {
static void collect_orphan_sorts(rule * r, const info_vector & const_infos, T & tgt) {
unsigned const_cnt = const_infos.size();
tgt.reset();
for (unsigned i=0; i<const_cnt; i++) {
for (unsigned i=0; i<const_cnt; ++i) {
const_info inf = const_infos[i];
if (inf.has_parent()) {
continue;
@ -233,7 +233,7 @@ namespace datalog {
SASSERT(vals.size()==const_cnt);
rule_vector::iterator it = first;
for (; it!=after_last; ++it) {
for (unsigned i=0; i<const_cnt; i++) {
for (unsigned i=0; i<const_cnt; ++i) {
app * pred = get_by_tail_index(*it, const_infos[i].tail_index());
app * val = to_app(pred->get_arg(const_infos[i].arg_index()));
if (vals[i]!=val) {
@ -242,7 +242,7 @@ namespace datalog {
}
}
unsigned removed_cnt = 0;
for (unsigned i=0; i<const_cnt; i++) {
for (unsigned i=0; i<const_cnt; ++i) {
if (vals[i]!=0) {
removed_cnt++;
}
@ -271,8 +271,8 @@ namespace datalog {
collect_orphan_sorts(r, const_infos, sorts);
SASSERT(vals.size()==const_cnt);
vector<unsigned_vector> possible_parents(const_cnt);
for (unsigned i=1; i<const_cnt; i++) {
for (unsigned j=0; j<i; j++) {
for (unsigned i=1; i<const_cnt; ++i) {
for (unsigned j=0; j<i; ++j) {
if (vals[i]==vals[j] && sorts[i]==sorts[j]) {
possible_parents[i].push_back(j);
}
@ -281,7 +281,7 @@ namespace datalog {
rule_vector::iterator it = first;
for (; it!=after_last; ++it) {
collect_orphan_consts(*it, const_infos, vals);
for (unsigned i=1; i<const_cnt; i++) {
for (unsigned i=1; i<const_cnt; ++i) {
unsigned_vector & ppars = possible_parents[i];
unsigned j=0;
while(j<ppars.size()) {
@ -295,11 +295,11 @@ namespace datalog {
}
}
}
for (unsigned i=0; i<const_cnt; i++) {
for (unsigned i=0; i<const_cnt; ++i) {
unsigned parent = i;
unsigned_vector & ppars = possible_parents[i];
unsigned ppars_sz = ppars.size();
for (unsigned j=0; j<ppars_sz; j++) {
for (unsigned j=0; j<ppars_sz; ++j) {
if (ppars[j]<parent) {
parent = ppars[j];
}
@ -313,7 +313,7 @@ namespace datalog {
static unsigned get_constant_count(rule * r) {
unsigned res = r->get_head()->get_num_args() - count_variable_arguments(r->get_head());
unsigned pos_tail_sz = r->get_positive_tail_size();
for (unsigned i=0; i<pos_tail_sz; i++) {
for (unsigned i=0; i<pos_tail_sz; ++i) {
res+= r->get_tail(i)->get_num_args() - count_variable_arguments(r->get_tail(i));
}
return res;
@ -375,7 +375,7 @@ namespace datalog {
ptr_vector<app> new_tail;
bool_vector new_negs;
unsigned tail_sz = r->get_tail_size();
for (unsigned i=0; i<tail_sz; i++) {
for (unsigned i=0; i<tail_sz; ++i) {
new_tail.push_back(r->get_tail(i));
new_negs.push_back(r->is_neg_tail(i));
}
@ -400,7 +400,7 @@ namespace datalog {
app * & mod_tail = (tail_idx==-1) ? new_head : new_tail[tail_idx];
ptr_vector<expr> mod_args(mod_tail->get_num_args(), mod_tail->get_args());
for (; i<const_cnt && const_infos[i].tail_index()==tail_idx; i++) { //here the outer loop counter is modified
for (; i<const_cnt && const_infos[i].tail_index()==tail_idx; ++i) { //here the outer loop counter is modified
const_info & inf = const_infos[i];
var * mod_var;
if (!inf.has_parent()) {
@ -458,7 +458,7 @@ namespace datalog {
unsigned const_cnt = get_constant_count(*first);
#if 0
for (unsigned ignored_index=0; ignored_index<const_cnt; ignored_index++) {
for (unsigned ignored_index=0; ignored_index<const_cnt; ++ignored_index) {
arg_ignoring_comparator comparator(ignored_index);
std::sort(first, after_last, comparator);
@ -513,7 +513,7 @@ namespace datalog {
m_modified = false;
unsigned init_rule_cnt = source.get_num_rules();
SASSERT(m_rules.empty());
for (unsigned i=0; i<init_rule_cnt; i++) {
for (unsigned i=0; i<init_rule_cnt; ++i) {
m_rules.push_back(source.get_rule(i));
}
@ -535,7 +535,7 @@ namespace datalog {
if (m_modified) {
result = alloc(rule_set, m_context);
unsigned fin_rule_cnt = m_result_rules.size();
for (unsigned i=0; i<fin_rule_cnt; i++) {
for (unsigned i=0; i<fin_rule_cnt; ++i) {
result->add_rule(m_result_rules.get(i));
}
result->inherit_predicates(source);

View file

@ -297,7 +297,7 @@ namespace datalog {
TRACE(dl, r->display(m_context, tout << "register "););
unsigned pos_tail_size = r->get_positive_tail_size();
for (unsigned i = 0; i < pos_tail_size; i++) {
for (unsigned i = 0; i < pos_tail_size; ++i) {
app* t = r->get_tail(i);
if (!rule_content.contains(t))
rule_content.push_back(t);
@ -305,11 +305,11 @@ namespace datalog {
m_modified_rules = true;
}
pos_tail_size = rule_content.size();
for (unsigned i = 0; i+1 < pos_tail_size; i++) {
for (unsigned i = 0; i+1 < pos_tail_size; ++i) {
app * t1 = rule_content[i];
var_idx_set t1_vars = rm.collect_vars(t1);
counter.count_vars(t1, -1); //temporarily remove t1 variables from counter
for (unsigned j = i+1; j < pos_tail_size; j++) {
for (unsigned j = i+1; j < pos_tail_size; ++j) {
app * t2 = rule_content[j];
SASSERT(t1 != t2);
counter.count_vars(t2, -1); //temporarily remove t2 variables from counter
@ -416,18 +416,18 @@ namespace datalog {
unsigned rt_sz = removed_tails.size();
//remove edges between removed tails
for (unsigned i = 0; i < rt_sz; i++) {
for (unsigned j = i+1; j < rt_sz; j++) {
for (unsigned i = 0; i < rt_sz; ++i) {
for (unsigned j = i+1; j < rt_sz; ++j) {
app_pair pair_key = get_key(removed_tails[i], removed_tails[j]);
remove_rule_from_pair(pair_key, r, original_len);
}
}
//remove edges between surviving tails and removed tails
for (unsigned i = 0; i < len; i++) {
for (unsigned i = 0; i < len; ++i) {
if (added_tails.contains(rule_content[i])) {
continue;
}
for (unsigned ri = 0; ri < rt_sz; ri++) {
for (unsigned ri = 0; ri < rt_sz; ++ri) {
app_pair pair_key = get_key(rule_content[i], removed_tails[ri]);
remove_rule_from_pair(pair_key, r, original_len);
}
@ -445,10 +445,10 @@ namespace datalog {
unsigned tail_size = r->get_tail_size();
unsigned pos_tail_size = r->get_positive_tail_size();
for (unsigned i = pos_tail_size; i < tail_size; i++) {
for (unsigned i = pos_tail_size; i < tail_size; ++i) {
counter.count_vars(r->get_tail(i), 1);
}
for (unsigned i = 0; i < len; i++) {
for (unsigned i = 0; i < len; ++i) {
counter.count_vars(rule_content[i], 1);
}
@ -461,7 +461,7 @@ namespace datalog {
var_idx_set a_tail_vars = rm.collect_vars(a_tail);
counter.count_vars(a_tail, -1); //temporarily remove a_tail variables from counter
for (unsigned i = 0; i < len; i++) {
for (unsigned i = 0; i < len; ++i) {
app * o_tail = rule_content[i]; //other tail
if (added_tails.contains(o_tail)) {
//this avoids adding edges between new tails twice
@ -507,7 +507,7 @@ namespace datalog {
func_decl * t2_pred = t2->get_decl();
app_ref_vector removed_tails(m);
app_ref_vector added_tails(m);
for (unsigned i1 = 0; i1 < len; i1++) {
for (unsigned i1 = 0; i1 < len; ++i1) {
app * rt1 = rule_content[i1];
if (rt1->get_decl() != t1_pred) {
continue;
@ -517,7 +517,7 @@ namespace datalog {
var_idx_set t1_vars = rm.collect_vars(t1);
unsigned i2start = (t1_pred == t2_pred) ? (i1+1) : 0;
for (unsigned i2 = i2start; i2 < len; i2++) {
for (unsigned i2 = i2start; i2 < len; ++i2) {
app * rt2 = rule_content[i2];
if (i1 == i2 || rt2->get_decl() != t2_pred) {
continue;
@ -636,7 +636,7 @@ namespace datalog {
vi.populate(t1, t2);
unsigned n = vi.size();
// remove contributions from joined columns.
for (unsigned i = 0; i < n; i++) {
for (unsigned i = 0; i < n; ++i) {
unsigned arg_index1, arg_index2;
vi.get(i, arg_index1, arg_index2);
expr* arg = t1->get_arg(arg_index1);
@ -718,7 +718,7 @@ namespace datalog {
ptr_vector<app> tail(content);
bool_vector negs(tail.size(), false);
unsigned or_len = orig_r->get_tail_size();
for (unsigned i = orig_r->get_positive_tail_size(); i < or_len; i++) {
for (unsigned i = orig_r->get_positive_tail_size(); i < or_len; ++i) {
tail.push_back(orig_r->get_tail(i));
negs.push_back(orig_r->is_neg_tail(i));
}

View file

@ -118,7 +118,7 @@ namespace datalog {
if(sz!=r2.size()) {
return false;
}
for(unsigned i=0; i<sz; i++) {
for(unsigned i=0; i<sz; ++i) {
if(r1[i].get_kind()!=r2[i].get_kind()) {
return false;
}
@ -169,7 +169,7 @@ namespace datalog {
m_spec_store.get_relation_spec(s, kind, spec);
relation_vector inner_rels;
unsigned rel_cnt = spec.size();
for(unsigned i=0; i<rel_cnt; i++) {
for(unsigned i=0; i<rel_cnt; ++i) {
inner_rels.push_back(get_manager().mk_empty_relation(s, spec[i]));
}
return alloc(product_relation,*this, s, inner_rels.size(), inner_rels.data());
@ -186,7 +186,7 @@ namespace datalog {
SASSERT(spec.well_formed());
relation_vector inner_rels;
unsigned rel_cnt = spec.size();
for(unsigned i=0; i<rel_cnt; i++) {
for(unsigned i=0; i<rel_cnt; ++i) {
inner_rels.push_back(get_manager().mk_full_relation(s, p, spec[i]));
}
return alloc(product_relation,*this, s, inner_rels.size(), inner_rels.data());
@ -239,7 +239,7 @@ namespace datalog {
}
unsigned sz = sig.size();
tsig.reset();
for(unsigned i=0; i<sz; i++) {
for(unsigned i=0; i<sz; ++i) {
table_sort tsort;
if(rmgr.relation_sort_to_table(sig[i], tsort)) {
tsig.push_back(tsort);
@ -624,7 +624,7 @@ namespace datalog {
~aligned_union_fn() override {
unsigned sz = m_unions.size();
for(unsigned i=0; i<sz; i++) {
for(unsigned i=0; i<sz; ++i) {
dealloc_ptr_vector_content(m_unions[i]);
}
}
@ -965,7 +965,7 @@ namespace datalog {
if (spec_changed) {
m_spec.resize(rel_cnt);
}
for (unsigned i = 0; i < rel_cnt; i++) {
for (unsigned i = 0; i < rel_cnt; ++i) {
family_id rkind = m_relations[i]->get_kind();
spec_changed |= (m_spec[i] != rkind);
m_spec[i] = rkind;
@ -1000,11 +1000,11 @@ namespace datalog {
relation_vector new_rels;
//the loop is quadratic with the number of relations, maybe we want to fix it
for(unsigned i=0; i<new_sz; i++) {
for(unsigned i=0; i<new_sz; ++i) {
family_id ikind = spec[i];
relation_base * irel = nullptr;
//we try to find the relation for the new specification among those we already have
for(unsigned j=0; j<old_sz; j++) {
for(unsigned j=0; j<old_sz; ++j) {
if(m_relations[j] && m_relations[j]->get_kind()==ikind) {
irel = m_relations[j];
m_relations[j] = 0;
@ -1037,7 +1037,7 @@ namespace datalog {
unsigned sz = size();
bool found = false;
unsigned candidate;
for(unsigned i=0; i<sz; i++) {
for(unsigned i=0; i<sz; ++i) {
relation_base & r = (*this)[i];
if(r.get_plugin().is_sieve_relation()) {
sieve_relation & sr = sieve_relation_plugin::get(r);

View file

@ -299,7 +299,7 @@ namespace datalog {
bool relation_manager::is_non_explanation(relation_signature const& s) const {
dl_decl_util & decl_util = get_context().get_decl_util();
unsigned n = s.size();
for(unsigned i = 0; i < n; i++) {
for(unsigned i = 0; i < n; ++i) {
if(decl_util.is_rule_sort(s[i])) {
return false;
}
@ -410,7 +410,7 @@ namespace datalog {
void relation_manager::from_predicate(func_decl * pred, relation_signature & result) {
result.reset();
unsigned arg_num=pred->get_arity();
for(unsigned i=0;i<arg_num; i++) {
for(unsigned i=0;i<arg_num; ++i) {
relation_sort rel_srt;
from_predicate(pred, i, rel_srt);
result.push_back(rel_srt);
@ -421,7 +421,7 @@ namespace datalog {
bool relation_manager::relation_signature_to_table(const relation_signature & from, table_signature & to) {
unsigned n=from.size();
to.resize(n);
for(unsigned i=0; i<n; i++) {
for(unsigned i=0; i<n; ++i) {
if(!relation_sort_to_table(from[i], to[i])) {
return false;
}
@ -434,7 +434,7 @@ namespace datalog {
SASSERT(s.size()==from.size());
unsigned n=from.size();
to.resize(n);
for(unsigned i=0;i<n;i++) {
for(unsigned i=0;i<n;++i) {
relation_to_table(s[i], from[i], to[i]);
}
}
@ -444,7 +444,7 @@ namespace datalog {
SASSERT(s.size()==from.size());
unsigned n=from.size();
to.resize(n);
for(unsigned i=0;i<n;i++) {
for(unsigned i=0;i<n;++i) {
table_to_relation(s[i], from[i], to[i]);
}
}
@ -944,7 +944,7 @@ namespace datalog {
for (const table_base::row_interface& row2 : t2) {
bool match=true;
for(unsigned i=0; i<m_col_cnt; i++) {
for(unsigned i=0; i<m_col_cnt; ++i) {
if(row1[m_cols1[i]]!=row2[m_cols2[i]]) {
match=false;
break;
@ -955,16 +955,16 @@ namespace datalog {
}
acc.reset();
for(unsigned i=0; i<t1first_func; i++) {
for(unsigned i=0; i<t1first_func; ++i) {
acc.push_back(row1[i]);
}
for(unsigned i=0; i<t2first_func; i++) {
for(unsigned i=0; i<t2first_func; ++i) {
acc.push_back(row2[i]);
}
for(unsigned i=t1first_func; i<t1cols; i++) {
for(unsigned i=t1first_func; i<t1cols; ++i) {
acc.push_back(row1[i]);
}
for(unsigned i=t2first_func; i<t2cols; i++) {
for(unsigned i=t2first_func; i<t2cols; ++i) {
acc.push_back(row2[i]);
}
res->add_fact(acc);
@ -1262,7 +1262,7 @@ namespace datalog {
bool should_remove(const table_fact & f) const override {
table_element val=f[m_identical_cols[0]];
for(unsigned i=1; i<m_col_cnt; i++) {
for(unsigned i=1; i<m_col_cnt; ++i) {
if(f[m_identical_cols[i]]!=val) {
return true;
}
@ -1634,7 +1634,7 @@ namespace datalog {
virtual void modify_fact(table_fact & f) const {
unsigned ofs=1;
unsigned r_i=1;
for(unsigned i=m_removed_cols[0]+1; i<m_inp_col_cnt; i++) {
for(unsigned i=m_removed_cols[0]+1; i<m_inp_col_cnt; ++i) {
if(r_i!=m_removed_col_cnt && m_removed_cols[r_i]==i) {
r_i++;
ofs++;

View file

@ -33,7 +33,7 @@ namespace datalog {
const bool * inner_columns, relation_base * inner)
: relation_base(p, s), m_inner_cols(s.size(), inner_columns), m_inner(inner) {
unsigned n = s.size();
for(unsigned i=0; i<n; i++) {
for(unsigned i=0; i<n; ++i) {
if(inner_columns && inner_columns[i]) {
unsigned inner_idx = m_inner2sig.size();
SASSERT(get_inner().get_signature()[inner_idx]==s[i]);
@ -153,7 +153,7 @@ namespace datalog {
SASSERT(inner_columns.size()==s.size());
unsigned n = s.size();
relation_signature inner_sig_singleton;
for(unsigned i=0; i<n; i++) {
for(unsigned i=0; i<n; ++i) {
inner_sig_singleton.reset();
inner_sig_singleton.push_back(s[i]);
inner_columns[i] = inner.can_handle_signature(inner_sig_singleton);
@ -172,7 +172,7 @@ namespace datalog {
SASSERT(inner_columns.size()==s.size());
inner_sig.reset();
unsigned n = s.size();
for(unsigned i=0; i<n; i++) {
for(unsigned i=0; i<n; ++i) {
if(inner_columns[i]) {
inner_sig.push_back(s[i]);
}
@ -325,7 +325,7 @@ namespace datalog {
unsigned_vector inner_cols1;
unsigned_vector inner_cols2;
for(unsigned i=0; i<col_cnt; i++) {
for(unsigned i=0; i<col_cnt; ++i) {
//if at least one end of an equality is not an inner column, we ignore that equality
//(which introduces imprecision)
if(r1_sieved && !sr1->is_inner_col(cols1[i])) {
@ -376,7 +376,7 @@ namespace datalog {
const sieve_relation & r = static_cast<const sieve_relation &>(r0);
unsigned_vector inner_removed_cols;
for(unsigned i=0; i<col_cnt; i++) {
for(unsigned i=0; i<col_cnt; ++i) {
unsigned col = removed_cols[i];
if(r.is_inner_col(col)) {
inner_removed_cols.push_back(r.get_inner_col(col));
@ -521,7 +521,7 @@ namespace datalog {
unsigned_vector inner_icols;
//we ignore the columns which do not belong to the inner relation (which introduces imprecision)
for(unsigned i=0; i<col_cnt; i++) {
for(unsigned i=0; i<col_cnt; ++i) {
unsigned col = identical_cols[i];
if(r.is_inner_col(col)) {
inner_icols.push_back(r.get_inner_col(col));
@ -572,7 +572,7 @@ namespace datalog {
expr_ref_vector subst_vect(m);
subst_vect.resize(sz);
unsigned subst_ofs = sz-1;
for(unsigned i=0; i<sz; i++) {
for(unsigned i=0; i<sz; ++i) {
if(!cond_vars.contains(i)) {
continue;
}
@ -630,7 +630,7 @@ namespace datalog {
unsigned_vector ir_cols;
unsigned_vector ineg_cols;
for(unsigned i=0; i<col_cnt; i++) {
for(unsigned i=0; i<col_cnt; ++i) {
//if at least one end of an equality is not an inner column, we ignore that equality
//(which introduces imprecision)
bool r_col_inner = r_sieved && !sr->is_inner_col(r_cols[i]);

View file

@ -127,7 +127,7 @@ namespace datalog {
unsigned ofs = 0;
unsigned sig_sz = sig.size();
unsigned first_functional = sig_sz-m_functional_col_cnt;
for (unsigned i=0; i<sig_sz; i++) {
for (unsigned i=0; i<sig_sz; ++i) {
uint64_t dom_size = sig[i];
unsigned length = get_domain_length(dom_size);
SASSERT(length>0);
@ -331,7 +331,7 @@ namespace datalog {
bool key_modified = true;
for (; ofs!=after_last; ofs+=t.m_fact_size) {
for (unsigned i=0; i<key_len; i++) {
for (unsigned i=0; i<key_len; ++i) {
table_element col_val = t.get_cell(ofs, m_key_cols[i]);
if (key[i]!=col_val) {
key[i] = col_val;
@ -399,7 +399,7 @@ namespace datalog {
SASSERT(can_handle(key_len, key_cols, t));
m_permutation.resize(key_len);
for (unsigned i=0; i<key_len; i++) {
for (unsigned i=0; i<key_len; ++i) {
//m_permutation[m_key_cols[i]] = i;
m_permutation[i] = m_key_cols[i];
}
@ -408,7 +408,7 @@ namespace datalog {
query_result get_matching_offsets(const key_value & key) const override {
unsigned key_len = m_key_cols.size();
for (unsigned i=0; i<key_len; i++) {
for (unsigned i=0; i<key_len; ++i) {
m_key_fact[m_permutation[i]] = key[i];
}
//We will change the content of the reserve; which does not change the 'high-level'
@ -534,7 +534,7 @@ namespace datalog {
return false;
}
unsigned sz = get_signature().size();
for (unsigned i=func_col_cnt; i<sz; i++) {
for (unsigned i=func_col_cnt; i<sz; ++i) {
if (t.get_cell(ofs, i)!=f[i]) {
return false;
}
@ -558,7 +558,7 @@ namespace datalog {
return false;
}
unsigned sz = sig.size();
for (unsigned i=sig.first_functional(); i<sz; i++) {
for (unsigned i=sig.first_functional(); i<sz; ++i) {
f[i] = t.get_cell(ofs, i);
}
return true;
@ -583,7 +583,7 @@ namespace datalog {
return;
}
unsigned sz = sig.size();
for (unsigned i=sig.first_functional(); i<sz; i++) {
for (unsigned i=sig.first_functional(); i<sz; ++i) {
set_cell(ofs, i, f[i]);
}
}
@ -603,7 +603,7 @@ namespace datalog {
void sparse_table::copy_columns(const column_layout & src_layout, const column_layout & dest_layout,
unsigned start_index, unsigned after_last, const char * src, char * dest,
unsigned & dest_idx, unsigned & pre_projection_idx, const unsigned * & next_removed) {
for (unsigned i=start_index; i<after_last; i++, pre_projection_idx++) {
for (unsigned i=start_index; i<after_last; ++i, ++pre_projection_idx) {
if (*next_removed == pre_projection_idx) {
next_removed++;
continue;
@ -691,7 +691,7 @@ namespace datalog {
key_indexer::query_result t2_offsets;
for (; t1idx != t1end; t1idx += t1_entry_size) {
for (unsigned i = 0; i < joined_col_cnt; i++) {
for (unsigned i = 0; i < joined_col_cnt; ++i) {
table_element val = t1.m_column_layout.get(t1.get_at_offset(t1idx), t1_joined_cols[i]);
TRACE(dl_table_relation, tout << "val: " << val << " " << t1idx << " " << t1_joined_cols[i] << "\n";);
if (t1_key[i] != val) {
@ -925,7 +925,7 @@ namespace datalog {
const sparse_table::column_layout & tgt_layout) {
unsigned r_idx=0;
unsigned tgt_i=0;
for (unsigned i=0; i<m_inp_col_cnt; i++) {
for (unsigned i=0; i<m_inp_col_cnt; ++i) {
if (r_idx!=m_removed_col_cnt && i == m_removed_cols[r_idx]) {
SASSERT(r_idx<m_removed_col_cnt);
r_idx++;
@ -1010,7 +1010,7 @@ namespace datalog {
char * res_reserve = res->m_data.get_reserve_ptr();
unsigned res_i = 0;
for (unsigned i=0; i<t_cols; i++) {
for (unsigned i=0; i<t_cols; ++i) {
if (i == m_col) {
continue;
}
@ -1166,7 +1166,7 @@ namespace datalog {
store_offset t1_after_last = t1.m_data.after_last_offset();
for (store_offset t1_ofs=0; t1_ofs<t1_after_last; t1_ofs+=t1_entry_size) {
for (unsigned i=0; i<joined_col_cnt; i++) {
for (unsigned i=0; i<joined_col_cnt; ++i) {
table_element val = t1.get_cell(t1_ofs, cols1[i]);
if (t1_key[i]!=val) {
t1_key[i]=val;

View file

@ -66,7 +66,7 @@ namespace datalog {
const table_fact & row2 = *els2it;
bool match=true;
for(unsigned i=0; i<m_joined_col_cnt; i++) {
for(unsigned i=0; i<m_joined_col_cnt; ++i) {
if(row1[m_cols1[i]]!=row2[m_cols2[i]]) {
match=false;
break;

View file

@ -471,7 +471,7 @@ namespace datalog {
out << "\t(";
for(unsigned i=0;i<arity;i++) {
for(unsigned i=0;i<arity;++i) {
if(i!=0) {
out << ',';
}

View file

@ -490,7 +490,7 @@ namespace datalog {
default: {
rel_spec rel_kinds; // kinds of plugins that are not table plugins
family_id rel_kind; // the aggregate kind of non-table plugins
for (unsigned i = 0; i < relation_name_cnt; i++) {
for (unsigned i = 0; i < relation_name_cnt; ++i) {
relation_plugin & p = get_ordinary_relation_plugin(relation_names[i]);
rel_kinds.push_back(p.get_kind());
}

View file

@ -98,7 +98,7 @@ bool lemma_cluster::match(const expr_ref &e, substitution &sub) {
return m_arith.is_numeral(e) || m_bv.is_numeral(e);
};
// All the matches should be numerals
for (unsigned i = 0; i < n_binds; i++) {
for (unsigned i = 0; i < n_binds; ++i) {
sub.get_binding(i, var, r);
if (!is_numeral(r.get_expr())) return false;
}
@ -149,7 +149,7 @@ void lemma_cluster::rm_subsumed(lemma_info_vector &removed_lemmas) {
lemma_info_vector keep;
for (auto lem : m_lemma_vec) {
bool found = false;
for (unsigned i = 0; i < r->size(); i++) {
for (unsigned i = 0; i < r->size(); ++i) {
if (lem.get_lemma()->get_expr() == r->form(i)) {
found = true;
keep.push_back(lem);

View file

@ -654,7 +654,7 @@ void lemma::add_binding(app_ref_vector const &binding) {
TRACE(spacer,
tout << "new binding: ";
for (unsigned i = 0; i < binding.size(); i++)
for (unsigned i = 0; i < binding.size(); ++i)
tout << mk_pp(binding.get(i), m) << " ";
tout << "\n";);
}
@ -906,7 +906,7 @@ const datalog::rule *pred_transformer::find_rule(model &model,
num_reuse_reach = 0;
reach_pred_used.reset();
unsigned tail_sz = r->get_uninterpreted_tail_size();
for (unsigned i = 0; i < tail_sz; i++) {
for (unsigned i = 0; i < tail_sz; ++i) {
bool used = false;
func_decl* d = r->get_tail(i)->get_decl();
const pred_transformer &pt = ctx.get_pred_transformer(d);
@ -935,7 +935,7 @@ void pred_transformer::find_predecessors(datalog::rule const& r, ptr_vector<func
{
preds.reset();
unsigned tail_sz = r.get_uninterpreted_tail_size();
for (unsigned ti = 0; ti < tail_sz; ti++) {
for (unsigned ti = 0; ti < tail_sz; ++ti) {
preds.push_back(r.get_tail(ti)->get_decl());
}
}
@ -1009,7 +1009,7 @@ void pred_transformer::add_lemma_from_child (pred_transformer& child,
ground_expr(to_quantifier(l)->get_expr(), grnd_lemma, tmp);
inst.push_back(grnd_lemma);
}
for (unsigned j=0; j < inst.size(); j++) {
for (unsigned j=0; j < inst.size(); ++j) {
inst.set(j, m.mk_implies(a, inst.get(j)));
}
if (lemma->is_ground() || (get_context().use_qlemmas() && !ground_only)) {
@ -1256,7 +1256,7 @@ void pred_transformer::get_pred_bg_invs(expr_ref_vector& out) {
datalog::rule const &r = kv.m_value->rule();
find_predecessors (r, preds);
for (unsigned i = 0, preds_sz = preds.size(); i < preds_sz; i++) {
for (unsigned i = 0, preds_sz = preds.size(); i < preds_sz; ++i) {
func_decl* pre = preds[i];
pred_transformer &pt = ctx.get_pred_transformer(pre);
const lemma_ref_vector &invs = pt.get_bg_invs();
@ -1389,7 +1389,7 @@ lbool pred_transformer::is_reachable(pob& n, expr_ref_vector* core,
datalog::rule const* r = &kv.m_value->rule();
find_predecessors(*r, m_predicates);
if (m_predicates.empty()) {continue;}
for (unsigned i = 0; i < m_predicates.size(); i++) {
for (unsigned i = 0; i < m_predicates.size(); ++i) {
const pred_transformer &pt =
ctx.get_pred_transformer(m_predicates[i]);
if (pt.has_rfs()) {
@ -1578,7 +1578,7 @@ void pred_transformer::mk_assumptions(func_decl* head, expr* fml,
expr* tag = kv.m_value->tag();
datalog::rule const& r = kv.m_value->rule();
find_predecessors(r, m_predicates);
for (unsigned i = 0; i < m_predicates.size(); i++) {
for (unsigned i = 0; i < m_predicates.size(); ++i) {
func_decl* d = m_predicates[i];
if (d == head) {
tmp1 = m.mk_implies(tag, fml);
@ -1767,7 +1767,7 @@ void pred_transformer::init_atom(decl2rel const &pts, app *atom,
unsigned arity = atom->get_num_args();
func_decl* head = atom->get_decl();
pred_transformer& pt = *pts.find(head);
for (unsigned i = 0; i < arity; i++) {
for (unsigned i = 0; i < arity; ++i) {
app_ref rep(m);
if (tail_idx == UINT_MAX) {
@ -2840,7 +2840,7 @@ unsigned context::get_cex_depth()
pts.push_back (nullptr); // cex depth marker
// bfs traversal of the query derivation tree
for (unsigned curr = 0; curr < pts.size (); curr++) {
for (unsigned curr = 0; curr < pts.size (); ++curr) {
// get current pt and fact
pt = pts.get (curr);
// check for depth marker
@ -2859,7 +2859,7 @@ unsigned context::get_cex_depth()
// add child facts and pts
facts.append (fact->get_justifications ());
pt->find_predecessors (*r, preds);
for (unsigned j = 0; j < preds.size (); j++) {
for (unsigned j = 0; j < preds.size (); ++j) {
pts.push_back (&(get_pred_transformer (preds[j])));
}
}
@ -2915,7 +2915,7 @@ void context::get_rules_along_trace(datalog::rule_ref_vector& rules)
pts.push_back (&(get_pred_transformer (preds[0])));
// populate rules according to a preorder traversal of the query derivation tree
for (unsigned curr = 0; curr < pts.size (); curr++) {
for (unsigned curr = 0; curr < pts.size (); ++curr) {
// get current pt and fact
pt = pts.get (curr);
fact = facts.get (curr);
@ -2928,7 +2928,7 @@ void context::get_rules_along_trace(datalog::rule_ref_vector& rules)
// add child facts and pts
facts.append (fact->get_justifications ());
pt->find_predecessors (*r, preds);
for (unsigned j = 0; j < preds.size (); j++) {
for (unsigned j = 0; j < preds.size (); ++j) {
pts.push_back (&(get_pred_transformer (preds[j])));
}
}
@ -3063,7 +3063,7 @@ lbool context::solve_core (unsigned from_lvl)
return l_false;
}
for (unsigned i = 0; i < m_callbacks.size(); i++){
for (unsigned i = 0; i < m_callbacks.size(); ++i){
if (m_callbacks[i]->unfold())
m_callbacks[i]->unfold_eh();
}
@ -3398,7 +3398,7 @@ bool context::is_reachable(pob &n)
void context::predecessor_eh()
{
for (unsigned i = 0; i < m_callbacks.size(); i++) {
for (unsigned i = 0; i < m_callbacks.size(); ++i) {
if (m_callbacks[i]->predecessor())
m_callbacks[i]->predecessor_eh();
}
@ -3419,7 +3419,7 @@ bool pred_transformer::mk_mdl_rf_consistent(const datalog::rule *r,
SASSERT(r != nullptr);
ptr_vector<func_decl> preds;
find_predecessors(*r, preds);
for (unsigned i = 0; i < preds.size(); i++) {
for (unsigned i = 0; i < preds.size(); ++i) {
func_decl *pred = preds[i];
bool atleast_one_true = false;
pred_transformer &ch_pt = ctx.get_pred_transformer(pred);
@ -3871,7 +3871,7 @@ bool context::propagate(unsigned min_prop_lvl,
log_propagate();
for (unsigned lvl = min_prop_lvl; lvl <= full_prop_lvl; lvl++) {
for (unsigned lvl = min_prop_lvl; lvl <= full_prop_lvl; ++lvl) {
IF_VERBOSE (1,
if (lvl > max_prop_lvl && lvl == max_prop_lvl + 1)
verbose_stream () << " ! ";
@ -3932,7 +3932,7 @@ reach_fact *pred_transformer::mk_rf(pob& n, model &mdl, const datalog::rule& r)
path_cons.push_back (get_transition (r));
app_ref_vector vars (m);
for (unsigned i = 0; i < preds.size (); i++) {
for (unsigned i = 0; i < preds.size (); ++i) {
func_decl* pred = preds[i];
pred_transformer& ch_pt = ctx.get_pred_transformer (pred);
// get a reach fact of body preds used in the model
@ -3942,7 +3942,7 @@ reach_fact *pred_transformer::mk_rf(pob& n, model &mdl, const datalog::rule& r)
pm.formula_n2o (kid->get (), o_ch_reach, i);
path_cons.push_back (o_ch_reach);
// collect o-vars to eliminate
for (unsigned j = 0; j < pred->get_arity (); j++)
for (unsigned j = 0; j < pred->get_arity (); ++j)
{ vars.push_back(m.mk_const(pm.o2o(ch_pt.sig(j), 0, i))); }
const ptr_vector<app> &v = kid->aux_vars ();
@ -4285,7 +4285,7 @@ void context::add_constraint (expr *c, unsigned level)
void context::new_lemma_eh(pred_transformer &pt, lemma *lem) {
bool handle=false;
for (unsigned i = 0; i < m_callbacks.size(); i++) {
for (unsigned i = 0; i < m_callbacks.size(); ++i) {
handle|=m_callbacks[i]->new_lemma();
}
if (!handle)
@ -4298,7 +4298,7 @@ void context::new_lemma_eh(pred_transformer &pt, lemma *lem) {
}
expr *app = m.mk_app(pt.head(), pt.sig_size(), args.data());
expr *lemma = m.mk_implies(app, lem->get_expr());
for (unsigned i = 0; i < m_callbacks.size(); i++) {
for (unsigned i = 0; i < m_callbacks.size(); ++i) {
if (m_callbacks[i]->new_lemma())
m_callbacks[i]->new_lemma_eh(lemma, lem->level());
}

View file

@ -25,15 +25,15 @@ namespace {
#ifdef Z3DEBUG
bool is_int_matrix(const spacer::spacer_matrix &matrix) {
for (unsigned i = 0, rows = matrix.num_rows(); i < rows; i++)
for (unsigned j = 0, cols = matrix.num_cols(); j < cols; j++)
for (unsigned i = 0, rows = matrix.num_rows(); i < rows; ++i)
for (unsigned j = 0, cols = matrix.num_cols(); j < cols; ++j)
if (!matrix.get(i, j).is_int())
return false;
return true;
}
bool is_sorted(const vector<rational> &data) {
for (unsigned i = 0; i < data.size() - 1; i++)
for (unsigned i = 0; i < data.size() - 1; ++i)
if (!(data[i] >= data[i + 1]))
return false;
return true;
@ -201,7 +201,7 @@ void convex_closure::cc_col2eq(unsigned col, expr_ref_vector &out) {
SASSERT(!has_bv());
expr_ref_buffer sum(m);
for (unsigned row = 0, sz = m_data.num_rows(); row < sz; row++) {
for (unsigned row = 0, sz = m_data.num_rows(); row < sz; ++row) {
expr_ref alpha(m);
auto n = m_data.get(row, col);
if (n.is_zero()) {
@ -229,7 +229,7 @@ void convex_closure::cc2fmls(expr_ref_vector &out) {
sort_ref real_sort(m_arith.mk_real(), m);
expr_ref zero(m_arith.mk_real(rational::zero()), m);
for (unsigned row = 0, sz = m_data.num_rows(); row < sz; row++) {
for (unsigned row = 0, sz = m_data.num_rows(); row < sz; ++row) {
if (row >= m_alphas.size()) {
m_alphas.push_back(m.mk_fresh_const("a!cc", real_sort));
}
@ -238,7 +238,7 @@ void convex_closure::cc2fmls(expr_ref_vector &out) {
out.push_back(m_arith.mk_ge(m_alphas.get(row), zero));
}
for (unsigned k = 0, sz = m_col_vars.size(); k < sz; k++) {
for (unsigned k = 0, sz = m_col_vars.size(); k < sz; ++k) {
if (m_col_vars.get(k) && !m_dead_cols[k]) cc_col2eq(k, out);
}
@ -276,7 +276,7 @@ bool convex_closure::infer_div_pred(const vector<rational> &data, rational &m,
rational bnd(MAX_DIV_BOUND);
rational big = data.back();
// AG: why (m < big)? Note that 'big' is the smallest element of data
for (; m < big && m < bnd; m++) {
for (; m < big && m < bnd; ++m) {
if (is_congruent_mod(data, m)) break;
}
if (m >= big) return false;
@ -362,7 +362,7 @@ void convex_closure::cc_1dim(const expr_ref &var, expr_ref_vector &out) {
// -- compute divisibility constraints
rational cr, off;
// add div constraints for all variables.
for (unsigned j = 0; j < m_data.num_cols(); j++) {
for (unsigned j = 0; j < m_data.num_cols(); ++j) {
auto *v = m_col_vars.get(j);
if (v && (m_arith.is_int(v) || m_bv.is_bv(v))) {
data.reset();

View file

@ -118,7 +118,7 @@ void lemma_expand_bnd_generalizer::operator()(lemma_ref &lemma) {
expr_ref lit(m), new_lit(m);
rational bnd;
// for every literal
for (unsigned i = 0, sz = cube.size(); i < sz; i++) {
for (unsigned i = 0, sz = cube.size(); i < sz; ++i) {
lit = cube.get(i);
if (m.is_true(lit)) continue;
if (!is_arith_comp(lit, bnd, m)) continue;

View file

@ -102,7 +102,7 @@ bool contains_bv(ast_manager &m, const substitution &sub, unsigned &sz) {
std::pair<unsigned, unsigned> v;
expr_offset r;
rational num;
for (unsigned j = 0, sz = sub.get_num_bindings(); j < sz; j++) {
for (unsigned j = 0, sz = sub.get_num_bindings(); j < sz; ++j) {
sub.get_binding(j, v, r);
if (m_bv.is_numeral(r.get_expr(), num, sz)) return true;
}
@ -117,7 +117,7 @@ bool all_same_sz(ast_manager &m, const substitution &sub, unsigned sz) {
expr_offset r;
rational num;
unsigned n_sz;
for (unsigned j = 0; j < sub.get_num_bindings(); j++) {
for (unsigned j = 0; j < sub.get_num_bindings(); ++j) {
sub.get_binding(j, v, r);
if (!m_bv.is_numeral(r.get_expr(), num, n_sz) || n_sz != sz)
return false;
@ -169,7 +169,7 @@ void lemma_global_generalizer::subsumer::mk_col_names(const lemma_cluster &lc) {
const substitution &sub = lemmas.get(0).get_sub();
m_col_names.reserve(sub.get_num_bindings());
for (unsigned j = 0, sz = sub.get_num_bindings(); j < sz; j++) {
for (unsigned j = 0, sz = sub.get_num_bindings(); j < sz; ++j) {
sub.get_binding(j, v, r);
auto *sort = r.get_expr()->get_sort();
auto i = v.first;
@ -211,7 +211,7 @@ void lemma_global_generalizer::subsumer::setup_cvx_closure(
}
unsigned i;
for (unsigned j = 0; j < n_vars; j++) {
for (unsigned j = 0; j < n_vars; ++j) {
sub.get_binding(j, v, r);
i = v.first;
SASSERT(0 <= i && i < n_vars);
@ -238,7 +238,7 @@ void lemma_global_generalizer::subsumer::setup_cvx_closure(
row.reserve(n_vars);
const substitution &sub = lemma.get_sub();
for (unsigned j = 0, sz = sub.get_num_bindings(); j < sz; j++) {
for (unsigned j = 0, sz = sub.get_num_bindings(); j < sz; ++j) {
sub.get_binding(j, v, r);
i = v.first;
VERIFY(is_numeral(r.get_expr(), num));
@ -276,7 +276,7 @@ void lemma_global_generalizer::subsumer::skolemize_for_quic3(
expr_fast_mark2 marks;
for (auto *c : f_cnsts) { marks.mark(c); }
for (unsigned i = 0, sz = m_col_names.size(); i < sz; i++) {
for (unsigned i = 0, sz = m_col_names.size(); i < sz; ++i) {
app *c = m_col_names.get(i);
if (!marks.is_marked(c)) continue;
@ -488,7 +488,7 @@ bool lemma_global_generalizer::subsumer::over_approximate(expr_ref_vector &a,
expr_ref_buffer res(m);
// remove all expressions whose tags are false
for (unsigned i = 0, sz = tags.size(); i < sz; i++) {
for (unsigned i = 0, sz = tags.size(); i < sz; ++i) {
if (!m.is_not(tags.get(i))) { res.push_back(a.get(i)); }
}
a.reset();

View file

@ -72,7 +72,7 @@ void qe_project(ast_manager& m, app_ref_vector& vars, expr_ref& fml, model_ref&
proof_ref pr(m.mk_asserted(m.mk_true()), m);
expr_ref bval(m);
model::scoped_model_completion _scm(*M, true);
for (unsigned i = 0; i < vars.size(); i++) {
for (unsigned i = 0; i < vars.size(); ++i) {
if (m.is_bool(vars.get(i))) {
// obtain the interpretation of the ith var using model completion
bval = (*M)(vars.get(i));

View file

@ -63,7 +63,7 @@ void model_evaluator::setup_model(const model_ref& model)
m_model = model.get();
rational r;
unsigned sz = model->get_num_constants();
for (unsigned i = 0; i < sz; i++) {
for (unsigned i = 0; i < sz; ++i) {
func_decl * d = model->get_constant(i);
expr* val = model->get_const_interp(d);
expr* e = m.mk_const(d);

View file

@ -128,7 +128,7 @@ bool spacer_matrix::is_lin_reltd(unsigned i, unsigned j, rational &coeff1,
coeff2 = m_matrix[1][i] - m_matrix[0][i];
off = (m_matrix[0][i] * m_matrix[1][j]) - (m_matrix[1][i] * m_matrix[0][j]);
for (unsigned k = 0; k < m_num_rows; k++) {
for (unsigned k = 0; k < m_num_rows; ++k) {
if (((coeff1 * m_matrix[k][i]) + (coeff2 * m_matrix[k][j]) + off) !=
rational::zero()) {
TRACE(cvx_dbg_verb,
@ -156,8 +156,8 @@ bool spacer_matrix::compute_linear_deps(spacer_matrix &eq) const {
vector<rational> lin_dep;
lin_dep.reserve(m_num_cols + 1);
for (unsigned i = 0; i < m_num_cols; i++) {
for (unsigned j = i + 1; j < m_num_cols; j++) {
for (unsigned i = 0; i < m_num_cols; ++i) {
for (unsigned j = i + 1; j < m_num_cols; ++j) {
if (is_lin_reltd(i, j, coeff1, coeff2, off)) {
SASSERT(!(coeff1 == 0 && coeff2 == 0 && off == 0));
lin_dep[i] = coeff1;

View file

@ -109,7 +109,7 @@ unsigned prop_solver::level_cnt() const
void prop_solver::assert_level_atoms(unsigned level)
{
unsigned lev_cnt = level_cnt();
for (unsigned i = 0; i < lev_cnt; i++) {
for (unsigned i = 0; i < lev_cnt; ++i) {
bool active = m_delta_level ? i == level : i >= level;
app * lev_atom =
active ? m_neg_level_atoms.get(i) : m_pos_level_atoms.get(i);

View file

@ -92,7 +92,7 @@ peq::peq(app *p, ast_manager &m)
VERIFY(is_partial_eq(p));
SASSERT(m_arr_u.is_array(m_lhs) && m_arr_u.is_array(m_rhs) &&
ast_eq_proc()(m_lhs->get_sort(), m_rhs->get_sort()));
for (unsigned i = 2; i < p->get_num_args(); i++) {
for (unsigned i = 2; i < p->get_num_args(); ++i) {
m_diff_indices.push_back(p->get_arg(i));
}
}
@ -106,7 +106,7 @@ peq::peq(expr *lhs, expr *rhs, unsigned num_indices, expr *const *diff_indices,
ptr_vector<sort> sorts;
sorts.push_back(m_lhs->get_sort());
sorts.push_back(m_rhs->get_sort());
for (unsigned i = 0; i < num_indices; i++) {
for (unsigned i = 0; i < num_indices; ++i) {
sorts.push_back(diff_indices[i]->get_sort());
m_diff_indices.push_back(diff_indices[i]);
}
@ -119,7 +119,7 @@ void peq::lhs(expr_ref &result) { result = m_lhs; }
void peq::rhs(expr_ref &result) { result = m_rhs; }
void peq::get_diff_indices(expr_ref_vector &result) {
for (unsigned i = 0; i < m_diff_indices.size(); i++) {
for (unsigned i = 0; i < m_diff_indices.size(); ++i) {
result.push_back(m_diff_indices.get(i));
}
}
@ -531,12 +531,12 @@ class arith_project_util {
rational lcm_coeffs(1), lcm_divs(1);
if (a.is_int(m_var->x())) {
// lcm of (absolute values of) coeffs
for (unsigned i = 0; i < m_lits.size(); i++) {
for (unsigned i = 0; i < m_lits.size(); ++i) {
lcm_coeffs = lcm(lcm_coeffs, abs(m_coeffs[i]));
}
// normalize coeffs of x to +/-lcm_coeffs and scale terms and divs
// appropriately; find lcm of scaled-up divs
for (unsigned i = 0; i < m_lits.size(); i++) {
for (unsigned i = 0; i < m_lits.size(); ++i) {
rational factor(lcm_coeffs / abs(m_coeffs[i]));
if (!factor.is_one() && !a.is_zero(m_terms.get(i)))
m_terms[i] = a.mk_mul(a.mk_numeral(factor, a.mk_int()),
@ -631,7 +631,7 @@ class arith_project_util {
TRACE(qe, tout << "Substitution for (lcm_coeffs * x): "
<< mk_pp(x_term_val, m) << "\n";);
}
for (unsigned i = 0; i < m_lits.size(); i++) {
for (unsigned i = 0; i < m_lits.size(); ++i) {
if (!m_divs[i].is_zero()) {
// m_divs[i] | (x_term_val + m_terms[i])
@ -1031,7 +1031,7 @@ class arith_project_util {
app *a = to_app(fml);
expr_ref_vector children(m);
expr_ref ch(m);
for (unsigned i = 0; i < a->get_num_args(); i++) {
for (unsigned i = 0; i < a->get_num_args(); ++i) {
ch = a->get_arg(i);
mod2div(ch, map);
children.push_back(ch);
@ -1114,7 +1114,7 @@ class arith_project_util {
void substitute(expr_ref &fml, app_ref_vector &lits, expr_map &map) {
expr_substitution sub(m);
// literals
for (unsigned i = 0; i < lits.size(); i++) {
for (unsigned i = 0; i < lits.size(); ++i) {
expr *new_lit = nullptr;
proof *pr = nullptr;
app *old_lit = lits.get(i);
@ -1400,7 +1400,7 @@ class array_project_eqs_util {
expr_ref val(m);
unsigned num_diff = diff_val_consts.size();
SASSERT(num_diff == I.size());
for (unsigned i = 0; i < num_diff; i++) {
for (unsigned i = 0; i < num_diff; ++i) {
// mk val term
ptr_vector<expr> sel_args;
sel_args.push_back(arr);
@ -1458,7 +1458,7 @@ class array_project_eqs_util {
if (!I.empty()) {
expr_ref val(m);
m_mev.eval(*M, idx, val);
for (unsigned i = 0; i < I.size() && !idx_in_I; i++) {
for (unsigned i = 0; i < I.size() && !idx_in_I; ++i) {
if (idx == I.get(i)) {
idx_in_I = true;
} else {
@ -1525,7 +1525,7 @@ class array_project_eqs_util {
tout << mk_pp(p_exp, m) << "\n";
for (unsigned i = m_aux_lits_v.size() - m_aux_vars.size();
i < m_aux_lits_v.size();
i++) { tout << mk_pp(m_aux_lits_v.get(i), m) << "\n"; });
++i) { tout << mk_pp(m_aux_lits_v.get(i), m) << "\n"; });
// find subst_term
bool stores_on_rhs = true;
@ -1553,10 +1553,10 @@ class array_project_eqs_util {
TRACE(
qe, tout << "array equalities:\n";
for (unsigned i = 0; i < eqs.size();
i++) { tout << mk_pp(eqs.get(i), m) << "\n"; });
++i) { tout << mk_pp(eqs.get(i), m) << "\n"; });
// evaluate eqs in M
for (unsigned i = 0; i < eqs.size(); i++) {
for (unsigned i = 0; i < eqs.size(); ++i) {
TRACE(qe, tout << "array equality:\n";
tout << mk_pp(eqs.get(i), m) << "\n";);
@ -1586,7 +1586,7 @@ class array_project_eqs_util {
// ...
unsigned num_true_eqs = true_eqs.size();
vector<unsigned> nds(num_true_eqs);
for (unsigned i = 0; i < num_true_eqs; i++) {
for (unsigned i = 0; i < num_true_eqs; ++i) {
app *eq = true_eqs.get(i);
expr *lhs = eq->get_arg(0);
expr *rhs = eq->get_arg(1);
@ -1607,7 +1607,7 @@ class array_project_eqs_util {
unsigned nd = 0; // nesting depth
if (store) {
for (nd = 1; m_arr_u.is_store(store);
nd++, store = to_app(store->get_arg(0)))
++nd, store = to_app(store->get_arg(0)))
/* empty */;
SASSERT(store == m_v);
}
@ -1618,7 +1618,7 @@ class array_project_eqs_util {
// sort true_eqs according to nesting depth
// use insertion sort
for (unsigned i = 1; i < num_true_eqs; i++) {
for (unsigned i = 1; i < num_true_eqs; ++i) {
app_ref eq(m);
eq = true_eqs.get(i);
unsigned nd = nds.get(i);
@ -1635,7 +1635,7 @@ class array_project_eqs_util {
}
// search for subst term
for (unsigned i = 0; !m_subst_term_v && i < num_true_eqs; i++) {
for (unsigned i = 0; !m_subst_term_v && i < num_true_eqs; ++i) {
app *eq = true_eqs.get(i);
m_true_sub_v.insert(eq, m.mk_true());
// try to find subst term
@ -1681,7 +1681,7 @@ class array_project_eqs_util {
app_ref_vector rem_arr_vars(m); // remaining arr vars
M = &mdl;
for (unsigned i = 0; i < arr_vars.size(); i++) {
for (unsigned i = 0; i < arr_vars.size(); ++i) {
reset_v();
m_v = arr_vars.get(i);
if (!m_arr_u.is_array(m_v)) {
@ -1881,7 +1881,7 @@ class array_select_reducer {
m_reduce_all_selects = reduce_all_selects;
// mark vars to eliminate
for (unsigned i = 0; i < arr_vars.size(); i++) {
for (unsigned i = 0; i < arr_vars.size(); ++i) {
m_arr_test.mark(arr_vars.get(i), true);
}
@ -1990,7 +1990,7 @@ class array_project_selects_util {
for (app *a : sel_terms) {
vals.reset();
idxs.reset();
for (unsigned i = 0; i < sz; i++) {
for (unsigned i = 0; i < sz; ++i) {
expr *idx = a->get_arg(i + 1);
m_mev.eval(*M, idx, val);
vals.push_back(val);
@ -1998,7 +1998,7 @@ class array_project_selects_util {
}
bool is_new = true;
for (unsigned j = start; j < m_idx_vals.size(); j++) {
for (unsigned j = start; j < m_idx_vals.size(); ++j) {
if (m_idx_vals.get(j) == vals) {
// idx belongs to the jth equivalence class;
// substitute sel term with ith sel const
@ -2036,7 +2036,7 @@ class array_project_selects_util {
(m_ari_u.is_real(idx_sort) || m_ari_u.is_int(idx_sort))) {
// using insertion sort
unsigned end = start + num_reprs;
for (unsigned i = start + 1; i < end; i++) {
for (unsigned i = start + 1; i < end; ++i) {
auto repr = m_idx_reprs.get(i).get(0);
auto val = m_idx_vals.get(i).get(0);
unsigned j = i;
@ -2053,7 +2053,7 @@ class array_project_selects_util {
m_idx_vals[j][0] = val;
}
for (unsigned i = start; i < end - 1; i++) {
for (unsigned i = start; i < end - 1; ++i) {
m_idx_lits.push_back(m_ari_u.mk_lt(m_idx_reprs[i].get(0),
m_idx_reprs[i + 1].get(0)));
}
@ -2101,7 +2101,7 @@ class array_project_selects_util {
TRACE(
qe, tout << "idx lits:\n";
for (unsigned i = 0; i < m_idx_lits.size();
i++) { tout << mk_pp(m_idx_lits.get(i), m) << "\n"; });
++i) { tout << mk_pp(m_idx_lits.get(i), m) << "\n"; });
return true;
}
@ -2117,12 +2117,12 @@ class array_project_selects_util {
M = &mdl;
// mark vars to eliminate
for (unsigned i = 0; i < arr_vars.size(); i++) {
for (unsigned i = 0; i < arr_vars.size(); ++i) {
m_arr_test.mark(arr_vars.get(i), true);
}
// alloc empty map from array var to sel terms over it
for (unsigned i = 0; i < arr_vars.size(); i++) {
for (unsigned i = 0; i < arr_vars.size(); ++i) {
ptr_vector<app> *lst = alloc(ptr_vector<app>);
m_sel_terms.insert(arr_vars.get(i), lst);
}
@ -2140,7 +2140,7 @@ class array_project_selects_util {
// dealloc
sel_map::iterator begin = m_sel_terms.begin(), end = m_sel_terms.end();
for (sel_map::iterator it = begin; it != end; it++) {
for (sel_map::iterator it = begin; it != end; ++it) {
dealloc(it->m_value);
}
m_sel_terms.reset();

View file

@ -165,7 +165,7 @@ void lemma_quantifier_generalizer::find_candidates(expr *e,
expr_sparse_mark marked_args;
// Make sure not to try and quantify already-quantified indices
for (unsigned idx=0, sz = indices.size(); idx < sz; idx++) {
for (unsigned idx=0, sz = indices.size(); idx < sz; ++idx) {
// skip expressions that already contain a quantified variable
if (has_zk_const(indices.get(idx))) {
continue;
@ -638,7 +638,7 @@ bool lemma_quantifier_generalizer::find_stride(expr_ref_vector &cube,
unsigned size = p_index->get_num_args();
unsigned matched = 0;
for (unsigned p = 0; p < size; p++) {
for (unsigned p = 0; p < size; ++p) {
expr *arg = p_index->get_arg(p);
if (is_var(arg)) {
rational val;
@ -708,7 +708,7 @@ void lemma_quantifier_generalizer::operator()(lemma_ref &lemma) {
m_offset = lemma->get_pob()->get_free_vars_size();
// for every literal, find a candidate term to abstract
for (unsigned i=0; i < m_cube.size(); i++) {
for (unsigned i=0; i < m_cube.size(); ++i) {
expr *r = m_cube.get(i);
// generate candidates for abstraction
@ -717,7 +717,7 @@ void lemma_quantifier_generalizer::operator()(lemma_ref &lemma) {
if (candidates.empty()) continue;
// for every candidate
for (unsigned arg=0, sz = candidates.size(); arg < sz; arg++) {
for (unsigned arg=0, sz = candidates.size(); arg < sz; ++arg) {
if (generalize (lemma, candidates.get(arg))) {
return;
}

View file

@ -186,10 +186,10 @@ proof *ground_sat_answer_op::mk_proof_step(frame &fr) {
premises.push_back(m.mk_asserted(rule_fml));
for (auto &k : fr.m_kids) {premises.push_back(m_cache.find(k));}
for (unsigned i = 0; i < premises.size(); i++) {
for (unsigned i = 0; i < premises.size(); ++i) {
positions.push_back(std::make_pair(0,i));
}
for (unsigned i = 0; i <= premises.size(); i++) {
for (unsigned i = 0; i <= premises.size(); ++i) {
substs.push_back(expr_ref_vector(m));
}
m_pinned.push_back(m.mk_hyper_resolve(premises.size(),

View file

@ -57,12 +57,12 @@ namespace datalog {
expr_ref_vector new_tail(m);
unsigned nb_predicates = r.get_uninterpreted_tail_size();
unsigned tail_size = r.get_tail_size();
for (unsigned i = 0; i < nb_predicates; i++) {
for (unsigned i = 0; i < nb_predicates; ++i) {
new_tail.push_back(r.get_tail(i));
}
expr_equiv_class array_eq_classes(m);
for(unsigned i = nb_predicates; i < tail_size; i++) {
for(unsigned i = nb_predicates; i < tail_size; ++i) {
expr* cond = r.get_tail(i);
expr* e1, *e2;
if (m.is_eq(cond, e1, e2) && m_a.is_array(e1->get_sort())) {
@ -82,7 +82,7 @@ namespace datalog {
}
}
for (expr * v : c_eq) {
for (unsigned i = 0; i < new_tail.size(); i++)
for (unsigned i = 0; i < new_tail.size(); ++i)
new_tail[i] = replace(new_tail[i].get(), representative, v);
}
for (expr * v : c_eq) {

View file

@ -53,7 +53,7 @@ namespace datalog {
dst = result.get();
unsigned nbrules = source.get_num_rules();
src_manager = &source.get_rule_manager();
for(unsigned i = 0; i < nbrules; i++) {
for(unsigned i = 0; i < nbrules; ++i) {
rule & r = *source.get_rule(i);
instantiate_rule(r, *result);
}
@ -77,20 +77,20 @@ namespace datalog {
expr_ref new_head = create_head(to_app(r.get_head()));
unsigned nb_predicates = r.get_uninterpreted_tail_size();
unsigned tail_size = r.get_tail_size();
for(unsigned i=0;i<nb_predicates;i++) {
for(unsigned i=0;i<nb_predicates;++i) {
preds.push_back(r.get_tail(i));
}
for(unsigned i=nb_predicates;i<tail_size;i++) {
for(unsigned i=nb_predicates;i<tail_size;++i) {
phi.push_back(r.get_tail(i));
}
//Retrieve selects
for(unsigned i=0;i<phi.size();i++)
for(unsigned i=0;i<phi.size();++i)
retrieve_selects(phi[i].get());
//Rewrite the predicates
expr_ref_vector new_tail(m);
for(unsigned i=0;i<preds.size();i++) {
for(unsigned i=0;i<preds.size();++i) {
new_tail.append(instantiate_pred(to_app(preds[i].get())));
}
new_tail.append(phi);
@ -105,13 +105,13 @@ namespace datalog {
expr_ref mk_array_instantiation::create_head(app* old_head) {
expr_ref_vector new_args(m);
for(unsigned i=0;i<old_head->get_num_args();i++) {
for(unsigned i=0;i<old_head->get_num_args();++i) {
expr*arg = old_head->get_arg(i);
if(m_a.is_array(arg->get_sort())) {
for(unsigned k=0; k< m_ctx.get_params().xform_instantiate_arrays_nb_quantifier();k++) {
for(unsigned k=0; k< m_ctx.get_params().xform_instantiate_arrays_nb_quantifier();++k) {
expr_ref_vector dummy_args(m);
dummy_args.push_back(arg);
for(unsigned i=0;i<get_array_arity(arg->get_sort());i++) {
for(unsigned i=0;i<get_array_arity(arg->get_sort());++i) {
dummy_args.push_back(m.mk_var(cnt, get_array_domain(arg->get_sort(), i)));
cnt++;
}
@ -139,7 +139,7 @@ namespace datalog {
app*f=to_app(e);
//Call the function recursively on all arguments
unsigned nbargs = f->get_num_args();
for(unsigned i=0;i<nbargs;i++) {
for(unsigned i=0;i<nbargs;++i) {
retrieve_selects(f->get_arg(i));
}
//If it is a select, then add it to selects
@ -161,10 +161,10 @@ namespace datalog {
expr_ref_vector mk_array_instantiation::getId(app*old_pred, const expr_ref_vector& n_args)
{
expr_ref_vector res(m);
for(unsigned i=0;i<n_args.size(); i++) {
for(unsigned i=0;i<n_args.size(); ++i) {
if(m_a.is_select(n_args[i])) {
app*select = to_app(n_args[i]);
for(unsigned j=1;j<select->get_num_args();j++) {
for(unsigned j=1;j<select->get_num_args();++j) {
res.push_back(select->get_arg(j));
}
}
@ -177,13 +177,13 @@ namespace datalog {
expr_ref_vector new_args(m);
new_args.append(n_args);
new_args.append(getId(old_pred, n_args));
for(unsigned i=0;i<new_args.size();i++) {
for(unsigned i=0;i<new_args.size();++i) {
if(m_a.is_select(new_args[i].get())) {
new_args[i] = mk_select_var(new_args[i].get());
}
}
sort_ref_vector new_sorts(m);
for(unsigned i=0;i<new_args.size();i++)
for(unsigned i=0;i<new_args.size();++i)
new_sorts.push_back(new_args.get(i)->get_sort());
expr_ref res(m);
func_decl_ref fun_decl(m);
@ -213,7 +213,7 @@ namespace datalog {
expr_ref res(m);
expr_ref_vector args(m);
args.push_back(array);
for(unsigned i=1; i<s->get_num_args();i++) {
for(unsigned i=1; i<s->get_num_args();++i) {
args.push_back(s->get_arg(i));
}
res = m_a.mk_select(args.size(), args.data());
@ -227,14 +227,14 @@ namespace datalog {
it != eq_classes.end(array); ++it) {
selects.insert_if_not_there(*it, ptr_vector<expr>());
ptr_vector<expr>& select_ops = selects[*it];
for(unsigned i=0;i<select_ops.size();i++) {
for(unsigned i=0;i<select_ops.size();++i) {
all_selects.push_back(rewrite_select(array, select_ops[i]));
}
}
if(all_selects.empty()) {
expr_ref_vector dummy_args(m);
dummy_args.push_back(array);
for(unsigned i=0;i<get_array_arity(array->get_sort());i++) {
for(unsigned i=0;i<get_array_arity(array->get_sort());++i) {
dummy_args.push_back(m.mk_var(cnt, get_array_domain(array->get_sort(), i)));
cnt++;
}
@ -249,7 +249,7 @@ namespace datalog {
unsigned nb_old_args=old_pred->get_num_args();
//Stores, for each old position, the list of a new possible arguments
vector<expr_ref_vector> arg_correspondance;
for(unsigned i=0;i<nb_old_args;i++) {
for(unsigned i=0;i<nb_old_args;++i) {
expr_ref arg(old_pred->get_arg(i), m);
if(m_a.is_array(arg->get_sort())) {
vector<expr_ref_vector> arg_possibilities(m_ctx.get_params().xform_instantiate_arrays_nb_quantifier(), retrieve_all_selects(arg));
@ -273,7 +273,7 @@ namespace datalog {
svector<unsigned> chosen(arg_correspondance.size(), 0u);
while(true) {
expr_ref_vector new_args(m);
for(unsigned i=0;i<chosen.size();i++) {
for(unsigned i=0;i<chosen.size();++i) {
new_args.push_back(arg_correspondance[i][chosen[i]].get());
}
res.push_back(create_pred(old_pred, new_args));

View file

@ -58,7 +58,7 @@ namespace datalog {
}
var_idx_set used_vars;
unsigned n = pred->get_num_args();
for (unsigned i = 0; i < n; i++) {
for (unsigned i = 0; i < n; ++i) {
expr * arg = pred->get_arg(i);
if (m.is_value(arg))
return true;
@ -108,7 +108,7 @@ namespace datalog {
bool_vector new_is_negated;
unsigned sz = r->get_tail_size();
bool rule_modified = false;
for (unsigned i = 0; i < sz; i++) {
for (unsigned i = 0; i < sz; ++i) {
app * tail = r->get_tail(i);
if (is_candidate(tail) && !r->is_neg_tail(i)) {
TRACE(mk_filter_rules, tout << "is_candidate: " << mk_pp(tail, m) << "\n";);
@ -117,7 +117,7 @@ namespace datalog {
ptr_buffer<expr> new_args;
var_idx_set used_vars;
unsigned num_args = tail->get_num_args();
for (unsigned i = 0; i < num_args; i++) {
for (unsigned i = 0; i < num_args; ++i) {
expr * arg = tail->get_arg(i);
if (is_var(arg)) {
unsigned vidx = to_var(arg)->get_idx();
@ -155,7 +155,7 @@ namespace datalog {
m_result = alloc(rule_set, m_context);
m_modified = false;
unsigned num_rules = source.get_num_rules();
for (unsigned i = 0; i < num_rules; i++) {
for (unsigned i = 0; i < num_rules; ++i) {
process(source.get_rule(i));
}
if(!m_modified) {

View file

@ -75,7 +75,7 @@ namespace datalog {
m_neg.reset();
unsigned tail_len = m_rule->get_tail_size();
for (unsigned i=0; i<tail_len; i++) {
for (unsigned i=0; i<tail_len; ++i) {
app_ref new_tail_el(m);
apply(m_rule->get_tail(i), new_tail_el);
m_tail.push_back(new_tail_el);
@ -142,7 +142,7 @@ namespace datalog {
unsigned neg_comparison = 0;
for (unsigned i=0; i<arg_cnt; i++) {
for (unsigned i=0; i<arg_cnt; ++i) {
expr * arg_a = a->get_arg(i);
expr * arg_b = b->get_arg(i);
@ -408,7 +408,7 @@ namespace datalog {
m_todo.reset();
m_leqs.reset();
for (unsigned i = u_len; i < len; i++) {
for (unsigned i = u_len; i < len; ++i) {
m_todo.push_back(r->get_tail(i));
SASSERT(!r->is_neg_tail(i));
}
@ -510,7 +510,7 @@ namespace datalog {
m_tail.reset();
m_tail_neg.reset();
for (unsigned i=0; i<u_len; i++) {
for (unsigned i=0; i<u_len; ++i) {
m_tail.push_back(r->get_tail(i));
m_tail_neg.push_back(r->is_neg_tail(i));
}
@ -525,7 +525,7 @@ namespace datalog {
}
else {
m_itail_members.reset();
for (unsigned i=u_len; i<len; i++) {
for (unsigned i=u_len; i<len; ++i) {
m_itail_members.push_back(r->get_tail(i));
SASSERT(!r->is_neg_tail(i));
}

View file

@ -45,7 +45,7 @@ namespace datalog {
void mk_magic_sets::adornment::populate(app * lit, const var_idx_set & bound_vars) {
SASSERT(empty());
unsigned arity = lit->get_num_args();
for (unsigned i = 0; i < arity; i++) {
for (unsigned i = 0; i < arity; ++i) {
const expr * arg = lit->get_arg(i);
bool bound = !is_var(arg) || bound_vars.contains(to_var(arg)->get_idx());
push_back(bound ? AD_BOUND : AD_FREE);
@ -65,7 +65,7 @@ namespace datalog {
unsigned get_bound_arg_count(app * lit, const var_idx_set & bound_vars) {
unsigned res = 0;
unsigned n = lit->get_num_args();
for (unsigned i = 0; i < n; i++) {
for (unsigned i = 0; i < n; ++i) {
const expr * arg = lit->get_arg(i);
if (!is_var(arg) || bound_vars.contains(to_var(arg)->get_idx())) {
SASSERT(is_var(arg) || is_app(arg));
@ -80,7 +80,7 @@ namespace datalog {
func_decl * pred = lit->get_decl();
float res = 1;
unsigned n = lit->get_num_args();
for (unsigned i = 0; i < n; i++) {
for (unsigned i = 0; i < n; ++i) {
const expr * arg = lit->get_arg(i);
if (is_var(arg) && !bound_vars.contains(to_var(arg)->get_idx())) {
res *= m_context.get_sort_size_estimate(pred->get_domain(i));
@ -100,7 +100,7 @@ namespace datalog {
float best_cost;
int candidate_index = -1;
unsigned n = cont.size();
for (unsigned i=0; i<n; i++) {
for (unsigned i=0; i<n; ++i) {
app * lit = r->get_tail(cont[i]);
unsigned bound_cnt = get_bound_arg_count(lit, bound_vars);
if (bound_cnt==0) {
@ -153,7 +153,7 @@ namespace datalog {
unsigned l_arity = l->get_num_args();
ptr_vector<expr> bound_args;
for (unsigned i=0; i<l_arity; i++) {
for (unsigned i=0; i<l_arity; ++i) {
if (adn[i]==AD_BOUND) {
bound_args.push_back(l->get_arg(i));
}
@ -164,7 +164,7 @@ namespace datalog {
unsigned mag_arity = bound_args.size();
ptr_vector<sort> mag_domain;
for (unsigned i=0; i<l_arity; i++) {
for (unsigned i=0; i<l_arity; ++i) {
if (adn[i]==AD_BOUND) {
mag_domain.push_back(l_pred->get_domain(i));
}
@ -189,7 +189,7 @@ namespace datalog {
negations.push_back(false);
negations.append(tail_cnt, negated);
for (unsigned i=0; i<tail_cnt; i++) {
for (unsigned i=0; i<tail_cnt; ++i) {
if (m_extentional.contains(tail[i]->get_decl())) {
continue;
}
@ -206,7 +206,7 @@ namespace datalog {
SASSERT(head_len==head_adornment.size());
var_idx_set bound_vars;
for (unsigned i=0; i<head_len; i++) {
for (unsigned i=0; i<head_len; ++i) {
expr * arg = head->get_arg(i);
if (head_adornment[i]==AD_BOUND && is_var(arg)) {
bound_vars.insert(to_var(arg)->get_idx());
@ -216,7 +216,7 @@ namespace datalog {
unsigned processed_tail_len = r->get_uninterpreted_tail_size();
unsigned_vector exten_tails;
unsigned_vector inten_tails;
for (unsigned i=0; i<processed_tail_len; i++) {
for (unsigned i=0; i<processed_tail_len; ++i) {
app * t = r->get_tail(i);
if (m_extentional.contains(t->get_decl())) {
exten_tails.push_back(i);
@ -268,7 +268,7 @@ namespace datalog {
create_magic_rules(new_head, new_tail.size(), new_tail.data(), negations.data(), result);
unsigned tail_len = r->get_tail_size();
for (unsigned i=processed_tail_len; i<tail_len; i++) {
for (unsigned i=processed_tail_len; i<tail_len; ++i) {
new_tail.push_back(r->get_tail(i));
negations.push_back(r->is_neg_tail(i));
}
@ -287,7 +287,7 @@ namespace datalog {
SASSERT(arity == d.m_pred->get_arity());
ptr_vector<expr> args;
for (unsigned i=0; i<arity; i++) {
for (unsigned i=0; i<arity; ++i) {
args.push_back(m.mk_var(i, adn_pred->get_domain(i)));
}
@ -314,7 +314,7 @@ namespace datalog {
unsigned init_rule_cnt = source.get_num_rules();
{
func_decl_set intentional;
for (unsigned i=0; i<init_rule_cnt; i++) {
for (unsigned i=0; i<init_rule_cnt; ++i) {
func_decl* pred = source.get_rule(i)->get_decl();
intentional.insert(pred);
}

View file

@ -98,7 +98,7 @@ namespace datalog {
rule const& r, bool is_tgt, unsigned skipped_index,
app_ref_vector& res, bool_vector& res_neg) {
unsigned rule_len = r.get_tail_size();
for (unsigned i = 0; i < rule_len; i++) {
for (unsigned i = 0; i < rule_len; ++i) {
if (i != skipped_index) { //i can never be UINT_MAX, so we'll never skip if we're not supposed to
app_ref new_tail_el(m);
apply(r.get_tail(i), is_tgt, new_tail_el);
@ -224,7 +224,7 @@ namespace datalog {
}
unsigned ut_len = r->get_uninterpreted_tail_size();
for (unsigned i=0; i<ut_len; i++) {
for (unsigned i=0; i<ut_len; ++i) {
func_decl * pred = r->get_decl(i);
m_tail_pred_ctr.inc(pred);
@ -350,7 +350,7 @@ namespace datalog {
unsigned rule_cnt = orig.get_num_rules();
for (unsigned ri=0; ri<rule_cnt; ri++) {
for (unsigned ri=0; ri<rule_cnt; ++ri) {
rule * r = orig.get_rule(ri);
func_decl * head_pred = r->get_decl();

View file

@ -49,7 +49,7 @@ namespace datalog {
return false;
}
for (unsigned i = 0; i < pt_len; i++) {
for (unsigned i = 0; i < pt_len; ++i) {
func_decl * tail_pred = r->get_tail(i)->get_decl();
if (!m_total_relations.contains(tail_pred)) {
// this rule has a non-total predicate in the tail
@ -58,7 +58,7 @@ namespace datalog {
}
unsigned t_len = r->get_positive_tail_size();
for(unsigned i = pt_len; i < t_len; i++) {
for(unsigned i = pt_len; i < t_len; ++i) {
SASSERT(!r->is_neg_tail(i)); //we assume interpreted tail not to be negated
if (!m.is_true(r->get_tail(i))) {
//this rule has an interpreted tail which is not constant true
@ -69,7 +69,7 @@ namespace datalog {
var_idx_set head_vars;
app * head = r->get_head();
unsigned arity = head->get_num_args();
for(unsigned i=0; i<arity; i++) {
for(unsigned i=0; i<arity; ++i) {
expr * arg = head->get_arg(i);
if(!is_var(arg)) { return false; }
unsigned idx = to_var(arg)->get_idx();
@ -127,7 +127,7 @@ namespace datalog {
app_ref_vector tail(m);
bool_vector tail_neg;
for(unsigned i=0; i<u_len; i++) {
for(unsigned i=0; i<u_len; ++i) {
app * tail_atom = r->get_tail(i);
bool neg = r->is_neg_tail(i);
if(m_total_relations.contains(tail_atom->get_decl())
@ -158,7 +158,7 @@ namespace datalog {
}
//we just copy the interpreted part of the tail
for(unsigned i=u_len; i<len; i++) {
for(unsigned i=u_len; i<len; ++i) {
tail.push_back(r->get_tail(i));
tail_neg.push_back(r->is_neg_tail(i));
}
@ -273,7 +273,7 @@ namespace datalog {
if (arity > 30) { continue; }
//for now we only check booleans domains
for(unsigned i=0; i<arity; i++) {
for(unsigned i=0; i<arity; ++i) {
if(!m.is_bool(pred->get_domain(i))) {
goto next_pred;
}
@ -316,7 +316,7 @@ namespace datalog {
app * head = r->get_head();
unsigned arity = pred->get_arity();
for(unsigned i=0; i<arity; i++) {
for(unsigned i=0; i<arity; ++i) {
expr * arg = head->get_arg(i);
if(!is_app(arg)) {
goto next_rule;

View file

@ -62,7 +62,7 @@ namespace datalog {
symbol const& parent_name = pred->get_name();
unsigned arity = parent_arity-1;
ptr_vector<sort> domain;
for (unsigned i = 0; i < parent_arity; i++) {
for (unsigned i = 0; i < parent_arity; ++i) {
if (i != arg_index) {
domain.push_back(parent_domain[i]);
}
@ -97,7 +97,7 @@ namespace datalog {
rm.get_counter().reset();
rm.get_counter().count_vars(head, 1);
for (unsigned i = 0; i < n; i++) {
for (unsigned i = 0; i < n; ++i) {
expr * arg = head->get_arg(i);
unsigned var_idx;
if (is_var(arg, var_idx) &&
@ -128,7 +128,7 @@ namespace datalog {
rm.get_counter().count_vars(head);
unsigned arg_index;
for (arg_index = 0; arg_index < head_arity; arg_index++) {
for (arg_index = 0; arg_index < head_arity; ++arg_index) {
expr * arg = head->get_arg(arg_index);
unsigned var_idx;
if (is_var(arg, var_idx) &&
@ -148,7 +148,7 @@ namespace datalog {
SASSERT(m_in_progress.contains(ci));
func_decl * cpred = m_map.find(ci);
ptr_vector<expr> cargs;
for (unsigned i=0; i < head_arity; i++) {
for (unsigned i=0; i < head_arity; ++i) {
if (i != arg_index) {
cargs.push_back(head->get_arg(i));
}
@ -197,7 +197,7 @@ namespace datalog {
func_decl * dtail_pred = m_map.find(ci);
ptr_vector<expr> dtail_args;
unsigned orig_dtail_arity = orig_dtail->get_num_args();
for (unsigned i = 0; i < orig_dtail_arity; i++) {
for (unsigned i = 0; i < orig_dtail_arity; ++i) {
if (i != arg_index) {
dtail_args.push_back(orig_dtail->get_arg(i));
}
@ -208,7 +208,7 @@ namespace datalog {
bool_vector tails_negated;
app_ref_vector tails(m);
unsigned tail_len = r->get_tail_size();
for (unsigned i = 0; i < tail_len; i++) {
for (unsigned i = 0; i < tail_len; ++i) {
tails_negated.push_back(r->is_neg_tail(i));
if (i == tail_index && !r->is_neg_tail(i)) {
tails.push_back(dtail);
@ -355,13 +355,13 @@ namespace datalog {
unsigned init_rule_cnt = source.get_num_rules();
for (unsigned i = 0; i < init_rule_cnt; i++) {
for (unsigned i = 0; i < init_rule_cnt; ++i) {
rule * r = source.get_rule(i);
m_rules.push_back(r);
m_head_occurrence_ctr.inc(r->get_decl());
}
for (unsigned i = 0; i < init_rule_cnt; i++) {
for (unsigned i = 0; i < init_rule_cnt; ++i) {
detect_tasks(source, i);
}