diff --git a/src/muz_qe/dl_base.cpp b/src/muz_qe/dl_base.cpp index 89ebc7e4e..dd817754f 100644 --- a/src/muz_qe/dl_base.cpp +++ b/src/muz_qe/dl_base.cpp @@ -325,9 +325,20 @@ namespace datalog { return res; } + /** + \brief Default method for complementation. + + It assumes that the compiler creates only tables with + at most one column (0 or 1 columns). + Complementation of tables with more than one columns + is transformed into a cross product of complements and/or + difference. + + */ table_base * table_base::complement(func_decl* p, const table_element * func_columns) const { const table_signature & sig = get_signature(); SASSERT(sig.functional_columns()==0 || func_columns!=0); + SASSERT(sig.first_functional() <= 1); table_base * res = get_plugin().mk_empty(sig); @@ -335,16 +346,14 @@ namespace datalog { fact.resize(sig.first_functional()); fact.append(sig.functional_columns(), func_columns); - if(sig.first_functional()==0) { - if(empty()) { + if (sig.first_functional() == 0) { + if (empty()) { res->add_fact(fact); } return res; } - if(sig.first_functional()!=1) { //now we support only tables with one non-functional column - NOT_IMPLEMENTED_YET(); - } + VERIFY(sig.first_functional() == 1); uint64 upper_bound = get_signature()[0]; bool empty_table = empty(); @@ -356,51 +365,13 @@ namespace datalog { warning_msg(buffer.str().c_str()); } - for(table_element i=0; iadd_fact(fact); } } return res; -#if 0 - svector var_arg_indexes(arity); - var_arg_indexes.fill(0); - - svector var_arg_domain_sizes = s; - - unsigned var_cnt=var_arg_indexes.size(); - table_fact fact; - fact.resize(arity); - fact.fill(0); - unsigned depth=arity; - - while(true) { - if(depth==arity) { - SASSERT(!res->contains_fact(fact)); - if(empty_table || !contains_fact(fact)) { - res->add_fact(fact); - } - depth--; - } - else if(fact[depth]==s[depth]-1) { - val_indexes[depth]=0; - if(depth==0) { - break; - } - depth--; - } - else { - SASSERT(val_indexes[depth] soln; @@ -378,7 +377,6 @@ namespace datalog { } void mk_karr_invariants::update_body(rule_set& rules, rule& r){ - func_decl* p = r.get_decl(); unsigned utsz = r.get_uninterpreted_tail_size(); unsigned tsz = r.get_tail_size(); app_ref_vector tail(m); diff --git a/src/muz_qe/dl_relation_manager.cpp b/src/muz_qe/dl_relation_manager.cpp index 76d538b08..3407f8fbe 100644 --- a/src/muz_qe/dl_relation_manager.cpp +++ b/src/muz_qe/dl_relation_manager.cpp @@ -243,15 +243,14 @@ namespace datalog { relation_plugin & relation_manager::get_appropriate_plugin(const relation_signature & s) { relation_plugin * res = try_get_appropriate_plugin(s); - if(!res) { + if (!res) { throw default_exception("no suitable plugin found for given relation signature"); - throw 0; } return *res; } table_plugin * relation_manager::try_get_appropriate_plugin(const table_signature & t) { - if(m_favourite_table_plugin && m_favourite_table_plugin->can_handle_signature(t)) { + if (m_favourite_table_plugin && m_favourite_table_plugin->can_handle_signature(t)) { return m_favourite_table_plugin; } table_plugin_vector::iterator tpit = m_table_plugins.begin(); @@ -346,7 +345,7 @@ namespace datalog { return p->mk_empty(s); } - if(mk_empty_table_relation(s, res)) { + if (mk_empty_table_relation(s, res)) { return res; } @@ -884,10 +883,10 @@ namespace datalog { SASSERT(plugin->can_handle_signature(res_sign)); table_base * res = plugin->mk_empty(res_sign); - unsigned t1cols=t1.get_signature().size(); - unsigned t2cols=t2.get_signature().size(); - unsigned t1first_func=t1.get_signature().first_functional(); - unsigned t2first_func=t2.get_signature().first_functional(); + unsigned t1cols = t1.get_signature().size(); + unsigned t2cols = t2.get_signature().size(); + unsigned t1first_func = t1.get_signature().first_functional(); + unsigned t2first_func = t2.get_signature().first_functional(); table_base::iterator els1it = t1.begin(); table_base::iterator els1end = t1.end(); diff --git a/src/muz_qe/horn_tactic.cpp b/src/muz_qe/horn_tactic.cpp index c22474a7c..b588b07ba 100644 --- a/src/muz_qe/horn_tactic.cpp +++ b/src/muz_qe/horn_tactic.cpp @@ -233,7 +233,6 @@ class horn_tactic : public tactic { lbool is_reachable = m_ctx.query(q); g->inc_depth(); - bool produce_models = g->models_enabled(); bool produce_proofs = g->proofs_enabled(); result.push_back(g.get()); diff --git a/src/muz_qe/rel_context.cpp b/src/muz_qe/rel_context.cpp index 1b4042ab9..00ac51e9f 100644 --- a/src/muz_qe/rel_context.cpp +++ b/src/muz_qe/rel_context.cpp @@ -31,9 +31,6 @@ Revision History: #include"dl_sparse_table.h" #include"dl_table.h" #include"dl_table_relation.h" -#ifndef _EXTERNAL_RELEASE -#include"dl_skip_table.h" -#endif namespace datalog { @@ -44,16 +41,16 @@ namespace datalog { m_answer(m), m_cancel(false), m_last_result_relation(0) { + + // register plugins for builtin tables + get_rmanager().register_plugin(alloc(sparse_table_plugin, get_rmanager())); get_rmanager().register_plugin(alloc(hashtable_table_plugin, get_rmanager())); get_rmanager().register_plugin(alloc(bitvector_table_plugin, get_rmanager())); get_rmanager().register_plugin(alloc(equivalence_table_plugin, get_rmanager())); -#ifndef _EXTERNAL_RELEASE - get_rmanager().register_plugin(alloc(skip_table_plugin, get_rmanager())); -#endif - //register plugins for builtin relations + // register plugins for builtin relations get_rmanager().register_plugin(alloc(bound_relation_plugin, get_rmanager())); get_rmanager().register_plugin(alloc(interval_relation_plugin, get_rmanager()));