3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-29 22:40:08 +00:00

call it data instead of c_ptr for approaching C++11 std::vector convention.

This commit is contained in:
Nikolaj Bjorner 2021-04-13 18:17:10 -07:00
parent 524dcd35f9
commit 4a6083836a
456 changed files with 2802 additions and 2802 deletions

View file

@ -170,7 +170,7 @@ namespace datalog {
}
if (valid) {
todo.pop_back();
e1 = m.mk_app(ap->get_decl(), args.size(), args.c_ptr());
e1 = m.mk_app(ap->get_decl(), args.size(), args.data());
trail.push_back(e1);
if (a.is_select(ap)) {
if (m_defs.find(e1, v)) {
@ -195,7 +195,7 @@ namespace datalog {
for (unsigned j = 0; j < s->get_num_args(); ++j) {
args.push_back(cache.find(s->get_arg(j)));
}
e1 = m.mk_app(s->get_decl(), args.size(), args.c_ptr());
e1 = m.mk_app(s->get_decl(), args.size(), args.data());
if (!m_defs.contains(e1) && !insert_def(r, e1, v)) {
return false;
}
@ -230,10 +230,10 @@ namespace datalog {
for (unsigned j = 0; j < args1.size(); ++j) {
eqs.push_back(m.mk_eq(args1[j], args2[j]));
}
conjs.push_back(m.mk_implies(m.mk_and(eqs.size(), eqs.c_ptr()), m.mk_eq(v1, v2)));
conjs.push_back(m.mk_implies(m.mk_and(eqs.size(), eqs.data()), m.mk_eq(v1, v2)));
}
}
body = m.mk_and(conjs.size(), conjs.c_ptr());
body = m.mk_and(conjs.size(), conjs.data());
m_rewriter(body);
return true;
}
@ -281,7 +281,7 @@ namespace datalog {
return false;
}
expr_ref fml1(m), fml2(m), body(m), head(m);
body = m.mk_and(new_conjs.size(), new_conjs.c_ptr());
body = m.mk_and(new_conjs.size(), new_conjs.data());
head = r.get_head();
sub(body);
m_rewriter(body);

View file

@ -99,7 +99,7 @@ namespace datalog {
res_conjs.push_back(tmp);
}
proof_ref pr(m);
m_src_manager->mk_rule(m.mk_implies(m.mk_and(res_conjs.size(), res_conjs.c_ptr()), r.get_head()), pr, dest, r.name());
m_src_manager->mk_rule(m.mk_implies(m.mk_and(res_conjs.size(), res_conjs.data()), r.get_head()), pr, dest, r.name());
}
// NSB Code review: use substitution facility, such as expr_safe_replace or expr_replacer.
@ -115,7 +115,7 @@ namespace datalog {
for (expr * arg : *f) {
n_args.push_back(replace(arg, new_val, old_val));
}
return m.mk_app(f->get_decl(), n_args.size(), n_args.c_ptr());
return m.mk_app(f->get_decl(), n_args.size(), n_args.data());
}
}

View file

@ -96,7 +96,7 @@ namespace datalog {
new_tail.push_back(m.mk_eq(it->get_value(), tmp));
}
proof_ref pr(m);
src_manager->mk_rule(m.mk_implies(m.mk_and(new_tail.size(), new_tail.c_ptr()), new_head), pr, dest, r.name());
src_manager->mk_rule(m.mk_implies(m.mk_and(new_tail.size(), new_tail.data()), new_head), pr, dest, r.name());
}
expr_ref mk_array_instantiation::create_head(app* old_head) {
@ -112,7 +112,7 @@ namespace datalog {
cnt++;
}
expr_ref select(m);
select = m_a.mk_select(dummy_args.size(), dummy_args.c_ptr());
select = m_a.mk_select(dummy_args.size(), dummy_args.data());
new_args.push_back(select);
selects.insert_if_not_there(arg, ptr_vector<expr>());
selects[arg].push_back(select);
@ -183,11 +183,11 @@ namespace datalog {
new_sorts.push_back(new_args.get(i)->get_sort());
expr_ref res(m);
func_decl_ref fun_decl(m);
fun_decl = m.mk_func_decl(symbol((old_pred->get_decl()->get_name().str()+"!inst").c_str()), new_sorts.size(), new_sorts.c_ptr(), old_pred->get_decl()->get_range());
fun_decl = m.mk_func_decl(symbol((old_pred->get_decl()->get_name().str()+"!inst").c_str()), new_sorts.size(), new_sorts.data(), old_pred->get_decl()->get_range());
m_ctx.register_predicate(fun_decl, false);
if(src_set->is_output_predicate(old_pred->get_decl()))
dst->set_output_predicate(fun_decl);
res=m.mk_app(fun_decl,new_args.size(), new_args.c_ptr());
res=m.mk_app(fun_decl,new_args.size(), new_args.data());
return res;
}
@ -212,7 +212,7 @@ namespace datalog {
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.c_ptr());
res = m_a.mk_select(args.size(), args.data());
return res;
}
@ -234,7 +234,7 @@ namespace datalog {
dummy_args.push_back(m.mk_var(cnt, get_array_domain(array->get_sort(), i)));
cnt++;
}
all_selects.push_back(m_a.mk_select(dummy_args.size(), dummy_args.c_ptr()));
all_selects.push_back(m_a.mk_select(dummy_args.size(), dummy_args.data()));
}
return all_selects;
}

View file

@ -67,7 +67,7 @@ namespace datalog {
else {
head = r.get_tail(j);
}
new_rule = rm.mk(head, tail.size(), tail.c_ptr(), neg.c_ptr(), r.name(), true);
new_rule = rm.mk(head, tail.size(), tail.data(), neg.data(), r.name(), true);
result->add_rule(new_rule);
}
}

View file

@ -182,7 +182,7 @@ namespace datalog {
m_args.push_back(a->get_arg(i));
m_g_vars.push_back(m.mk_var(idx++,m.mk_bool_sort()));
}
m_f_vars.push_back(m_util.mk_bv(sz, m_g_vars.c_ptr()+m_g_vars.size()-sz));
m_f_vars.push_back(m_util.mk_bv(sz, m_g_vars.data()+m_g_vars.size()-sz));
}
else {
m_args.push_back(arg);
@ -202,7 +202,7 @@ namespace datalog {
for (expr* arg : m_args) {
domain.push_back(arg->get_sort());
}
g = m_context.mk_fresh_head_predicate(f->get_name(), symbol("bv"), m_args.size(), domain.c_ptr(), f);
g = m_context.mk_fresh_head_predicate(f->get_name(), symbol("bv"), m_args.size(), domain.data(), f);
m_old_funcs.push_back(f);
m_new_funcs.push_back(g);
m_pred2blast.insert(f, g);

View file

@ -53,7 +53,7 @@ namespace datalog {
m_sub2.push_back(b);
args.push_back(m.mk_var(m_idx++, a->get_sort()));
}
pred = m.mk_app(p1->get_decl(), args.size(), args.c_ptr());
pred = m.mk_app(p1->get_decl(), args.size(), args.data());
}
void mk_coalesce::extract_conjs(expr_ref_vector const& sub, rule const& rl, expr_ref& result) {
@ -98,10 +98,10 @@ namespace datalog {
}
var_subst vs(m, false);
for (unsigned i = r->get_uninterpreted_tail_size(); i < r->get_tail_size(); ++i) {
result = vs(r->get_tail(i), revsub.size(), revsub.c_ptr());
result = vs(r->get_tail(i), revsub.size(), revsub.data());
conjs.push_back(result);
}
bwr.mk_and(conjs.size(), conjs.c_ptr(), result);
bwr.mk_and(conjs.size(), conjs.data(), result);
}
void mk_coalesce::merge_rules(rule_ref& tgt, rule const& src) {
@ -132,7 +132,7 @@ namespace datalog {
SASSERT(is_app(fml));
tail.push_back(to_app(fml));
is_neg.push_back(false);
res = rm.mk(head, tail.size(), tail.c_ptr(), is_neg.c_ptr(), tgt->name());
res = rm.mk(head, tail.size(), tail.data(), is_neg.data(), tgt->name());
if (m_ctx.generate_proof_trace()) {
rm.to_formula(src, fml1);
rm.to_formula(*tgt.get(),fml2);
@ -177,7 +177,7 @@ namespace datalog {
rule_set::decl2rules::iterator it = source.begin_grouped_rules(), end = source.end_grouped_rules();
for (; it != end; ++it) {
rule_ref_vector d_rules(rm);
d_rules.append(it->m_value->size(), it->m_value->c_ptr());
d_rules.append(it->m_value->size(), it->m_value->data());
for (unsigned i = 0; i < d_rules.size(); ++i) {
rule_ref r1(d_rules[i].get(), rm);
for (unsigned j = i + 1; j < d_rules.size(); ++j) {

View file

@ -84,7 +84,7 @@ namespace datalog {
m_new_tail_neg.push_back(false);
}
rule* new_r = m_context.get_rule_manager().mk(r->get_head(), m_new_tail.size(),
m_new_tail.c_ptr(), m_new_tail_neg.c_ptr(), symbol::null, false);
m_new_tail.data(), m_new_tail_neg.data(), symbol::null, false);
res->add_rule(new_r);
} else {
res->add_rule(r);
@ -155,7 +155,7 @@ namespace datalog {
fmls.push_back(mk_and(conj));
}
expr_ref fml(m);
fml = m.mk_or(fmls.size(), fmls.c_ptr());
fml = m.mk_or(fmls.size(), fmls.data());
mc0->add(f, fml);
}
m_context.add_model_converter(mc0);

View file

@ -135,7 +135,7 @@ namespace datalog {
for (expr* e : new_conjs) {
tail.push_back(rm.ensure_app(e));
}
rule_ref new_rule(rm.mk(r.get_head(), tail.size(), tail.c_ptr(), nullptr, r.name(), false), rm);
rule_ref new_rule(rm.mk(r.get_head(), tail.size(), tail.data(), nullptr, r.name(), false), rm);
rm.mk_rule_rewrite_proof(r, *new_rule.get());
new_rules.add_rule(new_rule);
TRACE("dl", tout << "No term-ite after blast_term_ite\n";);
@ -178,7 +178,7 @@ namespace datalog {
app_ref_vector consts(m);
collect_uninterp_consts(fml2, consts, m_ground);
fml2 = mk_forall(m, consts.size(), consts.c_ptr(), fml2);
fml2 = mk_forall(m, consts.size(), consts.data(), fml2);
proof_ref p(m);
rm.mk_rule(fml2, p, new_rules, r.name());

View file

@ -82,11 +82,11 @@ namespace datalog {
func_decl*& filter_decl = m_tail2filter.insert_if_not_there(key, 0);
if (!filter_decl) {
filter_decl = m_context.mk_fresh_head_predicate(pred->get_decl()->get_name(), symbol("filter"),
filter_domain.size(), filter_domain.c_ptr(), pred->get_decl());
filter_domain.size(), filter_domain.data(), pred->get_decl());
m_pinned.push_back(filter_decl);
app_ref filter_head(m);
filter_head = m.mk_app(filter_decl, key->filter_args.size(), key->filter_args.c_ptr());
filter_head = m.mk_app(filter_decl, key->filter_args.size(), key->filter_args.data());
app * filter_tail = key->new_pred;
rule * filter_rule = m_context.get_rule_manager().mk(filter_head, 1, &filter_tail, (const bool *)nullptr);
filter_rule->set_accounting_parent_object(m_context, m_current);
@ -128,7 +128,7 @@ namespace datalog {
}
}
SASSERT(new_args.size() == filter_decl->get_arity());
new_tail.push_back(m.mk_app(filter_decl, new_args.size(), new_args.c_ptr()));
new_tail.push_back(m.mk_app(filter_decl, new_args.size(), new_args.data()));
rule_modified = true;
}
else {
@ -139,7 +139,7 @@ namespace datalog {
if (rule_modified) {
remove_duplicate_tails(new_tail, new_is_negated);
SASSERT(new_tail.size() == new_is_negated.size());
rule * new_rule = m_context.get_rule_manager().mk(new_head, new_tail.size(), new_tail.c_ptr(), new_is_negated.c_ptr(), r->name());
rule * new_rule = m_context.get_rule_manager().mk(new_head, new_tail.size(), new_tail.data(), new_is_negated.data(), r->name());
new_rule->set_accounting_parent_object(m_context, m_current);
m_result->add_rule(new_rule);
m_context.get_rule_manager().mk_rule_rewrite_proof(*r, *new_rule);

View file

@ -85,7 +85,7 @@ namespace datalog {
mk_rule_inliner::remove_duplicate_tails(m_tail, m_neg);
SASSERT(m_tail.size() == m_neg.size());
res = m_context.get_rule_manager().mk(m_head, m_tail.size(), m_tail.c_ptr(), m_neg.c_ptr(),m_rule->name());
res = m_context.get_rule_manager().mk(m_head, m_tail.size(), m_tail.data(), m_neg.data(),m_rule->name());
res->set_accounting_parent_object(m_context, m_rule);
res->norm_vars(res.get_manager());
}
@ -334,7 +334,7 @@ namespace datalog {
m_app_args.reset();
m_app_args.append(num, args);
std::sort(m_app_args.c_ptr(), m_app_args.c_ptr()+m_app_args.size(), m_expr_cmp);
std::sort(m_app_args.data(), m_app_args.data()+m_app_args.size(), m_expr_cmp);
remove_duplicates(m_app_args);
@ -347,11 +347,11 @@ namespace datalog {
}
else {
if (m.is_and(f)) {
result = m.mk_and(m_app_args.size(), m_app_args.c_ptr());
result = m.mk_and(m_app_args.size(), m_app_args.data());
}
else {
SASSERT(m.is_or(f));
result = m.mk_or(m_app_args.size(), m_app_args.c_ptr());
result = m.mk_or(m_app_args.size(), m_app_args.data());
}
}
@ -529,7 +529,7 @@ namespace datalog {
m_itail_members.push_back(r->get_tail(i));
SASSERT(!r->is_neg_tail(i));
}
itail = m.mk_and(m_itail_members.size(), m_itail_members.c_ptr());
itail = m.mk_and(m_itail_members.size(), m_itail_members.data());
modified = true;
}
@ -559,7 +559,7 @@ namespace datalog {
}
SASSERT(m_tail.size() == m_tail_neg.size());
res = m_context.get_rule_manager().mk(head, m_tail.size(), m_tail.c_ptr(), m_tail_neg.c_ptr(), r->name());
res = m_context.get_rule_manager().mk(head, m_tail.size(), m_tail.data(), m_tail_neg.data(), r->name());
res->set_accounting_parent_object(m_context, r);
}
else {

View file

@ -156,7 +156,7 @@ namespace datalog {
for (unsigned i = 0; i < M.size(); ++i) {
mk_body(M.A[i], M.b[i], M.eq[i], conj);
}
bool_rewriter(m).mk_and(conj.size(), conj.c_ptr(), body);
bool_rewriter(m).mk_and(conj.size(), conj.data(), body);
}
void mk_body(vector<rational> const& row, rational const& b, bool is_eq, expr_ref_vector& conj) {
@ -179,7 +179,7 @@ namespace datalog {
if (!b.is_zero()) {
sum.push_back(a.mk_numeral(b, true));
}
lhs = a.mk_add(sum.size(), sum.c_ptr());
lhs = a.mk_add(sum.size(), sum.data());
if (is_eq) {
conj.push_back(m.mk_eq(lhs, zero));
}
@ -240,7 +240,7 @@ namespace datalog {
for (; dit != dend; ++dit) {
heads.push_back(dit->m_key);
}
m_inner_ctx.rel_query(heads.size(), heads.c_ptr());
m_inner_ctx.rel_query(heads.size(), heads.data());
// retrieve invariants.
dit = src.begin_grouped_rules();
@ -306,7 +306,7 @@ namespace datalog {
}
rule* new_rule = &r;
if (tail.size() != tsz) {
new_rule = rm.mk(r.get_head(), tail.size(), tail.c_ptr(), nullptr, r.name());
new_rule = rm.mk(r.get_head(), tail.size(), tail.data(), nullptr, r.name());
}
rules.add_rule(new_rule);
rm.mk_rule_rewrite_proof(r, *new_rule); // should be weakening rule.

View file

@ -42,7 +42,7 @@ namespace datalog {
ptr_vector<sort> domain;
domain.append(fn->get_num_args(), old_fn->get_domain());
domain.push_back(a.mk_int());
new_fn = m.mk_func_decl(old_fn->get_name(), domain.size(), domain.c_ptr(), old_fn->get_range());
new_fn = m.mk_func_decl(old_fn->get_name(), domain.size(), domain.data(), old_fn->get_range());
m_old2new.insert(old_fn, new_fn);
m_new2old.insert(new_fn, old_fn);
m_refs.push_back(new_fn);
@ -51,7 +51,7 @@ namespace datalog {
dst.set_output_predicate(new_fn);
}
}
return app_ref(m.mk_app(new_fn, args.size(), args.c_ptr()), m);
return app_ref(m.mk_app(new_fn, args.size(), args.data()), m);
}
app_ref mk_loop_counter::del_arg(app* fn) {
@ -60,7 +60,7 @@ namespace datalog {
SASSERT(fn->get_num_args() > 0);
args.append(fn->get_num_args()-1, fn->get_args());
VERIFY (m_new2old.find(new_fn, old_fn));
return app_ref(m.mk_app(old_fn, args.size(), args.c_ptr()), m);
return app_ref(m.mk_app(old_fn, args.size(), args.data()), m);
}
rule_set * mk_loop_counter::operator()(rule_set const & source) {
@ -108,10 +108,10 @@ namespace datalog {
expr_ref_vector args(m);
args.append(head->get_num_args(), head->get_args());
args[last] = a.mk_numeral(rational(0), true);
head = m.mk_app(head->get_decl(), args.size(), args.c_ptr());
head = m.mk_app(head->get_decl(), args.size(), args.data());
}
new_rule = rm.mk(head, tail.size(), tail.c_ptr(), neg.c_ptr(), r.name(), true);
new_rule = rm.mk(head, tail.size(), tail.data(), neg.data(), r.name(), true);
result->add_rule(new_rule);
}
@ -145,7 +145,7 @@ namespace datalog {
neg.push_back(false);
}
head = del_arg(r.get_head());
new_rule = rm.mk(head, tail.size(), tail.c_ptr(), neg.c_ptr(), r.name(), true);
new_rule = rm.mk(head, tail.size(), tail.data(), neg.data(), r.name(), true);
result->add_rule(new_rule);
}

View file

@ -171,11 +171,11 @@ namespace datalog {
}
mag_pred = m_context.mk_fresh_head_predicate(l_pred->get_name(), symbol("ms"),
mag_arity, mag_domain.c_ptr(), l_pred);
mag_arity, mag_domain.data(), l_pred);
m_pinned.push_back(mag_pred);
}
app * res = m.mk_app(mag_pred, bound_args.c_ptr());
app * res = m.mk_app(mag_pred, bound_args.data());
m_pinned.push_back(res);
return res;
}
@ -194,7 +194,7 @@ namespace datalog {
continue;
}
app * mag_head = create_magic_literal(tail[i]);
rule * r = m_context.get_rule_manager().mk(mag_head, i+1, new_tail.c_ptr(), negations.c_ptr());
rule * r = m_context.get_rule_manager().mk(mag_head, i+1, new_tail.data(), negations.data());
TRACE("dl", r->display(m_context,tout); );
result.add_rule(r);
}
@ -265,7 +265,7 @@ namespace datalog {
app * new_head = m.mk_app(new_head_pred, head->get_args());
SASSERT(new_tail.size()==r->get_uninterpreted_tail_size());
create_magic_rules(new_head, new_tail.size(), new_tail.c_ptr(), negations.c_ptr(), result);
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++) {
@ -276,7 +276,7 @@ namespace datalog {
new_tail.push_back(create_magic_literal(new_head));
negations.push_back(false);
rule * nr = m_context.get_rule_manager().mk(new_head, new_tail.size(), new_tail.c_ptr(), negations.c_ptr(), r->name());
rule * nr = m_context.get_rule_manager().mk(new_head, new_tail.size(), new_tail.data(), negations.data(), r->name());
result.add_rule(nr);
nr->set_accounting_parent_object(m_context, r);
}
@ -291,8 +291,8 @@ namespace datalog {
args.push_back(m.mk_var(i, adn_pred->get_domain(i)));
}
app * lit = m.mk_app(d.m_pred, args.c_ptr());
app * adn_lit = m.mk_app(adn_pred, args.c_ptr());
app * lit = m.mk_app(d.m_pred, args.data());
app * adn_lit = m.mk_app(adn_pred, args.data());
app * mag_lit = create_magic_literal(adn_lit);
app * tail[] = {lit, mag_lit};

View file

@ -47,7 +47,7 @@ namespace datalog {
};
struct a_flag_hash {
typedef a_flag data;
typedef a_flag data_t;
unsigned operator()(a_flag x) const { return x; }
};

View file

@ -94,7 +94,7 @@ namespace datalog {
tail.push_back(mk_ans(r.get_tail(j)));
neg.push_back(false);
}
new_rule = rm.mk(mk_ans(r.get_head()), tail.size(), tail.c_ptr(), neg.c_ptr(), r.name(), true);
new_rule = rm.mk(mk_ans(r.get_head()), tail.size(), tail.data(), neg.data(), r.name(), true);
result->add_rule(new_rule);
if (source.is_output_predicate(r.get_decl())) {
result->set_output_predicate(new_rule->get_decl());
@ -103,7 +103,7 @@ namespace datalog {
}
for (unsigned j = 0; j < utsz; ++j) {
new_rule = rm.mk(mk_query(r.get_tail(j)), tail.size()-utsz+j, tail.c_ptr(), neg.c_ptr(), r.name(), true);
new_rule = rm.mk(mk_query(r.get_tail(j)), tail.size()-utsz+j, tail.data(), neg.data(), r.name(), true);
result->add_rule(new_rule);
}

View file

@ -124,7 +124,7 @@ namespace datalog {
TRACE("dl", tout << body << "\n";);
// 3. abstract and quantify those variables that should be bound.
body = expr_abstract(bound, body);
body = m.mk_forall(names.size(), bound_sorts.c_ptr(), names.c_ptr(), body);
body = m.mk_forall(names.size(), bound_sorts.data(), names.data(), body);
TRACE("dl", tout << body << "\n";);
// 4. replace remaining constants by variables.
@ -198,7 +198,7 @@ namespace datalog {
bound.push_back(true);
sorts.push_back(s1);
}
arg = mk_select(arg, args.size(), args.c_ptr());
arg = mk_select(arg, args.size(), args.data());
s = get_array_range(s);
}
domain.push_back(s);
@ -207,7 +207,7 @@ namespace datalog {
sorts.push_back(s0);
}
SASSERT(old_p->get_range() == m.mk_bool_sort());
new_p = m.mk_func_decl(old_p->get_name(), domain.size(), domain.c_ptr(), old_p->get_range());
new_p = m.mk_func_decl(old_p->get_name(), domain.size(), domain.data(), old_p->get_range());
m_refs.push_back(new_p);
m_ctx.register_predicate(new_p, false);
if (m_mc) {
@ -234,7 +234,7 @@ namespace datalog {
for (unsigned j = 0; j < arity; ++j) {
args.push_back(m.mk_var(idx++, get_array_domain(s, j)));
}
arg = mk_select(arg, arity, args.c_ptr()+args.size()-arity);
arg = mk_select(arg, arity, args.data()+args.size()-arity);
s = get_array_range(s);
}
args.push_back(arg);
@ -244,7 +244,7 @@ namespace datalog {
for (unsigned i = 0; i < args.size(); ++i) {
tout << mk_pp(args[i].get(), m) << "\n";
});
return app_ref(m.mk_app(new_p, args.size(), args.c_ptr()), m);
return app_ref(m.mk_app(new_p, args.size(), args.data()), m);
}
app_ref mk_quantifier_abstraction::mk_tail(rule_set const& rules, rule_set& dst, app* p) {
@ -278,7 +278,7 @@ namespace datalog {
names.push_back(symbol(idx));
args.push_back(m.mk_var(idx++, vars.back()));
}
arg = mk_select(arg, arity, args.c_ptr()+args.size()-arity);
arg = mk_select(arg, arity, args.data()+args.size()-arity);
s = get_array_range(s);
}
if (is_pattern) {
@ -288,12 +288,12 @@ namespace datalog {
}
expr* pat = nullptr;
expr_ref pattern(m);
pattern = m.mk_pattern(pats.size(), pats.c_ptr());
pattern = m.mk_pattern(pats.size(), pats.data());
pat = pattern.get();
app_ref result(m);
symbol qid, skid;
result = m.mk_app(new_p, args.size(), args.c_ptr());
result = m.mk_eq(m.mk_forall(vars.size(), vars.c_ptr(), names.c_ptr(), result, 1, qid, skid, 1, &pat), m.mk_true());
result = m.mk_app(new_p, args.size(), args.data());
result = m.mk_eq(m.mk_forall(vars.size(), vars.data(), names.data(), result, 1, qid, skid, 1, &pat), m.mk_true());
return result;
}
@ -301,7 +301,7 @@ namespace datalog {
ptr_vector<expr> args2;
args2.push_back(arg);
args2.append(num_args, args);
return a.mk_select(args2.size(), args2.c_ptr());
return a.mk_select(args2.size(), args2.data());
}
rule_set * mk_quantifier_abstraction::operator()(rule_set const & source) {
@ -345,7 +345,7 @@ namespace datalog {
tail.push_back(r.get_tail(j));
}
head = mk_head(source, *result, r.get_head(), cnt);
fml = m.mk_implies(m.mk_and(tail.size(), tail.c_ptr()), head);
fml = m.mk_implies(m.mk_and(tail.size(), tail.data()), head);
proof_ref pr(m);
rm.mk_rule(fml, pr, *result, r.name());
TRACE("dl", result->last()->display(m_ctx, tout););

View file

@ -156,7 +156,7 @@ namespace datalog {
SASSERT(m_binding[i]);
});
m_binding.reverse();
expr_ref res = instantiate(m, q, m_binding.c_ptr());
expr_ref res = instantiate(m, q, m_binding.data());
m_binding.reverse();
m_cnst2var(res);
conjs.push_back(res);
@ -205,7 +205,7 @@ namespace datalog {
m_terms.reset();
m_var2cnst.reset();
m_cnst2var.reset();
fml = m.mk_and(conjs.size(), conjs.c_ptr());
fml = m.mk_and(conjs.size(), conjs.data());
for (unsigned i = 0; i < sorts.size(); ++i) {
var = m.mk_var(i, sorts[i]);
@ -214,7 +214,7 @@ namespace datalog {
m_cnst2var.insert(cnst, var);
}
fml = m.mk_and(conjs.size(), conjs.c_ptr());
fml = m.mk_and(conjs.size(), conjs.data());
m_var2cnst(fml);
collect_egraph(fml);
@ -224,7 +224,7 @@ namespace datalog {
for (auto & kv : m_funs) dealloc(kv.m_value);
m_funs.reset();
fml = m.mk_and(conjs.size(), conjs.c_ptr());
fml = m.mk_and(conjs.size(), conjs.data());
fml = m.mk_implies(fml, r.get_head());
TRACE("dl", r.display(m_ctx, tout); tout << mk_pp(fml, m) << "\n";);

View file

@ -117,7 +117,7 @@ namespace datalog {
std::ostringstream comb_name;
comb_name << tgt.name().str() << ";" << src.name().str();
symbol combined_rule_name(comb_name.str());
res = m_rm.mk(new_head, tail.size(), tail.c_ptr(), tail_neg.c_ptr(), combined_rule_name, m_normalize);
res = m_rm.mk(new_head, tail.size(), tail.data(), tail_neg.data(), combined_rule_name, m_normalize);
res->set_accounting_parent_object(m_context, const_cast<rule*>(&tgt));
TRACE("dl",
tgt.display(m_context, tout << "tgt (" << tail_index << "): \n");

View file

@ -60,7 +60,7 @@ namespace datalog {
subst.push_back(a.mk_numeral(rational(1), a.mk_real()));
SASSERT(!new_fi->is_partial() && new_fi->num_entries() == 0);
tmp = vs(new_fi->get_else(), subst.size(), subst.c_ptr());
tmp = vs(new_fi->get_else(), subst.size(), subst.data());
if (old_p->get_arity() == 0) {
old_model->register_decl(old_p, tmp);
}
@ -154,7 +154,7 @@ namespace datalog {
tail.append(m_eqs);
tail.push_back(a.mk_gt(m.mk_var(num_vars, a.mk_real()), a.mk_numeral(rational(0), false)));
neg.resize(tail.size(), false);
new_rule = rm.mk(new_pred, tail.size(), tail.c_ptr(), neg.c_ptr(), r.name(), true);
new_rule = rm.mk(new_pred, tail.size(), tail.data(), neg.data(), r.name(), true);
result->add_rule(new_rule);
if (source.is_output_predicate(r.get_decl())) {
result->set_output_predicate(new_rule->get_decl());
@ -174,7 +174,7 @@ namespace datalog {
ptr_vector<sort> domain(f->get_arity(), f->get_domain());
domain.push_back(a.mk_real());
func_decl_ref g(m);
g = m.mk_func_decl(f->get_name(), f->get_arity() + 1, domain.c_ptr(), f->get_range());
g = m.mk_func_decl(f->get_name(), f->get_arity() + 1, domain.data(), f->get_range());
expr_ref_vector args(m);
for (unsigned i = 0; i < q->get_num_args(); ++i) {
expr* arg = q->get_arg(i);
@ -200,7 +200,7 @@ namespace datalog {
if (m_mc) {
m_mc->add_new2old(g, f);
}
return app_ref(m.mk_app(g, q->get_num_args() + 1, args.c_ptr()), m);
return app_ref(m.mk_app(g, q->get_num_args() + 1, args.data()), m);
}
app_ref mk_scale::mk_constraint(unsigned sigma_idx, app* q) {
@ -227,7 +227,7 @@ namespace datalog {
for (unsigned i = 0; i < ap->get_num_args(); ++i) {
args.push_back(linearize(sigma_idx, ap->get_arg(i)));
}
result = m.mk_app(ap->get_decl(), args.size(), args.c_ptr());
result = m.mk_app(ap->get_decl(), args.size(), args.data());
}
else if (a.is_numeral(e)) {
result = a.mk_mul(m.mk_var(sigma_idx, a.mk_real()), e);

View file

@ -67,9 +67,9 @@ namespace datalog {
sorts.push_back(arg->get_sort());
}
}
fn = m.mk_fresh_func_decl(p->get_decl()->get_name(), symbol("N"), sorts.size(), sorts.c_ptr(), m.mk_bool_sort());
fn = m.mk_fresh_func_decl(p->get_decl()->get_name(), symbol("N"), sorts.size(), sorts.data(), m.mk_bool_sort());
m_ctx.register_predicate(fn, false);
q = m.mk_app(fn, args.size(), args.c_ptr());
q = m.mk_app(fn, args.size(), args.data());
bool is_neg = true;
rules.add_rule(rm.mk(q, 1, & p, &is_neg));
}
@ -101,7 +101,7 @@ namespace datalog {
tail.push_back(r.get_tail(i));
neg.push_back(false);
}
rules.add_rule(rm.mk(r.get_head(), tail.size(), tail.c_ptr(), neg.c_ptr(), r.name()));
rules.add_rule(rm.mk(r.get_head(), tail.size(), tail.data(), neg.data(), r.name()));
}
rule_set * mk_separate_negated_tails::operator()(rule_set const& src) {

View file

@ -240,7 +240,7 @@ namespace datalog {
r1 = r3;
}
rm.to_formula(*r1.get(), concl);
proof* new_p = m.mk_hyper_resolve(premises.size(), premises.c_ptr(), concl, positions, substs);
proof* new_p = m.mk_hyper_resolve(premises.size(), premises.data(), concl, positions, substs);
m_pinned_exprs.push_back(new_p);
m_pinned_rules.push_back(r1.get());
TRACE("dl",
@ -352,7 +352,7 @@ namespace datalog {
}
if (!new_fi->is_partial()) {
TRACE("dl", tout << mk_pp(new_fi->get_else(), m) << "\n";);
tmp = vs(new_fi->get_else(), subst.size(), subst.c_ptr());
tmp = vs(new_fi->get_else(), subst.size(), subst.data());
old_fi->set_else(tmp);
}
unsigned num_entries = new_fi->num_entries();
@ -362,7 +362,7 @@ namespace datalog {
func_entry const* e = new_fi->get_entry(j);
for (unsigned k = 0, l = 0; k < old_p->get_arity(); ++k) {
if (!is_sliced.get(k)) {
tmp = vs(e->get_arg(l++), subst.size(), subst.c_ptr());
tmp = vs(e->get_arg(l++), subst.size(), subst.data());
args.push_back(tmp);
}
else {
@ -370,8 +370,8 @@ namespace datalog {
}
SASSERT(l <= new_p->get_arity());
}
res = vs(e->get_result(), subst.size(), subst.c_ptr());
old_fi->insert_entry(args.c_ptr(), res.get());
res = vs(e->get_result(), subst.size(), subst.data());
old_fi->insert_entry(args.data(), res.get());
}
old_model->register_decl(old_p, old_fi);
}
@ -731,7 +731,7 @@ namespace datalog {
}
}
if (domain.size() < bv.size()) {
f = m_ctx.mk_fresh_head_predicate(p->get_name(), symbol("slice"), domain.size(), domain.c_ptr(), p);
f = m_ctx.mk_fresh_head_predicate(p->get_name(), symbol("slice"), domain.size(), domain.data(), p);
m_pinned.push_back(f);
m_predicates.insert(p, f);
dst.inherit_predicate(src, p, f);
@ -768,7 +768,7 @@ namespace datalog {
args.push_back(p->get_arg(i));
}
}
q = m.mk_app(qd, args.size(), args.c_ptr());
q = m.mk_app(qd, args.size(), args.data());
}
else {
q = p;
@ -797,7 +797,7 @@ namespace datalog {
tail.push_back(to_app(e));
}
new_rule = rm.mk(head.get(), tail.size(), tail.c_ptr(), (const bool*) nullptr, r.name());
new_rule = rm.mk(head.get(), tail.size(), tail.data(), (const bool*) nullptr, r.name());
rm.fix_unbound_vars(new_rule, false);

View file

@ -164,7 +164,7 @@ namespace datalog {
}
SASSERT(tail.size()==tail_neg.size());
res = m_context.get_rule_manager().mk(head, tail.size(), tail.c_ptr(), tail_neg.c_ptr(), r->name());
res = m_context.get_rule_manager().mk(head, tail.size(), tail.data(), tail_neg.data(), r->name());
res->set_accounting_parent_object(m_context, r);
m_context.get_rule_manager().fix_unbound_vars(res, true);
m_context.get_rule_manager().mk_rule_rewrite_proof(*r, *res.get());
@ -189,7 +189,7 @@ namespace datalog {
//before traversing we sort rules so that the shortest are in the beginning.
//this will help make subsumption checks more efficient
std::sort(orig_rules.c_ptr(), orig_rules.c_ptr() + orig_rules.size(), rule_size_comparator);
std::sort(orig_rules.data(), orig_rules.data() + orig_rules.size(), rule_size_comparator);
for (rule * r : orig_rules) {
func_decl * head_pred = r->get_decl();

View file

@ -82,7 +82,7 @@ namespace datalog {
was_added = true;
func_decl* orig = decls_buf[0];
func_decl* product_pred = m_ctx.mk_fresh_head_predicate(new_name,
symbol::null, domain.size(), domain.c_ptr(), orig);
symbol::null, domain.size(), domain.data(), orig);
m_cache.insert(new_name, product_pred);
}
return;
@ -130,7 +130,7 @@ namespace datalog {
rule_ref new_rule(rm);
new_rule = rm.mk(r.get_head(), tail_idx + 1,
new_tail.c_ptr(), new_tail_neg.c_ptr(), symbol::null, false);
new_tail.data(), new_tail_neg.data(), symbol::null, false);
rules.replace_rule(&r, new_rule.get());
}
@ -150,7 +150,7 @@ namespace datalog {
rule_ref new_rule(rm);
new_rule = rm.mk(r);
rm.substitute(new_rule, revsub.size(), revsub.c_ptr());
rm.substitute(new_rule, revsub.size(), revsub.data());
return new_rule;
}
@ -246,7 +246,7 @@ namespace datalog {
args[idx] = a->get_arg(i);
}
return app_ref(m.mk_app(pred, args_num, args.c_ptr()), m);
return app_ref(m.mk_app(pred, args_num, args.data()), m);
}
rule_ref mk_synchronize::product_rule(rule_ref_vector const & rules) {
@ -302,7 +302,7 @@ namespace datalog {
rule_ref new_rule(rm);
new_rule = rm.mk(product_head, tail_idx + 1,
new_tail.c_ptr(), new_tail_neg.c_ptr(), symbol(buffer.c_str()), false);
new_tail.data(), new_tail_neg.data(), symbol(buffer.c_str()), false);
rm.fix_unbound_vars(new_rule, false);
return new_rule;
}

View file

@ -72,7 +72,7 @@ namespace datalog {
name_suffix << "compr_arg_" << arg_index;
func_decl * cpred = m_context.mk_fresh_head_predicate(parent_name, symbol(name_suffix.str()),
arity, domain.c_ptr(), pred);
arity, domain.data(), pred);
m_pinned.push_back(cpred);
m_pinned.push_back(pred);
@ -154,7 +154,7 @@ namespace datalog {
}
}
app_ref chead(m.mk_app(cpred, head_arity-1, cargs.c_ptr()), m);
app_ref chead(m.mk_app(cpred, head_arity-1, cargs.data()), m);
m_modified = true;
if (r->get_tail_size()==0 && m_context.get_rule_manager().is_fact(chead)) {
@ -203,7 +203,7 @@ namespace datalog {
}
}
SASSERT(dtail_args.size()==dtail_pred->get_arity());
app_ref dtail(m.mk_app(dtail_pred, dtail_args.size(), dtail_args.c_ptr()), m);
app_ref dtail(m.mk_app(dtail_pred, dtail_args.size(), dtail_args.data()), m);
bool_vector tails_negated;
app_ref_vector tails(m);
@ -225,7 +225,7 @@ namespace datalog {
tails.push_back(dtail);
}
res = m_context.get_rule_manager().mk( r->get_head(), tails.size(), tails.c_ptr(), tails_negated.c_ptr());
res = m_context.get_rule_manager().mk( r->get_head(), tails.size(), tails.data(), tails_negated.data());
res->set_accounting_parent_object(m_context, r);
m_context.get_rule_manager().fix_unbound_vars(res, true);
return res;