mirror of
https://github.com/Z3Prover/z3
synced 2025-08-22 11:07:51 +00:00
switch to solve_eqs2 tactic
This commit is contained in:
parent
f769e2f1f6
commit
3a37cfca30
24 changed files with 149 additions and 52 deletions
|
@ -29,13 +29,19 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
inline tactic * mk_solve_eqs2_tactic(ast_manager& m, params_ref const& p) {
|
||||
return alloc(dependent_expr_state_tactic, m, p, alloc(solve_eqs2_tactic_factory), "solve-eqs2");
|
||||
inline tactic * mk_solve_eqs2_tactic(ast_manager& m, params_ref const& p = params_ref()) {
|
||||
return alloc(dependent_expr_state_tactic, m, p, alloc(solve_eqs2_tactic_factory), "solve-eqs");
|
||||
}
|
||||
|
||||
#if 1
|
||||
inline tactic * mk_solve_eqs_tactic(ast_manager & m, params_ref const & p = params_ref()) {
|
||||
return mk_solve_eqs2_tactic(m, p);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
ADD_TACTIC("solve-eqs2", "solve for variables.", "mk_solve_eqs2_tactic(m, p)")
|
||||
ADD_TACTIC("solve-eqs", "solve for variables.", "mk_solve_eqs2_tactic(m, p)")
|
||||
*/
|
||||
|
||||
|
||||
|
|
|
@ -997,6 +997,8 @@ class solve_eqs_tactic : public tactic {
|
|||
//
|
||||
void operator()(goal_ref const & g, goal_ref_buffer & result) {
|
||||
model_converter_ref mc;
|
||||
std::function<void(statistics&)> coll = [&](statistics& st) { collect_statistics(st); };
|
||||
statistics_report sreport(coll);
|
||||
tactic_report report("solve_eqs", *g);
|
||||
TRACE("goal", g->display(tout););
|
||||
m_produce_models = g->models_enabled();
|
||||
|
@ -1042,7 +1044,6 @@ class solve_eqs_tactic : public tactic {
|
|||
result.push_back(g.get());
|
||||
|
||||
|
||||
IF_VERBOSE(10, statistics st; collect_statistics(st); st.display_smt2(verbose_stream()));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1103,6 +1104,6 @@ public:
|
|||
|
||||
};
|
||||
|
||||
tactic * mk_solve_eqs_tactic(ast_manager & m, params_ref const & p) {
|
||||
tactic * mk_solve_eqs1_tactic(ast_manager & m, params_ref const & p) {
|
||||
return clean(alloc(solve_eqs_tactic, m, p, mk_expr_simp_replacer(m, p), true));
|
||||
}
|
||||
|
|
|
@ -22,10 +22,16 @@ Revision History:
|
|||
class ast_manager;
|
||||
class tactic;
|
||||
|
||||
tactic * mk_solve_eqs_tactic(ast_manager & m, params_ref const & p = params_ref());
|
||||
tactic * mk_solve_eqs1_tactic(ast_manager & m, params_ref const & p = params_ref());
|
||||
|
||||
#if 0
|
||||
inline tactic * mk_solve_eqs_tactic(ast_manager & m, params_ref const & p = params_ref()) {
|
||||
return mk_solve_eqs1_tactic(m, p);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
ADD_TACTIC("solve-eqs", "eliminate variables by solving equations.", "mk_solve_eqs_tactic(m, p)")
|
||||
ADD_TACTIC("solve-eqs1", "eliminate variables by solving equations.", "mk_solve_eqs1_tactic(m, p)")
|
||||
*/
|
||||
|
||||
|
||||
|
|
|
@ -22,16 +22,19 @@ class dependent_expr_state_tactic : public tactic, public dependent_expr_state {
|
|||
ast_manager& m;
|
||||
params_ref m_params;
|
||||
std::string m_name;
|
||||
ref<dependent_expr_simplifier_factory> m_factory;
|
||||
scoped_ptr<dependent_expr_simplifier> m_simp;
|
||||
trail_stack m_trail;
|
||||
scoped_ptr<model_reconstruction_trail> m_model_trail;
|
||||
trail_stack m_trail;
|
||||
goal_ref m_goal;
|
||||
dependent_expr m_dep;
|
||||
statistics m_st;
|
||||
ref<dependent_expr_simplifier_factory> m_factory;
|
||||
scoped_ptr<dependent_expr_simplifier> m_simp;
|
||||
scoped_ptr<model_reconstruction_trail> m_model_trail;
|
||||
|
||||
void init() {
|
||||
if (!m_simp)
|
||||
if (!m_simp) {
|
||||
m_simp = m_factory->mk(m, m_params, *this);
|
||||
m_st.reset();
|
||||
}
|
||||
if (!m_model_trail)
|
||||
m_model_trail = alloc(model_reconstruction_trail, m, m_trail);
|
||||
}
|
||||
|
@ -43,7 +46,7 @@ public:
|
|||
m_params(p),
|
||||
m_name(name),
|
||||
m_factory(f),
|
||||
m_simp(f->mk(m, p, *this)),
|
||||
m_simp(nullptr),
|
||||
m_dep(m, m.mk_true(), nullptr)
|
||||
{}
|
||||
|
||||
|
@ -86,30 +89,34 @@ public:
|
|||
if (in->proofs_enabled())
|
||||
throw tactic_exception("tactic does not support low level proofs");
|
||||
init();
|
||||
statistics_report sreport(*this);
|
||||
tactic_report report(name(), *in);
|
||||
m_goal = in.get();
|
||||
m_simp->reduce();
|
||||
m_goal->inc_depth();
|
||||
if (in->models_enabled())
|
||||
in->set(m_model_trail->get_model_converter().get());
|
||||
in->add(m_model_trail->get_model_converter().get());
|
||||
result.push_back(in.get());
|
||||
|
||||
statistics st;
|
||||
collect_statistics(st);
|
||||
IF_VERBOSE(10, st.display_smt2(verbose_stream()));
|
||||
}
|
||||
|
||||
void cleanup() override {
|
||||
if (m_simp)
|
||||
m_simp->collect_statistics(m_st);
|
||||
m_simp = nullptr;
|
||||
m_model_trail = nullptr;
|
||||
}
|
||||
|
||||
void collect_statistics(statistics & st) const override {
|
||||
if (m_simp)
|
||||
if (m_simp)
|
||||
m_simp->collect_statistics(st);
|
||||
else
|
||||
st.copy(m_st);
|
||||
}
|
||||
|
||||
void reset_statistics() override {
|
||||
if (m_simp)
|
||||
m_simp->reset_statistics();
|
||||
m_st.reset();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ Notes:
|
|||
--*/
|
||||
#include "ast/normal_forms/nnf.h"
|
||||
#include "tactic/core/solve_eqs_tactic.h"
|
||||
#include "tactic/core/solve_eqs2_tactic.h"
|
||||
#include "tactic/bv/bv_size_reduction_tactic.h"
|
||||
#include "tactic/bv/max_bv_sharing_tactic.h"
|
||||
#include "tactic/core/simplify_tactic.h"
|
||||
|
|
|
@ -17,6 +17,7 @@ Notes:
|
|||
|
||||
--*/
|
||||
#include "tactic/core/solve_eqs_tactic.h"
|
||||
#include "tactic/core/solve_eqs2_tactic.h"
|
||||
#include "tactic/core/simplify_tactic.h"
|
||||
#include "tactic/core/propagate_values_tactic.h"
|
||||
#include "tactic/bv/bit_blaster_tactic.h"
|
||||
|
|
|
@ -21,6 +21,7 @@ Notes:
|
|||
#include "tactic/core/propagate_values_tactic.h"
|
||||
#include "tactic/arith/propagate_ineqs_tactic.h"
|
||||
#include "tactic/core/solve_eqs_tactic.h"
|
||||
#include "tactic/core/solve_eqs2_tactic.h"
|
||||
#include "tactic/core/elim_uncnstr_tactic.h"
|
||||
#include "tactic/smtlogics/smt_tactic.h"
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ Notes:
|
|||
#include "tactic/core/simplify_tactic.h"
|
||||
#include "tactic/core/propagate_values_tactic.h"
|
||||
#include "tactic/core/solve_eqs_tactic.h"
|
||||
#include "tactic/core/solve_eqs2_tactic.h"
|
||||
#include "tactic/core/elim_uncnstr_tactic.h"
|
||||
#include "tactic/bv/bit_blaster_tactic.h"
|
||||
#include "tactic/bv/bv1_blaster_tactic.h"
|
||||
|
@ -39,6 +40,9 @@ static tactic * mk_qfbv_preamble(ast_manager& m, params_ref const& p) {
|
|||
// conservative gaussian elimination.
|
||||
solve_eq_p.set_uint("solve_eqs_max_occs", 2);
|
||||
|
||||
params_ref flat_and_or_p = p;
|
||||
flat_and_or_p.set_bool("flat_and_or", false);
|
||||
|
||||
params_ref simp2_p = p;
|
||||
simp2_p.set_bool("som", true);
|
||||
simp2_p.set_bool("pull_cheap_ite", true);
|
||||
|
@ -47,15 +51,17 @@ static tactic * mk_qfbv_preamble(ast_manager& m, params_ref const& p) {
|
|||
simp2_p.set_uint("local_ctx_limit", 10000000);
|
||||
simp2_p.set_bool("flat", true); // required by som
|
||||
simp2_p.set_bool("hoist_mul", false); // required by som
|
||||
simp2_p.set_bool("flat_and_or", false);
|
||||
|
||||
params_ref hoist_p;
|
||||
hoist_p.set_bool("hoist_mul", true);
|
||||
hoist_p.set_bool("som", false);
|
||||
hoist_p.set_bool("flat_and_or", false);
|
||||
|
||||
return
|
||||
and_then(
|
||||
mk_simplify_tactic(m),
|
||||
mk_propagate_values_tactic(m),
|
||||
using_params(mk_simplify_tactic(m), flat_and_or_p),
|
||||
using_params(mk_propagate_values_tactic(m), flat_and_or_p),
|
||||
using_params(mk_solve_eqs_tactic(m), solve_eq_p),
|
||||
mk_elim_uncnstr_tactic(m),
|
||||
if_no_proofs(if_no_unsat_cores(mk_bv_size_reduction_tactic(m))),
|
||||
|
@ -87,6 +93,7 @@ static tactic * mk_qfbv_tactic(ast_manager& m, params_ref const & p, tactic* sat
|
|||
params_ref local_ctx_p = p;
|
||||
local_ctx_p.set_bool("local_ctx", true);
|
||||
local_ctx_p.set_bool("flat", false);
|
||||
local_ctx_p.set_bool("flat_and_or", false);
|
||||
|
||||
params_ref solver_p;
|
||||
solver_p.set_bool("preprocess", false); // preprocessor of smt::context is not needed.
|
||||
|
|
|
@ -21,6 +21,7 @@ Notes:
|
|||
#include "tactic/core/propagate_values_tactic.h"
|
||||
#include "tactic/arith/propagate_ineqs_tactic.h"
|
||||
#include "tactic/core/solve_eqs_tactic.h"
|
||||
#include "tactic/core/solve_eqs2_tactic.h"
|
||||
#include "tactic/core/elim_uncnstr_tactic.h"
|
||||
#include "tactic/arith/normalize_bounds_tactic.h"
|
||||
#include "tactic/arith/fix_dl_var_tactic.h"
|
||||
|
|
|
@ -22,6 +22,7 @@ Notes:
|
|||
#include "tactic/arith/propagate_ineqs_tactic.h"
|
||||
#include "tactic/arith/normalize_bounds_tactic.h"
|
||||
#include "tactic/core/solve_eqs_tactic.h"
|
||||
#include "tactic/core/solve_eqs2_tactic.h"
|
||||
#include "tactic/core/elim_uncnstr_tactic.h"
|
||||
#include "tactic/arith/add_bounds_tactic.h"
|
||||
#include "tactic/arith/pb2bv_tactic.h"
|
||||
|
|
|
@ -21,6 +21,7 @@ Notes:
|
|||
#include "tactic/core/simplify_tactic.h"
|
||||
#include "tactic/core/symmetry_reduce_tactic.h"
|
||||
#include "tactic/core/solve_eqs_tactic.h"
|
||||
#include "tactic/core/solve_eqs2_tactic.h"
|
||||
#include "tactic/core/propagate_values_tactic.h"
|
||||
#include "tactic/smtlogics/smt_tactic.h"
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ Notes:
|
|||
#include "tactic/core/simplify_tactic.h"
|
||||
#include "tactic/core/propagate_values_tactic.h"
|
||||
#include "tactic/core/solve_eqs_tactic.h"
|
||||
#include "tactic/core/solve_eqs2_tactic.h"
|
||||
#include "tactic/core/elim_uncnstr_tactic.h"
|
||||
#include "tactic/bv/max_bv_sharing_tactic.h"
|
||||
#include "tactic/bv/bv_size_reduction_tactic.h"
|
||||
|
@ -136,22 +137,23 @@ private:
|
|||
};
|
||||
|
||||
static tactic * mk_qfufbv_preamble1(ast_manager & m, params_ref const & p) {
|
||||
params_ref simp2_p = p;
|
||||
params_ref simp2_p = p, flat_and_or_p = p;
|
||||
flat_and_or_p.set_bool("flat_and_or", false);
|
||||
simp2_p.set_bool("pull_cheap_ite", true);
|
||||
simp2_p.set_bool("push_ite_bv", false);
|
||||
simp2_p.set_bool("local_ctx", true);
|
||||
simp2_p.set_uint("local_ctx_limit", 10000000);
|
||||
|
||||
simp2_p.set_bool("ite_extra_rules", true);
|
||||
simp2_p.set_bool("mul2concat", true);
|
||||
simp2_p.set_bool("flat_and_or", false);
|
||||
|
||||
params_ref ctx_simp_p;
|
||||
ctx_simp_p.set_uint("max_depth", 32);
|
||||
ctx_simp_p.set_uint("max_steps", 5000000);
|
||||
|
||||
return and_then(
|
||||
mk_simplify_tactic(m),
|
||||
mk_propagate_values_tactic(m),
|
||||
using_params(mk_simplify_tactic(m), flat_and_or_p),
|
||||
using_params(mk_propagate_values_tactic(m), flat_and_or_p),
|
||||
if_no_proofs(if_no_unsat_cores(mk_bv_bound_chk_tactic(m))),
|
||||
//using_params(mk_ctx_simplify_tactic(m_m), ctx_simp_p),
|
||||
mk_solve_eqs_tactic(m),
|
||||
|
@ -163,8 +165,10 @@ static tactic * mk_qfufbv_preamble1(ast_manager & m, params_ref const & p) {
|
|||
}
|
||||
|
||||
static tactic * mk_qfufbv_preamble(ast_manager & m, params_ref const & p) {
|
||||
return and_then(mk_simplify_tactic(m),
|
||||
mk_propagate_values_tactic(m),
|
||||
params_ref simp2_p = p, flat_and_or_p = p;
|
||||
flat_and_or_p.set_bool("flat_and_or", false);
|
||||
return and_then(using_params(mk_simplify_tactic(m), flat_and_or_p),
|
||||
using_params(mk_propagate_values_tactic(m), flat_and_or_p),
|
||||
mk_solve_eqs_tactic(m),
|
||||
mk_elim_uncnstr_tactic(m),
|
||||
if_no_proofs(if_no_unsat_cores(mk_reduce_args_tactic(m))),
|
||||
|
|
|
@ -20,6 +20,7 @@ Revision History:
|
|||
#include "tactic/core/simplify_tactic.h"
|
||||
#include "tactic/core/propagate_values_tactic.h"
|
||||
#include "tactic/core/solve_eqs_tactic.h"
|
||||
#include "tactic/core/solve_eqs2_tactic.h"
|
||||
#include "tactic/core/elim_uncnstr_tactic.h"
|
||||
#include "qe/lite/qe_lite.h"
|
||||
#include "qe/qsat.h"
|
||||
|
|
|
@ -20,6 +20,7 @@ Notes:
|
|||
#include "tactic/core/simplify_tactic.h"
|
||||
#include "tactic/core/propagate_values_tactic.h"
|
||||
#include "tactic/core/solve_eqs_tactic.h"
|
||||
#include "tactic/core/solve_eqs2_tactic.h"
|
||||
#include "tactic/core/distribute_forall_tactic.h"
|
||||
#include "tactic/core/der_tactic.h"
|
||||
#include "tactic/core/reduce_args_tactic.h"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue