mirror of
https://github.com/Z3Prover/z3
synced 2025-09-25 10:51:29 +00:00
bmc improvements, move fd_solver to self-contained directory
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
fd09b1a7d0
commit
e041ebbe80
21 changed files with 120 additions and 76 deletions
|
@ -57,7 +57,8 @@ namespace datalog {
|
|||
m_hnf(m),
|
||||
m_qe(m, params_ref(), false),
|
||||
m_rwr(m),
|
||||
m_ufproc(m) {}
|
||||
m_ufproc(m),
|
||||
m_fd_proc(m) {}
|
||||
|
||||
void rule_manager::inc_ref(rule * r) {
|
||||
if (r) {
|
||||
|
@ -928,6 +929,23 @@ namespace datalog {
|
|||
return exist || univ;
|
||||
}
|
||||
|
||||
bool rule_manager::is_finite_domain(rule const& r) const {
|
||||
m_visited.reset();
|
||||
m_fd_proc.reset();
|
||||
for (unsigned i = r.get_uninterpreted_tail_size(); i < r.get_tail_size(); ++i) {
|
||||
for_each_expr_core<fd_finder_proc,expr_sparse_mark, true, false>(m_fd_proc, m_visited, r.get_tail(i));
|
||||
}
|
||||
for (unsigned i = 0; i < r.get_uninterpreted_tail_size(); ++i) {
|
||||
for (expr* arg : *r.get_tail(i)) {
|
||||
for_each_expr_core<fd_finder_proc,expr_sparse_mark, true, false>(m_fd_proc, m_visited, arg);
|
||||
}
|
||||
}
|
||||
for (expr* arg : *r.get_head()) {
|
||||
for_each_expr_core<fd_finder_proc,expr_sparse_mark, true, false>(m_fd_proc, m_visited, arg);
|
||||
}
|
||||
return m_fd_proc.is_fd();
|
||||
}
|
||||
|
||||
bool rule::has_negation() const {
|
||||
for (unsigned i = 0; i < get_uninterpreted_tail_size(); ++i) {
|
||||
if (is_neg_tail(i)) {
|
||||
|
|
|
@ -92,6 +92,20 @@ namespace datalog {
|
|||
void reset() { m_exist = m_univ = false; }
|
||||
};
|
||||
|
||||
struct fd_finder_proc {
|
||||
ast_manager& m;
|
||||
bv_util m_bv;
|
||||
bool m_is_fd;
|
||||
fd_finder_proc(ast_manager& m): m(m), m_bv(m), m_is_fd(true) {}
|
||||
|
||||
bool is_fd() const { return m_is_fd; }
|
||||
bool is_fd(sort* s) { return m.is_bool(s) || m_bv.is_bv_sort(s); }
|
||||
void operator()(var* n) { m_is_fd &= is_fd(n->get_sort()); }
|
||||
void operator()(quantifier* ) { m_is_fd = false; }
|
||||
void operator()(app* n) { m_is_fd &= is_fd(n->get_decl()->get_range()); }
|
||||
void reset() { m_is_fd = true; }
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
\brief Manager for the \c rule class
|
||||
|
@ -117,6 +131,7 @@ namespace datalog {
|
|||
mutable uninterpreted_function_finder_proc m_ufproc;
|
||||
mutable quantifier_finder_proc m_qproc;
|
||||
mutable expr_sparse_mark m_visited;
|
||||
mutable fd_finder_proc m_fd_proc;
|
||||
|
||||
|
||||
// only the context can create a rule_manager
|
||||
|
@ -265,6 +280,7 @@ namespace datalog {
|
|||
bool has_uninterpreted_non_predicates(rule const& r, func_decl*& f) const;
|
||||
void has_quantifiers(rule const& r, bool& existential, bool& universal) const;
|
||||
bool has_quantifiers(rule const& r) const;
|
||||
bool is_finite_domain(rule const& r) const;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -501,6 +501,14 @@ namespace datalog {
|
|||
}
|
||||
}
|
||||
|
||||
bool rule_set::is_finite_domain() const {
|
||||
for (rule * r : *this) {
|
||||
if (!get_rule_manager().is_finite_domain(*r))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void rule_set::display_deps( std::ostream & out ) const
|
||||
{
|
||||
|
|
|
@ -253,6 +253,7 @@ namespace datalog {
|
|||
const func_decl_set & get_output_predicates() const { return m_output_preds; }
|
||||
func_decl* get_output_predicate() const { SASSERT(m_output_preds.size() == 1); return *m_output_preds.begin(); }
|
||||
|
||||
bool is_finite_domain() const;
|
||||
|
||||
void display(std::ostream & out) const;
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
def_module_params('fp',
|
||||
description='fixedpoint parameters',
|
||||
export=True,
|
||||
params=(('timeout', UINT, UINT_MAX, 'set timeout'),
|
||||
('engine', SYMBOL, 'auto-config',
|
||||
params=(('engine', SYMBOL, 'auto-config',
|
||||
'Select: auto-config, datalog, bmc, spacer'),
|
||||
('datalog.default_table', SYMBOL, 'sparse',
|
||||
'default table implementation: sparse, hashtable, bitvector, interval'),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue