3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-24 01:25:31 +00:00

merge with master

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2018-03-25 14:57:01 -07:00
commit c513f3ca09
883 changed files with 13979 additions and 16480 deletions

View file

@ -82,7 +82,7 @@ namespace datalog {
void get_labels(proof* p, labels&);
public:
boogie_proof(ast_manager& m): m(m), m_proof(m), m_model(0) {}
boogie_proof(ast_manager& m): m(m), m_proof(m), m_model(nullptr) {}
void set_proof(proof* p);

View file

@ -90,10 +90,10 @@ namespace datalog {
return idx;
}
virtual unsigned get_constant_count() const {
unsigned get_constant_count() const override {
return m_el_names.size();
}
virtual void print_element(finite_element el_num, std::ostream & out) {
void print_element(finite_element el_num, std::ostream & out) override {
if (el_num>=m_el_names.size()) {
out << el_num;
return;
@ -132,10 +132,10 @@ namespace datalog {
}
return idx;
}
virtual unsigned get_constant_count() const {
unsigned get_constant_count() const override {
return m_el_names.size();
}
virtual void print_element(finite_element el_num, std::ostream & out) {
void print_element(finite_element el_num, std::ostream & out) override {
if (el_num >= m_el_names.size()) {
out << "<unk " << m_sort->get_name() << ":" << el_num << '>';
return;
@ -154,14 +154,14 @@ namespace datalog {
rule_set* m_old_rules;
void reset() {
dealloc(m_old_rules);
m_old_rules = 0;
m_old_rules = nullptr;
}
public:
restore_rules(rule_set& r): m_old_rules(alloc(rule_set, r)) {}
virtual ~restore_rules() {}
~restore_rules() override {}
virtual void undo(context& ctx) {
void undo(context& ctx) override {
ctx.replace_rules(*m_old_rules);
reset();
}
@ -173,8 +173,8 @@ namespace datalog {
unsigned m_old_size;
public:
restore_vec_size_trail(Vec& v): m_vector(v), m_old_size(v.size()) {}
virtual ~restore_vec_size_trail() {}
virtual void undo(Ctx& ctx) { m_vector.shrink(m_old_size); }
~restore_vec_size_trail() override {}
void undo(Ctx& ctx) override { m_vector.shrink(m_old_size); }
};
void context::push() {
@ -221,9 +221,9 @@ namespace datalog {
m_rule_fmls_head(0),
m_rule_fmls(m),
m_background(m),
m_mc(0),
m_rel(0),
m_engine(0),
m_mc(nullptr),
m_rel(nullptr),
m_engine(nullptr),
m_closed(false),
m_saturation_was_run(false),
m_enable_bind_variables(true),
@ -251,8 +251,8 @@ namespace datalog {
m_preds.reset();
m_preds_by_name.reset();
reset_dealloc_values(m_sorts);
m_engine = 0;
m_rel = 0;
m_engine = nullptr;
m_rel = nullptr;
}
bool context::is_fact(app * head) const {
@ -400,7 +400,7 @@ namespace datalog {
}
uint64 res;
if (!try_get_sort_constant_count(srt, res)) {
sort_size sz = srt->get_num_elements();
const sort_size & sz = srt->get_num_elements();
if (sz.is_finite()) {
res = sz.size();
}
@ -411,7 +411,7 @@ namespace datalog {
return res;
}
void context::set_argument_names(const func_decl * pred, svector<symbol> var_names)
void context::set_argument_names(const func_decl * pred, const svector<symbol> & var_names)
{
SASSERT(!m_argument_var_names.contains(pred));
m_argument_var_names.insert(pred, var_names);
@ -465,7 +465,7 @@ namespace datalog {
scoped_proof_mode _scp(m, generate_proof_trace()?PGM_ENABLED:PGM_DISABLED);
while (m_rule_fmls_head < m_rule_fmls.size()) {
expr* fml = m_rule_fmls[m_rule_fmls_head].get();
proof* p = generate_proof_trace()?m.mk_asserted(fml):0;
proof* p = generate_proof_trace()?m.mk_asserted(fml):nullptr;
rm.mk_rule(fml, p, m_rule_set, m_rule_names[m_rule_fmls_head]);
++m_rule_fmls_head;
}
@ -478,7 +478,7 @@ namespace datalog {
//
void context::update_rule(expr* rl, symbol const& name) {
datalog::rule_manager& rm = get_rule_manager();
proof* p = 0;
proof* p = nullptr;
if (generate_proof_trace()) {
p = m.mk_asserted(rl);
}
@ -493,7 +493,7 @@ namespace datalog {
// The new rule is inserted last:
rule_ref r(m_rule_set.get_rule(size_before), rm);
rule_ref_vector const& rls = m_rule_set.get_rules();
rule* old_rule = 0;
rule* old_rule = nullptr;
for (unsigned i = 0; i < size_before; ++i) {
if (rls[i]->name() == name) {
if (old_rule) {
@ -861,8 +861,8 @@ namespace datalog {
lbool context::query(expr* query) {
m_mc = mk_skip_model_converter();
m_last_status = OK;
m_last_answer = 0;
m_last_ground_answer = 0;
m_last_answer = nullptr;
m_last_ground_answer = nullptr;
switch (get_engine()) {
case DATALOG_ENGINE:
case SPACER_ENGINE:
@ -890,8 +890,8 @@ namespace datalog {
lbool context::query_from_lvl (expr* query, unsigned lvl) {
m_mc = mk_skip_model_converter();
m_last_status = OK;
m_last_answer = 0;
m_last_ground_answer = 0;
m_last_answer = nullptr;
m_last_ground_answer = nullptr;
switch (get_engine()) {
case DATALOG_ENGINE:
case SPACER_ENGINE:
@ -933,7 +933,7 @@ namespace datalog {
}
lbool context::rel_query(unsigned num_rels, func_decl * const* rels) {
m_last_answer = 0;
m_last_answer = nullptr;
ensure_engine();
return m_engine->query(num_rels, rels);
}
@ -1059,7 +1059,7 @@ namespace datalog {
for (unsigned i = m_rule_fmls_head; i < m_rule_fmls.size(); ++i) {
m_free_vars(m_rule_fmls[i].get());
if (!m_free_vars.empty()) {
rm.mk_rule(m_rule_fmls[i].get(), 0, m_rule_set, m_rule_names[i]);
rm.mk_rule(m_rule_fmls[i].get(), nullptr, m_rule_set, m_rule_names[i]);
m_rule_fmls[i] = m_rule_fmls.back();
m_rule_names[i] = m_rule_names.back();
m_rule_fmls.pop_back();
@ -1106,6 +1106,16 @@ namespace datalog {
names.push_back(m_rule_names[i]);
}
}
static std::ostream& display_symbol(std::ostream& out, symbol const& nm) {
if (is_smt2_quoted_symbol(nm)) {
out << mk_smt2_quoted_symbol(nm);
}
else {
out << nm;
}
return out;
}
void context::display_smt2(unsigned num_queries, expr* const* qs, std::ostream& out) {
ast_manager& m = get_manager();
@ -1148,13 +1158,13 @@ namespace datalog {
if (!use_fixedpoint_extensions) {
out << "(set-logic HORN)\n";
}
for (func_decl * f : rels)
visitor.remove_decl(f);
visitor.display_decls(out);
func_decl_set::iterator it = rels.begin(), end = rels.end();
for (; it != end; ++it) {
func_decl* f = *it;
for (func_decl * f : rels)
display_rel_decl(out, f);
}
if (use_fixedpoint_extensions && do_declare_vars) {
declare_vars(rules, fresh_names, out);
@ -1185,13 +1195,7 @@ namespace datalog {
nm = symbol(s.str().c_str());
}
fresh_names.add(nm);
if (is_smt2_quoted_symbol(nm)) {
out << mk_smt2_quoted_symbol(nm);
}
else {
out << nm;
}
out << ")";
display_symbol(out, nm) << ")";
}
out << ")\n";
}
@ -1219,7 +1223,8 @@ namespace datalog {
PP(qfn);
out << ")\n";
}
out << "(query " << fn->get_name() << ")\n";
out << "(query ";
display_symbol(out, fn->get_name()) << ")\n";
}
}
else {
@ -1238,7 +1243,8 @@ namespace datalog {
void context::display_rel_decl(std::ostream& out, func_decl* f) {
smt2_pp_environment_dbg env(m);
out << "(declare-rel " << f->get_name() << " (";
out << "(declare-rel ";
display_symbol(out, f->get_name()) << " (";
for (unsigned i = 0; i < f->get_arity(); ++i) {
ast_smt2_pp(out, f->get_domain(i), env);
if (i + 1 < f->get_arity()) {

View file

@ -110,7 +110,7 @@ namespace datalog {
class rel_context_base : public engine_base {
public:
rel_context_base(ast_manager& m, char const* name): engine_base(m, name) {}
virtual ~rel_context_base() {}
~rel_context_base() override {}
virtual relation_manager & get_rmanager() = 0;
virtual const relation_manager & get_rmanager() const = 0;
virtual relation_base & get_relation(func_decl * pred) = 0;
@ -146,9 +146,9 @@ namespace datalog {
context const& ctx;
public:
contains_pred(context& ctx): ctx(ctx) {}
virtual ~contains_pred() {}
~contains_pred() override {}
virtual bool operator()(expr* e) {
bool operator()(expr* e) override {
return ctx.is_predicate(e);
}
};
@ -331,7 +331,7 @@ namespace datalog {
names. Generally, the names coming from the parses are registered here.
*/
func_decl * try_get_predicate_decl(symbol const& pred_name) const {
func_decl * res = 0;
func_decl * res = nullptr;
m_preds_by_name.find(pred_name, res);
return res;
}
@ -341,7 +341,7 @@ namespace datalog {
*/
func_decl * mk_fresh_head_predicate(symbol const & prefix, symbol const & suffix,
unsigned arity, sort * const * domain, func_decl* orig_pred=0);
unsigned arity, sort * const * domain, func_decl* orig_pred=nullptr);
/**
@ -368,7 +368,7 @@ namespace datalog {
These names are used when printing out the relations to make the output conform
to the one of bddbddb.
*/
void set_argument_names(const func_decl * pred, svector<symbol> var_names);
void set_argument_names(const func_decl * pred, const svector<symbol> & var_names);
symbol get_argument_name(const func_decl * pred, unsigned arg_index);
void set_predicate_representation(func_decl * pred, unsigned relation_name_cnt,

View file

@ -128,7 +128,7 @@ namespace datalog {
//
// -----------------------------------
cost_recorder::cost_recorder() : m_obj(0) {
cost_recorder::cost_recorder() : m_obj(nullptr) {
m_stopwatch = alloc(stopwatch);
m_stopwatch->start();
}
@ -149,7 +149,7 @@ namespace datalog {
c.milliseconds+=time_delta;
m_obj->m_being_recorded = false;
}
m_running = obj!=0;
m_running = obj!=nullptr;
m_obj = obj;
m_last_time = curr_time;
if(obj) {

View file

@ -63,7 +63,7 @@ namespace datalog {
costs m_processed_cost;
bool m_being_recorded;
protected:
accounted_object() : m_context(0), m_parent_object(0), m_being_recorded(false) {}
accounted_object() : m_context(nullptr), m_parent_object(nullptr), m_being_recorded(false) {}
~accounted_object();
public:
@ -107,7 +107,7 @@ namespace datalog {
before separately.
*/
void start(accounted_object *);
void finish() { start(0); }
void finish() { start(nullptr); }
};
};

View file

@ -81,7 +81,7 @@ namespace datalog {
}
var_idx_set& rule_manager::collect_vars(expr* e) {
return collect_vars(e, 0);
return collect_vars(e, nullptr);
}
var_idx_set& rule_manager::collect_vars(expr* e1, expr* e2) {
@ -274,11 +274,11 @@ namespace datalog {
bind_variables(query, false, q);
quantifier_hoister qh(m);
qh.pull_quantifier(false, q, 0, &names);
qh.pull_quantifier(false, q, nullptr, &names);
// retrieve free variables.
m_free_vars(q);
vars.append(m_free_vars.size(), m_free_vars.c_ptr());
if (vars.contains(static_cast<sort*>(0))) {
if (vars.contains(static_cast<sort*>(nullptr))) {
var_subst sub(m, false);
expr_ref_vector args(m);
// [s0, 0, s2, ..]
@ -306,7 +306,7 @@ namespace datalog {
}
body.push_back(to_app(q));
flatten_body(body);
func_decl* body_pred = 0;
func_decl* body_pred = nullptr;
for (unsigned i = 0; i < body.size(); i++) {
if (is_uninterp(body[i].get())) {
body_pred = body[i]->get_decl();
@ -472,7 +472,7 @@ namespace datalog {
r->m_head = head;
r->m_name = name;
r->m_tail_size = n;
r->m_proof = 0;
r->m_proof = nullptr;
m.inc_ref(r->m_head);
app * * uninterp_tail = r->m_tail; //grows upwards
@ -482,7 +482,7 @@ namespace datalog {
bool has_neg = false;
for (unsigned i = 0; i < n; i++) {
bool is_neg = (is_negated != 0 && is_negated[i]);
bool is_neg = (is_negated != nullptr && is_negated[i]);
app * curr = tail[i];
if (is_neg && !m_ctx.is_predicate(curr)) {
@ -548,7 +548,7 @@ namespace datalog {
r->m_tail_size = n;
r->m_positive_cnt = source->m_positive_cnt;
r->m_uninterp_cnt = source->m_uninterp_cnt;
r->m_proof = 0;
r->m_proof = nullptr;
m.inc_ref(r->m_head);
for (unsigned i = 0; i < n; i++) {
r->m_tail[i] = source->m_tail[i];
@ -978,7 +978,7 @@ namespace datalog {
subst_vals.push_back(m.mk_var(next_fresh_var++, var_srt));
}
else {
subst_vals.push_back(0);
subst_vals.push_back(nullptr);
}
}

View file

@ -54,7 +54,7 @@ namespace datalog {
bool m_found;
func_decl* m_func;
uninterpreted_function_finder_proc(ast_manager& m):
m(m), m_dt(m), m_dl(m), m_found(false), m_func(0) {}
m(m), m_dt(m), m_dl(m), m_found(false), m_func(nullptr) {}
void operator()(var * n) { }
void operator()(quantifier * n) { }
void operator()(app * n) {
@ -71,7 +71,7 @@ namespace datalog {
}
}
}
void reset() { m_found = false; m_func = 0; }
void reset() { m_found = false; m_func = nullptr; }
bool found(func_decl*& f) const { f = m_func; return m_found; }
};
@ -209,7 +209,7 @@ namespace datalog {
\remark A tail may contain negation. tail[i] is assumed to be negated if is_neg != 0 && is_neg[i] == true
*/
rule * mk(app * head, unsigned n, app * const * tail, bool const * is_neg = 0,
rule * mk(app * head, unsigned n, app * const * tail, bool const * is_neg = nullptr,
symbol const& name = symbol::null, bool normalize = true);
/**

View file

@ -282,7 +282,7 @@ namespace datalog {
m_rule_manager(ctx.get_rule_manager()),
m_rules(m_rule_manager),
m_deps(ctx),
m_stratifier(0),
m_stratifier(nullptr),
m_refs(ctx.get_manager()) {
}
@ -291,7 +291,7 @@ namespace datalog {
m_rule_manager(other.m_rule_manager),
m_rules(m_rule_manager),
m_deps(other.m_context),
m_stratifier(0),
m_stratifier(nullptr),
m_refs(m_context.get_manager()) {
add_rules(other);
if (other.m_stratifier) {
@ -307,7 +307,7 @@ namespace datalog {
m_rules.reset();
reset_dealloc_values(m_head2rules);
m_deps.reset();
m_stratifier = 0;
m_stratifier = nullptr;
m_output_preds.reset();
m_orig2pred.reset();
m_pred2orig.reset();
@ -401,7 +401,7 @@ namespace datalog {
m_deps.populate(*this);
m_stratifier = alloc(rule_stratifier, m_deps);
if (!stratified_negation()) {
m_stratifier = 0;
m_stratifier = nullptr;
m_deps.reset();
return false;
}
@ -410,7 +410,7 @@ namespace datalog {
void rule_set::reopen() {
if (is_closed()) {
m_stratifier = 0;
m_stratifier = nullptr;
m_deps.reset();
}
}

View file

@ -87,7 +87,7 @@ namespace datalog {
(higher priority plugins will be applied first).
*/
plugin(unsigned priority, bool can_destratify_negation = false) : m_priority(priority),
m_can_destratify_negation(can_destratify_negation), m_transformer(0) {}
m_can_destratify_negation(can_destratify_negation), m_transformer(nullptr) {}
public:
virtual ~plugin() {}

View file

@ -34,7 +34,7 @@ Revision History:
namespace datalog {
verbose_action::verbose_action(char const* msg, unsigned lvl): m_lvl(lvl), m_sw(0) {
verbose_action::verbose_action(char const* msg, unsigned lvl): m_lvl(lvl), m_sw(nullptr) {
IF_VERBOSE(m_lvl,
(verbose_stream() << msg << "...").flush();
m_sw = alloc(stopwatch);
@ -87,7 +87,7 @@ namespace datalog {
else {
SASSERT(is_var(arg));
int vidx = to_var(arg)->get_idx();
var * new_var = 0;
var * new_var = nullptr;
if (!varidx2var.find(vidx, new_var)) {
new_var = m.mk_var(next_idx, to_var(arg)->get_sort());
next_idx++;
@ -277,16 +277,21 @@ namespace datalog {
return get_max_var(has_var);
}
void del_rule(horn_subsume_model_converter* mc, rule& r) {
void del_rule(horn_subsume_model_converter* mc, rule& r, bool unreachable) {
if (mc) {
ast_manager& m = mc->get_manager();
expr_ref_vector body(m);
for (unsigned i = 0; i < r.get_tail_size(); ++i) {
if (r.is_neg_tail(i)) {
body.push_back(m.mk_not(r.get_tail(i)));
}
else {
body.push_back(r.get_tail(i));
if (unreachable) {
body.push_back(m.mk_false());
}
else {
for (unsigned i = 0; i < r.get_tail_size(); ++i) {
if (r.is_neg_tail(i)) {
body.push_back(m.mk_not(r.get_tail(i)));
}
else {
body.push_back(r.get_tail(i));
}
}
}
TRACE("dl_dr",
@ -431,7 +436,7 @@ namespace datalog {
unsigned tgt_sz = max_var_idx+1;
unsigned tgt_ofs = tgt_sz-1;
tgt.resize(tgt_sz, 0);
tgt.resize(tgt_sz, nullptr);
for(unsigned i=0; i<src_sz; i++) {
expr * e = src[src_ofs-i];
if(!e) {
@ -449,7 +454,7 @@ namespace datalog {
out << "(";
for(int i=len-1; i>=0; i--) {
out << (len-1-i) <<"->";
if(cont.get(i)==0) {
if(cont.get(i)==nullptr) {
out << "{none}";
}
else {
@ -547,7 +552,7 @@ namespace datalog {
//
// -----------------------------------
void get_file_names(std::string directory, std::string extension, bool traverse_subdirs,
void get_file_names(std::string directory, const std::string & extension, bool traverse_subdirs,
string_vector & res) {
if(directory[directory.size()-1]!='\\' && directory[directory.size()-1]!='/') {
@ -595,7 +600,7 @@ namespace datalog {
#endif
}
bool file_exists(std::string name) {
bool file_exists(const std::string & name) {
struct stat st;
if(stat(name.c_str(),&st) == 0) {
return true;
@ -603,7 +608,7 @@ namespace datalog {
return false;
}
bool is_directory(std::string name) {
bool is_directory(const std::string & name) {
if(!file_exists(name)) {
return false;
}
@ -612,9 +617,9 @@ namespace datalog {
return (status.st_mode&S_IFDIR)!=0;
}
std::string get_file_name_without_extension(std::string name) {
std::string get_file_name_without_extension(const std::string & name) {
size_t slash_index = name.find_last_of("\\/");
size_t dot_index = name.rfind(".");
size_t dot_index = name.rfind('.');
size_t ofs = (slash_index==std::string::npos) ? 0 : slash_index+1;
size_t count = (dot_index!=std::string::npos && dot_index>ofs) ?
(dot_index-ofs) : std::string::npos;

View file

@ -290,7 +290,7 @@ namespace datalog {
}
template<class T>
void project_out_vector_columns(T & container, const unsigned_vector removed_cols) {
void project_out_vector_columns(T & container, const unsigned_vector & removed_cols) {
project_out_vector_columns(container, removed_cols.size(), removed_cols.c_ptr());
}
@ -342,7 +342,7 @@ namespace datalog {
}
template<class T>
void permutate_by_cycle(T & container, const unsigned_vector permutation_cycle) {
void permutate_by_cycle(T & container, const unsigned_vector & permutation_cycle) {
permutate_by_cycle(container, permutation_cycle.size(), permutation_cycle.c_ptr());
}
@ -354,7 +354,7 @@ namespace datalog {
unsigned get_max_rule_var(const rule& r);
};
void del_rule(horn_subsume_model_converter* mc, rule& r);
void del_rule(horn_subsume_model_converter* mc, rule& r, bool unreachable);
void resolve_rule(rule_manager& rm,
replace_proof_converter* pc, rule const& r1, rule const& r2, unsigned idx,
@ -578,13 +578,13 @@ namespace datalog {
//
// -----------------------------------
void get_file_names(std::string directory, std::string extension, bool traverse_subdirs,
void get_file_names(std::string directory, const std::string & extension, bool traverse_subdirs,
string_vector & res);
bool file_exists(std::string name);
bool is_directory(std::string name);
bool file_exists(const std::string & name);
bool is_directory(const std::string & name);
std::string get_file_name_without_extension(std::string name);
std::string get_file_name_without_extension(const std::string & name);
// -----------------------------------
//

View file

@ -33,7 +33,7 @@ def_module_params('fixedpoint',
"updated relation was modified or not"),
('datalog.compile_with_widening', BOOL, False,
"widening will be used to compile recursive rules"),
('datalog.default_table_checked', BOOL, False, "if true, the detault " +
('datalog.default_table_checked', BOOL, False, "if true, the default " +
'table will be default_table inside a wrapper that checks that its results ' +
'are the same as of default_table_checker table'),
('datalog.default_table_checker', SYMBOL, 'null', "see default_table_checked"),
@ -59,7 +59,7 @@ def_module_params('fixedpoint',
('duality.full_expand', BOOL, False, 'Fully expand derivation trees'),
('duality.no_conj', BOOL, False, 'No forced covering (conjectures)'),
('duality.feasible_edges', BOOL, True,
'Don\'t expand definitley infeasible edges'),
'Don\'t expand definitely infeasible edges'),
('duality.use_underapprox', BOOL, False, 'Use underapproximations'),
('duality.stratified_inlining', BOOL, False, 'Use stratified inlining'),
('duality.recursion_bound', UINT, UINT_MAX,
@ -130,7 +130,7 @@ def_module_params('fixedpoint',
('xform.magic', BOOL, False,
"perform symbolic magic set transformation"),
('xform.scale', BOOL, False,
"add scaling variable to linear real arithemtic clauses"),
"add scaling variable to linear real arithmetic clauses"),
('xform.inline_linear', BOOL, True, "try linear inlining method"),
('xform.inline_eager', BOOL, True, "try eager inlining of rules"),
('xform.inline_linear_branch', BOOL, False,
@ -176,7 +176,7 @@ def_module_params('fixedpoint',
('spacer.elim_aux', BOOL, True, "Eliminate auxiliary variables in reachability facts"),
('spacer.reach_as_init', BOOL, True, "Extend initial rules with computed reachability facts"),
('spacer.blast_term_ite', BOOL, True, "Expand non-Boolean ite-terms"),
('spacer.nondet_tie_break', BOOL, False, "Break ties in obligation queue non-deterministicly"),
('spacer.nondet_tie_break', BOOL, False, "Break ties in obligation queue non-deterministically"),
('spacer.reach_dnf', BOOL, True, "Restrict reachability facts to DNF"),
('bmc.linear_unrolling_depth', UINT, UINT_MAX, "Maximal level to explore"),
('spacer.split_farkas_literals', BOOL, False, "Split Farkas literals"),

View file

@ -153,7 +153,7 @@ public:
m_fresh_predicates.reset();
m_todo.push_back(n);
m_proofs.push_back(p);
m_produce_proofs = p != 0;
m_produce_proofs = p != nullptr;
while (!m_todo.empty() && checkpoint()) {
fml = m_todo.back();
pr = m_proofs.back();
@ -269,7 +269,7 @@ private:
expr* const* args = _or->get_args();
for (unsigned i = 0; i < sz; ++i) {
m_todo.push_back(bind_variables(m.mk_implies(args[i], head)));
m_proofs.push_back(0);
m_proofs.push_back(nullptr);
}
if (premise) {
@ -284,7 +284,7 @@ private:
m_proofs[m_proofs.size()-sz+i] = m.mk_and_elim(p2, i);
}
}
fml = 0;
fml = nullptr;
return;
}
@ -330,7 +330,7 @@ private:
bool is_disj = false;
expr_ref_vector _body(m);
unsigned num_disj = 0;
expr* const* disjs = 0;
expr* const* disjs = nullptr;
if (!contains_predicate(b)) {
return;
}
@ -356,7 +356,7 @@ private:
negate_args = false;
}
if (is_disj) {
app* old_head = 0;
app* old_head = nullptr;
if (m_memoize_disj.find(b, old_head)) {
body = old_head;
}
@ -369,7 +369,7 @@ private:
e = m.mk_not(e);
}
m_todo.push_back(bind_variables(m.mk_implies(e, head)));
m_proofs.push_back(0);
m_proofs.push_back(nullptr);
if (produce_proofs()) {
defs.push_back(m.mk_def_intro(m_todo.back()));
m_proofs[m_proofs.size()-1] = defs.back();
@ -423,7 +423,7 @@ private:
if (!is_predicate(e)) {
app_ref head = mk_fresh_head(e);
m_todo.push_back(bind_variables(m.mk_implies(e, head)));
m_proofs.push_back(0);
m_proofs.push_back(nullptr);
body = m.update_quantifier(q, head);
if (produce_proofs()) {
proof* def_intro = m.mk_def_intro(m_todo.back());

View file

@ -270,7 +270,7 @@ namespace datalog {
TRACE("bmc", tout << "Predicate: " << pred->get_name() << "\n";);
expr_ref_vector sub(m);
rule_vector const& rls = b.m_rules.get_predicate_rules(pred);
rule* r = 0;
rule* r = nullptr;
unsigned i = 0;
for (; i < rls.size(); ++i) {
rule_i = m.mk_app(mk_q_rule(pred, i), mk_q_num(level).get());
@ -489,7 +489,7 @@ namespace datalog {
proof_ref get_proof(model_ref& md, func_decl* pred, app* prop, unsigned level) {
if (m.canceled()) {
return proof_ref(0, m);
return proof_ref(nullptr, m);
}
TRACE("bmc", tout << "Predicate: " << pred->get_name() << "\n";);
rule_manager& rm = b.m_ctx.get_rule_manager();
@ -500,7 +500,7 @@ namespace datalog {
// find the rule that was triggered by evaluating the arguments to prop.
rule_vector const& rls = b.m_rules.get_predicate_rules(pred);
rule* r = 0;
rule* r = nullptr;
for (unsigned i = 0; i < rls.size(); ++i) {
func_decl_ref rule_i = mk_level_rule(pred, i, level);
TRACE("bmc", rls[i]->display(b.m_ctx, tout << "Checking rule " << mk_pp(rule_i, m) << " "););
@ -606,7 +606,7 @@ namespace datalog {
binding.push_back(m.mk_app(f, args.size(), args.c_ptr()));
}
else {
binding.push_back(0);
binding.push_back(nullptr);
}
}
return binding;
@ -642,7 +642,7 @@ namespace datalog {
names.push_back(symbol(i));
}
else {
binding.push_back(0);
binding.push_back(nullptr);
}
}
sorts.reverse();
@ -686,7 +686,7 @@ namespace datalog {
}
else {
expr * const * no_pats = &new_body;
result = n.m.update_quantifier(old_q, 0, 0, 1, no_pats, new_body);
result = n.m.update_quantifier(old_q, 0, nullptr, 1, no_pats, new_body);
}
return true;
}
@ -986,7 +986,7 @@ namespace datalog {
sort_ref_vector new_sorts(m);
family_id dfid = m.mk_family_id("datatype");
datatype_decl_plugin* dtp = static_cast<datatype_decl_plugin*>(m.get_plugin(dfid));
VERIFY (dtp->mk_datatypes(dts.size(), dts.c_ptr(), 0, 0, new_sorts));
VERIFY (dtp->mk_datatypes(dts.size(), dts.c_ptr(), 0, nullptr, new_sorts));
it = b.m_rules.begin_grouped_rules();
for (unsigned i = 0; it != end; ++it, ++i) {
@ -1012,7 +1012,7 @@ namespace datalog {
unsigned sz = r->get_uninterpreted_tail_size();
max_arity = std::max(sz, max_arity);
}
cnstrs.push_back(mk_constructor_decl(symbol("Z#"), symbol("Z#?"), 0, 0));
cnstrs.push_back(mk_constructor_decl(symbol("Z#"), symbol("Z#?"), 0, nullptr));
for (unsigned i = 0; i + 1 < max_arity; ++i) {
std::stringstream _name;
@ -1028,7 +1028,7 @@ namespace datalog {
cnstrs.push_back(mk_constructor_decl(name, is_name, accs.size(), accs.c_ptr()));
}
dts.push_back(mk_datatype_decl(dtu, symbol("Path"), 0, nullptr, cnstrs.size(), cnstrs.c_ptr()));
VERIFY (dtp->mk_datatypes(dts.size(), dts.c_ptr(), 0, 0, new_sorts));
VERIFY (dtp->mk_datatypes(dts.size(), dts.c_ptr(), 0, nullptr, new_sorts));
m_path_sort = new_sorts[0].get();
}
}
@ -1090,7 +1090,7 @@ namespace datalog {
}
}
UNREACHABLE();
return proof_ref(0, m);
return proof_ref(nullptr, m);
}
// instantiation of algebraic data-types takes care of the rest.
@ -1201,7 +1201,7 @@ namespace datalog {
TRACE("bmc", tout << "Predicate: " << pred->get_name() << "\n";);
expr_ref_vector sub(m);
rule_vector const& rls = b.m_rules.get_predicate_rules(pred);
rule* r = 0;
rule* r = nullptr;
unsigned i = 0;
for (; i < rls.size(); ++i) {
expr_ref rule_i = mk_level_rule(pred, i, level);
@ -1446,7 +1446,7 @@ namespace datalog {
lbool bmc::query(expr* query) {
m_solver.reset();
m_answer = 0;
m_answer = nullptr;
m_ctx.ensure_opened();
m_rules.reset();
datalog::rule_manager& rule_manager = m_ctx.get_rule_manager();

View file

@ -55,18 +55,18 @@ namespace datalog {
public:
bmc(context& ctx);
~bmc();
~bmc() override;
lbool query(expr* query);
lbool query(expr* query) override;
void display_certificate(std::ostream& out) const;
void display_certificate(std::ostream& out) const override;
void collect_statistics(statistics& st) const;
void collect_statistics(statistics& st) const override;
void reset_statistics();
void get_rules_along_trace(datalog::rule_ref_vector& rules);
void reset_statistics() override;
void get_rules_along_trace(datalog::rule_ref_vector& rules) override;
expr_ref get_answer();
expr_ref get_answer() override;
// direct access to (new) non-linear compiler.
void compile(rule_set const& rules, expr_ref_vector& fmls, unsigned level);

View file

@ -197,7 +197,7 @@ namespace datalog {
proof_ref get_proof() const {
return proof_ref(0, m);
return proof_ref(nullptr, m);
}
};

View file

@ -32,12 +32,12 @@ namespace datalog {
imp* m_imp;
public:
clp(context& ctx);
~clp();
virtual lbool query(expr* query);
virtual void reset_statistics();
virtual void collect_statistics(statistics& st) const;
virtual void display_certificate(std::ostream& out) const;
virtual expr_ref get_answer();
~clp() override;
lbool query(expr* query) override;
void reset_statistics() override;
void collect_statistics(statistics& st) const override;
void display_certificate(std::ostream& out) const override;
expr_ref get_answer() override;
};
};

View file

@ -62,8 +62,7 @@ namespace datalog {
rule_set::decl2rules m_body2rules;
void init_bottom_up() {
for (rule_set::iterator it = m_rules.begin(); it != m_rules.end(); ++it) {
rule* cur = *it;
for (rule* cur : m_rules) {
for (unsigned i = 0; i < cur->get_uninterpreted_tail_size(); ++i) {
func_decl *d = cur->get_decl(i);
rule_set::decl2rules::obj_map_entry *e = m_body2rules.insert_if_not_there2(d, 0);
@ -83,31 +82,25 @@ namespace datalog {
}
void init_top_down() {
const func_decl_set& output_preds = m_rules.get_output_predicates();
for (func_decl_set::iterator I = output_preds.begin(),
E = output_preds.end(); I != E; ++I) {
func_decl* sym = *I;
for (func_decl* sym : m_rules.get_output_predicates()) {
TRACE("dl", tout << sym->get_name() << "\n";);
const rule_vector& output_rules = m_rules.get_predicate_rules(sym);
for (unsigned i = 0; i < output_rules.size(); ++i) {
m_facts.insert_if_not_there2(sym, Fact())->get_data().m_value.init_down(m_context, output_rules[i]);
for (rule* r : output_rules) {
m_facts.insert_if_not_there2(sym, Fact())->get_data().m_value.init_down(m_context, r);
m_todo[m_todo_idx].insert(sym);
}
}
}
void step_bottom_up() {
for(todo_set::iterator I = m_todo[m_todo_idx].begin(),
E = m_todo[m_todo_idx].end(); I!=E; ++I) {
for (func_decl* f : m_todo[m_todo_idx]) {
ptr_vector<rule> * rules;
if (!m_body2rules.find(*I, rules))
if (!m_body2rules.find(f, rules))
continue;
for (ptr_vector<rule>::iterator I2 = rules->begin(),
E2 = rules->end(); I2 != E2; ++I2) {
func_decl* head_sym = (*I2)->get_head()->get_decl();
fact_reader<Fact> tail_facts(m_facts, *I2);
bool new_info = m_facts.insert_if_not_there2(head_sym, Fact())->get_data().m_value.propagate_up(m_context, *I2, tail_facts);
for (rule* r : *rules) {
func_decl* head_sym = r->get_head()->get_decl();
fact_reader<Fact> tail_facts(m_facts, r);
bool new_info = m_facts.insert_if_not_there2(head_sym, Fact())->get_data().m_value.propagate_up(m_context, r, tail_facts);
if (new_info) {
m_todo[!m_todo_idx].insert(head_sym);
}
@ -119,15 +112,11 @@ namespace datalog {
}
void step_top_down() {
for(todo_set::iterator I = m_todo[m_todo_idx].begin(),
E = m_todo[m_todo_idx].end(); I!=E; ++I) {
func_decl* head_sym = *I;
for (func_decl* head_sym : m_todo[m_todo_idx]) {
// We can't use a reference here because we are changing the map while using the reference
const Fact head_fact = m_facts.get(head_sym, Fact::null_fact);
const rule_vector& deps = m_rules.get_predicate_rules(head_sym);
const unsigned deps_size = deps.size();
for (unsigned i = 0; i < deps_size; ++i) {
rule *trg_rule = deps[i];
for (rule* trg_rule : deps) {
fact_writer<Fact> writer(m_facts, trg_rule, m_todo[!m_todo_idx]);
// Generate new facts
head_fact.propagate_down(m_context, trg_rule, writer);
@ -146,16 +135,13 @@ namespace datalog {
dataflow_engine(typename Fact::ctx_t& ctx, const rule_set& rules) : m_rules(rules), m_todo_idx(0), m_context(ctx) {}
~dataflow_engine() {
for (rule_set::decl2rules::iterator it = m_body2rules.begin(); it != m_body2rules.end(); ++it) {
dealloc(it->m_value);
}
for (auto & kv : m_body2rules)
dealloc(kv.m_value);
}
void dump(std::ostream& outp) {
obj_hashtable<func_decl> visited;
for (rule_set::iterator I = m_rules.begin(),
E = m_rules.end(); I != E; ++I) {
const rule* r = *I;
for (rule const* r : m_rules) {
func_decl* head_decl = r->get_decl();
obj_hashtable<func_decl>::entry *dummy;
if (visited.insert_if_not_there_core(head_decl, dummy)) {
@ -194,30 +180,30 @@ namespace datalog {
iterator end() const { return m_facts.end(); }
void join(const dataflow_engine<Fact>& oth) {
for (typename fact_db::iterator I = oth.m_facts.begin(),
E = oth.m_facts.end(); I != E; ++I) {
for (auto const& kv : oth.m_facts) {
typename fact_db::entry* entry;
if (m_facts.insert_if_not_there_core(I->m_key, entry)) {
entry->get_data().m_value = I->m_value;
} else {
entry->get_data().m_value.join(m_context, I->m_value);
if (m_facts.insert_if_not_there_core(kv.m_key, entry)) {
entry->get_data().m_value = kv.m_value;
}
else {
entry->get_data().m_value.join(m_context, kv.m_value);
}
}
}
void intersect(const dataflow_engine<Fact>& oth) {
vector<func_decl*> to_delete;
for (typename fact_db::iterator I = m_facts.begin(),
E = m_facts.end(); I != E; ++I) {
ptr_vector<func_decl> to_delete;
for (auto const& kv : m_facts) {
if (typename fact_db::entry *entry = oth.m_facts.find_core(I->m_key)) {
I->m_value.intersect(m_context, entry->get_data().m_value);
} else {
to_delete.push_back(I->m_key);
if (typename fact_db::entry *entry = oth.m_facts.find_core(kv.m_key)) {
kv.m_value.intersect(m_context, entry->get_data().m_value);
}
else {
to_delete.push_back(kv.m_key);
}
}
for (unsigned i = 0; i < to_delete.size(); ++i) {
m_facts.erase(to_delete[i]);
for (func_decl* f : to_delete) {
m_facts.erase(f);
}
}
};

View file

@ -462,7 +462,7 @@ namespace datalog {
private:
ddnf_mgr* insert(unsigned n) {
ddnf_mgr* m = 0;
ddnf_mgr* m = nullptr;
if (!m_mgrs.find(n, m)) {
m = alloc(ddnf_mgr, n);
m_mgrs.insert(n, m);
@ -673,7 +673,7 @@ namespace datalog {
void dump_rules(rule_set& rules) {
init_ctx(rules);
m_inner_ctx.display_smt2(0, 0, std::cout);
m_inner_ctx.display_smt2(0, nullptr, std::cout);
}
lbool execute_rules(rule_set& rules) {
@ -715,7 +715,7 @@ namespace datalog {
compile_expr(r.get_tail(i), tmp);
body.push_back(to_app(tmp));
}
rule* r_new = rm.mk(head, body.size(), body.c_ptr(), 0, r.name(), false);
rule* r_new = rm.mk(head, body.size(), body.c_ptr(), nullptr, r.name(), false);
new_rules.add_rule(r_new);
IF_VERBOSE(20, r_new->display(m_ctx, verbose_stream()););
if (old_rules.is_output_predicate(r.get_decl())) {
@ -775,11 +775,11 @@ namespace datalog {
return bv.mk_sort(nb);
}
UNREACHABLE();
return 0;
return nullptr;
}
void compile_expr(expr* e, expr_ref& result) {
expr* r = 0;
expr* r = nullptr;
if (m_cache.find(e, r)) {
result = r;
return;
@ -847,7 +847,7 @@ namespace datalog {
}
void compile_eq(expr* e, expr_ref& result, var* v, unsigned hi, unsigned lo, expr* c) {
tbv* t = 0;
tbv* t = nullptr;
// TBD: hi, lo are ignored.
VERIFY(m_expr2tbv.find(e, t));
var_ref w(m);

View file

@ -35,12 +35,12 @@ namespace datalog {
imp* m_imp;
public:
ddnf(context& ctx);
~ddnf();
virtual lbool query(expr* query);
virtual void reset_statistics();
virtual void collect_statistics(statistics& st) const;
virtual void display_certificate(std::ostream& out) const;
virtual expr_ref get_answer();
~ddnf() override;
lbool query(expr* query) override;
void reset_statistics() override;
void collect_statistics(statistics& st) const override;
void display_certificate(std::ostream& out) const override;
expr_ref get_answer() override;
};
class ddnf_node;

11
src/muz/duality/duality_dl_interface.cpp Executable file → Normal file
View file

@ -71,10 +71,10 @@ namespace Duality {
Solver::Counterexample cex;
duality_data(ast_manager &_m) : ctx(_m,config(params_ref())) {
ls = 0;
rpfp = 0;
ls = nullptr;
rpfp = nullptr;
status = StatusNull;
old_rs = 0;
old_rs = nullptr;
}
~duality_data(){
if(old_rs)
@ -92,7 +92,7 @@ namespace Duality {
m_ctx(dl_ctx)
{
_d = 0;
_d = nullptr;
// dl_ctx.get_manager().toggle_proof_mode(PGM_FINE);
}
@ -138,7 +138,7 @@ namespace Duality {
// if there is old data, get the cex and dispose (later)
duality_data *old_data = _d;
Solver *old_rs = 0;
Solver *old_rs = nullptr;
if(old_data){
old_rs = old_data->old_rs;
old_rs->GetCounterexample().swap(old_data->cex);
@ -273,6 +273,7 @@ namespace Duality {
if (!heads.contains(fd)) {
int arity = f.arity();
std::vector<expr> args;
args.reserve(arity);
for (int j = 0; j < arity; j++)
args.push_back(_d->ctx.fresh_func_decl("X", f.domain(j))());
expr c = implies(_d->ctx.bool_val(false), f(args));

View file

@ -41,33 +41,33 @@ namespace Duality {
public:
dl_interface(datalog::context& ctx);
~dl_interface();
~dl_interface() override;
lbool query(expr* query);
lbool query(expr* query) override;
void cancel();
void cancel() override;
void cleanup();
void cleanup() override;
void display_certificate(std::ostream& out) const;
void display_certificate(std::ostream& out) const override;
void collect_statistics(statistics& st) const;
void collect_statistics(statistics& st) const override;
void reset_statistics();
void reset_statistics() override;
expr_ref get_answer();
expr_ref get_answer() override;
unsigned get_num_levels(func_decl* pred);
unsigned get_num_levels(func_decl* pred) override;
expr_ref get_cover_delta(int level, func_decl* pred);
expr_ref get_cover_delta(int level, func_decl* pred) override;
void add_cover(int level, func_decl* pred, expr* property);
void add_cover(int level, func_decl* pred, expr* property) override;
void updt_params();
void updt_params() override;
model_ref get_model();
model_ref get_model() override;
proof_ref get_proof();
proof_ref get_proof() override;
duality_data *dd(){return _d;}

View file

@ -104,7 +104,7 @@ public:
m_ok = (m_file != NULL) && (err == 0);
#else
m_file = fopen(fname, "rb");
m_ok = (m_file != NULL);
m_ok = (m_file != nullptr);
#endif
}
~line_reader() {
@ -171,7 +171,7 @@ class char_reader {
public:
char_reader(char const* file):
m_line_reader(file),
m_line(0)
m_line(nullptr)
{}
bool operator()() { return m_line_reader(); }
@ -184,7 +184,7 @@ public:
m_line = m_line_reader.get_line();
}
if (!(m_line[0])) {
m_line = 0;
m_line = nullptr;
return '\n';
}
char result = m_line[0];
@ -266,8 +266,8 @@ public:
}
dlexer():
m_input(0),
m_reader(0),
m_input(nullptr),
m_reader(nullptr),
m_prev_char(0),
m_curr_char(0),
m_line(1),
@ -494,27 +494,27 @@ public:
{
}
virtual bool parse_file(char const * filename) {
bool parse_file(char const * filename) override {
reset();
if (filename != 0) {
if (filename != nullptr) {
set_path(filename);
char_reader reader(filename);
if (!reader()) {
get_err() << "ERROR: could not open file '" << filename << "'.\n";
return false;
}
return parse_stream(0, &reader);
return parse_stream(nullptr, &reader);
}
else {
return parse_stream(&std::cin, 0);
return parse_stream(&std::cin, nullptr);
}
}
virtual bool parse_string(char const * string) {
bool parse_string(char const * string) override {
reset();
std::string s(string);
std::istringstream is(s);
return parse_stream(&is, 0);
return parse_stream(&is, nullptr);
}
protected:
@ -701,7 +701,7 @@ protected:
if(is_predicate_declaration) {
return unexpected(tok, "predicate declaration should not end with '.'");
}
add_rule(pred, 0, 0, 0);
add_rule(pred, 0, nullptr, nullptr);
return m_lexer->next_token();
case TK_LEFT_ARROW:
return parse_body(pred);
@ -777,7 +777,7 @@ protected:
dtoken parse_infix(dtoken tok1, char const* td, app_ref& pred) {
symbol td1(td);
expr_ref v1(m_manager), v2(m_manager);
sort* s = 0;
sort* s = nullptr;
dtoken tok2 = m_lexer->next_token();
if (tok2 != TK_NEQ && tok2 != TK_GT && tok2 != TK_LT && tok2 != TK_EQ) {
return unexpected(tok2, "built-in infix operator");
@ -790,12 +790,12 @@ protected:
symbol td2(td);
if (tok1 == TK_ID) {
expr* _v1 = 0;
expr* _v1 = nullptr;
m_vars.find(td1.bare_str(), _v1);
v1 = _v1;
}
if (tok3 == TK_ID) {
expr* _v2 = 0;
expr* _v2 = nullptr;
m_vars.find(td2.bare_str(), _v2);
v2 = _v2;
}
@ -842,8 +842,8 @@ protected:
svector<symbol> arg_names;
func_decl* f = m_context.try_get_predicate_decl(s);
tok = parse_args(tok, f, args, arg_names);
is_predicate_declaration = f==0;
if (f==0) {
is_predicate_declaration = f==nullptr;
if (f==nullptr) {
//we're in a declaration
unsigned arity = args.size();
ptr_vector<sort> domain;
@ -884,7 +884,7 @@ protected:
tok = m_lexer->next_token();
while (tok != TK_EOS && tok != TK_ERROR) {
symbol alias;
sort* s = 0;
sort* s = nullptr;
if(!f) {
//we're in a predicate declaration
@ -951,7 +951,7 @@ protected:
symbol data (m_lexer->get_token_data());
if (is_var(data.bare_str())) {
unsigned idx = 0;
expr* v = 0;
expr* v = nullptr;
if (!m_vars.find(data.bare_str(), v)) {
idx = m_num_vars++;
v = m_manager.mk_var(idx, s);
@ -1014,7 +1014,7 @@ protected:
dlexer lexer;
{
flet<dlexer*> lexer_let(m_lexer, &lexer);
m_lexer->set_stream(0, &stream);
m_lexer->set_stream(nullptr, &stream);
tok = m_lexer->next_token();
if(parsing_domain) {
tok = parse_domains(tok);
@ -1186,7 +1186,7 @@ class wpa_parser_impl : public wpa_parser, dparser {
bool m_use_map_names;
uint64_set& ensure_sort_content(symbol sort_name) {
sym2nums::entry * e = m_sort_contents.insert_if_not_there2(sort_name, 0);
sym2nums::entry * e = m_sort_contents.insert_if_not_there2(sort_name, nullptr);
if(!e->get_data().m_value) {
e->get_data().m_value = alloc(uint64_set);
}
@ -1200,13 +1200,13 @@ public:
m_short_sort(ctx.get_manager()),
m_use_map_names(ctx.use_map_names()) {
}
~wpa_parser_impl() {
~wpa_parser_impl() override {
reset_dealloc_values(m_sort_contents);
}
void reset() {
}
virtual bool parse_directory(char const * path) {
bool parse_directory(char const * path) override {
bool result = false;
try {
result = parse_directory_core(path);
@ -1303,7 +1303,7 @@ private:
}
}
void parse_rules_file(std::string fname) {
void parse_rules_file(const std::string & fname) {
SASSERT(file_exists(fname));
flet<std::string> flet_cur_file(m_current_file, fname);
@ -1312,10 +1312,10 @@ private:
dlexer lexer;
m_lexer = &lexer;
m_lexer->set_stream(&stm, 0);
m_lexer->set_stream(&stm, nullptr);
dtoken tok = m_lexer->next_token();
tok = parse_decls(tok);
m_lexer = 0;
m_lexer = nullptr;
}
bool parse_rel_line(char * full_line, uint64_vector & args) {
@ -1347,7 +1347,7 @@ private:
return true;
}
void parse_rel_file(std::string fname) {
void parse_rel_file(const std::string & fname) {
SASSERT(file_exists(fname));
IF_VERBOSE(10, verbose_stream() << "Parsing relation file " << fname << "\n";);
@ -1496,7 +1496,7 @@ private:
return true;
}
void parse_map_file(std::string fname) {
void parse_map_file(const std::string & fname) {
SASSERT(file_exists(fname));
IF_VERBOSE(10, verbose_stream() << "Parsing map file " << fname << "\n";);

View file

@ -56,7 +56,7 @@ struct dl_context {
m_cmd(ctx),
m_collected_cmds(collected_cmds),
m_ref_count(0),
m_decl_plugin(0),
m_decl_plugin(nullptr),
m_trail(*this) {}
void inc_ref() {
@ -88,7 +88,7 @@ struct dl_context {
}
void reset() {
m_context = 0;
m_context = nullptr;
}
void register_predicate(func_decl* pred, unsigned num_kinds, symbol const* kinds) {
@ -164,12 +164,12 @@ public:
cmd("rule"),
m_dl_ctx(dl_ctx),
m_arg_idx(0),
m_t(0),
m_t(nullptr),
m_bound(UINT_MAX) {}
virtual char const * get_usage() const { return "(forall (q) (=> (and body) head)) :optional-name :optional-recursion-bound"; }
virtual char const * get_descr(cmd_context & ctx) const { return "add a Horn rule."; }
virtual unsigned get_arity() const { return VAR_ARITY; }
virtual cmd_arg_kind next_arg_kind(cmd_context & ctx) const {
char const * get_usage() const override { return "(forall (q) (=> (and body) head)) :optional-name :optional-recursion-bound"; }
char const * get_descr(cmd_context & ctx) const override { return "add a Horn rule."; }
unsigned get_arity() const override { return VAR_ARITY; }
cmd_arg_kind next_arg_kind(cmd_context & ctx) const override {
switch(m_arg_idx) {
case 0: return CPK_EXPR;
case 1: return CPK_SYMBOL;
@ -177,23 +177,23 @@ public:
default: return CPK_SYMBOL;
}
}
virtual void set_next_arg(cmd_context & ctx, expr * t) {
void set_next_arg(cmd_context & ctx, expr * t) override {
m_t = t;
m_arg_idx++;
}
virtual void set_next_arg(cmd_context & ctx, symbol const & s) {
void set_next_arg(cmd_context & ctx, symbol const & s) override {
m_name = s;
m_arg_idx++;
}
virtual void set_next_arg(cmd_context & ctx, unsigned bound) {
void set_next_arg(cmd_context & ctx, unsigned bound) override {
m_bound = bound;
m_arg_idx++;
}
virtual void reset(cmd_context & ctx) { m_dl_ctx->reset(); prepare(ctx); m_t = nullptr; }
virtual void prepare(cmd_context& ctx) { m_arg_idx = 0; m_name = symbol::null; m_bound = UINT_MAX; }
virtual void finalize(cmd_context & ctx) {
void reset(cmd_context & ctx) override { m_dl_ctx->reset(); prepare(ctx); m_t = nullptr; }
void prepare(cmd_context& ctx) override { m_arg_idx = 0; m_name = symbol::null; m_bound = UINT_MAX; }
void finalize(cmd_context & ctx) override {
}
virtual void execute(cmd_context & ctx) {
void execute(cmd_context & ctx) override {
if (!m_t) throw cmd_exception("invalid rule, expected formula");
m_dl_ctx->add_rule(m_t, m_name, m_bound);
}
@ -206,19 +206,19 @@ public:
dl_query_cmd(dl_context * dl_ctx):
parametric_cmd("query"),
m_dl_ctx(dl_ctx),
m_target(0) {
m_target(nullptr) {
}
virtual char const * get_usage() const { return "predicate"; }
virtual char const * get_main_descr() const {
char const * get_usage() const override { return "predicate"; }
char const * get_main_descr() const override {
return "pose a query to a predicate based on the Horn rules.";
}
virtual cmd_arg_kind next_arg_kind(cmd_context & ctx) const {
if (m_target == 0) return CPK_FUNC_DECL;
cmd_arg_kind next_arg_kind(cmd_context & ctx) const override {
if (m_target == nullptr) return CPK_FUNC_DECL;
return parametric_cmd::next_arg_kind(ctx);
}
virtual void set_next_arg(cmd_context & ctx, func_decl* t) {
void set_next_arg(cmd_context & ctx, func_decl* t) override {
m_target = t;
if (t->get_family_id() != null_family_id) {
throw cmd_exception("Invalid query argument, expected uinterpreted function name, but argument is interpreted");
@ -229,14 +229,14 @@ public:
}
}
virtual void prepare(cmd_context & ctx) {
void prepare(cmd_context & ctx) override {
ctx.m(); // ensure manager is initialized.
parametric_cmd::prepare(ctx);
m_target = 0;
m_target = nullptr;
}
virtual void execute(cmd_context& ctx) {
if (m_target == 0) {
void execute(cmd_context& ctx) override {
if (m_target == nullptr) {
throw cmd_exception("invalid query command, argument expected");
}
if (m_dl_ctx->collect_query(m_target)) {
@ -318,10 +318,10 @@ public:
}
dlctx.cleanup();
print_statistics(ctx);
m_target = 0;
m_target = nullptr;
}
virtual void init_pdescrs(cmd_context & ctx, param_descrs & p) {
void init_pdescrs(cmd_context & ctx, param_descrs & p) override {
m_dl_ctx->dlctx().collect_params(p);
}
@ -385,30 +385,30 @@ public:
m_dl_ctx(dl_ctx),
m_domain(0) {}
virtual char const * get_usage() const { return "<symbol> (<arg1 sort> ...) <representation>*"; }
virtual char const * get_descr(cmd_context & ctx) const { return "declare new relation"; }
virtual unsigned get_arity() const { return VAR_ARITY; }
char const * get_usage() const override { return "<symbol> (<arg1 sort> ...) <representation>*"; }
char const * get_descr(cmd_context & ctx) const override { return "declare new relation"; }
unsigned get_arity() const override { return VAR_ARITY; }
virtual void prepare(cmd_context & ctx) {
void prepare(cmd_context & ctx) override {
ctx.m(); // ensure manager is initialized.
m_arg_idx = 0;
m_query_arg_idx = 0;
m_domain.reset();
m_kinds.reset();
}
virtual cmd_arg_kind next_arg_kind(cmd_context & ctx) const {
cmd_arg_kind next_arg_kind(cmd_context & ctx) const override {
switch(m_query_arg_idx++) {
case 0: return CPK_SYMBOL; // relation name
case 1: return CPK_SORT_LIST; // arguments
default: return CPK_SYMBOL; // optional representation specification
}
}
virtual void set_next_arg(cmd_context & ctx, unsigned num, sort * const * slist) {
void set_next_arg(cmd_context & ctx, unsigned num, sort * const * slist) override {
m_domain.reset();
m_domain.append(num, slist);
m_arg_idx++;
}
virtual void set_next_arg(cmd_context & ctx, symbol const & s) {
void set_next_arg(cmd_context & ctx, symbol const & s) override {
if(m_arg_idx==0) {
m_rel_name = s;
}
@ -418,7 +418,7 @@ public:
}
m_arg_idx++;
}
virtual void execute(cmd_context & ctx) {
void execute(cmd_context & ctx) override {
if(m_arg_idx<2) {
throw cmd_exception("at least 2 arguments expected");
}
@ -444,15 +444,15 @@ public:
m_dl_ctx(dl_ctx)
{}
virtual char const * get_usage() const { return "<symbol> <sort>"; }
virtual char const * get_descr(cmd_context & ctx) const { return "declare constant as variable"; }
virtual unsigned get_arity() const { return 2; }
char const * get_usage() const override { return "<symbol> <sort>"; }
char const * get_descr(cmd_context & ctx) const override { return "declare constant as variable"; }
unsigned get_arity() const override { return 2; }
virtual void prepare(cmd_context & ctx) {
void prepare(cmd_context & ctx) override {
ctx.m(); // ensure manager is initialized.
m_arg_idx = 0;
}
virtual cmd_arg_kind next_arg_kind(cmd_context & ctx) const {
cmd_arg_kind next_arg_kind(cmd_context & ctx) const override {
SASSERT(m_arg_idx <= 1);
if (m_arg_idx == 0) {
return CPK_SYMBOL;
@ -460,19 +460,19 @@ public:
return CPK_SORT;
}
virtual void set_next_arg(cmd_context & ctx, sort* s) {
void set_next_arg(cmd_context & ctx, sort* s) override {
m_var_sort = s;
++m_arg_idx;
}
virtual void set_next_arg(cmd_context & ctx, symbol const & s) {
void set_next_arg(cmd_context & ctx, symbol const & s) override {
m_var_name = s;
++m_arg_idx;
}
virtual void execute(cmd_context & ctx) {
void execute(cmd_context & ctx) override {
ast_manager& m = ctx.m();
func_decl_ref var(m.mk_func_decl(m_var_name, 0, static_cast<sort*const*>(0), m_var_sort), m);
func_decl_ref var(m.mk_func_decl(m_var_name, 0, static_cast<sort*const*>(nullptr), m_var_sort), m);
ctx.insert(var);
m_dl_ctx->dlctx().register_variable(var);
}
@ -489,10 +489,10 @@ public:
m_dl_ctx(dl_ctx)
{}
virtual char const * get_usage() const { return ""; }
virtual char const * get_descr(cmd_context & ctx) const { return "push the fixedpoint context"; }
virtual unsigned get_arity() const { return 0; }
virtual void execute(cmd_context & ctx) {
char const * get_usage() const override { return ""; }
char const * get_descr(cmd_context & ctx) const override { return "push the fixedpoint context"; }
unsigned get_arity() const override { return 0; }
void execute(cmd_context & ctx) override {
m_dl_ctx->push();
}
};
@ -508,10 +508,10 @@ public:
m_dl_ctx(dl_ctx)
{}
virtual char const * get_usage() const { return ""; }
virtual char const * get_descr(cmd_context & ctx) const { return "pop the fixedpoint context"; }
virtual unsigned get_arity() const { return 0; }
virtual void execute(cmd_context & ctx) {
char const * get_usage() const override { return ""; }
char const * get_descr(cmd_context & ctx) const override { return "pop the fixedpoint context"; }
unsigned get_arity() const override { return 0; }
void execute(cmd_context & ctx) override {
m_dl_ctx->pop();
}
};
@ -528,7 +528,7 @@ static void install_dl_cmds_aux(cmd_context& ctx, dl_collected_cmds* collected_c
}
void install_dl_cmds(cmd_context & ctx) {
install_dl_cmds_aux(ctx, 0);
install_dl_cmds_aux(ctx, nullptr);
}
void install_dl_collect_cmds(dl_collected_cmds& collected_cmds, cmd_context & ctx) {

View file

@ -27,7 +27,7 @@ Revision History:
#include "muz/spacer/spacer_dl_interface.h"
namespace datalog {
register_engine::register_engine(): m_ctx(0) {}
register_engine::register_engine(): m_ctx(nullptr) {}
engine_base* register_engine::mk_engine(DL_ENGINE engine_type) {
switch(engine_type) {
@ -51,10 +51,10 @@ namespace datalog {
return alloc(ddnf, *m_ctx);
case LAST_ENGINE:
UNREACHABLE();
return 0;
return nullptr;
}
UNREACHABLE();
return 0;
return nullptr;
}
}

View file

@ -27,8 +27,8 @@ namespace datalog {
context* m_ctx;
public:
register_engine();
engine_base* mk_engine(DL_ENGINE engine_type);
void set_context(context* ctx) { m_ctx = ctx; }
engine_base* mk_engine(DL_ENGINE engine_type) override;
void set_context(context* ctx) override { m_ctx = ctx; }
};
}

View file

@ -65,7 +65,7 @@ class horn_tactic : public tactic {
void normalize(expr_ref& f) {
bool is_positive = true;
expr* e = 0;
expr* e = nullptr;
while (true) {
if (is_forall(f) && is_positive) {
f = to_quantifier(f)->get_expr();
@ -141,7 +141,7 @@ class horn_tactic : public tactic {
ast_mark mark;
expr_ref_vector args(m), body(m);
expr_ref head(m);
expr* a = 0, *a1 = 0;
expr* a = nullptr, *a1 = nullptr;
flatten_or(tmp, args);
for (unsigned i = 0; i < args.size(); ++i) {
a = args[i].get();
@ -270,7 +270,7 @@ class horn_tactic : public tactic {
if (produce_proofs) {
proof_ref proof = m_ctx.get_proof();
pc = proof2proof_converter(m, proof);
g->assert_expr(m.mk_false(), proof, 0);
g->assert_expr(m.mk_false(), proof, nullptr);
}
else {
g->assert_expr(m.mk_false());
@ -365,40 +365,40 @@ public:
m_imp = alloc(imp, t, m, p);
}
virtual tactic * translate(ast_manager & m) {
tactic * translate(ast_manager & m) override {
return alloc(horn_tactic, m_is_simplify, m, m_params);
}
virtual ~horn_tactic() {
~horn_tactic() override {
dealloc(m_imp);
}
virtual void updt_params(params_ref const & p) {
void updt_params(params_ref const & p) override {
m_params = p;
m_imp->updt_params(p);
}
virtual void collect_param_descrs(param_descrs & r) {
void collect_param_descrs(param_descrs & r) override {
m_imp->collect_param_descrs(r);
}
virtual void operator()(goal_ref const & in,
goal_ref_buffer & result) {
void operator()(goal_ref const & in,
goal_ref_buffer & result) override {
(*m_imp)(in, result);
}
virtual void collect_statistics(statistics & st) const {
void collect_statistics(statistics & st) const override {
m_imp->collect_statistics(st);
st.copy(m_stats);
}
virtual void reset_statistics() {
void reset_statistics() override {
m_stats.reset();
m_imp->reset_statistics();
}
virtual void cleanup() {
void cleanup() override {
ast_manager & m = m_imp->m;
m_imp->collect_statistics(m_stats);
dealloc(m_imp);

View file

@ -35,8 +35,8 @@ namespace pdr {
expr* m_k;
obj_map<func_decl, expr*>* m_translate;
public:
scaler(ast_manager& m): m(m), a(m), m_translate(0) {}
expr_ref operator()(expr* e, expr* k, obj_map<func_decl, expr*>* translate = 0);
scaler(ast_manager& m): m(m), a(m), m_translate(nullptr) {}
expr_ref operator()(expr* e, expr* k, obj_map<func_decl, expr*>* translate = nullptr);
expr_ref undo_k(expr* e, expr* k);
private:
expr_ref scale(expr* e, bool is_mul);

View file

@ -128,7 +128,7 @@ namespace pdr {
std::stringstream name_stm;
name_stm << m_head->get_name() << '_' << i;
func_decl_ref stm(m);
stm = m.mk_func_decl(symbol(name_stm.str().c_str()), 0, (sort*const*)0, arg_sort);
stm = m.mk_func_decl(symbol(name_stm.str().c_str()), 0, (sort*const*)nullptr, arg_sort);
m_sig.push_back(pm.get_o_pred(stm, 0));
}
}
@ -149,30 +149,27 @@ namespace pdr {
}
datalog::rule const& pred_transformer::find_rule(model_core const& model) const {
obj_map<expr, datalog::rule const*>::iterator it = m_tag2rule.begin(), end = m_tag2rule.end();
TRACE("pdr_verbose",
datalog::rule_manager& rm = ctx.get_context().get_rule_manager();
for (; it != end; ++it) {
expr* pred = it->m_key;
for (auto const& kv : m_tag2rule) {
expr* pred = kv.m_key;
tout << mk_pp(pred, m) << ":\n";
if (it->m_value) rm.display_smt2(*it->m_value, tout) << "\n";
if (kv.m_value) rm.display_smt2(*kv.m_value, tout) << "\n";
}
);
it = m_tag2rule.begin();
if (m_tag2rule.size() == 1) {
return *it->m_value;
return *m_tag2rule.begin()->m_value;
}
expr_ref vl(m);
for (; it != end; ++it) {
expr* pred = it->m_key;
for (auto const& kv : m_tag2rule) {
expr* pred = kv.m_key;
if (model.eval(to_app(pred)->get_decl(), vl) && m.is_true(vl)) {
return *it->m_value;
return *kv.m_value;
}
}
UNREACHABLE();
return *((datalog::rule*)0);
throw default_exception("could not find rule");
}
void pred_transformer::find_predecessors(datalog::rule const& r, ptr_vector<func_decl>& preds) const {
@ -201,7 +198,7 @@ namespace pdr {
void pred_transformer::simplify_formulas(tactic& tac, expr_ref_vector& v) {
goal_ref g(alloc(goal, m, false, false, false));
for (unsigned j = 0; j < v.size(); ++j) g->assert_expr(v[j].get());
for (expr* e : v) g->assert_expr(e);
goal_ref_buffer result;
tac(g, result);
SASSERT(result.size() == 1);
@ -213,9 +210,8 @@ namespace pdr {
void pred_transformer::simplify_formulas() {
tactic_ref us = mk_unit_subsumption_tactic(m);
simplify_formulas(*us, m_invariants);
for (unsigned i = 0; i < m_levels.size(); ++i) {
simplify_formulas(*us, m_levels[i]);
}
for (auto & fmls : m_levels)
simplify_formulas(*us, fmls);
}
expr_ref pred_transformer::get_formulas(unsigned level, bool add_axioms) {
@ -444,7 +440,7 @@ namespace pdr {
else if (is_sat == l_false) {
uses_level = m_solver.assumes_level();
}
m_solver.set_model(0);
m_solver.set_model(nullptr);
return is_sat;
}
@ -460,7 +456,7 @@ namespace pdr {
tmp = pm.mk_and(conj);
prop_solver::scoped_level _sl(m_solver, level);
m_solver.set_core(core);
m_solver.set_model(0);
m_solver.set_model(nullptr);
lbool r = m_solver.check_conjunction_as_assumptions(tmp);
if (r == l_false) {
assumes_level = m_solver.assumes_level();
@ -478,7 +474,7 @@ namespace pdr {
prop_solver::scoped_level _sl(m_solver, level);
m_solver.set_core(&core);
m_solver.set_subset_based_core(true);
m_solver.set_model(0);
m_solver.set_model(nullptr);
lbool res = m_solver.check_assumptions_and_formula(lits, fml);
if (res == l_false) {
lits.reset();
@ -650,7 +646,7 @@ namespace pdr {
expr_free_vars fv;
fv(e);
while (vars.size() < fv.size()) {
vars.push_back(0);
vars.push_back(nullptr);
}
for (unsigned i = 0; i < fv.size(); ++i) {
if (fv[i] && !vars[i].get()) {
@ -822,7 +818,7 @@ namespace pdr {
datalog::rule const& rl2 = pt().find_rule(*mdl);
SASSERT(is_ini(rl2));
set_rule(&rl2);
pt().get_solver().set_model(0);
pt().get_solver().set_model(nullptr);
return const_cast<datalog::rule*>(m_rule);
}
@ -900,7 +896,7 @@ namespace pdr {
if (this == m_next) {
SASSERT(m_prev == this);
if (root == this) {
root = 0;
root = nullptr;
}
}
else {
@ -911,8 +907,8 @@ namespace pdr {
}
}
TRACE("pdr", tout << "new root: " << root << "\n";);
m_prev = 0;
m_next = 0;
m_prev = nullptr;
m_next = nullptr;
}
@ -939,7 +935,7 @@ namespace pdr {
*/
model_node* model_search::next() {
if (!m_goal) {
return 0;
return nullptr;
}
else {
model_node* result = m_goal;
@ -1162,7 +1158,7 @@ namespace pdr {
todo.push_back(m_root);
while (!todo.empty()) {
model_node* n = todo.back();
model* md = 0;
model* md = nullptr;
if (!n->get_model_ptr()) {
if (models.find(n->state(), md)) {
TRACE("pdr", tout << n->state() << "\n";);
@ -1301,7 +1297,7 @@ namespace pdr {
ptr_vector<model_node> todo;
proof_ref_vector trail(m);
datalog::rule_ref_vector rules_trail(rm);
proof* pr = 0;
proof* pr = nullptr;
unif.set_normalize(true);
todo.push_back(m_root);
update_models();
@ -1417,7 +1413,7 @@ namespace pdr {
erase_children(*m_root, false);
remove_node(*m_root, false);
dealloc(m_root);
m_root = 0;
m_root = nullptr;
}
m_cache.reset();
}
@ -1449,10 +1445,10 @@ namespace pdr {
: m_fparams(fparams),
m_params(params),
m(m),
m_context(0),
m_context(nullptr),
m_pm(m_fparams, params.pdr_max_num_contexts(), m),
m_query_pred(m),
m_query(0),
m_query(nullptr),
m_search(m_params.pdr_bfs_model_search()),
m_last_result(l_undef),
m_inductive_lvl(0),
@ -1480,7 +1476,7 @@ namespace pdr {
reset(m_rels_tmp);
}
m_search.reset();
m_query = 0;
m_query = nullptr;
m_last_result = l_undef;
m_inductive_lvl = 0;
}
@ -1547,7 +1543,7 @@ namespace pdr {
init_rules(rules, m_rels_tmp);
decl2rel::iterator it = m_rels_tmp.begin(), end = m_rels_tmp.end();
for (; it != end; ++it) {
pred_transformer* pt = 0;
pred_transformer* pt = nullptr;
if (m_rels.find(it->m_key, pt)) {
it->m_value->inherit_properties(*pt);
}
@ -1562,7 +1558,7 @@ namespace pdr {
}
unsigned context::get_num_levels(func_decl* p) {
pred_transformer* pt = 0;
pred_transformer* pt = nullptr;
if (m_rels.find(p, pt)) {
return pt->get_num_levels();
}
@ -1573,7 +1569,7 @@ namespace pdr {
}
expr_ref context::get_cover_delta(int level, func_decl* p_orig, func_decl* p) {
pred_transformer* pt = 0;
pred_transformer* pt = nullptr;
if (m_rels.find(p, pt)) {
return pt->get_cover_delta(p_orig, level);
}
@ -1584,7 +1580,7 @@ namespace pdr {
}
void context::add_cover(int level, func_decl* p, expr* property) {
pred_transformer* pt = 0;
pred_transformer* pt = nullptr;
if (!m_rels.find(p, pt)) {
pt = alloc(pred_transformer, *this, get_pdr_manager(), p);
m_rels.insert(p, pt);
@ -1737,6 +1733,7 @@ namespace pdr {
}
void context::validate_model() {
IF_VERBOSE(1, verbose_stream() << "(pdr.validate_model)\n";);
std::stringstream msg;
expr_ref_vector refs(m);
expr_ref tmp(m);
@ -1746,11 +1743,10 @@ namespace pdr {
get_level_property(m_inductive_lvl, refs, rs);
inductive_property ex(m, mc, rs);
ex.to_model(model);
decl2rel::iterator it = m_rels.begin(), end = m_rels.end();
var_subst vs(m, false);
expr_free_vars fv;
for (; it != end; ++it) {
ptr_vector<datalog::rule> const& rules = it->m_value->rules();
for (auto const& kv : m_rels) {
ptr_vector<datalog::rule> const& rules = kv.m_value->rules();
for (unsigned i = 0; i < rules.size(); ++i) {
datalog::rule& r = *rules[i];
model->eval(r.get_head(), tmp);
@ -1917,7 +1913,7 @@ namespace pdr {
verbose_stream() << ex.to_string();
});
// upgrade invariants that are known to be inductive.
// upgrade invariants that are known to be inductive.
decl2rel::iterator it = m_rels.begin (), end = m_rels.end ();
for (; m_inductive_lvl > 0 && it != end; ++it) {
if (it->m_value->head() != m_query_pred) {
@ -2027,7 +2023,7 @@ namespace pdr {
//
bool context::check_reachability(unsigned level) {
expr_ref state(m.mk_true(), m);
model_node* root = alloc(model_node, 0, state, *m_query, level);
model_node* root = alloc(model_node, nullptr, state, *m_query, level);
m_search.set_root(root);
while (model_node* node = m_search.next()) {
@ -2404,7 +2400,7 @@ namespace pdr {
if (m_params.print_boogie_certificate()) {
datalog::boogie_proof bp(m);
bp.set_proof(get_proof());
bp.set_model(0);
bp.set_model(nullptr);
bp.pp(strm);
}
else {

View file

@ -143,7 +143,7 @@ namespace pdr {
void add_property(expr * lemma, unsigned lvl); // add property 'p' to state at level.
lbool is_reachable(model_node& n, expr_ref_vector* core, bool& uses_level);
bool is_invariant(unsigned level, expr* co_state, bool inductive, bool& assumes_level, expr_ref_vector* core = 0);
bool is_invariant(unsigned level, expr* co_state, bool inductive, bool& assumes_level, expr_ref_vector* core = nullptr);
bool check_inductive(unsigned level, expr_ref_vector& state, bool& assumes_level);
expr_ref get_formulas(unsigned level, bool add_axioms);
@ -199,8 +199,8 @@ namespace pdr {
datalog::rule const* m_rule;
public:
model_node(model_node* parent, expr_ref& state, pred_transformer& pt, unsigned level):
m_parent(parent), m_next(0), m_prev(0), m_pt(pt), m_state(state), m_model(0),
m_level(level), m_orig_level(level), m_depth(0), m_closed(false), m_rule(0) {
m_parent(parent), m_next(nullptr), m_prev(nullptr), m_pt(pt), m_state(state), m_model(nullptr),
m_level(level), m_orig_level(level), m_depth(0), m_closed(false), m_rule(nullptr) {
model_node* p = m_parent;
if (p) {
p->m_children.push_back(this);
@ -253,7 +253,7 @@ namespace pdr {
void dequeue(model_node*& root);
void enqueue(model_node* n);
model_node* next() const { return m_next; }
bool is_goal() const { return 0 != next(); }
bool is_goal() const { return nullptr != next(); }
};
class model_search {
@ -271,7 +271,7 @@ namespace pdr {
unsigned num_goals() const;
public:
model_search(bool bfs): m_bfs(bfs), m_root(0), m_goal(0) {}
model_search(bool bfs): m_bfs(bfs), m_root(nullptr), m_goal(nullptr) {}
~model_search();
void reset();

View file

@ -38,7 +38,7 @@ dl_interface::dl_interface(datalog::context& ctx) :
m_ctx(ctx),
m_pdr_rules(ctx),
m_old_rules(ctx),
m_context(0),
m_context(nullptr),
m_refs(ctx.get_manager()) {
m_context = alloc(pdr::context, ctx.get_fparams(), ctx.get_params(), ctx.get_manager());
}

View file

@ -47,29 +47,29 @@ namespace pdr {
public:
dl_interface(datalog::context& ctx);
~dl_interface();
~dl_interface() override;
virtual lbool query(expr* query);
lbool query(expr* query) override;
virtual void display_certificate(std::ostream& out) const;
void display_certificate(std::ostream& out) const override;
virtual void collect_statistics(statistics& st) const;
void collect_statistics(statistics& st) const override;
virtual void reset_statistics();
void reset_statistics() override;
virtual expr_ref get_answer();
expr_ref get_answer() override;
virtual unsigned get_num_levels(func_decl* pred);
unsigned get_num_levels(func_decl* pred) override;
virtual expr_ref get_cover_delta(int level, func_decl* pred);
expr_ref get_cover_delta(int level, func_decl* pred) override;
virtual void add_cover(int level, func_decl* pred, expr* property);
void add_cover(int level, func_decl* pred, expr* property) override;
virtual void updt_params();
void updt_params() override;
virtual model_ref get_model();
model_ref get_model() override;
virtual proof_ref get_proof();
proof_ref get_proof() override;
};
}

View file

@ -373,7 +373,7 @@ namespace pdr {
farkas_learner::farkas_learner(smt_params& params, ast_manager& outer_mgr)
: m_proof_params(get_proof_params(params)),
m_pr(PGM_ENABLED),
m_constr(0),
m_constr(nullptr),
m_combine_farkas_coefficients(true),
p2o(m_pr, outer_mgr),
o2p(outer_mgr, m_pr)

View file

@ -189,7 +189,7 @@ namespace pdr {
expr_ref fml1 = mk_and(core);
expr_ref fml2 = n.pt().get_formulas(n.level(), false);
fml1_2.push_back(fml1);
fml1_2.push_back(0);
fml1_2.push_back(nullptr);
flatten_and(fml2, fmls);
for (unsigned i = 0; i < fmls.size(); ++i) {
fml2 = m.mk_not(fmls[i].get());
@ -199,7 +199,7 @@ namespace pdr {
tout << "Check states:\n" << mk_pp(state, m) << "\n";
tout << "Old states:\n" << mk_pp(fml2, m) << "\n";
);
model_node nd(0, state, n.pt(), n.level());
model_node nd(nullptr, state, n.pt(), n.level());
pred_transformer::scoped_farkas sf(n.pt(), true);
bool uses_level1 = uses_level;
if (l_false == n.pt().is_reachable(nd, &conv2, uses_level1)) {
@ -236,7 +236,7 @@ namespace pdr {
n.pt().get_solver().set_consequences(&consequences);
pred_transformer::scoped_farkas sf (n.pt(), true);
VERIFY(l_false == n.pt().is_reachable(n, &core1, uses_level1));
n.pt().get_solver().set_consequences(0);
n.pt().get_solver().set_consequences(nullptr);
}
IF_VERBOSE(0,
verbose_stream() << "Consequences: " << consequences.size() << "\n";
@ -257,7 +257,7 @@ namespace pdr {
cstate.push_back(m.mk_not(consequences[i].get()));
}
tmp = m.mk_and(cstate.size(), cstate.c_ptr());
model_node nd(0, tmp, n.pt(), n.level());
model_node nd(nullptr, tmp, n.pt(), n.level());
pred_transformer::scoped_farkas sf (n.pt(), false);
VERIFY(l_false == n.pt().is_reachable(nd, &core1, uses_level1));
}
@ -752,7 +752,7 @@ namespace pdr {
//
void core_induction_generalizer::operator()(model_node& n, expr_ref_vector& core, bool& uses_level) {
model_node* p = n.parent();
if (p == 0) {
if (p == nullptr) {
return;
}
unsigned depth = 2;

View file

@ -30,8 +30,8 @@ namespace pdr {
unsigned m_failure_limit;
public:
core_bool_inductive_generalizer(context& ctx, unsigned failure_limit) : core_generalizer(ctx), m_failure_limit(failure_limit) {}
virtual ~core_bool_inductive_generalizer() {}
virtual void operator()(model_node& n, expr_ref_vector& core, bool& uses_level);
~core_bool_inductive_generalizer() override {}
void operator()(model_node& n, expr_ref_vector& core, bool& uses_level) override;
};
template <typename T>
@ -61,17 +61,17 @@ namespace pdr {
bool substitute_alias(rational const&r, expr* x, expr* e, expr_ref& result);
public:
core_arith_inductive_generalizer(context& ctx);
virtual ~core_arith_inductive_generalizer() {}
virtual void operator()(model_node& n, expr_ref_vector& core, bool& uses_level);
~core_arith_inductive_generalizer() override {}
void operator()(model_node& n, expr_ref_vector& core, bool& uses_level) override;
};
class core_farkas_generalizer : public core_generalizer {
farkas_learner m_farkas_learner;
public:
core_farkas_generalizer(context& ctx, ast_manager& m, smt_params& p);
virtual ~core_farkas_generalizer() {}
virtual void operator()(model_node& n, expr_ref_vector& core, bool& uses_level);
virtual void collect_statistics(statistics& st) const;
~core_farkas_generalizer() override {}
void operator()(model_node& n, expr_ref_vector& core, bool& uses_level) override;
void collect_statistics(statistics& st) const override;
};
@ -85,26 +85,26 @@ namespace pdr {
bool is_unsat(expr_ref_vector const& As, expr* B);
public:
core_convex_hull_generalizer(context& ctx, bool is_closure);
virtual ~core_convex_hull_generalizer() {}
virtual void operator()(model_node& n, expr_ref_vector const& core, bool uses_level, cores& new_cores);
virtual void operator()(model_node& n, expr_ref_vector& core, bool& uses_level);
~core_convex_hull_generalizer() override {}
void operator()(model_node& n, expr_ref_vector const& core, bool uses_level, cores& new_cores) override;
void operator()(model_node& n, expr_ref_vector& core, bool& uses_level) override;
};
class core_multi_generalizer : public core_generalizer {
core_bool_inductive_generalizer m_gen;
public:
core_multi_generalizer(context& ctx, unsigned max_failures): core_generalizer(ctx), m_gen(ctx, max_failures) {}
virtual ~core_multi_generalizer() {}
virtual void operator()(model_node& n, expr_ref_vector& core, bool& uses_level);
virtual void operator()(model_node& n, expr_ref_vector const& core, bool uses_level, cores& new_cores);
~core_multi_generalizer() override {}
void operator()(model_node& n, expr_ref_vector& core, bool& uses_level) override;
void operator()(model_node& n, expr_ref_vector const& core, bool uses_level, cores& new_cores) override;
};
class core_induction_generalizer : public core_generalizer {
class imp;
public:
core_induction_generalizer(context& ctx): core_generalizer(ctx) {}
virtual ~core_induction_generalizer() {}
virtual void operator()(model_node& n, expr_ref_vector& core, bool& uses_level);
~core_induction_generalizer() override {}
void operator()(model_node& n, expr_ref_vector& core, bool& uses_level) override;
};
};
#endif

View file

@ -289,7 +289,7 @@ namespace pdr {
bg is background knowledge and can be null
*/
bool implication_surely_holds(expr * lhs, expr * rhs, expr * bg=0);
bool implication_surely_holds(expr * lhs, expr * rhs, expr * bg=nullptr);
unsigned get_unique_num() { return m_next_unique_num++; }

View file

@ -133,7 +133,7 @@ namespace pdr {
else if ((m.is_eq(e, c, val) && is_app(val) && dt.is_constructor(to_app(val))) ||
(m.is_eq(e, val, c) && is_app(val) && dt.is_constructor(to_app(val)))){
func_decl* f = to_app(val)->get_decl();
func_decl* r = dt.get_constructor_recognizer(f);
func_decl* r = dt.get_constructor_is(f);
conjs[i] = m.mk_app(r, c);
ptr_vector<func_decl> const& acc = *dt.get_constructor_accessors(f);
for (unsigned j = 0; j < acc.size(); ++j) {
@ -234,9 +234,9 @@ namespace pdr {
m_pos_level_atoms(m),
m_neg_level_atoms(m),
m_proxies(m),
m_core(0),
m_model(0),
m_consequences(0),
m_core(nullptr),
m_model(nullptr),
m_consequences(nullptr),
m_subset_based_core(false),
m_use_farkas(false),
m_in_level(false),
@ -249,7 +249,7 @@ namespace pdr {
unsigned idx = level_cnt();
std::stringstream name;
name << m_name << "#level_" << idx;
func_decl * lev_pred = m.mk_fresh_func_decl(name.str().c_str(), 0, 0,m.mk_bool_sort());
func_decl * lev_pred = m.mk_fresh_func_decl(name.str().c_str(), 0, nullptr,m.mk_bool_sort());
m_aux_symbols.insert(lev_pred);
m_level_preds.push_back(lev_pred);
@ -301,7 +301,7 @@ namespace pdr {
safe_assumptions& safe,
const expr_ref_vector& atoms)
{
flet<bool> _model(m_fparams.m_model, m_model != 0);
flet<bool> _model(m_fparams.m_model, m_model != nullptr);
expr_ref_vector expr_atoms(m);
expr_atoms.append(atoms.size(), atoms.c_ptr());
@ -342,8 +342,8 @@ namespace pdr {
extract_subset_core(safe);
SASSERT(expr_atoms.size() >= m_core->size());
}
m_core = 0;
m_model = 0;
m_core = nullptr;
m_model = nullptr;
m_subset_based_core = false;
return result;
}

View file

@ -24,7 +24,7 @@ namespace pdr {
reachable_cache::reachable_cache(pdr::manager & pm, datalog::PDR_CACHE_MODE cm)
: m(pm.get_manager()),
m_pm(pm),
m_ctx(0),
m_ctx(nullptr),
m_ref_holder(m),
m_disj_connector(m),
m_cache_mode(cm) {

View file

@ -130,7 +130,7 @@ namespace pdr {
smt_context* smt_context_manager::mk_fresh() {
++m_num_contexts;
app_ref pred(m);
smt::kernel * ctx = 0;
smt::kernel * ctx = nullptr;
if (m_max_num_contexts == 0) {
m_contexts.push_back(alloc(smt::kernel, m, m_fparams));
pred = m.mk_true();

View file

@ -59,15 +59,15 @@ namespace pdr {
smt::kernel & m_context;
public:
_smt_context(smt::kernel & ctx, smt_context_manager& p, app* pred);
virtual ~_smt_context() {}
virtual void assert_expr(expr* e);
virtual lbool check(expr_ref_vector& assumptions);
virtual void get_model(model_ref& model);
virtual proof* get_proof();
virtual void push() { m_context.push(); }
virtual void pop() { m_context.pop(1); }
virtual unsigned get_unsat_core_size() { return m_context.get_unsat_core_size(); }
virtual expr* get_unsat_core_expr(unsigned i) { return m_context.get_unsat_core_expr(i); }
~_smt_context() override {}
void assert_expr(expr* e) override;
lbool check(expr_ref_vector& assumptions) override;
void get_model(model_ref& model) override;
proof* get_proof() override;
void push() override { m_context.push(); }
void pop() override { m_context.pop(1); }
unsigned get_unsat_core_size() override { return m_context.get_unsat_core_size(); }
expr* get_unsat_core_expr(unsigned i) override { return m_context.get_unsat_core_expr(i); }
};
class smt_context_manager {

View file

@ -122,7 +122,7 @@ public:
func_decl * try_get_primary_by_prefix(func_decl* prefix) const {
func_decl * res;
if(!m_prefix2prim.find(prefix, res)) {
return 0;
return nullptr;
}
return res;
}
@ -133,7 +133,7 @@ public:
func_decl * try_get_by_prefix(func_decl* prefix, unsigned idx) {
func_decl * prim = try_get_primary_by_prefix(prefix);
if(!prim) {
return 0;
return nullptr;
}
return conv(prim, 0, idx);
}

View file

@ -244,7 +244,7 @@ namespace pdr {
}
bool test_eq(expr* e) const {
expr* lhs = 0, *rhs = 0;
expr* lhs = nullptr, *rhs = nullptr;
VERIFY(m.is_eq(e, lhs, rhs));
if (!a.is_int_real(lhs)) {
return true;

View file

@ -32,7 +32,7 @@ namespace datalog {
predicates.insert(I->first);
}
// reserve pred id = 0 for initalization purposes
// reserve pred id = 0 for initialization purposes
unsigned num_preds = (unsigned)predicates.size() + 1;
// poor's man round-up log2
@ -118,7 +118,7 @@ namespace datalog {
}
exprs.reset();
assert_pred_id(numqs ? r->get_tail(0)->get_decl() : 0, m_ruleid_var_set, exprs);
assert_pred_id(numqs ? r->get_tail(0)->get_decl() : nullptr, m_ruleid_var_set, exprs);
assert_pred_id(r->get_head()->get_decl(), m_ruleid_varp_set, exprs);
subst.reset();
@ -141,7 +141,7 @@ namespace datalog {
if (m_facts) {
for (fact_vector::const_iterator I = m_facts->begin(), E = m_facts->end(); I != E; ++I) {
exprs.reset();
assert_pred_id(0, m_ruleid_var_set, exprs);
assert_pred_id(nullptr, m_ruleid_var_set, exprs);
assert_pred_id(I->first, m_ruleid_varp_set, exprs);
for (unsigned i = 0; i < I->second.size(); ++i) {

View file

@ -23,7 +23,7 @@ Abstract:
namespace datalog {
class aig_exporter {
public:
aig_exporter(const rule_set& rules, context& ctx, const fact_vector *facts = 0);
aig_exporter(const rule_set& rules, context& ctx, const fact_vector *facts = nullptr);
void operator()(std::ostream& out);
private:
@ -60,7 +60,7 @@ namespace datalog {
unsigned mk_or(unsigned id1, unsigned id2);
unsigned get_var(const expr *e);
unsigned mk_var(const expr *e);
unsigned mk_input_var(const expr *e = 0);
unsigned mk_input_var(const expr *e = nullptr);
unsigned mk_expr_id();
};
}

View file

@ -150,7 +150,7 @@ namespace datalog {
check_relation_plugin::check_relation_plugin(relation_manager& rm):
relation_plugin(check_relation_plugin::get_name(), rm),
m(rm.get_context().get_manager()),
m_base(0) {
m_base(nullptr) {
}
check_relation_plugin::~check_relation_plugin() {
}
@ -158,7 +158,7 @@ namespace datalog {
return dynamic_cast<check_relation&>(r);
}
check_relation* check_relation_plugin::get(relation_base* r) {
return r?dynamic_cast<check_relation*>(r):0;
return r?dynamic_cast<check_relation*>(r):nullptr;
}
check_relation const & check_relation_plugin::get(relation_base const& r) {
return dynamic_cast<check_relation const&>(r);
@ -192,8 +192,8 @@ namespace datalog {
const unsigned * cols1, const unsigned * cols2)
: convenient_join_fn(o1_sig, o2_sig, col_cnt, cols1, cols2), m_join(j)
{}
virtual ~join_fn() {}
virtual relation_base * operator()(const relation_base & r1, const relation_base & r2) {
~join_fn() override {}
relation_base * operator()(const relation_base & r1, const relation_base & r2) override {
check_relation const& t1 = get(r1);
check_relation const& t2 = get(r2);
check_relation_plugin& p = t1.get_plugin();
@ -207,7 +207,7 @@ namespace datalog {
const relation_base & t1, const relation_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) {
relation_join_fn* j = m_base->mk_join_fn(get(t1).rb(), get(t2).rb(), col_cnt, cols1, cols2);
return j?alloc(join_fn, j, t1.get_signature(), t2.get_signature(), col_cnt, cols1, cols2):0;
return j?alloc(join_fn, j, t1.get_signature(), t2.get_signature(), col_cnt, cols1, cols2):nullptr;
}
class check_relation_plugin::join_project_fn : public convenient_relation_join_project_fn {
@ -221,8 +221,8 @@ namespace datalog {
: convenient_join_project_fn(o1_sig, o2_sig, col_cnt, cols1, cols2,
removed_col_cnt, removed_cols), m_join(j)
{}
virtual ~join_project_fn() {}
virtual relation_base * operator()(const relation_base & r1, const relation_base & r2) {
~join_project_fn() override {}
relation_base * operator()(const relation_base & r1, const relation_base & r2) override {
check_relation const& t1 = get(r1);
check_relation const& t2 = get(r2);
check_relation_plugin& p = t1.get_plugin();
@ -239,7 +239,7 @@ namespace datalog {
relation_join_fn* j = m_base->mk_join_project_fn(get(t1).rb(), get(t2).rb(), col_cnt, cols1, cols2,
removed_col_cnt, removed_cols);
return j?alloc(join_project_fn, j, t1.get_signature(), t2.get_signature(), col_cnt, cols1, cols2,
removed_col_cnt, removed_cols):0;
removed_col_cnt, removed_cols):nullptr;
}
void check_relation_plugin::verify_filter_project(
@ -491,7 +491,7 @@ namespace datalog {
public:
union_fn(relation_union_fn* m): m_union(m) {}
virtual void operator()(relation_base & _r, const relation_base & _src, relation_base * _delta) {
void operator()(relation_base & _r, const relation_base & _src, relation_base * _delta) override {
TRACE("doc", _r.display(tout << "dst:\n"); _src.display(tout << "src:\n"););
check_relation& r = get(_r);
check_relation const& src = get(_src);
@ -499,8 +499,8 @@ namespace datalog {
expr_ref fml0 = r.m_fml;
expr_ref delta0(r.m_fml.get_manager());
if (d) d->to_formula(delta0);
(*m_union)(r.rb(), src.rb(), d?(&d->rb()):0);
r.get_plugin().verify_union(fml0, src.rb(), r.rb(), delta0, d?(&d->rb()):0);
(*m_union)(r.rb(), src.rb(), d?(&d->rb()):nullptr);
r.get_plugin().verify_union(fml0, src.rb(), r.rb(), delta0, d?(&d->rb()):nullptr);
r.rb().to_formula(r.m_fml);
if (d) d->rb().to_formula(d->m_fml);
}
@ -508,16 +508,16 @@ namespace datalog {
relation_union_fn * check_relation_plugin::mk_union_fn(
const relation_base & tgt, const relation_base & src,
const relation_base * delta) {
relation_base const* d1 = delta?(&(get(*delta).rb())):0;
relation_base const* d1 = delta?(&(get(*delta).rb())):nullptr;
relation_union_fn* u = m_base->mk_union_fn(get(tgt).rb(), get(src).rb(), d1);
return u?alloc(union_fn, u):0;
return u?alloc(union_fn, u):nullptr;
}
relation_union_fn * check_relation_plugin::mk_widen_fn(
const relation_base & tgt, const relation_base & src,
const relation_base * delta) {
relation_base const* d1 = delta?(&(get(*delta).rb())):0;
relation_base const* d1 = delta?(&(get(*delta).rb())):nullptr;
relation_union_fn* u = m_base->mk_widen_fn(get(tgt).rb(), get(src).rb(), d1);
return u?alloc(union_fn, u):0;
return u?alloc(union_fn, u):nullptr;
}
class check_relation_plugin::filter_identical_fn : public relation_mutator_fn {
@ -529,9 +529,9 @@ namespace datalog {
m_filter(f) {
}
virtual ~filter_identical_fn() {}
~filter_identical_fn() override {}
virtual void operator()(relation_base & _r) {
void operator()(relation_base & _r) override {
check_relation& r = get(_r);
check_relation_plugin& p = r.get_plugin();
ast_manager& m = p.m;
@ -553,7 +553,7 @@ namespace datalog {
relation_mutator_fn * check_relation_plugin::mk_filter_identical_fn(
const relation_base & t, unsigned col_cnt, const unsigned * identical_cols) {
relation_mutator_fn* r = m_base->mk_filter_identical_fn(get(t).rb(), col_cnt, identical_cols);
return r?alloc(filter_identical_fn, r, col_cnt, identical_cols):0;
return r?alloc(filter_identical_fn, r, col_cnt, identical_cols):nullptr;
}
class check_relation_plugin::filter_interpreted_fn : public relation_mutator_fn {
@ -565,9 +565,9 @@ namespace datalog {
m_condition(condition) {
}
virtual ~filter_interpreted_fn() {}
~filter_interpreted_fn() override {}
virtual void operator()(relation_base & tb) {
void operator()(relation_base & tb) override {
check_relation& r = get(tb);
check_relation_plugin& p = r.get_plugin();
expr_ref fml = r.m_fml;
@ -579,7 +579,7 @@ namespace datalog {
relation_mutator_fn * check_relation_plugin::mk_filter_interpreted_fn(const relation_base & t, app * condition) {
relation_mutator_fn* r = m_base->mk_filter_interpreted_fn(get(t).rb(), condition);
app_ref cond(condition, m);
return r?alloc(filter_interpreted_fn, r, cond):0;
return r?alloc(filter_interpreted_fn, r, cond):nullptr;
}
class check_relation_plugin::project_fn : public convenient_relation_project_fn {
@ -592,9 +592,9 @@ namespace datalog {
m_project(p) {
}
virtual ~project_fn() {}
~project_fn() override {}
virtual relation_base * operator()(const relation_base & tb) {
relation_base * operator()(const relation_base & tb) override {
check_relation const& t = get(tb);
check_relation_plugin& p = t.get_plugin();
relation_base* r = (*m_project)(t.rb());
@ -608,7 +608,7 @@ namespace datalog {
const relation_base & t, unsigned col_cnt,
const unsigned * removed_cols) {
relation_transformer_fn* p = m_base->mk_project_fn(get(t).rb(), col_cnt, removed_cols);
return p?alloc(project_fn, p, t, col_cnt, removed_cols):0;
return p?alloc(project_fn, p, t, col_cnt, removed_cols):nullptr;
}
class check_relation_plugin::rename_fn : public convenient_relation_rename_fn {
@ -620,9 +620,9 @@ namespace datalog {
m_permute(permute) {
}
virtual ~rename_fn() {}
~rename_fn() override {}
virtual relation_base * operator()(const relation_base & _t) {
relation_base * operator()(const relation_base & _t) override {
check_relation const& t = get(_t);
check_relation_plugin& p = t.get_plugin();
relation_signature const& sig = get_result_signature();
@ -635,7 +635,7 @@ namespace datalog {
const relation_base & r,
unsigned cycle_len, const unsigned * permutation_cycle) {
relation_transformer_fn* p = m_base->mk_rename_fn(get(r).rb(), cycle_len, permutation_cycle);
return p?alloc(rename_fn, p, r, cycle_len, permutation_cycle):0;
return p?alloc(rename_fn, p, r, cycle_len, permutation_cycle):nullptr;
}
class check_relation_plugin::filter_equal_fn : public relation_mutator_fn {
@ -649,8 +649,8 @@ namespace datalog {
m_val(val),
m_col(col)
{}
virtual ~filter_equal_fn() { }
virtual void operator()(relation_base & tb) {
~filter_equal_fn() override { }
void operator()(relation_base & tb) override {
check_relation & t = get(tb);
check_relation_plugin& p = t.get_plugin();
(*m_filter)(t.rb());
@ -663,7 +663,7 @@ namespace datalog {
relation_mutator_fn * check_relation_plugin::mk_filter_equal_fn(
const relation_base & t, const relation_element & value, unsigned col) {
relation_mutator_fn* r = m_base->mk_filter_equal_fn(get(t).rb(), value, col);
return r?alloc(filter_equal_fn, r, t, value, col):0;
return r?alloc(filter_equal_fn, r, t, value, col):nullptr;
}
@ -682,7 +682,7 @@ namespace datalog {
SASSERT(joined_col_cnt > 0);
}
virtual void operator()(relation_base& tb, const relation_base& negb) {
void operator()(relation_base& tb, const relation_base& negb) override {
check_relation& t = get(tb);
check_relation const& n = get(negb);
check_relation_plugin& p = t.get_plugin();
@ -700,7 +700,7 @@ namespace datalog {
const relation_base& neg, unsigned joined_col_cnt, const unsigned *t_cols,
const unsigned *negated_cols) {
relation_intersection_filter_fn* f = m_base->mk_filter_by_negation_fn(get(t).rb(), get(neg).rb(), joined_col_cnt, t_cols, negated_cols);
return f?alloc(negation_filter_fn, f, joined_col_cnt, t_cols, negated_cols):0;
return f?alloc(negation_filter_fn, f, joined_col_cnt, t_cols, negated_cols):nullptr;
}
/*
@ -763,9 +763,9 @@ namespace datalog {
m_xform(xform)
{}
virtual ~filter_proj_fn() {}
~filter_proj_fn() override {}
virtual relation_base* operator()(const relation_base & tb) {
relation_base* operator()(const relation_base & tb) override {
check_relation const & t = get(tb);
check_relation_plugin& p = t.get_plugin();
relation_base* r = (*m_xform)(t.rb());
@ -779,7 +779,7 @@ namespace datalog {
unsigned removed_col_cnt, const unsigned * removed_cols) {
relation_transformer_fn* r = m_base->mk_filter_interpreted_and_project_fn(get(t).rb(), condition, removed_col_cnt, removed_cols);
app_ref cond(condition, m);
return r?alloc(filter_proj_fn, r, t, cond, removed_col_cnt, removed_cols):0;
return r?alloc(filter_proj_fn, r, t, cond, removed_col_cnt, removed_cols):nullptr;
}

View file

@ -38,20 +38,20 @@ namespace datalog {
expr_ref mk_eq(relation_fact const& f) const;
public:
check_relation(check_relation_plugin& p, relation_signature const& s, relation_base* r);
virtual ~check_relation();
virtual void reset();
virtual void add_fact(const relation_fact & f);
virtual void add_new_fact(const relation_fact & f);
virtual bool contains_fact(const relation_fact & f) const;
virtual check_relation * clone() const;
virtual check_relation * complement(func_decl*) const;
virtual void to_formula(expr_ref& fml) const;
~check_relation() override;
void reset() override;
void add_fact(const relation_fact & f) override;
void add_new_fact(const relation_fact & f) override;
bool contains_fact(const relation_fact & f) const override;
check_relation * clone() const override;
check_relation * complement(func_decl*) const override;
void to_formula(expr_ref& fml) const override;
check_relation_plugin& get_plugin() const;
virtual bool fast_empty() const;
virtual bool empty() const;
virtual void display(std::ostream& out) const;
virtual bool is_precise() const { return m_relation->is_precise(); }
virtual unsigned get_size_estimate_rows() const { return m_relation->get_size_estimate_rows(); }
bool fast_empty() const override;
bool empty() const override;
void display(std::ostream& out) const override;
bool is_precise() const override { return m_relation->is_precise(); }
unsigned get_size_estimate_rows() const override { return m_relation->get_size_estimate_rows(); }
relation_base& rb() { return *m_relation; }
relation_base const& rb() const { return *m_relation; }
expr_ref ground(expr* fml) const;
@ -90,39 +90,39 @@ namespace datalog {
unsigned_vector const& cols1, unsigned_vector const& cols2);
public:
check_relation_plugin(relation_manager& rm);
~check_relation_plugin();
~check_relation_plugin() override;
void set_plugin(relation_plugin* p) { m_base = p; }
virtual bool can_handle_signature(const relation_signature & s);
bool can_handle_signature(const relation_signature & s) override;
static symbol get_name() { return symbol("check_relation"); }
virtual relation_base * mk_empty(const relation_signature & s);
virtual relation_base * mk_full(func_decl* p, const relation_signature & s);
virtual relation_join_fn * mk_join_fn(const relation_base & t1, const relation_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2);
virtual relation_join_fn * mk_join_project_fn(
relation_base * mk_empty(const relation_signature & s) override;
relation_base * mk_full(func_decl* p, const relation_signature & s) override;
relation_join_fn * mk_join_fn(const relation_base & t1, const relation_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) override;
relation_join_fn * mk_join_project_fn(
const relation_base & t1, const relation_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2,
unsigned removed_col_cnt, const unsigned * removed_cols);
virtual relation_transformer_fn * mk_project_fn(const relation_base & t, unsigned col_cnt,
const unsigned * removed_cols);
virtual relation_transformer_fn * mk_rename_fn(const relation_base & t, unsigned permutation_cycle_len,
const unsigned * permutation_cycle);
virtual relation_union_fn * mk_union_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta);
virtual relation_union_fn * mk_widen_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta);
virtual relation_mutator_fn * mk_filter_identical_fn(const relation_base & t, unsigned col_cnt,
const unsigned * identical_cols);
virtual relation_mutator_fn * mk_filter_equal_fn(const relation_base & t, const relation_element & value,
unsigned col);
virtual relation_mutator_fn * mk_filter_interpreted_fn(const relation_base & t, app * condition);
virtual relation_intersection_filter_fn * mk_filter_by_negation_fn(
unsigned removed_col_cnt, const unsigned * removed_cols) override;
relation_transformer_fn * mk_project_fn(const relation_base & t, unsigned col_cnt,
const unsigned * removed_cols) override;
relation_transformer_fn * mk_rename_fn(const relation_base & t, unsigned permutation_cycle_len,
const unsigned * permutation_cycle) override;
relation_union_fn * mk_union_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta) override;
relation_union_fn * mk_widen_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta) override;
relation_mutator_fn * mk_filter_identical_fn(const relation_base & t, unsigned col_cnt,
const unsigned * identical_cols) override;
relation_mutator_fn * mk_filter_equal_fn(const relation_base & t, const relation_element & value,
unsigned col) override;
relation_mutator_fn * mk_filter_interpreted_fn(const relation_base & t, app * condition) override;
relation_intersection_filter_fn * mk_filter_by_negation_fn(
const relation_base& t,
const relation_base& neg, unsigned joined_col_cnt, const unsigned *t_cols,
const unsigned *negated_cols);
virtual relation_transformer_fn * mk_filter_interpreted_and_project_fn(
const unsigned *negated_cols) override;
relation_transformer_fn * mk_filter_interpreted_and_project_fn(
const relation_base & t, app * condition,
unsigned removed_col_cnt, const unsigned * removed_cols);
unsigned removed_col_cnt, const unsigned * removed_cols) override;
void verify_join(relation_base const& t1, relation_base const& t2, relation_base const& t,
unsigned_vector const& cols1, unsigned_vector const& cols2);

View file

@ -51,7 +51,7 @@ namespace datalog {
ast_manager & m = renaming_arg.get_manager();
unsigned sz = map.size();
unsigned ofs = sz-1;
renaming_arg.resize(sz, static_cast<expr *>(0));
renaming_arg.resize(sz, static_cast<expr *>(nullptr));
for(unsigned i=0; i<sz; i++) {
if(map[i]!=UINT_MAX) {
renaming_arg.set(ofs-i, m.mk_var(map[i], orig_sig[i]));
@ -127,7 +127,7 @@ namespace datalog {
unsigned func_cnt = src.functional_columns();
if(removed_cols==0) {
if(removed_cols==nullptr) {
result.set_functional_columns(func_cnt);
return;
}
@ -423,17 +423,17 @@ namespace datalog {
const row_interface & m_parent;
unsigned m_index;
protected:
virtual bool is_finished() const { return m_index==m_parent.size(); }
bool is_finished() const override { return m_index==m_parent.size(); }
public:
fact_row_iterator(const row_interface & row, bool finished)
: m_parent(row), m_index(finished ? row.size() : 0) {}
virtual table_element operator*() {
table_element operator*() override {
SASSERT(!is_finished());
return m_parent[m_index];
}
virtual void operator++() {
void operator++() override {
m_index++;
SASSERT(m_index<=m_parent.size());
}

View file

@ -41,20 +41,20 @@ namespace datalog {
public:
scoped_rel(T* t) : m_t(t) {}
~scoped_rel() { if (m_t) { universal_delete(m_t); } }
scoped_rel() : m_t(0) {}
scoped_rel() : m_t(nullptr) {}
scoped_rel& operator=(T* t) { if (m_t && t != m_t) { universal_delete(m_t); } m_t = t; return *this; }
T* operator->() { return m_t; }
const T* operator->() const { return m_t; }
T& operator*() { return *m_t; }
const T& operator*() const { return *m_t; }
operator bool() const { return m_t!=0; }
operator bool() const { return m_t!=nullptr; }
T* get() const { return m_t; }
/**
\brief Remove object from \c scoped_rel without deleting it.
*/
T* release() {
T* res = m_t;
m_t = 0;
m_t = nullptr;
return res;
}
};
@ -202,7 +202,7 @@ namespace datalog {
virtual void operator()(base_object & tgt, const base_object & src, base_object * delta) = 0;
void operator()(base_object & tgt, const base_object & src) {
(*this)(tgt, src, static_cast<base_object *>(0));
(*this)(tgt, src, static_cast<base_object *>(nullptr));
}
};
@ -220,7 +220,7 @@ namespace datalog {
*/
class mutator_fn : public base_fn {
public:
virtual ~mutator_fn() {}
~mutator_fn() override {}
virtual void operator()(base_object & t) = 0;
@ -335,55 +335,55 @@ namespace datalog {
virtual join_fn * mk_join_fn(const base_object & t1, const base_object & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) { return 0; }
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) { return nullptr; }
virtual transformer_fn * mk_project_fn(const base_object & t, unsigned col_cnt,
const unsigned * removed_cols) { return 0; }
const unsigned * removed_cols) { return nullptr; }
virtual join_fn * mk_join_project_fn(const base_object & t1, const base_object & t2,
unsigned joined_col_cnt, const unsigned * cols1, const unsigned * cols2,
unsigned removed_col_cnt, const unsigned * removed_cols) { return 0; }
unsigned removed_col_cnt, const unsigned * removed_cols) { return nullptr; }
virtual transformer_fn * mk_rename_fn(const base_object & t, unsigned permutation_cycle_len,
const unsigned * permutation_cycle) { return 0; }
const unsigned * permutation_cycle) { return nullptr; }
virtual transformer_fn * mk_permutation_rename_fn(const base_object & t,
const unsigned * permutation) { return 0; }
const unsigned * permutation) { return nullptr; }
public:
virtual union_fn * mk_union_fn(const base_object & tgt, const base_object & src,
const base_object * delta) { return 0; }
const base_object * delta) { return nullptr; }
protected:
virtual union_fn * mk_widen_fn(const base_object & tgt, const base_object & src,
const base_object * delta) { return 0; }
const base_object * delta) { return nullptr; }
virtual mutator_fn * mk_filter_identical_fn(const base_object & t, unsigned col_cnt,
const unsigned * identical_cols) { return 0; }
const unsigned * identical_cols) { return nullptr; }
virtual mutator_fn * mk_filter_equal_fn(const base_object & t, const element & value,
unsigned col) { return 0; }
unsigned col) { return nullptr; }
virtual mutator_fn * mk_filter_interpreted_fn(const base_object & t, app * condition)
{ return 0; }
{ return nullptr; }
virtual transformer_fn * mk_filter_interpreted_and_project_fn(const base_object & t,
app * condition, unsigned removed_col_cnt, const unsigned * removed_cols)
{ return 0; }
{ return nullptr; }
virtual transformer_fn * mk_select_equal_and_project_fn(const base_object & t,
const element & value, unsigned col) { return 0; }
const element & value, unsigned col) { return nullptr; }
virtual intersection_filter_fn * mk_filter_by_intersection_fn(const base_object & t,
const base_object & src, unsigned joined_col_cnt,
const unsigned * t_cols, const unsigned * src_cols)
{ return 0; }
{ return nullptr; }
virtual intersection_filter_fn * mk_filter_by_negation_fn(const base_object & t,
const base_object & negated_obj, unsigned joined_col_cnt,
const unsigned * t_cols, const unsigned * negated_cols)
{ return 0; }
{ return nullptr; }
virtual intersection_join_filter_fn * mk_filter_by_negated_join_fn(
const base_object & t,
@ -393,7 +393,7 @@ namespace datalog {
unsigned_vector const& src_cols,
unsigned_vector const& src1_cols,
unsigned_vector const& src2_cols)
{ return 0; }
{ return nullptr; }
};
@ -629,19 +629,19 @@ namespace datalog {
class identity_transformer_fn : public transformer_fn {
public:
virtual base_object * operator()(const base_object & t) {
base_object * operator()(const base_object & t) override {
return t.clone();
}
};
class identity_mutator_fn : public mutator_fn {
public:
virtual void operator()(base_object & t) {};
void operator()(base_object & t) override {};
};
class identity_intersection_filter_fn : public intersection_filter_fn {
public:
virtual void operator()(base_object & t, const base_object & neg) {};
void operator()(base_object & t, const base_object & neg) override {};
};
class default_permutation_rename_fn : public transformer_fn {
@ -655,11 +655,11 @@ namespace datalog {
: m_permutation(o.get_signature().size(), permutation),
m_renamers_initialized(false) {}
~default_permutation_rename_fn() {
~default_permutation_rename_fn() override {
dealloc_ptr_vector_content(m_renamers);
}
base_object * operator()(const base_object & o) {
base_object * operator()(const base_object & o) override {
const base_object * res = &o;
scoped_rel<base_object> res_scoped;
if(m_renamers_initialized) {
@ -803,11 +803,11 @@ namespace datalog {
protected:
relation_base(relation_plugin & plugin, const relation_signature & s)
: base_ancestor(plugin, s) {}
virtual ~relation_base() {}
~relation_base() override {}
public:
virtual relation_base * complement(func_decl* p) const = 0;
virtual void reset();
void reset() override;
virtual void display_tuples(func_decl & pred, std::ostream & out) const {
out << "Tuples in " << pred.get_name() << ": \n";
@ -1022,21 +1022,21 @@ namespace datalog {
table_plugin(symbol const& n, relation_manager & manager) : plugin_object(n, manager) {}
public:
virtual bool can_handle_signature(const table_signature & s) { return s.functional_columns()==0; }
bool can_handle_signature(const table_signature & s) override { return s.functional_columns()==0; }
protected:
/**
If the returned value is non-zero, the returned object must take ownership of \c mapper.
Otherwise \c mapper must remain unmodified.
*/
virtual table_mutator_fn * mk_map_fn(const table_base & t, table_row_mutator_fn * mapper) { return 0; }
virtual table_mutator_fn * mk_map_fn(const table_base & t, table_row_mutator_fn * mapper) { return nullptr; }
/**
If the returned value is non-zero, the returned object must take ownership of \c reducer.
Otherwise \c reducer must remain unmodified.
*/
virtual table_transformer_fn * mk_project_with_reduce_fn(const table_base & t, unsigned col_cnt,
const unsigned * removed_cols, table_row_pair_reduce_fn * reducer) { return 0; }
const unsigned * removed_cols, table_row_pair_reduce_fn * reducer) { return nullptr; }
};
@ -1044,17 +1044,17 @@ namespace datalog {
protected:
table_base(table_plugin & plugin, const table_signature & s)
: base_ancestor(plugin, s) {}
virtual ~table_base() {}
~table_base() override {}
public:
virtual table_base * clone() const;
virtual table_base * complement(func_decl* p, const table_element * func_columns = 0) const;
virtual bool empty() const;
table_base * clone() const override;
virtual table_base * complement(func_decl* p, const table_element * func_columns = nullptr) const;
bool empty() const override;
/**
\brief Return true if table contains fact that corresponds to \c f in all non-functional
columns.
*/
virtual bool contains_fact(const table_fact & f) const;
bool contains_fact(const table_fact & f) const override;
/**
\brief If \c f (i.e. its non-functional part) is not present in the table,
@ -1082,11 +1082,11 @@ namespace datalog {
virtual void remove_fact(table_element const* fact) = 0;
virtual void remove_facts(unsigned fact_cnt, const table_fact * facts);
virtual void remove_facts(unsigned fact_cnt, const table_element * facts);
virtual void reset();
void reset() override;
class row_interface;
virtual void display(std::ostream & out) const;
void display(std::ostream & out) const override;
/**
\brief Convert table to a formula that encodes the table.
@ -1245,9 +1245,9 @@ namespace datalog {
public:
caching_row_interface(const table_base & parent) : row_interface(parent) {}
virtual void get_fact(table_fact & result) const = 0;
void get_fact(table_fact & result) const override = 0;
virtual table_element operator[](unsigned col) const {
table_element operator[](unsigned col) const override {
ensure_populated();
return m_current[col];
}

View file

@ -79,11 +79,11 @@ namespace datalog {
: convenient_relation_join_fn(o1_sig, o2_sig, col_cnt, cols1, cols2) {
}
virtual relation_base * operator()(const relation_base & _r1, const relation_base & _r2) {
relation_base * operator()(const relation_base & _r1, const relation_base & _r2) override {
bound_relation const& r1 = get(_r1);
bound_relation const& r2 = get(_r2);
bound_relation_plugin& p = r1.get_plugin();
bound_relation* result = dynamic_cast<bound_relation*>(p.mk_full(0, get_result_signature()));
bound_relation* result = dynamic_cast<bound_relation*>(p.mk_full(nullptr, get_result_signature()));
result->mk_join(r1, r2, m_cols1.size(), m_cols1.c_ptr(), m_cols2.c_ptr());
return result;
}
@ -92,7 +92,7 @@ namespace datalog {
relation_join_fn * bound_relation_plugin::mk_join_fn(const relation_base & r1, const relation_base & r2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) {
if (!check_kind(r1) || !check_kind(r2)) {
return 0;
return nullptr;
}
return alloc(join_fn, r1.get_signature(), r2.get_signature(), col_cnt, cols1, cols2);
}
@ -104,10 +104,10 @@ namespace datalog {
: convenient_relation_project_fn(orig_sig, removed_col_cnt, removed_cols) {
}
virtual relation_base * operator()(const relation_base & _r) {
relation_base * operator()(const relation_base & _r) override {
bound_relation const& r = get(_r);
bound_relation_plugin& p = r.get_plugin();
bound_relation* result = get(p.mk_full(0, get_result_signature()));
bound_relation* result = get(p.mk_full(nullptr, get_result_signature()));
result->mk_project(r, m_removed_cols.size(), m_removed_cols.c_ptr());
return result;
}
@ -124,10 +124,10 @@ namespace datalog {
: convenient_relation_rename_fn(orig_sig, cycle_len, cycle) {
}
virtual relation_base * operator()(const relation_base & _r) {
relation_base * operator()(const relation_base & _r) override {
bound_relation const& r = get(_r);
bound_relation_plugin& p = r.get_plugin();
bound_relation* result = get(p.mk_full(0, get_result_signature()));
bound_relation* result = get(p.mk_full(nullptr, get_result_signature()));
result->mk_rename(r, m_cycle.size(), m_cycle.c_ptr());
return result;
}
@ -138,7 +138,7 @@ namespace datalog {
if(check_kind(r)) {
return alloc(rename_fn, r.get_signature(), cycle_len, permutation_cycle);
}
return 0;
return nullptr;
}
@ -148,7 +148,7 @@ namespace datalog {
union_fn(bool is_widen) :
m_is_widen(is_widen) {
}
virtual void operator()(relation_base & _r, const relation_base & _src, relation_base * _delta) {
void operator()(relation_base & _r, const relation_base & _src, relation_base * _delta) override {
TRACE("bound_relation", _r.display(tout << "dst:\n"); _src.display(tout << "src:\n"););
get(_r).mk_union(get(_src), get(_delta), m_is_widen);
}
@ -160,7 +160,7 @@ namespace datalog {
union_fn_i(bool is_widen) :
m_is_widen(is_widen) {
}
virtual void operator()(relation_base & _r, const relation_base & _src, relation_base * _delta) {
void operator()(relation_base & _r, const relation_base & _src, relation_base * _delta) override {
TRACE("bound_relation", _r.display(tout << "dst:\n"); _src.display(tout << "src:\n"););
get(_r).mk_union_i(get_interval_relation(_src), get(_delta), m_is_widen);
TRACE("bound_relation", _r.display(tout << "dst':\n"););
@ -176,7 +176,7 @@ namespace datalog {
if (check_kind(tgt) && check_kind(src) && (!delta || check_kind(*delta))) {
return alloc(union_fn, false);
}
return 0;
return nullptr;
}
relation_union_fn * bound_relation_plugin::mk_widen_fn(
@ -188,7 +188,7 @@ namespace datalog {
if (check_kind(tgt) && check_kind(src) && (!delta || check_kind(*delta))) {
return alloc(union_fn, true);
}
return 0;
return nullptr;
}
class bound_relation_plugin::filter_identical_fn : public relation_mutator_fn {
@ -197,7 +197,7 @@ namespace datalog {
filter_identical_fn(unsigned col_cnt, const unsigned * identical_cols)
: m_cols(col_cnt, identical_cols) {}
virtual void operator()(relation_base & r) {
void operator()(relation_base & r) override {
for (unsigned i = 1; i < m_cols.size(); ++i) {
get(r).equate(m_cols[0], m_cols[i]);
}
@ -209,14 +209,14 @@ namespace datalog {
if(check_kind(t)) {
return alloc(filter_identical_fn, col_cnt, identical_cols);
}
return 0;
return nullptr;
}
class bound_relation_plugin::filter_equal_fn : public relation_mutator_fn {
public:
filter_equal_fn(relation_element const& value, unsigned col) {}
virtual void operator()(relation_base & r) { }
void operator()(relation_base & r) override { }
};
relation_mutator_fn * bound_relation_plugin::mk_filter_equal_fn(const relation_base & r,
@ -224,7 +224,7 @@ namespace datalog {
if (check_kind(r)) {
return alloc(filter_equal_fn, value, col);
}
return 0;
return nullptr;
}
class bound_relation_plugin::filter_interpreted_fn : public relation_mutator_fn {
@ -280,7 +280,7 @@ namespace datalog {
filter_interpreted_fn(ast_manager& m, app* cond) :
m_cond(cond, m),
m_lt(m), m_arith(m), m_interval(0), m_kind(NOT_APPLICABLE) {
m_lt(m), m_arith(m), m_interval(nullptr), m_kind(NOT_APPLICABLE) {
expr* l, *r, *r1, *r2, *c2;
rational n1;
if ((m_arith.is_lt(cond, l, r) || m_arith.is_gt(cond, r, l)) &&
@ -342,7 +342,7 @@ namespace datalog {
// x < y + z
//
void operator()(relation_base& t) {
void operator()(relation_base& t) override {
TRACE("dl", tout << mk_pp(m_cond, m_cond.get_manager()) << "\n"; t.display(tout););
bound_relation& r = get(t);
switch(m_kind) {
@ -370,11 +370,11 @@ namespace datalog {
TRACE("dl", t.display(tout << "result\n"););
}
bool supports_attachment(relation_base& t) {
bool supports_attachment(relation_base& t) override {
return is_interval_relation(t);
}
void attach(relation_base& t) {
void attach(relation_base& t) override {
SASSERT(is_interval_relation(t));
interval_relation& r = get_interval_relation(t);
m_interval = &r;
@ -592,7 +592,7 @@ namespace datalog {
scoped_ptr<relation_mutator_fn> fe = get_plugin().mk_filter_equal_fn(r, f[i], i);
(*fe)(r);
}
mk_union(r, 0, false);
mk_union(r, nullptr, false);
}
bool bound_relation::contains_fact(const relation_fact & f) const {
@ -604,12 +604,12 @@ namespace datalog {
}
bound_relation * bound_relation::clone() const {
bound_relation* result = 0;
bound_relation* result = nullptr;
if (empty()) {
result = bound_relation_plugin::get(get_plugin().mk_empty(get_signature()));
}
else {
result = bound_relation_plugin::get(get_plugin().mk_full(0, get_signature()));
result = bound_relation_plugin::get(get_plugin().mk_full(nullptr, get_signature()));
result->copy(*this);
}
return result;
@ -647,7 +647,7 @@ namespace datalog {
bound_relation * bound_relation::complement(func_decl* p) const {
UNREACHABLE();
return 0;
return nullptr;
}
void bound_relation::to_formula(expr_ref& fml) const {

View file

@ -47,29 +47,29 @@ namespace datalog {
bool_rewriter m_bsimp;
public:
bound_relation_plugin(relation_manager& m);
virtual bool can_handle_signature(const relation_signature & s);
bool can_handle_signature(const relation_signature & s) override;
static symbol get_name() { return symbol("bound_relation"); }
virtual relation_base * mk_empty(const relation_signature & s);
virtual relation_base * mk_full(func_decl* p, const relation_signature & s);
virtual relation_join_fn * mk_join_fn(const relation_base & t1, const relation_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2);
virtual relation_transformer_fn * mk_project_fn(const relation_base & t, unsigned col_cnt,
const unsigned * removed_cols);
virtual relation_transformer_fn * mk_rename_fn(const relation_base & t, unsigned permutation_cycle_len,
const unsigned * permutation_cycle);
virtual relation_union_fn * mk_union_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta);
virtual relation_union_fn * mk_widen_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta);
virtual relation_mutator_fn * mk_filter_identical_fn(const relation_base & t, unsigned col_cnt,
const unsigned * identical_cols);
virtual relation_mutator_fn * mk_filter_equal_fn(const relation_base & t, const relation_element & value,
unsigned col);
virtual relation_mutator_fn * mk_filter_interpreted_fn(const relation_base & t, app * condition);
virtual relation_join_fn * mk_join_project_fn(const relation_base & t1, const relation_base & t2,
unsigned joined_col_cnt, const unsigned * cols1, const unsigned * cols2,
unsigned removed_col_cnt, const unsigned * removed_cols) { return 0; }
relation_base * mk_empty(const relation_signature & s) override;
relation_base * mk_full(func_decl* p, const relation_signature & s) override;
relation_join_fn * mk_join_fn(const relation_base & t1, const relation_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) override;
relation_transformer_fn * mk_project_fn(const relation_base & t, unsigned col_cnt,
const unsigned * removed_cols) override;
relation_transformer_fn * mk_rename_fn(const relation_base & t, unsigned permutation_cycle_len,
const unsigned * permutation_cycle) override;
relation_union_fn * mk_union_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta) override;
relation_union_fn * mk_widen_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta) override;
relation_mutator_fn * mk_filter_identical_fn(const relation_base & t, unsigned col_cnt,
const unsigned * identical_cols) override;
relation_mutator_fn * mk_filter_equal_fn(const relation_base & t, const relation_element & value,
unsigned col) override;
relation_mutator_fn * mk_filter_interpreted_fn(const relation_base & t, app * condition) override;
relation_join_fn * mk_join_project_fn(const relation_base & t1, const relation_base & t2,
unsigned joined_col_cnt, const unsigned * cols1, const unsigned * cols2,
unsigned removed_col_cnt, const unsigned * removed_cols) override { return nullptr; }
#if 0
@ -123,12 +123,12 @@ namespace datalog {
bound_relation(bound_relation_plugin& p, relation_signature const& s, bool is_empty);
bound_relation& operator=(bound_relation const& other);
virtual bool empty() const { return m_empty; }
virtual void add_fact(const relation_fact & f);
virtual bool contains_fact(const relation_fact & f) const;
virtual bound_relation * clone() const;
virtual bound_relation * complement(func_decl* p) const;
virtual void to_formula(expr_ref& fml) const;
bool empty() const override { return m_empty; }
void add_fact(const relation_fact & f) override;
bool contains_fact(const relation_fact & f) const override;
bound_relation * clone() const override;
bound_relation * complement(func_decl* p) const override;
void to_formula(expr_ref& fml) const override;
bound_relation_plugin& get_plugin() const;
void mk_union_i(interval_relation const& src, bound_relation* delta, bool is_widen);
@ -141,28 +141,28 @@ namespace datalog {
bool is_lt(unsigned i, unsigned j) const;
virtual bool is_precise() const { return false; }
bool is_precise() const override { return false; }
private:
typedef uint_set2 T;
virtual T mk_intersect(T const& t1, T const& t2, bool& is_empty) const;
T mk_intersect(T const& t1, T const& t2, bool& is_empty) const override;
virtual T mk_widen(T const& t1, T const& t2) const;
T mk_widen(T const& t1, T const& t2) const override;
virtual T mk_unite(T const& t1, T const& t2) const;
T mk_unite(T const& t1, T const& t2) const override;
virtual T mk_eq(union_find<> const& old_eqs, union_find<> const& new_eqs, T const& t) const;
T mk_eq(union_find<> const& old_eqs, union_find<> const& new_eqs, T const& t) const override;
virtual void mk_rename_elem(T& i, unsigned col_cnt, unsigned const* cycle);
void mk_rename_elem(T& i, unsigned col_cnt, unsigned const* cycle) override;
virtual bool is_subset_of(T const& t1, T const& t2) const;
bool is_subset_of(T const& t1, T const& t2) const override;
virtual bool is_full(T const& t) const;
bool is_full(T const& t) const override;
virtual bool is_empty(unsigned idx, T const& t) const;
bool is_empty(unsigned idx, T const& t) const override;
virtual void display_index(unsigned idx, T const& t, std::ostream& out) const;
void display_index(unsigned idx, T const& t, std::ostream& out) const override;
void normalize(T const& src, T& dst) const;

View file

@ -40,12 +40,12 @@ namespace datalog {
table_base& check_table_plugin::checker(table_base& r) { return *get(r).m_checker; }
table_base const& check_table_plugin::checker(table_base const& r) { return *get(r).m_checker; }
table_base* check_table_plugin::checker(table_base* r) { return r?(get(*r).m_checker):0; }
table_base const* check_table_plugin::checker(table_base const* r) { return r?(get(*r).m_checker):0; }
table_base* check_table_plugin::checker(table_base* r) { return r?(get(*r).m_checker):nullptr; }
table_base const* check_table_plugin::checker(table_base const* r) { return r?(get(*r).m_checker):nullptr; }
table_base& check_table_plugin::tocheck(table_base& r) { return *get(r).m_tocheck; }
table_base const& check_table_plugin::tocheck(table_base const& r) { return *get(r).m_tocheck; }
table_base* check_table_plugin::tocheck(table_base* r) { return r?(get(*r).m_tocheck):0; }
table_base const* check_table_plugin::tocheck(table_base const* r) { return r?(get(*r).m_tocheck):0; }
table_base* check_table_plugin::tocheck(table_base* r) { return r?(get(*r).m_tocheck):nullptr; }
table_base const* check_table_plugin::tocheck(table_base const* r) { return r?(get(*r).m_tocheck):nullptr; }
table_base * check_table_plugin::mk_empty(const table_signature & s) {
IF_VERBOSE(1, verbose_stream() << __FUNCTION__ << "\n";);
@ -65,7 +65,7 @@ namespace datalog {
m_checker = p.get_manager().mk_join_fn(checker(t1), checker(t2), col_cnt, cols1, cols2);
}
virtual table_base* operator()(const table_base & t1, const table_base & t2) {
table_base* operator()(const table_base & t1, const table_base & t2) override {
IF_VERBOSE(1, verbose_stream() << __FUNCTION__ << "\n";);
table_base* ttocheck = (*m_tocheck)(tocheck(t1), tocheck(t2));
table_base* tchecker = (*m_checker)(checker(t1), checker(t2));
@ -77,7 +77,7 @@ namespace datalog {
table_join_fn * check_table_plugin::mk_join_fn(const table_base & t1, const table_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) {
if (!check_kind(t1) || !check_kind(t2)) {
return 0;
return nullptr;
}
return alloc(join_fn, *this, t1, t2, col_cnt, cols1, cols2);
}
@ -93,7 +93,7 @@ namespace datalog {
m_checker = p.get_manager().mk_join_project_fn(checker(t1), checker(t2), col_cnt, cols1, cols2, removed_col_cnt, removed_cols);
}
virtual table_base* operator()(const table_base & t1, const table_base & t2) {
table_base* operator()(const table_base & t1, const table_base & t2) override {
table_base* ttocheck = (*m_tocheck)(tocheck(t1), tocheck(t2));
table_base* tchecker = (*m_checker)(checker(t1), checker(t2));
check_table* result = alloc(check_table, get(t1).get_plugin(), ttocheck->get_signature(), ttocheck, tchecker);
@ -105,7 +105,7 @@ namespace datalog {
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2, unsigned removed_col_cnt,
const unsigned * removed_cols) {
if (!check_kind(t1) || !check_kind(t2)) {
return 0;
return nullptr;
}
return alloc(join_project_fn, *this, t1, t2, col_cnt, cols1, cols2, removed_col_cnt, removed_cols);
}
@ -119,7 +119,7 @@ namespace datalog {
m_checker = p.get_manager().mk_union_fn(checker(tgt), checker(src), checker(delta));
}
virtual void operator()(table_base& tgt, const table_base& src, table_base* delta) {
void operator()(table_base& tgt, const table_base& src, table_base* delta) override {
IF_VERBOSE(1, verbose_stream() << __FUNCTION__ << "\n";);
(*m_tocheck)(tocheck(tgt), tocheck(src), tocheck(delta));
(*m_checker)(checker(tgt), checker(src), checker(delta));
@ -132,7 +132,7 @@ namespace datalog {
table_union_fn * check_table_plugin::mk_union_fn(const table_base & tgt, const table_base & src, const table_base * delta) {
if (!check_kind(tgt) || !check_kind(src) || (delta && !check_kind(*delta))) {
return 0;
return nullptr;
}
return alloc(union_fn, *this, tgt, src, delta);
@ -147,7 +147,7 @@ namespace datalog {
m_tocheck = p.get_manager().mk_project_fn(tocheck(t), col_cnt, removed_cols);
}
table_base* operator()(table_base const& src) {
table_base* operator()(table_base const& src) override {
table_base* tchecker = (*m_checker)(checker(src));
table_base* ttocheck = (*m_tocheck)(tocheck(src));
check_table* result = alloc(check_table, get(src).get_plugin(), tchecker->get_signature(), ttocheck, tchecker);
@ -157,7 +157,7 @@ namespace datalog {
table_transformer_fn * check_table_plugin::mk_project_fn(const table_base & t, unsigned col_cnt, const unsigned * removed_cols) {
if (!check_kind(t)) {
return 0;
return nullptr;
}
return alloc(project_fn, *this, t, col_cnt, removed_cols);
}
@ -171,7 +171,7 @@ namespace datalog {
m_tocheck = p.get_manager().mk_select_equal_and_project_fn(tocheck(t), value, col);
}
table_base* operator()(table_base const& src) {
table_base* operator()(table_base const& src) override {
table_base* tchecker = (*m_checker)(checker(src));
table_base* ttocheck = (*m_tocheck)(tocheck(src));
check_table* result = alloc(check_table, get(src).get_plugin(), tchecker->get_signature(), ttocheck, tchecker);
@ -182,7 +182,7 @@ namespace datalog {
table_transformer_fn * check_table_plugin::mk_select_equal_and_project_fn(const table_base & t,
const table_element & value, unsigned col) {
if (!check_kind(t)) {
return 0;
return nullptr;
}
return alloc(select_equal_and_project_fn, *this, t, value, col);
}
@ -196,7 +196,7 @@ namespace datalog {
m_tocheck = p.get_manager().mk_rename_fn(tocheck(t), cycle_len, cycle);
}
table_base* operator()(table_base const& src) {
table_base* operator()(table_base const& src) override {
IF_VERBOSE(1, verbose_stream() << __FUNCTION__ << "\n";);
table_base* tchecker = (*m_checker)(checker(src));
table_base* ttocheck = (*m_tocheck)(tocheck(src));
@ -207,7 +207,7 @@ namespace datalog {
table_transformer_fn * check_table_plugin::mk_rename_fn(const table_base & t, unsigned len, const unsigned * cycle) {
if (!check_kind(t)) {
return 0;
return nullptr;
}
return alloc(rename_fn, *this, t, len, cycle);
}
@ -222,7 +222,7 @@ namespace datalog {
m_tocheck = p.get_manager().mk_filter_identical_fn(tocheck(t), cnt, cols);
}
void operator()(table_base & t) {
void operator()(table_base & t) override {
(*m_checker)(checker(t));
(*m_tocheck)(tocheck(t));
get(t).well_formed();
@ -234,7 +234,7 @@ namespace datalog {
if (check_kind(t)) {
return alloc(filter_identical_fn, *this, t, col_cnt, identical_cols);
}
return 0;
return nullptr;
}
class check_table_plugin::filter_equal_fn : public table_mutator_fn {
@ -247,7 +247,7 @@ namespace datalog {
m_tocheck = p.get_manager().mk_filter_equal_fn(tocheck(t), v, col);
}
virtual void operator()(table_base& src) {
void operator()(table_base& src) override {
(*m_checker)(checker(src));
(*m_tocheck)(tocheck(src));
get(src).well_formed();
@ -258,7 +258,7 @@ namespace datalog {
if (check_kind(t)) {
return alloc(filter_equal_fn, *this, t, value, col);
}
return 0;
return nullptr;
}
class check_table_plugin::filter_interpreted_fn : public table_mutator_fn {
@ -271,7 +271,7 @@ namespace datalog {
m_tocheck = p.get_manager().mk_filter_interpreted_fn(tocheck(t), condition);
}
virtual void operator()(table_base& src) {
void operator()(table_base& src) override {
(*m_checker)(checker(src));
(*m_tocheck)(tocheck(src));
get(src).well_formed();
@ -282,7 +282,7 @@ namespace datalog {
if (check_kind(t)) {
return alloc(filter_interpreted_fn, *this, t, condition);
}
return 0;
return nullptr;
}
class check_table_plugin::filter_interpreted_and_project_fn : public table_transformer_fn {
@ -296,7 +296,7 @@ namespace datalog {
m_tocheck = p.get_manager().mk_filter_interpreted_and_project_fn(tocheck(t), condition, removed_col_cnt, removed_cols);
}
table_base* operator()(table_base const& src) {
table_base* operator()(table_base const& src) override {
table_base* tchecker = (*m_checker)(checker(src));
table_base* ttocheck = (*m_tocheck)(tocheck(src));
check_table* result = alloc(check_table, get(src).get_plugin(), ttocheck->get_signature(), ttocheck, tchecker);
@ -309,7 +309,7 @@ namespace datalog {
if (check_kind(t)) {
return alloc(filter_interpreted_and_project_fn, *this, t, condition, removed_col_cnt, removed_cols);
}
return 0;
return nullptr;
}
class check_table_plugin::filter_by_negation_fn : public table_intersection_filter_fn {
@ -325,7 +325,7 @@ namespace datalog {
m_tocheck = p.get_manager().mk_filter_by_negation_fn(tocheck(t), tocheck(negated_obj), joined_col_cnt, t_cols, negated_cols);
}
virtual void operator()(table_base& src, table_base const& negated_obj) {
void operator()(table_base& src, table_base const& negated_obj) override {
IF_VERBOSE(1, verbose_stream() << __FUNCTION__ << "\n";);
(*m_checker)(checker(src), checker(negated_obj));
(*m_tocheck)(tocheck(src), tocheck(negated_obj));
@ -340,7 +340,7 @@ namespace datalog {
if (check_kind(t) && check_kind(negated_obj)) {
return alloc(filter_by_negation_fn, *this, t, negated_obj, joined_col_cnt, t_cols, negated_cols);
}
return 0;
return nullptr;
}
// ------------------

View file

@ -53,34 +53,34 @@ namespace datalog {
m_checker(*manager.get_table_plugin(checker)),
m_tocheck(*manager.get_table_plugin(tocheck)), m_count(0) {}
virtual table_base * mk_empty(const table_signature & s);
table_base * mk_empty(const table_signature & s) override;
virtual table_join_fn * mk_join_fn(const table_base & t1, const table_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2);
virtual table_join_fn * mk_join_project_fn(const table_base & t1, const table_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2, unsigned removed_col_cnt,
const unsigned * removed_cols);
virtual table_union_fn * mk_union_fn(const table_base & tgt, const table_base & src,
const table_base * delta);
virtual table_transformer_fn * mk_project_fn(const table_base & t, unsigned col_cnt,
const unsigned * removed_cols);
virtual table_transformer_fn * mk_select_equal_and_project_fn(const table_base & t,
const table_element & value, unsigned col);
virtual table_transformer_fn * mk_rename_fn(const table_base & t, unsigned permutation_cycle_len,
const unsigned * permutation_cycle);
virtual table_mutator_fn * mk_filter_identical_fn(const table_base & t, unsigned col_cnt,
const unsigned * identical_cols);
virtual table_mutator_fn * mk_filter_equal_fn(const table_base & t, const table_element & value,
unsigned col);
virtual table_mutator_fn * mk_filter_interpreted_fn(const table_base & t, app * condition);
virtual table_transformer_fn * mk_filter_interpreted_and_project_fn(const table_base & t,
app * condition, unsigned removed_col_cnt, const unsigned * removed_cols);
virtual table_intersection_filter_fn * mk_filter_by_negation_fn(
const table_base & t,
const table_base & negated_obj, unsigned joined_col_cnt,
const unsigned * t_cols, const unsigned * negated_cols);
table_join_fn * mk_join_fn(const table_base & t1, const table_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) override;
table_join_fn * mk_join_project_fn(const table_base & t1, const table_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2, unsigned removed_col_cnt,
const unsigned * removed_cols) override;
table_union_fn * mk_union_fn(const table_base & tgt, const table_base & src,
const table_base * delta) override;
table_transformer_fn * mk_project_fn(const table_base & t, unsigned col_cnt,
const unsigned * removed_cols) override;
table_transformer_fn * mk_select_equal_and_project_fn(const table_base & t,
const table_element & value, unsigned col) override;
table_transformer_fn * mk_rename_fn(const table_base & t, unsigned permutation_cycle_len,
const unsigned * permutation_cycle) override;
table_mutator_fn * mk_filter_identical_fn(const table_base & t, unsigned col_cnt,
const unsigned * identical_cols) override;
table_mutator_fn * mk_filter_equal_fn(const table_base & t, const table_element & value,
unsigned col) override;
table_mutator_fn * mk_filter_interpreted_fn(const table_base & t, app * condition) override;
table_transformer_fn * mk_filter_interpreted_and_project_fn(const table_base & t,
app * condition, unsigned removed_col_cnt, const unsigned * removed_cols) override;
table_intersection_filter_fn * mk_filter_by_negation_fn(
const table_base & t,
const table_base & negated_obj, unsigned joined_col_cnt,
const unsigned * t_cols, const unsigned * negated_cols) override;
virtual bool can_handle_signature(table_signature const& s);
bool can_handle_signature(table_signature const& s) override;
private:
static check_table& get(table_base& r);
@ -106,7 +106,7 @@ namespace datalog {
check_table(check_table_plugin & p, const table_signature & sig);
check_table(check_table_plugin & p, const table_signature & sig, table_base* tocheck, table_base* checker);
virtual ~check_table();
~check_table() override;
bool well_formed() const;
@ -116,18 +116,18 @@ namespace datalog {
return static_cast<check_table_plugin &>(table_base::get_plugin());
}
virtual bool empty() const;
virtual void add_fact(const table_fact & f);
virtual void remove_fact(const table_element* fact);
virtual bool contains_fact(const table_fact & f) const;
virtual table_base * complement(func_decl* p, const table_element * func_columns = 0) const;
virtual table_base * clone() const;
bool empty() const override;
void add_fact(const table_fact & f) override;
void remove_fact(const table_element* fact) override;
bool contains_fact(const table_fact & f) const override;
table_base * complement(func_decl* p, const table_element * func_columns = nullptr) const override;
table_base * clone() const override;
virtual iterator begin() const { SASSERT(well_formed()); return m_tocheck->begin(); }
virtual iterator end() const { return m_tocheck->end(); }
iterator begin() const override { SASSERT(well_formed()); return m_tocheck->begin(); }
iterator end() const override { return m_tocheck->end(); }
virtual unsigned get_size_estimate_rows() const { return m_tocheck->get_size_estimate_rows(); }
virtual unsigned get_size_estimate_bytes() const { return m_tocheck->get_size_estimate_bytes(); }
unsigned get_size_estimate_rows() const override { return m_tocheck->get_size_estimate_rows(); }
unsigned get_size_estimate_bytes() const override { return m_tocheck->get_size_estimate_bytes(); }
};
};

View file

@ -1120,7 +1120,7 @@ namespace datalog {
//and clear local deltas
make_inloop_delta_transition(global_head_deltas, global_tail_deltas, local_deltas, *loop_body);
loop_body->set_observer(0);
loop_body->set_observer(nullptr);
acc.push_back(instruction::mk_while_loop(loop_control_regs.size(),
loop_control_regs.c_ptr(), loop_body));
}
@ -1316,7 +1316,7 @@ namespace datalog {
pred2idx empty_pred2idx_map;
compile_strats(m_rule_set.get_stratifier(), static_cast<pred2idx *>(0),
compile_strats(m_rule_set.get_stratifier(), static_cast<pred2idx *>(nullptr),
empty_pred2idx_map, true, execution_code);
@ -1331,7 +1331,7 @@ namespace datalog {
termination_code.push_back(instruction::mk_store(m_context.get_manager(), pred, reg));
}
acc.set_observer(0);
acc.set_observer(nullptr);
TRACE("dl", execution_code.display(execution_context(m_context), tout););
}

View file

@ -60,7 +60,7 @@ namespace datalog {
ACK_UNBOUND_VAR(var_index) - encodes that the column contains a variable that
is unbound (by the corresponding rule body),
var_index is the de-Brujin index (var->get_idx())
var_index is the de-Bruijn index (var->get_idx())
of the variable associated with the column.
ACK_CONSTANT(constant) - encodes that the column contains the constant.
@ -93,11 +93,11 @@ namespace datalog {
compiler & m_parent;
rule * m_current;
public:
instruction_observer(compiler & parent) : m_parent(parent), m_current(0) {}
instruction_observer(compiler & parent) : m_parent(parent), m_current(nullptr) {}
void start_rule(rule * r) { SASSERT(!m_current); m_current=r; }
void finish_rule() { m_current = 0; }
virtual void notify(instruction * i) {
void finish_rule() { m_current = nullptr; }
void notify(instruction * i) override {
if(m_current) {
i->set_accounting_parent_object(m_parent.m_context, m_current);
}

View file

@ -46,7 +46,7 @@ namespace datalog {
args.push_back(f[i]);
}
if (!fn.get()) {
fn = m.mk_func_decl(fid, k, 0, 0, args.size(), args.c_ptr());
fn = m.mk_func_decl(fid, k, 0, nullptr, args.size(), args.c_ptr());
}
if (destructive) {
get_plugin().reduce_assign(fn, args.size(), args.c_ptr(), 1, args.c_ptr());
@ -63,7 +63,7 @@ namespace datalog {
expr_ref res(m);
if (!m_is_empty_fn.get()) {
family_id fid = get_plugin().get_family_id();
const_cast<func_decl_ref&>(m_is_empty_fn) = m.mk_func_decl(fid, OP_RA_IS_EMPTY, 0, 0, 1, &r);
const_cast<func_decl_ref&>(m_is_empty_fn) = m.mk_func_decl(fid, OP_RA_IS_EMPTY, 0, nullptr, 1, &r);
}
get_plugin().reduce(m_is_empty_fn, 1, &r, res);
return m.is_true(res);
@ -86,7 +86,7 @@ namespace datalog {
expr* rel = m_rel.get();
expr_ref res(m.mk_fresh_const("T", m.get_sort(rel)), m);
expr* rel_out = res.get();
func_decl_ref fn(m.mk_func_decl(fid, OP_RA_CLONE,0,0, 1, &rel), m);
func_decl_ref fn(m.mk_func_decl(fid, OP_RA_CLONE,0,nullptr, 1, &rel), m);
get_plugin().reduce_assign(fn, 1, &rel, 1, &rel_out);
return alloc(external_relation, get_plugin(), get_signature(), res);
}
@ -96,7 +96,7 @@ namespace datalog {
family_id fid = get_plugin().get_family_id();
expr_ref res(m);
expr* rel = m_rel;
func_decl_ref fn(m.mk_func_decl(fid, OP_RA_COMPLEMENT,0,0, 1, &rel), m);
func_decl_ref fn(m.mk_func_decl(fid, OP_RA_COMPLEMENT,0,nullptr, 1, &rel), m);
get_plugin().reduce(fn, 1, &rel, res);
return alloc(external_relation, get_plugin(), get_signature(), res);
}
@ -140,8 +140,8 @@ namespace datalog {
family_id fid = get_family_id();
expr_ref e(m.mk_fresh_const("T", r_sort), m);
expr* args[1] = { e.get() };
func_decl_ref empty_decl(m.mk_func_decl(fid, OP_RA_EMPTY, 1, &param, 0, (sort*const*)0), m);
reduce_assign(empty_decl, 0, 0, 1, args);
func_decl_ref empty_decl(m.mk_func_decl(fid, OP_RA_EMPTY, 1, &param, 0, (sort*const*)nullptr), m);
reduce_assign(empty_decl, 0, nullptr, 1, args);
return alloc(external_relation, *this, s, e);
}
@ -195,7 +195,7 @@ namespace datalog {
m_join_fn = m.mk_func_decl(fid, OP_RA_JOIN, params.size(), params.c_ptr(), 2, domain);
}
virtual relation_base * operator()(const relation_base & r1, const relation_base & r2) {
relation_base * operator()(const relation_base & r1, const relation_base & r2) override {
expr_ref res(m_plugin.get_ast_manager());
m_args[0] = get(r1).get_relation();
m_args[1] = get(r2).get_relation();
@ -207,7 +207,7 @@ namespace datalog {
relation_join_fn * external_relation_plugin::mk_join_fn(const relation_base & r1, const relation_base & r2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) {
if (!check_kind(r1) || !check_kind(r2)) {
return 0;
return nullptr;
}
return alloc(join_fn, *this, r1.get_signature(), r2.get_signature() , col_cnt, cols1, cols2);
}
@ -231,7 +231,7 @@ namespace datalog {
m_project_fn = m.mk_func_decl(fid, OP_RA_PROJECT, params.size(), params.c_ptr(), 1, &relation_sort);
}
virtual relation_base * operator()(const relation_base & r) {
relation_base * operator()(const relation_base & r) override {
expr_ref res(m_plugin.get_ast_manager());
expr* rel = get(r).get_relation();
m_plugin.reduce(m_project_fn, 1, &rel, res);
@ -265,7 +265,7 @@ namespace datalog {
m_rename_fn = m.mk_func_decl(fid, OP_RA_RENAME, params.size(), params.c_ptr(), 1, &relation_sort);
}
virtual relation_base * operator()(const relation_base & r) {
relation_base * operator()(const relation_base & r) override {
expr* rel = get(r).get_relation();
expr_ref res(m_plugin.get_ast_manager());
m_args[0] = rel;
@ -277,7 +277,7 @@ namespace datalog {
relation_transformer_fn * external_relation_plugin::mk_rename_fn(const relation_base & r,
unsigned cycle_len, const unsigned * permutation_cycle) {
if(!check_kind(r)) {
return 0;
return nullptr;
}
return alloc(rename_fn, *this, get(r).get_sort(), r.get_signature(), cycle_len, permutation_cycle);
}
@ -295,10 +295,10 @@ namespace datalog {
m_union_fn(p.get_ast_manager()) {
ast_manager& m = p.get_ast_manager();
sort* domain[2] = { relation_sort, relation_sort };
m_union_fn = m.mk_func_decl(p.get_family_id(), k, 0, 0, 2, domain);
m_union_fn = m.mk_func_decl(p.get_family_id(), k, 0, nullptr, 2, domain);
}
virtual void operator()(relation_base & r, const relation_base & src, relation_base * delta) {
void operator()(relation_base & r, const relation_base & src, relation_base * delta) override {
ast_manager& m = m_plugin.get_ast_manager();
expr_ref_vector res(m);
m_args[0] = get(r).get_relation();
@ -316,7 +316,7 @@ namespace datalog {
relation_union_fn * external_relation_plugin::mk_union_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta) {
if (!check_kind(tgt) || !check_kind(src) || (delta && !check_kind(*delta))) {
return 0;
return nullptr;
}
return alloc(union_fn, *this, OP_RA_UNION, get(src).get_sort());
}
@ -324,7 +324,7 @@ namespace datalog {
relation_union_fn * external_relation_plugin::mk_widen_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta) {
if (!check_kind(tgt) || !check_kind(src) || (delta && !check_kind(*delta))) {
return 0;
return nullptr;
}
return alloc(union_fn, *this, OP_RA_WIDEN, get(src).get_sort());
}
@ -342,7 +342,7 @@ namespace datalog {
SASSERT(p.get_ast_manager().is_bool(condition));
}
virtual void operator()(relation_base & r) {
void operator()(relation_base & r) override {
SASSERT(m_plugin.check_kind(r));
expr* arg = get(r).get_relation();
m_plugin.reduce_assign(m_filter_fn, 1, &arg, 1, &arg);
@ -351,7 +351,7 @@ namespace datalog {
relation_mutator_fn * external_relation_plugin::mk_filter_interpreted_fn(const relation_base & r, app * condition) {
if(!check_kind(r)) {
return 0;
return nullptr;
}
return alloc(filter_interpreted_fn, *this, get(r).get_sort(), condition);
}
@ -359,7 +359,7 @@ namespace datalog {
relation_mutator_fn * external_relation_plugin::mk_filter_equal_fn(const relation_base & r,
const relation_element & value, unsigned col) {
if(!check_kind(r)) {
return 0;
return nullptr;
}
ast_manager& m = get_ast_manager();
app_ref condition(m);
@ -396,7 +396,7 @@ namespace datalog {
}
}
virtual void operator()(relation_base & r) {
void operator()(relation_base & r) override {
expr* r0 = get(r).get_relation();
for (unsigned i = 0; i < m_filter_fn.size(); ++i) {
m_plugin.reduce_assign(m_filter_fn[i].get(), 1, &r0, 1, &r0);
@ -407,7 +407,7 @@ namespace datalog {
relation_mutator_fn * external_relation_plugin::mk_filter_identical_fn(const relation_base & r,
unsigned col_cnt, const unsigned * identical_cols) {
if (!check_kind(r)) {
return 0;
return nullptr;
}
return alloc(filter_identical_fn, *this, get(r).get_sort(), col_cnt, identical_cols);
}
@ -436,7 +436,7 @@ namespace datalog {
m_negated_filter_fn = m.mk_func_decl(fid, OP_RA_NEGATION_FILTER, params.size(), params.c_ptr(), 2, domain);
}
void operator()(relation_base & t, const relation_base & negated_obj) {
void operator()(relation_base & t, const relation_base & negated_obj) override {
m_args[0] = get(t).get_relation();
m_args[1] = get(negated_obj).get_relation();
m_plugin.reduce_assign(m_negated_filter_fn.get(), 2, m_args, 1, m_args);
@ -447,7 +447,7 @@ namespace datalog {
const relation_base & negated_obj, unsigned joined_col_cnt,
const unsigned * t_cols, const unsigned * negated_cols) {
if (!check_kind(t) || !check_kind(negated_obj)) {
return 0;
return nullptr;
}
return alloc(negation_filter_fn, *this, t, negated_obj, joined_col_cnt, t_cols, negated_cols);
}

View file

@ -54,30 +54,30 @@ namespace datalog {
public:
external_relation_plugin(external_relation_context& ctx, relation_manager & m);
virtual bool can_handle_signature(const relation_signature & s) { return true; }
bool can_handle_signature(const relation_signature & s) override { return true; }
static symbol get_name() { return symbol("external_relation"); }
virtual relation_base * mk_empty(const relation_signature & s);
relation_base * mk_empty(const relation_signature & s) override;
virtual relation_join_fn * mk_join_fn(const relation_base & t1, const relation_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2);
virtual relation_transformer_fn * mk_project_fn(const relation_base & t, unsigned col_cnt,
const unsigned * removed_cols);
virtual relation_transformer_fn * mk_rename_fn(const relation_base & t, unsigned permutation_cycle_len,
const unsigned * permutation_cycle);
virtual relation_union_fn * mk_union_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta);
virtual relation_union_fn * mk_widen_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta);
virtual relation_mutator_fn * mk_filter_identical_fn(const relation_base & t, unsigned col_cnt,
const unsigned * identical_cols);
virtual relation_mutator_fn * mk_filter_equal_fn(const relation_base & t, const relation_element & value,
unsigned col);
virtual relation_mutator_fn * mk_filter_interpreted_fn(const relation_base & t, app * condition);
virtual relation_intersection_filter_fn * mk_filter_by_negation_fn(const relation_base & t,
const relation_base & negated_obj, unsigned joined_col_cnt,
const unsigned * t_cols, const unsigned * negated_cols);
relation_join_fn * mk_join_fn(const relation_base & t1, const relation_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) override;
relation_transformer_fn * mk_project_fn(const relation_base & t, unsigned col_cnt,
const unsigned * removed_cols) override;
relation_transformer_fn * mk_rename_fn(const relation_base & t, unsigned permutation_cycle_len,
const unsigned * permutation_cycle) override;
relation_union_fn * mk_union_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta) override;
relation_union_fn * mk_widen_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta) override;
relation_mutator_fn * mk_filter_identical_fn(const relation_base & t, unsigned col_cnt,
const unsigned * identical_cols) override;
relation_mutator_fn * mk_filter_equal_fn(const relation_base & t, const relation_element & value,
unsigned col) override;
relation_mutator_fn * mk_filter_interpreted_fn(const relation_base & t, app * condition) override;
relation_intersection_filter_fn * mk_filter_by_negation_fn(const relation_base & t,
const relation_base & negated_obj, unsigned joined_col_cnt,
const unsigned * t_cols, const unsigned * negated_cols) override;
private:
@ -123,28 +123,28 @@ namespace datalog {
void mk_accessor(decl_kind k, func_decl_ref& fn, const relation_fact& f, bool destructive, expr_ref& res) const;
external_relation(external_relation_plugin & p, const relation_signature & s, expr* r);
virtual ~external_relation();
~external_relation() override;
public:
external_relation_plugin & get_plugin() const;
virtual bool empty() const;
bool empty() const override;
virtual void add_fact(const relation_fact & f);
void add_fact(const relation_fact & f) override;
virtual bool contains_fact(const relation_fact & f) const;
bool contains_fact(const relation_fact & f) const override;
virtual external_relation * clone() const;
external_relation * clone() const override;
virtual external_relation * complement(func_decl*) const;
external_relation * complement(func_decl*) const override;
virtual void display(std::ostream & out) const;
void display(std::ostream & out) const override;
virtual void display_tuples(func_decl & pred, std::ostream & out) const;
void display_tuples(func_decl & pred, std::ostream & out) const override;
expr* get_relation() const { return m_rel.get(); }
virtual void to_formula(expr_ref& fml) const { fml = get_relation(); }
void to_formula(expr_ref& fml) const override { fml = get_relation(); }
};

View file

@ -245,14 +245,14 @@ namespace datalog {
}
finite_product_relation * finite_product_relation_plugin::mk_from_table_relation(const table_relation & r) {
func_decl* pred = 0;
func_decl* pred = nullptr;
const relation_signature & sig = r.get_signature();
const table_base & t = r.get_table();
table_plugin & tplugin = r.get_table().get_plugin();
relation_signature inner_sig; //empty signature for the inner relation
if(!get_inner_plugin().can_handle_signature(inner_sig)) {
return 0;
return nullptr;
}
table_signature idx_singleton_sig;
@ -270,7 +270,7 @@ namespace datalog {
idx_singleton_fact.push_back(0);
idx_singleton->add_fact(idx_singleton_fact);
scoped_ptr<table_join_fn> join_fun = get_manager().mk_join_fn(t, *idx_singleton, 0, 0, 0);
scoped_ptr<table_join_fn> join_fun = get_manager().mk_join_fn(t, *idx_singleton, 0, nullptr, nullptr);
SASSERT(join_fun);
scoped_rel<table_base> res_table = (*join_fun)(t, *idx_singleton);
@ -333,7 +333,7 @@ namespace datalog {
: convenient_relation_join_fn(sig1, sig2, col_cnt, cols1, cols2),
m_plugin(plugin) {}
virtual relation_base * operator()(const relation_base & r1, const relation_base & r2) {
relation_base * operator()(const relation_base & r1, const relation_base & r2) override {
scoped_rel<finite_product_relation> r1_conv;
if(&r1.get_plugin()!=&m_plugin) {
r1_conv = convert(r1);
@ -390,7 +390,7 @@ namespace datalog {
relation_vector & rjoins)
: m_parent(parent), m_r1(r1), m_r2(r2), m_rjoins(rjoins) {}
virtual bool operator()(table_element * func_columns) {
bool operator()(table_element * func_columns) override {
const relation_base & or1 = m_r1.get_inner_rel(func_columns[0]);
const relation_base & or2 = m_r2.get_inner_rel(func_columns[1]);
SASSERT(&or1);
@ -450,7 +450,7 @@ namespace datalog {
return (*m_rjoin_fn)(r1, r2);
}
virtual relation_base * operator()(const relation_base & rb1, const relation_base & rb2) {
relation_base * operator()(const relation_base & rb1, const relation_base & rb2) override {
finite_product_relation_plugin & plugin = get(rb1).get_plugin();
relation_manager & rmgr = plugin.get_manager();
@ -513,7 +513,7 @@ namespace datalog {
return alloc(converting_join_fn, *this, rb1.get_signature(), rb2.get_signature(), col_cnt, cols1,
cols2);
}
return 0;
return nullptr;
}
const finite_product_relation & r1 = get(rb1);
const finite_product_relation & r2 = get(rb2);
@ -565,7 +565,7 @@ namespace datalog {
project_reducer(project_fn & parent, relation_vector & relations)
: m_parent(parent), m_relations(relations) {}
virtual void operator()(table_element * func_columns, const table_element * merged_func_columns) {
void operator()(table_element * func_columns, const table_element * merged_func_columns) override {
relation_base * tgt = m_relations[static_cast<unsigned>(func_columns[0])]->clone();
relation_base & src = *m_relations[static_cast<unsigned>(merged_func_columns[0])];
if(!m_parent.m_inner_rel_union) {
@ -579,7 +579,7 @@ namespace datalog {
}
};
virtual relation_base * operator()(const relation_base & rb) {
relation_base * operator()(const relation_base & rb) override {
const finite_product_relation & r = get(rb);
finite_product_relation_plugin & plugin = r.get_plugin();
const table_base & rtable = r.get_table();
@ -590,7 +590,7 @@ namespace datalog {
unsigned orig_rel_cnt = r.m_others.size();
for(unsigned i=0; i<orig_rel_cnt; i++) {
relation_base * orig_rel = r.m_others[i];
res_relations.push_back(orig_rel ? orig_rel->clone() : 0);
res_relations.push_back(orig_rel ? orig_rel->clone() : nullptr);
}
SASSERT(res_relations.size()==orig_rel_cnt);
@ -608,7 +608,7 @@ namespace datalog {
res_table = (*tproject)(rtable);
}
relation_plugin * res_oplugin = 0;
relation_plugin * res_oplugin = nullptr;
if(!m_removed_rel_cols.empty()) {
unsigned res_rel_cnt = res_relations.size();
@ -651,7 +651,7 @@ namespace datalog {
relation_transformer_fn * finite_product_relation_plugin::mk_project_fn(const relation_base & rb, unsigned col_cnt,
const unsigned * removed_cols) {
if(&rb.get_plugin()!=this) {
return 0;
return nullptr;
}
return alloc(project_fn, get(rb), col_cnt, removed_cols);
}
@ -696,7 +696,7 @@ namespace datalog {
}
virtual relation_base * operator()(const relation_base & rb) {
relation_base * operator()(const relation_base & rb) override {
const finite_product_relation & r = get(rb);
const table_base & rtable = r.get_table();
@ -705,7 +705,7 @@ namespace datalog {
unsigned orig_rel_cnt = r.m_others.size();
for(unsigned i=0; i<orig_rel_cnt; i++) {
relation_base * orig_rel = r.m_others[i];
res_relations.push_back(orig_rel ? orig_rel->clone() : 0);
res_relations.push_back(orig_rel ? orig_rel->clone() : nullptr);
}
if(!m_rel_identity) {
@ -746,7 +746,7 @@ namespace datalog {
unsigned permutation_cycle_len, const unsigned * permutation_cycle) {
if(&rb.get_plugin()!=this) {
return 0;
return nullptr;
}
const finite_product_relation & r = get(rb);
return alloc(rename_fn, r, permutation_cycle_len, permutation_cycle);
@ -771,7 +771,7 @@ namespace datalog {
relation_union_fn & get_inner_rel_union_op(relation_base & r) {
if(!m_rel_union) {
m_rel_union = r.get_manager().mk_union_fn(r, r, m_use_delta ? &r : 0);
m_rel_union = r.get_manager().mk_union_fn(r, r, m_use_delta ? &r : nullptr);
}
return *m_rel_union;
}
@ -795,9 +795,9 @@ namespace datalog {
m_delta_indexes(delta_indexes),
m_delta_rels(delta_rels) {}
virtual ~union_mapper() {}
~union_mapper() override {}
virtual bool operator()(table_element * func_columns) {
bool operator()(table_element * func_columns) override {
relation_base & otgt_orig = m_tgt.get_inner_rel(func_columns[0]);
const relation_base & osrc = m_src.get_inner_rel(func_columns[1]);
@ -838,7 +838,7 @@ namespace datalog {
src_copying_mapper(finite_product_relation & tgt, const finite_product_relation & src)
: m_tgt(tgt), m_src(src) {}
virtual bool operator()(table_element * func_columns) {
bool operator()(table_element * func_columns) override {
const relation_base & osrc = m_src.get_inner_rel(func_columns[0]);
unsigned new_tgt_idx = m_tgt.get_next_rel_idx();
m_tgt.set_inner_rel(new_tgt_idx, osrc.clone());
@ -847,7 +847,7 @@ namespace datalog {
}
};
virtual void operator()(relation_base & tgtb, const relation_base & srcb, relation_base * deltab) {
void operator()(relation_base & tgtb, const relation_base & srcb, relation_base * deltab) override {
finite_product_relation & tgt = get(tgtb);
const finite_product_relation & src0 = get(srcb);
finite_product_relation * delta = get(deltab);
@ -1088,7 +1088,7 @@ namespace datalog {
class finite_product_relation_plugin::converting_union_fn : public relation_union_fn {
scoped_ptr<relation_union_fn> m_tr_union_fun;
public:
virtual void operator()(relation_base & tgtb, const relation_base & srcb, relation_base * deltab) {
void operator()(relation_base & tgtb, const relation_base & srcb, relation_base * deltab) override {
SASSERT(srcb.get_plugin().is_finite_product_relation());
const finite_product_relation & src = get(srcb);
finite_product_relation_plugin & plugin = src.get_plugin();
@ -1104,19 +1104,19 @@ namespace datalog {
relation_union_fn * finite_product_relation_plugin::mk_union_fn(const relation_base & tgtb, const relation_base & srcb,
const relation_base * deltab) {
if(&srcb.get_plugin()!=this) {
return 0;
return nullptr;
}
const finite_product_relation & src = get(srcb);
if(&tgtb.get_plugin()!=this || (deltab && &deltab->get_plugin()!=this) ) {
if(can_convert_to_table_relation(src)) {
return alloc(converting_union_fn);
}
return 0;
return nullptr;
}
const finite_product_relation * delta = get(deltab);
return alloc(union_fn, get(tgtb), delta!=0);
return alloc(union_fn, get(tgtb), delta!=nullptr);
}
@ -1131,7 +1131,7 @@ namespace datalog {
scoped_ptr<relation_mutator_fn> m_tr_filter;
public:
filter_identical_fn(const finite_product_relation & r, unsigned col_cnt, const unsigned * identical_cols)
: m_table_filter(0), m_rel_filter(0), m_tr_filter(0) {
: m_table_filter(nullptr), m_rel_filter(nullptr), m_tr_filter(nullptr) {
finite_product_relation_plugin & plugin = r.get_plugin();
for(unsigned i=0; i<col_cnt; i++) {
unsigned col = identical_cols[i];
@ -1164,7 +1164,7 @@ namespace datalog {
SASSERT(m_rel_filter);
}
virtual void operator()(relation_base & rb) {
void operator()(relation_base & rb) override {
finite_product_relation & r = get(rb);
if(m_table_cols.size()>1) {
@ -1192,7 +1192,7 @@ namespace datalog {
relation_mutator_fn * finite_product_relation_plugin::mk_filter_identical_fn(const relation_base & rb,
unsigned col_cnt, const unsigned * identical_cols) {
if(&rb.get_plugin()!=this) {
return 0;
return nullptr;
}
return alloc(filter_identical_fn, get(rb), col_cnt, identical_cols);
}
@ -1212,7 +1212,7 @@ namespace datalog {
}
}
virtual void operator()(relation_base & rb) {
void operator()(relation_base & rb) override {
finite_product_relation & r = get(rb);
if(m_table_filter) {
@ -1238,7 +1238,7 @@ namespace datalog {
relation_mutator_fn * finite_product_relation_plugin::mk_filter_equal_fn(const relation_base & rb,
const relation_element & value, unsigned col) {
if(&rb.get_plugin()!=this) {
return 0;
return nullptr;
}
return alloc(filter_equal_fn, get(rb), value, col);
}
@ -1339,7 +1339,7 @@ namespace datalog {
}
}
virtual void operator()(relation_base & rb) {
void operator()(relation_base & rb) override {
finite_product_relation & r = get(rb);
table_base & rtable = r.get_table();
table_plugin & tplugin = r.get_table_plugin();
@ -1357,7 +1357,7 @@ namespace datalog {
unsigned rel_cnt = r.m_others.size();
for(unsigned i=0; i<rel_cnt; i++) {
relation_base * inner = r.m_others[i];
if(inner==0) {
if(inner==nullptr) {
continue;
}
if(!m_rel_filter) {
@ -1451,7 +1451,7 @@ namespace datalog {
relation_mutator_fn * finite_product_relation_plugin::mk_filter_interpreted_fn(const relation_base & rb,
app * condition) {
if(&rb.get_plugin()!=this) {
return 0;
return nullptr;
}
return alloc(filter_interpreted_fn, get(rb), condition);
}
@ -1537,7 +1537,7 @@ namespace datalog {
const finite_product_relation & inters)
: m_parent(parent), m_r(r), m_inters(inters) {}
virtual bool operator()(table_element * func_columns) {
bool operator()(table_element * func_columns) override {
relation_base * r_inner = m_r.get_inner_rel(func_columns[0]).clone();
const relation_base & inters_inner = m_inters.get_inner_rel(func_columns[1]);
@ -1557,7 +1557,7 @@ namespace datalog {
};
virtual void operator()(relation_base & rb, const relation_base & negb) {
void operator()(relation_base & rb, const relation_base & negb) override {
finite_product_relation & r = get(rb);
const finite_product_relation & neg = get(negb);
@ -1626,7 +1626,7 @@ namespace datalog {
const relation_base & negb, unsigned joined_col_cnt,
const unsigned * r_cols, const unsigned * negated_cols) {
if(&rb.get_plugin()!=this || &negb.get_plugin()!=this) {
return 0;
return nullptr;
}
return alloc(negation_filter_fn, get(rb), get(negb), joined_col_cnt, r_cols, negated_cols);
@ -1662,7 +1662,7 @@ namespace datalog {
}
}
virtual void operator()(relation_base & rb) {
void operator()(relation_base & rb) override {
finite_product_relation & r = get(rb);
finite_product_relation_plugin & plugin = r.get_plugin();
table_plugin & tplugin = r.get_table_plugin();
@ -1852,8 +1852,8 @@ namespace datalog {
m_others.swap(r.m_others);
m_available_rel_indexes.swap(r.m_available_rel_indexes);
std::swap(m_full_rel_idx,r.m_full_rel_idx);
m_live_rel_collection_project=0;
m_empty_rel_removal_filter=0;
m_live_rel_collection_project=nullptr;
m_empty_rel_removal_filter=nullptr;
relation_base::swap(r0);
}
@ -1896,7 +1896,7 @@ namespace datalog {
unsigned finite_product_relation::get_full_rel_idx() {
if(m_full_rel_idx==UINT_MAX) {
m_full_rel_idx = get_next_rel_idx();
relation_base * full_other = mk_full_inner(0);
relation_base * full_other = mk_full_inner(nullptr);
m_others[m_full_rel_idx] = full_other;
}
return m_full_rel_idx;
@ -1924,7 +1924,7 @@ namespace datalog {
}
}
void finite_product_relation::extract_table_fact(const relation_fact rf, table_fact & tf) const {
void finite_product_relation::extract_table_fact(const relation_fact & rf, table_fact & tf) const {
const relation_signature & sig = get_signature();
relation_manager & rmgr = get_manager();
@ -1940,7 +1940,7 @@ namespace datalog {
tf.push_back(0);
}
void finite_product_relation::extract_other_fact(const relation_fact rf, relation_fact & of) const {
void finite_product_relation::extract_other_fact(const relation_fact & rf, relation_fact & of) const {
of.reset();
unsigned o_sz = m_other_sig.size();
for(unsigned i=0; i<o_sz; i++) {
@ -2027,9 +2027,9 @@ namespace datalog {
table_element full_rel_idx = get_full_rel_idx();
scoped_rel<table_base> complement_table = m_table->complement(p, &full_rel_idx);
scoped_ptr<table_union_fn> u_fn = get_manager().mk_union_fn(*m_table, *complement_table, 0);
scoped_ptr<table_union_fn> u_fn = get_manager().mk_union_fn(*m_table, *complement_table, nullptr);
SASSERT(u_fn);
(*u_fn)(*m_table, *complement_table, 0);
(*u_fn)(*m_table, *complement_table, nullptr);
}
finite_product_relation * finite_product_relation::complement(func_decl* p) const {
@ -2043,7 +2043,7 @@ namespace datalog {
public:
live_rel_collection_reducer(idx_set & accumulator) : m_accumulator(accumulator) {}
virtual void operator()(table_element * func_columns, const table_element * merged_func_columns) {
void operator()(table_element * func_columns, const table_element * merged_func_columns) override {
m_accumulator.insert(static_cast<unsigned>(merged_func_columns[0]));
}
};

View file

@ -93,23 +93,23 @@ namespace datalog {
finite_product_relation_plugin(relation_plugin & inner_plugin, relation_manager & manager);
virtual void initialize(family_id fid);
void initialize(family_id fid) override;
relation_plugin & get_inner_plugin() const { return m_inner_plugin; }
virtual bool can_handle_signature(const relation_signature & s);
bool can_handle_signature(const relation_signature & s) override;
virtual relation_base * mk_empty(const relation_signature & s);
relation_base * mk_empty(const relation_signature & s) override;
/**
\c inner_kind==null_family_id means we don't care about the kind of the inner relation
*/
finite_product_relation * mk_empty(const relation_signature & s, const bool * table_columns,
family_id inner_kind=null_family_id);
finite_product_relation * mk_empty(const finite_product_relation & original);
virtual relation_base * mk_empty(const relation_base & original);
virtual relation_base * mk_empty(const relation_signature & s, family_id kind);
relation_base * mk_empty(const relation_base & original) override;
relation_base * mk_empty(const relation_signature & s, family_id kind) override;
virtual relation_base * mk_full(func_decl* p, const relation_signature & s);
relation_base * mk_full(func_decl* p, const relation_signature & s) override;
/**
\brief Return true if \c r can be converted to \c finite_product_relation_plugin either
@ -127,22 +127,22 @@ namespace datalog {
table_relation * to_table_relation(const finite_product_relation & r);
protected:
virtual relation_join_fn * mk_join_fn(const relation_base & t1, const relation_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2);
virtual relation_transformer_fn * mk_project_fn(const relation_base & t, unsigned col_cnt,
const unsigned * removed_cols);
virtual relation_transformer_fn * mk_rename_fn(const relation_base & t, unsigned permutation_cycle_len,
const unsigned * permutation_cycle);
virtual relation_union_fn * mk_union_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta);
virtual relation_mutator_fn * mk_filter_identical_fn(const relation_base & t, unsigned col_cnt,
const unsigned * identical_cols);
virtual relation_mutator_fn * mk_filter_equal_fn(const relation_base & t, const relation_element & value,
unsigned col);
virtual relation_mutator_fn * mk_filter_interpreted_fn(const relation_base & t, app * condition);
virtual relation_intersection_filter_fn * mk_filter_by_negation_fn(const relation_base & t,
const relation_base & negated_obj, unsigned joined_col_cnt,
const unsigned * t_cols, const unsigned * negated_cols);
relation_join_fn * mk_join_fn(const relation_base & t1, const relation_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) override;
relation_transformer_fn * mk_project_fn(const relation_base & t, unsigned col_cnt,
const unsigned * removed_cols) override;
relation_transformer_fn * mk_rename_fn(const relation_base & t, unsigned permutation_cycle_len,
const unsigned * permutation_cycle) override;
relation_union_fn * mk_union_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta) override;
relation_mutator_fn * mk_filter_identical_fn(const relation_base & t, unsigned col_cnt,
const unsigned * identical_cols) override;
relation_mutator_fn * mk_filter_equal_fn(const relation_base & t, const relation_element & value,
unsigned col) override;
relation_mutator_fn * mk_filter_interpreted_fn(const relation_base & t, app * condition) override;
relation_intersection_filter_fn * mk_filter_by_negation_fn(const relation_base & t,
const relation_base & negated_obj, unsigned joined_col_cnt,
const unsigned * t_cols, const unsigned * negated_cols) override;
private:
/**
@ -281,11 +281,11 @@ namespace datalog {
\brief Extract the values of table non-functional columns from the relation fact.
The value of the functional column which determines index of the inner relation is undefined.
*/
void extract_table_fact(const relation_fact rf, table_fact & tf) const;
void extract_table_fact(const relation_fact & rf, table_fact & tf) const;
/**
\brief Extract the values of the inner relation columns from the relation fact.
*/
void extract_other_fact(const relation_fact rf, relation_fact & of) const;
void extract_other_fact(const relation_fact & rf, relation_fact & of) const;
relation_base * mk_empty_inner();
relation_base * mk_full_inner(func_decl* pred);
@ -309,7 +309,7 @@ namespace datalog {
bool try_modify_specification(const bool * table_cols);
virtual bool can_swap(const relation_base & r) const
bool can_swap(const relation_base & r) const override
{ return &get_plugin()==&r.get_plugin(); }
/**
@ -317,7 +317,7 @@ namespace datalog {
Both relations must come from the same plugin and be of the same signature.
*/
virtual void swap(relation_base & r);
void swap(relation_base & r) override;
/**
\brief Create a \c finite_product_relation object.
@ -325,7 +325,7 @@ namespace datalog {
finite_product_relation(finite_product_relation_plugin & p, const relation_signature & s,
const bool * table_columns, table_plugin & tplugin, relation_plugin & oplugin, family_id other_kind);
finite_product_relation(const finite_product_relation & r);
virtual ~finite_product_relation();
~finite_product_relation() override;
public:
context & get_context() const;
finite_product_relation_plugin & get_plugin() const {
@ -342,22 +342,22 @@ namespace datalog {
/**
The function calls garbage_collect, so the internal state may change when it is called.
*/
virtual bool empty() const;
void reset() { m_table->reset(); garbage_collect(false); }
bool empty() const override;
void reset() override { m_table->reset(); garbage_collect(false); }
virtual void add_fact(const relation_fact & f);
virtual bool contains_fact(const relation_fact & f) const;
void add_fact(const relation_fact & f) override;
bool contains_fact(const relation_fact & f) const override;
virtual finite_product_relation * clone() const;
virtual finite_product_relation * complement(func_decl* p) const;
finite_product_relation * clone() const override;
finite_product_relation * complement(func_decl* p) const override;
virtual void display(std::ostream & out) const;
virtual void display_tuples(func_decl & pred, std::ostream & out) const;
void display(std::ostream & out) const override;
void display_tuples(func_decl & pred, std::ostream & out) const override;
virtual unsigned get_size_estimate_rows() const { return m_table->get_size_estimate_rows(); }
virtual unsigned get_size_estimate_bytes() const { return m_table->get_size_estimate_bytes(); }
unsigned get_size_estimate_rows() const override { return m_table->get_size_estimate_rows(); }
unsigned get_size_estimate_bytes() const override { return m_table->get_size_estimate_bytes(); }
virtual void to_formula(expr_ref& fml) const;
void to_formula(expr_ref& fml) const override;
};
};

View file

@ -36,7 +36,7 @@ namespace datalog {
execution_context::execution_context(context & context)
: m_context(context),
m_stopwatch(0),
m_stopwatch(nullptr),
m_timelimit_ms(0) {}
execution_context::~execution_context() {
@ -168,7 +168,7 @@ namespace datalog {
}
void instruction::display_indented(execution_context const & _ctx, std::ostream & out, std::string indentation) const {
void instruction::display_indented(execution_context const & _ctx, std::ostream & out, const std::string & indentation) const {
out << indentation;
rel_context const& ctx = _ctx.get_rel_context();
display_head_impl(_ctx, out);
@ -190,9 +190,9 @@ namespace datalog {
func_decl_ref m_pred;
reg_idx m_reg;
public:
instr_io(bool store, func_decl_ref pred, reg_idx reg)
instr_io(bool store, func_decl_ref const& pred, reg_idx reg)
: m_store(store), m_pred(pred), m_reg(reg) {}
virtual bool perform(execution_context & ctx) {
bool perform(execution_context & ctx) override {
log_verbose(ctx);
if (m_store) {
if (ctx.reg(m_reg)) {
@ -218,10 +218,10 @@ namespace datalog {
}
return true;
}
virtual void make_annotations(execution_context & ctx) {
void make_annotations(execution_context & ctx) override {
ctx.set_register_annotation(m_reg, m_pred->get_name().bare_str());
}
virtual void display_head_impl(execution_context const& ctx, std::ostream & out) const {
void display_head_impl(execution_context const& ctx, std::ostream & out) const override {
const char * rel_name = m_pred->get_name().bare_str();
if (m_store) {
out << "store " << m_reg << " into " << rel_name;
@ -245,14 +245,14 @@ namespace datalog {
reg_idx m_reg;
public:
instr_dealloc(reg_idx reg) : m_reg(reg) {}
virtual bool perform(execution_context & ctx) {
bool perform(execution_context & ctx) override {
ctx.make_empty(m_reg);
return true;
}
virtual void make_annotations(execution_context & ctx) {
void make_annotations(execution_context & ctx) override {
ctx.set_register_annotation(m_reg, "alloc");
}
virtual void display_head_impl(execution_context const& ctx, std::ostream & out) const {
void display_head_impl(execution_context const& ctx, std::ostream & out) const override {
out << "dealloc " << m_reg;
}
};
@ -268,17 +268,17 @@ namespace datalog {
public:
instr_clone_move(bool clone, reg_idx src, reg_idx tgt)
: m_clone(clone), m_src(src), m_tgt(tgt) {}
virtual bool perform(execution_context & ctx) {
bool perform(execution_context & ctx) override {
if (ctx.reg(m_src)) log_verbose(ctx);
if (m_clone) {
ctx.set_reg(m_tgt, ctx.reg(m_src) ? ctx.reg(m_src)->clone() : 0);
ctx.set_reg(m_tgt, ctx.reg(m_src) ? ctx.reg(m_src)->clone() : nullptr);
}
else {
ctx.set_reg(m_tgt, ctx.reg(m_src) ? ctx.release_reg(m_src) : 0);
ctx.set_reg(m_tgt, ctx.reg(m_src) ? ctx.release_reg(m_src) : nullptr);
}
return true;
}
virtual void make_annotations(execution_context & ctx) {
void make_annotations(execution_context & ctx) override {
std::string str;
if (ctx.get_register_annotation(m_src, str)) {
ctx.set_register_annotation(m_tgt, str);
@ -287,7 +287,7 @@ namespace datalog {
ctx.set_register_annotation(m_src, str);
}
}
virtual void display_head_impl(execution_context const& ctx, std::ostream & out) const {
void display_head_impl(execution_context const& ctx, std::ostream & out) const override {
out << (m_clone ? "clone " : "move ") << m_src << " into " << m_tgt;
}
};
@ -317,17 +317,17 @@ namespace datalog {
return true;
}
protected:
virtual void process_all_costs() {
void process_all_costs() override {
instruction::process_all_costs();
m_body->process_all_costs();
}
public:
instr_while_loop(unsigned control_reg_cnt, const reg_idx * control_regs, instruction_block * body)
: m_controls(control_reg_cnt, control_regs), m_body(body) {}
virtual ~instr_while_loop() {
~instr_while_loop() override {
dealloc(m_body);
}
virtual bool perform(execution_context & ctx) {
bool perform(execution_context & ctx) override {
log_verbose(ctx);
TRACE("dl", tout << "loop entered\n";);
unsigned count = 0;
@ -341,14 +341,14 @@ namespace datalog {
TRACE("dl", tout << "while loop exited\n";);
return true;
}
virtual void make_annotations(execution_context & ctx) {
void make_annotations(execution_context & ctx) override {
m_body->make_annotations(ctx);
}
virtual void display_head_impl(execution_context const & ctx, std::ostream & out) const {
void display_head_impl(execution_context const & ctx, std::ostream & out) const override {
out << "while";
print_container(m_controls, out);
}
virtual void display_body_impl(execution_context const & ctx, std::ostream & out, std::string indentation) const {
void display_body_impl(execution_context const & ctx, std::ostream & out, const std::string & indentation) const override {
m_body->display_indented(ctx, out, indentation+" ");
}
};
@ -371,7 +371,7 @@ namespace datalog {
const unsigned * cols2, reg_idx result)
: m_rel1(rel1), m_rel2(rel2), m_cols1(col_cnt, cols1),
m_cols2(col_cnt, cols2), m_res(result) {}
virtual bool perform(execution_context & ctx) {
bool perform(execution_context & ctx) override {
log_verbose(ctx);
++ctx.m_stats.m_join;
if (!ctx.reg(m_rel1) || !ctx.reg(m_rel2)) {
@ -408,13 +408,13 @@ namespace datalog {
}
return true;
}
virtual void make_annotations(execution_context & ctx) {
void make_annotations(execution_context & ctx) override {
std::string a1 = "rel1", a2 = "rel2";
ctx.get_register_annotation(m_rel1, a1);
ctx.get_register_annotation(m_rel1, a1);
ctx.set_register_annotation(m_res, "join " + a1 + " " + a2);
}
virtual void display_head_impl(execution_context const & ctx, std::ostream & out) const {
void display_head_impl(execution_context const & ctx, std::ostream & out) const override {
out << "join " << m_rel1;
print_container(m_cols1, out);
out << " and " << m_rel2;
@ -435,7 +435,7 @@ namespace datalog {
public:
instr_filter_equal(ast_manager & m, reg_idx reg, const relation_element & value, unsigned col)
: m_reg(reg), m_value(value, m), m_col(col) {}
virtual bool perform(execution_context & ctx) {
bool perform(execution_context & ctx) override {
log_verbose(ctx);
++ctx.m_stats.m_filter_eq;
if (!ctx.reg(m_reg)) {
@ -460,12 +460,12 @@ namespace datalog {
}
return true;
}
virtual void make_annotations(execution_context & ctx) {
void make_annotations(execution_context & ctx) override {
std::stringstream a;
a << "filter_equal " << m_col << " val: " << ctx.get_rel_context().get_rmanager().to_nice_string(m_value);
ctx.set_register_annotation(m_reg, a.str());
}
virtual void display_head_impl(execution_context const& ctx, std::ostream & out) const {
void display_head_impl(execution_context const& ctx, std::ostream & out) const override {
out << "filter_equal " << m_reg << " col: " << m_col << " val: "
<< ctx.get_rel_context().get_rmanager().to_nice_string(m_value);
}
@ -484,7 +484,7 @@ namespace datalog {
public:
instr_filter_identical(reg_idx reg, unsigned col_cnt, const unsigned * identical_cols)
: m_reg(reg), m_cols(col_cnt, identical_cols) {}
virtual bool perform(execution_context & ctx) {
bool perform(execution_context & ctx) override {
log_verbose(ctx);
++ctx.m_stats.m_filter_id;
if (!ctx.reg(m_reg)) {
@ -509,11 +509,11 @@ namespace datalog {
}
return true;
}
virtual void display_head_impl(execution_context const& ctx, std::ostream & out) const {
void display_head_impl(execution_context const& ctx, std::ostream & out) const override {
out << "filter_identical " << m_reg << " ";
print_container(m_cols, out);
}
virtual void make_annotations(execution_context & ctx) {
void make_annotations(execution_context & ctx) override {
ctx.set_register_annotation(m_reg, "filter_identical");
}
};
@ -529,7 +529,7 @@ namespace datalog {
public:
instr_filter_interpreted(reg_idx reg, app_ref & condition)
: m_reg(reg), m_cond(condition) {}
virtual bool perform(execution_context & ctx) {
bool perform(execution_context & ctx) override {
if (!ctx.reg(m_reg)) {
return true;
}
@ -557,11 +557,11 @@ namespace datalog {
return true;
}
virtual void display_head_impl(execution_context const& ctx, std::ostream & out) const {
void display_head_impl(execution_context const& ctx, std::ostream & out) const override {
out << "filter_interpreted " << m_reg << " using "
<< mk_pp(m_cond, m_cond.get_manager());
}
virtual void make_annotations(execution_context & ctx) {
void make_annotations(execution_context & ctx) override {
std::stringstream a;
a << "filter_interpreted " << mk_pp(m_cond, m_cond.get_manager());
ctx.set_register_annotation(m_reg, a.str());
@ -584,7 +584,7 @@ namespace datalog {
: m_src(src), m_cond(condition), m_cols(col_cnt, removed_cols),
m_res(result) {}
virtual bool perform(execution_context & ctx) {
bool perform(execution_context & ctx) override {
log_verbose(ctx);
if (!ctx.reg(m_src)) {
ctx.make_empty(m_res);
@ -614,14 +614,14 @@ namespace datalog {
return true;
}
virtual void display_head_impl(execution_context const& ctx, std::ostream & out) const {
void display_head_impl(execution_context const& ctx, std::ostream & out) const override {
out << "filter_interpreted_and_project " << m_src << " into " << m_res;
out << " using " << mk_pp(m_cond, m_cond.get_manager());
out << " deleting columns ";
print_container(m_cols, out);
}
virtual void make_annotations(execution_context & ctx) {
void make_annotations(execution_context & ctx) override {
std::stringstream s;
std::string a = "rel_src";
ctx.get_register_annotation(m_src, a);
@ -644,7 +644,7 @@ namespace datalog {
public:
instr_union(reg_idx src, reg_idx tgt, reg_idx delta, bool widen)
: m_src(src), m_tgt(tgt), m_delta(delta), m_widen(widen) {}
virtual bool perform(execution_context & ctx) {
bool perform(execution_context & ctx) override {
TRACE("dl", tout << "union " << m_src << " into " << m_tgt
<< " " << ctx.reg(m_src) << " " << ctx.reg(m_tgt) << "\n";);
if (!ctx.reg(m_src)) {
@ -662,7 +662,7 @@ namespace datalog {
relation_base * new_delta = r_tgt.get_plugin().mk_empty(r_tgt);
ctx.set_reg(m_delta, new_delta);
}
relation_base * r_delta = (m_delta!=execution_context::void_register) ? ctx.reg(m_delta) : 0;
relation_base * r_delta = (m_delta!=execution_context::void_register) ? ctx.reg(m_delta) : nullptr;
relation_union_fn * fn;
@ -687,10 +687,10 @@ namespace datalog {
else {
if (!find_fn(r_tgt, r_src, fn)) {
if (m_widen) {
fn = r_src.get_manager().mk_widen_fn(r_tgt, r_src, 0);
fn = r_src.get_manager().mk_widen_fn(r_tgt, r_src, nullptr);
}
else {
fn = r_src.get_manager().mk_union_fn(r_tgt, r_src, 0);
fn = r_src.get_manager().mk_union_fn(r_tgt, r_src, nullptr);
}
if (!fn) {
std::stringstream sstm;
@ -721,7 +721,7 @@ namespace datalog {
return true;
}
virtual void make_annotations(execution_context & ctx) {
void make_annotations(execution_context & ctx) override {
std::string str = "union";
if (!ctx.get_register_annotation(m_tgt, str)) {
ctx.set_register_annotation(m_tgt, "union");
@ -731,7 +731,7 @@ namespace datalog {
}
ctx.set_register_annotation(m_delta, str);
}
virtual void display_head_impl(execution_context const& ctx, std::ostream & out) const {
void display_head_impl(execution_context const& ctx, std::ostream & out) const override {
out << (m_widen ? "widen " : "union ") << m_src << " into " << m_tgt;
if (m_delta!=execution_context::void_register) {
out << " with delta " << m_delta;
@ -758,7 +758,7 @@ namespace datalog {
instr_project_rename(bool projection, reg_idx src, unsigned col_cnt, const unsigned * cols,
reg_idx tgt) : m_projection(projection), m_src(src),
m_cols(col_cnt, cols), m_tgt(tgt) {}
virtual bool perform(execution_context & ctx) {
bool perform(execution_context & ctx) override {
if (!ctx.reg(m_src)) {
ctx.make_empty(m_tgt);
return true;
@ -787,12 +787,12 @@ namespace datalog {
return true;
}
virtual void display_head_impl(execution_context const& ctx, std::ostream & out) const {
void display_head_impl(execution_context const& ctx, std::ostream & out) const override {
out << (m_projection ? "project " : "rename ") << m_src << " into " << m_tgt;
out << (m_projection ? " deleting columns " : " with cycle ");
print_container(m_cols, out);
}
virtual void make_annotations(execution_context & ctx) {
void make_annotations(execution_context & ctx) override {
std::stringstream s;
std::string a = "rel_src";
ctx.get_register_annotation(m_src, a);
@ -825,7 +825,7 @@ namespace datalog {
: m_rel1(rel1), m_rel2(rel2), m_cols1(joined_col_cnt, cols1),
m_cols2(joined_col_cnt, cols2), m_removed_cols(removed_col_cnt, removed_cols), m_res(result) {
}
virtual bool perform(execution_context & ctx) {
bool perform(execution_context & ctx) override {
log_verbose(ctx);
if (!ctx.reg(m_rel1) || !ctx.reg(m_rel2)) {
ctx.make_empty(m_res);
@ -852,7 +852,7 @@ namespace datalog {
}
return true;
}
virtual void display_head_impl(execution_context const& ctx, std::ostream & out) const {
void display_head_impl(execution_context const& ctx, std::ostream & out) const override {
relation_base const* r1 = ctx.reg(m_rel1);
relation_base const* r2 = ctx.reg(m_rel2);
out << "join_project " << m_rel1;
@ -870,7 +870,7 @@ namespace datalog {
out << " into " << m_res << " removing columns ";
print_container(m_removed_cols, out);
}
virtual void make_annotations(execution_context & ctx) {
void make_annotations(execution_context & ctx) override {
std::string s1 = "rel1", s2 = "rel2";
ctx.get_register_annotation(m_rel1, s1);
ctx.get_register_annotation(m_rel2, s2);
@ -898,7 +898,7 @@ namespace datalog {
// TRACE("dl", tout << "src:" << m_src << " result: " << m_result << " value:" << m_value << " column:" << m_col << "\n";);
}
virtual bool perform(execution_context & ctx) {
bool perform(execution_context & ctx) override {
if (!ctx.reg(m_src)) {
ctx.make_empty(m_result);
return true;
@ -923,11 +923,11 @@ namespace datalog {
}
return true;
}
virtual void display_head_impl(execution_context const& ctx, std::ostream & out) const {
void display_head_impl(execution_context const& ctx, std::ostream & out) const override {
out << "select_equal_and_project " << m_src <<" into " << m_result << " col: " << m_col
<< " val: " << ctx.get_rel_context().get_rmanager().to_nice_string(m_value);
}
virtual void make_annotations(execution_context & ctx) {
void make_annotations(execution_context & ctx) override {
std::stringstream s;
std::string s1 = "src";
ctx.get_register_annotation(m_src, s1);
@ -953,7 +953,7 @@ namespace datalog {
instr_filter_by_negation(reg_idx tgt, reg_idx neg_rel, unsigned col_cnt, const unsigned * cols1,
const unsigned * cols2)
: m_tgt(tgt), m_neg_rel(neg_rel), m_cols1(col_cnt, cols1), m_cols2(col_cnt, cols2) {}
virtual bool perform(execution_context & ctx) {
bool perform(execution_context & ctx) override {
log_verbose(ctx);
if (!ctx.reg(m_tgt) || !ctx.reg(m_neg_rel)) {
return true;
@ -980,14 +980,14 @@ namespace datalog {
}
return true;
}
virtual void display_head_impl(execution_context const& ctx, std::ostream & out) const {
void display_head_impl(execution_context const& ctx, std::ostream & out) const override {
out << "filter_by_negation on " << m_tgt;
print_container(m_cols1, out);
out << " with " << m_neg_rel;
print_container(m_cols2, out);
out << " as the negated table";
}
virtual void make_annotations(execution_context & ctx) {
void make_annotations(execution_context & ctx) override {
std::string s = "negated relation";
ctx.get_register_annotation(m_neg_rel, s);
ctx.set_register_annotation(m_tgt, "filter by negation " + s);
@ -1011,7 +1011,7 @@ namespace datalog {
m_sig.push_back(s);
m_fact.push_back(val);
}
virtual bool perform(execution_context & ctx) {
bool perform(execution_context & ctx) override {
log_verbose(ctx);
++ctx.m_stats.m_unary_singleton;
relation_base * rel = ctx.get_rel_context().get_rmanager().mk_empty_relation(m_sig, m_pred);
@ -1019,12 +1019,12 @@ namespace datalog {
ctx.set_reg(m_tgt, rel);
return true;
}
virtual void display_head_impl(execution_context const& ctx, std::ostream & out) const {
void display_head_impl(execution_context const& ctx, std::ostream & out) const override {
out << "mk_unary_singleton into " << m_tgt << " sort:"
<< ctx.get_rel_context().get_rmanager().to_nice_string(m_sig[0]) << " val:"
<< ctx.get_rel_context().get_rmanager().to_nice_string(m_sig[0], m_fact[0]);
}
virtual void make_annotations(execution_context & ctx) {
void make_annotations(execution_context & ctx) override {
std::string s;
if (!ctx.get_register_annotation(m_tgt, s)) {
ctx.set_register_annotation(m_tgt, "mk unary singleton");
@ -1044,18 +1044,18 @@ namespace datalog {
reg_idx m_tgt;
public:
instr_mk_total(const relation_signature & sig, func_decl* p, reg_idx tgt) : m_sig(sig), m_pred(p), m_tgt(tgt) {}
virtual bool perform(execution_context & ctx) {
bool perform(execution_context & ctx) override {
log_verbose(ctx);
++ctx.m_stats.m_total;
ctx.set_reg(m_tgt, ctx.get_rel_context().get_rmanager().mk_full_relation(m_sig, m_pred));
return true;
}
virtual void display_head_impl(execution_context const& ctx, std::ostream & out) const {
void display_head_impl(execution_context const& ctx, std::ostream & out) const override {
out << "mk_total into " << m_tgt << " sort:"
<< ctx.get_rel_context().get_rmanager().to_nice_string(m_sig)
<< " " << m_pred->get_name();
}
virtual void make_annotations(execution_context & ctx) {
void make_annotations(execution_context & ctx) override {
std::string s;
if (!ctx.get_register_annotation(m_tgt, s)) {
ctx.set_register_annotation(m_tgt, "mk_total");
@ -1072,15 +1072,15 @@ namespace datalog {
public:
instr_mark_saturated(ast_manager & m, func_decl * pred)
: m_pred(pred, m) {}
virtual bool perform(execution_context & ctx) {
bool perform(execution_context & ctx) override {
log_verbose(ctx);
ctx.get_rel_context().get_rmanager().mark_saturated(m_pred);
return true;
}
virtual void display_head_impl(execution_context const& ctx, std::ostream & out) const {
void display_head_impl(execution_context const& ctx, std::ostream & out) const override {
out << "mark_saturated " << m_pred->get_name().bare_str();
}
virtual void make_annotations(execution_context & ctx) {
void make_annotations(execution_context & ctx) override {
}
};
@ -1094,18 +1094,18 @@ namespace datalog {
public:
instr_assert_signature(const relation_signature & s, reg_idx tgt)
: m_sig(s), m_tgt(tgt) {}
virtual bool perform(execution_context & ctx) {
bool perform(execution_context & ctx) override {
log_verbose(ctx);
if (ctx.reg(m_tgt)) {
SASSERT(ctx.reg(m_tgt)->get_signature()==m_sig);
}
return true;
}
virtual void display_head_impl(execution_context const& ctx, std::ostream & out) const {
void display_head_impl(execution_context const& ctx, std::ostream & out) const override {
out << "instr_assert_signature of " << m_tgt << " signature:";
print_container(m_sig, out);
}
virtual void make_annotations(execution_context & ctx) {
void make_annotations(execution_context & ctx) override {
std::string s;
if (!ctx.get_register_annotation(m_tgt, s)) {
ctx.set_register_annotation(m_tgt, "assert signature");
@ -1135,7 +1135,7 @@ namespace datalog {
dealloc(*it);
}
m_data.reset();
m_observer = 0;
m_observer = nullptr;
}
bool instruction_block::perform(execution_context & ctx) const {
@ -1182,7 +1182,7 @@ namespace datalog {
}
}
void instruction_block::display_indented(execution_context const& _ctx, std::ostream & out, std::string indentation) const {
void instruction_block::display_indented(execution_context const& _ctx, std::ostream & out, const std::string & indentation) const {
rel_context const& ctx = _ctx.get_rel_context();
instr_seq_type::const_iterator it = m_data.begin();
instr_seq_type::const_iterator end = m_data.end();

View file

@ -107,7 +107,7 @@ namespace datalog {
*/
reg_type reg(reg_idx i) const {
if (i >= m_registers.size()) {
return 0;
return nullptr;
}
return m_registers[i];
}
@ -138,7 +138,7 @@ namespace datalog {
void make_empty(reg_idx i) {
if (reg(i)) {
set_reg(i, 0);
set_reg(i, nullptr);
}
}
@ -150,7 +150,7 @@ namespace datalog {
return m_reg_annotation.find(reg, res);
}
void set_register_annotation(reg_idx reg, std::string str) {
void set_register_annotation(reg_idx reg, const std::string & str) {
m_reg_annotation.insert(reg, str);
}
@ -233,7 +233,7 @@ namespace datalog {
Each line must be prepended by \c indentation and ended by a newline character.
*/
virtual void display_body_impl(execution_context const & ctx, std::ostream & out, std::string indentation) const {}
virtual void display_body_impl(execution_context const & ctx, std::ostream & out, const std::string & indentation) const {}
void log_verbose(execution_context& ctx);
public:
@ -249,7 +249,7 @@ namespace datalog {
void display(execution_context const& ctx, std::ostream & out) const {
display_indented(ctx, out, "");
}
void display_indented(execution_context const & ctx, std::ostream & out, std::string indentation) const;
void display_indented(execution_context const & ctx, std::ostream & out, const std::string & indentation) const;
static instruction * mk_load(ast_manager & m, func_decl * pred, reg_idx tgt);
/**
@ -326,7 +326,7 @@ namespace datalog {
instr_seq_type m_data;
instruction_observer* m_observer;
public:
instruction_block() : m_observer(0) {}
instruction_block() : m_observer(nullptr) {}
~instruction_block();
void reset();
@ -359,7 +359,7 @@ namespace datalog {
void display(execution_context const & ctx, std::ostream & out) const {
display_indented(ctx, out, "");
}
void display_indented(execution_context const & ctx, std::ostream & out, std::string indentation) const;
void display_indented(execution_context const & ctx, std::ostream & out, const std::string & indentation) const;
unsigned num_instructions() const { return m_data.size(); }
};

View file

@ -59,11 +59,11 @@ namespace datalog {
: convenient_relation_join_fn(o1_sig, o2_sig, col_cnt, cols1, cols2){
}
virtual relation_base * operator()(const relation_base & _r1, const relation_base & _r2) {
relation_base * operator()(const relation_base & _r1, const relation_base & _r2) override {
interval_relation const& r1 = get(_r1);
interval_relation const& r2 = get(_r2);
interval_relation_plugin& p = r1.get_plugin();
interval_relation* result = dynamic_cast<interval_relation*>(p.mk_full(0, get_result_signature()));
interval_relation* result = dynamic_cast<interval_relation*>(p.mk_full(nullptr, get_result_signature()));
result->mk_join(r1, r2, m_cols1.size(), m_cols1.c_ptr(), m_cols2.c_ptr());
return result;
}
@ -72,7 +72,7 @@ namespace datalog {
relation_join_fn * interval_relation_plugin::mk_join_fn(const relation_base & r1, const relation_base & r2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) {
if (!check_kind(r1) || !check_kind(r2)) {
return 0;
return nullptr;
}
return alloc(join_fn, r1.get_signature(), r2.get_signature(), col_cnt, cols1, cols2);
}
@ -84,10 +84,10 @@ namespace datalog {
: convenient_relation_project_fn(orig_sig, removed_col_cnt, removed_cols) {
}
virtual relation_base * operator()(const relation_base & _r) {
relation_base * operator()(const relation_base & _r) override {
interval_relation const& r = get(_r);
interval_relation_plugin& p = r.get_plugin();
interval_relation* result = dynamic_cast<interval_relation*>(p.mk_full(0, get_result_signature()));
interval_relation* result = dynamic_cast<interval_relation*>(p.mk_full(nullptr, get_result_signature()));
result->mk_project(r, m_removed_cols.size(), m_removed_cols.c_ptr());
return result;
}
@ -104,10 +104,10 @@ namespace datalog {
: convenient_relation_rename_fn(orig_sig, cycle_len, cycle) {
}
virtual relation_base * operator()(const relation_base & _r) {
relation_base * operator()(const relation_base & _r) override {
interval_relation const& r = get(_r);
interval_relation_plugin& p = r.get_plugin();
interval_relation* result = dynamic_cast<interval_relation*>(p.mk_full(0, get_result_signature()));
interval_relation* result = dynamic_cast<interval_relation*>(p.mk_full(nullptr, get_result_signature()));
result->mk_rename(r, m_cycle.size(), m_cycle.c_ptr());
return result;
}
@ -116,7 +116,7 @@ namespace datalog {
relation_transformer_fn * interval_relation_plugin::mk_rename_fn(const relation_base & r,
unsigned cycle_len, const unsigned * permutation_cycle) {
if(!check_kind(r)) {
return 0;
return nullptr;
}
return alloc(rename_fn, r.get_signature(), cycle_len, permutation_cycle);
}
@ -134,7 +134,7 @@ namespace datalog {
high = src2.sup();
r_open = src2.is_upper_open();
}
return interval(dep(), low, l_open, 0, high, r_open, 0);
return interval(dep(), low, l_open, nullptr, high, r_open, nullptr);
}
interval interval_relation_plugin::widen(interval const& src1, interval const& src2) {
@ -151,7 +151,7 @@ namespace datalog {
high = ext_numeral(true);
r_open = true;
}
return interval(dep(), low, l_open, 0, high, r_open, 0);
return interval(dep(), low, l_open, nullptr, high, r_open, nullptr);
}
interval interval_relation_plugin::meet(interval const& src1, interval const& src2, bool& isempty) {
@ -179,7 +179,7 @@ namespace datalog {
return interval(dep());
}
else {
return interval(dep(), low, l_open, 0, high, r_open, 0);
return interval(dep(), low, l_open, nullptr, high, r_open, nullptr);
}
}
@ -198,7 +198,7 @@ namespace datalog {
m_is_widen(is_widen) {
}
virtual void operator()(relation_base & _r, const relation_base & _src, relation_base * _delta) {
void operator()(relation_base & _r, const relation_base & _src, relation_base * _delta) override {
TRACE("interval_relation", _r.display(tout << "dst:\n"); _src.display(tout << "src:\n"););
@ -209,7 +209,7 @@ namespace datalog {
r.mk_union(src, &d, m_is_widen);
}
else {
r.mk_union(src, 0, m_is_widen);
r.mk_union(src, nullptr, m_is_widen);
}
}
};
@ -217,7 +217,7 @@ namespace datalog {
relation_union_fn * interval_relation_plugin::mk_union_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta) {
if (!check_kind(tgt) || !check_kind(src) || (delta && !check_kind(*delta))) {
return 0;
return nullptr;
}
return alloc(union_fn, false);
}
@ -226,7 +226,7 @@ namespace datalog {
const relation_base & tgt, const relation_base & src,
const relation_base * delta) {
if (!check_kind(tgt) || !check_kind(src) || (delta && !check_kind(*delta))) {
return 0;
return nullptr;
}
return alloc(union_fn, true);
}
@ -237,7 +237,7 @@ namespace datalog {
filter_identical_fn(unsigned col_cnt, const unsigned * identical_cols)
: m_identical_cols(col_cnt, identical_cols) {}
virtual void operator()(relation_base & r) {
void operator()(relation_base & r) override {
interval_relation & pr = get(r);
for (unsigned i = 1; i < m_identical_cols.size(); ++i) {
unsigned c1 = m_identical_cols[0];
@ -250,7 +250,7 @@ namespace datalog {
relation_mutator_fn * interval_relation_plugin::mk_filter_identical_fn(
const relation_base & t, unsigned col_cnt, const unsigned * identical_cols) {
if(!check_kind(t)) {
return 0;
return nullptr;
}
return alloc(filter_identical_fn, col_cnt, identical_cols);
}
@ -266,7 +266,7 @@ namespace datalog {
VERIFY(arith.is_numeral(value, m_value));
}
virtual void operator()(relation_base & _r) {
void operator()(relation_base & _r) override {
interval_relation & r = get(_r);
interval_relation_plugin & p = r.get_plugin();
r.mk_intersect(m_col, interval(p.dep(), m_value));
@ -279,7 +279,7 @@ namespace datalog {
if(check_kind(r)) {
return alloc(filter_equal_fn, get_manager(), value, col);
}
return 0;
return nullptr;
}
@ -290,7 +290,7 @@ namespace datalog {
m_cond(cond, t.get_plugin().get_ast_manager()) {
}
void operator()(relation_base& t) {
void operator()(relation_base& t) override {
get(t).filter_interpreted(m_cond);
TRACE("interval_relation", tout << mk_pp(m_cond, m_cond.get_manager()) << "\n"; t.display(tout););
}
@ -300,7 +300,7 @@ namespace datalog {
if (check_kind(t)) {
return alloc(filter_interpreted_fn, get(t), condition);
}
return 0;
return nullptr;
}
interval_relation& interval_relation_plugin::get(relation_base& r) {
@ -329,7 +329,7 @@ namespace datalog {
eq = m.mk_eq(m.mk_var(i, m.get_sort(e)), e);
r.filter_interpreted(eq.get());
}
mk_union(r, 0, false);
mk_union(r, nullptr, false);
}
bool interval_relation::contains_fact(const relation_fact & f) const {
@ -365,7 +365,7 @@ namespace datalog {
interval_relation * interval_relation::complement(func_decl*) const {
UNREACHABLE();
return 0;
return nullptr;
}
void interval_relation::to_formula(expr_ref& fml) const {
@ -434,22 +434,22 @@ namespace datalog {
// 0 < x - y + k
if (x == UINT_MAX) {
// y < k
mk_intersect(y, interval(p.dep(), k, true, false, 0));
mk_intersect(y, interval(p.dep(), k, true, false, nullptr));
return;
}
if (y == UINT_MAX) {
// -k < x
mk_intersect(x, interval(p.dep(), -k, true, true, 0));
mk_intersect(x, interval(p.dep(), -k, true, true, nullptr));
return;
}
// y < x + k
ext_numeral x_hi = (*this)[x].sup();
ext_numeral y_lo = (*this)[y].inf();
if (!x_hi.is_infinite()) {
mk_intersect(y, interval(p.dep(), k + x_hi.to_rational(), true, false, 0));
mk_intersect(y, interval(p.dep(), k + x_hi.to_rational(), true, false, nullptr));
}
if (!y_lo.is_infinite()) {
mk_intersect(x, interval(p.dep(), y_lo.to_rational() - k, true, true, 0));
mk_intersect(x, interval(p.dep(), y_lo.to_rational() - k, true, true, nullptr));
}
return;
}
@ -458,21 +458,21 @@ namespace datalog {
// 0 <= x - y + k
if (x == UINT_MAX) {
// y <= k
mk_intersect(y, interval(p.dep(), k, false, false, 0));
mk_intersect(y, interval(p.dep(), k, false, false, nullptr));
return;
}
if (y == UINT_MAX) {
// -k <= x
mk_intersect(x, interval(p.dep(), -k, false, true, 0));
mk_intersect(x, interval(p.dep(), -k, false, true, nullptr));
return;
}
ext_numeral x_hi = (*this)[x].sup();
ext_numeral y_lo = (*this)[y].inf();
if (!x_hi.is_infinite()) {
mk_intersect(y, interval(p.dep(), k + x_hi.to_rational(), false, false, 0));
mk_intersect(y, interval(p.dep(), k + x_hi.to_rational(), false, false, nullptr));
}
if (!y_lo.is_infinite()) {
mk_intersect(x, interval(p.dep(), y_lo.to_rational() - k, false, true, 0));
mk_intersect(x, interval(p.dep(), y_lo.to_rational() - k, false, true, nullptr));
}
return;
}

View file

@ -53,25 +53,25 @@ namespace datalog {
public:
interval_relation_plugin(relation_manager& m);
virtual bool can_handle_signature(const relation_signature & s);
bool can_handle_signature(const relation_signature & s) override;
static symbol get_name() { return symbol("interval_relation"); }
virtual relation_base * mk_empty(const relation_signature & s);
virtual relation_base * mk_full(func_decl* p, const relation_signature & s);
virtual relation_join_fn * mk_join_fn(const relation_base & t1, const relation_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2);
virtual relation_transformer_fn * mk_project_fn(const relation_base & t, unsigned col_cnt,
const unsigned * removed_cols);
virtual relation_transformer_fn * mk_rename_fn(const relation_base & t, unsigned permutation_cycle_len,
const unsigned * permutation_cycle);
virtual relation_union_fn * mk_union_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta);
virtual relation_union_fn * mk_widen_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta);
virtual relation_mutator_fn * mk_filter_identical_fn(const relation_base & t, unsigned col_cnt,
const unsigned * identical_cols);
virtual relation_mutator_fn * mk_filter_equal_fn(const relation_base & t, const relation_element & value,
unsigned col);
virtual relation_mutator_fn * mk_filter_interpreted_fn(const relation_base & t, app * condition);
relation_base * mk_empty(const relation_signature & s) override;
relation_base * mk_full(func_decl* p, const relation_signature & s) override;
relation_join_fn * mk_join_fn(const relation_base & t1, const relation_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) override;
relation_transformer_fn * mk_project_fn(const relation_base & t, unsigned col_cnt,
const unsigned * removed_cols) override;
relation_transformer_fn * mk_rename_fn(const relation_base & t, unsigned permutation_cycle_len,
const unsigned * permutation_cycle) override;
relation_union_fn * mk_union_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta) override;
relation_union_fn * mk_widen_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta) override;
relation_mutator_fn * mk_filter_identical_fn(const relation_base & t, unsigned col_cnt,
const unsigned * identical_cols) override;
relation_mutator_fn * mk_filter_equal_fn(const relation_base & t, const relation_element & value,
unsigned col) override;
relation_mutator_fn * mk_filter_interpreted_fn(const relation_base & t, app * condition) override;
static bool is_empty(unsigned idx, interval const& i);
static bool is_infinite(interval const& i);
@ -97,39 +97,39 @@ namespace datalog {
public:
interval_relation(interval_relation_plugin& p, relation_signature const& s, bool is_empty);
virtual void add_fact(const relation_fact & f);
virtual bool contains_fact(const relation_fact & f) const;
virtual interval_relation * clone() const;
virtual interval_relation * complement(func_decl*) const;
virtual void to_formula(expr_ref& fml) const;
void add_fact(const relation_fact & f) override;
bool contains_fact(const relation_fact & f) const override;
interval_relation * clone() const override;
interval_relation * complement(func_decl*) const override;
void to_formula(expr_ref& fml) const override;
interval_relation_plugin& get_plugin() const;
void filter_interpreted(app* cond);
virtual bool is_precise() const { return false; }
bool is_precise() const override { return false; }
private:
virtual interval mk_intersect(interval const& t1, interval const& t2, bool& is_empty) const {
interval mk_intersect(interval const& t1, interval const& t2, bool& is_empty) const override {
return get_plugin().meet(t1, t2, is_empty);
}
virtual interval mk_unite(interval const& t1, interval const& t2) const { return get_plugin().unite(t1,t2); }
interval mk_unite(interval const& t1, interval const& t2) const override { return get_plugin().unite(t1,t2); }
virtual interval mk_widen(interval const& t1, interval const& t2) const { return get_plugin().widen(t1,t2); }
interval mk_widen(interval const& t1, interval const& t2) const override { return get_plugin().widen(t1,t2); }
virtual bool is_subset_of(interval const& t1, interval const& t2) const { NOT_IMPLEMENTED_YET(); return false; }
bool is_subset_of(interval const& t1, interval const& t2) const override { NOT_IMPLEMENTED_YET(); return false; }
virtual bool is_full(interval const& t) const {
bool is_full(interval const& t) const override {
return interval_relation_plugin::is_infinite(t);
}
virtual bool is_empty(unsigned idx, interval const& t) const {
bool is_empty(unsigned idx, interval const& t) const override {
return interval_relation_plugin::is_empty(idx, t);
}
virtual void mk_rename_elem(interval& i, unsigned col_cnt, unsigned const* cycle);
void mk_rename_elem(interval& i, unsigned col_cnt, unsigned const* cycle) override;
virtual void display_index(unsigned idx, interval const & i, std::ostream& out) const;
void display_index(unsigned idx, interval const & i, std::ostream& out) const override;
void mk_intersect(unsigned idx, interval const& i);

View file

@ -50,7 +50,7 @@ namespace datalog {
unsigned const* cols1, unsigned const* cols2):
convenient_table_join_fn(s1, s2, col_cnt, cols1, cols2) {}
virtual table_base* operator()(const table_base& _t1, const table_base& _t2) {
table_base* operator()(const table_base& _t1, const table_base& _t2) override {
lazy_table const& t1 = get(_t1);
lazy_table const& t2 = get(_t2);
lazy_table_ref* tr = alloc(lazy_table_join, m_cols1.size(), m_cols1.c_ptr(), m_cols2.c_ptr(), t1, t2, get_result_signature());
@ -65,7 +65,7 @@ namespace datalog {
return alloc(join_fn, t1.get_signature(), t2.get_signature(), col_cnt, cols1, cols2);
}
else {
return 0;
return nullptr;
}
}
@ -75,13 +75,13 @@ namespace datalog {
class lazy_table_plugin::union_fn : public table_union_fn {
public:
void operator()(table_base & _tgt, const table_base & _src,
table_base * _delta) {
table_base * _delta) override {
lazy_table& tgt = get(_tgt);
lazy_table const& src = get(_src);
lazy_table* delta = get(_delta);
table_base const* t_src = src.eval();
table_base * t_tgt = tgt.eval();
table_base * t_delta = delta?delta->eval():0;
table_base * t_delta = delta?delta->eval():nullptr;
verbose_action _t("union");
table_union_fn* m = tgt.get_lplugin().get_manager().mk_union_fn(*t_tgt, *t_src, t_delta);
SASSERT(m);
@ -98,7 +98,7 @@ namespace datalog {
return alloc(union_fn);
}
else {
return 0;
return nullptr;
}
}
@ -111,7 +111,7 @@ namespace datalog {
convenient_table_project_fn(orig_sig, cnt, cols)
{}
virtual table_base* operator()(table_base const& _t) {
table_base* operator()(table_base const& _t) override {
lazy_table const& t = get(_t);
return alloc(lazy_table, alloc(lazy_table_project, m_removed_cols.size(), m_removed_cols.c_ptr(), t, get_result_signature()));
}
@ -124,7 +124,7 @@ namespace datalog {
return alloc(project_fn, t.get_signature(), col_cnt, removed_cols);
}
else {
return 0;
return nullptr;
}
}
@ -137,7 +137,7 @@ namespace datalog {
convenient_table_rename_fn(orig_sig, cnt, cols)
{}
virtual table_base* operator()(table_base const& _t) {
table_base* operator()(table_base const& _t) override {
lazy_table const& t = get(_t);
return alloc(lazy_table, alloc(lazy_table_rename, m_cycle.size(), m_cycle.c_ptr(), t, get_result_signature()));
}
@ -150,7 +150,7 @@ namespace datalog {
return alloc(rename_fn, t.get_signature(), col_cnt, removed_cols);
}
else {
return 0;
return nullptr;
}
}
@ -163,7 +163,7 @@ namespace datalog {
public:
filter_identical_fn(unsigned cnt, unsigned const* cols): m_cols(cnt, cols) {}
virtual void operator()(table_base& _t) {
void operator()(table_base& _t) override {
lazy_table& t = get(_t);
t.set(alloc(lazy_table_filter_identical, m_cols.size(), m_cols.c_ptr(), t));
}
@ -175,7 +175,7 @@ namespace datalog {
return alloc(filter_identical_fn, col_cnt, identical_cols);
}
else {
return 0;
return nullptr;
}
}
@ -188,7 +188,7 @@ namespace datalog {
public:
filter_interpreted_fn(app_ref& p): m_condition(p) {}
virtual void operator()(table_base& _t) {
void operator()(table_base& _t) override {
lazy_table& t = get(_t);
t.set(alloc(lazy_table_filter_interpreted, t, m_condition));
}
@ -201,7 +201,7 @@ namespace datalog {
return alloc(filter_interpreted_fn, cond);
}
else {
return 0;
return nullptr;
}
}
@ -214,7 +214,7 @@ namespace datalog {
public:
filter_by_negation_fn(unsigned cnt, unsigned const* cols1, unsigned const* cols2):
m_cols1(cnt, cols1), m_cols2(cnt, cols2) {}
virtual void operator()(table_base & _t, const table_base & _intersected_obj) {
void operator()(table_base & _t, const table_base & _intersected_obj) override {
lazy_table& t = get(_t);
lazy_table const& it = get(_intersected_obj);
t.set(alloc(lazy_table_filter_by_negation, t, it, m_cols1, m_cols2));
@ -229,7 +229,7 @@ namespace datalog {
return alloc(filter_by_negation_fn, joined_col_cnt, t_cols, negated_cols);
}
else {
return 0;
return nullptr;
}
}
@ -246,7 +246,7 @@ namespace datalog {
m_col(col)
{ }
virtual void operator()(table_base& _t) {
void operator()(table_base& _t) override {
lazy_table& t = get(_t);
t.set(alloc(lazy_table_filter_equal, m_col, m_value, t));
}
@ -258,7 +258,7 @@ namespace datalog {
return alloc(filter_equal_fn, value, col);
}
else {
return 0;
return nullptr;
}
}
@ -269,7 +269,7 @@ namespace datalog {
return alloc(lazy_table_plugin, *sp);
}
else {
return 0;
return nullptr;
}
}
@ -397,7 +397,7 @@ namespace datalog {
SASSERT(!m_table);
m_table = m_src->eval();
m_src->release_table();
m_src = 0;
m_src = nullptr;
verbose_action _t("filter_identical");
table_mutator_fn* m = rm().mk_filter_identical_fn(*m_table, m_cols.size(), m_cols.c_ptr());
SASSERT(m);
@ -410,7 +410,7 @@ namespace datalog {
SASSERT(!m_table);
m_table = m_src->eval();
m_src->release_table();
m_src = 0;
m_src = nullptr;
verbose_action _t("filter_equal");
table_mutator_fn* m = rm().mk_filter_equal_fn(*m_table, m_value, m_col);
SASSERT(m);
@ -423,7 +423,7 @@ namespace datalog {
SASSERT(!m_table);
m_table = m_src->eval();
m_src->release_table();
m_src = 0;
m_src = nullptr;
verbose_action _t("filter_interpreted");
table_mutator_fn* m = rm().mk_filter_interpreted_fn(*m_table, m_condition);
SASSERT(m);
@ -436,7 +436,7 @@ namespace datalog {
SASSERT(!m_table);
m_table = m_tgt->eval();
m_tgt->release_table();
m_tgt = 0;
m_tgt = nullptr;
switch(m_src->kind()) {

View file

@ -48,37 +48,37 @@ namespace datalog {
table_plugin(mk_name(p), p.get_manager()),
m_plugin(p) {}
virtual bool can_handle_signature(const table_signature & s) {
bool can_handle_signature(const table_signature & s) override {
return m_plugin.can_handle_signature(s);
}
virtual table_base * mk_empty(const table_signature & s);
table_base * mk_empty(const table_signature & s) override;
static table_plugin* mk_sparse(relation_manager& rm);
protected:
virtual table_join_fn * mk_join_fn(
table_join_fn * mk_join_fn(
const table_base & t1, const table_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2);
virtual table_union_fn * mk_union_fn(
const table_base & tgt, const table_base & src,
const table_base * delta);
virtual table_transformer_fn * mk_project_fn(
const table_base & t, unsigned col_cnt,
const unsigned * removed_cols);
virtual table_transformer_fn * mk_rename_fn(
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) override;
table_union_fn * mk_union_fn(
const table_base & tgt, const table_base & src,
const table_base * delta) override;
table_transformer_fn * mk_project_fn(
const table_base & t, unsigned col_cnt,
const unsigned * removed_cols) override;
table_transformer_fn * mk_rename_fn(
const table_base & t, unsigned permutation_cycle_len,
const unsigned * permutation_cycle);
virtual table_mutator_fn * mk_filter_identical_fn(
const table_base & t, unsigned col_cnt, const unsigned * identical_cols);
virtual table_mutator_fn * mk_filter_equal_fn(
const table_base & t, const table_element & value, unsigned col);
virtual table_mutator_fn * mk_filter_interpreted_fn(
const table_base & t, app * condition);
virtual table_intersection_filter_fn * mk_filter_by_negation_fn(
const table_base & t,
const table_base & negated_obj, unsigned joined_col_cnt,
const unsigned * t_cols, const unsigned * negated_cols);
const unsigned * permutation_cycle) override;
table_mutator_fn * mk_filter_identical_fn(
const table_base & t, unsigned col_cnt, const unsigned * identical_cols) override;
table_mutator_fn * mk_filter_equal_fn(
const table_base & t, const table_element & value, unsigned col) override;
table_mutator_fn * mk_filter_interpreted_fn(
const table_base & t, app * condition) override;
table_intersection_filter_fn * mk_filter_by_negation_fn(
const table_base & t,
const table_base & negated_obj, unsigned joined_col_cnt,
const unsigned * t_cols, const unsigned * negated_cols) override;
static lazy_table const& get(table_base const& tb);
static lazy_table& get(table_base& tb);
@ -129,30 +129,30 @@ namespace datalog {
m_ref(t)
{}
virtual ~lazy_table() {}
~lazy_table() override {}
lazy_table_plugin& get_lplugin() const {
return dynamic_cast<lazy_table_plugin&>(table_base::get_plugin());
}
virtual table_base * clone() const;
virtual table_base * complement(func_decl* p, const table_element * func_columns = 0) const;
virtual bool empty() const;
virtual bool contains_fact(const table_fact & f) const;
virtual void remove_fact(table_element const* fact);
virtual void remove_facts(unsigned fact_cnt, const table_fact * facts);
virtual void remove_facts(unsigned fact_cnt, const table_element * facts);
virtual void reset();
virtual void add_fact(table_fact const& f);
table_base * clone() const override;
table_base * complement(func_decl* p, const table_element * func_columns = nullptr) const override;
bool empty() const override;
bool contains_fact(const table_fact & f) const override;
void remove_fact(table_element const* fact) override;
void remove_facts(unsigned fact_cnt, const table_fact * facts) override;
void remove_facts(unsigned fact_cnt, const table_element * facts) override;
void reset() override;
void add_fact(table_fact const& f) override;
virtual unsigned get_size_estimate_rows() const { return 1; }
virtual unsigned get_size_estimate_bytes() const { return 1; }
virtual bool knows_exact_size() const { return false; }
unsigned get_size_estimate_rows() const override { return 1; }
unsigned get_size_estimate_bytes() const override { return 1; }
bool knows_exact_size() const override { return false; }
table_base* eval() const;
virtual table_base::iterator begin() const;
virtual table_base::iterator end() const;
table_base::iterator begin() const override;
table_base::iterator end() const override;
lazy_table_ref* get_ref() const { return m_ref.get(); }
void set(lazy_table_ref* r) { m_ref = r; }
@ -165,9 +165,9 @@ namespace datalog {
m_table = table;
// SASSERT(&p.m_plugin == &table->get_lplugin());
}
virtual ~lazy_table_base() {}
virtual lazy_table_kind kind() const { return LAZY_TABLE_BASE; }
virtual table_base* force() { return m_table.get(); }
~lazy_table_base() override {}
lazy_table_kind kind() const override { return LAZY_TABLE_BASE; }
table_base* force() override { return m_table.get(); }
};
class lazy_table_join : public lazy_table_ref {
@ -184,13 +184,13 @@ namespace datalog {
m_cols2(col_cnt, cols2),
m_t1(t1.get_ref()),
m_t2(t2.get_ref()) { }
virtual ~lazy_table_join() {}
virtual lazy_table_kind kind() const { return LAZY_TABLE_JOIN; }
~lazy_table_join() override {}
lazy_table_kind kind() const override { return LAZY_TABLE_JOIN; }
unsigned_vector const& cols1() const { return m_cols1; }
unsigned_vector const& cols2() const { return m_cols2; }
lazy_table_ref* t1() const { return m_t1.get(); }
lazy_table_ref* t2() const { return m_t2.get(); }
virtual table_base* force();
table_base* force() override;
};
@ -202,12 +202,12 @@ namespace datalog {
: lazy_table_ref(src.get_lplugin(), sig),
m_cols(col_cnt, cols),
m_src(src.get_ref()) {}
virtual ~lazy_table_project() {}
~lazy_table_project() override {}
virtual lazy_table_kind kind() const { return LAZY_TABLE_PROJECT; }
lazy_table_kind kind() const override { return LAZY_TABLE_PROJECT; }
unsigned_vector const& cols() const { return m_cols; }
lazy_table_ref* src() const { return m_src.get(); }
virtual table_base* force();
table_base* force() override;
};
class lazy_table_rename : public lazy_table_ref {
@ -218,12 +218,12 @@ namespace datalog {
: lazy_table_ref(src.get_lplugin(), sig),
m_cols(col_cnt, cols),
m_src(src.get_ref()) {}
virtual ~lazy_table_rename() {}
~lazy_table_rename() override {}
virtual lazy_table_kind kind() const { return LAZY_TABLE_RENAME; }
lazy_table_kind kind() const override { return LAZY_TABLE_RENAME; }
unsigned_vector const& cols() const { return m_cols; }
lazy_table_ref* src() const { return m_src.get(); }
virtual table_base* force();
table_base* force() override;
};
class lazy_table_filter_identical : public lazy_table_ref {
@ -232,12 +232,12 @@ namespace datalog {
public:
lazy_table_filter_identical(unsigned col_cnt, const unsigned * cols, lazy_table const& src)
: lazy_table_ref(src.get_lplugin(), src.get_signature()), m_cols(col_cnt, cols), m_src(src.get_ref()) {}
virtual ~lazy_table_filter_identical() {}
~lazy_table_filter_identical() override {}
virtual lazy_table_kind kind() const { return LAZY_TABLE_FILTER_IDENTICAL; }
lazy_table_kind kind() const override { return LAZY_TABLE_FILTER_IDENTICAL; }
unsigned_vector const& cols() const { return m_cols; }
lazy_table_ref* src() const { return m_src.get(); }
virtual table_base* force();
table_base* force() override;
};
class lazy_table_filter_equal : public lazy_table_ref {
@ -250,13 +250,13 @@ namespace datalog {
m_col(col),
m_value(value),
m_src(src.get_ref()) {}
virtual ~lazy_table_filter_equal() {}
~lazy_table_filter_equal() override {}
virtual lazy_table_kind kind() const { return LAZY_TABLE_FILTER_EQUAL; }
lazy_table_kind kind() const override { return LAZY_TABLE_FILTER_EQUAL; }
unsigned col() const { return m_col; }
table_element value() const { return m_value; }
lazy_table_ref* src() const { return m_src.get(); }
virtual table_base* force();
table_base* force() override;
};
class lazy_table_filter_interpreted : public lazy_table_ref {
@ -266,12 +266,12 @@ namespace datalog {
lazy_table_filter_interpreted(lazy_table const& src, app* condition)
: lazy_table_ref(src.get_lplugin(), src.get_signature()),
m_condition(condition, src.get_lplugin().get_ast_manager()), m_src(src.get_ref()) {}
virtual ~lazy_table_filter_interpreted() {}
~lazy_table_filter_interpreted() override {}
virtual lazy_table_kind kind() const { return LAZY_TABLE_FILTER_INTERPRETED; }
lazy_table_kind kind() const override { return LAZY_TABLE_FILTER_INTERPRETED; }
app* condition() const { return m_condition; }
lazy_table_ref* src() const { return m_src.get(); }
virtual table_base* force();
table_base* force() override;
};
@ -288,13 +288,13 @@ namespace datalog {
m_src(src.get_ref()),
m_cols1(c1),
m_cols2(c2) {}
virtual ~lazy_table_filter_by_negation() {}
virtual lazy_table_kind kind() const { return LAZY_TABLE_FILTER_BY_NEGATION; }
~lazy_table_filter_by_negation() override {}
lazy_table_kind kind() const override { return LAZY_TABLE_FILTER_BY_NEGATION; }
lazy_table_ref* tgt() const { return m_tgt.get(); }
lazy_table_ref* src() const { return m_src.get(); }
unsigned_vector const& cols1() const { return m_cols1; }
unsigned_vector const& cols2() const { return m_cols2; }
virtual table_base* force();
table_base* force() override;
};

View file

@ -69,7 +69,7 @@ namespace datalog {
m_relation_level_explanations(relation_level),
m_union_decl(mk_explanations::get_union_decl(get_context()), get_ast_manager()) {}
~explanation_relation_plugin() {
~explanation_relation_plugin() override {
for (unsigned i = 0; i < m_pool.size(); ++i) {
for (unsigned j = 0; j < m_pool[i].size(); ++j) {
dealloc(m_pool[i][j]);
@ -77,7 +77,7 @@ namespace datalog {
}
}
virtual bool can_handle_signature(const relation_signature & s) {
bool can_handle_signature(const relation_signature & s) override {
unsigned n=s.size();
for (unsigned i=0; i<n; i++) {
if (!get_context().get_decl_util().is_rule_sort(s[i])) {
@ -87,27 +87,27 @@ namespace datalog {
return true;
}
virtual relation_base * mk_empty(const relation_signature & s);
relation_base * mk_empty(const relation_signature & s) override;
void recycle(explanation_relation* r);
protected:
virtual relation_join_fn * mk_join_fn(const relation_base & t1, const relation_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2);
virtual relation_transformer_fn * mk_project_fn(const relation_base & t, unsigned col_cnt,
const unsigned * removed_cols);
virtual relation_transformer_fn * mk_rename_fn(const relation_base & t, unsigned permutation_cycle_len,
const unsigned * permutation_cycle);
virtual relation_union_fn * mk_union_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta);
virtual relation_mutator_fn * mk_filter_interpreted_fn(const relation_base & t, app * condition);
virtual relation_intersection_filter_fn * mk_filter_by_negation_fn(const relation_base & t,
const relation_base & negated_obj, unsigned joined_col_cnt,
const unsigned * t_cols, const unsigned * negated_cols);
virtual relation_intersection_filter_fn * mk_filter_by_intersection_fn(const relation_base & t,
const relation_base & src, unsigned joined_col_cnt,
const unsigned * t_cols, const unsigned * src_cols);
relation_join_fn * mk_join_fn(const relation_base & t1, const relation_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) override;
relation_transformer_fn * mk_project_fn(const relation_base & t, unsigned col_cnt,
const unsigned * removed_cols) override;
relation_transformer_fn * mk_rename_fn(const relation_base & t, unsigned permutation_cycle_len,
const unsigned * permutation_cycle) override;
relation_union_fn * mk_union_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta) override;
relation_mutator_fn * mk_filter_interpreted_fn(const relation_base & t, app * condition) override;
relation_intersection_filter_fn * mk_filter_by_negation_fn(const relation_base & t,
const relation_base & negated_obj, unsigned joined_col_cnt,
const unsigned * t_cols, const unsigned * negated_cols) override;
relation_intersection_filter_fn * mk_filter_by_intersection_fn(const relation_base & t,
const relation_base & src, unsigned joined_col_cnt,
const unsigned * t_cols, const unsigned * src_cols) override;
};
@ -173,7 +173,7 @@ namespace datalog {
}
}
virtual void deallocate() {
void deallocate() override {
get_plugin().recycle(this);
}
@ -183,13 +183,13 @@ namespace datalog {
return static_cast<explanation_relation_plugin &>(relation_base::get_plugin());
}
virtual void to_formula(expr_ref& fml) const {
void to_formula(expr_ref& fml) const override {
ast_manager& m = fml.get_manager();
fml = m.mk_eq(m.mk_var(0, m.get_sort(m_data[0])), m_data[0]);
}
bool is_undefined(unsigned col_idx) const {
return m_data[col_idx]==0;
return m_data[col_idx]==nullptr;
}
bool no_undefined() const {
if (empty()) {
@ -204,23 +204,23 @@ namespace datalog {
return true;
}
virtual bool empty() const { return m_empty; }
bool empty() const override { return m_empty; }
virtual void reset() {
void reset() override {
m_empty = true;
}
virtual void add_fact(const relation_fact & f) {
void add_fact(const relation_fact & f) override {
SASSERT(empty());
assign_data(f);
}
virtual bool contains_fact(const relation_fact & f) const {
bool contains_fact(const relation_fact & f) const override {
UNREACHABLE();
throw 0;
}
virtual explanation_relation * clone() const {
explanation_relation * clone() const override {
explanation_relation * res = static_cast<explanation_relation *>(get_plugin().mk_empty(get_signature()));
res->m_empty = m_empty;
SASSERT(res->m_data.empty());
@ -228,7 +228,7 @@ namespace datalog {
return res;
}
virtual relation_base * complement(func_decl* pred) const {
relation_base * complement(func_decl* pred) const override {
explanation_relation * res = static_cast<explanation_relation *>(get_plugin().mk_empty(get_signature()));
if (empty()) {
res->set_undefined();
@ -247,7 +247,7 @@ namespace datalog {
}
}
virtual void display(std::ostream & out) const {
void display(std::ostream & out) const override {
if (empty()) {
out << "<empty explanation relation>\n";
return;
@ -296,9 +296,9 @@ namespace datalog {
class explanation_relation_plugin::join_fn : public convenient_relation_join_fn {
public:
join_fn(const relation_signature & sig1, const relation_signature & sig2)
: convenient_relation_join_fn(sig1, sig2, 0, 0, 0) {}
: convenient_relation_join_fn(sig1, sig2, 0, nullptr, nullptr) {}
virtual relation_base * operator()(const relation_base & r1_0, const relation_base & r2_0) {
relation_base * operator()(const relation_base & r1_0, const relation_base & r2_0) override {
const explanation_relation & r1 = static_cast<const explanation_relation &>(r1_0);
const explanation_relation & r2 = static_cast<const explanation_relation &>(r2_0);
explanation_relation_plugin & plugin = r1.get_plugin();
@ -317,10 +317,10 @@ namespace datalog {
relation_join_fn * explanation_relation_plugin::mk_join_fn(const relation_base & r1, const relation_base & r2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) {
if (&r1.get_plugin()!=this || &r2.get_plugin()!=this) {
return 0;
return nullptr;
}
if (col_cnt!=0) {
return 0;
return nullptr;
}
return alloc(join_fn, r1.get_signature(), r2.get_signature());
}
@ -331,7 +331,7 @@ namespace datalog {
project_fn(const relation_signature & sig, unsigned col_cnt, const unsigned * removed_cols)
: convenient_relation_project_fn(sig, col_cnt, removed_cols) {}
virtual relation_base * operator()(const relation_base & r0) {
relation_base * operator()(const relation_base & r0) override {
const explanation_relation & r = static_cast<const explanation_relation &>(r0);
explanation_relation_plugin & plugin = r.get_plugin();
@ -348,7 +348,7 @@ namespace datalog {
relation_transformer_fn * explanation_relation_plugin::mk_project_fn(const relation_base & r, unsigned col_cnt,
const unsigned * removed_cols) {
if (&r.get_plugin()!=this) {
return 0;
return nullptr;
}
return alloc(project_fn, r.get_signature(), col_cnt, removed_cols);
}
@ -359,7 +359,7 @@ namespace datalog {
rename_fn(const relation_signature & sig, unsigned permutation_cycle_len, const unsigned * permutation_cycle)
: convenient_relation_rename_fn(sig, permutation_cycle_len, permutation_cycle) {}
virtual relation_base * operator()(const relation_base & r0) {
relation_base * operator()(const relation_base & r0) override {
const explanation_relation & r = static_cast<const explanation_relation &>(r0);
explanation_relation_plugin & plugin = r.get_plugin();
@ -382,10 +382,10 @@ namespace datalog {
class explanation_relation_plugin::union_fn : public relation_union_fn {
scoped_ptr<relation_union_fn> m_delta_union_fun;
public:
virtual void operator()(relation_base & tgt0, const relation_base & src0, relation_base * delta0) {
void operator()(relation_base & tgt0, const relation_base & src0, relation_base * delta0) override {
explanation_relation & tgt = static_cast<explanation_relation &>(tgt0);
const explanation_relation & src = static_cast<const explanation_relation &>(src0);
explanation_relation * delta = delta0 ? static_cast<explanation_relation *>(delta0) : 0;
explanation_relation * delta = delta0 ? static_cast<explanation_relation *>(delta0) : nullptr;
explanation_relation_plugin & plugin = tgt.get_plugin();
if (!src.no_undefined() || !tgt.no_undefined() || (delta && !delta->no_undefined())) {
@ -418,9 +418,9 @@ namespace datalog {
class explanation_relation_plugin::foreign_union_fn : public relation_union_fn {
scoped_ptr<relation_union_fn> m_delta_union_fun;
public:
virtual void operator()(relation_base & tgt0, const relation_base & src, relation_base * delta0) {
void operator()(relation_base & tgt0, const relation_base & src, relation_base * delta0) override {
explanation_relation & tgt = static_cast<explanation_relation &>(tgt0);
explanation_relation * delta = delta0 ? static_cast<explanation_relation *>(delta0) : 0;
explanation_relation * delta = delta0 ? static_cast<explanation_relation *>(delta0) : nullptr;
if (src.empty()) {
return;
@ -435,7 +435,7 @@ namespace datalog {
relation_union_fn * explanation_relation_plugin::mk_union_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta) {
if (!check_kind(tgt) || (delta && !check_kind(*delta))) {
return 0;
return nullptr;
}
if (!check_kind(src)) {
//this is to handle the product relation
@ -454,9 +454,9 @@ namespace datalog {
: m_manager(ctx.get_manager()),
m_subst(ctx.get_var_subst()),
m_col_idx(col_idx),
m_new_rule(new_rule) {}
m_new_rule(std::move(new_rule)) {}
virtual void operator()(relation_base & r0) {
void operator()(relation_base & r0) override {
explanation_relation & r = static_cast<explanation_relation &>(r0);
if (!r.is_undefined(m_col_idx)) {
@ -480,11 +480,11 @@ namespace datalog {
relation_mutator_fn * explanation_relation_plugin::mk_filter_interpreted_fn(const relation_base & r,
app * cond) {
if (&r.get_plugin()!=this) {
return 0;
return nullptr;
}
ast_manager & m = get_ast_manager();
if (!m.is_eq(cond)) {
return 0;
return nullptr;
}
expr * arg1 = cond->get_arg(0);
expr * arg2 = cond->get_arg(1);
@ -494,12 +494,12 @@ namespace datalog {
}
if (!is_var(arg1) || !is_app(arg2)) {
return 0;
return nullptr;
}
var * col_var = to_var(arg1);
app * new_rule = to_app(arg2);
if (!get_context().get_decl_util().is_rule_sort(col_var->get_sort())) {
return 0;
return nullptr;
}
unsigned col_idx = col_var->get_idx();
@ -509,7 +509,7 @@ namespace datalog {
class explanation_relation_plugin::negation_filter_fn : public relation_intersection_filter_fn {
public:
virtual void operator()(relation_base & r, const relation_base & neg) {
void operator()(relation_base & r, const relation_base & neg) override {
if (!neg.empty()) {
r.reset();
}
@ -520,7 +520,7 @@ namespace datalog {
const relation_base & neg, unsigned joined_col_cnt, const unsigned * t_cols,
const unsigned * negated_cols) {
if (&r.get_plugin()!=this || &neg.get_plugin()!=this) {
return 0;
return nullptr;
}
return alloc(negation_filter_fn);
}
@ -531,7 +531,7 @@ namespace datalog {
intersection_filter_fn(explanation_relation_plugin & plugin)
: m_union_decl(plugin.m_union_decl) {}
virtual void operator()(relation_base & tgt0, const relation_base & src0) {
void operator()(relation_base & tgt0, const relation_base & src0) override {
explanation_relation & tgt = static_cast<explanation_relation &>(tgt0);
const explanation_relation & src = static_cast<const explanation_relation &>(src0);
@ -569,18 +569,18 @@ namespace datalog {
const relation_base & tgt, const relation_base & src, unsigned joined_col_cnt,
const unsigned * tgt_cols, const unsigned * src_cols) {
if (&tgt.get_plugin()!=this || &src.get_plugin()!=this) {
return 0;
return nullptr;
}
//this checks the join is one to one on all columns
if (tgt.get_signature()!=src.get_signature()
|| joined_col_cnt!=tgt.get_signature().size()
|| !containers_equal(tgt_cols, tgt_cols+joined_col_cnt, src_cols, src_cols+joined_col_cnt)) {
return 0;
return nullptr;
}
counter ctr;
ctr.count(joined_col_cnt, tgt_cols);
if (ctr.get_max_counter_value()>1 || (joined_col_cnt && ctr.get_max_positive()!=joined_col_cnt-1)) {
return 0;
return nullptr;
}
return alloc(intersection_filter_fn, *this);
}
@ -776,7 +776,7 @@ namespace datalog {
app_ref orig_lit(m_manager.mk_app(orig_decl, lit_args.c_ptr()), m_manager);
app_ref e_lit(get_e_lit(orig_lit, arity), m_manager);
app * tail[] = { e_lit.get() };
dst.add_rule(m_context.get_rule_manager().mk(orig_lit, 1, tail, 0));
dst.add_rule(m_context.get_rule_manager().mk(orig_lit, 1, tail, nullptr));
}
}
@ -852,7 +852,7 @@ namespace datalog {
translate_rel_level_relation(rmgr, orig_rel, e_rel);
}
else {
scoped_ptr<relation_join_fn> product_fun = rmgr.mk_join_fn(orig_rel, *m_e_fact_relation, 0, 0, 0);
scoped_ptr<relation_join_fn> product_fun = rmgr.mk_join_fn(orig_rel, *m_e_fact_relation, 0, nullptr, nullptr);
SASSERT(product_fun);
scoped_rel<relation_base> aux_extended_rel = (*product_fun)(orig_rel, *m_e_fact_relation);
TRACE("dl", tout << aux_extended_rel << " " << aux_extended_rel->get_plugin().get_name() << "\n";
@ -868,10 +868,10 @@ namespace datalog {
rule_set * mk_explanations::operator()(rule_set const & source) {
if (source.empty()) {
return 0;
return nullptr;
}
if (!m_context.generate_explanations()) {
return 0;
return nullptr;
}
rule_set * res = alloc(rule_set, m_context);
transform_facts(m_context.get_rel_context()->get_rmanager(), source, *res);

View file

@ -76,7 +76,7 @@ namespace datalog {
return get_union_decl(m_context);
}
rule_set * operator()(rule_set const & source);
rule_set * operator()(rule_set const & source) override;
static expr* get_explanation(relation_base const& r);
};

View file

@ -531,7 +531,7 @@ namespace datalog {
}
}
rule_set * result = static_cast<rule_set *>(0);
rule_set * result = static_cast<rule_set *>(nullptr);
if (m_modified) {
result = alloc(rule_set, m_context);
unsigned fin_rule_cnt = m_result_rules.size();

View file

@ -69,7 +69,7 @@ namespace datalog {
public:
mk_similarity_compressor(context & ctx);
rule_set * operator()(rule_set const & source);
rule_set * operator()(rule_set const & source) override;
};
};

View file

@ -165,7 +165,7 @@ namespace datalog {
SASSERT(is_var(t->get_arg(i)));
var * v = to_var(t->get_arg(i));
unsigned var_idx = v->get_idx();
if (result[res_ofs-var_idx]==0) {
if (result[res_ofs-var_idx]==nullptr) {
result[res_ofs-var_idx]=m.mk_var(next_var, v->get_sort());
next_var++;
}
@ -235,7 +235,7 @@ namespace datalog {
//so the order should not matter
}
result.resize(max_var_idx+1, static_cast<expr *>(0));
result.resize(max_var_idx+1, static_cast<expr *>(nullptr));
unsigned next_var = 0;
get_normalizer(t1, next_var, result);
get_normalizer(t2, next_var, result);
@ -268,9 +268,9 @@ namespace datalog {
*/
void register_pair(app * t1, app * t2, rule * r, const var_idx_set & non_local_vars) {
SASSERT(t1!=t2);
cost_map::entry * e = m_costs.insert_if_not_there2(get_key(t1, t2), 0);
cost_map::entry * e = m_costs.insert_if_not_there2(get_key(t1, t2), nullptr);
pair_info * & ptr_inf = e->get_data().m_value;
if (ptr_inf==0) {
if (ptr_inf==nullptr) {
ptr_inf = alloc(pair_info);
}
pair_info & inf = *ptr_inf;
@ -297,7 +297,7 @@ namespace datalog {
}
void remove_rule_from_pair(app_pair key, rule * r, unsigned original_len) {
pair_info * ptr = 0;
pair_info * ptr = nullptr;
if (m_costs.find(key, ptr) && ptr &&
ptr->remove_rule(r, original_len)) {
SASSERT(ptr->m_rules.empty());
@ -354,7 +354,7 @@ namespace datalog {
void join_pair(app_pair pair_key) {
app * t1 = pair_key.first;
app * t2 = pair_key.second;
pair_info* infp = 0;
pair_info* infp = nullptr;
if (!m_costs.find(pair_key, infp) || !infp) {
UNREACHABLE();
return;
@ -402,7 +402,7 @@ namespace datalog {
app * tail[] = {t1, t2};
rule * new_rule = m_context.get_rule_manager().mk(head, 2, tail, 0);
rule * new_rule = m_context.get_rule_manager().mk(head, 2, tail, nullptr);
//TODO: update accounting so that it can handle multiple parents
new_rule->set_accounting_parent_object(m_context, one_parent);
@ -702,7 +702,7 @@ namespace datalog {
}
if (!m_modified_rules) {
return 0;
return nullptr;
}
rule_set * result = alloc(rule_set, m_context);
rule_pred_map::iterator rcit = m_rules_content.begin();

View file

@ -54,7 +54,7 @@ namespace datalog {
public:
mk_simple_joins(context & ctx);
rule_set * operator()(rule_set const & source);
rule_set * operator()(rule_set const & source) override;
};
};

View file

@ -261,7 +261,7 @@ namespace datalog {
void init(relation_signature const& r1_sig, unsigned num_rels1, relation_base const* const* r1,
relation_signature const& r2_sig, unsigned num_rels2, relation_base const* const* r2,
unsigned col_cnt, unsigned const* cols1, unsigned const* cols2) {
func_decl* p = 0;
func_decl* p = nullptr;
bit_vector bv;
bv.resize(num_rels2);
relation_manager& rmgr = m_plugin.get_manager();
@ -444,16 +444,16 @@ namespace datalog {
init(r1.get_signature(), 1, rels1, r2.get_signature(), 1, rels2, col_cnt, cols1, cols2);
}
~join_fn() {
~join_fn() override {
dealloc_ptr_vector_content(m_joins);
dealloc_ptr_vector_content(m_full);
}
virtual relation_base * operator()(const relation_base & _r1, const relation_base & _r2) {
relation_base * operator()(const relation_base & _r1, const relation_base & _r2) override {
TRACE("dl", _r1.display(tout); _r2.display(tout););
ptr_vector<relation_base> relations;
unsigned sz = m_joins.size();
relation_base* result = 0;
relation_base* result = nullptr;
for (unsigned i = 0; i < sz; ++i) {
relation_base const& r1 = (m_kind1[i] == T_FULL)?(*m_full[m_offset1[i]]):access(m_offset1[i], _r1);
relation_base const& r2 = (m_kind2[i] == T_FULL)?(*m_full[m_offset2[i]]):access(m_offset2[i], _r2);
@ -479,7 +479,7 @@ namespace datalog {
if (r1.get_kind() != r2.get_kind()) {
return alloc(join_fn, *this, r1, r2, col_cnt, cols1, cols2);
}
return 0;
return nullptr;
}
@ -488,12 +488,12 @@ namespace datalog {
ptr_vector<relation_transformer_fn> m_transforms;
public:
transform_fn(relation_signature s, unsigned num_trans, relation_transformer_fn** trans):
m_sig(s),
m_sig(std::move(s)),
m_transforms(num_trans, trans) {}
~transform_fn() { dealloc_ptr_vector_content(m_transforms); }
~transform_fn() override { dealloc_ptr_vector_content(m_transforms); }
virtual relation_base * operator()(const relation_base & _r) {
relation_base * operator()(const relation_base & _r) override {
product_relation const& r = get(_r);
product_relation_plugin& p = r.get_plugin();
SASSERT(m_transforms.size() == r.size());
@ -519,7 +519,7 @@ namespace datalog {
relation_signature::from_project(r.get_signature(), col_cnt, removed_cols, s);
return alloc(transform_fn, s, projs.size(), projs.c_ptr());
}
return 0;
return nullptr;
}
relation_transformer_fn * product_relation_plugin::mk_rename_fn(const relation_base & _r,
@ -534,7 +534,7 @@ namespace datalog {
relation_signature::from_rename(r.get_signature(), cycle_len, permutation_cycle, s);
return alloc(transform_fn, s, trans.size(), trans.c_ptr());
}
return 0;
return nullptr;
}
class product_relation_plugin::aligned_union_fn : public relation_union_fn {
@ -549,7 +549,7 @@ namespace datalog {
void mk_union_fn(unsigned i, unsigned j, relation_base const& r1, relation_base const& r2,
const relation_base* delta) {
relation_manager& rmgr = r1.get_manager();
relation_union_fn* u = 0;
relation_union_fn* u = nullptr;
if (m_is_widen) {
u = rmgr.mk_widen_fn(r1, r2, delta);
}
@ -596,7 +596,7 @@ namespace datalog {
return;
}
do_intersection(*tgt, *src);
src = 0;
src = nullptr;
}
void do_intersection(relation_base& tgt, relation_base& src) {
@ -625,17 +625,17 @@ namespace datalog {
m_is_widen(is_widen) {
SASSERT(vectors_equal(tgt.m_spec, src.m_spec));
SASSERT(!delta || vectors_equal(tgt.m_spec, delta->m_spec));
init(tgt.m_relations, src.m_relations, delta ? &delta->m_relations : 0);
init(tgt.m_relations, src.m_relations, delta ? &delta->m_relations : nullptr);
}
~aligned_union_fn() {
~aligned_union_fn() override {
unsigned sz = m_unions.size();
for(unsigned i=0; i<sz; i++) {
dealloc_ptr_vector_content(m_unions[i]);
}
}
virtual void operator()(relation_base& _tgt, const relation_base& _src, relation_base* _delta) {
void operator()(relation_base& _tgt, const relation_base& _src, relation_base* _delta) override {
TRACE("dl", _tgt.display(tout << "dst:\n"); _src.display(tout << "src:\n"););
SASSERT(m_plugin.check_kind(_tgt));
SASSERT(m_plugin.check_kind(_src));
@ -650,9 +650,9 @@ namespace datalog {
for (unsigned i = 0; i < num; ++i) {
relation_base& itgt = tgt[i];
relation_base* idelta = delta ? &(*delta)[i] : 0;
relation_base* idelta = delta ? &(*delta)[i] : nullptr;
scoped_rel<relation_base> fresh_delta = idelta ? idelta->get_plugin().mk_empty(*idelta) : 0;
scoped_rel<relation_base> fresh_delta = idelta ? idelta->get_plugin().mk_empty(*idelta) : nullptr;
scoped_rel<relation_base> side_result;
scoped_rel<relation_base> side_delta;
@ -665,7 +665,7 @@ namespace datalog {
TRACE("dl", itgt.display(tout << "tgt:\n"); src[j].display(tout << "src:\n"););
// union[i][j]
scoped_rel<relation_base> one_side_union = itgt.clone();
scoped_rel<relation_base> one_side_delta = fresh_delta ? fresh_delta->clone() : 0;
scoped_rel<relation_base> one_side_delta = fresh_delta ? fresh_delta->clone() : nullptr;
TRACE("dl", one_side_union->display(tout << "union 1:\n"); src[j].display(tout););
do_inner_union(i, j, *one_side_union, src[j], one_side_delta.get());
TRACE("dl", one_side_union->display(tout << "union:\n"););
@ -679,7 +679,7 @@ namespace datalog {
// union[j][i]
one_side_union = src[i].clone();
one_side_delta = fresh_delta ? fresh_delta->clone() : 0;
one_side_delta = fresh_delta ? fresh_delta->clone() : nullptr;
TRACE("dl", one_side_union->display(tout << "union 2:\n"); tgt[j].display(tout););
do_inner_union(i, j, *one_side_union, tgt[j], one_side_delta.get());
TRACE("dl", one_side_union->display(tout << "union:\n"););
@ -697,8 +697,8 @@ namespace datalog {
}
for (unsigned i = 0; i < num; ++i) {
relation_base& itgt = tgt[i];
relation_base* idelta = delta ? &(*delta)[i] : 0;
scoped_rel<relation_base> fresh_delta = idelta ? idelta->get_plugin().mk_empty(*idelta) : 0;
relation_base* idelta = delta ? &(*delta)[i] : nullptr;
scoped_rel<relation_base> fresh_delta = idelta ? idelta->get_plugin().mk_empty(*idelta) : nullptr;
scoped_rel<relation_base> side_result(side_results[i]);
scoped_rel<relation_base> side_delta(side_deltas[i]);
@ -748,11 +748,11 @@ namespace datalog {
}
virtual void operator()(relation_base& _tgt, const relation_base& _src, relation_base* _delta) {
void operator()(relation_base& _tgt, const relation_base& _src, relation_base* _delta) override {
TRACE("dl_verbose", _tgt.display(tout << "dst:\n"); _src.display(tout << "src:\n"););
product_relation& tgt = get(_tgt);
product_relation const& src0 = get(_src);
product_relation* delta = _delta ? get(_delta) : 0;
product_relation* delta = _delta ? get(_delta) : nullptr;
tgt.convert_spec(m_common_spec);
if(delta) {
@ -783,7 +783,7 @@ namespace datalog {
: m_single_rel_idx(single_rel_idx),
m_inner_union_fun(inner_union_fun) {}
virtual void operator()(relation_base& tgt, const relation_base& _src, relation_base* delta) {
void operator()(relation_base& tgt, const relation_base& _src, relation_base* delta) override {
TRACE("dl", tgt.display(tout); _src.display(tout); );
product_relation const& src = get(_src);
(*m_inner_union_fun)(tgt, src[m_single_rel_idx], delta);
@ -815,7 +815,7 @@ namespace datalog {
}
}
}
return 0;
return nullptr;
}
relation_union_fn * product_relation_plugin::mk_union_fn(const relation_base & tgt, const relation_base & src,
@ -834,9 +834,9 @@ namespace datalog {
mutator_fn(unsigned sz, relation_mutator_fn** muts):
m_mutators(sz, muts) {}
~mutator_fn() { dealloc_ptr_vector_content(m_mutators); }
~mutator_fn() override { dealloc_ptr_vector_content(m_mutators); }
virtual void operator()(relation_base & _r) {
void operator()(relation_base & _r) override {
TRACE("dl", _r.display(tout););
product_relation& r = get(_r);
SASSERT(m_mutators.size() == r.size());
@ -867,7 +867,7 @@ namespace datalog {
return alloc(mutator_fn, mutators.size(), mutators.c_ptr());
}
}
return 0;
return nullptr;
}
relation_mutator_fn * product_relation_plugin::mk_filter_equal_fn(const relation_base & _t,
@ -885,7 +885,7 @@ namespace datalog {
return alloc(mutator_fn, mutators.size(), mutators.c_ptr());
}
}
return 0;
return nullptr;
}
class product_relation_plugin::filter_interpreted_fn : public relation_mutator_fn {
@ -911,9 +911,9 @@ namespace datalog {
}
}
~filter_interpreted_fn() { dealloc_ptr_vector_content(m_mutators); }
~filter_interpreted_fn() override { dealloc_ptr_vector_content(m_mutators); }
void operator()(relation_base& _r) {
void operator()(relation_base& _r) override {
TRACE("dl", _r.display(tout););
product_relation const& r = get(_r);
for (unsigned i = 0; i < m_attach.size(); ++i) {
@ -983,7 +983,7 @@ namespace datalog {
void product_relation::convert_spec(const rel_spec & spec) {
func_decl* p = 0;
func_decl* p = nullptr;
const relation_signature & sig = get_signature();
family_id new_kind = get_plugin().get_relation_kind(sig, spec);
if (new_kind == get_kind()) {
@ -1008,7 +1008,7 @@ namespace datalog {
//the loop is quadratic with the number of relations, maybe we want to fix it
for(unsigned i=0; i<new_sz; i++) {
family_id ikind = spec[i];
relation_base * irel = 0;
relation_base * irel = nullptr;
//we try to find the relation for the new specification among those we already have
for(unsigned j=0; j<old_sz; j++) {
if(m_relations[j] && m_relations[j]->get_kind()==ikind) {
@ -1096,7 +1096,7 @@ namespace datalog {
return res;
}
UNREACHABLE();
return 0;
return nullptr;
}
bool product_relation::empty() const {

View file

@ -59,37 +59,37 @@ namespace datalog {
product_relation_plugin(relation_manager& m);
virtual void initialize(family_id fid);
void initialize(family_id fid) override;
virtual bool can_handle_signature(const relation_signature & s);
virtual bool can_handle_signature(const relation_signature & s, family_id kind);
bool can_handle_signature(const relation_signature & s) override;
bool can_handle_signature(const relation_signature & s, family_id kind) override;
static symbol get_name() { return symbol("product_relation"); }
family_id get_relation_kind(const relation_signature & sig, const rel_spec & spec);
virtual relation_base * mk_empty(const relation_signature & s);
virtual relation_base * mk_empty(const relation_signature & s, family_id kind);
relation_base * mk_empty(const relation_signature & s) override;
relation_base * mk_empty(const relation_signature & s, family_id kind) override;
virtual relation_base * mk_full(func_decl* p, const relation_signature & s);
virtual relation_base * mk_full(func_decl* p, const relation_signature & s, family_id kind);
relation_base * mk_full(func_decl* p, const relation_signature & s) override;
relation_base * mk_full(func_decl* p, const relation_signature & s, family_id kind) override;
protected:
virtual relation_join_fn * mk_join_fn(const relation_base & t1, const relation_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2);
virtual relation_transformer_fn * mk_project_fn(const relation_base & t, unsigned col_cnt,
const unsigned * removed_cols);
virtual relation_transformer_fn * mk_rename_fn(const relation_base & t, unsigned permutation_cycle_len,
const unsigned * permutation_cycle);
virtual relation_union_fn * mk_union_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta);
virtual relation_union_fn * mk_widen_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta);
virtual relation_mutator_fn * mk_filter_identical_fn(const relation_base & t, unsigned col_cnt,
const unsigned * identical_cols);
virtual relation_mutator_fn * mk_filter_equal_fn(const relation_base & t, const relation_element & value,
unsigned col);
virtual relation_mutator_fn * mk_filter_interpreted_fn(const relation_base & t, app * condition);
relation_join_fn * mk_join_fn(const relation_base & t1, const relation_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) override;
relation_transformer_fn * mk_project_fn(const relation_base & t, unsigned col_cnt,
const unsigned * removed_cols) override;
relation_transformer_fn * mk_rename_fn(const relation_base & t, unsigned permutation_cycle_len,
const unsigned * permutation_cycle) override;
relation_union_fn * mk_union_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta) override;
relation_union_fn * mk_widen_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta) override;
relation_mutator_fn * mk_filter_identical_fn(const relation_base & t, unsigned col_cnt,
const unsigned * identical_cols) override;
relation_mutator_fn * mk_filter_equal_fn(const relation_base & t, const relation_element & value,
unsigned col) override;
relation_mutator_fn * mk_filter_interpreted_fn(const relation_base & t, app * condition) override;
static bool is_product_relation(relation_base const& r);
@ -154,15 +154,15 @@ namespace datalog {
product_relation(product_relation_plugin& p, relation_signature const& s);
product_relation(product_relation_plugin& p, relation_signature const& s, unsigned num_relations, relation_base** relations);
~product_relation();
~product_relation() override;
virtual bool empty() const;
virtual void add_fact(const relation_fact & f);
virtual bool contains_fact(const relation_fact & f) const;
virtual product_relation * clone() const;
virtual product_relation * complement(func_decl* p) const;
virtual void display(std::ostream & out) const;
virtual void to_formula(expr_ref& fml) const;
bool empty() const override;
void add_fact(const relation_fact & f) override;
bool contains_fact(const relation_fact & f) const override;
product_relation * clone() const override;
product_relation * complement(func_decl* p) const override;
void display(std::ostream & out) const override;
void to_formula(expr_ref& fml) const override;
product_relation_plugin& get_plugin() const;
unsigned size() const { return m_relations.size(); }
@ -175,7 +175,7 @@ namespace datalog {
*/
bool try_get_single_non_transparent(unsigned & idx) const;
virtual bool is_precise() const {
bool is_precise() const override {
for (unsigned i = 0; i < m_relations.size(); ++i) {
if (!m_relations[i]->is_precise()) {
return false;

View file

@ -47,8 +47,8 @@ namespace datalog {
void relation_manager::reset() {
reset_relations();
m_favourite_table_plugin = static_cast<table_plugin *>(0);
m_favourite_relation_plugin = static_cast<relation_plugin *>(0);
m_favourite_table_plugin = static_cast<table_plugin *>(nullptr);
m_favourite_relation_plugin = static_cast<relation_plugin *>(nullptr);
dealloc_ptr_vector_content(m_table_plugins);
m_table_plugins.reset();
dealloc_ptr_vector_content(m_relation_plugins);
@ -95,9 +95,9 @@ namespace datalog {
}
relation_base * relation_manager::try_get_relation(func_decl * pred) const {
relation_base * res = 0;
relation_base * res = nullptr;
if(!m_relations.find(pred, res)) {
return 0;
return nullptr;
}
SASSERT(res);
return res;
@ -217,7 +217,7 @@ namespace datalog {
return *rpit;
}
}
return 0;
return nullptr;
}
relation_plugin & relation_manager::get_appropriate_plugin(const relation_signature & s) {
@ -239,7 +239,7 @@ namespace datalog {
return *tpit;
}
}
return 0;
return nullptr;
}
table_plugin & relation_manager::get_appropriate_plugin(const table_signature & t) {
@ -258,13 +258,13 @@ namespace datalog {
return *rpit;
}
}
return 0;
return nullptr;
}
relation_plugin & relation_manager::get_relation_plugin(family_id kind) {
SASSERT(kind>=0);
SASSERT(kind<m_next_relation_fid);
relation_plugin * res = 0;
relation_plugin * res = nullptr;
VERIFY(m_kind2plugin.find(kind, res));
return *res;
}
@ -275,11 +275,11 @@ namespace datalog {
return tp;
}
}
return 0;
return nullptr;
}
table_relation_plugin & relation_manager::get_table_relation_plugin(table_plugin & tp) {
table_relation_plugin * res = 0;
table_relation_plugin * res = nullptr;
VERIFY( m_table_relation_plugins.find(&tp, res) );
return *res;
}
@ -538,7 +538,7 @@ namespace datalog {
class relation_manager::empty_signature_relation_join_fn : public relation_join_fn {
public:
virtual relation_base * operator()(const relation_base & r1, const relation_base & r2) {
relation_base * operator()(const relation_base & r1, const relation_base & r2) override {
TRACE("dl", tout << r1.get_plugin().get_name() << " " << r2.get_plugin().get_name() << "\n";);
if(r1.get_signature().empty()) {
if(r1.empty()) {
@ -612,10 +612,10 @@ namespace datalog {
unsigned removed_col_cnt,
const unsigned * removed_cols)
: m_filter(filter),
m_project(0),
m_project(nullptr),
m_removed_cols(removed_col_cnt, removed_cols) {}
virtual relation_base * operator()(const relation_base & t) {
relation_base * operator()(const relation_base & t) override {
scoped_rel<relation_base> t1 = t.clone();
(*m_filter)(*t1);
if( !m_project) {
@ -658,11 +658,11 @@ namespace datalog {
default_relation_apply_sequential_fn(unsigned n, relation_mutator_fn ** mutators):
m_mutators(n, mutators) {
}
virtual ~default_relation_apply_sequential_fn() {
~default_relation_apply_sequential_fn() override {
std::for_each(m_mutators.begin(), m_mutators.end(), delete_proc<relation_mutator_fn>());
}
virtual void operator()(relation_base& t) {
void operator()(relation_base& t) override {
for (unsigned i = 0; i < m_mutators.size(); ++i) {
if (t.empty()) return;
(*(m_mutators[i]))(t);
@ -686,9 +686,9 @@ namespace datalog {
*/
default_relation_join_project_fn(join_fn * join, unsigned removed_col_cnt,
const unsigned * removed_cols)
: m_join(join), m_project(0), m_removed_cols(removed_col_cnt, removed_cols) {}
: m_join(join), m_project(nullptr), m_removed_cols(removed_col_cnt, removed_cols) {}
virtual relation_base * operator()(const relation_base & t1, const relation_base & t2) {
relation_base * operator()(const relation_base & t1, const relation_base & t2) override {
scoped_rel<relation_base> aux = (*m_join)(t1, t2);
if(!m_project) {
relation_manager & rmgr = aux->get_plugin().get_manager();
@ -787,7 +787,7 @@ namespace datalog {
default_relation_select_equal_and_project_fn(relation_mutator_fn * filter, relation_transformer_fn * project)
: m_filter(filter), m_project(project) {}
virtual relation_base * operator()(const relation_base & t1) {
relation_base * operator()(const relation_base & t1) override {
TRACE("dl", tout << t1.get_plugin().get_name() << "\n";);
scoped_rel<relation_base> aux = t1.clone();
(*m_filter)(*aux);
@ -823,7 +823,7 @@ namespace datalog {
default_relation_intersection_filter_fn(relation_join_fn * join_fun, relation_union_fn * union_fun)
: m_join_fun(join_fun), m_union_fun(union_fun) {}
virtual void operator()(relation_base & tgt, const relation_base & intersected_obj) {
void operator()(relation_base & tgt, const relation_base & intersected_obj) override {
scoped_rel<relation_base> filtered_rel = (*m_join_fun)(tgt, intersected_obj);
TRACE("dl",
tgt.display(tout << "tgt:\n");
@ -851,21 +851,21 @@ namespace datalog {
scoped_rel<relation_join_fn> join_fun = mk_join_project_fn(tgt, src, joined_col_cnt, tgt_cols, src_cols,
join_removed_cols.size(), join_removed_cols.c_ptr(), false);
if(!join_fun) {
return 0;
return nullptr;
}
//we perform the join operation here to see what the result is
scoped_rel<relation_base> join_res = (*join_fun)(tgt, src);
if(tgt.can_swap(*join_res)) {
return alloc(default_relation_intersection_filter_fn, join_fun.release(), 0);
return alloc(default_relation_intersection_filter_fn, join_fun.release(), nullptr);
}
if(join_res->get_plugin().is_product_relation()) {
//we cannot have the product relation here, since it uses the intersection operation
//for unions and therefore we would get into an infinite recursion
return 0;
return nullptr;
}
scoped_rel<relation_union_fn> union_fun = mk_union_fn(tgt, *join_res);
if(!union_fun) {
return 0;
return nullptr;
}
return alloc(default_relation_intersection_filter_fn, join_fun.release(), union_fun.release());
}
@ -926,7 +926,7 @@ namespace datalog {
const unsigned * cols1, const unsigned * cols2)
: convenient_table_join_fn(t1_sig, t2_sig, col_cnt, cols1, cols2), m_col_cnt(col_cnt) {}
virtual table_base * operator()(const table_base & t1, const table_base & t2) {
table_base * operator()(const table_base & t1, const table_base & t2) override {
table_plugin * plugin = &t1.get_plugin();
const table_signature & res_sign = get_result_signature();
@ -1037,15 +1037,15 @@ namespace datalog {
SASSERT(removed_col_cnt>0);
}
virtual const table_signature & get_result_signature() const {
const table_signature & get_result_signature() const override {
return convenient_table_project_fn::get_result_signature();
}
virtual void modify_fact(table_fact & f) const {
void modify_fact(table_fact & f) const override {
project_out_vector_columns(f, m_removed_cols);
}
virtual table_base * operator()(const table_base & t) {
table_base * operator()(const table_base & t) override {
return auxiliary_table_transformer_fn::operator()(t);
}
};
@ -1054,7 +1054,7 @@ namespace datalog {
const table_signature m_empty_sig;
public:
null_signature_table_project_fn() : m_empty_sig() {}
virtual table_base * operator()(const table_base & t) {
table_base * operator()(const table_base & t) override {
relation_manager & m = t.get_plugin().get_manager();
table_base * res = m.mk_empty_table(m_empty_sig);
if(!t.empty()) {
@ -1096,14 +1096,14 @@ namespace datalog {
m_removed_cols(removed_col_cnt, removed_cols) {}
class unreachable_reducer : public table_row_pair_reduce_fn {
virtual void operator()(table_element * func_columns, const table_element * merged_func_columns) {
void operator()(table_element * func_columns, const table_element * merged_func_columns) override {
//we do project_with_reduce only if we are sure there will be no reductions
//(see code of the table_signature::from_join_project function)
UNREACHABLE();
}
};
virtual table_base * operator()(const table_base & t1, const table_base & t2) {
table_base * operator()(const table_base & t1, const table_base & t2) override {
table_base * aux = (*m_join)(t1, t2);
if(m_project==0) {
relation_manager & rmgr = aux->get_plugin().get_manager();
@ -1154,15 +1154,15 @@ namespace datalog {
SASSERT(permutation_cycle_len>=2);
}
virtual const table_signature & get_result_signature() const {
const table_signature & get_result_signature() const override {
return convenient_table_rename_fn::get_result_signature();
}
virtual void modify_fact(table_fact & f) const {
void modify_fact(table_fact & f) const override {
permutate_by_cycle(f, m_cycle);
}
virtual table_base * operator()(const table_base & t) {
table_base * operator()(const table_base & t) override {
return auxiliary_table_transformer_fn::operator()(t);
}
@ -1190,7 +1190,7 @@ namespace datalog {
class relation_manager::default_table_union_fn : public table_union_fn {
table_fact m_row;
public:
virtual void operator()(table_base & tgt, const table_base & src, table_base * delta) {
void operator()(table_base & tgt, const table_base & src, table_base * delta) override {
table_base::iterator it = src.begin();
table_base::iterator iend = src.end();
@ -1283,7 +1283,7 @@ namespace datalog {
SASSERT(col_cnt>=2);
}
virtual bool should_remove(const table_fact & f) const {
bool should_remove(const table_fact & f) const override {
table_element val=f[m_identical_cols[0]];
for(unsigned i=1; i<m_col_cnt; i++) {
if(f[m_identical_cols[i]]!=val) {
@ -1293,7 +1293,7 @@ namespace datalog {
return false;
}
virtual void operator()(table_base & t) {
void operator()(table_base & t) override {
auxiliary_table_filter_fn::operator()(t);
}
@ -1318,11 +1318,11 @@ namespace datalog {
: m_value(value),
m_col(col) {}
virtual bool should_remove(const table_fact & f) const {
bool should_remove(const table_fact & f) const override {
return f[m_col]!=m_value;
}
virtual void operator()(table_base & t) {
void operator()(table_base & t) override {
auxiliary_table_filter_fn::operator()(t);
}
};
@ -1346,22 +1346,22 @@ namespace datalog {
m_value(value) {
}
virtual bool should_remove(const table_fact & f) const {
bool should_remove(const table_fact & f) const override {
return f[m_column] == m_value;
}
virtual void operator()(table_base & t) {
void operator()(table_base & t) override {
auxiliary_table_filter_fn::operator()(t);
}
static table_mutator_fn* mk(context& ctx, expr* condition) {
ast_manager& m = ctx.get_manager();
if (!m.is_not(condition)) {
return 0;
return nullptr;
}
condition = to_app(condition)->get_arg(0);
if (!m.is_eq(condition)) {
return 0;
return nullptr;
}
expr* x = to_app(condition)->get_arg(0);
expr* y = to_app(condition)->get_arg(1);
@ -1369,12 +1369,12 @@ namespace datalog {
std::swap(x, y);
}
if (!is_var(x)) {
return 0;
return nullptr;
}
dl_decl_util decl_util(m);
uint64 value = 0;
if (!decl_util.is_numeral_ext(y, value)) {
return 0;
return nullptr;
}
return alloc(default_table_filter_not_equal_fn, ctx, to_var(x)->get_idx(), value);
}
@ -1402,7 +1402,7 @@ namespace datalog {
m_free_vars(m_condition);
}
virtual bool should_remove(const table_fact & f) const {
bool should_remove(const table_fact & f) const override {
expr_ref_vector& args = const_cast<expr_ref_vector&>(m_args);
args.reset();
@ -1410,7 +1410,7 @@ namespace datalog {
unsigned col_cnt = f.size();
for(int i=col_cnt-1;i>=0;i--) {
if(!m_free_vars.contains(i)) {
args.push_back(0);
args.push_back(nullptr);
continue; //this variable does not occur in the condition;
}
@ -1425,7 +1425,7 @@ namespace datalog {
return m_ast_manager.is_false(ground);
}
virtual void operator()(table_base & t) {
void operator()(table_base & t) override {
auxiliary_table_filter_fn::operator()(t);
}
};
@ -1455,7 +1455,7 @@ namespace datalog {
: m_filter(filter), m_condition(condition, ctx.get_manager()),
m_removed_cols(removed_col_cnt, removed_cols) {}
virtual table_base* operator()(const table_base & tb) {
table_base* operator()(const table_base & tb) override {
table_base *t2 = tb.clone();
(*m_filter)(*t2);
if (!m_project) {
@ -1502,11 +1502,11 @@ namespace datalog {
default_table_negation_filter_fn(const table_base & tgt, const table_base & neg_t,
unsigned joined_col_cnt, const unsigned * t_cols, const unsigned * negated_cols)
: convenient_table_negation_filter_fn(tgt, neg_t, joined_col_cnt, t_cols, negated_cols),
m_negated_table(0) {
m_negated_table(nullptr) {
m_aux_fact.resize(neg_t.get_signature().size());
}
virtual bool should_remove(const table_fact & f) const {
bool should_remove(const table_fact & f) const override {
if(!m_all_neg_bound || m_overlap) {
table_base::iterator nit = m_negated_table->begin();
table_base::iterator nend = m_negated_table->end();
@ -1524,7 +1524,7 @@ namespace datalog {
}
}
virtual void operator()(table_base & tgt, const table_base & negated_table) {
void operator()(table_base & tgt, const table_base & negated_table) override {
SASSERT(m_negated_table==0);
flet<const table_base *> flet_neg_table(m_negated_table, &negated_table);
auxiliary_table_filter_fn::operator()(tgt);
@ -1568,7 +1568,7 @@ namespace datalog {
default_table_select_equal_and_project_fn(table_mutator_fn * filter, table_transformer_fn * project)
: m_filter(filter), m_project(project) {}
virtual table_base * operator()(const table_base & t1) {
table_base * operator()(const table_base & t1) override {
TRACE("dl", tout << t1.get_plugin().get_name() << "\n";);
scoped_rel<table_base> aux = t1.clone();
(*m_filter)(*aux);
@ -1603,12 +1603,12 @@ namespace datalog {
SASSERT(t.get_signature().functional_columns()>0);
table_plugin & plugin = t.get_plugin();
m_aux_table = plugin.mk_empty(t.get_signature());
m_union_fn = plugin.mk_union_fn(t, *m_aux_table, static_cast<table_base *>(0));
m_union_fn = plugin.mk_union_fn(t, *m_aux_table, static_cast<table_base *>(nullptr));
}
virtual ~default_table_map_fn() {}
~default_table_map_fn() override {}
virtual void operator()(table_base & t) {
void operator()(table_base & t) override {
SASSERT(t.get_signature()==m_aux_table->get_signature());
if(!m_aux_table->empty()) {
m_aux_table->reset();
@ -1625,7 +1625,7 @@ namespace datalog {
}
t.reset();
(*m_union_fn)(t, *m_aux_table, static_cast<table_base *>(0));
(*m_union_fn)(t, *m_aux_table, static_cast<table_base *>(nullptr));
}
};
@ -1664,7 +1664,7 @@ namespace datalog {
m_former_row.resize(get_result_signature().size());
}
virtual ~default_table_project_with_reduce_fn() {}
~default_table_project_with_reduce_fn() override {}
virtual void modify_fact(table_fact & f) const {
unsigned ofs=1;
@ -1693,7 +1693,7 @@ namespace datalog {
}
}
virtual table_base * operator()(const table_base & t) {
table_base * operator()(const table_base & t) override {
table_plugin & plugin = t.get_plugin();
const table_signature & res_sign = get_result_signature();
SASSERT(plugin.can_handle_signature(res_sign));

View file

@ -109,8 +109,8 @@ namespace datalog {
public:
relation_manager(context & ctx) :
m_context(ctx),
m_favourite_table_plugin(0),
m_favourite_relation_plugin(0),
m_favourite_table_plugin(nullptr),
m_favourite_relation_plugin(nullptr),
m_next_table_fid(0),
m_next_relation_fid(0) {}
@ -289,7 +289,7 @@ namespace datalog {
relation_transformer_fn * mk_permutation_rename_fn(const relation_base & t,
const unsigned * permutation);
relation_transformer_fn * mk_permutation_rename_fn(const relation_base & t,
const unsigned_vector permutation) {
const unsigned_vector & permutation) {
SASSERT(t.get_signature().size()==permutation.size());
return mk_permutation_rename_fn(t, permutation.c_ptr());
}
@ -331,7 +331,7 @@ namespace datalog {
const relation_base * delta);
relation_union_fn * mk_union_fn(const relation_base & tgt, const relation_base & src) {
return mk_union_fn(tgt, src, static_cast<relation_base *>(0));
return mk_union_fn(tgt, src, static_cast<relation_base *>(nullptr));
}
/**
@ -343,7 +343,7 @@ namespace datalog {
relation_mutator_fn * mk_filter_identical_fn(const relation_base & t, unsigned col_cnt,
const unsigned * identical_cols);
relation_mutator_fn * mk_filter_identical_fn(const relation_base & t, const unsigned_vector identical_cols) {
relation_mutator_fn * mk_filter_identical_fn(const relation_base & t, const unsigned_vector & identical_cols) {
return mk_filter_identical_fn(t, identical_cols.size(), identical_cols.c_ptr());
}
@ -468,7 +468,7 @@ namespace datalog {
of column number.
*/
table_transformer_fn * mk_permutation_rename_fn(const table_base & t, const unsigned * permutation);
table_transformer_fn * mk_permutation_rename_fn(const table_base & t, const unsigned_vector permutation) {
table_transformer_fn * mk_permutation_rename_fn(const table_base & t, const unsigned_vector & permutation) {
SASSERT(t.get_signature().size()==permutation.size());
return mk_permutation_rename_fn(t, permutation.c_ptr());
}
@ -510,7 +510,7 @@ namespace datalog {
const table_base * delta);
table_union_fn * mk_union_fn(const table_base & tgt, const table_base & src) {
return mk_union_fn(tgt, src, static_cast<table_base *>(0));
return mk_union_fn(tgt, src, static_cast<table_base *>(nullptr));
}
/**
@ -522,7 +522,7 @@ namespace datalog {
table_mutator_fn * mk_filter_identical_fn(const table_base & t, unsigned col_cnt,
const unsigned * identical_cols);
table_mutator_fn * mk_filter_identical_fn(const table_base & t, const unsigned_vector identical_cols) {
table_mutator_fn * mk_filter_identical_fn(const table_base & t, const unsigned_vector & identical_cols) {
return mk_filter_identical_fn(t, identical_cols.size(), identical_cols.c_ptr());
}
@ -609,7 +609,7 @@ namespace datalog {
std::string to_nice_string(const relation_element & el) const;
/**
This one may give a nicer representation of \c el than the
\c to_nice_string(const relation_element & el) function, by unsing the information about the sort
\c to_nice_string(const relation_element & el) function, by using the information about the sort
of the element.
*/
std::string to_nice_string(const relation_sort & s, const relation_element & el) const;

View file

@ -67,7 +67,7 @@ namespace datalog {
}
relation_base * sieve_relation::complement(func_decl* p) const {
//this is not precisely a complement, because we still treat the ignored collumns as
//this is not precisely a complement, because we still treat the ignored columns as
//full, but it should give reasonable results inside the product relation
relation_base * new_inner = get_inner().complement(p);
return get_plugin().mk_from_inner(get_signature(), m_inner_cols.c_ptr(), new_inner);
@ -226,7 +226,7 @@ namespace datalog {
relation_base * sieve_relation_plugin::mk_empty(const relation_signature & s) {
UNREACHABLE();
return 0;
return nullptr;
#if 0
svector<bool> inner_cols(s.size());
extract_inner_columns(s, inner_cols.c_ptr());
@ -278,8 +278,8 @@ namespace datalog {
m_inner_join_fun(inner_join_fun) {
bool r1_sieved = r1.get_plugin().is_sieve_relation();
bool r2_sieved = r2.get_plugin().is_sieve_relation();
const sieve_relation * sr1 = r1_sieved ? static_cast<const sieve_relation *>(&r1) : 0;
const sieve_relation * sr2 = r2_sieved ? static_cast<const sieve_relation *>(&r2) : 0;
const sieve_relation * sr1 = r1_sieved ? static_cast<const sieve_relation *>(&r1) : nullptr;
const sieve_relation * sr2 = r2_sieved ? static_cast<const sieve_relation *>(&r2) : nullptr;
if(r1_sieved) {
m_result_inner_cols.append(sr1->m_inner_cols);
}
@ -294,12 +294,12 @@ namespace datalog {
}
}
virtual relation_base * operator()(const relation_base & r1, const relation_base & r2) {
relation_base * operator()(const relation_base & r1, const relation_base & r2) override {
bool r1_sieved = r1.get_plugin().is_sieve_relation();
bool r2_sieved = r2.get_plugin().is_sieve_relation();
SASSERT(r1_sieved || r2_sieved);
const sieve_relation * sr1 = r1_sieved ? static_cast<const sieve_relation *>(&r1) : 0;
const sieve_relation * sr2 = r2_sieved ? static_cast<const sieve_relation *>(&r2) : 0;
const sieve_relation * sr1 = r1_sieved ? static_cast<const sieve_relation *>(&r1) : nullptr;
const sieve_relation * sr2 = r2_sieved ? static_cast<const sieve_relation *>(&r2) : nullptr;
const relation_base & inner1 = r1_sieved ? sr1->get_inner() : r1;
const relation_base & inner2 = r2_sieved ? sr2->get_inner() : r2;
@ -313,12 +313,12 @@ namespace datalog {
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) {
if( &r1.get_plugin()!=this && &r2.get_plugin()!=this ) {
//we create just operations that involve the current plugin
return 0;
return nullptr;
}
bool r1_sieved = r1.get_plugin().is_sieve_relation();
bool r2_sieved = r2.get_plugin().is_sieve_relation();
const sieve_relation * sr1 = r1_sieved ? static_cast<const sieve_relation *>(&r1) : 0;
const sieve_relation * sr2 = r2_sieved ? static_cast<const sieve_relation *>(&r2) : 0;
const sieve_relation * sr1 = r1_sieved ? static_cast<const sieve_relation *>(&r1) : nullptr;
const sieve_relation * sr2 = r2_sieved ? static_cast<const sieve_relation *>(&r2) : nullptr;
const relation_base & inner1 = r1_sieved ? sr1->get_inner() : r1;
const relation_base & inner2 = r2_sieved ? sr2->get_inner() : r2;
@ -340,7 +340,7 @@ namespace datalog {
relation_join_fn * inner_join_fun = get_manager().mk_join_fn(inner1, inner2, inner_cols1, inner_cols2, false);
if(!inner_join_fun) {
return 0;
return nullptr;
}
return alloc(join_fn, *this, r1, r2, col_cnt, cols1, cols2, inner_join_fun);
}
@ -357,7 +357,7 @@ namespace datalog {
get_result_signature() = result_sig;
}
virtual relation_base * operator()(const relation_base & r0) {
relation_base * operator()(const relation_base & r0) override {
SASSERT(r0.get_plugin().is_sieve_relation());
const sieve_relation & r = static_cast<const sieve_relation &>(r0);
sieve_relation_plugin & plugin = r.get_plugin();
@ -371,7 +371,7 @@ namespace datalog {
relation_transformer_fn * sieve_relation_plugin::mk_project_fn(const relation_base & r0, unsigned col_cnt,
const unsigned * removed_cols) {
if(&r0.get_plugin()!=this) {
return 0;
return nullptr;
}
const sieve_relation & r = static_cast<const sieve_relation &>(r0);
unsigned_vector inner_removed_cols;
@ -398,7 +398,7 @@ namespace datalog {
}
if(!inner_fun) {
return 0;
return nullptr;
}
return alloc(transformer_fn, inner_fun, result_sig, result_inner_cols.c_ptr());
}
@ -406,7 +406,7 @@ namespace datalog {
relation_transformer_fn * sieve_relation_plugin::mk_rename_fn(const relation_base & r0,
unsigned cycle_len, const unsigned * permutation_cycle) {
if(&r0.get_plugin()!=this) {
return 0;
return nullptr;
}
const sieve_relation & r = static_cast<const sieve_relation &>(r0);
@ -428,7 +428,7 @@ namespace datalog {
relation_transformer_fn * inner_fun =
get_manager().mk_permutation_rename_fn(r.get_inner(), inner_permutation);
if(!inner_fun) {
return 0;
return nullptr;
}
return alloc(transformer_fn, inner_fun, result_sig, result_inner_cols.c_ptr());
}
@ -439,13 +439,13 @@ namespace datalog {
public:
union_fn(relation_union_fn * union_fun) : m_union_fun(union_fun) {}
virtual void operator()(relation_base & tgt, const relation_base & src, relation_base * delta) {
void operator()(relation_base & tgt, const relation_base & src, relation_base * delta) override {
bool tgt_sieved = tgt.get_plugin().is_sieve_relation();
bool src_sieved = src.get_plugin().is_sieve_relation();
bool delta_sieved = delta && delta->get_plugin().is_sieve_relation();
sieve_relation * stgt = tgt_sieved ? static_cast<sieve_relation *>(&tgt) : 0;
const sieve_relation * ssrc = src_sieved ? static_cast<const sieve_relation *>(&src) : 0;
sieve_relation * sdelta = delta_sieved ? static_cast<sieve_relation *>(delta) : 0;
sieve_relation * stgt = tgt_sieved ? static_cast<sieve_relation *>(&tgt) : nullptr;
const sieve_relation * ssrc = src_sieved ? static_cast<const sieve_relation *>(&src) : nullptr;
sieve_relation * sdelta = delta_sieved ? static_cast<sieve_relation *>(delta) : nullptr;
relation_base & itgt = tgt_sieved ? stgt->get_inner() : tgt;
const relation_base & isrc = src_sieved ? ssrc->get_inner() : src;
relation_base * idelta = delta_sieved ? &sdelta->get_inner() : delta;
@ -458,15 +458,15 @@ namespace datalog {
const relation_base * delta) {
if(&tgt.get_plugin()!=this && &src.get_plugin()!=this && (delta && &delta->get_plugin()!=this)) {
//we create the operation only if it involves this plugin
return 0;
return nullptr;
}
bool tgt_sieved = tgt.get_plugin().is_sieve_relation();
bool src_sieved = src.get_plugin().is_sieve_relation();
bool delta_sieved = delta && delta->get_plugin().is_sieve_relation();
const sieve_relation * stgt = tgt_sieved ? static_cast<const sieve_relation *>(&tgt) : 0;
const sieve_relation * ssrc = src_sieved ? static_cast<const sieve_relation *>(&src) : 0;
const sieve_relation * sdelta = delta_sieved ? static_cast<const sieve_relation *>(delta) : 0;
const sieve_relation * stgt = tgt_sieved ? static_cast<const sieve_relation *>(&tgt) : nullptr;
const sieve_relation * ssrc = src_sieved ? static_cast<const sieve_relation *>(&src) : nullptr;
const sieve_relation * sdelta = delta_sieved ? static_cast<const sieve_relation *>(delta) : nullptr;
const relation_base & itgt = tgt_sieved ? stgt->get_inner() : tgt;
const relation_base & isrc = src_sieved ? ssrc->get_inner() : src;
const relation_base * idelta = delta_sieved ? &sdelta->get_inner() : delta;
@ -476,7 +476,7 @@ namespace datalog {
if( tgt_sieved && src_sieved && (!delta || delta_sieved) ) {
if( !vectors_equal(stgt->m_inner_cols, ssrc->m_inner_cols)
|| (delta && !vectors_equal(stgt->m_inner_cols, sdelta->m_inner_cols)) ) {
return 0;
return nullptr;
}
}
else {
@ -485,13 +485,13 @@ namespace datalog {
|| (sdelta && !sdelta->no_sieved_columns()) ) {
//We have an unsieved relation and then some relation with some sieved columns,
//which means there is an misalignment.
return 0;
return nullptr;
}
}
relation_union_fn * union_fun = get_manager().mk_union_fn(itgt, isrc, idelta);
if(!union_fun) {
return 0;
return nullptr;
}
return alloc(union_fn, union_fun);
@ -504,7 +504,7 @@ namespace datalog {
filter_fn(relation_mutator_fn * inner_fun)
: m_inner_fun(inner_fun) {}
virtual void operator()(relation_base & r0) {
void operator()(relation_base & r0) override {
SASSERT(r0.get_plugin().is_sieve_relation());
sieve_relation & r = static_cast<sieve_relation &>(r0);
@ -515,7 +515,7 @@ namespace datalog {
relation_mutator_fn * sieve_relation_plugin::mk_filter_identical_fn(const relation_base & r0,
unsigned col_cnt, const unsigned * identical_cols) {
if(&r0.get_plugin()!=this) {
return 0;
return nullptr;
}
const sieve_relation & r = static_cast<const sieve_relation &>(r0);
unsigned_vector inner_icols;
@ -534,7 +534,7 @@ namespace datalog {
relation_mutator_fn * inner_fun = get_manager().mk_filter_identical_fn(r.get_inner(), inner_icols);
if(!inner_fun) {
return 0;
return nullptr;
}
return alloc(filter_fn, inner_fun);
}
@ -542,7 +542,7 @@ namespace datalog {
relation_mutator_fn * sieve_relation_plugin::mk_filter_equal_fn(const relation_base & r0,
const relation_element & value, unsigned col) {
if(&r0.get_plugin()!=this) {
return 0;
return nullptr;
}
const sieve_relation & r = static_cast<const sieve_relation &>(r0);
if(!r.is_inner_col(col)) {
@ -553,7 +553,7 @@ namespace datalog {
relation_mutator_fn * inner_fun = get_manager().mk_filter_equal_fn(r.get_inner(), value, inner_col);
if(!inner_fun) {
return 0;
return nullptr;
}
return alloc(filter_fn, inner_fun);
}
@ -561,7 +561,7 @@ namespace datalog {
relation_mutator_fn * sieve_relation_plugin::mk_filter_interpreted_fn(const relation_base & rb,
app * condition) {
if(&rb.get_plugin()!=this) {
return 0;
return nullptr;
}
ast_manager & m = get_ast_manager();
const sieve_relation & r = static_cast<const sieve_relation &>(rb);
@ -589,7 +589,7 @@ namespace datalog {
relation_mutator_fn * inner_fun = get_manager().mk_filter_interpreted_fn(r.get_inner(), to_app(inner_cond));
if(!inner_fun) {
return 0;
return nullptr;
}
return alloc(filter_fn, inner_fun);
}
@ -600,12 +600,12 @@ namespace datalog {
negation_filter_fn(relation_intersection_filter_fn * inner_fun)
: m_inner_fun(inner_fun) {}
virtual void operator()(relation_base & r, const relation_base & neg) {
void operator()(relation_base & r, const relation_base & neg) override {
bool r_sieved = r.get_plugin().is_sieve_relation();
bool neg_sieved = neg.get_plugin().is_sieve_relation();
SASSERT(r_sieved || neg_sieved);
sieve_relation * sr = r_sieved ? static_cast<sieve_relation *>(&r) : 0;
const sieve_relation * sneg = neg_sieved ? static_cast<const sieve_relation *>(&neg) : 0;
sieve_relation * sr = r_sieved ? static_cast<sieve_relation *>(&r) : nullptr;
const sieve_relation * sneg = neg_sieved ? static_cast<const sieve_relation *>(&neg) : nullptr;
relation_base & inner_r = r_sieved ? sr->get_inner() : r;
const relation_base & inner_neg = neg_sieved ? sneg->get_inner() : neg;
@ -618,13 +618,13 @@ namespace datalog {
const unsigned * neg_cols) {
if(&r.get_plugin()!=this && &neg.get_plugin()!=this) {
//we create just operations that involve the current plugin
return 0;
return nullptr;
}
bool r_sieved = r.get_plugin().is_sieve_relation();
bool neg_sieved = neg.get_plugin().is_sieve_relation();
SASSERT(r_sieved || neg_sieved);
const sieve_relation * sr = r_sieved ? static_cast<const sieve_relation *>(&r) : 0;
const sieve_relation * sneg = neg_sieved ? static_cast<const sieve_relation *>(&neg) : 0;
const sieve_relation * sr = r_sieved ? static_cast<const sieve_relation *>(&r) : nullptr;
const sieve_relation * sneg = neg_sieved ? static_cast<const sieve_relation *>(&neg) : nullptr;
const relation_base & inner_r = r_sieved ? sr->get_inner() : r;
const relation_base & inner_neg = neg_sieved ? sneg->get_inner() : neg;
@ -657,7 +657,7 @@ namespace datalog {
relation_intersection_filter_fn * inner_fun =
get_manager().mk_filter_by_negation_fn(inner_r, inner_neg, ir_cols, ineg_cols);
if(!inner_fun) {
return 0;
return nullptr;
}
return alloc(negation_filter_fn, inner_fun);
}

View file

@ -85,7 +85,7 @@ namespace datalog {
sieve_relation_plugin(relation_manager & manager);
virtual void initialize(family_id fid);
void initialize(family_id fid) override;
family_id get_relation_kind(const relation_signature & sig, const bool * inner_columns,
family_id inner_kind);
@ -95,20 +95,20 @@ namespace datalog {
return get_relation_kind(sig, inner_columns.c_ptr(), inner_kind);
}
virtual bool can_handle_signature(const relation_signature & s);
bool can_handle_signature(const relation_signature & s) override;
virtual relation_base * mk_empty(const relation_signature & s);
relation_base * mk_empty(const relation_signature & s) override;
sieve_relation * mk_empty(const sieve_relation & original);
virtual relation_base * mk_empty(const relation_base & original);
virtual relation_base * mk_empty(const relation_signature & s, family_id kind);
relation_base * mk_empty(const relation_base & original) override;
relation_base * mk_empty(const relation_signature & s, family_id kind) override;
sieve_relation * mk_empty(const relation_signature & s, relation_plugin & inner_plugin);
virtual relation_base * mk_full(func_decl* p, const relation_signature & s);
relation_base * mk_full(func_decl* p, const relation_signature & s) override;
sieve_relation * full(func_decl* p, const relation_signature & s, relation_plugin & inner_plugin);
sieve_relation * mk_from_inner(const relation_signature & s, const bool * inner_columns,
relation_base * inner_rel);
sieve_relation * mk_from_inner(const relation_signature & s, const svector<bool> inner_columns,
sieve_relation * mk_from_inner(const relation_signature & s, const svector<bool> & inner_columns,
relation_base * inner_rel) {
SASSERT(inner_columns.size()==s.size());
return mk_from_inner(s, inner_columns.c_ptr(), inner_rel);
@ -116,22 +116,22 @@ namespace datalog {
protected:
virtual relation_join_fn * mk_join_fn(const relation_base & t1, const relation_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2);
virtual relation_transformer_fn * mk_project_fn(const relation_base & t, unsigned col_cnt,
const unsigned * removed_cols);
virtual relation_transformer_fn * mk_rename_fn(const relation_base & t, unsigned permutation_cycle_len,
const unsigned * permutation_cycle);
virtual relation_union_fn * mk_union_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta);
virtual relation_mutator_fn * mk_filter_identical_fn(const relation_base & t, unsigned col_cnt,
const unsigned * identical_cols);
virtual relation_mutator_fn * mk_filter_equal_fn(const relation_base & t, const relation_element & value,
unsigned col);
virtual relation_mutator_fn * mk_filter_interpreted_fn(const relation_base & t, app * condition);
virtual relation_intersection_filter_fn * mk_filter_by_negation_fn(const relation_base & t,
const relation_base & negated_obj, unsigned joined_col_cnt,
const unsigned * t_cols, const unsigned * negated_cols);
relation_join_fn * mk_join_fn(const relation_base & t1, const relation_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) override;
relation_transformer_fn * mk_project_fn(const relation_base & t, unsigned col_cnt,
const unsigned * removed_cols) override;
relation_transformer_fn * mk_rename_fn(const relation_base & t, unsigned permutation_cycle_len,
const unsigned * permutation_cycle) override;
relation_union_fn * mk_union_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta) override;
relation_mutator_fn * mk_filter_identical_fn(const relation_base & t, unsigned col_cnt,
const unsigned * identical_cols) override;
relation_mutator_fn * mk_filter_equal_fn(const relation_base & t, const relation_element & value,
unsigned col) override;
relation_mutator_fn * mk_filter_interpreted_fn(const relation_base & t, app * condition) override;
relation_intersection_filter_fn * mk_filter_by_negation_fn(const relation_base & t,
const relation_base & negated_obj, unsigned joined_col_cnt,
const unsigned * t_cols, const unsigned * negated_cols) override;
};
@ -176,18 +176,18 @@ namespace datalog {
relation_base & get_inner() { return *m_inner; }
const relation_base & get_inner() const { return *m_inner; }
virtual void add_fact(const relation_fact & f);
virtual bool contains_fact(const relation_fact & f) const;
virtual sieve_relation * clone() const;
virtual relation_base * complement(func_decl*p) const;
virtual void to_formula(expr_ref& fml) const;
void add_fact(const relation_fact & f) override;
bool contains_fact(const relation_fact & f) const override;
sieve_relation * clone() const override;
relation_base * complement(func_decl*p) const override;
void to_formula(expr_ref& fml) const override;
virtual bool empty() const { return get_inner().empty(); }
virtual void reset() { get_inner().reset(); }
virtual unsigned get_size_estimate_rows() const { return get_inner().get_size_estimate_rows(); }
virtual unsigned get_size_estimate_bytes() const { return get_inner().get_size_estimate_bytes(); }
bool empty() const override { return get_inner().empty(); }
void reset() override { get_inner().reset(); }
unsigned get_size_estimate_rows() const override { return get_inner().get_size_estimate_rows(); }
unsigned get_size_estimate_bytes() const override { return get_inner().get_size_estimate_bytes(); }
virtual void display(std::ostream & out) const;
void display(std::ostream & out) const override;
};

View file

@ -198,7 +198,7 @@ namespace datalog {
row_interface(t),
m_parent(parent) {}
virtual table_element operator[](unsigned col) const {
table_element operator[](unsigned col) const override {
return m_parent.m_layout.get(m_parent.m_ptr, col);
}
@ -218,15 +218,15 @@ namespace datalog {
m_row_obj(t, *this),
m_layout(t.m_column_layout) {}
virtual bool is_finished() const {
bool is_finished() const override {
return m_ptr == m_end;
}
virtual row_interface & operator*() {
row_interface & operator*() override {
SASSERT(!is_finished());
return m_row_obj;
}
virtual void operator++() {
void operator++() override {
SASSERT(!is_finished());
m_ptr+=m_fact_size;
}
@ -257,8 +257,8 @@ namespace datalog {
\brief Empty result.
*/
query_result() : m_singleton(false) {
m_many.begin = 0;
m_many.end = 0;
m_many.begin = nullptr;
m_many.end = nullptr;
}
query_result(offset_iterator begin, offset_iterator end) : m_singleton(false) {
m_many.begin = begin;
@ -312,7 +312,7 @@ namespace datalog {
m_keys(key_len*sizeof(table_element)),
m_first_nonindexed(0) {}
virtual void update(const sparse_table & t) {
void update(const sparse_table & t) override {
if (m_first_nonindexed == t.m_data.after_last_offset()) {
return;
}
@ -327,7 +327,7 @@ namespace datalog {
key_value key;
key.resize(key_len);
offset_vector * index_entry = 0;
offset_vector * index_entry = nullptr;
bool key_modified = true;
for (; ofs!=after_last; ofs+=t.m_fact_size) {
@ -351,7 +351,7 @@ namespace datalog {
m_first_nonindexed = t.m_data.after_last_offset();
}
virtual query_result get_matching_offsets(const key_value & key) const {
query_result get_matching_offsets(const key_value & key) const override {
key_to_reserve(key);
store_offset ofs;
if (!m_keys.find_reserve_content(ofs)) {
@ -406,9 +406,9 @@ namespace datalog {
m_key_fact.resize(t.get_signature().size());
}
virtual ~full_signature_key_indexer() {}
~full_signature_key_indexer() override {}
virtual query_result get_matching_offsets(const key_value & key) const {
query_result get_matching_offsets(const key_value & key) const override {
unsigned key_len = m_key_cols.size();
for (unsigned i=0; i<key_len; i++) {
m_key_fact[m_permutation[i]] = key[i];
@ -473,7 +473,7 @@ namespace datalog {
#endif
key_spec kspec;
kspec.append(key_len, key_cols);
key_index_map::entry * key_map_entry = m_key_indexes.insert_if_not_there2(kspec, 0);
key_index_map::entry * key_map_entry = m_key_indexes.insert_if_not_there2(kspec, nullptr);
if (!key_map_entry->get_data().m_value) {
if (full_signature_key_indexer::can_handle(key_len, key_cols, *this)) {
key_map_entry->get_data().m_value = alloc(full_signature_key_indexer, key_len, key_cols, *this);
@ -777,9 +777,9 @@ namespace datalog {
const table_signature & sig = t->get_signature();
t->reset();
table_pool::entry * e = m_pool.insert_if_not_there2(sig, 0);
table_pool::entry * e = m_pool.insert_if_not_there2(sig, nullptr);
sp_table_vector * & vect = e->get_data().m_value;
if (vect == 0) {
if (vect == nullptr) {
vect = alloc(sp_table_vector);
}
IF_VERBOSE(12, verbose_stream() << "Recycle: " << t->get_size_estimate_bytes() << "\n";);
@ -826,7 +826,7 @@ namespace datalog {
m_removed_cols.push_back(UINT_MAX);
}
virtual table_base * operator()(const table_base & tb1, const table_base & tb2) {
table_base * operator()(const table_base & tb1, const table_base & tb2) override {
const sparse_table & t1 = get(tb1);
const sparse_table & t2 = get(tb2);
@ -859,9 +859,9 @@ namespace datalog {
if (t1.get_kind()!=get_kind() || t2.get_kind()!=get_kind()
|| join_involves_functional(sig1, sig2, col_cnt, cols1, cols2)) {
//We also don't allow indexes on functional columns (and they are needed for joins)
return 0;
return nullptr;
}
return mk_join_project_fn(t1, t2, col_cnt, cols1, cols2, 0, static_cast<unsigned*>(0));
return mk_join_project_fn(t1, t2, col_cnt, cols1, cols2, 0, static_cast<unsigned*>(nullptr));
}
table_join_fn * sparse_table_plugin::mk_join_project_fn(const table_base & t1, const table_base & t2,
@ -874,7 +874,7 @@ namespace datalog {
|| join_involves_functional(sig1, sig2, col_cnt, cols1, cols2)) {
//We don't allow sparse tables with zero signatures (and project on all columns leads to such)
//We also don't allow indexes on functional columns.
return 0;
return nullptr;
}
return alloc(join_project_fn, t1.get_signature(), t2.get_signature(), col_cnt, cols1, cols2,
removed_col_cnt, removed_cols);
@ -882,7 +882,7 @@ namespace datalog {
class sparse_table_plugin::union_fn : public table_union_fn {
public:
virtual void operator()(table_base & tgt0, const table_base & src0, table_base * delta0) {
void operator()(table_base & tgt0, const table_base & src0, table_base * delta0) override {
verbose_action _va("union");
sparse_table & tgt = get(tgt0);
const sparse_table & src = get(src0);
@ -905,7 +905,7 @@ namespace datalog {
|| (delta && delta->get_kind()!=get_kind())
|| tgt.get_signature()!=src.get_signature()
|| (delta && delta->get_signature()!=tgt.get_signature())) {
return 0;
return nullptr;
}
return alloc(union_fn);
}
@ -941,7 +941,7 @@ namespace datalog {
SASSERT(r_idx == m_removed_col_cnt);
}
virtual table_base * operator()(const table_base & tb) {
table_base * operator()(const table_base & tb) override {
verbose_action _va("project");
const sparse_table & t = get(tb);
@ -969,7 +969,7 @@ namespace datalog {
table_transformer_fn * sparse_table_plugin::mk_project_fn(const table_base & t, unsigned col_cnt,
const unsigned * removed_cols) {
if (col_cnt == t.get_signature().size()) {
return 0;
return nullptr;
}
return alloc(project_fn, t.get_signature(), col_cnt, removed_cols);
}
@ -985,7 +985,7 @@ namespace datalog {
m_key.push_back(val);
}
virtual table_base * operator()(const table_base & tb) {
table_base * operator()(const table_base & tb) override {
verbose_action _va("select_equal_and_project");
const sparse_table & t = get(tb);
@ -1032,7 +1032,7 @@ namespace datalog {
//column table produces one).
//We also don't allow indexes on functional columns. And our implementation of
//select_equal_and_project uses index on \c col.
return 0;
return nullptr;
}
return alloc(select_equal_and_project_fn, t.get_signature(), value, col);
}
@ -1072,7 +1072,7 @@ namespace datalog {
}
}
virtual table_base * operator()(const table_base & tb) {
table_base * operator()(const table_base & tb) override {
verbose_action _va("rename");
const sparse_table & t = get(tb);
@ -1113,7 +1113,7 @@ namespace datalog {
table_transformer_fn * sparse_table_plugin::mk_rename_fn(const table_base & t, unsigned permutation_cycle_len,
const unsigned * permutation_cycle) {
if (t.get_kind()!=get_kind()) {
return 0;
return nullptr;
}
return alloc(rename_fn, t.get_signature(), permutation_cycle_len, permutation_cycle);
}
@ -1210,7 +1210,7 @@ namespace datalog {
}
}
virtual void operator()(table_base & tgt0, const table_base & neg0) {
void operator()(table_base & tgt0, const table_base & neg0) override {
sparse_table & tgt = get(tgt0);
const sparse_table & neg = get(neg0);
@ -1252,7 +1252,7 @@ namespace datalog {
if (!check_kind(t) || !check_kind(negated_obj)
|| join_involves_functional(t.get_signature(), negated_obj.get_signature(), joined_col_cnt,
t_cols, negated_cols) ) {
return 0;
return nullptr;
}
return alloc(negation_filter_fn, t, negated_obj, joined_col_cnt, t_cols, negated_cols);
}
@ -1310,7 +1310,7 @@ namespace datalog {
m_s2_cols.append(src2_cols);
}
virtual void operator()(table_base & _t, const table_base & _s1, const table_base& _s2) {
void operator()(table_base & _t, const table_base & _s1, const table_base& _s2) override {
verbose_action _va("negated_join");
sparse_table& t = get(_t);
@ -1394,7 +1394,7 @@ namespace datalog {
return alloc(negated_join_fn, src1, t_cols, src_cols, src1_cols, src2_cols);
}
else {
return 0;
return nullptr;
}
}

View file

@ -69,39 +69,39 @@ namespace datalog {
typedef sparse_table table;
sparse_table_plugin(relation_manager & manager);
~sparse_table_plugin();
~sparse_table_plugin() override;
virtual bool can_handle_signature(const table_signature & s)
bool can_handle_signature(const table_signature & s) override
{ return s.size()>0; }
virtual table_base * mk_empty(const table_signature & s);
table_base * mk_empty(const table_signature & s) override;
sparse_table * mk_clone(const sparse_table & t);
protected:
virtual table_join_fn * mk_join_fn(const table_base & t1, const table_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2);
virtual table_join_fn * mk_join_project_fn(const table_base & t1, const table_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2, unsigned removed_col_cnt,
const unsigned * removed_cols);
virtual table_union_fn * mk_union_fn(const table_base & tgt, const table_base & src,
const table_base * delta);
virtual table_transformer_fn * mk_project_fn(const table_base & t, unsigned col_cnt,
const unsigned * removed_cols);
virtual table_transformer_fn * mk_rename_fn(const table_base & t, unsigned permutation_cycle_len,
const unsigned * permutation_cycle);
virtual table_transformer_fn * mk_select_equal_and_project_fn(const table_base & t,
const table_element & value, unsigned col);
virtual table_intersection_filter_fn * mk_filter_by_negation_fn(const table_base & t,
const table_base & negated_obj, unsigned joined_col_cnt,
const unsigned * t_cols, const unsigned * negated_cols);
virtual table_intersection_join_filter_fn* mk_filter_by_negated_join_fn(
const table_base & t,
const table_base & src1,
const table_base & src2,
table_join_fn * mk_join_fn(const table_base & t1, const table_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) override;
table_join_fn * mk_join_project_fn(const table_base & t1, const table_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2, unsigned removed_col_cnt,
const unsigned * removed_cols) override;
table_union_fn * mk_union_fn(const table_base & tgt, const table_base & src,
const table_base * delta) override;
table_transformer_fn * mk_project_fn(const table_base & t, unsigned col_cnt,
const unsigned * removed_cols) override;
table_transformer_fn * mk_rename_fn(const table_base & t, unsigned permutation_cycle_len,
const unsigned * permutation_cycle) override;
table_transformer_fn * mk_select_equal_and_project_fn(const table_base & t,
const table_element & value, unsigned col) override;
table_intersection_filter_fn * mk_filter_by_negation_fn(const table_base & t,
const table_base & negated_obj, unsigned joined_col_cnt,
const unsigned * t_cols, const unsigned * negated_cols) override;
table_intersection_join_filter_fn* mk_filter_by_negated_join_fn(
const table_base & t,
const table_base & src1,
const table_base & src2,
unsigned_vector const& t_cols,
unsigned_vector const& src_cols,
unsigned_vector const& src1_cols,
unsigned_vector const& src2_cols);
unsigned_vector const& src2_cols) override;
static sparse_table const& get(table_base const&);
static sparse_table& get(table_base&);
@ -424,7 +424,7 @@ namespace datalog {
/**
\c array \c removed_cols contains column indexes to be removed in ascending order and
is terminated by a number greated than the highest column index of a join the the two tables.
is terminated by a number greater than the highest column index of a join the two tables.
This is to simplify the traversal of the array when building facts.
*/
static void concatenate_rows(const column_layout & layout1, const column_layout & layout2,
@ -436,7 +436,7 @@ namespace datalog {
columns from t2 using indexing.
\c array \c removed_cols contains column indexes to be removed in ascending order and
is terminated by a number greated than the highest column index of a join the the two tables.
is terminated by a number greater than the highest column index of a join the two tables.
This is to simplify the traversal of the array when building facts.
\c tables_swapped value means that the resulting facts should contain facts from t2 first,
@ -463,10 +463,10 @@ namespace datalog {
sparse_table(sparse_table_plugin & p, const table_signature & sig, unsigned init_capacity=0);
sparse_table(const sparse_table & t);
virtual ~sparse_table();
~sparse_table() override;
public:
virtual void deallocate() {
void deallocate() override {
get_plugin().recycle(this);
}
@ -475,22 +475,22 @@ namespace datalog {
sparse_table_plugin & get_plugin() const
{ return static_cast<sparse_table_plugin &>(table_base::get_plugin()); }
virtual bool empty() const { return row_count()==0; }
virtual void add_fact(const table_fact & f);
virtual bool contains_fact(const table_fact & f) const;
virtual bool fetch_fact(table_fact & f) const;
virtual void ensure_fact(const table_fact & f);
virtual void remove_fact(const table_element* fact);
virtual void reset();
bool empty() const override { return row_count()==0; }
void add_fact(const table_fact & f) override;
bool contains_fact(const table_fact & f) const override;
bool fetch_fact(table_fact & f) const override;
void ensure_fact(const table_fact & f) override;
void remove_fact(const table_element* fact) override;
void reset() override;
virtual table_base * clone() const;
table_base * clone() const override;
virtual table_base::iterator begin() const;
virtual table_base::iterator end() const;
table_base::iterator begin() const override;
table_base::iterator end() const override;
virtual unsigned get_size_estimate_rows() const { return row_count(); }
virtual unsigned get_size_estimate_bytes() const;
virtual bool knows_exact_size() const { return true; }
unsigned get_size_estimate_rows() const override { return row_count(); }
unsigned get_size_estimate_bytes() const override;
bool knows_exact_size() const override { return true; }
};
};

View file

@ -43,7 +43,7 @@ namespace datalog {
: convenient_table_join_fn(t1_sig, t2_sig, col_cnt, cols1, cols2),
m_joined_col_cnt(col_cnt) {}
virtual table_base * operator()(const table_base & t1, const table_base & t2) {
table_base * operator()(const table_base & t1, const table_base & t2) override {
const hashtable_table & ht1 = static_cast<const hashtable_table &>(t1);
const hashtable_table & ht2 = static_cast<const hashtable_table &>(t2);
@ -89,7 +89,7 @@ namespace datalog {
table_join_fn * hashtable_table_plugin::mk_join_fn(const table_base & t1, const table_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) {
if(t1.get_kind()!=get_kind() || t2.get_kind()!=get_kind()) {
return 0;
return nullptr;
}
return alloc(join_fn, t1.get_signature(), t2.get_signature(), col_cnt, cols1, cols2);
}
@ -105,10 +105,10 @@ namespace datalog {
public:
our_row(const our_iterator_core & parent) : row_interface(parent.m_parent), m_parent(parent) {}
virtual void get_fact(table_fact & result) const {
void get_fact(table_fact & result) const override {
result = *m_parent.m_inner;
}
virtual table_element operator[](unsigned col) const {
table_element operator[](unsigned col) const override {
return (*m_parent.m_inner)[col];
}
@ -121,15 +121,15 @@ namespace datalog {
m_parent(t), m_inner(finished ? t.m_data.end() : t.m_data.begin()),
m_end(t.m_data.end()), m_row_obj(*this) {}
virtual bool is_finished() const {
bool is_finished() const override {
return m_inner==m_end;
}
virtual row_interface & operator*() {
row_interface & operator*() override {
SASSERT(!is_finished());
return m_row_obj;
}
virtual void operator++() {
void operator++() override {
SASSERT(!is_finished());
++m_inner;
}
@ -192,7 +192,7 @@ namespace datalog {
const bv_iterator& m_parent;
public:
our_row(const bv_iterator & p) : caching_row_interface(p.m_bv), m_parent(p) {}
virtual void get_fact(table_fact& result) const {
void get_fact(table_fact& result) const override {
if (result.size() < size()) {
result.resize(size(), 0);
}
@ -210,15 +210,15 @@ namespace datalog {
}
}
virtual bool is_finished() const {
bool is_finished() const override {
return m_offset == m_bv.m_bv.size();
}
virtual row_interface & operator*() {
row_interface & operator*() override {
SASSERT(!is_finished());
return m_row_obj;
}
virtual void operator++() {
void operator++() override {
SASSERT(!is_finished());
++m_offset;
while (!is_finished() && !m_bv.m_bv.get(m_offset)) {

View file

@ -61,10 +61,10 @@ namespace datalog {
hashtable_table_plugin(relation_manager & manager)
: table_plugin(symbol("hashtable"), manager) {}
virtual table_base * mk_empty(const table_signature & s);
table_base * mk_empty(const table_signature & s) override;
virtual table_join_fn * mk_join_fn(const table_base & t1, const table_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2);
table_join_fn * mk_join_fn(const table_base & t1, const table_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) override;
};
class hashtable_table : public table_base {
@ -84,23 +84,23 @@ namespace datalog {
hashtable_table_plugin & get_plugin() const
{ return static_cast<hashtable_table_plugin &>(table_base::get_plugin()); }
virtual void add_fact(const table_fact & f) {
void add_fact(const table_fact & f) override {
m_data.insert(f);
}
virtual void remove_fact(const table_element* fact) {
void remove_fact(const table_element* fact) override {
table_fact f(get_signature().size(), fact);
m_data.remove(f);
}
virtual bool contains_fact(const table_fact & f) const {
bool contains_fact(const table_fact & f) const override {
return m_data.contains(f);
}
virtual iterator begin() const;
virtual iterator end() const;
iterator begin() const override;
iterator end() const override;
virtual unsigned get_size_estimate_rows() const { return m_data.size(); }
virtual unsigned get_size_estimate_bytes() const { return m_data.size()*get_signature().size()*8; }
virtual bool knows_exact_size() const { return true; }
unsigned get_size_estimate_rows() const override { return m_data.size(); }
unsigned get_size_estimate_bytes() const override { return m_data.size()*get_signature().size()*8; }
bool knows_exact_size() const override { return true; }
};
// -----------------------------------
@ -118,9 +118,9 @@ namespace datalog {
bitvector_table_plugin(relation_manager & manager)
: table_plugin(symbol("bitvector"), manager) {}
virtual bool can_handle_signature(const table_signature & s);
bool can_handle_signature(const table_signature & s) override;
virtual table_base * mk_empty(const table_signature & s);
table_base * mk_empty(const table_signature & s) override;
};
class bitvector_table : public table_base {
@ -137,11 +137,11 @@ namespace datalog {
bitvector_table(bitvector_table_plugin & plugin, const table_signature & sig);
public:
virtual void add_fact(const table_fact & f);
virtual void remove_fact(const table_element* fact);
virtual bool contains_fact(const table_fact & f) const;
virtual iterator begin() const;
virtual iterator end() const;
void add_fact(const table_fact & f) override;
void remove_fact(const table_element* fact) override;
bool contains_fact(const table_fact & f) const override;
iterator begin() const override;
iterator end() const override;
};

View file

@ -48,7 +48,7 @@ namespace datalog {
relation_base * table_relation_plugin::mk_empty(const relation_signature & s) {
table_signature tsig;
if (!get_manager().relation_signature_to_table(s, tsig)) {
return 0;
return nullptr;
}
table_base * t = m_table_plugin.mk_empty(tsig);
return alloc(table_relation, *this, s, t);
@ -57,7 +57,7 @@ namespace datalog {
relation_base * table_relation_plugin::mk_full_relation(const relation_signature & s, func_decl* p, family_id kind) {
table_signature tsig;
if(!get_manager().relation_signature_to_table(s, tsig)) {
return 0;
return nullptr;
}
table_base * t = m_table_plugin.mk_full(p, tsig, kind);
return alloc(table_relation, *this, s, t);
@ -82,7 +82,7 @@ namespace datalog {
: convenient_relation_join_project_fn(s1, s2, col_cnt, cols1, cols2, removed_col_cnt,
removed_cols), m_tfun(tfun) {}
virtual relation_base * operator()(const relation_base & t1, const relation_base & t2) {
relation_base * operator()(const relation_base & t1, const relation_base & t2) override {
SASSERT(t1.from_table());
SASSERT(t2.from_table());
table_relation_plugin & plugin = static_cast<table_relation_plugin &>(t1.get_plugin());
@ -108,25 +108,25 @@ namespace datalog {
relation_join_fn * table_relation_plugin::mk_join_fn(const relation_base & r1, const relation_base & r2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) {
if(!r1.from_table() || !r2.from_table()) {
return 0;
return nullptr;
}
const table_relation & tr1 = static_cast<const table_relation &>(r1);
const table_relation & tr2 = static_cast<const table_relation &>(r2);
table_join_fn * tfun = get_manager().mk_join_fn(tr1.get_table(), tr2.get_table(), col_cnt, cols1, cols2);
if(!tfun) {
return 0;
return nullptr;
}
return alloc(tr_join_project_fn, r1.get_signature(), r2.get_signature(), col_cnt, cols1,
cols2, 0, static_cast<const unsigned *>(0), tfun);
cols2, 0, static_cast<const unsigned *>(nullptr), tfun);
}
relation_join_fn * table_relation_plugin::mk_join_project_fn(const relation_base & r1,
const relation_base & r2, unsigned joined_col_cnt, const unsigned * cols1, const unsigned * cols2,
unsigned removed_col_cnt, const unsigned * removed_cols) {
if(!r1.from_table() || !r2.from_table()) {
return 0;
return nullptr;
}
const table_relation & tr1 = static_cast<const table_relation &>(r1);
const table_relation & tr2 = static_cast<const table_relation &>(r2);
@ -146,7 +146,7 @@ namespace datalog {
tr_transformer_fn(const relation_signature & rsig, table_transformer_fn * tfun)
: m_tfun(tfun) { get_result_signature() = rsig; }
virtual relation_base * operator()(const relation_base & t) {
relation_base * operator()(const relation_base & t) override {
SASSERT(t.from_table());
table_relation_plugin & plugin = static_cast<table_relation_plugin &>(t.get_plugin());
@ -168,7 +168,7 @@ namespace datalog {
relation_transformer_fn * table_relation_plugin::mk_project_fn(const relation_base & t, unsigned col_cnt,
const unsigned * removed_cols) {
if(!t.from_table()) {
return 0;
return nullptr;
}
const table_relation & tr = static_cast<const table_relation &>(t);
@ -184,7 +184,7 @@ namespace datalog {
relation_transformer_fn * table_relation_plugin::mk_rename_fn(const relation_base & t, unsigned permutation_cycle_len,
const unsigned * permutation_cycle) {
if(!t.from_table()) {
return 0;
return nullptr;
}
const table_relation & tr = static_cast<const table_relation &>(t);
@ -200,7 +200,7 @@ namespace datalog {
relation_transformer_fn * table_relation_plugin::mk_permutation_rename_fn(const relation_base & t,
const unsigned * permutation) {
if(!t.from_table()) {
return 0;
return nullptr;
}
const table_relation & tr = static_cast<const table_relation &>(t);
@ -216,7 +216,7 @@ namespace datalog {
relation_transformer_fn * table_relation_plugin::mk_select_equal_and_project_fn(const relation_base & t,
const relation_element & value, unsigned col) {
if(!t.from_table()) {
return 0;
return nullptr;
}
const table_relation & tr = static_cast<const table_relation &>(t);
@ -235,12 +235,12 @@ namespace datalog {
by iterating through the table and calling \c add_fact of the target relation.
*/
class table_relation_plugin::universal_target_union_fn : public relation_union_fn {
virtual void operator()(relation_base & tgt, const relation_base & src, relation_base * delta) {
void operator()(relation_base & tgt, const relation_base & src, relation_base * delta) override {
SASSERT(src.from_table());
const table_relation & tr_src = static_cast<const table_relation &>(src);
relation_manager & rmgr = tr_src.get_manager();
relation_signature sig = tr_src.get_signature();
const relation_signature & sig = tr_src.get_signature();
SASSERT(tgt.get_signature()==sig);
SASSERT(!delta || delta->get_signature()==sig);
@ -271,7 +271,7 @@ namespace datalog {
public:
tr_union_fn(table_union_fn * tfun) : m_tfun(tfun) {}
virtual void operator()(relation_base & tgt, const relation_base & src, relation_base * delta) {
void operator()(relation_base & tgt, const relation_base & src, relation_base * delta) override {
SASSERT(tgt.from_table());
SASSERT(src.from_table());
SASSERT(!delta || delta->from_table());
@ -280,7 +280,7 @@ namespace datalog {
const table_relation & tr_src = static_cast<const table_relation &>(src);
table_relation * tr_delta = static_cast<table_relation *>(delta);
(*m_tfun)(tr_tgt.get_table(), tr_src.get_table(), tr_delta ? &tr_delta->get_table() : 0);
(*m_tfun)(tr_tgt.get_table(), tr_src.get_table(), tr_delta ? &tr_delta->get_table() : nullptr);
TRACE("dl_table_relation", tout << "# union => "; tr_tgt.get_table().display(tout););
}
@ -289,7 +289,7 @@ namespace datalog {
relation_union_fn * table_relation_plugin::mk_union_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta) {
if(!src.from_table()) {
return 0;
return nullptr;
}
if(!tgt.from_table() || (delta && !delta->from_table())) {
return alloc(universal_target_union_fn);
@ -299,7 +299,7 @@ namespace datalog {
const table_relation * tr_delta = static_cast<const table_relation *>(delta);
table_union_fn * tfun = get_manager().mk_union_fn(tr_tgt.get_table(), tr_src.get_table(),
tr_delta ? &tr_delta->get_table() : 0);
tr_delta ? &tr_delta->get_table() : nullptr);
SASSERT(tfun);
return alloc(tr_union_fn, tfun);
@ -311,7 +311,7 @@ namespace datalog {
public:
tr_mutator_fn(table_mutator_fn * tfun) : m_tfun(tfun) {}
virtual void operator()(relation_base & r) {
void operator()(relation_base & r) override {
SASSERT(r.from_table());
table_relation & tr = static_cast<table_relation &>(r);
(*m_tfun)(tr.get_table());
@ -322,7 +322,7 @@ namespace datalog {
relation_mutator_fn * table_relation_plugin::mk_filter_identical_fn(const relation_base & t, unsigned col_cnt,
const unsigned * identical_cols) {
if(!t.from_table()) {
return 0;
return nullptr;
}
const table_relation & tr = static_cast<const table_relation &>(t);
@ -334,7 +334,7 @@ namespace datalog {
relation_mutator_fn * table_relation_plugin::mk_filter_equal_fn(const relation_base & t, const relation_element & value,
unsigned col) {
if(!t.from_table()) {
return 0;
return nullptr;
}
const table_relation & tr = static_cast<const table_relation &>(t);
@ -349,7 +349,7 @@ namespace datalog {
relation_mutator_fn * table_relation_plugin::mk_filter_interpreted_fn(const relation_base & t, app * condition) {
bool condition_needs_transforming = false;
if(!t.from_table() || condition_needs_transforming) {
return 0;
return nullptr;
}
const table_relation & tr = static_cast<const table_relation &>(t);
table_mutator_fn * tfun = get_manager().mk_filter_interpreted_fn(tr.get_table(), condition);
@ -360,7 +360,7 @@ namespace datalog {
relation_transformer_fn * table_relation_plugin::mk_filter_interpreted_and_project_fn(const relation_base & t,
app * condition, unsigned removed_col_cnt, const unsigned * removed_cols) {
if (!t.from_table())
return 0;
return nullptr;
const table_relation & tr = static_cast<const table_relation &>(t);
table_transformer_fn * tfun = get_manager().mk_filter_interpreted_and_project_fn(tr.get_table(),
@ -377,7 +377,7 @@ namespace datalog {
public:
tr_intersection_filter_fn(table_intersection_filter_fn * tfun) : m_tfun(tfun) {}
virtual void operator()(relation_base & r, const relation_base & src) {
void operator()(relation_base & r, const relation_base & src) override {
SASSERT(r.from_table());
SASSERT(src.from_table());
@ -392,14 +392,14 @@ namespace datalog {
relation_intersection_filter_fn * table_relation_plugin::mk_filter_by_intersection_fn(const relation_base & r,
const relation_base & src, unsigned joined_col_cnt, const unsigned * r_cols, const unsigned * src_cols) {
if(!r.from_table() || !src.from_table()) {
return 0;
return nullptr;
}
const table_relation & tr = static_cast<const table_relation &>(r);
const table_relation & tr_neg = static_cast<const table_relation &>(src);
table_intersection_filter_fn * tfun = get_manager().mk_filter_by_intersection_fn(tr.get_table(),
tr_neg.get_table(), joined_col_cnt, r_cols, src_cols);
if(!tfun) {
return 0;
return nullptr;
}
return alloc(tr_intersection_filter_fn, tfun);
@ -410,7 +410,7 @@ namespace datalog {
const relation_base & negated_rel, unsigned joined_col_cnt,
const unsigned * r_cols, const unsigned * negated_cols) {
if(!r.from_table() || !negated_rel.from_table()) {
return 0;
return nullptr;
}
const table_relation & tr = static_cast<const table_relation &>(r);
const table_relation & tr_neg = static_cast<const table_relation &>(negated_rel);

View file

@ -46,40 +46,40 @@ namespace datalog {
table_plugin & get_table_plugin() { return m_table_plugin; }
virtual bool can_handle_signature(const relation_signature & s);
bool can_handle_signature(const relation_signature & s) override;
virtual relation_base * mk_empty(const relation_signature & s);
relation_base * mk_empty(const relation_signature & s) override;
virtual relation_base * mk_full_relation(const relation_signature & s, func_decl* p, family_id kind);
relation_base * mk_from_table(const relation_signature & s, table_base * t);
protected:
virtual relation_join_fn * mk_join_fn(const relation_base & t1, const relation_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2);
virtual relation_join_fn * mk_join_project_fn(const relation_base & t1, const relation_base & t2,
unsigned joined_col_cnt, const unsigned * cols1, const unsigned * cols2, unsigned removed_col_cnt,
const unsigned * removed_cols);
virtual relation_transformer_fn * mk_project_fn(const relation_base & t, unsigned col_cnt,
const unsigned * removed_cols);
virtual relation_transformer_fn * mk_rename_fn(const relation_base & t, unsigned permutation_cycle_len,
const unsigned * permutation_cycle);
virtual relation_transformer_fn * mk_permutation_rename_fn(const relation_base & t,
const unsigned * permutation);
virtual relation_union_fn * mk_union_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta);
virtual relation_mutator_fn * mk_filter_identical_fn(const relation_base & t, unsigned col_cnt,
const unsigned * identical_cols);
virtual relation_mutator_fn * mk_filter_equal_fn(const relation_base & t, const relation_element & value,
unsigned col);
virtual relation_mutator_fn * mk_filter_interpreted_fn(const relation_base & t, app * condition);
virtual relation_transformer_fn * mk_filter_interpreted_and_project_fn(const relation_base & t,
app * condition, unsigned removed_col_cnt, const unsigned * removed_cols);
virtual relation_intersection_filter_fn * mk_filter_by_intersection_fn(const relation_base & t,
const relation_base & src, unsigned joined_col_cnt, const unsigned * t_cols, const unsigned * src_cols);
virtual relation_intersection_filter_fn * mk_filter_by_negation_fn(const relation_base & t,
const relation_base & negated_obj, unsigned joined_col_cnt,
const unsigned * t_cols, const unsigned * negated_cols);
virtual relation_transformer_fn * mk_select_equal_and_project_fn(const relation_base & t,
const relation_element & value, unsigned col);
relation_join_fn * mk_join_fn(const relation_base & t1, const relation_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) override;
relation_join_fn * mk_join_project_fn(const relation_base & t1, const relation_base & t2,
unsigned joined_col_cnt, const unsigned * cols1, const unsigned * cols2, unsigned removed_col_cnt,
const unsigned * removed_cols) override;
relation_transformer_fn * mk_project_fn(const relation_base & t, unsigned col_cnt,
const unsigned * removed_cols) override;
relation_transformer_fn * mk_rename_fn(const relation_base & t, unsigned permutation_cycle_len,
const unsigned * permutation_cycle) override;
relation_transformer_fn * mk_permutation_rename_fn(const relation_base & t,
const unsigned * permutation) override;
relation_union_fn * mk_union_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta) override;
relation_mutator_fn * mk_filter_identical_fn(const relation_base & t, unsigned col_cnt,
const unsigned * identical_cols) override;
relation_mutator_fn * mk_filter_equal_fn(const relation_base & t, const relation_element & value,
unsigned col) override;
relation_mutator_fn * mk_filter_interpreted_fn(const relation_base & t, app * condition) override;
relation_transformer_fn * mk_filter_interpreted_and_project_fn(const relation_base & t,
app * condition, unsigned removed_col_cnt, const unsigned * removed_cols) override;
relation_intersection_filter_fn * mk_filter_by_intersection_fn(const relation_base & t,
const relation_base & src, unsigned joined_col_cnt, const unsigned * t_cols, const unsigned * src_cols) override;
relation_intersection_filter_fn * mk_filter_by_negation_fn(const relation_base & t,
const relation_base & negated_obj, unsigned joined_col_cnt,
const unsigned * t_cols, const unsigned * negated_cols) override;
relation_transformer_fn * mk_select_equal_and_project_fn(const relation_base & t,
const relation_element & value, unsigned col) override;
};
class table_relation : public relation_base {
@ -107,24 +107,24 @@ namespace datalog {
table_base & get_table() { return *m_table; }
const table_base & get_table() const { return *m_table; }
virtual bool empty() const { return m_table->empty(); }
bool empty() const override { return m_table->empty(); }
void add_table_fact(const table_fact & f);
virtual void add_fact(const relation_fact & f);
virtual bool contains_fact(const relation_fact & f) const;
virtual relation_base * clone() const;
virtual relation_base * complement(func_decl* p) const;
virtual void to_formula(expr_ref& fml) const { get_table().to_formula(get_signature(), fml); }
void add_fact(const relation_fact & f) override;
bool contains_fact(const relation_fact & f) const override;
relation_base * clone() const override;
relation_base * complement(func_decl* p) const override;
void to_formula(expr_ref& fml) const override { get_table().to_formula(get_signature(), fml); }
virtual void display(std::ostream & out) const {
void display(std::ostream & out) const override {
get_table().display(out);
}
virtual void display_tuples(func_decl & pred, std::ostream & out) const;
void display_tuples(func_decl & pred, std::ostream & out) const override;
virtual unsigned get_size_estimate_rows() const { return m_table->get_size_estimate_rows(); }
virtual unsigned get_size_estimate_bytes() const { return m_table->get_size_estimate_bytes(); }
virtual bool knows_exact_size() const { return m_table->knows_exact_size(); }
unsigned get_size_estimate_rows() const override { return m_table->get_size_estimate_rows(); }
unsigned get_size_estimate_bytes() const override { return m_table->get_size_estimate_bytes(); }
bool knows_exact_size() const override { return m_table->knows_exact_size(); }
};
};

View file

@ -55,12 +55,12 @@ namespace datalog {
}
}
virtual ~vector_relation() {
~vector_relation() override {
dealloc(m_eqs);
dealloc(m_elems);
}
virtual void swap(relation_base& other) {
void swap(relation_base& other) override {
vector_relation& o = dynamic_cast<vector_relation&>(other);
if (&o == this) return;
std::swap(o.m_eqs, m_eqs);
@ -85,7 +85,7 @@ namespace datalog {
}
virtual bool empty() const { return m_empty; }
bool empty() const override { return m_empty; }
T& operator[](unsigned i) { return (*m_elems)[find(i)]; }
@ -93,7 +93,7 @@ namespace datalog {
virtual void display_index(unsigned i, T const& t, std::ostream& out) const = 0;
virtual void display(std::ostream & out) const {
void display(std::ostream & out) const override {
if (empty()) {
out << "empty\n";
return;

View file

@ -447,7 +447,7 @@ doc* doc_manager::join(const doc& d1, const doc& d2, doc_manager& dm1,
}
else if (v1 != v2) {
// columns don't match
return 0;
return nullptr;
}
SASSERT(well_formed(*d));
}

View file

@ -373,7 +373,7 @@ class doc_ref {
doc_manager& dm;
doc* d;
public:
doc_ref(doc_manager& dm):dm(dm),d(0) {}
doc_ref(doc_manager& dm):dm(dm),d(nullptr) {}
doc_ref(doc_manager& dm, doc* d):dm(dm),d(d) {}
~doc_ref() {
if (d) dm.deallocate(d);
@ -385,8 +385,8 @@ public:
}
doc& operator*() { return *d; }
doc* operator->() { return d; }
doc* detach() { doc* r = d; d = 0; return r; }
operator bool() const { return d != 0; }
doc* detach() { doc* r = d; d = nullptr; return r; }
operator bool() const { return d != nullptr; }
};
#endif /* DOC_H_ */

View file

@ -36,13 +36,13 @@ namespace datalog {
{
}
virtual bool empty() const {
bool empty() const override {
return m_empty;
}
virtual bool is_precise() const { return false; }
bool is_precise() const override { return false; }
virtual void add_fact(const relation_fact & f) {
void add_fact(const relation_fact & f) override {
SASSERT(m_empty);
SASSERT(!m_basis_valid);
m_empty = false;
@ -60,12 +60,12 @@ namespace datalog {
}
}
virtual bool contains_fact(const relation_fact & f) const {
bool contains_fact(const relation_fact & f) const override {
UNREACHABLE();
return false;
}
virtual void display(std::ostream & out) const {
void display(std::ostream & out) const override {
if (m_fn) {
out << m_fn->get_name() << "\n";
}
@ -82,18 +82,18 @@ namespace datalog {
}
}
virtual karr_relation * clone() const {
karr_relation * clone() const override {
karr_relation* result = alloc(karr_relation, m_plugin, m_fn, get_signature(), m_empty);
result->copy(*this);
return result;
}
virtual karr_relation * complement(func_decl*) const {
karr_relation * complement(func_decl*) const override {
UNREACHABLE();
return 0;
return nullptr;
}
virtual void to_formula(expr_ref& fml) const {
void to_formula(expr_ref& fml) const override {
if (empty()) {
fml = m.mk_false();
}
@ -111,8 +111,8 @@ namespace datalog {
void filter_interpreted(app* cond) {
rational one(1), mone(-1);
expr* e1 = 0, *e2 = 0, *en = 0;
var* v = 0, *w = 0;
expr* e1 = nullptr, *e2 = nullptr, *en = nullptr;
var* v = nullptr, *w = nullptr;
rational n1, n2;
expr_ref_vector conjs(m);
flatten_and(cond, conjs);
@ -500,7 +500,7 @@ namespace datalog {
}
relation_base * karr_relation_plugin::mk_empty(const relation_signature & s) {
return alloc(karr_relation, *this, 0, s, true);
return alloc(karr_relation, *this, nullptr, s, true);
}
relation_base * karr_relation_plugin::mk_full(func_decl* p, const relation_signature & s) {
@ -514,11 +514,11 @@ namespace datalog {
: convenient_relation_join_fn(o1_sig, o2_sig, col_cnt, cols1, cols2){
}
virtual relation_base * operator()(const relation_base & _r1, const relation_base & _r2) {
relation_base * operator()(const relation_base & _r1, const relation_base & _r2) override {
karr_relation const& r1 = get(_r1);
karr_relation const& r2 = get(_r2);
karr_relation_plugin& p = r1.get_plugin();
karr_relation* result = dynamic_cast<karr_relation*>(p.mk_full(0, get_result_signature()));
karr_relation* result = dynamic_cast<karr_relation*>(p.mk_full(nullptr, get_result_signature()));
result->mk_join(r1, r2, m_cols1.size(), m_cols1.c_ptr(), m_cols2.c_ptr());
return result;
}
@ -528,7 +528,7 @@ namespace datalog {
const relation_base & t1, const relation_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) {
if (!check_kind(t1) || !check_kind(t2)) {
return 0;
return nullptr;
}
return alloc(join_fn, t1.get_signature(), t2.get_signature(), col_cnt, cols1, cols2);
}
@ -540,10 +540,10 @@ namespace datalog {
: convenient_relation_project_fn(orig_sig, removed_col_cnt, removed_cols) {
}
virtual relation_base * operator()(const relation_base & _r) {
relation_base * operator()(const relation_base & _r) override {
karr_relation const& r = get(_r);
karr_relation_plugin& p = r.get_plugin();
karr_relation* result = dynamic_cast<karr_relation*>(p.mk_full(0, get_result_signature()));
karr_relation* result = dynamic_cast<karr_relation*>(p.mk_full(nullptr, get_result_signature()));
result->mk_project(r, m_removed_cols.size(), m_removed_cols.c_ptr());
return result;
}
@ -559,10 +559,10 @@ namespace datalog {
rename_fn(karr_relation_plugin& p, const relation_signature & orig_sig, unsigned cycle_len, const unsigned * cycle)
: convenient_relation_rename_fn(orig_sig, cycle_len, cycle) {}
virtual relation_base * operator()(const relation_base & _r) {
relation_base * operator()(const relation_base & _r) override {
karr_relation const& r = get(_r);
karr_relation_plugin& p = r.get_plugin();
karr_relation* result = dynamic_cast<karr_relation*>(p.mk_full(0, get_result_signature()));
karr_relation* result = dynamic_cast<karr_relation*>(p.mk_full(nullptr, get_result_signature()));
result->mk_rename(r, m_cycle.size(), m_cycle.c_ptr());
return result;
}
@ -571,7 +571,7 @@ namespace datalog {
relation_transformer_fn * karr_relation_plugin::mk_rename_fn(const relation_base & r,
unsigned cycle_len, const unsigned * permutation_cycle) {
if (!check_kind(r)) {
return 0;
return nullptr;
}
return alloc(rename_fn, *this, r.get_signature(), cycle_len, permutation_cycle);
}
@ -676,7 +676,7 @@ namespace datalog {
public:
union_fn() {}
virtual void operator()(relation_base & _r, const relation_base & _src, relation_base * _delta) {
void operator()(relation_base & _r, const relation_base & _src, relation_base * _delta) override {
karr_relation& r = get(_r);
karr_relation const& src = get(_src);
@ -687,7 +687,7 @@ namespace datalog {
r.mk_union(src, &d);
}
else {
r.mk_union(src, 0);
r.mk_union(src, nullptr);
}
TRACE("dl", r.display(tout << "result:\n"););
}
@ -696,7 +696,7 @@ namespace datalog {
relation_union_fn * karr_relation_plugin::mk_union_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta) {
if (!check_kind(tgt) || !check_kind(src) || (delta && !check_kind(*delta))) {
return 0;
return nullptr;
}
return alloc(union_fn);
}
@ -707,7 +707,7 @@ namespace datalog {
filter_identical_fn(unsigned col_cnt, const unsigned * identical_cols)
: m_identical_cols(col_cnt, identical_cols) {}
virtual void operator()(relation_base & _r) {
void operator()(relation_base & _r) override {
karr_relation & r = get(_r);
TRACE("dl", r.display(tout << "src:\n"););
r.get_ineqs();
@ -730,7 +730,7 @@ namespace datalog {
relation_mutator_fn * karr_relation_plugin::mk_filter_identical_fn(
const relation_base & t, unsigned col_cnt, const unsigned * identical_cols) {
if(!check_kind(t)) {
return 0;
return nullptr;
}
return alloc(filter_identical_fn, col_cnt, identical_cols);
}
@ -747,7 +747,7 @@ namespace datalog {
m_valid = arith.is_numeral(value, m_value) && m_value.is_int();
}
virtual void operator()(relation_base & _r) {
void operator()(relation_base & _r) override {
karr_relation & r = get(_r);
if (m_valid) {
r.get_ineqs();
@ -768,7 +768,7 @@ namespace datalog {
if (check_kind(r)) {
return alloc(filter_equal_fn, get_manager(), value, col);
}
return 0;
return nullptr;
}
@ -779,7 +779,7 @@ namespace datalog {
m_cond(cond, t.get_plugin().get_ast_manager()) {
}
void operator()(relation_base& t) {
void operator()(relation_base& t) override {
get(t).filter_interpreted(m_cond);
TRACE("dl", tout << mk_pp(m_cond, m_cond.get_manager()) << "\n"; t.display(tout););
}
@ -789,6 +789,6 @@ namespace datalog {
if (check_kind(t)) {
return alloc(filter_interpreted_fn, get(t), condition);
}
return 0;
return nullptr;
}
};

View file

@ -45,33 +45,33 @@ namespace datalog {
a(get_ast_manager())
{}
virtual bool can_handle_signature(const relation_signature & sig) {
bool can_handle_signature(const relation_signature & sig) override {
return get_manager().get_context().karr();
}
static symbol get_name() { return symbol("karr_relation"); }
virtual relation_base * mk_empty(const relation_signature & s);
relation_base * mk_empty(const relation_signature & s) override;
virtual relation_base * mk_full(func_decl* p, const relation_signature & s);
relation_base * mk_full(func_decl* p, const relation_signature & s) override;
static karr_relation& get(relation_base& r);
static karr_relation const & get(relation_base const& r);
virtual relation_join_fn * mk_join_fn(
const relation_base & t1, const relation_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2);
virtual relation_transformer_fn * mk_project_fn(const relation_base & t, unsigned col_cnt,
const unsigned * removed_cols);
virtual relation_transformer_fn * mk_rename_fn(const relation_base & t, unsigned permutation_cycle_len,
const unsigned * permutation_cycle);
virtual relation_union_fn * mk_union_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta);
virtual relation_mutator_fn * mk_filter_identical_fn(const relation_base & t, unsigned col_cnt,
const unsigned * identical_cols);
virtual relation_mutator_fn * mk_filter_equal_fn(const relation_base & t, const relation_element & value,
unsigned col);
virtual relation_mutator_fn * mk_filter_interpreted_fn(const relation_base & t, app * condition);
relation_join_fn * mk_join_fn(
const relation_base & t1, const relation_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) override;
relation_transformer_fn * mk_project_fn(const relation_base & t, unsigned col_cnt,
const unsigned * removed_cols) override;
relation_transformer_fn * mk_rename_fn(const relation_base & t, unsigned permutation_cycle_len,
const unsigned * permutation_cycle) override;
relation_union_fn * mk_union_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta) override;
relation_mutator_fn * mk_filter_identical_fn(const relation_base & t, unsigned col_cnt,
const unsigned * identical_cols) override;
relation_mutator_fn * mk_filter_equal_fn(const relation_base & t, const relation_element & value,
unsigned col) override;
relation_mutator_fn * mk_filter_interpreted_fn(const relation_base & t, app * condition) override;
private:
bool dualizeI(matrix& dst, matrix const& src);

View file

@ -96,7 +96,7 @@ namespace datalog {
m(ctx.get_manager()),
m_rmanager(ctx),
m_answer(m),
m_last_result_relation(0),
m_last_result_relation(nullptr),
m_ectx(ctx),
m_sw(0) {
@ -121,7 +121,7 @@ namespace datalog {
rel_context::~rel_context() {
if (m_last_result_relation) {
m_last_result_relation->deallocate();
m_last_result_relation = 0;
m_last_result_relation = nullptr;
}
}

View file

@ -56,72 +56,72 @@ namespace datalog {
public:
rel_context(context& ctx);
virtual ~rel_context();
~rel_context() override;
virtual relation_manager & get_rmanager();
virtual const relation_manager & get_rmanager() const;
relation_manager & get_rmanager() override;
const relation_manager & get_rmanager() const override;
ast_manager& get_manager() const { return m; }
context& get_context() const { return m_context; }
virtual relation_base & get_relation(func_decl * pred);
virtual relation_base * try_get_relation(func_decl * pred) const;
virtual bool is_empty_relation(func_decl* pred) const;
virtual expr_ref try_get_formula(func_decl * pred) const;
virtual expr_ref get_answer() { return m_answer; }
relation_base & get_relation(func_decl * pred) override;
relation_base * try_get_relation(func_decl * pred) const override;
bool is_empty_relation(func_decl* pred) const override;
expr_ref try_get_formula(func_decl * pred) const override;
expr_ref get_answer() override { return m_answer; }
virtual bool output_profile() const;
bool output_profile() const override;
virtual lbool query(expr* q);
virtual lbool query(unsigned num_rels, func_decl * const* rels);
lbool query(expr* q) override;
lbool query(unsigned num_rels, func_decl * const* rels) override;
virtual void set_predicate_representation(func_decl * pred, unsigned relation_name_cnt,
symbol const * relation_names);
void set_predicate_representation(func_decl * pred, unsigned relation_name_cnt,
symbol const * relation_names) override;
virtual void inherit_predicate_kind(func_decl* new_pred, func_decl* orig_pred);
void inherit_predicate_kind(func_decl* new_pred, func_decl* orig_pred) override;
virtual void collect_statistics(statistics& st) const;
void collect_statistics(statistics& st) const override;
virtual void updt_params();
void updt_params() override;
/**
\brief Restrict the set of used predicates to \c res.
The function deallocates unsused relations, it does not deal with rules.
*/
virtual void restrict_predicates(func_decl_set const& predicates);
void restrict_predicates(func_decl_set const& predicates) override;
virtual void transform_rules();
void transform_rules() override;
virtual bool try_get_size(func_decl* pred, unsigned& rel_size) const;
bool try_get_size(func_decl* pred, unsigned& rel_size) const override;
/**
\brief query result if it contains fact.
*/
virtual bool result_contains_fact(relation_fact const& f);
bool result_contains_fact(relation_fact const& f) override;
virtual void collect_non_empty_predicates(func_decl_set& ps) {
void collect_non_empty_predicates(func_decl_set& ps) override {
return get_rmanager().collect_non_empty_predicates(ps);
}
/** \brief add facts to relation
*/
virtual void add_fact(func_decl* pred, relation_fact const& fact);
virtual void add_fact(func_decl* pred, table_fact const& fact);
void add_fact(func_decl* pred, relation_fact const& fact) override;
void add_fact(func_decl* pred, table_fact const& fact) override;
/** \brief check if facts were added to relation
*/
virtual bool has_facts(func_decl * pred) const;
bool has_facts(func_decl * pred) const override;
/**
\brief Store the relation \c rel under the predicate \c pred. The \c context object
takes over the ownership of the relation object.
*/
virtual void store_relation(func_decl * pred, relation_base * rel);
void store_relation(func_decl * pred, relation_base * rel) override;
virtual void display_output_facts(rule_set const& rules, std::ostream & out) const;
virtual void display_facts(std::ostream & out) const;
void display_output_facts(rule_set const& rules, std::ostream & out) const override;
void display_facts(std::ostream & out) const override;
virtual void display_profile(std::ostream& out);
void display_profile(std::ostream& out) override;
virtual lbool saturate();
lbool saturate() override;
};
};

View file

@ -130,7 +130,7 @@ class tbv_ref {
tbv_manager& mgr;
tbv* d;
public:
tbv_ref(tbv_manager& mgr):mgr(mgr),d(0) {}
tbv_ref(tbv_manager& mgr):mgr(mgr),d(nullptr) {}
tbv_ref(tbv_manager& mgr, tbv* d):mgr(mgr),d(d) {}
~tbv_ref() {
if (d) mgr.deallocate(d);
@ -143,7 +143,7 @@ public:
tbv& operator*() { return *d; }
tbv* operator->() { return d; }
tbv* get() { return d; }
tbv* detach() { tbv* result = d; d = 0; return result; }
tbv* detach() { tbv* result = d; d = nullptr; return result; }
};

View file

@ -203,7 +203,7 @@ namespace datalog {
return dynamic_cast<udoc_relation&>(r);
}
udoc_relation* udoc_plugin::get(relation_base* r) {
return r?dynamic_cast<udoc_relation*>(r):0;
return r?dynamic_cast<udoc_relation*>(r):nullptr;
}
udoc_relation const & udoc_plugin::get(relation_base const& r) {
return dynamic_cast<udoc_relation const&>(r);
@ -328,7 +328,7 @@ namespace datalog {
t2.expand_column_vector(m_cols2);
}
virtual relation_base * operator()(const relation_base & _r1, const relation_base & _r2) {
relation_base * operator()(const relation_base & _r1, const relation_base & _r2) override {
udoc_relation const& r1 = get(_r1);
udoc_relation const& r2 = get(_r2);
TRACE("doc", r1.display(tout << "r1:\n"); r2.display(tout << "r2:\n"););
@ -351,7 +351,7 @@ namespace datalog {
const relation_base & t1, const relation_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) {
if (!check_kind(t1) || !check_kind(t2)) {
return 0;
return nullptr;
}
return alloc(join_fn, *this, get(t1), get(t2), col_cnt, cols1, cols2);
}
@ -369,7 +369,7 @@ namespace datalog {
}
}
virtual relation_base * operator()(const relation_base & tb) {
relation_base * operator()(const relation_base & tb) override {
TRACE("doc", tb.display(tout << "src:\n"););
udoc_relation const& t = get(tb);
udoc_plugin& p = t.get_plugin();
@ -394,7 +394,7 @@ namespace datalog {
const relation_base & t, unsigned col_cnt,
const unsigned * removed_cols) {
if (!check_kind(t))
return 0;
return nullptr;
return alloc(project_fn, get(t), col_cnt, removed_cols);
}
@ -462,7 +462,7 @@ namespace datalog {
}
}
virtual relation_base * operator()(const relation_base & _r) {
relation_base * operator()(const relation_base & _r) override {
udoc_relation const& r = get(_r);
TRACE("doc", r.display(tout << "r:\n"););
udoc_plugin& p = r.get_plugin();
@ -487,20 +487,20 @@ namespace datalog {
return alloc(rename_fn, get(r), cycle_len, permutation_cycle);
}
else {
return 0;
return nullptr;
}
}
class udoc_plugin::union_fn : public relation_union_fn {
public:
union_fn() {}
virtual void operator()(relation_base & _r, const relation_base & _src, relation_base * _delta) {
void operator()(relation_base & _r, const relation_base & _src, relation_base * _delta) override {
TRACE("doc", _r.display(tout << "dst:\n"); _src.display(tout << "src:\n"););
udoc_relation& r = get(_r);
udoc_relation const& src = get(_src);
udoc_relation* d = get(_delta);
doc_manager& dm = r.get_dm();
udoc* d1 = 0;
udoc* d1 = nullptr;
if (d) d1 = &d->get_udoc();
IF_VERBOSE(3, r.display(verbose_stream() << "orig: "););
r.get_plugin().mk_union(dm, r.get_udoc(), src.get_udoc(), d1);
@ -539,7 +539,7 @@ namespace datalog {
const relation_base & tgt, const relation_base & src,
const relation_base * delta) {
if (!check_kind(tgt) || !check_kind(src) || (delta && !check_kind(*delta))) {
return 0;
return nullptr;
}
return alloc(union_fn);
}
@ -574,7 +574,7 @@ namespace datalog {
}
}
virtual void operator()(relation_base & _r) {
void operator()(relation_base & _r) override {
udoc_relation& r = get(_r);
udoc& d = r.get_udoc();
doc_manager& dm = r.get_dm();
@ -585,7 +585,7 @@ namespace datalog {
};
relation_mutator_fn * udoc_plugin::mk_filter_identical_fn(
const relation_base & t, unsigned col_cnt, const unsigned * identical_cols) {
return check_kind(t)?alloc(filter_identical_fn, t, col_cnt, identical_cols):0;
return check_kind(t)?alloc(filter_identical_fn, t, col_cnt, identical_cols):nullptr;
}
class udoc_plugin::filter_equal_fn : public relation_mutator_fn {
doc_manager& dm;
@ -602,10 +602,10 @@ namespace datalog {
SASSERT(num_bits == hi - lo);
dm.tbvm().set(m_filter->pos(), r, hi-1, lo);
}
virtual ~filter_equal_fn() {
~filter_equal_fn() override {
dm.deallocate(m_filter);
}
virtual void operator()(relation_base & tb) {
void operator()(relation_base & tb) override {
udoc_relation & t = get(tb);
t.get_udoc().intersect(dm, *m_filter);
SASSERT(t.get_udoc().well_formed(t.get_dm()));
@ -614,7 +614,7 @@ namespace datalog {
relation_mutator_fn * udoc_plugin::mk_filter_equal_fn(
const relation_base & t, const relation_element & value, unsigned col) {
if (!check_kind(t))
return 0;
return nullptr;
return alloc(filter_equal_fn, *this, get(t), value, col);
}
@ -932,11 +932,11 @@ namespace datalog {
m_udoc.display(dm, tout) << "\n";);
}
virtual ~filter_interpreted_fn() {
~filter_interpreted_fn() override {
m_udoc.reset(dm);
}
virtual void operator()(relation_base & tb) {
void operator()(relation_base & tb) override {
udoc_relation & t = get(tb);
udoc& u = t.get_udoc();
SASSERT(u.well_formed(dm));
@ -951,7 +951,7 @@ namespace datalog {
}
};
relation_mutator_fn * udoc_plugin::mk_filter_interpreted_fn(const relation_base & t, app * condition) {
return check_kind(t)?alloc(filter_interpreted_fn, get(t), get_ast_manager(), condition):0;
return check_kind(t)?alloc(filter_interpreted_fn, get(t), get_ast_manager(), condition):nullptr;
}
class udoc_plugin::join_project_fn : public convenient_relation_join_project_fn {
@ -987,7 +987,7 @@ namespace datalog {
// TBD: replace this by "join" given below.
virtual relation_base* operator()(relation_base const& t1, relation_base const& t2) {
relation_base* operator()(relation_base const& t1, relation_base const& t2) override {
#if 1
return join(get(t1), get(t2));
#else
@ -1043,7 +1043,7 @@ namespace datalog {
public:
join_project_and_fn() {}
virtual relation_base* operator()(relation_base const& t1, relation_base const& t2) {
relation_base* operator()(relation_base const& t1, relation_base const& t2) override {
udoc_relation *result = get(t1.clone());
result->get_udoc().intersect(result->get_dm(), get(t2).get_udoc());
return result;
@ -1055,7 +1055,7 @@ namespace datalog {
unsigned joined_col_cnt, const unsigned * cols1, const unsigned * cols2,
unsigned removed_col_cnt, const unsigned * removed_cols) {
if (!check_kind(t1) || !check_kind(t2))
return 0;
return nullptr;
// special case where we have h(X) :- f(X), g(X).
if (joined_col_cnt == removed_col_cnt &&
t1.get_signature().size() == joined_col_cnt &&
@ -1121,7 +1121,7 @@ namespace datalog {
neg.expand_column_vector(m_neg_cols);
}
virtual void operator()(relation_base& tb, const relation_base& negb) {
void operator()(relation_base& tb, const relation_base& negb) override {
udoc_relation& t = get(tb);
udoc_relation const& n = get(negb);
IF_VERBOSE(3, t.display(verbose_stream() << "dst:"););
@ -1183,7 +1183,7 @@ namespace datalog {
const relation_base& neg, unsigned joined_col_cnt, const unsigned *t_cols,
const unsigned *negated_cols) {
if (!check_kind(t) || !check_kind(neg))
return 0;
return nullptr;
return alloc(negation_filter_fn, get(t), get(neg), joined_col_cnt, t_cols, negated_cols);
}
@ -1223,10 +1223,10 @@ namespace datalog {
t.compile_guard(guard, m_udoc, m_to_delete);
}
virtual ~filter_proj_fn() {
~filter_proj_fn() override {
m_udoc.reset(dm);
}
virtual relation_base* operator()(const relation_base & tb) {
relation_base* operator()(const relation_base & tb) override {
udoc_relation const & t = get(tb);
udoc const& u1 = t.get_udoc();
doc_manager& dm = t.get_dm();
@ -1250,7 +1250,7 @@ namespace datalog {
relation_transformer_fn * udoc_plugin::mk_filter_interpreted_and_project_fn(
const relation_base & t, app * condition,
unsigned removed_col_cnt, const unsigned * removed_cols) {
return check_kind(t)?alloc(filter_proj_fn, get(t), get_ast_manager(), condition, removed_col_cnt, removed_cols):0;
return check_kind(t)?alloc(filter_proj_fn, get(t), get_ast_manager(), condition, removed_col_cnt, removed_cols):nullptr;
}

View file

@ -39,21 +39,21 @@ namespace datalog {
expr_ref to_formula(doc const& d) const;
public:
udoc_relation(udoc_plugin& p, relation_signature const& s);
virtual ~udoc_relation();
virtual void reset();
virtual void add_fact(const relation_fact & f);
virtual void add_new_fact(const relation_fact & f);
virtual bool contains_fact(const relation_fact & f) const;
virtual udoc_relation * clone() const;
virtual udoc_relation * complement(func_decl*) const;
virtual void to_formula(expr_ref& fml) const;
~udoc_relation() override;
void reset() override;
void add_fact(const relation_fact & f) override;
void add_new_fact(const relation_fact & f) override;
bool contains_fact(const relation_fact & f) const override;
udoc_relation * clone() const override;
udoc_relation * complement(func_decl*) const override;
void to_formula(expr_ref& fml) const override;
udoc_plugin& get_plugin() const;
virtual bool fast_empty() const { return m_elems.is_empty(); }
virtual bool empty() const;
virtual void display(std::ostream& out) const;
virtual bool is_precise() const { return true; }
virtual unsigned get_size_estimate_rows() const { return m_elems.size(); }
virtual unsigned get_size_estimate_bytes() const;
bool fast_empty() const override { return m_elems.is_empty(); }
bool empty() const override;
void display(std::ostream& out) const override;
bool is_precise() const override { return true; }
unsigned get_size_estimate_rows() const override { return m_elems.size(); }
unsigned get_size_estimate_bytes() const override;
doc_manager& get_dm() const { return dm; }
udoc const& get_udoc() const { return m_elems; }
@ -63,7 +63,7 @@ namespace datalog {
unsigned get_num_cols() const { return m_column_info.size()-1; }
unsigned column_idx(unsigned col) const { return m_column_info[col]; }
unsigned column_num_bits(unsigned col) const { return m_column_info[col+1] - m_column_info[col]; }
void expand_column_vector(unsigned_vector& v, const udoc_relation* other = 0) const;
void expand_column_vector(unsigned_vector& v, const udoc_relation* other = nullptr) const;
void extract_guard(expr* condition, expr_ref& guard, expr_ref& rest) const;
bool is_guard(expr* g) const;
bool is_guard(unsigned n, expr* const *g) const;
@ -113,38 +113,38 @@ namespace datalog {
expr* mk_numeral(rational const& r, sort* s);
public:
udoc_plugin(relation_manager& rm);
~udoc_plugin();
virtual bool can_handle_signature(const relation_signature & s);
~udoc_plugin() override;
bool can_handle_signature(const relation_signature & s) override;
static symbol get_name() { return symbol("doc"); }
virtual relation_base * mk_empty(const relation_signature & s);
virtual relation_base * mk_full(func_decl* p, const relation_signature & s);
virtual relation_join_fn * mk_join_fn(const relation_base & t1, const relation_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2);
virtual relation_transformer_fn * mk_project_fn(const relation_base & t, unsigned col_cnt,
const unsigned * removed_cols);
virtual relation_transformer_fn * mk_rename_fn(const relation_base & t, unsigned permutation_cycle_len,
const unsigned * permutation_cycle);
virtual relation_union_fn * mk_union_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta);
virtual relation_union_fn * mk_widen_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta);
virtual relation_mutator_fn * mk_filter_identical_fn(const relation_base & t, unsigned col_cnt,
const unsigned * identical_cols);
virtual relation_mutator_fn * mk_filter_equal_fn(const relation_base & t, const relation_element & value,
unsigned col);
virtual relation_mutator_fn * mk_filter_interpreted_fn(const relation_base & t, app * condition);
virtual relation_intersection_filter_fn * mk_filter_by_negation_fn(
relation_base * mk_empty(const relation_signature & s) override;
relation_base * mk_full(func_decl* p, const relation_signature & s) override;
relation_join_fn * mk_join_fn(const relation_base & t1, const relation_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) override;
relation_transformer_fn * mk_project_fn(const relation_base & t, unsigned col_cnt,
const unsigned * removed_cols) override;
relation_transformer_fn * mk_rename_fn(const relation_base & t, unsigned permutation_cycle_len,
const unsigned * permutation_cycle) override;
relation_union_fn * mk_union_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta) override;
relation_union_fn * mk_widen_fn(const relation_base & tgt, const relation_base & src,
const relation_base * delta) override;
relation_mutator_fn * mk_filter_identical_fn(const relation_base & t, unsigned col_cnt,
const unsigned * identical_cols) override;
relation_mutator_fn * mk_filter_equal_fn(const relation_base & t, const relation_element & value,
unsigned col) override;
relation_mutator_fn * mk_filter_interpreted_fn(const relation_base & t, app * condition) override;
relation_intersection_filter_fn * mk_filter_by_negation_fn(
const relation_base& t,
const relation_base& neg, unsigned joined_col_cnt, const unsigned *t_cols,
const unsigned *negated_cols);
virtual relation_transformer_fn * mk_filter_interpreted_and_project_fn(
const unsigned *negated_cols) override;
relation_transformer_fn * mk_filter_interpreted_and_project_fn(
const relation_base & t, app * condition,
unsigned removed_col_cnt, const unsigned * removed_cols);
virtual relation_join_fn * mk_join_project_fn(
unsigned removed_col_cnt, const unsigned * removed_cols) override;
relation_join_fn * mk_join_project_fn(
relation_base const& t1, relation_base const& t2,
unsigned joined_col_cnt, const unsigned * cols1, const unsigned * cols2,
unsigned removed_col_cnt, const unsigned * removed_cols);
unsigned joined_col_cnt, const unsigned * cols1, const unsigned * cols2,
unsigned removed_col_cnt, const unsigned * removed_cols) override;
void disable_fast_pass() { m_disable_fast_pass = true; }
};
};

View file

@ -441,7 +441,7 @@ struct subs_rewriter_cfg : public default_rewriter_cfg {
bool reduce_var(var * t, expr_ref & result, proof_ref & result_pr) {
result = m_c;
result_pr = 0;
result_pr = nullptr;
return true;
}
};

View file

@ -127,7 +127,7 @@ void pred_transformer::init_sig()
std::stringstream name_stm;
name_stm << m_head->get_name() << '_' << i;
func_decl_ref stm(m);
stm = m.mk_func_decl(symbol(name_stm.str().c_str()), 0, (sort*const*)0, arg_sort);
stm = m.mk_func_decl(symbol(name_stm.str().c_str()), 0, (sort*const*)nullptr, arg_sort);
m_sig.push_back(pm.get_o_pred(stm, 0));
}
}
@ -153,7 +153,7 @@ bool pred_transformer::is_must_reachable(expr* state, model_ref* model)
m_reach_ctx->push ();
m_reach_ctx->assert_expr (state);
m_reach_ctx->assert_expr (m.mk_not (m_reach_case_vars.back ()));
lbool res = m_reach_ctx->check_sat (0, NULL);
lbool res = m_reach_ctx->check_sat (0, nullptr);
if (model) { m_reach_ctx->get_model(*model); }
m_reach_ctx->pop (1);
return (res == l_true);
@ -176,14 +176,14 @@ reach_fact* pred_transformer::get_used_reach_fact (model_evaluator_util& mev,
}
UNREACHABLE ();
return NULL;
return nullptr;
}
reach_fact *pred_transformer::get_used_origin_reach_fact (model_evaluator_util& mev,
unsigned oidx)
{
expr_ref b(m), v(m);
reach_fact *res = NULL;
reach_fact *res = nullptr;
for (unsigned i = 0, sz = m_reach_case_vars.size (); i < sz; i++) {
pm.formula_n2o (m_reach_case_vars.get (i), v, oidx);
@ -219,7 +219,7 @@ datalog::rule const* pred_transformer::find_rule(model &model,
// prefer a rule where the model intersects with reach facts of all predecessors;
// also find how many predecessors' reach facts are true in the model
expr_ref vl(m);
datalog::rule const* r = ((datalog::rule*)0);
datalog::rule const* r = ((datalog::rule*)nullptr);
tag2rule::iterator it = m_tag2rule.begin(), end = m_tag2rule.end();
for (; it != end; ++it) {
expr* tag = it->m_key;
@ -392,7 +392,7 @@ expr* pred_transformer::mk_fresh_reach_case_var ()
name << head ()->get_name () << "#reach_case_" << m_reach_case_vars.size ();
decl = m.mk_func_decl (symbol (name.str ().c_str ()), 0,
(sort*const*)0, m.mk_bool_sort ());
(sort*const*)nullptr, m.mk_bool_sort ());
m_reach_case_vars.push_back (m.mk_const (pm.get_n_pred (decl)));
return m_reach_case_vars.back ();
}
@ -495,7 +495,7 @@ expr_ref pred_transformer::get_reachable()
expr* pred_transformer::get_last_reach_case_var () const
{
return m_reach_case_vars.empty () ? NULL : m_reach_case_vars.back ();
return m_reach_case_vars.empty () ? nullptr : m_reach_case_vars.back ();
}
expr_ref pred_transformer::get_cover_delta(func_decl* p_orig, int level)
@ -557,7 +557,7 @@ expr_ref pred_transformer::get_origin_summary (model_evaluator_util &mev,
if (!must) { // use may summary
summary.push_back (get_formulas (level, false));
// -- no auxiliary variables in lemmas
*aux = NULL;
*aux = nullptr;
} else { // find must summary to use
reach_fact *f = get_used_origin_reach_fact (mev, oidx);
summary.push_back (f->get ());
@ -613,12 +613,12 @@ bool pred_transformer::is_blocked (pob &n, unsigned &uses_level)
{
ensure_level (n.level ());
prop_solver::scoped_level _sl (m_solver, n.level ());
m_solver.set_core (NULL);
m_solver.set_model (NULL);
m_solver.set_core (nullptr);
m_solver.set_model (nullptr);
expr_ref_vector post(m), aux(m);
post.push_back (n.post ());
lbool res = m_solver.check_assumptions (post, aux, 0, NULL, 0);
lbool res = m_solver.check_assumptions (post, aux, 0, nullptr, 0);
if (res == l_false) { uses_level = m_solver.uses_level(); }
return res == l_false;
}
@ -775,7 +775,7 @@ bool pred_transformer::is_invariant(unsigned level, expr* lemma,
prop_solver::scoped_level _sl(m_solver, level);
prop_solver::scoped_subset_core _sc (m_solver, true);
m_solver.set_core(core);
m_solver.set_model(0);
m_solver.set_model(nullptr);
expr * bg = m_extend_lit.get ();
lbool r = m_solver.check_assumptions (conj, aux, 1, &bg, 1);
if (r == l_false) {
@ -799,7 +799,7 @@ bool pred_transformer::check_inductive(unsigned level, expr_ref_vector& state,
prop_solver::scoped_level _sl(m_solver, level);
prop_solver::scoped_subset_core _sc (m_solver, true);
m_solver.set_core(&core);
m_solver.set_model (0);
m_solver.set_model (nullptr);
expr_ref_vector aux (m);
conj.push_back (m_extend_lit);
lbool res = m_solver.check_assumptions (state, aux, conj.size (), conj.c_ptr (), 1);
@ -1023,7 +1023,7 @@ void pred_transformer::ground_free_vars(expr* e, app_ref_vector& vars,
fv(e);
while (vars.size() < fv.size()) {
vars.push_back(0);
vars.push_back(nullptr);
}
for (unsigned i = 0; i < fv.size(); ++i) {
if (fv[i] && !vars[i].get()) {
@ -1110,7 +1110,7 @@ lemma::lemma (ast_manager &manager, expr * body, unsigned lvl) :
m_ref_count(0), m(manager),
m_body(body, m), m_cube(m),
m_bindings(m), m_lvl(lvl),
m_pob(0), m_new_pob(false) {
m_pob(nullptr), m_new_pob(false) {
SASSERT(m_body);
normalize(m_body, m_body);
}
@ -1576,7 +1576,7 @@ void derivation::add_premise (pred_transformer &pt,
pob *derivation::create_first_child (model_evaluator_util &mev)
{
if (m_premises.empty()) { return NULL; }
if (m_premises.empty()) { return nullptr; }
m_active = 0;
return create_next_child(mev);
}
@ -1599,7 +1599,7 @@ pob *derivation::create_next_child (model_evaluator_util &mev)
vars.append (m_premises[m_active].get_ovars ());
++m_active;
}
if (m_active >= m_premises.size()) { return NULL; }
if (m_active >= m_premises.size()) { return nullptr; }
// -- update m_trans with the pre-image of m_trans over the must summaries
summaries.push_back (m_trans);
@ -1618,7 +1618,7 @@ pob *derivation::create_next_child (model_evaluator_util &mev)
if (!mev.is_true (m_premises[m_active].get_summary())) {
IF_VERBOSE(1, verbose_stream() << "Summary unexpectendly not true\n";);
return NULL;
return nullptr;
}
@ -1667,7 +1667,7 @@ pob *derivation::create_next_child (model_evaluator_util &mev)
pob *derivation::create_next_child ()
{
if (m_active + 1 >= m_premises.size()) { return NULL; }
if (m_active + 1 >= m_premises.size()) { return nullptr; }
bool use_native_mbp = get_context ().use_native_mbp ();
bool ground = get_context ().use_ground_cti ();
@ -1694,7 +1694,7 @@ pob *derivation::create_next_child ()
// if not true, bail out, the must summary of m_active is not strong enough
// this is possible if m_post was weakened for some reason
if (!pt.is_must_reachable(pm.mk_and(summaries), &model)) { return NULL; }
if (!pt.is_must_reachable(pm.mk_and(summaries), &model)) { return nullptr; }
model_evaluator_util mev (m);
mev.set_model (*model);
@ -1845,12 +1845,12 @@ void pob::get_skolems(app_ref_vector &v) {
pob* pob_queue::top ()
{
/// nothing in the queue
if (m_obligations.empty()) { return NULL; }
if (m_obligations.empty()) { return nullptr; }
/// top queue element is above max level
if (m_obligations.top()->level() > m_max_level) { return NULL; }
if (m_obligations.top()->level() > m_max_level) { return nullptr; }
/// top queue element is at the max level, but at a higher than base depth
if (m_obligations.top ()->level () == m_max_level &&
m_obligations.top()->depth() > m_min_depth) { return NULL; }
m_obligations.top()->depth() > m_min_depth) { return nullptr; }
/// there is something good in the queue
return m_obligations.top ().get ();
@ -1879,10 +1879,10 @@ context::context(fixedpoint_params const& params,
ast_manager& m) :
m_params(params),
m(m),
m_context(0),
m_context(nullptr),
m_pm(params.pdr_max_num_contexts(), m),
m_query_pred(m),
m_query(0),
m_query(nullptr),
m_pob_queue(),
m_last_result(l_undef),
m_inductive_lvl(0),
@ -1911,7 +1911,7 @@ void context::reset()
dealloc(it->m_value);
}
m_rels.reset();
m_query = 0;
m_query = nullptr;
m_last_result = l_undef;
m_inductive_lvl = 0;
}
@ -1982,7 +1982,7 @@ void context::update_rules(datalog::rule_set& rules)
init_rules(rules, rels);
decl2rel::iterator it = rels.begin(), end = rels.end();
for (; it != end; ++it) {
pred_transformer* pt = 0;
pred_transformer* pt = nullptr;
if (m_rels.find(it->m_key, pt)) {
it->m_value->inherit_properties(*pt);
}
@ -1996,7 +1996,7 @@ void context::update_rules(datalog::rule_set& rules)
unsigned context::get_num_levels(func_decl* p)
{
pred_transformer* pt = 0;
pred_transformer* pt = nullptr;
if (m_rels.find(p, pt)) {
return pt->get_num_levels();
} else {
@ -2007,7 +2007,7 @@ unsigned context::get_num_levels(func_decl* p)
expr_ref context::get_cover_delta(int level, func_decl* p_orig, func_decl* p)
{
pred_transformer* pt = 0;
pred_transformer* pt = nullptr;
if (m_rels.find(p, pt)) {
return pt->get_cover_delta(p_orig, level);
} else {
@ -2018,7 +2018,7 @@ expr_ref context::get_cover_delta(int level, func_decl* p_orig, func_decl* p)
void context::add_cover(int level, func_decl* p, expr* property)
{
pred_transformer* pt = 0;
pred_transformer* pt = nullptr;
if (!m_rels.find(p, pt)) {
pt = alloc(pred_transformer, *this, get_manager(), p);
m_rels.insert(p, pt);
@ -2033,7 +2033,7 @@ void context::add_invariant (func_decl *p, expr *property)
expr_ref context::get_reachable(func_decl *p)
{
pred_transformer* pt = 0;
pred_transformer* pt = nullptr;
if (!m_rels.find(p, pt))
{ return expr_ref(m.mk_false(), m); }
return pt->get_reachable();
@ -2297,7 +2297,7 @@ unsigned context::get_cex_depth()
// get current pt and fact
pt = pts.get (curr);
// check for depth marker
if (pt == NULL) {
if (pt == nullptr) {
++cex_depth;
// insert new marker if there are pts at higher depth
if (curr + 1 < pts.size()) { pts.push_back(NULL); }
@ -2632,7 +2632,7 @@ bool context::check_reachability ()
while (last_reachable) {
checkpoint ();
node = last_reachable;
last_reachable = NULL;
last_reachable = nullptr;
if (m_pob_queue.is_root(*node)) { return true; }
if (is_reachable (*node->parent())) {
last_reachable = node->parent ();
@ -2748,14 +2748,14 @@ bool context::is_reachable(pob &n)
// used in case n is reachable
bool is_concrete;
const datalog::rule * r = NULL;
const datalog::rule * r = nullptr;
// denotes which predecessor's (along r) reach facts are used
vector<bool> reach_pred_used;
unsigned num_reuse_reach = 0;
unsigned saved = n.level ();
n.m_level = infty_level ();
lbool res = n.pt().is_reachable(n, NULL, &model,
lbool res = n.pt().is_reachable(n, nullptr, &model,
uses_level, is_concrete, r,
reach_pred_used, num_reuse_reach);
n.m_level = saved;
@ -2779,7 +2779,7 @@ bool context::is_reachable(pob &n)
// if n has a derivation, create a new child and report l_undef
// otherwise if n has no derivation or no new children, report l_true
pob *next = NULL;
pob *next = nullptr;
scoped_ptr<derivation> deriv;
if (n.has_derivation()) {deriv = n.detach_derivation();}
@ -2851,7 +2851,7 @@ lbool context::expand_node(pob& n)
// used in case n is reachable
bool is_concrete;
const datalog::rule * r = NULL;
const datalog::rule * r = nullptr;
// denotes which predecessor's (along r) reach facts are used
vector<bool> reach_pred_used;
unsigned num_reuse_reach = 0;
@ -2896,7 +2896,7 @@ lbool context::expand_node(pob& n)
// if n has a derivation, create a new child and report l_undef
// otherwise if n has no derivation or no new children, report l_true
pob *next = NULL;
pob *next = nullptr;
scoped_ptr<derivation> deriv;
if (n.has_derivation()) {deriv = n.detach_derivation();}
@ -3261,7 +3261,7 @@ bool context::create_children(pob& n, datalog::rule const& r,
pred_transformer &pt = get_pred_transformer (preds [j]);
const ptr_vector<app> *aux = NULL;
const ptr_vector<app> *aux = nullptr;
expr_ref sum(m);
// XXX This is a bit confusing. The summary is returned over
// XXX o-variables. But it is simpler if it is returned over n-variables instead.
@ -3415,7 +3415,7 @@ expr_ref context::get_constraints (unsigned level)
return m_pm.mk_and (constraints);
}
void context::add_constraints (unsigned level, expr_ref c)
void context::add_constraints (unsigned level, const expr_ref& c)
{
if (!c.get()) { return; }
if (m.is_true(c)) { return; }
@ -3429,7 +3429,7 @@ void context::add_constraints (unsigned level, expr_ref c)
expr *e1, *e2;
if (m.is_implies(c, e1, e2)) {
SASSERT (is_app (e1));
pred_transformer *r = 0;
pred_transformer *r = nullptr;
if (m_rels.find (to_app (e1)->get_decl (), r))
{ r->add_lemma(e2, level); }
}

View file

@ -323,7 +323,7 @@ public:
{
for (unsigned i = 0, sz = m_reach_facts.size (); i < sz; ++i)
if(v == m_reach_facts [i]->get()) { return m_reach_facts[i]; }
return NULL;
return nullptr;
}
void add_rule(datalog::rule* r) { m_rules.push_back(r); }
@ -348,7 +348,7 @@ public:
void collect_statistics(statistics& st) const;
void reset_statistics();
bool is_must_reachable (expr* state, model_ref* model = 0);
bool is_must_reachable (expr* state, model_ref* model = nullptr);
/// \brief Returns reachability fact active in the given model
/// all determines whether initial reachability facts are included as well
reach_fact *get_used_reach_fact (model_evaluator_util& mev, bool all = true);
@ -397,7 +397,7 @@ public:
vector<bool>& reach_pred_used,
unsigned& num_reuse_reach);
bool is_invariant(unsigned level, expr* lemma,
unsigned& solver_level, expr_ref_vector* core = 0);
unsigned& solver_level, expr_ref_vector* core = nullptr);
bool check_inductive(unsigned level, expr_ref_vector& state,
unsigned& assumes_level);
@ -475,7 +475,7 @@ public:
void set_derivation (derivation *d) {m_derivation = d;}
bool has_derivation () const {return (bool)m_derivation;}
derivation &get_derivation() const {return *m_derivation.get ();}
void reset_derivation () {set_derivation (NULL);}
void reset_derivation () {set_derivation (nullptr);}
/// detaches derivation from the node without deallocating
derivation* detach_derivation () {return m_derivation.detach ();}
@ -503,7 +503,7 @@ public:
/// clean a dirty node
void clean();
void reset () {clean (); m_derivation = NULL; m_open = true;}
void reset () {clean (); m_derivation = nullptr; m_open = true;}
bool is_closed () const { return !m_open; }
void close();
@ -563,7 +563,7 @@ class derivation {
public:
premise (pred_transformer &pt, unsigned oidx, expr *summary, bool must,
const ptr_vector<app> *aux_vars = NULL);
const ptr_vector<app> *aux_vars = nullptr);
premise (const premise &p);
bool is_must () {return m_must;}
@ -575,7 +575,7 @@ class derivation {
/// \brief Updated the summary.
/// The new summary is over n-variables.
void set_summary (expr * summary, bool must,
const ptr_vector<app> *aux_vars = NULL);
const ptr_vector<app> *aux_vars = nullptr);
};
@ -600,7 +600,7 @@ public:
derivation (pob& parent, datalog::rule const& rule,
expr *trans, app_ref_vector const &evars);
void add_premise (pred_transformer &pt, unsigned oidx,
expr * summary, bool must, const ptr_vector<app> *aux_vars = NULL);
expr * summary, bool must, const ptr_vector<app> *aux_vars = nullptr);
/// creates the first child. Must be called after all the premises
/// are added. The model must be valid for the premises
@ -628,7 +628,7 @@ class pob_queue {
pob_ref_gt> m_obligations;
public:
pob_queue(): m_root(NULL), m_max_level(0), m_min_depth(0) {}
pob_queue(): m_root(nullptr), m_max_level(0), m_min_depth(0) {}
~pob_queue();
void reset();
@ -833,7 +833,7 @@ public:
pob& get_root() const { return m_pob_queue.get_root(); }
expr_ref get_constraints (unsigned lvl);
void add_constraints (unsigned lvl, expr_ref c);
void add_constraints (unsigned lvl, const expr_ref& c);
};
inline bool pred_transformer::use_native_mbp () {return ctx.use_native_mbp ();}

View file

@ -42,7 +42,7 @@ dl_interface::dl_interface(datalog::context& ctx) :
m_ctx(ctx),
m_spacer_rules(ctx),
m_old_rules(ctx),
m_context(0),
m_context(nullptr),
m_refs(ctx.get_manager())
{
m_context = alloc(spacer::context, ctx.get_params(), ctx.get_manager());

View file

@ -45,39 +45,39 @@ class dl_interface : public datalog::engine_base {
public:
dl_interface(datalog::context& ctx);
~dl_interface();
~dl_interface() override;
lbool query(expr* query);
lbool query(expr* query) override;
lbool query_from_lvl(expr* query, unsigned lvl);
lbool query_from_lvl(expr* query, unsigned lvl) override;
void display_certificate(std::ostream& out) const;
void display_certificate(std::ostream& out) const override;
void collect_statistics(statistics& st) const;
void collect_statistics(statistics& st) const override;
void reset_statistics();
void reset_statistics() override;
expr_ref get_answer();
expr_ref get_answer() override;
expr_ref get_ground_sat_answer();
expr_ref get_ground_sat_answer() override;
void get_rules_along_trace(datalog::rule_ref_vector& rules);
void get_rules_along_trace(datalog::rule_ref_vector& rules) override;
unsigned get_num_levels(func_decl* pred);
unsigned get_num_levels(func_decl* pred) override;
expr_ref get_cover_delta(int level, func_decl* pred);
expr_ref get_cover_delta(int level, func_decl* pred) override;
void add_cover(int level, func_decl* pred, expr* property);
void add_cover(int level, func_decl* pred, expr* property) override;
void add_invariant(func_decl* pred, expr* property);
void add_invariant(func_decl* pred, expr* property) override;
expr_ref get_reachable(func_decl *pred);
expr_ref get_reachable(func_decl *pred) override;
void updt_params();
void updt_params() override;
model_ref get_model();
model_ref get_model() override;
proof_ref get_proof();
proof_ref get_proof() override;
};
}

View file

@ -161,7 +161,7 @@ class collect_array_proc {
sort *m_sort;
public:
collect_array_proc(ast_manager &m, func_decl_set& s) :
m_au(m), m_symbs(s), m_sort(NULL) {}
m_au(m), m_symbs(s), m_sort(nullptr) {}
void operator()(app* a)
{

View file

@ -30,8 +30,8 @@ namespace spacer {
class lemma_sanity_checker : public lemma_generalizer {
public:
lemma_sanity_checker(context& ctx) : lemma_generalizer(ctx) {}
virtual ~lemma_sanity_checker() {}
virtual void operator()(lemma_ref &lemma);
~lemma_sanity_checker() override {}
void operator()(lemma_ref &lemma) override;
};
/**
@ -53,11 +53,11 @@ class lemma_bool_inductive_generalizer : public lemma_generalizer {
public:
lemma_bool_inductive_generalizer(context& ctx, unsigned failure_limit) :
lemma_generalizer(ctx), m_failure_limit(failure_limit) {}
virtual ~lemma_bool_inductive_generalizer() {}
virtual void operator()(lemma_ref &lemma);
~lemma_bool_inductive_generalizer() override {}
void operator()(lemma_ref &lemma) override;
virtual void collect_statistics(statistics& st) const;
virtual void reset_statistics() {m_st.reset();}
void collect_statistics(statistics& st) const override;
void reset_statistics() override {m_st.reset();}
};
class unsat_core_generalizer : public lemma_generalizer {
@ -72,26 +72,26 @@ class unsat_core_generalizer : public lemma_generalizer {
stats m_st;
public:
unsat_core_generalizer(context &ctx) : lemma_generalizer(ctx) {}
virtual ~unsat_core_generalizer() {}
virtual void operator()(lemma_ref &lemma);
~unsat_core_generalizer() override {}
void operator()(lemma_ref &lemma) override;
virtual void collect_statistics(statistics &st) const;
virtual void reset_statistics() {m_st.reset();}
void collect_statistics(statistics &st) const override;
void reset_statistics() override {m_st.reset();}
};
class lemma_array_eq_generalizer : public lemma_generalizer {
public:
lemma_array_eq_generalizer(context &ctx) : lemma_generalizer(ctx) {}
virtual ~lemma_array_eq_generalizer() {}
virtual void operator()(lemma_ref &lemma);
~lemma_array_eq_generalizer() override {}
void operator()(lemma_ref &lemma) override;
};
class lemma_eq_generalizer : public lemma_generalizer {
public:
lemma_eq_generalizer(context &ctx) : lemma_generalizer(ctx) {}
virtual ~lemma_eq_generalizer() {}
virtual void operator()(lemma_ref &lemma);
~lemma_eq_generalizer() override {}
void operator()(lemma_ref &lemma) override;
};

View file

@ -146,7 +146,7 @@ app* itp_solver::def_manager::mk_proxy (expr *v)
bool itp_solver::def_manager::is_proxy (app *k, app_ref &def)
{
app *r = NULL;
app *r = nullptr;
bool found = m_proxy2def.find (k, r);
def = r;
return found;

Some files were not shown because too many files have changed in this diff Show more