mirror of
https://github.com/Z3Prover/z3
synced 2025-08-01 00:43:18 +00:00
na
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
05bcf0bed7
commit
788de7d614
9 changed files with 174 additions and 45 deletions
|
@ -301,5 +301,36 @@ namespace dd {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool_vector fdd::rational2bits(rational const& r) const {
|
||||
bool_vector result;
|
||||
for (unsigned i = 0; i < num_bits(); ++i)
|
||||
result.push_back(r.get_bit(i));
|
||||
return result;
|
||||
}
|
||||
|
||||
rational fdd::bits2rational(bool_vector const& v) const {
|
||||
rational result(0);
|
||||
for (unsigned i = 0; i < num_bits(); ++i)
|
||||
if (v[i])
|
||||
result += rational::power_of_two(i);
|
||||
return result;
|
||||
}
|
||||
|
||||
bool fdd::sup(bdd const& b, rational& _lo) const {
|
||||
bool_vector lo = rational2bits(_lo);
|
||||
if (!sup(b, lo))
|
||||
return false;
|
||||
_lo = bits2rational(lo);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool fdd::inf(bdd const& b, rational& _hi) const {
|
||||
bool_vector hi = rational2bits(_hi);
|
||||
if (!inf(b, hi))
|
||||
return false;
|
||||
_hi = bits2rational(hi);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -47,6 +47,10 @@ namespace dd {
|
|||
|
||||
bool contains(bdd const& b, bool_vector const& value) const;
|
||||
|
||||
rational bits2rational(bool_vector const& v) const;
|
||||
|
||||
bool_vector rational2bits(rational const& r) const;
|
||||
|
||||
public:
|
||||
/** Initialize FDD using BDD variables from 0 to num_bits-1. */
|
||||
fdd(bdd_manager& manager, unsigned num_bits, unsigned start = 0, unsigned step = 1) : fdd(manager, seq(num_bits, start, step)) { }
|
||||
|
@ -89,6 +93,10 @@ namespace dd {
|
|||
bool sup(bdd const& b, bool_vector& lo) const;
|
||||
|
||||
bool inf(bdd const& b, bool_vector& hi) const;
|
||||
|
||||
bool sup(bdd const& b, rational& lo) const;
|
||||
|
||||
bool inf(bdd const& b, rational& hi) const;
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue