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

bugfixes, adding plugin solver

This commit is contained in:
Nikolaj Bjorner 2024-02-21 14:11:11 -08:00
parent 659e384ee7
commit cf72a916f8
7 changed files with 146 additions and 14 deletions

View file

@ -91,7 +91,7 @@ namespace bv {
lbool sls::search() {
// init and init_eval were invoked
unsigned n = 0;
unsigned n = 0;
for (; n++ < m_config.m_max_repairs && m.inc(); ) {
++m_stats.m_moves;
auto [down, e] = next_to_repair();
@ -164,7 +164,7 @@ namespace bv {
return was_repaired;
}
void sls::try_repair_up(app* e) {
void sls::try_repair_up(app* e) {
m_repair_up.remove(e->get_id());
if (m_terms.is_assertion(e) || !m_eval.repair_up(e))
m_repair_down.insert(e->get_id());

View file

@ -130,7 +130,7 @@ namespace bv {
void sls_eval::init_eval_bv(app* e) {
if (bv.is_bv(e)) {
auto& v = wval0(e);
v.set(wval1(e));
v.set(wval1(e).bits);
}
else if (m.is_bool(e))
m_eval.setx(e->get_id(), bval1_bv(e), false);
@ -299,10 +299,10 @@ namespace bv {
return bval0(e);
}
svector<digit_t>& sls_eval::wval1(app* e) const {
sls_valuation& sls_eval::wval1(app* e) const {
auto& val = *m_values1[e->get_id()];
wval1(e, val);
return val.bits;
return val;
}
void sls_eval::wval1(app* e, sls_valuation& val) const {
@ -429,8 +429,6 @@ namespace bv {
break;
}
case OP_CONCAT: {
if (e->get_num_args() != 2)
verbose_stream() << mk_bounded_pp(e, m) << "\n";
SASSERT(e->get_num_args() == 2);
auto const& a = wval0(e->get_arg(0));
auto const& b = wval0(e->get_arg(1));
@ -1005,8 +1003,8 @@ namespace bv {
}
else {
// b := a - e
a.set_sub(m_tmp, a.bits, e.bits);
a.set_repair(random_bool(), m_tmp);
b.set_sub(m_tmp, a.bits, e.bits);
b.set_repair(random_bool(), m_tmp);
}
return true;
}
@ -1186,7 +1184,6 @@ namespace bv {
if (a.is_zero(m_tmp2))
return false;
if (!a.get_at_least(m_tmp2, m_tmp)) {
verbose_stream() << "could not get at least\n";
return false;
}
}
@ -1571,7 +1568,7 @@ namespace bv {
return true;
}
if (bv.is_bv(e))
return wval0(e).try_set(wval1(to_app(e)));
return wval0(e).try_set(wval1(to_app(e)).bits);
return false;
}
}

View file

@ -136,8 +136,8 @@ namespace bv {
*/
bool bval1(app* e) const;
bool can_eval1(app* e) const;
svector<digit_t>& wval1(app* e) const;
sls_valuation& wval1(app* e) const;
/**
* Override evaluaton.

View file

@ -202,6 +202,7 @@ namespace bv {
}
std::ostream& display(std::ostream& out) const {
out << "V:";
out << std::hex;
auto print_bits = [&](svector<digit_t> const& v) {
bool nz = false;
@ -215,7 +216,7 @@ namespace bv {
};
print_bits(bits);
out << " ";
out << " fix:";
print_bits(fixed);
if (!eq(lo, hi)) {