Skip to content

Commit

Permalink
register forbidden functions with reduce_args for user-propagator
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolajBjorner committed Dec 7, 2021
1 parent 658a334 commit 50d50cd
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
31 changes: 25 additions & 6 deletions src/tactic/core/reduce_args_tactic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ Module Name:
class reduce_args_tactic : public tactic {
struct imp;
imp * m_imp;

public:
reduce_args_tactic(ast_manager & m);

Expand All @@ -75,20 +76,24 @@ class reduce_args_tactic : public tactic {

void operator()(goal_ref const & g, goal_ref_buffer & result) override;
void cleanup() override;
unsigned user_propagate_register(expr* e) override;
void user_propagate_clear() override;
};

tactic * mk_reduce_args_tactic(ast_manager & m, params_ref const & p) {
return clean(alloc(reduce_args_tactic, m));
}

struct reduce_args_tactic::imp {
expr_ref_vector m_vars;
ast_manager & m_manager;
bv_util m_bv;
array_util m_ar;

ast_manager & m() const { return m_manager; }

imp(ast_manager & m):
m_vars(m),
m_manager(m),
m_bv(m),
m_ar(m) {
Expand Down Expand Up @@ -164,6 +169,9 @@ struct reduce_args_tactic::imp {
*/
void find_non_candidates(goal const & g, obj_hashtable<func_decl> & non_candidates) {
non_candidates.reset();
for (expr* v : m_vars)
if (is_app(v))
non_candidates.insert(to_app(v)->get_decl());
find_non_candidates_proc proc(m_manager, m_bv, m_ar, non_candidates);
expr_fast_mark1 visited;
unsigned sz = g.size();
Expand All @@ -173,12 +181,9 @@ struct reduce_args_tactic::imp {
}

TRACE("reduce_args", tout << "non_candidates:\n";
obj_hashtable<func_decl>::iterator it = non_candidates.begin();
obj_hashtable<func_decl>::iterator end = non_candidates.end();
for (; it != end; ++it) {
func_decl * d = *it;
tout << d->get_name() << "\n";
});
for (func_decl* d : non_candidates)
tout << d->get_name() << "\n";
);
}

struct populate_decl2args_proc {
Expand Down Expand Up @@ -482,6 +487,7 @@ struct reduce_args_tactic::imp {
};

reduce_args_tactic::reduce_args_tactic(ast_manager & m) {
expr_ref_vector vars(m);
m_imp = alloc(imp, m);
}

Expand All @@ -502,7 +508,20 @@ void reduce_args_tactic::operator()(goal_ref const & g,

void reduce_args_tactic::cleanup() {
ast_manager & m = m_imp->m();
expr_ref_vector vars = m_imp->m_vars;
m_imp->~imp();
m_imp = new (m_imp) imp(m);
m_imp->m_vars.append(vars);
}

unsigned reduce_args_tactic::user_propagate_register(expr* e) {
m_imp->m_vars.push_back(e);
return 0;
}

void reduce_args_tactic::user_propagate_clear() {
m_imp->m_vars.reset();
}



2 changes: 2 additions & 0 deletions src/tactic/tactic.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ class tactic : public user_propagator::core {
throw default_exception("tactic does not support user propagation");
}

unsigned user_propagate_register(expr* e) override { return 0; }

protected:
friend class nary_tactical;
friend class binary_tactical;
Expand Down
2 changes: 2 additions & 0 deletions src/tactic/tactical.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,12 @@ class and_then_tactical : public binary_tactical {
}

unsigned user_propagate_register(expr* e) override {
m_t1->user_propagate_register(e);
return m_t2->user_propagate_register(e);
}

void user_propagate_clear() override {
m_t1->user_propagate_clear();
m_t2->user_propagate_clear();
}

Expand Down

0 comments on commit 50d50cd

Please sign in to comment.