BDD - PowerPoint PPT Presentation

1 / 28
About This Presentation
Title:

BDD

Description:

Truth table inefficient space satisfaction easy comparison is difficult ... Satisfiability, tautology, equivalence. Normal forms: DNF, CNF ... – PowerPoint PPT presentation

Number of Views:154
Avg rating:3.0/5.0
Slides: 29
Provided by: Technology9
Category:
Tags: bdd | tautology

less

Transcript and Presenter's Notes

Title: BDD


1
BDD
2
Binary Decision Diagrams
  • Boolean variable
  • Boolean function
  • Examples x, xy, xy, represent others in terms
    of these
  • Can represent a boolean function by truth table
  • B function compact, determining satisfaction
    difficult checking equivalence is hard
  • Truth table inefficient space satisfaction easy
    comparison is difficult
  • Could give canonical representations as DNF, CNF
    complexity of algorithms is high

3
Binary Decision Tree
4
BDD
  • OBDD are a cononical form representation for b
    formulas
  • more compagt, manipulated efficiently
  • Used widely in variety of areas eg CAD and
    verification

5
(No Transcript)
6
Binary Decision Trees
  • Nonterminal vertex v labeled by a variable var(v)
    and has 2 successors low v (var (v) assigned 0)
    and high v (var (v) assigned 1).
  • Each terminal vertex is labelled by 0 0r 1.
  • Each BDD determined a b function
  • Much like truth table

7
Simplify
  • Remove duplicate terminals
  • Remove duplicate nonterminals (if var(u) var(v)
    low(u) low(v) and high(u) high(v)
  • Remove redundant tests (if nonterminal v has
    low(v) high (v) has

8
  • Boolean variable and expression
  • grammar t x 0 1 -t t t t V t
    t gt t
  • - and v suffice
  • Truth assignments 0/x1, 1/x2
  • If ordering of variables is established a b exp t
    over n varables can be viewed as a function
    f(x1,xn) Bn -gt B
  • Ordering plays crucial role in considering
    compact representations of b. expressions
  • Satisfiability, tautology, equivalence
  • Normal forms DNF, CNF
  • Satisfiability of b. expressions is NP complete

9
DNF, CNF
Similarly, a Conjunctive Normal Form (CNF) is an
expression that can be written as conjunction of
disjunction. Like,
10
  • if then else operator x-gt y0, y1 defined as
  • (x y0) V (-x y1)
  • Call x the test expression
  • All operators can be expressed using the if then
    else operator and constants 0 and 1, in such a
    way as all tests occur only on un-negated
    variables and variables occur nowhere else
  • Eg x is (x -gt 0,1)
  • Since variables must occur only in tests the B
    exp x is (x -gt 1,0)
  • A new Normal Form If-then-else Normal Form (INF)
  • Some Predefined Boolean expressions
  • 111, 100, 1v11, 1v01, 1?11, 1?00, 0?11,
    0?01
  • 1XX, X00, 1vX1, Xv0X, 1?XX, X?11, 0?X1

11
  • Shannon expansion of term (expression) t with
    respect to variable x x -gt t1/x, t0/x
  • t is equivalent to its Shannon expansion along
    any variable
  • Proposition Any b exp is equivalent to an
    expression in INF
  • Proof
  • Use Shannon expansion to generate the INF for
    any expression t
  • If t contains no variables it is equivalent to 0
    or 1 which is in INF
  • Else form Shannon expansion of t with wrt one of
    its variables,x
  • Since terms t0/x and t1/x have one less
    variable we recursively find INFs for both of
    these call them t0 and t1
  • An INF for t is x -gt t0, t1

12
  • Example Find INF for t (x1? y1) (x2?y2)
  • Lets assume the ordering x1 lt y1 lt x2 lt y2
  • Now for x1,
  • t x1?t1,t0 means, (x1t1)v (x1t0)
  • where t1t1/ x1, t0t0/ x1
  • evaluating,t1(1?y1)(x2?y2)
  • t0(0? y1)(x2?y2)
  • For y1,
  • t1 y1?t11,t10 where t11t11/ y1, t10t10/
    y1
  • evaluating,t11(1?1)(x2?y2)(x2?y2)
  • t10(1? 0)(x2?y2)0
  • So, t1 y1?t11,0

13
  • t0 y1?t01,t00 where t01t011/ y1, t00t10/
    y1
  • evaluating,t01(0?1)(x2?y2)0
  • t00(0? 0)(x2?y2)(x2?y2)
  • So, t0 y1?0, t00
  • For x2,
  • t11 x2?t111,t110 where t111t111/ x2,
    t110t110/ x2
  • evaluating,t111 1?y2
  • t110 0?y2
  • t00 x2?t001, t000 where t001t001/ x2,
    t000t000/ x2
  • evaluating,t001 1?y2
  • t000 0?y2

14
  • For y2 ,
  • t001 y2? t0011, t0010 where t0011t0011/ y2,
    t0010t0010/ y2
  • evaluating,t0011(1?1)1
  • t0010(1? 0) 0
  • So, t001 y2?1,0
  • t000 y2? t0001, t0000 where t0001t0001/ y2,
    t0000t0000/ y2
  • evaluating,t0001(0?1)0
  • t0010(0? 0) 1
  • So, t000 y2?0,1

15
  • Similarly show,
  • t111 y2? t1110, t1111
  • y2?1,0
  • t110 y2? t1101, t1100
  • y2?0,1
  • See figure 2.
  • Here,
  • Low edge else part dotted
  • high edge then part solid

16
  • Decision tree for above b expression
  • Show INF as graph it is decision tree (somewhat
    reduced from the above)
  • Can reduce even further some expressions are
    identical
  • t110 identical to t000 and t111 identical to
    t001
  • If we identify all equal subexpressions we end up
    with Binary decision diagram (BDD) no longer a
    tree but a directed acyclic graph (DAG)
  • Substitute t000 for t110 in RHS of t11 and also
    t001 for t11, see that t00 and t11 are identical
    and in t 1 replace t11 with t00

17
  • Figure 2 with caption

18
  • Figure 3 with caption

19
  • Figure 4 with caption

20
  • A BDD is a rooted DAG such that
  • One or more terminal nodes of out degree zero
    labelled 0 or 1
  • A set of variable nodes of out degree 2. (Out
    going edges are given by functions low and high
    in next figure, low(u) - dashed line high
    (u)-solid line). A variable var(u) is associated
    with each variable node
  • A BDD is ordered iff on all paths through the
    graph the variables respect a given linear order
    x1 lt x2 lt x3 lt xn An (O)BDD is reduced R(O)BDD
    iff
  • Uniqueness no two distinct nodes u and v have the
    sam variable name and low and high successor
    (var(u)var(v), low(u) low(v) and
    high(u)high(v) gt u v
  • Non-redundant tests no variable nodeu has
    identical low and high successor (low(u) is not
    equal t high (u) )

21
(No Transcript)
22
  • Interesting properties of ROBDDs
  • Compact representation of b expressions
  • There are efficient algorithms for performing all
    kinds of logical operations on ROBDDs
  • Based on fact that for any function f Bn -gt B
    there is exactly one ROBDD representing it
  • In particular there is exactly one ROBDD for the
    constant T function on Bn (and one for the
    constantly F function)
  • Can test in constant time if an ROBDD is
    constantly T (or constantly F) Compare with b
    expressions - this problem is NP complete!

23
  • An ROBDD represents a function
  • Nodes u inductively define b expression tu
    terminal node is a b constant nonterminal node
    marked x is an if-then-else expression where
    condition is x and the two branches are the b
    expressions given by low and high son
  • t0 0 t1 1 tu var(u) -gt t high(u), t
    low(u)
  • If x1lt x2lt lt xn, is var ordering associate with
    each node u the function fu that maps (b1,,bn)
    to tub1/x1,bn/xn
  • Lemma For any function f Bn -gt B there is
    exactly one ROBDD u with variable ordering
    x1ltx2lt,,lt xn such that fu f(x1,,xn)
  • Proof Induction on number of arguments of f
    for induction step use two function f0 and f1 of
    n arguments by fixing the first argument of f to
    0 and 1 resp then
  • f(x1,,xn1 ) x1 -gt f1(x2,xn1),
    f0(x2,,xn1).
  • Buy induction result holds for f0 and f1 -
    and there are unique ROBDD nodes u0 and u1 with
    fu0 f0 and fu1 f1. Two cases to consider to
    show result holds for f (Case u0 u1 and case
    u0 not u1) See reading for remainder of proof.

24
  • The ordering determines the ROBDD and in
    particular the number of nodes varies see figure
    6.
  • Difficult to find minimal ROBDD some heuristics
    for particular classes of functions (see text and
    reading)

25
  • Figure 6 and caption

26
  • Rather than construct OBDD and then reduce it
    there is algorithm to reduce the OBDD during
    construction ( see reading)

27
Represent Kripke Structures
  • If Q is an nary relation over 0,1 then Q can be
    represented by the ROBDD for its characteristic
    function
  • fQ(x1,,xn) 1 iff (x1,xn) is in Q
  • Let Q be n-ary relation over D (wlog let number
    of elements of D be 2n).
  • Let g be bijection g 0,1m -gt D. g takes
    m-tuple x (of 0s and 1s) to element of D --
    d is rep by x
  • Q is rep as the char function of the boolean
    relation Q of arity m x n where Q(x1,,xn)
    Q(g(x1) , g(xn)).

28
  • If M (S, R, L)
  • Assume 2n states let g be mapping g 0,1n -gt
    S each assignment is in S so the characteristic
    function representing S is the OBDD representing
    the characteristic function for 1 (all s in S are
    in relation 1),denoted as f1
  • For R use same encoding g need 2 sets of
    variables one to represent start state and one to
    represent final state of a transition. If
    transition relation R is encoded by R(x, x),
    then R is rep by char function for R denoted as
    fR
  • Let L AP -gt 2S. For each p we have set L(p)
    use encoding g to find char function of that set.
Write a Comment
User Comments (0)
About PowerShow.com