mirror of
https://github.com/Z3Prover/z3
synced 2025-04-08 10:25:18 +00:00
add option to enable equality propagation
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
8c538fd3f0
commit
63c138c08e
|
@ -155,6 +155,8 @@ class bv_bounds_simplifier : public ctx_simplify_tactic::simplifier {
|
|||
typedef obj_map<expr, interval> map;
|
||||
|
||||
ast_manager& m;
|
||||
params_ref m_params;
|
||||
bool m_propagate_eq;
|
||||
bv_util m_bv;
|
||||
vector<map> m_scopes;
|
||||
map *m_bound;
|
||||
|
@ -209,9 +211,19 @@ class bv_bounds_simplifier : public ctx_simplify_tactic::simplifier {
|
|||
|
||||
public:
|
||||
|
||||
bv_bounds_simplifier(ast_manager& m) : m(m), m_bv(m) {
|
||||
bv_bounds_simplifier(ast_manager& m, params_ref const& p) : m(m), m_params(p), m_bv(m) {
|
||||
m_scopes.push_back(map());
|
||||
m_bound = &m_scopes.back();
|
||||
updt_params(p);
|
||||
}
|
||||
|
||||
|
||||
virtual void updt_params(params_ref const & p) {
|
||||
m_propagate_eq = p.get_bool("propagate_eq", false);
|
||||
}
|
||||
|
||||
static void get_param_descrs(param_descrs& r) {
|
||||
r.insert("propagate-eq", CPK_BOOL, "(default: false) propagate equalities from inequalities");
|
||||
}
|
||||
|
||||
virtual ~bv_bounds_simplifier() {}
|
||||
|
@ -262,7 +274,7 @@ public:
|
|||
result = m.mk_true();
|
||||
} else if (!b.intersect(ctx, intr)) {
|
||||
result = m.mk_false();
|
||||
} else if (false && intr.l == intr.h) {
|
||||
} else if (m_propagate_eq && intr.l == intr.h) {
|
||||
result = m.mk_eq(t1, m_bv.mk_numeral(intr.l, m.get_sort(t1)));
|
||||
}
|
||||
} else if (b.is_full() && b.tight) {
|
||||
|
@ -291,7 +303,7 @@ public:
|
|||
}
|
||||
|
||||
virtual simplifier * translate(ast_manager & m) {
|
||||
return alloc(bv_bounds_simplifier, m);
|
||||
return alloc(bv_bounds_simplifier, m, m_params);
|
||||
}
|
||||
|
||||
virtual unsigned scope_level() const {
|
||||
|
@ -302,5 +314,5 @@ public:
|
|||
}
|
||||
|
||||
tactic * mk_bv_bounds_tactic(ast_manager & m, params_ref const & p) {
|
||||
return clean(alloc(ctx_simplify_tactic, m, alloc(bv_bounds_simplifier, m), p));
|
||||
return clean(alloc(ctx_simplify_tactic, m, alloc(bv_bounds_simplifier, m, p), p));
|
||||
}
|
||||
|
|
|
@ -198,6 +198,7 @@ struct ctx_simplify_tactic::imp {
|
|||
m_max_steps = p.get_uint("max_steps", UINT_MAX);
|
||||
m_max_depth = p.get_uint("max_depth", 1024);
|
||||
m_bail_on_blowup = p.get_bool("bail_on_blowup", false);
|
||||
m_simp->updt_params(p);
|
||||
}
|
||||
|
||||
void checkpoint() {
|
||||
|
@ -622,6 +623,7 @@ void ctx_simplify_tactic::get_param_descrs(param_descrs & r) {
|
|||
insert_max_memory(r);
|
||||
insert_max_steps(r);
|
||||
r.insert("max_depth", CPK_UINT, "(default: 1024) maximum term depth.");
|
||||
r.insert("propagate_eq", CPK_BOOL, "(default: false) enable equality propagation from bounds.");
|
||||
}
|
||||
|
||||
void ctx_simplify_tactic::operator()(goal_ref const & in,
|
||||
|
|
|
@ -34,6 +34,7 @@ public:
|
|||
virtual void pop(unsigned num_scopes) = 0;
|
||||
virtual simplifier * translate(ast_manager & m) = 0;
|
||||
virtual unsigned scope_level() const = 0;
|
||||
virtual void updt_params(params_ref const & p) {}
|
||||
void set_occs(goal_num_occurs& occs) { m_occs = &occs; };
|
||||
bool shared(expr* t) const;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue