3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-15 05:18:44 +00:00

add two failing test cases

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2014-10-02 10:38:43 -07:00
parent 2c70e8d79f
commit 93a757f45b
3 changed files with 53 additions and 15 deletions

View file

@ -221,7 +221,8 @@ namespace datalog {
relation_plugin(udoc_plugin::get_name(), rm),
m(rm.get_context().get_manager()),
bv(m),
dl(m) {
dl(m),
m_disable_fast_pass(false) {
}
udoc_plugin::~udoc_plugin() {
u_map<doc_manager*>::iterator it = m_dms.begin(), end = m_dms.end();
@ -1079,13 +1080,22 @@ namespace datalog {
virtual void operator()(relation_base& tb, const relation_base& negb) {
udoc_relation& t = get(tb);
udoc_relation const& n = get(negb);
udoc_plugin& p = t.get_plugin();
IF_VERBOSE(3, t.display(verbose_stream() << "dst:"););
IF_VERBOSE(3, n.display(verbose_stream() << "neg:"););
if (!t.fast_empty() && !n.fast_empty() && !p.m_disable_fast_pass) {
fast_pass(t, n);
}
if (!t.fast_empty() && !n.fast_empty()) {
slow_pass(t, n);
}
}
void fast_pass(udoc_relation& t, const udoc_relation& n) {
udoc & dst = t.get_udoc();
udoc const & neg = n.get_udoc();
doc_manager& dmt = t.get_dm();
doc_manager& dmn = n.get_dm();
IF_VERBOSE(3, t.display(verbose_stream() << "dst:"););
IF_VERBOSE(3, n.display(verbose_stream() << "neg:"););
udoc result;
for (unsigned i = 0; i < dst.size(); ++i) {
bool subsumed = false;
@ -1100,12 +1110,13 @@ namespace datalog {
result.push_back(&dst[i]);
}
std::swap(dst, result);
if (dst.is_empty()) {
IF_VERBOSE(3, tb.display(verbose_stream() << "fast empty"););
return;
}
}
// slow case
void slow_pass(udoc_relation& t, udoc_relation const& n) {
udoc & dst = t.get_udoc();
udoc const & neg = n.get_udoc();
doc_manager& dmt = t.get_dm();
doc_manager& dmn = n.get_dm();
udoc renamed_neg;
for (unsigned i = 0; i < neg.size(); ++i) {
doc& neg_i = neg[i];
@ -1142,8 +1153,9 @@ namespace datalog {
TRACE("doc", dst.display(dmt, tout) << "\n";);
SASSERT(dst.well_formed(dmt));
renamed_neg.reset(dmt);
IF_VERBOSE(3, tb.display(verbose_stream() << "slow case:"););
IF_VERBOSE(3, t.display(verbose_stream() << "slow case:"););
}
bool copy_columns(
tbv& dst, tbv const& src,
udoc_relation const& dstt,

View file

@ -91,10 +91,12 @@ namespace datalog {
class filter_by_union_fn;
class filter_proj_fn;
class negation_filter_fn;
ast_manager& m;
bv_util bv;
dl_decl_util dl;
ast_manager& m;
bv_util bv;
dl_decl_util dl;
u_map<doc_manager*> m_dms;
bool m_disable_fast_pass;
doc_manager& dm(unsigned sz);
doc_manager& dm(relation_signature const& sig);
static udoc_relation& get(relation_base& r);
@ -136,6 +138,7 @@ namespace datalog {
virtual relation_transformer_fn * mk_filter_interpreted_and_project_fn(
const relation_base & t, app * condition,
unsigned removed_col_cnt, const unsigned * removed_cols);
void disable_fast_pass() { m_disable_fast_pass = true; }
};
};

View file

@ -144,13 +144,17 @@ public:
udoc_relation* t1, *t2, *t3;
expr_ref fml(m);
test_join(1000);
test_filter_neg4(false);
test_filter_neg4(true);
test_rename();
test_filter_neg();
test_filter_neg2();
test_filter_neg3();
test_join(1000);
test_rename();
// empty
{
@ -635,6 +639,25 @@ public:
t2->deallocate();
}
void test_filter_neg4(bool disable_fast) {
relation_signature sig1, sig2;
sig1.push_back(bv.mk_sort(2));
sig1.push_back(bv.mk_sort(2));
sig2.push_back(bv.mk_sort(2));
unsigned_vector cols1, cols2;
cols1.push_back(0);
cols1.push_back(1);
cols2.push_back(0);
cols2.push_back(0);
udoc_relation* tgt = mk_full(sig1);
udoc_relation* neg = mk_full(sig2);
if (disable_fast) p.disable_fast_pass();
apply_filter_neg(*tgt, *neg, cols1, cols2);
tgt->deallocate();
neg->deallocate();
}
void set_random(udoc_relation& r, unsigned num_vals) {
unsigned num_bits = r.get_dm().num_tbits();
udoc_relation* full = mk_full(r.get_signature());