mirror of
https://github.com/Z3Prover/z3
synced 2025-04-28 11:25:51 +00:00
prepare for tuned viable sets
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
a0b0c1f428
commit
a374e739f1
6 changed files with 165 additions and 38 deletions
|
@ -1193,5 +1193,4 @@ namespace dd {
|
|||
return r;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -259,6 +259,7 @@ namespace dd {
|
|||
bool is_constv(bddv const& a);
|
||||
rational to_val(bddv const& a);
|
||||
|
||||
|
||||
std::ostream& display(std::ostream& out);
|
||||
std::ostream& display(std::ostream& out, bdd const& b);
|
||||
|
||||
|
|
|
@ -120,4 +120,36 @@ namespace dd {
|
|||
return out;
|
||||
}
|
||||
|
||||
|
||||
bool fdd::sup(bdd const& x, bool_vector& lo) {
|
||||
SASSERT(lo.size() == num_bits());
|
||||
//
|
||||
// Assumption: common case is that high-order bits are before lower-order bits also
|
||||
// after re-ordering.
|
||||
//
|
||||
|
||||
// this checks that lo is included in x
|
||||
bdd b = x;
|
||||
while (!b.is_true()) {
|
||||
unsigned const pos = var2pos(b.var());
|
||||
SASSERT(pos != UINT_MAX && "Unexpected BDD variable");
|
||||
if (lo[pos] && b.hi().is_false())
|
||||
return false;
|
||||
if (!lo[pos] && b.lo().is_false())
|
||||
return false;
|
||||
|
||||
if (lo[pos])
|
||||
b = b.hi();
|
||||
else
|
||||
b = b.lo();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool fdd::inf(bdd const& b, bool_vector& hi) {
|
||||
SASSERT(hi.size() == num_bits());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -11,8 +11,8 @@ Abstract:
|
|||
|
||||
Author:
|
||||
|
||||
Nikolaj Bjorner (nbjorner) 2021-04-20
|
||||
Jakob Rath 2021-04-20
|
||||
Nikolaj Bjorner (nbjorner) 2021-04-20
|
||||
|
||||
--*/
|
||||
#pragma once
|
||||
|
@ -71,6 +71,23 @@ namespace dd {
|
|||
|
||||
/** Like find, but returns hint if it is contained in the BDD. */
|
||||
find_t find_hint(bdd b, rational const& hint, rational& out_val) const;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* find largest value at lo or above such that bdd b evaluates to true
|
||||
* at lo and all values between.
|
||||
* dually, find smallest value below hi that evaluates b to true
|
||||
* and all values between the value and hi also evaluate b to true.
|
||||
* \param b - a bdd using variables from this
|
||||
* \param lo/hi - bound to be traversed.
|
||||
* \return false if b is false at lo/hi
|
||||
* \pre variables in b are a subset of variables from the fdd
|
||||
*/
|
||||
bool sup(bdd const& b, bool_vector& lo);
|
||||
|
||||
bool inf(bdd const& b, bool_vector& hi);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue