pub trait BooleanVecSet: Function {
Show 17 methods
// Required methods
fn new_singleton<'id>(manager: &mut Self::Manager<'id>) -> AllocResult<Self>;
fn empty_edge<'id>(manager: &Self::Manager<'id>) -> EdgeOfFunc<'id, Self>;
fn base_edge<'id>(manager: &Self::Manager<'id>) -> EdgeOfFunc<'id, Self>;
fn subset0_edge<'id>(
manager: &Self::Manager<'id>,
set: &EdgeOfFunc<'id, Self>,
var: &EdgeOfFunc<'id, Self>,
) -> AllocResult<EdgeOfFunc<'id, Self>>;
fn subset1_edge<'id>(
manager: &Self::Manager<'id>,
set: &EdgeOfFunc<'id, Self>,
var: &EdgeOfFunc<'id, Self>,
) -> AllocResult<EdgeOfFunc<'id, Self>>;
fn change_edge<'id>(
manager: &Self::Manager<'id>,
set: &EdgeOfFunc<'id, Self>,
var: &EdgeOfFunc<'id, Self>,
) -> AllocResult<EdgeOfFunc<'id, Self>>;
fn union_edge<'id>(
manager: &Self::Manager<'id>,
lhs: &EdgeOfFunc<'id, Self>,
rhs: &EdgeOfFunc<'id, Self>,
) -> AllocResult<EdgeOfFunc<'id, Self>>;
fn intsec_edge<'id>(
manager: &Self::Manager<'id>,
lhs: &EdgeOfFunc<'id, Self>,
rhs: &EdgeOfFunc<'id, Self>,
) -> AllocResult<EdgeOfFunc<'id, Self>>;
fn diff_edge<'id>(
manager: &Self::Manager<'id>,
lhs: &EdgeOfFunc<'id, Self>,
rhs: &EdgeOfFunc<'id, Self>,
) -> AllocResult<EdgeOfFunc<'id, Self>>;
// Provided methods
fn empty<'id>(manager: &Self::Manager<'id>) -> Self { ... }
fn base<'id>(manager: &Self::Manager<'id>) -> Self { ... }
fn subset0(&self, var: &Self) -> AllocResult<Self> { ... }
fn subset1(&self, var: &Self) -> AllocResult<Self> { ... }
fn change(&self, var: &Self) -> AllocResult<Self> { ... }
fn union(&self, rhs: &Self) -> AllocResult<Self> { ... }
fn intsec(&self, rhs: &Self) -> AllocResult<Self> { ... }
fn diff(&self, rhs: &Self) -> AllocResult<Self> { ... }
}Expand description
Set of Boolean vectors
A Boolean function f: πΉβΏ β πΉ may also be regarded as a set S β π«(πΉβΏ), where S = {v β πΉβΏ | f(v) = 1}. f is also called the characteristic function of S. We can even view a Boolean vector as a subset of some βUniverseβ U, so we also have S β π«(π«(U)). For example, let U = {a, b, c}. The function a is the set of all sets containing a, {a, ab, abc, ac} (for the sake of readability, we write ab for the set {a, b}). Conversely, the set {a} is the function a β§ Β¬b β§ Β¬c.
Counting the number of elements in a BoolVecSet is equivalent to counting
the number of satisfying assignments of its characteristic function. Hence,
you may use BooleanFunction::sat_count() for this task.
The functions of this trait can be implemented efficiently for ZBDDs.
As a user of this trait, you are probably most interested in methods like
Self::union(), Self::intsec(), and Self::diff(). As an
implementor, it suffices to implement the functions operating on edges.
Required MethodsΒ§
sourcefn new_singleton<'id>(manager: &mut Self::Manager<'id>) -> AllocResult<Self>
fn new_singleton<'id>(manager: &mut Self::Manager<'id>) -> AllocResult<Self>
Add a new variable to the manager and get the corresponding singleton set
This adds a new level to the decision diagram.
sourcefn empty_edge<'id>(manager: &Self::Manager<'id>) -> EdgeOfFunc<'id, Self>
fn empty_edge<'id>(manager: &Self::Manager<'id>) -> EdgeOfFunc<'id, Self>
Edge version of Self::empty()
sourcefn base_edge<'id>(manager: &Self::Manager<'id>) -> EdgeOfFunc<'id, Self>
fn base_edge<'id>(manager: &Self::Manager<'id>) -> EdgeOfFunc<'id, Self>
Edge version of Self::base()
sourcefn subset0_edge<'id>(
manager: &Self::Manager<'id>,
set: &EdgeOfFunc<'id, Self>,
var: &EdgeOfFunc<'id, Self>,
) -> AllocResult<EdgeOfFunc<'id, Self>>
fn subset0_edge<'id>( manager: &Self::Manager<'id>, set: &EdgeOfFunc<'id, Self>, var: &EdgeOfFunc<'id, Self>, ) -> AllocResult<EdgeOfFunc<'id, Self>>
Edge version of Self::subset0()
sourcefn subset1_edge<'id>(
manager: &Self::Manager<'id>,
set: &EdgeOfFunc<'id, Self>,
var: &EdgeOfFunc<'id, Self>,
) -> AllocResult<EdgeOfFunc<'id, Self>>
fn subset1_edge<'id>( manager: &Self::Manager<'id>, set: &EdgeOfFunc<'id, Self>, var: &EdgeOfFunc<'id, Self>, ) -> AllocResult<EdgeOfFunc<'id, Self>>
Edge version of Self::subset1()
sourcefn change_edge<'id>(
manager: &Self::Manager<'id>,
set: &EdgeOfFunc<'id, Self>,
var: &EdgeOfFunc<'id, Self>,
) -> AllocResult<EdgeOfFunc<'id, Self>>
fn change_edge<'id>( manager: &Self::Manager<'id>, set: &EdgeOfFunc<'id, Self>, var: &EdgeOfFunc<'id, Self>, ) -> AllocResult<EdgeOfFunc<'id, Self>>
Edge version of Self::change()
sourcefn union_edge<'id>(
manager: &Self::Manager<'id>,
lhs: &EdgeOfFunc<'id, Self>,
rhs: &EdgeOfFunc<'id, Self>,
) -> AllocResult<EdgeOfFunc<'id, Self>>
fn union_edge<'id>( manager: &Self::Manager<'id>, lhs: &EdgeOfFunc<'id, Self>, rhs: &EdgeOfFunc<'id, Self>, ) -> AllocResult<EdgeOfFunc<'id, Self>>
Compute the union lhs βͺ rhs, edge version
sourcefn intsec_edge<'id>(
manager: &Self::Manager<'id>,
lhs: &EdgeOfFunc<'id, Self>,
rhs: &EdgeOfFunc<'id, Self>,
) -> AllocResult<EdgeOfFunc<'id, Self>>
fn intsec_edge<'id>( manager: &Self::Manager<'id>, lhs: &EdgeOfFunc<'id, Self>, rhs: &EdgeOfFunc<'id, Self>, ) -> AllocResult<EdgeOfFunc<'id, Self>>
Compute the intersection lhs β© rhs, edge version
sourcefn diff_edge<'id>(
manager: &Self::Manager<'id>,
lhs: &EdgeOfFunc<'id, Self>,
rhs: &EdgeOfFunc<'id, Self>,
) -> AllocResult<EdgeOfFunc<'id, Self>>
fn diff_edge<'id>( manager: &Self::Manager<'id>, lhs: &EdgeOfFunc<'id, Self>, rhs: &EdgeOfFunc<'id, Self>, ) -> AllocResult<EdgeOfFunc<'id, Self>>
Compute the set difference lhs β rhs, edge version
Provided MethodsΒ§
sourcefn empty<'id>(manager: &Self::Manager<'id>) -> Self
fn empty<'id>(manager: &Self::Manager<'id>) -> Self
Get the empty set β
This corresponds to the Boolean function β₯.
sourcefn base<'id>(manager: &Self::Manager<'id>) -> Self
fn base<'id>(manager: &Self::Manager<'id>) -> Self
Get the set {β }
This corresponds to the Boolean function Β¬xβ β§ β¦ β§ Β¬xβ
sourcefn subset0(&self, var: &Self) -> AllocResult<Self>
fn subset0(&self, var: &Self) -> AllocResult<Self>
Get the set of subsets of self not containing var, formally
{s β self | var β s}
var must be a singleton set, otherwise the result is unspecified.
Ideally, the implementation panics.
Locking behavior: acquires a shared manager lock
Panics if self and var do not belong to the same manager.
sourcefn subset1(&self, var: &Self) -> AllocResult<Self>
fn subset1(&self, var: &Self) -> AllocResult<Self>
Get the set of subsets of self containing var, formally
{s β self | var β s}
var must be a singleton set, otherwise the result is unspecified.
Ideally, the implementation panics.
Locking behavior: acquires a shared manager lock
Panics if self and var do not belong to the same manager.
sourcefn change(&self, var: &Self) -> AllocResult<Self>
fn change(&self, var: &Self) -> AllocResult<Self>
Get the set of subsets derived from self by adding var to the
subsets that do not contain var, and removing var from the subsets
that contain var, formally
{s βͺ {var} | s β self β§ var β s} βͺ {s β {var} | s β self β§ var β s}
var must be a singleton set, otherwise the result is unspecified.
Ideally, the implementation panics.
Locking behavior: acquires a shared manager lock
Panics if self and var do not belong to the same manager.
sourcefn union(&self, rhs: &Self) -> AllocResult<Self>
fn union(&self, rhs: &Self) -> AllocResult<Self>
Compute the union self βͺ rhs
Locking behavior: acquires a shared manager lock
Panics if self and rhs do not belong to the same manager.
sourcefn intsec(&self, rhs: &Self) -> AllocResult<Self>
fn intsec(&self, rhs: &Self) -> AllocResult<Self>
Compute the intersection self β© rhs
Locking behavior: acquires a shared manager lock
Panics if self and rhs do not belong to the same manager.
sourcefn diff(&self, rhs: &Self) -> AllocResult<Self>
fn diff(&self, rhs: &Self) -> AllocResult<Self>
Compute the set difference self β rhs
Locking behavior: acquires a shared manager lock
Panics if self and rhs do not belong to the same manager.