3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-05-05 23:05:46 +00:00

enable exposing internal solver state on interrupted solvers

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2017-05-30 17:33:27 -07:00
parent e0a86ccc1a
commit 7d245be4e1
15 changed files with 215 additions and 29 deletions

View file

@ -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());