mirror of
https://github.com/Z3Prover/z3
synced 2025-04-10 19:27:06 +00:00
fix push/pop bug for ite-elimination, thanks to Nao Hirokawa for reporting it
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
de43e05102
commit
4c0db00a7b
|
@ -17,6 +17,7 @@ Revision History:
|
|||
|
||||
--*/
|
||||
#include "model/model_core.h"
|
||||
#include "ast/ast_pp.h"
|
||||
|
||||
model_core::~model_core() {
|
||||
for (auto & kv : m_interp) {
|
||||
|
@ -47,7 +48,9 @@ bool model_core::eval(func_decl* f, expr_ref & r) const {
|
|||
|
||||
void model_core::register_decl(func_decl * d, expr * v) {
|
||||
SASSERT(d->get_arity() == 0);
|
||||
TRACE("model", tout << "register " << d->get_name() << "\n";);
|
||||
TRACE("model", tout << "register " << d->get_name() << "\n";
|
||||
if (v) tout << mk_pp(v, m) << "\n";
|
||||
);
|
||||
decl2expr::obj_map_entry * entry = m_interp.insert_if_not_there2(d, nullptr);
|
||||
if (entry->get_data().m_value == nullptr) {
|
||||
// new entry
|
||||
|
|
|
@ -184,6 +184,7 @@ void asserted_formulas::push_scope() {
|
|||
SASSERT(inconsistent() || s.m_formulas_lim == m_qhead || m.canceled());
|
||||
s.m_inconsistent_old = m_inconsistent;
|
||||
m_defined_names.push();
|
||||
m_elim_term_ite.push();
|
||||
m_bv_sharing.push_scope();
|
||||
m_macro_manager.push_scope();
|
||||
commit();
|
||||
|
@ -198,6 +199,7 @@ void asserted_formulas::pop_scope(unsigned num_scopes) {
|
|||
scope & s = m_scopes[new_lvl];
|
||||
m_inconsistent = s.m_inconsistent_old;
|
||||
m_defined_names.pop(num_scopes);
|
||||
m_elim_term_ite.pop(num_scopes);
|
||||
m_scoped_substitution.pop(num_scopes);
|
||||
m_formulas.shrink(s.m_formulas_lim);
|
||||
m_qhead = s.m_formulas_lim;
|
||||
|
|
|
@ -156,6 +156,8 @@ class asserted_formulas {
|
|||
void simplify(justified_expr const& j, expr_ref& n, proof_ref& p) override { m_elim(j.get_fml(), n, p); }
|
||||
bool should_apply() const override { return af.m_smt_params.m_eliminate_term_ite && af.m_smt_params.m_lift_ite != LI_FULL; }
|
||||
void post_op() override { af.m_formulas.append(m_elim.new_defs()); af.reduce_and_solve(); m_elim.reset(); }
|
||||
void push() { m_elim.push(); }
|
||||
void pop(unsigned n) { m_elim.pop(n); }
|
||||
};
|
||||
|
||||
#define MK_SIMPLIFIERA(NAME, FUNCTOR, MSG, APP, ARG, REDUCE) \
|
||||
|
|
|
@ -27,14 +27,16 @@ class elim_term_ite_cfg : public default_rewriter_cfg {
|
|||
ast_manager& m;
|
||||
defined_names & m_defined_names;
|
||||
vector<justified_expr> m_new_defs;
|
||||
unsigned_vector m_lim;
|
||||
public:
|
||||
elim_term_ite_cfg(ast_manager & m, defined_names & d): m(m), m_defined_names(d) {
|
||||
// TBD enable_ac_support(false);
|
||||
}
|
||||
virtual ~elim_term_ite_cfg() {}
|
||||
vector<justified_expr> const& new_defs() const { return m_new_defs; }
|
||||
void reset() { m_new_defs.reset(); }
|
||||
br_status reduce_app(func_decl* f, unsigned n, expr *const* args, expr_ref& result, proof_ref& result_pr);
|
||||
void push() { m_lim.push_back(m_new_defs.size()); }
|
||||
void pop(unsigned n) {if (n > 0) { m_new_defs.shrink(m_lim[m_lim.size() - n]); m_lim.shrink(m_lim.size() - n); } }
|
||||
};
|
||||
|
||||
class elim_term_ite_rw : public rewriter_tpl<elim_term_ite_cfg> {
|
||||
|
@ -45,7 +47,8 @@ public:
|
|||
m_cfg(m, dn)
|
||||
{}
|
||||
vector<justified_expr> const& new_defs() const { return m_cfg.new_defs(); }
|
||||
void reset() { m_cfg.reset(); }
|
||||
void push() { m_cfg.push(); }
|
||||
void pop(unsigned n) { m_cfg.pop(n); }
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue