3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-17 00:32:16 +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

@ -62,8 +62,8 @@ class macro_finder_tactic : public tactic {
g->reset();
for (unsigned i = 0; i < new_forms.size(); i++)
g->assert_expr(new_forms.get(i),
produce_proofs ? new_proofs.get(i) : 0,
unsat_core_enabled ? new_deps.get(i) : 0);
produce_proofs ? new_proofs.get(i) : nullptr,
unsat_core_enabled ? new_deps.get(i) : nullptr);
generic_model_converter * evmc = alloc(generic_model_converter, mm.get_manager(), "macro_finder");
unsigned num = mm.get_num_macros();
@ -92,32 +92,32 @@ public:
m_imp = alloc(imp, m, p);
}
virtual tactic * translate(ast_manager & m) {
tactic * translate(ast_manager & m) override {
return alloc(macro_finder_tactic, m, m_params);
}
virtual ~macro_finder_tactic() {
~macro_finder_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 {
insert_max_memory(r);
insert_produce_models(r);
insert_produce_proofs(r);
r.insert("elim_and", CPK_BOOL, "(default: false) eliminate conjunctions during (internal) calls to the simplifier.");
}
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 cleanup() {
void cleanup() override {
ast_manager & m = m_imp->m();
imp * d = alloc(imp, m, m_params);
std::swap(d, m_imp);

View file

@ -74,8 +74,8 @@ class quasi_macros_tactic : public tactic {
g->reset();
for (unsigned i = 0; i < new_forms.size(); i++)
g->assert_expr(forms.get(i),
produce_proofs ? proofs.get(i) : 0,
produce_unsat_cores ? deps.get(i) : 0);
produce_proofs ? proofs.get(i) : nullptr,
produce_unsat_cores ? deps.get(i) : nullptr);
generic_model_converter * evmc = alloc(generic_model_converter, mm.get_manager(), "quasi_macros");
unsigned num = mm.get_num_macros();
@ -104,31 +104,31 @@ public:
m_imp = alloc(imp, m, p);
}
virtual tactic * translate(ast_manager & m) {
tactic * translate(ast_manager & m) override {
return alloc(quasi_macros_tactic, m, m_params);
}
virtual ~quasi_macros_tactic() {
~quasi_macros_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 {
insert_max_memory(r);
insert_produce_models(r);
insert_produce_proofs(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 cleanup() {
void cleanup() override {
ast_manager & m = m_imp->m();
imp * d = alloc(imp, m, m_params);
std::swap(d, m_imp);

View file

@ -196,14 +196,14 @@ int ufbv_rewriter::is_smaller(expr * e1, expr * e2) const {
class max_var_id_proc {
unsigned m_max_var_id;
public:
max_var_id_proc(void):m_max_var_id(0) {}
max_var_id_proc():m_max_var_id(0) {}
void operator()(var * n) {
if(n->get_idx() > m_max_var_id)
m_max_var_id = n->get_idx();
}
void operator()(quantifier * n) {}
void operator()(app * n) {}
unsigned get_max(void) { return m_max_var_id; }
unsigned get_max() { return m_max_var_id; }
};
unsigned ufbv_rewriter::max_var_id(expr * e)
@ -253,7 +253,7 @@ void ufbv_rewriter::remove_fwd_idx(func_decl * f, quantifier * demodulator) {
}
}
bool ufbv_rewriter::check_fwd_idx_consistency(void) {
bool ufbv_rewriter::check_fwd_idx_consistency() {
for (fwd_idx_map::iterator it = m_fwd_idx.begin(); it != m_fwd_idx.end() ; it++ ) {
quantifier_set * set = it->m_value;
SASSERT(set);
@ -322,8 +322,27 @@ bool ufbv_rewriter::rewrite_visit_children(app * a) {
while (j > 0) {
expr * e = a->get_arg(--j);
if (!m_rewrite_cache.contains(e) || !m_rewrite_cache.get(e).second) {
m_rewrite_todo.push_back(e);
res = false;
bool recursive = false;
unsigned sz = m_rewrite_todo.size();
expr * v = e;
if (m_rewrite_cache.contains(e)) {
expr_bool_pair const & ebp = m_rewrite_cache.get(e);
if (ebp.second)
v = ebp.first;
}
for (unsigned i = sz; i > 0; i--) {
if (m_rewrite_todo[i - 1] == v) {
recursive = true;
TRACE("demodulator", tout << "Detected demodulator cycle: " <<
mk_pp(a, m_manager) << " --> " << mk_pp(v, m_manager) << std::endl;);
m_rewrite_cache.insert(e, expr_bool_pair(v, true));
break;
}
}
if (!recursive) {
m_rewrite_todo.push_back(e);
res = false;
}
}
}
return res;
@ -347,7 +366,8 @@ expr * ufbv_rewriter::rewrite(expr * n) {
while (!m_rewrite_todo.empty()) {
TRACE("demodulator_stack", tout << "STACK: " << std::endl;
for ( unsigned i = 0; i<m_rewrite_todo.size(); i++)
tout << std::dec << i << ": " << std::hex << (size_t)m_rewrite_todo[i] << std::endl;
tout << std::dec << i << ": " << std::hex << (size_t)m_rewrite_todo[i] <<
" = " << mk_pp(m_rewrite_todo[i], m_manager) << std::endl;
);
expr * e = m_rewrite_todo.back();

View file

@ -74,7 +74,7 @@ each offset is a different "variable bank". A pair (expr, offset) is essentially
where every variable in expr is assumed to be from the "bank" offset.
The class substitution (in substitution.h) manages offsets for us.
The class matcher (in matcher.h) can be use to test whether an expression is an instance of another one.
The class matcher (in matcher.h) can be used to test whether an expression is an instance of another one.
Finally, there is the problem when we have N demodulators (where N is big), and a big formula, and we want
to traverse the formula only once looking for opportunities for applying these N demodulators.
@ -173,7 +173,7 @@ class ufbv_rewriter {
void insert_fwd_idx(expr * large, expr * small, quantifier * demodulator);
void remove_fwd_idx(func_decl * f, quantifier * demodulator);
bool check_fwd_idx_consistency(void);
bool check_fwd_idx_consistency();
void show_fwd_idx(std::ostream & out);
bool is_demodulator(expr * e, expr_ref & large, expr_ref & small) const;
bool can_rewrite(expr * n, expr * lhs);

View file

@ -54,7 +54,7 @@ class ufbv_rewriter_tactic : public tactic {
g->reset();
for (unsigned i = 0; i < new_forms.size(); i++)
g->assert_expr(new_forms.get(i), produce_proofs ? new_proofs.get(i) : 0, 0);
g->assert_expr(new_forms.get(i), produce_proofs ? new_proofs.get(i) : nullptr, nullptr);
// CMW: Remark: The demodulator could potentially
// remove all references to a variable.
@ -78,31 +78,30 @@ public:
m_imp = alloc(imp, m, p);
}
virtual tactic * translate(ast_manager & m) {
tactic * translate(ast_manager & m) override {
return alloc(ufbv_rewriter_tactic, m, m_params);
}
virtual ~ufbv_rewriter_tactic() {
~ufbv_rewriter_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 {
insert_max_memory(r);
insert_produce_models(r);
insert_produce_proofs(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 cleanup() {
void cleanup() override {
ast_manager & m = m_imp->m();
imp * d = alloc(imp, m, m_params);
std::swap(d, m_imp);