© 2011 Carnegie Mellon University Binary Decision Diagrams Part 2 15-414 Bug Catching: Automated Program Verification and Testing Sagar Chaki September.

Slides:



Advertisements
Similar presentations
Model Checking Lecture 4. Outline 1 Specifications: logic vs. automata, linear vs. branching, safety vs. liveness 2 Graph algorithms for model checking.
Advertisements

Representing Boolean Functions for Symbolic Model Checking Supratik Chakraborty IIT Bombay.
Propositional and First Order Reasoning. Terminology Propositional variable: boolean variable (p) Literal: propositional variable or its negation p 
On Solving Presburger and Linear Arithmetic with SAT Ofer Strichman Carnegie Mellon University.
© 2011 Carnegie Mellon University SPIN: Part /614 Bug Catching: Automated Program Verification Sagar Chaki April 21, 2014.
© 2011 Carnegie Mellon University SPIN: Part /614 Bug Catching: Automated Program Verification Sagar Chaki April 21, 2014.
© 2010 Carnegie Mellon University B OXES : A Symbolic Abstract Domain of Boxes Arie Gurfinkel and Sagar Chaki Software Engineering Institute Carnegie Mellon.
NP-complete and NP-hard problems Transitivity of polynomial-time many-one reductions Concept of Completeness and hardness for a complexity class Definition.
Simplifying CFGs There are several ways in which context-free grammars can be simplified. One natural way is to eliminate useless symbols those that cannot.
SYMBOLIC MODEL CHECKING: STATES AND BEYOND J.R. Burch E.M. Clarke K.L. McMillan D. L. Dill L. J. Hwang Presented by Rehana Begam.
Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt.
© 2011 Carnegie Mellon University SPIN: Part Bug Catching: Automated Program Verification and Testing Sagar Chaki November 2, 2011.
© 2011 Carnegie Mellon University Binary Decision Diagrams Part Bug Catching: Automated Program Verification and Testing Sagar Chaki September.
ECE 667 Synthesis & Verification - Boolean Functions 1 ECE 667 Spring 2013 ECE 667 Spring 2013 Synthesis and Verification of Digital Circuits Boolean Functions.
Binary Decision Diagrams. ROBDDs Slide 2 Example Directed acyclic graph non-terminal node terminal node What function is represented by the graph?
DATE-2002TED1 Taylor Expansion Diagrams: A Compact Canonical Representation for Symbolic Verification M. Ciesielski, P. Kalla, Z. Zeng B. Rouzeyre Electrical.
1 Deciding separation formulas with SAT Ofer Strichman Sanjit A. Seshia Randal E. Bryant School of Computer Science, Carnegie Mellon University.
ECE Synthesis & Verification - Lecture 18 1 ECE 697B (667) Spring 2006 ECE 697B (667) Spring 2006 Synthesis and Verification of Digital Systems Word-level.
Boolean Functions and their Representations
A New Approach to Structural Analysis and Transformation of Networks Alan Mishchenko November 29, 1999.
Rolf Drechlser’s slides used
A Compressed Breadth-First Search for Satisfiability DoRon B. Motter and Igor L. Markov University of Michigan, Ann Arbor.
Taylor Expansion Diagrams (TED): Verification EC667: Synthesis and Verification of Digital Systems Spring 2011 Presented by: Sudhan.
ECE Synthesis & Verification - Lecture 10 1 ECE 697B (667) Spring 2006 ECE 697B (667) Spring 2006 Synthesis and Verification of Digital Systems Binary.
 2001 CiesielskiBDD Tutorial1 Decision Diagrams Maciej Ciesielski Electrical & Computer Engineering University of Massachusetts, Amherst, USA
ECE 667 Synthesis & Verification - BDD 1 ECE 667 ECE 667 Synthesis and Verification of Digital Systems Binary Decision Diagrams (BDD)
ENGG3190 Logic Synthesis “Binary Decision Diagrams” BDDs Winter 2014 S. Areibi School of Engineering University of Guelph.
 2000 M. CiesielskiPTL Synthesis1 Synthesis for Pass Transistor Logic Maciej Ciesielski Dept. of Electrical & Computer Engineering University of Massachusetts,
ECE 667 Synthesis and Verification of Digital Systems
By Tariq Bashir Ahmad Taylor Expansion Diagrams (TED) Adapted from the paper M. Ciesielski, P. Kalla, Z. Zeng, B. Rouzeyre,”Taylor Expansion Diagrams:
Daniel Kroening and Ofer Strichman 1 Decision Procedures in First Order Logic Decision Procedures for Equality Logic.
Digitaalsüsteemide verifitseerimise kursus1 Formal verification: BDD BDDs applied in equivalence checking.
Binary Decision Diagrams (BDDs)
Software Verification 2 Automated Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität and Fraunhofer Institut für.
February 18, 2015CS21 Lecture 181 CS21 Decidability and Tractability Lecture 18 February 18, 2015.
Lecture 22 More NPC problems
Propositional Equivalences
Solvers for the Problem of Boolean Satisfiability (SAT) Will Klieber Aug 31, 2011 TexPoint fonts used in EMF. Read the TexPoint manual before you.
Computer Science 210 Computer Organization Introduction to Boolean Algebra.
NP Complexity By Mussie Araya. What is NP Complexity? Formal Definition: NP is the set of decision problems solvable in polynomial time by a non- deterministic.
CS 267: Automated Verification Lecture 6: Binary Decision Diagrams Instructor: Tevfik Bultan.
Propositional Satisfiability A compound proposition is satisfiable if there is an assignment of truth values to its variables that make it true. When no.
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View BDDs.
Efficient Synthesis of Feature Models Article Review By: Sigal Berkovitz & Yohai Vidergor.
Integrating high-level constructs into programming languages Language extensions to make programming more productive Underspecified programs –give assertions,
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View BDDs.
Binary decision diagrams (BDD’s) Compact representation of a logic function ROBDD’s (reduced ordered BDD’s) are a canonical representation: equivalence.
BDDs1 Binary Tree Representation The recursive Shannon expansion corresponds to a binary tree Example: Each path from the root to a leaf corresponds to.
Satisfiability and SAT Solvers CS 270 Math Foundations of CS Jeremy Johnson.
NPC.
CSCI 2670 Introduction to Theory of Computing December 2, 2004.
SAT Encodings for Sudoku Bug Catching in 2006 Fall Sep. 26, 2006 Gi-Hwon Kwon.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Proof Methods for Propositional Logic CIS 391 – Intro to Artificial Intelligence.
Binary Decision Diagrams Prof. Shobha Vasudevan ECE, UIUC ECE 462.
1 1. Which of these sequences correspond to Hamilton cycles in the graph? (a) (b) (c) (d) (e)
How CTL model checking works
Polynomial-Time Reduction
NP-Completeness Yin Tat Lee
Intro to Theory of Computation
ECE 667 Synthesis and Verification of Digital Systems
SS 2017 Software Verification CTL model checking, BDDs
NP-Completeness Proofs
Binary Decision Diagrams
Propositional Equivalences
Formal Methods in software development
Binary Decision Diagrams
NP-Completeness Yin Tat Lee
CSE 589 Applied Algorithms Spring 1999
Boolean Algebra for CAD Applications
Presentation transcript:

© 2011 Carnegie Mellon University Binary Decision Diagrams Part Bug Catching: Automated Program Verification and Testing Sagar Chaki September 14, 2011

2 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University BDDs Recap Typically mean Reduced Ordered Binary Decision Diagrams (ROBDDs) Can be viewed as reduced forms of Ordered Binary Decision Trees Obtained by eliminating duplicate nodes and redundant nodes Often substantially smaller than the OBDT Canonical representation of Boolean formulas Unlike other normal forms like CNF and DNF Size of BDD depends critically on variable ordering In practice, BDDs are built up from their components Via (efficient) Boolean operations Dynamic variable ordering used to manage BDD size

