mirror of
https://github.com/Z3Prover/z3
synced 2025-10-07 00:11:55 +00:00
fix bugs in doc
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
8c34cfca31
commit
75b11d2b75
4 changed files with 102 additions and 15 deletions
|
@ -109,7 +109,7 @@ doc& doc_manager::fillX(doc& src) {
|
|||
bool doc_manager::set_and(doc& dst, doc const& src) {
|
||||
// (A \ B) & (C \ D) = (A & C) \ (B u D)
|
||||
if (!m.set_and(dst.pos(), src.pos())) return false;
|
||||
dst.neg().intersect(m, src.pos());
|
||||
dst.neg().intersect(m, dst.pos());
|
||||
tbv_ref t(m);
|
||||
for (unsigned i = 0; i < src.neg().size(); ++i) {
|
||||
t = m.allocate(src.neg()[i]);
|
||||
|
@ -117,6 +117,7 @@ bool doc_manager::set_and(doc& dst, doc const& src) {
|
|||
dst.neg().insert(m, t.detach());
|
||||
}
|
||||
}
|
||||
SASSERT(well_formed(dst));
|
||||
return (src.neg().is_empty() || fold_neg(dst));
|
||||
}
|
||||
bool doc_manager::set_and(doc& dst, tbv const& src) {
|
||||
|
@ -150,11 +151,12 @@ bool doc_manager::fold_neg(doc& dst) {
|
|||
}
|
||||
else { // count == 1:
|
||||
dst.pos().set(index, neg(dst.neg()[i][index]));
|
||||
dst.neg().erase(tbvm(), i);
|
||||
dst.neg().intersect(tbvm(), dst.pos());
|
||||
goto start_over;
|
||||
}
|
||||
}
|
||||
}
|
||||
SASSERT(well_formed(dst));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -175,20 +175,17 @@ public:
|
|||
}
|
||||
}
|
||||
void intersect(M& m, union_bvec const& other) {
|
||||
union_bvec result;
|
||||
unsigned sz1 = size();
|
||||
unsigned sz2 = other.size();
|
||||
T* inter = m.allocate();
|
||||
for (unsigned i = 0; i < sz1; ++i) {
|
||||
for (unsigned j = 0; j < sz2; ++j) {
|
||||
if (m.intersect(*m_elems[i], other[j], *inter)) {
|
||||
result.push_back(inter);
|
||||
inter = m.allocate();
|
||||
}
|
||||
unsigned sz = other.size();
|
||||
union_bvec tmp, result;
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
tmp.copy(m, *this);
|
||||
tmp.intersect(m, other[i]);
|
||||
for (unsigned j = 0; j < tmp.size(); ++j) {
|
||||
result.push_back(tmp.m_elems[j]);
|
||||
}
|
||||
tmp.m_elems.reset();
|
||||
}
|
||||
m.deallocate(inter);
|
||||
std::swap(result, *this);
|
||||
std::swap(*this, result);
|
||||
result.reset(m);
|
||||
}
|
||||
void subtract(M& m, union_bvec const& other) {
|
||||
|
|
|
@ -382,6 +382,7 @@ namespace datalog {
|
|||
}
|
||||
}
|
||||
TRACE("doc", result->display(tout << "result:\n"););
|
||||
IF_VERBOSE(3, result->display(verbose_stream() << "join result:\n"););
|
||||
SASSERT(r.well_formed(result->get_dm()));
|
||||
return result;
|
||||
}
|
||||
|
@ -544,6 +545,7 @@ namespace datalog {
|
|||
SASSERT(r.get_udoc().well_formed(dm));
|
||||
SASSERT(!d1 || d1->well_formed(dm));
|
||||
TRACE("doc", _r.display(tout << "dst':\n"); );
|
||||
IF_VERBOSE(3, _r.display(verbose_stream() << "union result:\n"););
|
||||
}
|
||||
};
|
||||
void udoc_plugin::mk_union(doc_manager& dm, udoc& dst, udoc const& src, udoc* delta) {
|
||||
|
@ -1045,6 +1047,7 @@ namespace datalog {
|
|||
SASSERT(r->get_udoc().well_formed(dm2));
|
||||
}
|
||||
u2.reset(dm);
|
||||
IF_VERBOSE(3, r->display(verbose_stream() << "filter result:\n"););
|
||||
return r;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue