Expand description
§boolean_expression expression manipulation / BDD library
This crate provides for the manipulation and evaluation of Boolean expressions
and Binary Decision Diagrams (BDDs), and the construction of BDDs from Boolean
expressions. It can also simplify Boolean expressions via either a set of rules
such as DeMorgan’s Law (see Expr::simplify_via_laws()), or via a
roundtrip through a BDD and a cubelist-based term reduction (see
Expr::simplify_via_bdd()). The latter is more powerful, but also more
expensive.
The main pieces of interest are:
Expr, an AST enum for expression simpleAND/OR/NOT-based expressions.BDD, a Binary Decision Diagram implementation.CubeList, a low-level datatype with support for cubelist manipulation (used when convertingBDDfunctions to expressions).
Structs§
- BDD
- A
BDDis a Binary Decision Diagram, an efficient way to represent a Boolean function in a canonical way. (It is actually a “Reduced Ordered Binary Decision Diagram”, which gives it its canonicity assuming terminals are ordered consistently.) - BDDLoader
- A
BDDLoaderprovides a way to inject BDD nodes directly, as they were previously dumped by aPersistedBDDto aBDDOutput. The user should create aBDDLoaderinstance wrapped around aBDDand callinject_labelandinject_nodeas appropriate to inject labels and nodes. - Cube
- A
Cubeis one (multidimensional) cube in the variable space: i.e., a particular set of variable assignments, where each variable is assigned either true, false, or “don’t care”. - Cube
List - A
CubeListis a sum (OR’d list) of cubes. It represents a Boolean expression in sum-of-products form, by construction. - PersistedBDD
- A
PersistedBDDis a wrapper around aBDDthat provides a means to write BDD labels and nodes out to aBDDOutput. It tracks how much of the BDD has already been writen out, and writes out new nodes and labels as required when itspersist()orpersist_all()method is called.
Enums§
- Cube
Merge Result - The result of attempting to merge two cubes.
- CubeVar
- A variable assignment in a cube.
- Expr
- An
Expris a simple Boolean logic expression. It may contain terminals (i.e., free variables), constants, and the following fundamental operations: AND, OR, NOT.
Constants§
- BDD_ONE
- A special terminal
BDDFuncwhich is constanttrue(one). - BDD_
ZERO - A special terminal
BDDFuncwhich is constantfalse(zero).
Traits§
- BDDOutput
- The
BDDOutputtrait provides an interface to inform a listener about new BDD nodes that are created. It allows the user to persist a BDD to a stream (e.g., a log or trace file) as a long-running process executes. ABDDOutputinstance may be provided to all BDD operations.
Type Aliases§
- BDDFunc
- A
BDDFuncis a function index within a particularBDD. It must only be used with theBDDinstance which produced it.