mirror of
https://github.com/Z3Prover/z3
synced 2025-10-04 06:53:58 +00:00
enable exposing internal solver state on interrupted solvers
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
e0a86ccc1a
commit
7d245be4e1
15 changed files with 215 additions and 29 deletions
|
@ -117,8 +117,10 @@ struct bit_blaster_model_converter : public model_converter {
|
|||
SASSERT(is_uninterp_const(bit));
|
||||
func_decl * bit_decl = to_app(bit)->get_decl();
|
||||
expr * bit_val = old_model->get_const_interp(bit_decl);
|
||||
// remark: if old_model does not assign bit_val, then assume it is false.
|
||||
if (bit_val != 0 && m().is_true(bit_val))
|
||||
if (bit_val == 0) {
|
||||
goto bail;
|
||||
}
|
||||
if (m().is_true(bit_val))
|
||||
val++;
|
||||
}
|
||||
}
|
||||
|
@ -133,15 +135,50 @@ struct bit_blaster_model_converter : public model_converter {
|
|||
func_decl * bit_decl = to_app(bit)->get_decl();
|
||||
expr * bit_val = old_model->get_const_interp(bit_decl);
|
||||
// remark: if old_model does not assign bit_val, then assume it is false.
|
||||
if (bit_val != 0 && !util.is_zero(bit_val))
|
||||
if (bit_val == 0) {
|
||||
goto bail;
|
||||
}
|
||||
if (!util.is_zero(bit_val))
|
||||
val++;
|
||||
}
|
||||
}
|
||||
new_val = util.mk_numeral(val, bv_sz);
|
||||
new_model->register_decl(m_vars.get(i), new_val);
|
||||
continue;
|
||||
bail:
|
||||
new_model->register_decl(m_vars.get(i), mk_bv(bs, *old_model));
|
||||
}
|
||||
}
|
||||
|
||||
app_ref mk_bv(expr* bs, model& old_model) {
|
||||
bv_util util(m());
|
||||
unsigned bv_sz = to_app(bs)->get_num_args();
|
||||
expr_ref_vector args(m());
|
||||
app_ref result(m());
|
||||
for (unsigned j = 0; j < bv_sz; ++j) {
|
||||
expr * bit = to_app(bs)->get_arg(j);
|
||||
SASSERT(is_uninterp_const(bit));
|
||||
func_decl * bit_decl = to_app(bit)->get_decl();
|
||||
expr * bit_val = old_model.get_const_interp(bit_decl);
|
||||
if (bit_val != 0) {
|
||||
args.push_back(bit_val);
|
||||
}
|
||||
else {
|
||||
args.push_back(bit);
|
||||
}
|
||||
}
|
||||
|
||||
if (TO_BOOL) {
|
||||
SASSERT(is_app_of(bs, m().get_family_id("bv"), OP_MKBV));
|
||||
result = util.mk_bv(bv_sz, args.c_ptr());
|
||||
}
|
||||
else {
|
||||
SASSERT(is_app_of(bs, m().get_family_id("bv"), OP_CONCAT));
|
||||
result = util.mk_concat(bv_sz, args.c_ptr());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
virtual void operator()(model_ref & md, unsigned goal_idx) {
|
||||
SASSERT(goal_idx == 0);
|
||||
model * new_model = alloc(model, m());
|
||||
|
|
|
@ -262,6 +262,13 @@ void goal::get_formulas(ptr_vector<expr> & result) {
|
|||
}
|
||||
}
|
||||
|
||||
void goal::get_formulas(expr_ref_vector & result) {
|
||||
unsigned sz = size();
|
||||
for (unsigned i = 0; i < sz; i++) {
|
||||
result.push_back(form(i));
|
||||
}
|
||||
}
|
||||
|
||||
void goal::update(unsigned i, expr * f, proof * pr, expr_dependency * d) {
|
||||
// KLM: don't know why this assertion is no longer true
|
||||
// SASSERT(proofs_enabled() == (pr != 0 && !m().is_undef_proof(pr)));
|
||||
|
|
|
@ -120,6 +120,7 @@ public:
|
|||
void update(unsigned i, expr * f, proof * pr = 0, expr_dependency * dep = 0);
|
||||
|
||||
void get_formulas(ptr_vector<expr> & result);
|
||||
void get_formulas(expr_ref_vector & result);
|
||||
|
||||
void elim_true();
|
||||
void elim_redundancies();
|
||||
|
|
|
@ -30,7 +30,6 @@ Notes:
|
|||
#include"qffp_tactic.h"
|
||||
#include"qfaufbv_tactic.h"
|
||||
#include"qfauflia_tactic.h"
|
||||
#include"qfufnra_tactic.h"
|
||||
|
||||
tactic * mk_default_tactic(ast_manager & m, params_ref const & p) {
|
||||
tactic * st = using_params(and_then(mk_simplify_tactic(m),
|
||||
|
@ -44,7 +43,6 @@ tactic * mk_default_tactic(ast_manager & m, params_ref const & p) {
|
|||
cond(mk_is_nra_probe(), mk_nra_tactic(m),
|
||||
cond(mk_is_lira_probe(), mk_lira_tactic(m, p),
|
||||
cond(mk_is_qffp_probe(), mk_qffp_tactic(m, p),
|
||||
//cond(mk_is_qfufnra_probe(), mk_qfufnra_tactic(m, p),
|
||||
mk_smt_tactic()))))))))))),
|
||||
p);
|
||||
return st;
|
||||
|
|
|
@ -18,11 +18,13 @@ Notes:
|
|||
--*/
|
||||
|
||||
#include "fd_solver.h"
|
||||
#include "fd_tactic.h"
|
||||
#include "tactic.h"
|
||||
#include "inc_sat_solver.h"
|
||||
#include "enum2bv_solver.h"
|
||||
#include "pb2bv_solver.h"
|
||||
#include "bounded_int2bv_solver.h"
|
||||
#include "solver/solver2tactic.h"
|
||||
|
||||
solver * mk_fd_solver(ast_manager & m, params_ref const & p) {
|
||||
solver* s = mk_inc_sat_solver(m, p);
|
||||
|
@ -31,3 +33,7 @@ solver * mk_fd_solver(ast_manager & m, params_ref const & p) {
|
|||
s = mk_bounded_int2bv_solver(m, p, s);
|
||||
return s;
|
||||
}
|
||||
|
||||
tactic * mk_fd_tactic(ast_manager & m, params_ref const& p) {
|
||||
return mk_solver2tactic(mk_fd_solver(m, p));
|
||||
}
|
||||
|
|
|
@ -26,4 +26,5 @@ class solver;
|
|||
|
||||
solver * mk_fd_solver(ast_manager & m, params_ref const & p);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -34,11 +34,11 @@ Notes:
|
|||
#include"default_tactic.h"
|
||||
#include"ufbv_tactic.h"
|
||||
#include"qffp_tactic.h"
|
||||
#include"qfufnra_tactic.h"
|
||||
#include"horn_tactic.h"
|
||||
#include"smt_solver.h"
|
||||
#include"inc_sat_solver.h"
|
||||
#include"fd_solver.h"
|
||||
#include"fd_tactic.h"
|
||||
#include"bv_rewriter.h"
|
||||
#include"solver2tactic.h"
|
||||
|
||||
|
@ -91,9 +91,7 @@ tactic * mk_tactic_for_logic(ast_manager & m, params_ref const & p, symbol const
|
|||
else if (logic=="HORN")
|
||||
return mk_horn_tactic(m, p);
|
||||
else if (logic == "QF_FD")
|
||||
return mk_solver2tactic(mk_fd_solver(m, p));
|
||||
//else if (logic=="QF_UFNRA")
|
||||
// return mk_qfufnra_tactic(m, p);
|
||||
return mk_fd_tactic(m, p);
|
||||
else
|
||||
return mk_default_tactic(m, p);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue