Skip to content

Commit

Permalink
have bool rewriter use flat_and_or, and integrate hoist rewriter
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolajBjorner committed Nov 8, 2022
1 parent 238ea0a commit f769e2f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/ast/rewriter/bool_rewriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Module Name:

void bool_rewriter::updt_params(params_ref const & _p) {
bool_rewriter_params p(_p);
m_flat_and_or = p.flat();
m_flat_and_or = p.flat_and_or();
m_elim_and = p.elim_and();
m_elim_ite = p.elim_ite();
m_local_ctx = p.local_ctx();
Expand Down Expand Up @@ -267,6 +267,15 @@ br_status bool_rewriter::mk_nflat_or_core(unsigned num_args, expr * const * args
return BR_DONE;
}

#if 1
br_status st;
st = m_hoist.mk_or(buffer.size(), buffer.data(), result);
if (st == BR_DONE)
return BR_REWRITE1;
if (st != BR_FAILED)
return st;
#endif

if (s) {
ast_lt lt;
std::sort(buffer.begin(), buffer.end(), lt);
Expand Down
4 changes: 3 additions & 1 deletion src/ast/rewriter/bool_rewriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Module Name:

#include "ast/ast.h"
#include "ast/rewriter/rewriter.h"
#include "ast/rewriter/hoist_rewriter.h"
#include "util/params.h"

/**
Expand Down Expand Up @@ -50,6 +51,7 @@ Module Name:
*/
class bool_rewriter {
ast_manager & m_manager;
hoist_rewriter m_hoist;
bool m_flat_and_or;
bool m_local_ctx;
bool m_elim_and;
Expand Down Expand Up @@ -78,7 +80,7 @@ class bool_rewriter {
void push_new_arg(expr* arg, expr_ref_vector& new_args, expr_fast_mark1& neg_lits, expr_fast_mark2& pos_lits);

public:
bool_rewriter(ast_manager & m, params_ref const & p = params_ref()):m_manager(m), m_local_ctx_cost(0) { updt_params(p); }
bool_rewriter(ast_manager & m, params_ref const & p = params_ref()):m_manager(m), m_hoist(m), m_local_ctx_cost(0) { updt_params(p); }
ast_manager & m() const { return m_manager; }
family_id get_fid() const { return m().get_basic_family_id(); }
bool is_eq(expr * t) const { return m().is_eq(t); }
Expand Down

0 comments on commit f769e2f

Please sign in to comment.