3 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University Running Example: Comparator Comparator a1a1 a2a2 b1b1 b2b2 (A) f = 1, a 1 = b 1 Æ a 2 = b 2 (B) f = 1, a 1 = b 1 Ç a 2 = b 2

4 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University Conjunctive Normal Form ( : a 1 Ç b 1 ) Æ ( : b 1 Ç a 1 ) Æ ( : a 2 Ç b 2 ) Æ ( : b 2 Ç a 2 ) ( : b 1 Ç a 1 ) Æ ( : a 1 Ç b 1 ) Æ ( : a 2 Ç b 2 ) Æ ( : b 2 Ç a 2 ) (b 1 Ç a 1 ) Æ ( : a 1 Ç : b 1 ) Æ ( : a 2 Ç b 2 ) Æ ( : b 2 Ç a 2 ) ( : a 1 Ç b 1 ) Æ ( : b 1 Ç a 1 ) Æ ( : a 2 Ç : b 2 ) Æ (b 2 Ç a 2 )

5 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University Truth Table Row#a1a1 b1b1 a2a2 b2b2 f

6 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University Representing a Truth Table using a Graph a1a1 b1b1 b1b1 a2a2 a2a2 b1b1 b2b2 b2b2 b2b2 a2a2 b2b2 b2b2 b2b2 a2a2 a2a2

7 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University Representing a Truth Table using a Graph a1a1 b1b1 b1b1 a2a2 a2a2 b2b2 b2b b2b2 b2b a2a2 a2a2 b2b2 b2b b2b2 b2b2 0000

8 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University OBDT to ROBDD a1a1 b1b1 b1b1 a2a2 b2b2 b2b2 10 a2a2 b2b2 b2b2 AB CD Which pairs are isomorphic? (1){A,B} and {C,D} (2){A,C} and {B,D} (3){A,D} and {B,C} Which pairs are isomorphic? (1){A,B} and {C,D} (2){A,C} and {B,D} (3){A,D} and {B,C}

9 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University OBDT to ROBDD a1a1 b1b1 b1b1 b2b2 10 a2a2 b2b2 Is this a ROBDD? (1) YES (2) NO Is this a ROBDD? (1) YES (2) NO

10 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University OBDT to ROBDD a1a1 b1b1 b1b1 b2b2 10 a2a2 b2b2 What function does X represent? (1) a 2 = b 2 (2) a 2 = ( : b 2 ) (3) a 2 ) b 2 (4) a 2 © b 2 (5) : (a 2 © b 2 ) (6) (a 2 Æ b 2 ) Ç ( : a 2 Æ : b 2 ) What function does X represent? (1) a 2 = b 2 (2) a 2 = ( : b 2 ) (3) a 2 ) b 2 (4) a 2 © b 2 (5) : (a 2 © b 2 ) (6) (a 2 Æ b 2 ) Ç ( : a 2 Æ : b 2 ) X 1,5,6

11 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University ROBDD (a.k.a. BDD) Summary If BDD(f 1 ) and BDD(f 2 ) are isomorphic then: 1.f 1 = f 2 2.f 1 and f 2 have the same variables 3.BDD(f 1 ) and BDD(f 2 ) have the same variable ordering If BDD(f) is the leaf node “1” then f is: 1.Satisfiable 2.Unsatisfiable 3.Valid

12 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University ROBDD and variable ordering a1a1 a2a2 a2a2 b1b1 b1b1 b2b2 10 b1b1 b1b1 b2b2 b2b2 Is this a ROBDD? (1) YES (2) NO Is this a ROBDD? (1) YES (2) NO

13 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University ROBDD and variable ordering a1a1 a2a2 a2a2 b1b1 b1b1 b2b2 10 b1b1 b1b1 b2b2 Is this a ROBDD? (1) YES (2) NO Is this a ROBDD? (1) YES (2) NO

14 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University ROBDD and variable ordering There exists a function whose BDD grows polynomially in the number of variables for some ordering and exponentially for others? TRUE There exists a function whose BDD grows exponentially for all variable orderings? TRUE There exists a function whose BDD grows linearly for all variable orderings? TRUE

15 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University BDD Operations True : BDD(TRUE) False: BDD(FALSE) Var : v  BDD(v) Not : BDD(f)  BDD( : f) And : BDD(f 1 ) £ BDD(f 2 )  BDD(f 1 Æ f 2 ) Or : BDD(f 1 ) £ BDD(f 2 )  BDD(f 1 Ç f 2 ) Exist : BDD(f) £ v  BDD( 9 v. f)

16 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University Basic BDD Operations TrueFalse Var(v) v

17 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University BDD Operations: Not v O (1)

18 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University BDD Operations: Not v Swap “0” and “1” O (1) O (n)

19 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University BDD Operations: And v What formula does this represent? Suppose this is the BDD for f

20 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University BDD Operations: And v f v=0 Suppose this is the BDD for f f v=1 f v=0 and f v=1 are known as the co-factors of f w.r.t. v f = (X Æ f v=0 ) Ç (Y Æ f v=1 )

21 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University BDD Operations: And v f v=0 Suppose this is the BDD for f f v=1 f v=0 and f v=1 are known as the co-factors of f w.r.t. v f = ( : v Æ f v=0 ) Ç (v Æ f v=1 )

22 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University BDD Operations: And (Simple Cases) And (f, ) = 00 1 f And (,f ) = 1 f 0 0

23 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University BDD Operations: And (Complex Case) v1v1 f1f1 g1g1 v2v2 f2f2 g2g2 ( : v 1 Æ f 1 ) Ç (v 1 Æ g 1 ) ( : v 2 Æ f 2 ) Ç (v 2 Æ g 2 ) Æ Æ

24 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University BDD Operations: And (Complex Case 1) v1v1 f1f1 g1g1 v1v1 f2f2 g2g2 ( : v 1 Æ f 1 ) Ç (v 1 Æ g 1 ) ( : v 1 Æ f 2 ) Ç (v 1 Æ g 2 ) Æ Æ v 1 = v 2

25 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University BDD Operations: And (Complex Case 1) ( : v 1 Æ f 1 ) Ç (v 1 Æ g 1 ) ( : v 1 Æ f 2 ) Ç (v 1 Æ g 2 ) Æ v 1 = v 2 ( : v 1 Æ X) Ç (v 1 Æ Y)

26 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University BDD Operations: And (Complex Case 1) ( : v 1 Æ f 1 ) Ç (v 1 Æ g 1 ) ( : v 1 Æ f 2 ) Ç (v 1 Æ g 2 ) Æ v 1 = v 2 ( : v 1 Æ (f 1 Æ f 2 )) Ç (v 1 Æ (g 1 Æ g 2 )) Compute recursively

27 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University BDD Operations: And (Complex Case 1) ( : v 1 Æ f 1 ) Ç (v 1 Æ g 1 ) ( : v 1 Æ f 2 ) Ç (v 1 Æ g 2 ) Æ v 1 = v 2 ( : v 1 Æ (f 1 Æ f 2 )) Ç (v 1 Æ (g 1 Æ g 2 )) v1v1 f 1 Æ f 2 g 1 Æ g 2 What if f 1 Æ f 2 = g 1 Æ g 2 ? Return f 1 Æ f 2

28 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University BDD Operations: And (Complex Case 2) v1v1 f1f1 g1g1 v2v2 f2f2 g2g2 ( : v 1 Æ f 1 ) Ç (v 1 Æ g 1 ) ( : v 2 Æ f 2 ) Ç (v 2 Æ g 2 ) Æ Æ v 1 < v 2 v 1 appears before v 2 in the variable ordering d2d2 d2d2

29 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University BDD Operations: And (Complex Case 2) ( : v 1 Æ f 1 ) Ç (v 1 Æ g 1 ) d2d2 d2d2 Æ v 1 < v 2 ( : v 1 Æ (f 1 Æ d 2 )) Ç (v 1 Æ (g 1 Æ d 2 )) v1v1 f 1 Æ d 2 g 1 Æ d 2 What if f 1 Æ d 2 = g 1 Æ d 2 ? Return f 1 Æ d 2 O (n 1 £ n 2 )

30 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University BDD Operations: Or Or(d1,d 2 ) = Not ( And ( Not(d 1 ), Not(d 2 ) ) ) Or(d1,d 2 ) = Not ( And ( Not(d 1 ), Not(d 2 ) ) ) O (n 1 £ n 2 )

31 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University BDD Operations: Exist Exist(“0”,v) = ?

32 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University BDD Operations: Exist Exist(“0”,v) = “0” Exist(“1”,v) = ? Exist(“0”,v) = “0” Exist(“1”,v) = ?

33 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University BDD Operations: Exist Exist(“0”,v) = “0” Exist(“1”,v) = “1” Exist(( : v Æ f) Ç (v Æ g), v) = ? Exist(“0”,v) = “0” Exist(“1”,v) = “1” Exist(( : v Æ f) Ç (v Æ g), v) = ?

34 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University BDD Operations: Exist Exist(“0”,v) = “0” Exist(“1”,v) = “1” Exist(( : v Æ f) Ç (v Æ g), v) = Or(f,g) Exist(( : v’ Æ f) Ç (v’ Æ g), v) = ? Exist(“0”,v) = “0” Exist(“1”,v) = “1” Exist(( : v Æ f) Ç (v Æ g), v) = Or(f,g) Exist(( : v’ Æ f) Ç (v’ Æ g), v) = ?

35 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University BDD Operations: Exist Exist(“0”,v) = “0” Exist(“1”,v) = “1” Exist(( : v Æ f) Ç (v Æ g), v) = Or(f,g) Exist(( : v’ Æ f) Ç (v’ Æ g), v) = ( : v’ Æ Exist(f,v)) Ç (v’ Æ Exist(g,v)) Exist(“0”,v) = “0” Exist(“1”,v) = “1” Exist(( : v Æ f) Ç (v Æ g), v) = Or(f,g) Exist(( : v’ Æ f) Ç (v’ Æ g), v) = ( : v’ Æ Exist(f,v)) Ç (v’ Æ Exist(g,v)) O (n 2 ) But f is SAT iff 9 V. f is not “0”. So why doesn’t this imply P = NP? Because the BDD size changes!

36 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University BDD Applications SAT is great if you are interested to know if a solution exists BDDs are great if you are interested in the set of all solutions How many solutions are there? How do you do this on a BDD? Or if your problem involves computing a fixed point Set of nodes reachable from a given node in a graph

37 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University BDD Application: Counting Sudoku Solutions How many ways can you solve this puzzle?

38 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University BDD Application: Counting Sudoku Solutions How many ways can you solve this puzzle? At least 2.

39 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University BDD Application: Counting Sudoku Solutions How many ways can you solve this puzzle? At least 2.

40 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University BDD Application: Counting Sudoku Solutions a 11,b 11 a 44,b 44

41 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University BDD Application: Counting Sudoku Solutions : a 13 Æ b 13 a 33 Æ : b 33 a 31 Æ b 31

42 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University BDD Application: Counting Sudoku Solutions Distinct Elements a 11 © a 12 Ç b 11 © b 12 Æ a 11 © a 13 Ç b 11 © b 13 Æ a 11 © a 14 Ç b 11 © b 14 Æ a 12 © a 13 Ç b 12 © b 13 Æ a 12 © a 14 Ç b 12 © b 14 Æ a 13 © a 14 Ç b 13 © b 14 a 11 © a 12 Ç b 11 © b 12 Æ a 11 © a 13 Ç b 11 © b 13 Æ a 11 © a 14 Ç b 11 © b 14 Æ a 12 © a 13 Ç b 12 © b 13 Æ a 12 © a 14 Ç b 12 © b 14 Æ a 13 © a 14 Ç b 13 © b 14 Repeat for each row, column and sub-square Construct BDD Count number of solutions Repeat for each row, column and sub-square Construct BDD Count number of solutions

43 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University Graph Reachability Which nodes are reachable from “7”? {2,3,5,6,7} But what if the graph has trillions of nodes?

44 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University Graph Reachability Use three Boolean variables (a,b,c) to encode each node? : a Æ : b Æ : c a Æ b Æ c

45 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University Graph Reachability Use three Boolean variables (a,b,c) to encode each node? : a Æ : b Æ : c a Æ b Æ c a Æ : b Æ : c

46 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University Graph Reachability Use three Boolean variables (a,b,c) to encode each node? : a Æ : b Æ : c a Æ b Æ c a Æ : b Æ : c a Æ : b Æ c

47 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University Graph Reachability Key Idea 1: Every Boolean formula represents a set of nodes! a Æ b Æ : c = ? The nodes whose encodings satisfy the formula.

48 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University Graph Reachability Key Idea 1: Every Boolean formula represents a set of nodes! a Æ b Æ : c = {6}

49 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University Graph Reachability Key Idea 1: Every Boolean formula represents a set of nodes! a Æ b = ?

50 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University Graph Reachability Key Idea 1: Every Boolean formula represents a set of nodes! a Æ b = {6,7}

51 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University Graph Reachability Key Idea 1: Every Boolean formula represents a set of nodes! a © b = ?

52 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University Graph Reachability Key Idea 1: Every Boolean formula represents a set of nodes! a © b = {2,3,4,5}

53 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University Graph Reachability Key Idea 2: Edges can also be represented by Boolean formulas An edge is just a pair of nodes Introduce three new variables: a’, b’, c’ Formula © represents all pairs of nodes (n,n’) that satisfy © when n is encoded using (a,b,c) and n’ is encoded using (a’,b’,c’) Key Idea 2: Edges can also be represented by Boolean formulas An edge is just a pair of nodes Introduce three new variables: a’, b’, c’ Formula © represents all pairs of nodes (n,n’) that satisfy © when n is encoded using (a,b,c) and n’ is encoded using (a’,b’,c’)

54 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University Graph Reachability : a Æ : b Æ : c Æ : a’ Æ : b’ Æ c’ Key Idea 2: Edges can also be represented by Boolean formulas

55 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University Graph Reachability a Æ : b Æ c Æ : a’ Æ b’ Æ : c’ Key Idea 2: Edges can also be represented by Boolean formulas

56 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University Graph Reachability a Æ : b Æ c Æ : a’ Æ b’ Æ : c’ Ç : a Æ : b Æ : c Æ : a’ Æ : b’ Æ c’ Key Idea 2: Edges can also be represented by Boolean formulas a Æ : b Æ c Æ : a’ Æ b’ Æ : c’ Ç : a Æ : b Æ : c Æ : a’ Æ : b’ Æ c’

57 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University Graph Reachability Key Idea 3: Given the BDD for a set of nodes S, and the BDD for the set of all edges R, the BDD for all the nodes that are adjacent to S can be computed using the BDD operations Image(S,R) = ( 9 a,b,c. (S Æ R)) [ a \ a’, b \ b’, c \ c’] Image(S,R) = ( 9 a,b,c. (S Æ R)) [ a \ a’, b \ b’, c \ c’] Variable renaming : replace a’ with a

58 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University Graph Reachability Algorithm S = BDD for initial set of nodes; R = BDD for all the edges of the graph; while (true) { I = Image(S,R); //compute adjacent nodes to S if (And(Not(S),I) == False) //no new nodes found break; S = Or(S,I); //add newly discovered nodes to result } return S; Symbolic Model Checking. Has been done for graphs with nodes.

59 Binary Decision Diagrams – Part 2 Sagar Chaki, Sep 14, 2011 © 2011 Carnegie Mellon University Questions? Sagar Chaki Senior Member of Technical Staff RTSS Program Telephone: U.S. Mail Software Engineering Institute Customer Relations 4500 Fifth Avenue Pittsburgh, PA USA Web Customer Relations Telephone: SEI Phone: SEI Fax: