mirror of
https://github.com/Z3Prover/z3
synced 2025-08-22 02:57:50 +00:00
working on sub/super slices
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
9a7e50c1e8
commit
5bbec43235
4 changed files with 134 additions and 24 deletions
|
@ -90,6 +90,16 @@ namespace polysat {
|
|||
fixed_bits(unsigned hi, unsigned lo, rational value) : hi(hi), lo(lo), value(value) {}
|
||||
};
|
||||
|
||||
struct justified_slice {
|
||||
pvar v;
|
||||
unsigned offset;
|
||||
dependency dep;
|
||||
};
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& out, justified_slice const& js) {
|
||||
return out << "v" << js.v << "[" << js.offset << "[ @" << js.dep;
|
||||
}
|
||||
|
||||
using justified_fixed_bits = vector<std::pair<fixed_bits, dependency>>;
|
||||
|
||||
using dependency_vector = vector<dependency>;
|
||||
|
@ -100,7 +110,7 @@ namespace polysat {
|
|||
using core_vector = std::initializer_list<constraint_or_dependency>;
|
||||
using constraint_id_vector = svector<constraint_id>;
|
||||
using constraint_id_list = std::initializer_list<constraint_id>;
|
||||
using justified_slices = vector<std::pair<pvar, dependency>>;
|
||||
using justified_slices = vector<justified_slice>;
|
||||
using eq_justification = svector<std::pair<theory_var, theory_var>>;
|
||||
|
||||
//
|
||||
|
@ -118,6 +128,8 @@ namespace polysat {
|
|||
virtual trail_stack& trail() = 0;
|
||||
virtual bool inconsistent() const = 0;
|
||||
virtual void get_bitvector_suffixes(pvar v, justified_slices& out) = 0;
|
||||
virtual void get_bitvector_sub_slices(pvar v, justified_slices& out) = 0;
|
||||
virtual void get_bitvector_super_slices(pvar v, justified_slices& out) = 0;
|
||||
virtual void get_fixed_bits(pvar v, justified_fixed_bits& fixed_bits) = 0;
|
||||
};
|
||||
|
||||
|
|
|
@ -105,13 +105,13 @@ namespace polysat {
|
|||
|
||||
justified_slices overlaps;
|
||||
c.get_bitvector_suffixes(v, overlaps);
|
||||
std::sort(overlaps.begin(), overlaps.end(), [&](auto const& x, auto const& y) { return c.size(x.first) > c.size(y.first); });
|
||||
std::sort(overlaps.begin(), overlaps.end(), [&](auto const& x, auto const& y) { return c.size(x.v) > c.size(y.v); });
|
||||
|
||||
uint_set widths_set;
|
||||
// max size should always be present, regardless of whether we have intervals there (to make sure all fixed bits are considered)
|
||||
widths_set.insert(c.size(v));
|
||||
|
||||
for (auto const& [v, j] : overlaps)
|
||||
for (auto const& [v, offset, j] : overlaps)
|
||||
for (layer const& l : m_units[v].get_layers())
|
||||
widths_set.insert(l.bit_width);
|
||||
|
||||
|
@ -176,7 +176,7 @@ namespace polysat {
|
|||
// however, we probably should rotate to avoid getting stuck in refinement loop on a 'bad' constraint
|
||||
bool refined = false;
|
||||
for (unsigned i = overlaps.size(); i-- > 0; ) {
|
||||
pvar x = overlaps[i].first;
|
||||
pvar x = overlaps[i].v;
|
||||
rational const& mod_value = c.var2pdd(x).two_to_N();
|
||||
rational x_val = mod(val, mod_value);
|
||||
if (!refine_viable(x, x_val)) {
|
||||
|
@ -240,7 +240,7 @@ namespace polysat {
|
|||
|
||||
// find relevant interval lists
|
||||
svector<entry_cursor> ecs;
|
||||
for (auto const& [x, j] : overlaps) {
|
||||
for (auto const& [x, offset, j] : overlaps) {
|
||||
if (c.size(x) < w) // note that overlaps are sorted by variable size descending
|
||||
break;
|
||||
if (entry* e = m_units[x].get_entries(w)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue