mirror of
https://github.com/Z3Prover/z3
synced 2025-04-15 13:28:47 +00:00
parent
8dac9b7b94
commit
b66360d0b5
|
@ -1088,6 +1088,7 @@ namespace opt {
|
|||
if (D.is_zero()) {
|
||||
throw default_exception("modulo 0 is not defined");
|
||||
}
|
||||
if (D.is_neg()) D = abs(D);
|
||||
TRACE("opt1", display(tout << "lcm: " << D << " x: v" << x << " tableau\n"););
|
||||
rational val_x = m_var2value[x];
|
||||
rational u = mod(val_x, D);
|
||||
|
|
|
@ -39,10 +39,8 @@ namespace datalog {
|
|||
}
|
||||
|
||||
void dealloc_ptr_vector_content(ptr_vector<relation_base> & v) {
|
||||
ptr_vector<relation_base>::iterator it = v.begin();
|
||||
ptr_vector<relation_base>::iterator end = v.end();
|
||||
for(; it!=end; ++it) {
|
||||
(*it)->deallocate();
|
||||
for (auto& r : v) {
|
||||
r->deallocate();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,7 +75,7 @@ namespace datalog {
|
|||
unsigned sz = size();
|
||||
out << "(";
|
||||
for (unsigned i = 0; i < sz; i++) {
|
||||
if(i) { out<<","; }
|
||||
if (i != 0) out << ",";
|
||||
out << mk_pp((*this)[i], m);
|
||||
}
|
||||
out << ")";
|
||||
|
@ -91,7 +89,7 @@ namespace datalog {
|
|||
app_ref bottom_ref(m.mk_false(), m);
|
||||
scoped_ptr<relation_mutator_fn> reset_fn = get_manager().mk_filter_interpreted_fn(*this, bottom_ref);
|
||||
if (!reset_fn) {
|
||||
NOT_IMPLEMENTED_YET();
|
||||
throw default_exception("filter function does not exist");
|
||||
}
|
||||
(*reset_fn)(*this);
|
||||
}
|
||||
|
@ -227,9 +225,6 @@ namespace datalog {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// -----------------------------------
|
||||
//
|
||||
// table_base
|
||||
|
@ -257,24 +252,18 @@ namespace datalog {
|
|||
|
||||
void table_base::reset() {
|
||||
vector<table_fact> to_remove;
|
||||
table_base::iterator it = begin();
|
||||
table_base::iterator iend = end();
|
||||
table_fact row;
|
||||
for(; it!=iend; ++it) {
|
||||
it->get_fact(row);
|
||||
for (auto& k : *this) {
|
||||
k.get_fact(row);
|
||||
to_remove.push_back(row);
|
||||
}
|
||||
remove_facts(to_remove.size(), to_remove.c_ptr());
|
||||
}
|
||||
|
||||
bool table_base::contains_fact(const table_fact & f) const {
|
||||
iterator it = begin();
|
||||
iterator iend = end();
|
||||
|
||||
table_fact row;
|
||||
|
||||
for(; it!=iend; ++it) {
|
||||
it->get_fact(row);
|
||||
for (auto const& k : *this) {
|
||||
k.get_fact(row);
|
||||
if (vectors_equal(row, f)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -289,11 +278,9 @@ namespace datalog {
|
|||
else {
|
||||
unsigned sig_sz = get_signature().size();
|
||||
unsigned non_func_cnt = sig_sz-get_signature().functional_columns();
|
||||
table_base::iterator it = begin();
|
||||
table_base::iterator iend = end();
|
||||
table_fact row;
|
||||
for(; it!=iend; ++it) {
|
||||
it->get_fact(row);
|
||||
for (auto& k : *this) {
|
||||
k.get_fact(row);
|
||||
bool differs = false;
|
||||
for (unsigned i=0; i<non_func_cnt; i++) {
|
||||
if (row[i]!=f[i]) {
|
||||
|
@ -341,14 +328,9 @@ namespace datalog {
|
|||
|
||||
table_base * table_base::clone() const {
|
||||
table_base * res = get_plugin().mk_empty(get_signature());
|
||||
|
||||
iterator it = begin();
|
||||
iterator iend = end();
|
||||
|
||||
table_fact row;
|
||||
|
||||
for(; it!=iend; ++it) {
|
||||
it->get_fact(row);
|
||||
for (auto& k : *this) {
|
||||
k.get_fact(row);
|
||||
res->add_new_fact(row);
|
||||
}
|
||||
return res;
|
||||
|
@ -408,11 +390,8 @@ namespace datalog {
|
|||
print_container(get_signature(), out);
|
||||
out << ":\n";
|
||||
|
||||
iterator it = begin();
|
||||
iterator iend = end();
|
||||
for(; it!=iend; ++it) {
|
||||
const row_interface & r = *it;
|
||||
r.display(out);
|
||||
for (auto& k : *this) {
|
||||
k.display(out);
|
||||
}
|
||||
|
||||
out << "\n";
|
||||
|
@ -470,10 +449,7 @@ namespace datalog {
|
|||
dl_decl_util util(m);
|
||||
bool_rewriter brw(m);
|
||||
table_fact fact;
|
||||
iterator it = begin();
|
||||
iterator iend = end();
|
||||
for(; it != iend; ++it) {
|
||||
const row_interface & r = *it;
|
||||
for (row_interface const& r : *this) {
|
||||
r.get_fact(fact);
|
||||
conjs.reset();
|
||||
for (unsigned i = 0; i < fact.size(); ++i) {
|
||||
|
|
Loading…
Reference in a new issue