Binary Decision Diagrams INF5140 1
Motivation Fig 1. Polynomial representation Boolean functions ● Extremely useful ○ Some areas of application: ○ Cryptography ■ Propositional logic ■ Verification/model checking ■ Fig 2. Binary decision tree and Hardware ● accompanying truth table Software ● Often modelled with truth tables or ○ polynomials State space explosion ■ Symbolic model checking! ● Fig 3. Binary decision diagram Fig 4. PDAG 2
Differences between BDTs and BDDs BDDs BDTs Between 1 and 2 terminal nodes An arbitrary number of terminal ● ● (a boolean function can be such that it nodes depending on the function ○ only maps to true or only maps to Size scales with complexity of ● false) function Can be a tree, usually isn’t ● Easy to make ● (more) Compact representation ● NP-Hard to find a good ● representation 3
Binary Decision Diagrams 101 Decision nodes ● Terminal nodes ● Ordered (OBDD) ● Reduced (RBDD) ● (Well-) Ordered, reduced (ROBDD) ● Satisfiability ● Validity ● Equivalence ● Brief mention about notation: ● hi(n) leads to 1, lo(n) leads to 0 ○ 4
Binary Decision Diagrams: Ordering Finding the “correct” ordering is a ● difficult problem! Big differences in OBDDs for the ● same function Necessary to choose an order to ● obtain a (unique) reduced ordered BDD 5
Binary Decision Diagram: Ordering, example 2 6
Ordered Binary Decision Diagrams: Reduction Starting with a BDT: ● a. Remove all duplicate terminal nodes b. Remove all duplicate decision nodes c. Remove all redundant decision nodes If you have two reduced BDDs, and order them the same, they will be ● canonical/unique Some boolean functions are exponential and cannot be reduced to a ● linear form 7
Algorithms: Reduce Bottom up id(n) assigns an integer label to the node n 1. 0-terminals are assigned 0, 1-terminals are assigned 1 Given then a non-terminal node, integers are given based on the following: ○ 2. If id(lo(n)) == id(hi(n)), then id(n) == id(lo(n)) 3. If nodes n and m exist such that id(lo(n)) == id(lo(m)) and id(hi(n)) == id(lo(m)) then id(n) == id(m) 4. Else id(n) is the next unused integer 5. Finally: Collapse nodes with the same label, redirect edges accordingly 8
Boole’s expansion theorem Example: ● f = xyz + xy’z + x’y’z + x’yz + x’y’z ○ f = x(yz + y’z) + x’(y’z + yz + y’z) ○ f = xg x + x’g x’ ○ Used in the construction of the BDD data structure ● A op B = x’ (A [0/x] op B[0/x]) + x(A [1/x] op B[1/x] ● 9
Algorithms: Apply Used to build an ROBDD from ● apply(op, B psi , B phi ): two OBDDs B psi B phi 1. If r psi , r phi are terminal nodes: Based on Boole’s expansion ● apply(op, B psi ,B phi ) = B (rpsi op rphi) ○ theorem (Shannon’s expansion) 2. If both roots are decision nodes, create a dashed line to apply(op, B lo(rpsi) , B lo(rphi) ) and a solid line to apply(op, Recursive (roots down) ● B hi(rpsi) , B hi(rphi) ) 3. If r psi is a decision node but r phi is a terminal node, or a node higher in the order, create a node with a dashed line to apply(op, B lo(rpsi) , B phi ) 4. If r phi is a decision node but r psii is a terminal node, it is handled in the same way as in 3 10
Algorithms: Apply, example 11
Algorithms: Restrict restrict(T, x, B psi ): Used to restrict a boolean ● for each node n labelled with x : function B f in a BDD by some 1. Incoming edges are redirected to lo(n) 2. n is removed variable, either to true or false. For boolean quantification, ● restrict(F, x, B psi ): same as above, but redirect to hi(n) creating exists function for generating ROBDDs 12
Algorithms: Restrict, example 13
Algorithms: Exists Boolean quantification ● Combination of known algorithms ● 14
Algorithms: Exists, example 15
Sources https://www.inf.unibz.it/~artale/FM/slide7.pdf ● http://www.nptel.ac.in/courses/106103016/module4/lec3/1.html ● An Investigation of the Laws of Thought: On which are Founded the ● Mathematical Theories of Logic and Probabilities, George Boole (1854) Images shamelessly stolen from Wikimedia ● 16
Recommend
More recommend