3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-12 12:08:18 +00:00

rename set-flat to set-flat-and-or to allow to differentiate parameters

This commit is contained in:
Nikolaj Bjorner 2022-10-27 11:22:57 -07:00
parent fe1b4bf5ce
commit 1fae3aa152
9 changed files with 15 additions and 15 deletions

View file

@ -106,7 +106,7 @@ public:
{ {
ast_manager &m = args.get_manager(); ast_manager &m = args.get_manager();
bool_rewriter brwr(m); bool_rewriter brwr(m);
brwr.set_flat(false); brwr.set_flat_and_or(false);
if (m.is_or(decl)) if (m.is_or(decl))
{ mk_or_core(args, res); } { mk_or_core(args, res); }

View file

@ -59,7 +59,7 @@ class bit_blaster : public bit_blaster_tpl<bit_blaster_cfg> {
public: public:
bit_blaster(ast_manager & m, bit_blaster_params const & params); bit_blaster(ast_manager & m, bit_blaster_params const & params);
bit_blaster_params const & get_params() const { return this->m_params; } bit_blaster_params const & get_params() const { return this->m_params; }
void set_flat(bool f) { m_rw.set_flat(f); } void set_flat_and_or(bool f) { m_rw.set_flat_and_or(f); }
}; };

View file

@ -75,7 +75,7 @@ public:
bit_blaster_tpl<blaster_cfg>(blaster_cfg(m_rewriter, m_util)), bit_blaster_tpl<blaster_cfg>(blaster_cfg(m_rewriter, m_util)),
m_rewriter(m), m_rewriter(m),
m_util(m) { m_util(m) {
m_rewriter.set_flat(false); m_rewriter.set_flat_and_or(false);
m_rewriter.set_elim_and(true); m_rewriter.set_elim_and(true);
} }

View file

@ -24,7 +24,7 @@ Notes:
void bool_rewriter::updt_params(params_ref const & _p) { void bool_rewriter::updt_params(params_ref const & _p) {
bool_rewriter_params p(_p); bool_rewriter_params p(_p);
m_flat = p.flat(); m_flat_and_or = p.flat();
m_elim_and = p.elim_and(); m_elim_and = p.elim_and();
m_elim_ite = p.elim_ite(); m_elim_ite = p.elim_ite();
m_local_ctx = p.local_ctx(); m_local_ctx = p.local_ctx();
@ -555,7 +555,7 @@ bool bool_rewriter::local_ctx_simp(unsigned num_args, expr * const * args, expr_
result = arg; \ result = arg; \
return true; \ return true; \
} \ } \
if (m_flat && m().is_or(arg)) { \ if (m_flat_and_or && m().is_or(arg)) { \
unsigned sz = to_app(arg)->get_num_args(); \ unsigned sz = to_app(arg)->get_num_args(); \
for (unsigned j = 0; j < sz; j++) { \ for (unsigned j = 0; j < sz; j++) { \
expr * arg_arg = to_app(arg)->get_arg(j); \ expr * arg_arg = to_app(arg)->get_arg(j); \

View file

@ -50,7 +50,7 @@ Notes:
*/ */
class bool_rewriter { class bool_rewriter {
ast_manager & m_manager; ast_manager & m_manager;
bool m_flat; bool m_flat_and_or;
bool m_local_ctx; bool m_local_ctx;
bool m_elim_and; bool m_elim_and;
bool m_blast_distinct; bool m_blast_distinct;
@ -83,8 +83,8 @@ public:
family_id get_fid() const { return m().get_basic_family_id(); } family_id get_fid() const { return m().get_basic_family_id(); }
bool is_eq(expr * t) const { return m().is_eq(t); } bool is_eq(expr * t) const { return m().is_eq(t); }
bool flat() const { return m_flat; } bool flat_and_or() const { return m_flat_and_or; }
void set_flat(bool f) { m_flat = f; } void set_flat_and_or(bool f) { m_flat_and_or = f; }
bool elim_and() const { return m_elim_and; } bool elim_and() const { return m_elim_and; }
void set_elim_and(bool f) { m_elim_and = f; } void set_elim_and(bool f) { m_elim_and = f; }
void reset_local_ctx_cost() { m_local_ctx_cost = 0; } void reset_local_ctx_cost() { m_local_ctx_cost = 0; }
@ -111,7 +111,7 @@ public:
mk_and_as_or(num_args, args, result); mk_and_as_or(num_args, args, result);
return BR_DONE; return BR_DONE;
} }
else if (m_flat) { else if (m_flat_and_or) {
return mk_flat_and_core(num_args, args, result); return mk_flat_and_core(num_args, args, result);
} }
else { else {
@ -119,7 +119,7 @@ public:
} }
} }
br_status mk_or_core(unsigned num_args, expr * const * args, expr_ref & result) { br_status mk_or_core(unsigned num_args, expr * const * args, expr_ref & result) {
return m_flat ? return m_flat_and_or ?
mk_flat_or_core(num_args, args, result) : mk_flat_or_core(num_args, args, result) :
mk_nflat_or_core(num_args, args, result); mk_nflat_or_core(num_args, args, result);
} }
@ -234,7 +234,7 @@ public:
struct bool_rewriter_cfg : public default_rewriter_cfg { struct bool_rewriter_cfg : public default_rewriter_cfg {
bool_rewriter m_r; bool_rewriter m_r;
bool flat_assoc(func_decl * f) const { return m_r.flat() && (m_r.m().is_and(f) || m_r.m().is_or(f)); } bool flat_assoc(func_decl * f) const { return m_r.flat_and_or() && (m_r.m().is_and(f) || m_r.m().is_or(f)); }
bool rewrite_patterns() const { return false; } bool rewrite_patterns() const { return false; }
br_status reduce_app(func_decl * f, unsigned num, expr * const * args, expr_ref & result, proof_ref & result_pr) { br_status reduce_app(func_decl * f, unsigned num, expr * const * args, expr_ref & result, proof_ref & result_pr) {
result_pr = nullptr; result_pr = nullptr;

View file

@ -86,7 +86,7 @@ struct evaluator_cfg : public default_rewriter_cfg {
m_dt(m), m_dt(m),
m_pinned(m) { m_pinned(m) {
bool flat = true; bool flat = true;
m_b_rw.set_flat(flat); m_b_rw.set_flat_and_or(flat);
m_a_rw.set_flat(flat); m_a_rw.set_flat(flat);
m_bv_rw.set_flat(flat); m_bv_rw.set_flat(flat);
m_bv_rw.set_mkbv2num(true); m_bv_rw.set_mkbv2num(true);

View file

@ -55,7 +55,7 @@ namespace bv {
m_ackerman(*this), m_ackerman(*this),
m_bb(m, get_config()), m_bb(m, get_config()),
m_find(*this) { m_find(*this) {
m_bb.set_flat(false); m_bb.set_flat_and_or(false);
} }
bool solver::is_fixed(euf::theory_var v, expr_ref& val, sat::literal_vector& lits) { bool solver::is_fixed(euf::theory_var v, expr_ref& val, sat::literal_vector& lits) {

View file

@ -866,7 +866,7 @@ private:
m_used_dependencies(m), m_used_dependencies(m),
m_rw(*this) { m_rw(*this) {
updt_params(p); updt_params(p);
m_b_rw.set_flat(false); // no flattening otherwise will blowup the memory m_b_rw.set_flat_and_or(false); // no flattening otherwise will blowup the memory
m_b_rw.set_elim_and(true); m_b_rw.set_elim_and(true);
} }

View file

@ -116,7 +116,7 @@ class tseitin_cnf_tactic : public tactic {
m_rw(_m), m_rw(_m),
m_num_aux_vars(0) { m_num_aux_vars(0) {
updt_params(p); updt_params(p);
m_rw.set_flat(false); m_rw.set_flat_and_or(false);
} }
void updt_params(params_ref const & p) { void updt_params(params_ref const & p) {