3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-13 20:38:43 +00:00

checkpoint

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2012-10-25 15:44:53 -07:00
parent 8a4f6d5719
commit 1ea606092c
50 changed files with 279 additions and 211 deletions

View file

@ -37,7 +37,7 @@ add_lib('macros', ['simplifier', 'old_params'], 'ast/macros')
add_lib('grobner', ['ast'], 'math/grobner')
add_lib('euclid', ['util'], 'math/euclid')
add_lib('proof_checker', ['rewriter', 'old_params'], 'ast/proof_checker')
add_lib('bit_blaster', ['rewriter', 'simplifier', 'old_params', 'tactic'], 'tactic/bit_blaster')
add_lib('bit_blaster', ['rewriter', 'simplifier', 'old_params'], 'ast/rewriter/bit_blaster')
add_lib('smt', ['bit_blaster', 'macros', 'normal_forms', 'cmd_context',
'substitution', 'grobner', 'euclid', 'proof_checker', 'pattern', 'parser_util'])
add_lib('user_plugin', ['smt'], 'smt/user_plugin')

View file

@ -139,7 +139,7 @@ struct blaster_rewriter_cfg : public default_rewriter_cfg {
bool max_steps_exceeded(unsigned num_steps) const {
cooperate("bit blaster");
if (memory::get_allocation_size() > m_max_memory)
throw tactic_exception(TACTIC_MAX_MEMORY_MSG);
throw rewriter_exception(Z3_MAX_MEMORY_MSG);
return num_steps > m_max_steps;
}
@ -307,7 +307,7 @@ MK_PARAMETRIC_UNARY_REDUCE(reduce_sign_extend, mk_sign_extend);
}
void throw_unsupported() {
throw tactic_exception("operator is not supported, you must simplify the goal before applying bit-blasting");
throw rewriter_exception("operator is not supported, you must simplify the goal before applying bit-blasting");
}
void blast_bv_term(expr * t, expr_ref & result, proof_ref & result_pr) {

View file

@ -20,14 +20,15 @@ Revision History:
#include"rational.h"
#include"ast_pp.h"
#include"cooperate.h"
#include"tactic_exception.h"
#include"common_msgs.h"
#include"rewriter_types.h"
template<typename Cfg>
void bit_blaster_tpl<Cfg>::checkpoint() {
if (memory::get_allocation_size() > m_max_memory)
throw tactic_exception(TACTIC_MAX_MEMORY_MSG);
throw rewriter_exception(Z3_MAX_MEMORY_MSG);
if (m_cancel)
throw tactic_exception(TACTIC_CANCELED_MSG);
throw rewriter_exception(Z3_CANCELED_MSG);
cooperate("bit-blaster");
}

View file

@ -139,58 +139,10 @@ MK_SIMPLE_TACTIC_FACTORY(ufbv_fct, mk_ufbv_tactic(m, p));
void install_tactics(tactic_manager & ctx) {
ADD_TACTIC_CMD("bv1-blast", "reduce bit-vector expressions into bit-vectors of size 1 (notes: only equality, extract and concat are supported).", bv1blaster_fct);
ADD_TACTIC_CMD("ctx-simplify", "apply contextual simplification rules.", ctx_simplify_fct);
ADD_TACTIC_CMD("ctx-solver-simplify", "apply solver-based contextual simplification rules.", ctx_solver_simplify_fct);
ADD_TACTIC_CMD("der", "destructive equality resolution.", der_fct);
ADD_TACTIC_CMD("unit-subsume-simplify", "unit subsumption simplification.", unit_subsume_fct);
ADD_TACTIC_CMD("qe", "apply quantifier elimination.", qe_fct);
ADD_TACTIC_CMD("qe-sat", "check satisfiability of quantified formulas using quantifier elimination.", qe_sat_fct);
ADD_TACTIC_CMD("max-bv-sharing", "use heuristics to maximize the sharing of bit-vector expressions such as adders and multipliers.", max_bv_sharing_fct);
ADD_TACTIC_CMD("fix-dl-var", "if goal is in the difference logic fragment, then fix the variable with the most number of occurrences at 0.",
fix_dl_var_fct);
ADD_TACTIC_CMD("tseitin-cnf", "convert goal into CNF using tseitin-like encoding (note: quantifiers are ignored).", tseitin_cnf_fct);
ADD_TACTIC_CMD("tseitin-cnf-core", "convert goal into CNF using tseitin-like encoding (note: quantifiers are ignored). This tactic does not apply required simplifications to the input goal like the tseitin-cnf tactic.", tseitin_cnf_core_fct);
ADD_TACTIC_CMD("degree-shift", "try to reduce degree of polynomials (remark: :mul2power simplification is automatically applied).", degree_shift_fct);
ADD_TACTIC_CMD("purify-arith", "eliminate unnecessary operators: -, /, div, mod, rem, is-int, to-int, ^, root-objects.", purify_arith_fct);
ADD_TACTIC_CMD("nlsat", "(try to) solve goal using a nonlinear arithmetic solver.", nlsat_fct);
ADD_TACTIC_CMD("factor", "polynomial factorization.", factor_fct);
ADD_TACTIC_CMD("fm", "eliminate variables using fourier-motzkin elimination.", fm_fct);
ADD_TACTIC_CMD("fail-if-undecided", "fail if goal is undecided.", fail_if_undecided_fct);
ADD_TACTIC_CMD("diff-neq", "specialized solver for integer arithmetic problems that contain only atoms of the form (<= k x) (<= x k) and (not (= (- x y) k)), where x and y are constants and k is a numberal, and all constants are bounded.", diff_neq_fct);
ADD_TACTIC_CMD("lia2pb", "convert bounded integer variables into a sequence of 0-1 variables.", lia2pb_fct);
ADD_TACTIC_CMD("fpa2bv", "convert floating point numbers to bit-vectors.", fpa2bv_fct);
ADD_TACTIC_CMD("qffpa", "(try to) solve goal using the tactic for QF_FPA.", qffpa_fct);
ADD_TACTIC_CMD("pb2bv", "convert pseudo-boolean constraints to bit-vectors.", pb2bv_fct);
ADD_TACTIC_CMD("recover-01", "recover 0-1 variables hidden as Boolean variables.", recover_01_fct);
ADD_TACTIC_CMD("distribute-forall", "distribute forall over conjunctions.", distribute_forall_fct);
ADD_TACTIC_CMD("reduce-args", "reduce the number of arguments of function applications, when for all occurrences of a function f the i-th is a value.",
reduce_args_fct);
ADD_TACTIC_CMD("reduce-bv-size", "try to reduce bit-vector sizes using inequalities.", bv_size_reduction_fct);
ADD_TACTIC_CMD("propagate-ineqs", "propagate ineqs/bounds, remove subsumed inequalities.", propagate_ineqs_fct);
ADD_TACTIC_CMD("cofactor-term-ite", "eliminate term if-the-else using cofactors.", cofactor_term_ite_fct);
ADD_TACTIC_CMD("nla2bv", "convert a nonlinear arithmetic problem into a bit-vector problem, in most cases the resultant goal is an under approximation and is useul for finding models.", nla2bv_fct);
ADD_TACTIC_CMD("vsubst", "checks satsifiability of quantifier-free non-linear constraints using virtual substitution.", vsubst_fct);
ADD_TACTIC_CMD("qfbv-sls", "(try to) solve using stochastic local search for QF_BV.", qfbv_sls_fct);
ADD_TACTIC_CMD("qflia", "builtin strategy for solving QF_LIA problems.", qflia_fct);
ADD_TACTIC_CMD("qflra", "builtin strategy for solving QF_LRA problems.", qflra_fct);
ADD_TACTIC_CMD("qfnia", "builtin strategy for solving QF_NIA problems.", qfnia_fct);
ADD_TACTIC_CMD("qfnra", "builtin strategy for solving QF_NRA problems.", qfnra_fct);
ADD_TACTIC_CMD("qfnra-nlsat", "builtin strategy for solving QF_NRA problems using only nlsat.", qfnra_nlsat_fct);
ADD_TACTIC_CMD("qfbv", "builtin strategy for solving QF_BV problems.", qfbv_fct);
ADD_TACTIC_CMD("ufbv", "builtin strategy for solving UFBV problems (with quantifiers).", ufbv_fct);
ADD_TACTIC_CMD("bv", "builtin strategy for solving BV problems (with quantifiers).", ufbv_fct);
#ifndef _EXTERNAL_RELEASE
ADD_TACTIC_CMD("subpaving", "tactic for testing subpaving module.", subpaving_fct);
#endif
ADD_PROBE("memory", "ammount of used memory in megabytes.", mk_memory_probe());
ADD_PROBE("depth", "depth of the input goal.", mk_depth_probe());
ADD_PROBE("size", "number of assertions in the given goal.", mk_size_probe());

View file

@ -29,6 +29,8 @@ namespace qe {
tactic * mk_sat_tactic(ast_manager& m, params_ref const& p);
};
/*
ADD_TACTIC("qe-sat", "check satisfiability of quantified formulas using quantifier elimination.", "qe::mk_sat_tactic(m, p)")
*/
#endif

View file

@ -24,5 +24,7 @@ class ast_manager;
class tactic;
tactic * mk_qe_tactic(ast_manager & m, params_ref const & p = params_ref());
/*
ADD_TACTIC("qe", "apply quantifier elimination.", "mk_qe_tactic(m, p)")
*/
#endif

View file

@ -25,6 +25,9 @@ class ast_manager;
class tactic;
tactic * mk_vsubst_tactic(ast_manager & m, params_ref const & p = params_ref());
/*
ADD_TACTIC("vsubst", "checks satsifiability of quantifier-free non-linear constraints using virtual substitution.", "mk_vsubst_tactic(m, p)")
*/
#endif

View file

@ -24,6 +24,6 @@ class tactic;
tactic * mk_aig_tactic(params_ref const & p = params_ref());
/*
ADD_TACTIC("aig", "simplify Boolean structure using AIGs.", "mk_aig_tactic")
ADD_TACTIC("aig", "simplify Boolean structure using AIGs.", "mk_aig_tactic()")
*/
#endif

View file

@ -28,4 +28,8 @@ class tactic;
tactic * mk_degree_shift_tactic(ast_manager & m, params_ref const & p = params_ref());
/*
ADD_TACTIC("degree-shift", "try to reduce degree of polynomials (remark: :mul2power simplification is automatically applied).", "mk_degree_shift_tactic(m, p)")
*/
#endif

View file

@ -28,5 +28,7 @@ class ast_manager;
class tactic;
tactic * mk_diff_neq_tactic(ast_manager & m, params_ref const & p = params_ref());
/*
ADD_TACTIC("diff-neq", "specialized solver for integer arithmetic problems that contain only atoms of the form (<= k x) (<= x k) and (not (= (- x y) k)), where x and y are constants and k is a numberal, and all constants are bounded.", "mk_diff_neq_tactic(m, p)")
*/
#endif

View file

@ -24,5 +24,7 @@ class ast_manager;
class tactic;
tactic * mk_factor_tactic(ast_manager & m, params_ref const & p = params_ref());
/*
ADD_TACTIC("factor", "polynomial factorization.", "mk_factor_tactic(m, p)")
*/
#endif

View file

@ -30,4 +30,8 @@ class tactic;
tactic * mk_fix_dl_var_tactic(ast_manager & m, params_ref const & p = params_ref());
/*
ADD_TACTIC("fix-dl-var", "if goal is in the difference logic fragment, then fix the variable with the most number of occurrences at 0.", "mk_fix_dl_var_tactic(m, p)")
*/
#endif

View file

@ -29,5 +29,8 @@ class ast_manager;
class tactic;
tactic * mk_fm_tactic(ast_manager & m, params_ref const & p = params_ref());
/*
ADD_TACTIC("fm", "eliminate variables using fourier-motzkin elimination.", "mk_fm_tactic(m, p)")
*/
#endif

View file

@ -24,5 +24,8 @@ class ast_manager;
class tactic;
tactic * mk_lia2pb_tactic(ast_manager & m, params_ref const & p = params_ref());
/*
ADD_TACTIC("lia2pb", "convert bounded integer variables into a sequence of 0-1 variables.", "mk_lia2pb_tactic(m, p)")
*/
#endif

View file

@ -25,6 +25,9 @@ class ast_manager;
class tactic;
tactic * mk_nla2bv_tactic(ast_manager & m, params_ref const & p = params_ref());
/*
ADD_TACTIC("nla2bv", "convert a nonlinear arithmetic problem into a bit-vector problem, in most cases the resultant goal is an under approximation and is useul for finding models.", "mk_nla2bv_tactic(m, p)")
*/
#endif

View file

@ -24,6 +24,9 @@ class ast_manager;
class tactic;
tactic * mk_pb2bv_tactic(ast_manager & m, params_ref const & p = params_ref());
/*
ADD_TACTIC("pb2bv", "convert pseudo-boolean constraints to bit-vectors.", "mk_pb2bv_tactic(m, p)")
*/
probe * mk_is_pb_probe();

View file

@ -38,5 +38,8 @@ class ast_manager;
class tactic;
tactic * mk_propagate_ineqs_tactic(ast_manager & m, params_ref const & p = params_ref());
/*
ADD_TACTIC("propagate-ineqs", "propagate ineqs/bounds, remove subsumed inequalities.", "mk_propagate_ineqs_tactic(m, p)")
*/
#endif

View file

@ -54,5 +54,9 @@ class tactic;
tactic * mk_purify_arith_tactic(ast_manager & m, params_ref const & p = params_ref());
/*
ADD_TACTIC("purify-arith", "eliminate unnecessary operators: -, /, div, mod, rem, is-int, to-int, ^, root-objects.", "mk_purify_arith_tactic(m, p)")
*/
#endif

View file

@ -38,5 +38,8 @@ class ast_manager;
class tactic;
tactic * mk_recover_01_tactic(ast_manager & m, params_ref const & p = params_ref());
/*
ADD_TACTIC("recover-01", "recover 0-1 variables hidden as Boolean variables.", "mk_recover_01_tactic(m, p)")
*/
#endif

View file

@ -21,6 +21,7 @@ Notes:
#include"bit_blaster_rewriter.h"
#include"ast_smt2_pp.h"
#include"model_pp.h"
#include"rewriter_types.h"
class bit_blaster_tactic : public tactic {
@ -130,8 +131,13 @@ public:
model_converter_ref & mc,
proof_converter_ref & pc,
expr_dependency_ref & core) {
try {
(*m_imp)(g, result, mc, pc, core);
}
catch (rewriter_exception & ex) {
throw tactic_exception(ex.msg());
}
}
virtual void cleanup() {
ast_manager & m = m_imp->m();

View file

@ -31,5 +31,7 @@ class tactic;
tactic * mk_bv1_blaster_tactic(ast_manager & m, params_ref const & p = params_ref());
probe * mk_is_qfbv_eq_probe();
/*
ADD_TACTIC("bv1-blast", "reduce bit-vector expressions into bit-vectors of size 1 (notes: only equality, extract and concat are supported).", "mk_bv1_blaster_tactic(m, p)")
*/
#endif

View file

@ -29,5 +29,8 @@ class ast_manager;
class tactic;
tactic * mk_bv_size_reduction_tactic(ast_manager & m, params_ref const & p = params_ref());
/*
ADD_TACTIC("reduce-bv-size", "try to reduce bit-vector sizes using inequalities.", "mk_bv_size_reduction_tactic(m, p)")
*/
#endif

View file

@ -27,6 +27,9 @@ class ast_manager;
class tactic;
tactic * mk_max_bv_sharing_tactic(ast_manager & m, params_ref const & p = params_ref());
/*
ADD_TACTIC("max-bv-sharing", "use heuristics to maximize the sharing of bit-vector expressions such as adders and multipliers.", "mk_max_bv_sharing_tactic(m, p)")
*/
#endif

View file

@ -25,5 +25,8 @@ class ast_manager;
class tactic;
tactic * mk_cofactor_term_ite_tactic(ast_manager & m, params_ref const & p = params_ref());
/*
ADD_TACTIC("cofactor-term-ite", "eliminate term if-the-else using cofactors.", "mk_cofactor_term_ite_tactic(m, p)")
*/
#endif

View file

@ -53,4 +53,8 @@ inline tactic * mk_ctx_simplify_tactic(ast_manager & m, params_ref const & p = p
return clean(alloc(ctx_simplify_tactic, m, p));
}
/*
ADD_TACTIC("ctx-simplify", "apply contextual simplification rules.", "mk_ctx_simplify_tactic(m, p)")
*/
#endif

View file

@ -22,4 +22,8 @@ class tactic;
tactic * mk_der_tactic(ast_manager & m);
/*
ADD_TACTIC_CMD("der", "destructive equality resolution.", "mk_der_tactic(m)")
*/
#endif /* _DER_TACTIC_H_ */

View file

@ -24,5 +24,8 @@ class ast_manager;
class tactic;
tactic * mk_reduce_args_tactic(ast_manager & m, params_ref const & p = params_ref());
/*
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)")
*/
#endif

View file

@ -28,4 +28,9 @@ tactic * mk_tseitin_cnf_core_tactic(ast_manager & m, params_ref const & p = para
tactic * mk_tseitin_cnf_tactic(ast_manager & m, params_ref const & p = params_ref());
/*
ADD_TACTIC("tseitin-cnf", "convert goal into CNF using tseitin-like encoding (note: quantifiers are ignored).", "mk_tseitin_cnf_tactic(m, p)")
ADD_TACTIC("tseitin-cnf-core", "convert goal into CNF using tseitin-like encoding (note: quantifiers are ignored). This tactic does not apply required simplifications to the input goal like the tseitin-cnf tactic.", "mk_tseitin_cnf_core_tactic(m, p)")
*/
#endif

View file

@ -24,5 +24,8 @@ class ast_manager;
class tactic;
tactic * mk_fpa2bv_tactic(ast_manager & m, params_ref const & p = params_ref());
/*
ADD_TACTIC("fpa2bv", "convert floating point numbers to bit-vectors.", "mk_fpa2bv_tactic(m, p)")
*/
#endif

View file

@ -25,5 +25,8 @@ class ast_manager;
class tactic;
tactic * mk_qffpa_tactic(ast_manager & m, params_ref const & p = params_ref());
/*
ADD_TACTIC("qffpa", "(try to) solve goal using the tactic for QF_FPA.", "mk_qffpa_tactic(m, p)")
*/
#endif

View file

@ -27,4 +27,8 @@ tactic * mk_qfnra_nlsat_tactic(ast_manager & m, params_ref const & p = params_re
MK_SIMPLE_TACTIC_FACTORY(qfnra_nlsat_fct, mk_qfnra_nlsat_tactic(m, p));
/*
ADD_TACTIC("qfnra-nlsat", "builtin strategy for solving QF_NRA problems using only nlsat.", "mk_qfnra_nlsat_tactic(m, p)")
*/
#endif

View file

@ -24,7 +24,9 @@ class ast_manager;
class tactic;
tactic * mk_sls_tactic(ast_manager & m, params_ref const & p = params_ref());
tactic * mk_qfbv_sls_tactic(ast_manager & m, params_ref const & p = params_ref());
/*
ADD_TACTIC("qfbv-sls", "(try to) solve using stochastic local search for QF_BV.", "mk_qfbv_sls_tactic(m, p)")
*/
#endif

View file

@ -21,6 +21,7 @@ Notes:
#include"smt_solver.h"
#include"front_end_params.h"
#include"params2front_end_params.h"
#include"rewriter_types.h"
class smt_tactic : public tactic {
scoped_ptr<front_end_params> m_params;
@ -146,6 +147,7 @@ public:
model_converter_ref & mc,
proof_converter_ref & pc,
expr_dependency_ref & core) {
try {
SASSERT(in->is_well_sorted());
ast_manager & m = in->m();
TRACE("smt_tactic", tout << this << "\nAUTO_CONFIG: " << fparams().m_auto_config << " HIDIV0: " << fparams().m_hi_div0 << " "
@ -301,6 +303,10 @@ public:
throw tactic_exception(m_failure.c_str());
}
}
catch (rewriter_exception & ex) {
throw tactic_exception(ex.msg());
}
}
};
tactic * mk_smt_tactic(params_ref const & p) {

View file

@ -24,5 +24,8 @@ class ast_manager;
class tactic;
tactic * mk_qfbv_tactic(ast_manager & m, params_ref const & p = params_ref());
/*
ADD_TACTIC("qfbv", "builtin strategy for solving QF_BV problems.", "mk_qfbv_tactic(m, p)")
*/
#endif

View file

@ -24,5 +24,8 @@ class ast_manager;
class tactic;
tactic * mk_qflia_tactic(ast_manager & m, params_ref const & p = params_ref());
/*
ADD_TACTIC("qflia", "builtin strategy for solving QF_LIA problems.", "mk_qflia_tactic(m, p)")
*/
#endif

View file

@ -24,5 +24,8 @@ class ast_manager;
class tactic;
tactic * mk_qflra_tactic(ast_manager & m, params_ref const & p = params_ref());
/*
ADD_TACTIC("qflra", "builtin strategy for solving QF_LRA problems.", "mk_qflra_tactic(m, p)")
*/
#endif

View file

@ -24,5 +24,8 @@ class ast_manager;
class tactic;
tactic * mk_qfnia_tactic(ast_manager & m, params_ref const & p = params_ref());
/*
ADD_TACTIC("qfnia", "builtin strategy for solving QF_NIA problems.", "mk_qfnia_tactic(m, p)")
*/
#endif

View file

@ -24,5 +24,8 @@ class ast_manager;
class tactic;
tactic * mk_qfnra_tactic(ast_manager & m, params_ref const & p = params_ref());
/*
ADD_TACTIC("qfnra", "builtin strategy for solving QF_NRA problems.", "mk_qfnra_tactic(m, p)")
*/
#endif

View file

@ -24,5 +24,8 @@ class ast_manager;
class tactic;
tactic * mk_subpaving_tactic(ast_manager & m, params_ref const & p = params_ref());
/*
ADD_TACTIC("subpaving", "tactic for testing subpaving module.", "mk_subpaving_tactic(m, p)")
*/
#endif

View file

@ -131,6 +131,7 @@ tactic * mk_fail_if_undecided_tactic();
/*
ADD_TACTIC("skip", "do nothing tactic.", "mk_skip_tactic()")
ADD_TACTIC("fail", "always fail tactic.", "mk_fail_tactic()")
ADD_TACTIC("fail-if-undecided", "fail if goal is undecided.", "mk_fail_if_undecided_tactic()")
*/
tactic * mk_report_verbose_tactic(char const * msg, unsigned lvl);

View file

@ -26,5 +26,9 @@ class tactic;
tactic * mk_macro_finder_tactic(ast_manager & m, params_ref const & p);
tactic * mk_ufbv_tactic(ast_manager & m, params_ref const & p);
/*
ADD_TACTIC("bv", "builtin strategy for solving BV problems (with quantifiers).", "mk_ufbv_tactic(m, p)")
ADD_TACTIC("ufbv", "builtin strategy for solving UFBV problems (with quantifiers).", "mk_ufbv_tactic(m, p)")
*/
#endif