mirror of
https://github.com/Z3Prover/z3
synced 2025-05-02 13:27:01 +00:00
convert reduce-args to a simplifier
- convert reduce-args to a simplifier. Currently exposed as reduce-args2 tactic until the old tactic code gets removed. - bug fixes in model_reconstruction trail - allow multiple defs to be added with same pool of removed formulas - fix tracking of function symbols instead of expressions to filter replay - add nla_divisions to track (cheap) divisibility lemmas. -
This commit is contained in:
parent
246d6f7b77
commit
8ea49eed8e
23 changed files with 740 additions and 92 deletions
|
@ -18,6 +18,7 @@ Notes:
|
|||
--*/
|
||||
#include "tactic/tactical.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
#include "ast/ast_util.h"
|
||||
#include "ast/array_decl_plugin.h"
|
||||
#include "ast/has_free_vars.h"
|
||||
#include "util/map.h"
|
||||
|
@ -397,7 +398,7 @@ struct reduce_args_tactic::imp {
|
|||
ptr_buffer<expr> new_args;
|
||||
var_ref_vector new_vars(m);
|
||||
ptr_buffer<expr> new_eqs;
|
||||
generic_model_converter * f_mc = alloc(generic_model_converter, m, "reduce_args");
|
||||
generic_model_converter * f_mc = alloc(generic_model_converter, m, "reduce_args");
|
||||
for (auto const& [f, map] : decl2arg2funcs)
|
||||
for (auto const& [t, new_def] : *map)
|
||||
f_mc->hide(new_def);
|
||||
|
@ -414,7 +415,6 @@ struct reduce_args_tactic::imp {
|
|||
new_args.push_back(new_vars.back());
|
||||
}
|
||||
for (auto const& [t, new_def] : *map) {
|
||||
// f_mc->hide(new_def);
|
||||
SASSERT(new_def->get_arity() == new_args.size());
|
||||
app * new_t = m.mk_app(new_def, new_args);
|
||||
if (def == nullptr) {
|
||||
|
@ -427,11 +427,7 @@ struct reduce_args_tactic::imp {
|
|||
new_eqs.push_back(m.mk_eq(new_vars.get(i), t->get_arg(i)));
|
||||
}
|
||||
SASSERT(new_eqs.size() > 0);
|
||||
expr * cond;
|
||||
if (new_eqs.size() == 1)
|
||||
cond = new_eqs[0];
|
||||
else
|
||||
cond = m.mk_and(new_eqs);
|
||||
expr * cond = mk_and(m, new_eqs);
|
||||
def = m.mk_ite(cond, new_t, def);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,6 +63,8 @@ It creates a fresh function for each of the different values at position `i`.
|
|||
#pragma once
|
||||
|
||||
#include "util/params.h"
|
||||
#include "ast/simplifiers/reduce_args_simplifier.h"
|
||||
#include "tactic/dependent_expr_state_tactic.h"
|
||||
class ast_manager;
|
||||
class tactic;
|
||||
|
||||
|
@ -71,3 +73,11 @@ tactic * mk_reduce_args_tactic(ast_manager & m, params_ref const & p = params_re
|
|||
ADD_TACTIC("reduce-args", "reduce the number of arguments of function applications, when for all occurrences of a function f the i-th is a value.", "mk_reduce_args_tactic(m, p)")
|
||||
*/
|
||||
|
||||
inline tactic* mk_reduce_args_tactic2(ast_manager& m, params_ref const& p = params_ref()) {
|
||||
return alloc(dependent_expr_state_tactic, m, p,
|
||||
[](auto& m, auto& p, auto& s) -> dependent_expr_simplifier* { return mk_reduce_args_simplifier(m, s, p); });
|
||||
}
|
||||
/*
|
||||
ADD_TACTIC("reduce-args2", "reduce the number of arguments of function applications, when for all occurrences of a function f the i-th is a value.", "mk_reduce_args_tactic2(m, p)")
|
||||
*/
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue