mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 09:05:31 +00:00
Adding some options in support of F* (#6774)
* patterns: add option for pattern decomposition (pi.decompose_patterns) True by default, retaining current behavior. * rewriter: add option for sorting of disjunctions (rewriter.sort_disjunctions) True by default, retaining current behavior.
This commit is contained in:
parent
eb1caee18a
commit
3517361a73
8 changed files with 14 additions and 2 deletions
|
@ -109,6 +109,7 @@ pattern_inference_cfg::pattern_inference_cfg(ast_manager & m, pattern_inference_
|
|||
m_le(),
|
||||
m_nested_arith_only(true),
|
||||
m_block_loop_patterns(params.m_pi_block_loop_patterns),
|
||||
m_decompose_patterns(params.m_pi_decompose_patterns),
|
||||
m_candidates(m),
|
||||
m_pattern_weight_lt(m_candidates_info),
|
||||
m_collect(m, *this),
|
||||
|
@ -407,6 +408,9 @@ bool pattern_inference_cfg::pattern_weight_lt::operator()(expr * n1, expr * n2)
|
|||
|
||||
|
||||
app* pattern_inference_cfg::mk_pattern(app* candidate) {
|
||||
if (!m_decompose_patterns)
|
||||
return m.mk_pattern(candidate);
|
||||
|
||||
auto has_var_arg = [&](expr* e) {
|
||||
if (!is_app(e))
|
||||
return false;
|
||||
|
|
|
@ -70,6 +70,7 @@ class pattern_inference_cfg : public default_rewriter_cfg {
|
|||
expr * const * m_no_patterns;
|
||||
bool m_nested_arith_only;
|
||||
bool m_block_loop_patterns;
|
||||
bool m_decompose_patterns;
|
||||
|
||||
struct info {
|
||||
uint_set m_free_vars;
|
||||
|
|
|
@ -26,6 +26,7 @@ Notes:
|
|||
void bool_rewriter::updt_params(params_ref const & _p) {
|
||||
bool_rewriter_params p(_p);
|
||||
m_flat_and_or = p.flat_and_or();
|
||||
m_sort_disjunctions = p.sort_disjunctions();
|
||||
m_elim_and = p.elim_and();
|
||||
m_elim_ite = p.elim_ite();
|
||||
m_local_ctx = p.local_ctx();
|
||||
|
@ -291,7 +292,7 @@ br_status bool_rewriter::mk_nflat_or_core(unsigned num_args, expr * const * args
|
|||
if (st != BR_FAILED)
|
||||
return st;
|
||||
#endif
|
||||
if (s) {
|
||||
if (m_sort_disjunctions && s) {
|
||||
ast_lt lt;
|
||||
std::sort(buffer.begin(), buffer.end(), lt);
|
||||
result = m().mk_or(sz, buffer.data());
|
||||
|
@ -329,7 +330,7 @@ br_status bool_rewriter::mk_flat_or_core(unsigned num_args, expr * const * args,
|
|||
}
|
||||
}
|
||||
if (mk_nflat_or_core(flat_args.size(), flat_args.data(), result) == BR_FAILED) {
|
||||
if (!ordered) {
|
||||
if (m_sort_disjunctions && !ordered) {
|
||||
ast_lt lt;
|
||||
std::sort(flat_args.begin(), flat_args.end(), lt);
|
||||
}
|
||||
|
|
|
@ -53,6 +53,7 @@ class bool_rewriter {
|
|||
ast_manager & m_manager;
|
||||
hoist_rewriter m_hoist;
|
||||
bool m_flat_and_or = false;
|
||||
bool m_sort_disjunctions = true;
|
||||
bool m_local_ctx = false;
|
||||
bool m_elim_and = false;
|
||||
bool m_blast_distinct = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue