Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
B.Z.
B.Z.
Boolean Functions
Definition
A map that associates a Boolean value to each possible assignment of input variables
B.Z.
B.Z.
Truth Table
X 0 0 0 0 1 1 1 1 Y 0 0 1 1 0 0 1 1 Z 0 1 0 1 0 1 0 1 F 0 0 1 0 1 1 0 0
Boolean Circuit
X Y Z
B.Z.
What are the values of input variables that evaluate the Boolean function to TRUE
B.Z.
B.Z.
B.Z.
B.Z.
Reduction Rule
B.Z.
1-edge
F(X=1)
Reduction Rule
X Y
F F
X Z Y
X Z
BDD Features
Canonicity
If two functions are equal than their BDD graphs are isomorphic
Compactness
Constant Boolean functions are one-node BDD Some important functions grow linearly with number of input variables (e.g. Parity)
Equivalence Check
Equivalence check is done in constant time
B.Z.
BDD Features
Basic Boolean Operations
The size of result of operation like FG is bounded by a product of sizes of F and G Using Dynamic Programming techniques, the time is almost linear with the size The size of F is equal to size of F The time is linear with the size Advanced techniques (attributed edges) reduce the time to constant
Complement
B.Z.
BDD Features
Find Satisfying Assignment Shared BDD
The time is linear with the size of a BDD All features remain true for multiple boolean functions represented by BDD set
B.Z.
Truth Expression Table Exponenial Linear Linear Linear Linear Yes Constant
B.Z.
Building a BDD
Models Are Boolean Expressions/Circuits Nave Approach
Build a decision tree and then apply reduction rules Wont work: decision trees are too big
B.Z.
F 1 = F, F F = 0
Underlined are dynamic programming usage BDDnode function applies reduction rules The scheme of algorithm may be applied to other logic manipulations
Variables Ordering
Good Order Is Crucial
Different variable orders may change the size of BDD from exponential to linear
Theoretical Fact
Finding an optimal order is really hard Best known algorithms have complexity O(3N)
B.Z.
COMPARATOR
X1 XN Y1 YN q If F
q For
Dynamic Reordering
One basic idea: perform local order changes
Swap adjacent variables Try a single variable at a time
B.Z.
Correctness Proof
After:
Y X
F Potentially new X
Performance
Complexity of SiftVariable is linear with the size of BDD Complexity of Sifting is linear with N times the size of BDD ConvergenceSifting is basically more powerful, but may be very expensive
Grouping Variables
Choose variables upon certain criterion (symmetry, dependency) and stick them together in groups Reorder on the group level only Better BDD size reduction in some cases
B.Z.
B.Z.
Main Components
Unique Table
Imposes a uniqueness of each BDD node
Computed Table
Stores the results of previous computations (dynamic programming technique)
Garbage Collection
Remove no-more-in-use BDD nodes
B.Z.
Unique Table
Unique Table
x Finds BDD node (x, F0, F1) Each variable has a separate Hash Table
Allows more efficient manipulation
Hash Table
The hash table entry Key is function of (F0, F1, size[hash]) Advanced Techniques
Resize Hash Table for efficiency Different Collision Chain policies
Last Recently Used - first Ring chain
..
...
key
Collision Chain x
x x
B.Z.
Computed Table
Cache Table
Stores result of Op(Arg1,Arg2) Implementation: Hash-Based Cache Table
Collisions are not resolved - last result stored
..
key
..
Cache entry Key is function of (Op, Arg1, Arg2, size[cache]) Advanced Techniques
Resize Cache table for efficiency Split Cache table to avoid collisions of frequently used Ops
B.Z.
Garbage Collection
Remove Dead BDD Nodes
`Dead node is one which is no longer in use Reference Counts Explicit Marks Number of references to each BDD node is kept All nodes with RC equal to zero are removed More expensive but more flexible A standard approach in many commercial BDD packages
B.Z.
Garbage Collection
Explicit Marks
Functions that are in use are marked Only BDD nodes representing functions in-use are left Less expensive but less flexible
Garbage Collection can not be triggered until a function is not built
B.Z.
B.Z.
Memory elements, Inputs Allowed initial assignments FSM State, Set Of States Transition Relation
B.Z.
B.Z.
FSM State
Assignment of Boolean values B to V
A Set Of States
BDD of Characteristic Function S(V) B belongs to set S(B) = 1
B.Z.
Transition Relation
BDD of Characteristic Function N(V, V) <A, B> is legal N(A,B) = 1
B.Z.
B.Z.
Initial states
Set of atomic init functions x0 = Ix(V)
Transition relation
Set of atomic next-state functions x = Nx(V,V)
Assumptions
B.Z.
Exclude Dead-Ends
[Pre-Image]
-inc
TransRelation Bld
Nx [Build/Conjunct]
spec
B.Z.
Spec Evaluation
[Pre-Image]
CountExmap Gen
[Image/Pre-Image]
B.Z.