Unit-11: Binary Decision Diagrams (BDDs)
- B. Srivathsan
Chennai Mathematical Institute
NPTEL-course July - November 2015
1/24
Unit-11: Binary Decision Diagrams (BDDs) B. Srivathsan Chennai - - PowerPoint PPT Presentation
Unit-11: Binary Decision Diagrams (BDDs) B. Srivathsan Chennai Mathematical Institute NPTEL-course July - November 2015 1 / 24 Module 1: Introduction to BDDs 2 / 24 Model-checking Transition Systems + Properties + NuSMV State-space Bchi
NPTEL-course July - November 2015
1/24
2/24
Transition Systems + Properties + NuSMV
Automata
Unit: 4
Büchi Automata
Unit: 5,6
LTL properties
Unit: 7,8
CTL properties
Unit: 9
State-space explosion
Unit: 10
3/24
In this unit: An efficient data structure for representing transition systems
◮ Module 1: Introduction to the data structure: Binary Decision
Diagrams (BDDs)
◮ Module 2: Operations on BDDs ◮ Module 3: Using BDDs in the model-checking process
4/24
In this unit: An efficient data structure for representing transition systems
◮ Module 1: Introduction to the data structure: Binary Decision
Diagrams (BDDs)
◮ Module 2: Operations on BDDs ◮ Module 3: Using BDDs in the model-checking process
Reference: Logic in Computer Science, 2nd edition, by Huth and Ryan, Section 6.1 - 6.3
4/24
5/24
x,y : Boolean variables
6/24
x,y : Boolean variables Boolean function f (x,y) = x + y
6/24
x,y : Boolean variables Boolean function f (x,y) = x + y 0 + 0 = 0 0 + 1 = 1 1 + 0 = 1 1 + 1 = 1
6/24
x,y : Boolean variables Boolean function f (x,y) = x + y 0 + 0 = 0 0 + 1 = 1 1 + 0 = 1 1 + 1 = 1 Logical OR
6/24
x,y : Boolean variables Boolean function f (x,y) = x + y 0 + 0 = 0 0 + 1 = 1 1 + 0 = 1 1 + 1 = 1 Logical OR
1 1 1 1 1 1 1 x y f (x,y)
Truth table
6/24
x,y : Boolean variables
7/24
x,y : Boolean variables Boolean function f (x,y) = x · y
7/24
x,y : Boolean variables Boolean function f (x,y) = x · y 0 · 0 = 0 0 · 1 = 0 1 · 0 = 0 1 · 1 = 1
7/24
x,y : Boolean variables Boolean function f (x,y) = x · y 0 · 0 = 0 0 · 1 = 0 1 · 0 = 0 1 · 1 = 1 Logical AND
7/24
x,y : Boolean variables Boolean function f (x,y) = x · y 0 · 0 = 0 0 · 1 = 0 1 · 0 = 0 1 · 1 = 1 Logical AND
1 1 1 1 1 x y f (x,y)
Truth table
7/24
x : Boolean variable
8/24
x : Boolean variable Boolean function f (x) = x
8/24
x : Boolean variable Boolean function f (x) = x 0 = 1 1 = 0
8/24
x : Boolean variable Boolean function f (x) = x 0 = 1 1 = 0 Logical NOT
8/24
x : Boolean variable Boolean function f (x) = x 0 = 1 1 = 0 Logical NOT
1 1 x f (x)
Truth table
8/24
x1,x2,...,xn: Boolean variables f : {x1,x2,...,xn} → {0,1} Boolean function
+
· Boolean operations
9/24
x1,x2,...,xn: Boolean variables f : {x1,x2,...,xn} → {0,1} Boolean function
+
· Boolean operations Examples: f1(x,y) = x + y, f2(x,y,z) = x · y + y · z, f3(x,y,z) = x + y · z
9/24
10/24
f (x,y,z) = x · y + y · z
x y z f
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Truth table
11/24
f (x,y,z) = x · y + y · z
x y z f
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
x y y z z z z 1 1 1 1
Truth table
11/24
f (x,y,z) = x · y + y · z
x y z f
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
x y y z z z z 1 1 1 1
Truth table Binary Decision Tree
11/24
12/24
g(x,y,z) = f (x,y,z) = x · y + y · z
x y z f
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 13/24
g(x,y,z) = f (x,y,z) = x · y + y · z
x y z f
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
x y z g
1 1 1 1 1 1 1 1 1 1 1 1 13/24
g(x,y,z) = f (x,y,z) = x · y + y · z
x y z f
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
x y z g
1 1 1 1 1 1 1 1 1 1 1 1 1 13/24
g(x,y,z) = f (x,y,z) = x · y + y · z
x y z f
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
x y z g
1 1 1 1 1 1 1 1 1 1 1 1 1 13/24
g(x,y,z) = f (x,y,z) = x · y + y · z
x y z f
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
x y z g
1 1 1 1 1 1 1 1 1 1 1 1 1 1 13/24
g(x,y,z) = f (x,y,z) = x · y + y · z
x y z f
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
x y z g
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 13/24
g(x,y,z) = f (x,y,z) = x · y + y · z
x y z f
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
x y z g
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 13/24
g(x,y,z) = f (x,y,z) = x · y + y · z
x y z f
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
x y z g
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 13/24
g(x,y,z) = f (x,y,z) = x · y + y · z
x y z f
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
x y z g
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 13/24
g(x,y,z) = f (x,y,z) = x · y + y · z
x y z f
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
x y z g
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 13/24
x y z f
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
x y z g
1 1 1 1 1 1 1 1 1 1 1 1 1 1
f (x,y,z) = x · y + y · z g(x,y,z) = x · y
14/24
x y z f
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
x y z g
1 1 1 1 1 1 1 1 1 1 1 1 1 1
f (x,y,z) = x · y + y · z g(x,y,z) = x · y h(x,y,z) = f (x,y,z) + g(x,y,z)
14/24
x y z f
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
x y z g
1 1 1 1 1 1 1 1 1 1 1 1 1 1
f (x,y,z) = x · y + y · z g(x,y,z) = x · y h(x,y,z) = f (x,y,z) + g(x,y,z)
x y z
1 1 1 1 1 1 1 1 1 1 1 1 14/24
x y z f
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
x y z g
1 1 1 1 1 1 1 1 1 1 1 1 1 1
f (x,y,z) = x · y + y · z g(x,y,z) = x · y h(x,y,z) = f (x,y,z) + g(x,y,z)
x y z h
1 1 1 1 1 1 1 1 1 1 1 1 14/24
x y z f
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
x y z g
1 1 1 1 1 1 1 1 1 1 1 1 1 1
f (x,y,z) = x · y + y · z g(x,y,z) = x · y h(x,y,z) = f (x,y,z) + g(x,y,z)
x y z h
1 1 1 1 1 1 1 1 1 1 1 1 1 14/24
x y z f
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
x y z g
1 1 1 1 1 1 1 1 1 1 1 1 1 1
f (x,y,z) = x · y + y · z g(x,y,z) = x · y h(x,y,z) = f (x,y,z) + g(x,y,z)
x y z h
1 1 1 1 1 1 1 1 1 1 1 1 1 1 14/24
x y z f
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
x y z g
1 1 1 1 1 1 1 1 1 1 1 1 1 1
f (x,y,z) = x · y + y · z g(x,y,z) = x · y h(x,y,z) = f (x,y,z) + g(x,y,z)
x y z h
1 1 1 1 1 1 1 1 1 1 1 1 1 1 14/24
x y z f
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
x y z g
1 1 1 1 1 1 1 1 1 1 1 1 1 1
f (x,y,z) = x · y + y · z g(x,y,z) = x · y h(x,y,z) = f (x,y,z) + g(x,y,z)
x y z h
1 1 1 1 1 1 1 1 1 1 1 1 1 1 14/24
x y z f
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
x y z g
1 1 1 1 1 1 1 1 1 1 1 1 1 1
f (x,y,z) = x · y + y · z g(x,y,z) = x · y h(x,y,z) = f (x,y,z) + g(x,y,z)
x y z h
1 1 1 1 1 1 1 1 1 1 1 1 1 1 14/24
x y z f
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
x y z g
1 1 1 1 1 1 1 1 1 1 1 1 1 1
f (x,y,z) = x · y + y · z g(x,y,z) = x · y h(x,y,z) = f (x,y,z) + g(x,y,z)
x y z h
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14/24
x y z f
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
x y z g
1 1 1 1 1 1 1 1 1 1 1 1 1 1
f (x,y,z) = x · y + y · z g(x,y,z) = x · y h(x,y,z) = f (x,y,z) + g(x,y,z)
x y z h
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14/24
x y z f
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
x y z g
1 1 1 1 1 1 1 1 1 1 1 1 1 1
f (x,y,z) = x · y + y · z g(x,y,z) = x · y h(x,y,z) = f (x,y,z) + g(x,y,z)
x y z h
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14/24
x y z f
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
x y z g
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
f (x,y,z) = x · y + y · z g(x,y,z) = x
15/24
x y z f
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
x y z g
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
f (x,y,z) = x · y + y · z g(x,y,z) = x h(x,y,z) = f (x,y,z) · g(x,y,z)
15/24
x y z f
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
x y z g
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
f (x,y,z) = x · y + y · z g(x,y,z) = x h(x,y,z) = f (x,y,z) · g(x,y,z)
x y z
1 1 1 1 1 1 1 1 1 1 1 1 15/24
x y z f
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
x y z g
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
f (x,y,z) = x · y + y · z g(x,y,z) = x h(x,y,z) = f (x,y,z) · g(x,y,z)
x y z h
1 1 1 1 1 1 1 1 1 1 1 1 15/24
x y z f
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
x y z g
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
f (x,y,z) = x · y + y · z g(x,y,z) = x h(x,y,z) = f (x,y,z) · g(x,y,z)
x y z h
1 1 1 1 1 1 1 1 1 1 1 1 15/24
x y z f
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
x y z g
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
f (x,y,z) = x · y + y · z g(x,y,z) = x h(x,y,z) = f (x,y,z) · g(x,y,z)
x y z h
1 1 1 1 1 1 1 1 1 1 1 1 15/24
x y z f
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
x y z g
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
f (x,y,z) = x · y + y · z g(x,y,z) = x h(x,y,z) = f (x,y,z) · g(x,y,z)
x y z h
1 1 1 1 1 1 1 1 1 1 1 1 15/24
x y z f
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
x y z g
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
f (x,y,z) = x · y + y · z g(x,y,z) = x h(x,y,z) = f (x,y,z) · g(x,y,z)
x y z h
1 1 1 1 1 1 1 1 1 1 1 1 15/24
x y z f
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
x y z g
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
f (x,y,z) = x · y + y · z g(x,y,z) = x h(x,y,z) = f (x,y,z) · g(x,y,z)
x y z h
1 1 1 1 1 1 1 1 1 1 1 1 15/24
x y z f
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
x y z g
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
f (x,y,z) = x · y + y · z g(x,y,z) = x h(x,y,z) = f (x,y,z) · g(x,y,z)
x y z h
1 1 1 1 1 1 1 1 1 1 1 1 1 15/24
x y z f
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
x y z g
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
f (x,y,z) = x · y + y · z g(x,y,z) = x h(x,y,z) = f (x,y,z) · g(x,y,z)
x y z h
1 1 1 1 1 1 1 1 1 1 1 1 1 1 15/24
x y z f
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
x y z g
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
f (x,y,z) = x · y + y · z g(x,y,z) = x h(x,y,z) = f (x,y,z) · g(x,y,z)
x y z h
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 15/24
◮ Space: For n variables, needs to store 2n · (n + 1) bits ◮ Operations: Visit each entry of truth table
16/24
◮ Space: For n variables, needs to store 2n · (n + 1) bits ◮ Operations: Visit each entry of truth table ◮ Sequential circuits can be modeled using boolean functions
16/24
◮ Space: For n variables, needs to store 2n · (n + 1) bits ◮ Operations: Visit each entry of truth table ◮ Sequential circuits can be modeled using boolean functions
16/24
17/24
x · y
x y y 1
18/24
x · y
x y y 1 x y y 1
18/24
x · y
x y y 1 x y y 1
unnecessary
18/24
x · y
x y y 1 x y y 1
unnecessary
x y 1
18/24
x · y
x y y 1 x y y 1
unnecessary
x y 1
18/24
x y y z z z z 1 1 1 1
19/24
x y y z z z z 1 1 1 1 x y y z z z z 1
19/24
x y y z z z z 1 1 1 1 x y y z z z z 1 x y y z z 1
19/24
x y y z z z z 1 1 1 1 x y y z z z z 1 x y y z z 1 x y y z 1
19/24
x y y z z z z 1 x y y z 1 x y y 1 x y 1
20/24
x y y z z z z 1 x y y z 1 x y y 1 x y 1
20/24
◮ C1: Removal of duplicate leaves ◮ C2: Removal of redundant tests ◮ C3: Removal of duplicate sub-trees
21/24
x y y z z z z 1 1 1 1 x y y z z z z 1 x y y z z 1 x y y z 1
C1 C2 C3
22/24
x · y
x y y 1 x y y 1 x y 1
C1 C2
23/24
24/24