FORMAL METHODS LECTURE VI BINARY DECISION DIAGRAMS (BDD S)

Similar documents
Formal Methods Lecture VII Symbolic Model Checking

FORMAL METHODS LECTURE V: CTL MODEL CHECKING

Boolean decision diagrams and SAT-based representations

FORMAL METHODS LECTURE IV: COMPUTATION TREE LOGIC (CTL)

Comp487/587 - Boolean Formulas

FORMAL METHODS LECTURE III: LINEAR TEMPORAL LOGIC

Sequence Analysis, WS 14/15, D. Huson & R. Neher (this part by D. Huson & J. Fischer) January 21,

Announcements. Office Hours Swap: OH schedule has been updated to reflect this.

Maximum Entropy and Exponential Families

Reduced Ordered Binary Decision Diagrams

Binary Decision Diagrams

Formal Verification by Model Checking

BDD Based Upon Shannon Expansion

Computational Logic. Davide Martinenghi. Spring Free University of Bozen-Bolzano. Computational Logic Davide Martinenghi (1/30)

15.12 Applications of Suffix Trees

Two-Level Minimization

Binary Decision Diagrams Boolean Functions

Sensitivity Analysis in Markov Networks

Symbolic Model Checking with ROBDDs

Binary Decision Diagrams

Formal Verification SE303 Conception des systèmes sur puces (SoC)

Reduced Ordered Binary Decision Diagrams

Binary Decision Diagrams. Graphs. Boolean Functions

Summary. Computation Tree logic Vs. LTL. CTL at a glance. KM,s =! iff for every path " starting at s KM," =! COMPUTATION TREE LOGIC (CTL)

A brief introduction to Logic. (slides from

Binary Decision Diagrams

Binary Decision Diagrams

McCreight s Suffix Tree Construction Algorithm. Milko Izamski B.Sc. Informatics Instructor: Barbara König

Lecture 7: Sampling/Projections for Least-squares Approximation, Cont. 7 Sampling/Projections for Least-squares Approximation, Cont.

Probabilistic Graphical Models

Most results in this section are stated without proof.

Binary Decision Diagrams

Propositional Logic: Evaluating the Formulas

Decision Procedures for Satisfiability and Validity in Propositional Logic

Parallelized Side-Channel Attack Resisted Scalar Multiplication Using q-based Addition-Subtraction k-chains

Outline. Complexity Theory. Introduction. What is abduction? Motivation. Reference VU , SS Logic-Based Abduction

max min z i i=1 x j k s.t. j=1 x j j:i T j

Modal Horn Logics Have Interpolation

Differential Equations 8/24/2010

1 First-order logic. 1 Syntax of first-order logic. 2 Semantics of first-order logic. 3 First-order logic queries. 2 First-order query evaluation

Cryptography, winter term 16/17: Sample solution to assignment 2

CTL Model Checking. Wishnu Prasetya.

Bypassing Space Explosion in High-Speed Regular Expression Matching

Mathematical Logic Propositional Logic - Tableaux*

State Diagrams. Margaret M. Fleck. 14 November 2011

Quantified Boolean Formulas Part 1

Model Checking for Propositions CS477 Formal Software Dev Methods

CMSC 451: Lecture 9 Greedy Approximation: Set Cover Thursday, Sep 28, 2017

A NETWORK SIMPLEX ALGORITHM FOR THE MINIMUM COST-BENEFIT NETWORK FLOW PROBLEM

23.1 Tuning controllers, in the large view Quoting from Section 16.7:

EECS 219C: Computer-Aided Verification Boolean Satisfiability Solving III & Binary Decision Diagrams. Sanjit A. Seshia EECS, UC Berkeley

Overview. Discrete Event Systems Verification of Finite Automata. What can finite automata be used for? What can finite automata be used for?

SERIJA III

Advanced Computational Fluid Dynamics AA215A Lecture 4

13th International Conference on Relational and Algebraic Methods in Computer Science (RAMiCS 13)

An Efficient Sequential SAT Solver With Improved Search Strategies

Basing Decisions on Sentences in Decision Diagrams

Comparison of Alternative Equivalent Circuits of Induction Motor with Real Machine Data

CS 687 Jana Kosecka. Uncertainty, Bayesian Networks Chapter 13, Russell and Norvig Chapter 14,

Algebraic Methods. Motivation: Systems like this: v 1 v 2 v 3 v 4 = 1 v 1 v 2 v 3 v 4 = 0 v 2 v 4 = 0

LOGIC PROPOSITIONAL REASONING

if t 1,...,t k Terms and P k is a k-ary predicate, then P k (t 1,...,t k ) Formulas (atomic formulas)

7 Max-Flow Problems. Business Computing and Operations Research 608

Chapter 8 Hypothesis Testing

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler

Outline. Complexity Theory EXACT TSP. The Class DP. Definition. Problem EXACT TSP. Complexity of EXACT TSP. Proposition VU 181.

MAC Calculus II Summer All you need to know on partial fractions and more

Hankel Optimal Model Order Reduction 1

Pushdown Specifications

Logic: Propositional Logic (Part I)

A Collection of Problems in Propositional Logic

Knowledge base (KB) = set of sentences in a formal language Declarative approach to building an agent (or other system):

Fault Tolerant Variable Block Carry Skip Logic (VBCSL) using Parity Preserving Reversible Gates

Reliability Guaranteed Energy-Aware Frame-Based Task Set Execution Strategy for Hard Real-Time Systems

Complexity. Complexity Theory Lecture 3. Decidability and Complexity. Complexity Classes

International Journal of Electronics and Computer Science Engineering 817. Available Online at ISSN

Journal of Inequalities in Pure and Applied Mathematics

Logic and Inferences

22c:145 Artificial Intelligence

Lecture 2: Symbolic Model Checking With SAT

Determination of the reaction order

Counting Idempotent Relations

Propositional Fragments for Knowledge Compilation and Quantified Boolean Formulae

Statistical physics analysis of the computational complexity of solving random satisfiability problems using backtrack algorithms

SAT, NP, NP-Completeness

General Equilibrium. What happens to cause a reaction to come to equilibrium?

PROOFS IN PREDICATE LOGIC AND COMPLETENESS; WHAT DECIDABILITY MEANS HUTH AND RYAN 2.3, SUPPLEMENTARY NOTES 2

Lecture 9: The Splitting Method for SAT

Fig Review of Granta-gravel

Database Theory VU , SS Ehrenfeucht-Fraïssé Games. Reinhard Pichler

SURFACE WAVES OF NON-RAYLEIGH TYPE

First-Order Logic. 1 Syntax. Domain of Discourse. FO Vocabulary. Terms

7.1 Roots of a Polynomial

Database Theory VU , SS Complexity of Query Evaluation. Reinhard Pichler

Millennium Relativity Acceleration Composition. The Relativistic Relationship between Acceleration and Uniform Motion

Chapter 2. Reductions and NP. 2.1 Reductions Continued The Satisfiability Problem (SAT) SAT 3SAT. CS 573: Algorithms, Fall 2013 August 29, 2013

1 Algebraic Methods. 1.1 Gröbner Bases Applied to SAT

Some examples of generated fuzzy implicators

LECTURE NOTES FOR , FALL 2004

Product Policy in Markets with Word-of-Mouth Communication. Technical Appendix

Transcription:

Alessandro Artale (FM First Semester 2009/2010) p. 1/38 FORMAL METHODS LECTURE VI BINARY DECISION DIAGRAMS (BDD S) Alessandro Artale Faulty of Computer Siene Free University of Bolzano artale@inf.unibz.it http://www.inf.unibz.it/ artale/ Some material (text, figures) displayed in these slides is ourtesy of: M. Benereetti, A. Cimatti, M. Fisher, F. Giunhiglia, M. Pistore, M. Roveri, R.Sebastiani.

Alessandro Artale (FM First Semester 2009/2010) p. 2/38 Summary of Leture VI Motivations. Ordered Binary Deision Diagrams (OBDD). OBDD s as Canonial Forms. Building OBDD s.

Alessandro Artale (FM First Semester 2009/2010) p. 3/38 State Spae Explosion The bottlenek: Exhaustive analysis may require to store all the states of the Kripke struture, and to explore them one-by-one. The state spae may be exponential in the number of omponents and variables (E.g., 300 boolean vars up to 2 300 10 100 states!) State Spae Explosion: Too muh memory required; Too muh CPU time required to explore eah state. A solution: Symboli Model Cheking.

Alessandro Artale (FM First Semester 2009/2010) p. 4/38 Symboli Model Cheking: Intuitions Symboli representation of Set of states by formulae in propositional logi. manipulation of sets of states, rather than single states; manipulation of sets of transitions, rather than single transitions.

Alessandro Artale (FM First Semester 2009/2010) p. 5/38 Summary Motivations. Ordered Binary Deision Diagrams (OBDD). OBDD s as Canonial Forms. Building OBDD s

Alessandro Artale (FM First Semester 2009/2010) p. 6/38 Ordered Binary Deision Diagrams (OBDD) Ordered Binary Deision Diagrams (OBDD) are used to represent formulae in propositional logi. A simple version: Binary Deision Trees: Non-Terminal nodes labeled with boolean variables/propositions; Leaves (terminal nodes) are labeled with either 0 or 1; Two kinds of lines: dashed and solid; Paths leading to 1 represent models, while paths leading to 0 represent ounter-models.

Alessandro Artale (FM First Semester 2009/2010) p. 7/38 Binary Deision Trees: An Example BDT representing the formula: ϕ = x y. x y y 1 0 0 0 The assignment, x = 0,y = 0, makes true the formula.

Alessandro Artale (FM First Semester 2009/2010) p. 8/38 Binary Deision Trees (BDT) Let T be a BDT, then T determines a unique boolean formula in the following way: Fixed an assignment for the variables in T we start at the root and: If the value of the variable in the urrent node is 1 we follow the solid line; Otherwise, we follow the dashed line; The truth value of the formula is given by the value of the leaf we reah.

Alessandro Artale (FM First Semester 2009/2010) p. 9/38 Binary Deision Trees (Cont.) BDT s with multiple ourrenes of a variable along a path are: 1. Rather ineffiient (Redundant paths); 2. Diffiult to hek whether they represent the same formula (equivalene test). Example of two equivalent BDT s x x y z y y x 1 y x 0 1 0 1 0 1 0 1 z 1 0 1

Ordered Deision Trees Ordered Deision Tree (OBDT): from root to leaves variables are enountered always in the same order without repetitions along paths. Example: Ordered Deision tree for ϕ = (a b) ( d) a b b d d d d d d d d 0 0 0 1 0 0 0 1 0 0 0 1 1 1 1 1 Alessandro Artale (FM First Semester 2009/2010) p. 10/38

Alessandro Artale (FM First Semester 2009/2010) p. 11/38 Summary Motivations. Ordered Binary Deision Diagrams (OBDD). OBDD s as Canonial Forms. Building OBDD s

Alessandro Artale (FM First Semester 2009/2010) p. 12/38 Reduing the size of Ordered Deision Trees OBDT s are still exponential in the number of variables: Given n variables the OBDT s will have 2 n+1 1 nodes! We an redue the size of OBDT s by a reursive appliations of the following redutions: Remove Redundanies: Nodes with same left and right hildren an be eliminated; Share Subnodes: Roots of struturally idential sub-trees an be ollapsed.

Alessandro Artale (FM First Semester 2009/2010) p. 13/38 Redution: Example a b b d d d d d d d d 0 0 0 1 0 0 0 1 0 0 0 1 1 1 1 1

Alessandro Artale (FM First Semester 2009/2010) p. 14/38 Redution: Example (Cont.) Detet redundaies: a b b d d d d d d d d 0 0 0 1 0 0 0 1 0 0 0 1 1 1 1 1

Alessandro Artale (FM First Semester 2009/2010) p. 15/38 Redution: Example (Cont.) Remove redundaies: a b b 0 d 0 d 0 d 1 1 0 1 0 1 0 1

Alessandro Artale (FM First Semester 2009/2010) p. 16/38 Redution: Example (Cont.) Remove redundaies: a b b 1 0 d 0 d 0 d 0 1 0 1 0 1

Alessandro Artale (FM First Semester 2009/2010) p. 17/38 Redution: Example (Cont.) Share idential nodes: a b b 1 0 d 0 d 0 d 0 1 0 1 0 1

Alessandro Artale (FM First Semester 2009/2010) p. 18/38 Redution: Example (Cont.) Share idential nodes: a b b 0 d 1

Alessandro Artale (FM First Semester 2009/2010) p. 19/38 Redution: Example (Cont.) Detet redundanies: a b b 0 d 1

Alessandro Artale (FM First Semester 2009/2010) p. 20/38 Redution: Example (Cont.) Remove redundanies: a b 0 d 1 Final OBDD!

Alessandro Artale (FM First Semester 2009/2010) p. 21/38 OBDD s as Canonial Forms Definition. Given two OBDD s, B ϕ,b ψ, they have a ompatible variable ordering if there are no variables x,y suh that x < y in B ϕ while y < x in B ψ. Theorem. A Redued OBDD is a Canonial Form of a boolean formula: One a variable ordering is established (i.e., OBDD s have ompatible variable ordering), equivalent formulas are represented by the same OBDD: ϕ 1 ϕ 2 iff OBDD(ϕ 1 ) OBDD(ϕ 2 )

Alessandro Artale (FM First Semester 2009/2010) p. 22/38 Importane of OBDD s Canonial forms for OBDD s allow us to perform in an effiient way the following tests: Equivalene hek is simple: We test whether the redued and order ompatible OBDD s have idential struture. Validity hek requires onstant time! ϕ iff the redued OBDD B ϕ B (un)satisfiability hek requires onstant time! ϕ iff the redued OBDD B ϕ B The set of the paths from the root to 1 represent all the models of the formula; The set of the paths from the root to 0 represent all the ounter-models of the formula.

Alessandro Artale (FM First Semester 2009/2010) p. 23/38 Importane of Variable Ordering Changing the ordering of variables may inrease the size of OBDD s. Example, two OBDD s for the formula: ϕ = (a1 b1) (a2 b2) (a3 b3) a1 a1 b1 b1 a2 a2 a2 a3 a3 a3 a3 b2 b2 b1 b1 b1 b1 b1 b1 b1 b1 a3 b2 b2 b2 b2 b3 b3 b3 b3 True False True False Linear size Exponential size

Alessandro Artale (FM First Semester 2009/2010) p. 24/38 Summary Motivations. Ordered Binary Deision Diagrams (OBDD). OBDD s as Canonial Forms. Building OBDD s.

Alessandro Artale (FM First Semester 2009/2010) p. 25/38 The REDUCE Algorithm Notation. Given a non-terminal node, n, then lo(n) denotes the node pointed via the dashed line, while hi(n) denotes the node pointed by the solid line. Given an OBDD, REDUCE proeeds bottom-up assigning an integer label, id(n), to eah node: 1. Assign label 0 to all 0-terminals and label 1 to all 1-terminals. Given now a non-terminal node for x i, say n, then: 2. If id(lo(n)) = id(hi(n)), then id(n) = id(lo(n)); 3. If there is another node for x i, say m, suh that id(lo(n)) = id(lo(m)) and id(hi(n)) = id(hi(m)), then, id(n) =id(m); 4. Otherwise we set id(n) to the next unused integer.

Alessandro Artale (FM First Semester 2009/2010) p. 26/38 The Redue Algorithm (Cont) REDUCE Final Step: Collapsing nodes with the same label and redireting edges aordingly with the node ollapsing. Example: See Figure 6.14 from the book.

Alessandro Artale (FM First Semester 2009/2010) p. 27/38 Reursive struture of OBDD s Given a formula ϕ and a variable ordering X = {x 1,x 2,...,x n }, the algorithm to build OBDD s from formulas, OBDD(ϕ,X), operates reursively: 1. If ϕ =, then, OBDD(,X) = B = 1; 2. If ϕ =, then, OBDD(,X) = B = 0; 3. If ϕ = x i, then, OBDD(x i,x) = B xi x i 1 0 4. If ϕ = ϕ 1, then, OBDD( ϕ 1,X) is obtained by negating the terminal nodes of OBDD(ϕ 1,X); 5. If ϕ = ϕ 1 op ϕ 2 (op a binary boolean operator), then, OBDD(ϕ 1 op ϕ 2,X) =apply(op,obdd(ϕ 1,X),OBDD(ϕ 2,X)).

Alessandro Artale (FM First Semester 2009/2010) p. 28/38 The algorithm APPLY Given two OBDD s, B ϕ,b ψ, the all apply(op,b ϕ,b ψ ) omputes the redued OBDD of the formula ϕ op ψ. The algorithms operates reursively on the struture of the two OBDD s: 1. Let x be the variable highest in the ordering whih ours in B ϕ or B ψ, then 2. Split the problem in two sub-problems: one for x being true and the other for x being false and solve reursively; 3. At the leaves, apply the boolean operation diretly.

Alessandro Artale (FM First Semester 2009/2010) p. 29/38 The algorithm APPLY (Cont.) Definition. Let ϕ be a formula and x a variable. We denote by ϕ[0/x] (ϕ[1/x]) the formula obtained by replaing all ourrenes of x in ϕ by 0 (1). This allow us to split boolean formulas in simpler ones. Lemma [Shannon Expansion]. Let ϕ be a formula and x a variable, then: ϕ (x ϕ[1/x]) ( x ϕ[0/x]) The funtion APPLY is based on the Shannon Expansion: ϕopψ (x (ϕ[1/x]opψ[1/x])) ( x (ϕ[0/x]opψ[0/x]))

Alessandro Artale (FM First Semester 2009/2010) p. 30/38 The algorithm APPLY (Cont.) Apply(op,B ϕ,b ψ ) proeeds from the roots downward. Let r ϕ,r ψ the roots of B ϕ,b ψ respetively: 1. If both r ϕ,r ψ are terminal nodes, then, Apply(op,B ϕ,b ψ ) =B (rϕ op r ψ ); 2. If both roots are x i -nodes, then reate an x i -node with a dashed line to Apply(op,B lo(rϕ ),B lo(rψ )) and a solid line to Apply(op,B hi(rϕ ),B hi(rψ )); 3. If r ϕ is an x i -node, but r ψ is a terminal node or an x j -node with j > i (i.e., ψ[0/x i ] ψ[1/x i ] ψ), then reate an x i -node with dashed line to Apply(op,B lo(rϕ ),B ψ ) and solid line to Apply(op,B hi(rϕ ),B ψ ); 4. If r ψ is an x i -node, but r ϕ is a terminal node or an x j -node with j > i, is handled as above.

Alessandro Artale (FM First Semester 2009/2010) p. 31/38 OBBD Inremental Building: An Example ϕ = (A 1 A 2 ) (A 1 A 2 ) ( A 1 A 2 ) ( A 1 A 2 ) (A1 v A2) (A1 v A2) ( A1 v A2) ( A2 v A2) A1 A1 A1 A1 A2 A2 A2 A2 T F T F T F T F (A1 v A2) ^ (A1 v A2) ( A1 v A2) ^ ( A1 v A2) A1 A1 T F T F (A1 v A2) ^ (A1 v A2) ( A1 v A2) ^ ( A1 v A2) ^ F

Alessandro Artale (FM First Semester 2009/2010) p. 32/38 Boolean Quantifiation Quantifying over boolean variables is a ruial operation to ompute Preimages (i.e., the next-time operator). If x is a boolean variable, then x.ϕ ϕ[0/x] ϕ[1/x] x.ϕ ϕ[0/x] ϕ[1/x] Let W = {w 1,...,w n ). Multi-variable quantifiation: W.ϕ (w 1,...,w n ).ϕ w 1... w n.ϕ

Alessandro Artale (FM First Semester 2009/2010) p. 33/38 The RESTRICT Algorithm To ompute the OBDD for x.ϕ we need to ompute the OBDD for both ϕ[0/x] and ϕ[1/x]. B ϕ[0/x] = RESTRICT(0,x,B ϕ ). For eah node n labeled with x, then: 1. Inoming edges are redireted to lo(n); 2. n is removed. B ϕ[1/x] = RESTRICT(1,x,B ϕ ). As above, only rediret inoming edges to hi(n).

Alessandro Artale (FM First Semester 2009/2010) p. 34/38 Boolean Quantifiation (Cont.) B x.ϕ = APPLY(, RESTRICT(0,x,B ϕ ), RESTRICT(1,x,B ϕ )) x 1 x 1 x 1 y 1 y 1 y 1 x 2 x 2 x 2 y 2 y 2 y 2 x 3 y 3 y 3 0 1 0 1 0 1 B ϕ RESTRICT(0,x 3,B ϕ ) RESTRICT(1,x 3,B ϕ )

Alessandro Artale (FM First Semester 2009/2010) p. 35/38 Boolean Quantifiation (Cont.) B x.ϕ = APPLY(, RESTRICT(0,x,B ϕ ), RESTRICT(1,x,B ϕ )) x 1 x 1 x 1 y 1 y 1 y 1 x 2 x 2 x 2 y 2 y 2 y 2 y 3 y 3 0 1 0 1 0 1 RESTRICT(0,x 3,B ϕ ) RESTRICT(1,x 3,B ϕ ) x 3.B ϕ

Alessandro Artale (FM First Semester 2009/2010) p. 36/38 Time Complexity Algorithm Time-Complexity REDUCE(B) O( B log B ) APPLY(op,B ϕ,b ψ ) O( B ϕ B ψ ) N.B. The above omplexity results depend from the size of the input OBDD s: The size of OBDD s may grow exponentially wrt. the number of variables in worst-ase. Example: there exist no polynomial-size OBDD representing the eletroni iruit of a bitwise multiplier.

Alessandro Artale (FM First Semester 2009/2010) p. 37/38 OBDD Summary Require setting a variable ordering a priori (ritial!) Normal representation of a boolean formula. One built, logial operations (satisfiability, validity, equivalene) immediate. Represents all models and ounter-models of the formula. Require exponential spae in worst-ase.

Alessandro Artale (FM First Semester 2009/2010) p. 38/38 Summary of Leture VI Motivations. Ordered Binary Deision Diagrams (OBDD). OBDD s as Canonial Forms. Building OBDD s.