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 subset 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 subset of self
containing var
with var
removed afterwards,
formally {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 change(&self, var: &Self) -> AllocResult<Self>
fn change(&self, var: &Self) -> AllocResult<Self>
Swap subset0
and subset1
with
respect to 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.
Dyn CompatibilityΒ§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.