mirror of
https://github.com/Z3Prover/z3
synced 2025-08-16 07:45:27 +00:00
updated handling of value initialization for bit-vectors
This commit is contained in:
parent
ba5cec7704
commit
a9f8ec1bcb
10 changed files with 112 additions and 36 deletions
|
@ -78,6 +78,7 @@ class inc_sat_solver : public solver {
|
|||
// this allows to access the internal state of the SAT solver and carry on partial results.
|
||||
bool m_internalized_converted; // have internalized formulas been converted back
|
||||
expr_ref_vector m_internalized_fmls; // formulas in internalized format
|
||||
vector<std::pair<expr_ref, expr_ref>> m_var2value;
|
||||
|
||||
typedef obj_map<expr, sat::literal> dep2asm_t;
|
||||
|
||||
|
@ -175,9 +176,27 @@ public:
|
|||
(m.is_not(e, e) && is_uninterp_const(e));
|
||||
}
|
||||
|
||||
void initialize_values() {
|
||||
if (m_mcs.back())
|
||||
m_mcs.back()->convert_initialize_value(m_var2value);
|
||||
if (m_mcs.back())
|
||||
m_mcs.back()->display(verbose_stream());
|
||||
|
||||
for (auto & [var, value] : m_var2value) {
|
||||
sat::bool_var b = m_map.to_bool_var(var);
|
||||
if (b != sat::null_bool_var)
|
||||
m_solver.set_phase(sat::literal(b, m.is_false(value)));
|
||||
else if (get_euf())
|
||||
ensure_euf()->user_propagate_initialize_value(var, value);
|
||||
}
|
||||
}
|
||||
|
||||
lbool check_sat_core(unsigned sz, expr * const * assumptions) override {
|
||||
m_solver.pop_to_base_level();
|
||||
m_core.reset();
|
||||
|
||||
|
||||
|
||||
if (m_solver.inconsistent()) return l_false;
|
||||
expr_ref_vector _assumptions(m);
|
||||
obj_map<expr, expr*> asm2fml;
|
||||
|
@ -202,6 +221,8 @@ public:
|
|||
r = internalize_assumptions(sz, _assumptions.data());
|
||||
if (r != l_true) return r;
|
||||
|
||||
initialize_values();
|
||||
|
||||
init_reason_unknown();
|
||||
m_internalized_converted = false;
|
||||
bool reason_set = false;
|
||||
|
@ -703,14 +724,7 @@ public:
|
|||
}
|
||||
|
||||
void user_propagate_initialize_value(expr* var, expr* value) override {
|
||||
expr_ref _var(var, m), _value(value, m);
|
||||
if (m_mcs.back())
|
||||
m_mcs.back()->convert_initialize_value(_var, _value);
|
||||
sat::bool_var b = m_map.to_bool_var(_var);
|
||||
if (b != sat::null_bool_var)
|
||||
m_solver.set_phase(sat::literal(b, m.is_false(_value)));
|
||||
else if (get_euf())
|
||||
ensure_euf()->user_propagate_initialize_value(_var, _value);
|
||||
m_var2value.push_back({expr_ref(var, m), expr_ref(value, m) });
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue