mirror of
https://github.com/Z3Prover/z3
synced 2025-08-31 23:34:55 +00:00
tune and fix doc
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
16f80fce92
commit
918d52f1b0
13 changed files with 188 additions and 103 deletions
|
@ -31,6 +31,7 @@ Revision History:
|
|||
#include"hnf.h"
|
||||
#include"qe_lite.h"
|
||||
#include"var_subst.h"
|
||||
#include"datatype_decl_plugin.h"
|
||||
|
||||
namespace datalog {
|
||||
|
||||
|
@ -43,6 +44,57 @@ namespace datalog {
|
|||
typedef obj_ref<rule, rule_manager> rule_ref;
|
||||
typedef ref_vector<rule, rule_manager> rule_ref_vector;
|
||||
typedef ptr_vector<rule> rule_vector;
|
||||
|
||||
|
||||
struct quantifier_finder_proc {
|
||||
bool m_exist;
|
||||
bool m_univ;
|
||||
quantifier_finder_proc() : m_exist(false), m_univ(false) {}
|
||||
void operator()(var * n) { }
|
||||
void operator()(quantifier * n) {
|
||||
if (n->is_forall()) {
|
||||
m_univ = true;
|
||||
}
|
||||
else {
|
||||
SASSERT(n->is_exists());
|
||||
m_exist = true;
|
||||
}
|
||||
}
|
||||
void operator()(app * n) { }
|
||||
void reset() { m_exist = m_univ = false; }
|
||||
};
|
||||
|
||||
struct uninterpreted_function_finder_proc {
|
||||
ast_manager& m;
|
||||
datatype_util m_dt;
|
||||
bool m_found;
|
||||
func_decl* m_func;
|
||||
uninterpreted_function_finder_proc(ast_manager& m):
|
||||
m(m), m_dt(m), m_found(false), m_func(0) {}
|
||||
|
||||
void reset() { m_found = false; m_func = 0; }
|
||||
|
||||
void operator()(var * n) { }
|
||||
void operator()(quantifier * n) { }
|
||||
void operator()(app * n) {
|
||||
if (is_uninterp(n)) {
|
||||
m_found = true;
|
||||
m_func = n->get_decl();
|
||||
}
|
||||
else if (m_dt.is_accessor(n)) {
|
||||
sort* s = m.get_sort(n->get_arg(0));
|
||||
SASSERT(m_dt.is_datatype(s));
|
||||
if (m_dt.get_datatype_constructors(s)->size() > 1) {
|
||||
m_found = true;
|
||||
m_func = n->get_decl();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool found(func_decl*& f) const { f = m_func; return m_found; }
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
\brief Manager for the \c rule class
|
||||
|
||||
|
@ -75,6 +127,9 @@ namespace datalog {
|
|||
qe_lite m_qe;
|
||||
remove_label_cfg m_cfg;
|
||||
rewriter_tpl<remove_label_cfg> m_rwr;
|
||||
mutable uninterpreted_function_finder_proc m_ufproc;
|
||||
mutable quantifier_finder_proc m_qproc;
|
||||
mutable expr_sparse_mark m_visited;
|
||||
|
||||
|
||||
// only the context can create a rule_manager
|
||||
|
@ -220,6 +275,10 @@ namespace datalog {
|
|||
|
||||
std::ostream& display_smt2(rule const& r, std::ostream & out);
|
||||
|
||||
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;
|
||||
|
||||
};
|
||||
|
||||
class rule : public accounted_object {
|
||||
|
@ -295,9 +354,6 @@ namespace datalog {
|
|||
*/
|
||||
bool is_in_tail(const func_decl * p, bool only_positive=false) const;
|
||||
|
||||
bool has_uninterpreted_non_predicates(ast_manager& m, func_decl*& f) const;
|
||||
void has_quantifiers(bool& existential, bool& universal) const;
|
||||
bool has_quantifiers() const;
|
||||
bool has_negation() const;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue