Download presentation
1
Binary Decision Diagrams (BDDs)
Daniel Kroening and Ofer Strichman
2
Part I Reminders - Deciding Propositional Logic What is Logic
Proofs by deduction Proofs by enumeration Decidability, Soundness and Completeness some notes on Propositional Logic Deciding Propositional Logic SAT tools BDDs
3
Next: Binary Decision Diagrams
SAT looked for a satisfying solution to CNF We will now examine a graph-based data structure called Binary Decision Diagrams. It has several advantages and disadvantages comparing to SAT Developed by Bryant [1986]. Next few slides are from the source …
4
Alternate Approach (A ∧ C) ∨ (C ∧ B) (A Ç B) Æ (C) A B C 1 A B C 1
Generate complete representation of function Canonicity: functions are equal iff representations are identical (A ∧ C) ∨ (C ∧ B) A B C 1 (A Ç B) Æ (C) A B C 1
5
Decision Structures Truth Table Decision Tree
Vertex represents decision Follow green (dashed) line for value 0 Follow red (solid) line for value 1 Function value determined by leaf value.
6
Variable Ordering OK Not OK
Assign arbitrary total ordering to variables e.g., x1 < x2 < x3 Variables must appear in ascending order along all paths OK Not OK x x 3 1 x 2 x x3 1
7
Reduction Rule #1 Merge equivalent leaves a a a
8
Reduction Rule #2 Merge isomorphic nodes y x z y x z y x z
9
Reduction Rule #3 Eliminate Redundant Tests y x y
10
Example OBDD Initial Graph Reduced Graph
(x1 Ç x2) Æ x3 Canonical representation of Boolean functions For a given variable ordering Two functions are equivalent iff graphs are isomorphic Can be tested in linear time Desirable property: simplest form is canonical.
11
Satisfiability etc. Constants Unique unsatisfiable function Unique tautology Conclusion: given a BDD it takes constant time to check: Validity Contradiction Satisfiability Is this a free lunch ? …
12
Effect of Variable Ordering
Good Ordering Bad Ordering Linear Growth Exponential Growth
13
Selecting Good Variable Ordering
Intractable Problem Even when problem represented as OBDD i.e., to find optimum improvement to current ordering Application-Based Heuristics Exploit characteristics of application e.g., Ordering for functions of combinational circuit Traverse circuit graph depth-first from outputs to inputs
14
Building BDDs ‘from below’
Starting from a binary decision tree is too hard for formulas with many variables. Goal: construct the BDD ‘from below’.
15
Building BDDs ‘from below’
For this we will need a function called APPLY: Given the BDDs for f1 and f2, and a binary connective F 2 {Æ, Ç, !, $...} (any one of the 16 binary connectives), Construct the BDD for f1 F f2,
16
Building BDDs ‘from below’
Def: a restriction of a function f to x=d, denoted f|x=d where x 2 vars(f), d 2 {0,1}, is equal to f after assigning x=d. Given the BDD of f, deriving the BDD of f|x=0 is simple: f: (x1 Ç x2) Æ x3 f|x2=1 1 x 3 x 3 1
17
Now, APPLY (1/3) Let v1,v2 denote that root nodes of f1, f2, respectively, with var(v1) = x1 and var(v2)=x2. If v1 and v2 are leafs, f1 F f2 is a leaf node with value val(v1) F val(v2) Ç 1 = 1 Æ 1 =
18
Now, APPLY (2/3) If x1 = x2 = x, apply Shanon expansion: f1 F f2 = (:x Æ f1|x=0 F f2|x=0 Ç x Æ f1|x=1 F f2|x=1) x BDD for f1|x=1 Æ f2|x=1 f1|x=0 Æ f2|x=0 x x Æ = BDD for f1|x=0 BDD for f1|x=1 BDD for f2|x=0 BDD for f2|x=1
19
Now, APPLY (3/3) else, suppose x1 < x2 in the variable order. f1 F f2 = (:x1 Æ f1|x=0 F f2 Ç x1 Æ f1|x=1 F f2) x1 x2 x1 Æ = BDD for f1|x1=1 BDD for f1|x=0 Æ f2 BDD for f1|x=1 Æ f2 BDD for f1|x1=0 BDD for f2|x2=0 BDD for f2|x2=1
20
BDDs from below: example.
1 Ç x 2 1 x 1 BDD for f1|x1=0 Ç f2 f1|x1=1 Ç f2 x2 1 x x 2 x 2 1 2 Ç = 1 f2: :x2 f1: x1 $ x2 BDD for f1|x1=0 Ç f2 = = x 2 1 0 Ç 0 = 0 1 Ç 1 = 1
21
BDDs from below: example.
1 x x 2 x 2 x 1 BDD for f1|x=0 Ç f2 f1|x=1 Ç f2 2 Ç = 1 1 f2: :x2 f1: x1 $ x2 f1 Ç f2 = x1 Ç (:x1 Æ :x2) x 1 2 = x 1 x 2 = x 2 1
22
Comparing SAT to BDDs BDD is a canonical data structure that represents the semantic of a function, i.e. all its solutions Some applications (e.g. symbolic model checking) need canonicity to detect when two sets are equivalent. Can require exponential space & time (highly sensitive to variable ordering) SAT searches through CNF for a single solution CNF is not canonical. Poly-space algorithms exists. Time can be exponential.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.