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

parent list of root may miss nodes from children if they are not congruence roots. We walk parents of all siblings to not miss

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2024-01-14 18:20:44 -08:00
parent 79a2c86c05
commit 42aad423c9
3 changed files with 47 additions and 37 deletions

View file

@ -94,22 +94,24 @@ namespace polysat {
// walk the e-graph to retrieve fixed overlaps
void solver::get_fixed_bits(pvar pv, fixed_bits_vector& out) {
theory_var v = m_pddvar2var[pv];
euf::enode* b = var2enode(v);
std::function<bool(euf::enode*, unsigned)> consume_slice = [&](euf::enode* n, unsigned offset) {
n = n->get_root();
if (!n->interpreted())
auto r = n->get_root();
if (!r->interpreted())
return true;
auto w = n->get_th_var(get_id());
auto w = r->get_th_var(get_id());
if (w == euf::null_theory_var)
return true;
unsigned length = bv.get_bv_size(n->get_expr());
unsigned length = bv.get_bv_size(r->get_expr());
rational value;
VERIFY(bv.is_numeral(n->get_expr(), value));
VERIFY(bv.is_numeral(r->get_expr(), value));
out.push_back({ fixed_slice(value, offset, length) });
return false;
};
theory_var v = m_pddvar2var[pv];
m_bv_plugin->sub_slices(var2enode(v), consume_slice);
m_bv_plugin->super_slices(var2enode(v), consume_slice);
m_bv_plugin->sub_slices(b, consume_slice);
m_bv_plugin->super_slices(b, consume_slice);
}
void solver::explain_slice(pvar pv, pvar pw, unsigned offset, std::function<void(euf::enode*, euf::enode*)>& consume_eq) {

View file

@ -135,6 +135,10 @@ namespace polysat {
}
void solver::explain_dep(dependency const& d, euf::enode_pair_vector& eqs, sat::literal_vector& core) {
std::function<void(euf::enode*, euf::enode*)> consume = [&](auto* a, auto* b) {
eqs.push_back({ a, b });
};
if (d.is_axiom())
;
else if (d.is_bool_var()) {
@ -144,16 +148,10 @@ namespace polysat {
}
else if (d.is_fixed_claim()) {
auto const& o = d.fixed();
std::function<void(euf::enode*, euf::enode*)> consume = [&](auto* a, auto* b) {
eqs.push_back({ a, b });
};
explain_fixed(o.v, o, consume);
}
else if (d.is_offset_claim()) {
auto const& offs = d.offset();
std::function<void(euf::enode*, euf::enode*)> consume = [&](auto* a, auto* b) {
eqs.push_back({ a, b });
};
explain_slice(offs.v, offs.w, offs.offset, consume);
}
else {