mirror of
https://github.com/Z3Prover/z3
synced 2025-06-21 05:13:39 +00:00
re-factoring
This commit is contained in:
parent
7f7185ce02
commit
bcab9a3600
7 changed files with 29 additions and 26 deletions
|
@ -18,6 +18,8 @@ Revision History:
|
||||||
#include"ackr_params.hpp"
|
#include"ackr_params.hpp"
|
||||||
#include"ackr_model_converter.h"
|
#include"ackr_model_converter.h"
|
||||||
#include"model_smt2_pp.h"
|
#include"model_smt2_pp.h"
|
||||||
|
#include"ackr_bound_probe.h"
|
||||||
|
#include"ackr_tactics_params.hpp"
|
||||||
|
|
||||||
class ackermannize_tactic : public tactic {
|
class ackermannize_tactic : public tactic {
|
||||||
public:
|
public:
|
||||||
|
@ -35,10 +37,10 @@ public:
|
||||||
expr_dependency_ref & core) {
|
expr_dependency_ref & core) {
|
||||||
mc = 0;
|
mc = 0;
|
||||||
ast_manager& m(g->m());
|
ast_manager& m(g->m());
|
||||||
tactic_report report("ackermannize", *g);
|
tactic_report report("ackermannize", *g);
|
||||||
fail_if_unsat_core_generation("ackermannize", g);
|
fail_if_unsat_core_generation("ackermannize", g);
|
||||||
fail_if_proof_generation("ackermannize", g);
|
fail_if_proof_generation("ackermannize", g);
|
||||||
|
|
||||||
expr_ref_vector flas(m);
|
expr_ref_vector flas(m);
|
||||||
const unsigned sz = g->size();
|
const unsigned sz = g->size();
|
||||||
for (unsigned i = 0; i < sz; i++) flas.push_back(g->form(i));
|
for (unsigned i = 0; i < sz; i++) flas.push_back(g->form(i));
|
||||||
|
@ -78,3 +80,15 @@ private:
|
||||||
tactic * mk_ackermannize_tactic(ast_manager & m, params_ref const & p) {
|
tactic * mk_ackermannize_tactic(ast_manager & m, params_ref const & p) {
|
||||||
return alloc(ackermannize_tactic, m, p);
|
return alloc(ackermannize_tactic, m, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tactic * mk_ackermannize_bounded_tactic(ast_manager & m, params_ref const & p) {
|
||||||
|
ackr_tactics_params my_params(p);
|
||||||
|
const double should_ackermannize = static_cast<double>(my_params.div0ackermann());
|
||||||
|
const double ackermannize_limit = static_cast<double>(my_params.div0_ackermann_limit());
|
||||||
|
probe * const should_ackermann_p = mk_and(
|
||||||
|
mk_const_probe(should_ackermannize),
|
||||||
|
mk_lt(mk_ackr_bound_probe(), mk_const_probe(ackermannize_limit))
|
||||||
|
);
|
||||||
|
tactic * const actual_tactic = mk_ackermannize_tactic(m, p);
|
||||||
|
return when(should_ackermann_p, actual_tactic);
|
||||||
|
}
|
|
@ -18,10 +18,12 @@ Revision History:
|
||||||
#define _ACKERMANNIZE_TACTIC_H
|
#define _ACKERMANNIZE_TACTIC_H
|
||||||
#include"tactical.h"
|
#include"tactical.h"
|
||||||
|
|
||||||
|
tactic * mk_ackermannize_bounded_tactic(ast_manager & m, params_ref const & p);
|
||||||
tactic * mk_ackermannize_tactic(ast_manager & m, params_ref const & p);
|
tactic * mk_ackermannize_tactic(ast_manager & m, params_ref const & p);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ADD_TACTIC("ackermannize", "A tactic for performing full Ackermannization.", "mk_ackermannize_tactic(m, p)")
|
ADD_TACTIC("ackermannize", "A tactic for performing full Ackermannization.", "mk_ackermannize_tactic(m, p)")
|
||||||
|
ADD_TACTIC("ackermannize_bounded", "A tactic for performing full Ackermannization where Ackermannization is invoked only if bounds given by the parameters of the tactic are not exceeded.", "mk_ackermannize_bounded_tactic(m, p)")
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3,5 +3,7 @@ def_module_params('ackr_tactics',
|
||||||
export=True,
|
export=True,
|
||||||
params=(
|
params=(
|
||||||
('sat_backend', BOOL, False, 'use SAT rather than SMT in qfufbv_ackr_tactic'),
|
('sat_backend', BOOL, False, 'use SAT rather than SMT in qfufbv_ackr_tactic'),
|
||||||
|
('div0ackermann', BOOL, False, "if true, then try to Ackermannize div etc functions."),
|
||||||
|
("div0_ackermann_limit", UINT, 1000, "a bound for number of congruence Ackermann lemmas")
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,10 @@ public:
|
||||||
expr_dependency_ref & core) {
|
expr_dependency_ref & core) {
|
||||||
mc = 0;
|
mc = 0;
|
||||||
ast_manager& m(g->m());
|
ast_manager& m(g->m());
|
||||||
|
tactic_report report("qfufbv_ackr", *g);
|
||||||
|
fail_if_unsat_core_generation("qfufbv_ackr", g);
|
||||||
|
fail_if_proof_generation("qfufbv_ackr", g);
|
||||||
|
|
||||||
TRACE("qfufbv_ackr_tactic", g->display(tout << "goal:\n"););
|
TRACE("qfufbv_ackr_tactic", g->display(tout << "goal:\n"););
|
||||||
// running implementation
|
// running implementation
|
||||||
expr_ref_vector flas(m);
|
expr_ref_vector flas(m);
|
||||||
|
|
|
@ -21,7 +21,7 @@ Revision History:
|
||||||
tactic * mk_qfufbv_ackr_tactic(ast_manager & m, params_ref const & p);
|
tactic * mk_qfufbv_ackr_tactic(ast_manager & m, params_ref const & p);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ADD_TACTIC("qfufbv_ackr", "A tactic for solving QF_UFBV based on Ackermannization.", "mk_qfufbv_ackr_tactic(m, p)")
|
ADD_TACTIC("qfufbv_ackr", "A tactic for solving QF_UFBV based on Ackermannization.", "mk_qfufbv_ackr_tactic(m, p)")
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -29,8 +29,6 @@ Notes:
|
||||||
#include"aig_tactic.h"
|
#include"aig_tactic.h"
|
||||||
#include"sat_tactic.h"
|
#include"sat_tactic.h"
|
||||||
#include"ackermannize_tactic.h"
|
#include"ackermannize_tactic.h"
|
||||||
#include"ackr_bound_probe.h"
|
|
||||||
#include"qfbv_tactic_params.hpp"
|
|
||||||
|
|
||||||
#define MEMLIMIT 300
|
#define MEMLIMIT 300
|
||||||
|
|
||||||
|
@ -49,21 +47,10 @@ tactic * mk_qfbv_preamble(ast_manager& m, params_ref const& p) {
|
||||||
simp2_p.set_bool("flat", true); // required by som
|
simp2_p.set_bool("flat", true); // required by som
|
||||||
simp2_p.set_bool("hoist_mul", false); // required by som
|
simp2_p.set_bool("hoist_mul", false); // required by som
|
||||||
|
|
||||||
|
|
||||||
qfbv_tactic_params my_params(p);
|
|
||||||
|
|
||||||
params_ref hoist_p;
|
params_ref hoist_p;
|
||||||
hoist_p.set_bool("hoist_mul", true);
|
hoist_p.set_bool("hoist_mul", true);
|
||||||
hoist_p.set_bool("som", false);
|
hoist_p.set_bool("som", false);
|
||||||
|
|
||||||
const double should_ackermannize = static_cast<double>(my_params.div0ackermann());
|
|
||||||
const double ackermannize_limit = static_cast<double>(my_params.div0_ackermann_limit());
|
|
||||||
probe * const should_ackermann_p = mk_and(
|
|
||||||
mk_const_probe(should_ackermannize),
|
|
||||||
mk_lt(mk_ackr_bound_probe(), mk_const_probe(ackermannize_limit))
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
return
|
return
|
||||||
and_then(
|
and_then(
|
||||||
mk_simplify_tactic(m),
|
mk_simplify_tactic(m),
|
||||||
|
@ -80,7 +67,7 @@ tactic * mk_qfbv_preamble(ast_manager& m, params_ref const& p) {
|
||||||
//
|
//
|
||||||
using_params(mk_simplify_tactic(m), hoist_p),
|
using_params(mk_simplify_tactic(m), hoist_p),
|
||||||
mk_max_bv_sharing_tactic(m),
|
mk_max_bv_sharing_tactic(m),
|
||||||
when(should_ackermann_p, mk_ackermannize_tactic(m,p))
|
mk_ackermannize_bounded_tactic(m,p)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
def_module_params(class_name='qfbv_tactic_params',
|
|
||||||
module_name="smtlogic_tactic",
|
|
||||||
export=True,
|
|
||||||
params=(('div0ackermann', BOOL, False, "if true, then try to Ackermannize div etc functions."),
|
|
||||||
("div0_ackermann_limit", UINT, 1000, "a bound for number of congregants Ackerman lemmas")
|
|
||||||
))
|
|
Loading…
Add table
Add a link
Reference in a new issue