mirror of
https://github.com/Z3Prover/z3
synced 2025-06-27 00:18:45 +00:00
add simple bounded CLP backend
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
8038c719fb
commit
65b52ba3e9
3 changed files with 41 additions and 1 deletions
|
@ -547,6 +547,8 @@ namespace datalog {
|
||||||
throw default_exception("get_num_levels is not supported for bmc");
|
throw default_exception("get_num_levels is not supported for bmc");
|
||||||
case TAB_ENGINE:
|
case TAB_ENGINE:
|
||||||
throw default_exception("get_num_levels is not supported for tab");
|
throw default_exception("get_num_levels is not supported for tab");
|
||||||
|
case CLP_ENGINE:
|
||||||
|
throw default_exception("get_num_levels is not supported for clp");
|
||||||
default:
|
default:
|
||||||
throw default_exception("unknown engine");
|
throw default_exception("unknown engine");
|
||||||
}
|
}
|
||||||
|
@ -565,6 +567,8 @@ namespace datalog {
|
||||||
throw default_exception("operation is not supported for BMC engine");
|
throw default_exception("operation is not supported for BMC engine");
|
||||||
case TAB_ENGINE:
|
case TAB_ENGINE:
|
||||||
throw default_exception("operation is not supported for TAB engine");
|
throw default_exception("operation is not supported for TAB engine");
|
||||||
|
case CLP_ENGINE:
|
||||||
|
throw default_exception("operation is not supported for CLP engine");
|
||||||
default:
|
default:
|
||||||
throw default_exception("unknown engine");
|
throw default_exception("unknown engine");
|
||||||
}
|
}
|
||||||
|
@ -584,6 +588,8 @@ namespace datalog {
|
||||||
throw default_exception("operation is not supported for BMC engine");
|
throw default_exception("operation is not supported for BMC engine");
|
||||||
case TAB_ENGINE:
|
case TAB_ENGINE:
|
||||||
throw default_exception("operation is not supported for TAB engine");
|
throw default_exception("operation is not supported for TAB engine");
|
||||||
|
case CLP_ENGINE:
|
||||||
|
throw default_exception("operation is not supported for CLP engine");
|
||||||
default:
|
default:
|
||||||
throw default_exception("unknown engine");
|
throw default_exception("unknown engine");
|
||||||
}
|
}
|
||||||
|
@ -711,6 +717,10 @@ namespace datalog {
|
||||||
check_existential_tail(r);
|
check_existential_tail(r);
|
||||||
check_positive_predicates(r);
|
check_positive_predicates(r);
|
||||||
break;
|
break;
|
||||||
|
case CLP_ENGINE:
|
||||||
|
check_existential_tail(r);
|
||||||
|
check_positive_predicates(r);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
break;
|
break;
|
||||||
|
@ -984,6 +994,9 @@ namespace datalog {
|
||||||
else if (e == symbol("tab")) {
|
else if (e == symbol("tab")) {
|
||||||
m_engine = TAB_ENGINE;
|
m_engine = TAB_ENGINE;
|
||||||
}
|
}
|
||||||
|
else if (e == symbol("clp")) {
|
||||||
|
m_engine = CLP_ENGINE;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_engine == LAST_ENGINE) {
|
if (m_engine == LAST_ENGINE) {
|
||||||
expr_fast_mark1 mark;
|
expr_fast_mark1 mark;
|
||||||
|
@ -1019,6 +1032,8 @@ namespace datalog {
|
||||||
return bmc_query(query);
|
return bmc_query(query);
|
||||||
case TAB_ENGINE:
|
case TAB_ENGINE:
|
||||||
return tab_query(query);
|
return tab_query(query);
|
||||||
|
case CLP_ENGINE:
|
||||||
|
return clp_query(query);
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
return rel_query(query);
|
return rel_query(query);
|
||||||
|
@ -1083,11 +1098,22 @@ namespace datalog {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void context::ensure_clp() {
|
||||||
|
if (!m_clp.get()) {
|
||||||
|
m_clp = alloc(clp, *this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
lbool context::tab_query(expr* query) {
|
lbool context::tab_query(expr* query) {
|
||||||
ensure_tab();
|
ensure_tab();
|
||||||
return m_tab->query(query);
|
return m_tab->query(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lbool context::clp_query(expr* query) {
|
||||||
|
ensure_clp();
|
||||||
|
return m_clp->query(query);
|
||||||
|
}
|
||||||
|
|
||||||
void context::ensure_rel() {
|
void context::ensure_rel() {
|
||||||
if (!m_rel.get()) {
|
if (!m_rel.get()) {
|
||||||
m_rel = alloc(rel_context, *this);
|
m_rel = alloc(rel_context, *this);
|
||||||
|
@ -1128,6 +1154,10 @@ namespace datalog {
|
||||||
ensure_tab();
|
ensure_tab();
|
||||||
m_last_answer = m_tab->get_answer();
|
m_last_answer = m_tab->get_answer();
|
||||||
return m_last_answer.get();
|
return m_last_answer.get();
|
||||||
|
case CLP_ENGINE:
|
||||||
|
ensure_clp();
|
||||||
|
m_last_answer = m_clp->get_answer();
|
||||||
|
return m_last_answer.get();
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
@ -1153,6 +1183,10 @@ namespace datalog {
|
||||||
ensure_tab();
|
ensure_tab();
|
||||||
m_tab->display_certificate(out);
|
m_tab->display_certificate(out);
|
||||||
return true;
|
return true;
|
||||||
|
case CLP_ENGINE:
|
||||||
|
ensure_clp();
|
||||||
|
m_clp->display_certificate(out);
|
||||||
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ Revision History:
|
||||||
#include"dl_rule_transformer.h"
|
#include"dl_rule_transformer.h"
|
||||||
#include"expr_abstract.h"
|
#include"expr_abstract.h"
|
||||||
#include"expr_functors.h"
|
#include"expr_functors.h"
|
||||||
|
#include"clp_context.h"
|
||||||
|
|
||||||
namespace datalog {
|
namespace datalog {
|
||||||
|
|
||||||
|
@ -124,6 +124,7 @@ namespace datalog {
|
||||||
scoped_ptr<bmc> m_bmc;
|
scoped_ptr<bmc> m_bmc;
|
||||||
scoped_ptr<rel_context> m_rel;
|
scoped_ptr<rel_context> m_rel;
|
||||||
scoped_ptr<tab> m_tab;
|
scoped_ptr<tab> m_tab;
|
||||||
|
scoped_ptr<clp> m_clp;
|
||||||
|
|
||||||
bool m_closed;
|
bool m_closed;
|
||||||
bool m_saturation_was_run;
|
bool m_saturation_was_run;
|
||||||
|
@ -477,6 +478,8 @@ namespace datalog {
|
||||||
|
|
||||||
void ensure_tab();
|
void ensure_tab();
|
||||||
|
|
||||||
|
void ensure_clp();
|
||||||
|
|
||||||
void ensure_rel();
|
void ensure_rel();
|
||||||
|
|
||||||
void new_query();
|
void new_query();
|
||||||
|
@ -489,6 +492,8 @@ namespace datalog {
|
||||||
|
|
||||||
lbool tab_query(expr* query);
|
lbool tab_query(expr* query);
|
||||||
|
|
||||||
|
lbool clp_query(expr* query);
|
||||||
|
|
||||||
void check_quantifier_free(rule_ref& r);
|
void check_quantifier_free(rule_ref& r);
|
||||||
void check_uninterpreted_free(rule_ref& r);
|
void check_uninterpreted_free(rule_ref& r);
|
||||||
void check_existential_tail(rule_ref& r);
|
void check_existential_tail(rule_ref& r);
|
||||||
|
|
|
@ -54,6 +54,7 @@ namespace datalog {
|
||||||
BMC_ENGINE,
|
BMC_ENGINE,
|
||||||
QBMC_ENGINE,
|
QBMC_ENGINE,
|
||||||
TAB_ENGINE,
|
TAB_ENGINE,
|
||||||
|
CLP_ENGINE,
|
||||||
LAST_ENGINE
|
LAST_ENGINE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue