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

Slides:



Advertisements
Similar presentations
Model Checking Lecture 3. Specification Automata Syntax, given a set A of atomic observations: Sfinite set of states S 0 Sset of initial states S S transition.
Advertisements

Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
Model Checking Lecture 2. Three important decisions when choosing system properties: 1automata vs. logic 2branching vs. linear time 3safety vs. liveness.
Representing Boolean Functions for Symbolic Model Checking Supratik Chakraborty IIT Bombay.
Semantics Static semantics Dynamic semantics attribute grammars
BDDs & Theorem Proving Binary Decision Diagrams Dr. Eng. Amr T. Abdel-Hamid NETW 703 Winter 2012 Network Protocols Lectures are based on slides by: K.
Planning based on Model Checking Dept. of Information Systems and Applied CS Bamberg University Seminar Paper Svetlana Balinova.
Automatic Verification Book: Chapter 6. What is verification? Traditionally, verification means proof of correctness automatic: model checking deductive:
ECE Synthesis & Verification - L271 ECE 697B (667) Spring 2006 Synthesis and Verification of Digital Systems Model Checking basics.
CS357 Lecture: BDD basics David Dill 1. 2 BDDs (Boolean/binary decision diagrams) BDDs are a very successful representation for Boolean functions. A BDD.
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 11.
Bebop: A Symbolic Model Checker for Boolean Programs Thomas Ball Sriram K. Rajamani
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.
Review of topics Final exam : -May 2nd to May 7 th - Projects due on May 7th.
SAT and Model Checking. Bounded Model Checking (BMC) A.I. Planning problems: can we reach a desired state in k steps? Verification of safety properties:
1 Don´t Care Minimization of *BMDs: Complexity and Algorithms Christoph Scholl Marc Herbstritt Bernd Becker Institute of Computer Science Albert-Ludwigs-University.
© 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.
Spring 07, Feb 13 ELEC 7770: Advanced VLSI Design (Agrawal) 1 ELEC 7770 Advanced VLSI Design Spring 2007 Binary Decision Diagrams Vishwani D. Agrawal James.
DATE-2002TED1 Taylor Expansion Diagrams: A Compact Canonical Representation for Symbolic Verification M. Ciesielski, P. Kalla, Z. Zeng B. Rouzeyre Electrical.
Model Checking Lecture 4. Outline 1 Specifications: logic vs. automata, linear vs. branching, safety vs. liveness 2 Graph algorithms for model checking.
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
1 CSEP590 – Model Checking and Automated Verification Lecture outline for July 16, 2003.
Symbolic Boolean Manipulation with Ordered Binary Decision Diagrams Carnegie Mellon University Randal E. Bryant.
Taylor Expansion Diagrams (TED): Verification EC667: Synthesis and Verification of Digital Systems Spring 2011 Presented by: Sudhan.
Decision Structures Truth TableDecision Tree –Vertex represents decision –Follow green (dashed) line for value 0 –Follow red (solid) line for value 1 –Function.
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)
IT University of Copenhagen Lecture 8: Binary Decision Diagrams 1. Classical Boolean expression representations 2. If-then-else Normal Form (INF) 3. Binary.
Lazy Abstraction Tom Henzinger Ranjit Jhala Rupak Majumdar Grégoire Sutre.
Binary Decision Diagrams for First Order Predicate Logic By: Jan Friso Groote Afsaneh Shirazi.
Propositional Calculus CS 680: Formal Methods in Verification Computer Systems Jeremy Johnson.
Digitaalsüsteemide verifitseerimise kursus1 Formal verification: BDD BDDs applied in equivalence checking.
Athens 2004 Symposium on Innovation of Computer Science Curriculum in Higher Education Athens 2004 Decision Diagrams: Principles of Programming Dragan.
1 Introduction to SMV and Model Checking Mostly by: Ken McMillan Cadence Berkeley Labs Small parts by: Brandon Eames ISIS/Vanderbilt.
B. Alizadeh Advanced Logic Design (2008) 1 / 55 Decision Diagrams.
Identifying Reversible Functions From an ROBDD Adam MacDonald.
Binary Decision Diagrams (BDDs)
Model Checking Lecture 4 Tom Henzinger. Model-Checking Problem I |= S System modelSystem property.
CS 267: Automated Verification Lecture 6: Binary Decision Diagrams Instructor: Tevfik Bultan.
CS 363 Comparative Programming Languages Semantics.
Algorithmic Software Verification V &VI. Binary decision diagrams.
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View BDDs.
Propositional Calculus CS 270: Mathematical Foundations of Computer Science Jeremy Johnson.
Four Lectures on Model Checking Tom Henzinger University of California, Berkeley.
On the Relation between SAT and BDDs for Equivalence Checking Sherief Reda Rolf Drechsler Alex Orailoglu Computer Science & Engineering Dept. University.
CS6133 Software Specification and Verification
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View BDDs.
1 Verification of FSM Equivalence Goal: Verify that two sequential circuit implementations always produce the same sequence of outputs given the same sequence.
Verification & Validation By: Amir Masoud Gharehbaghi
Verifying Programs with BDDs Topics Representing Boolean functions with Binary Decision Diagrams Application to program verification class-bdd.ppt
1 CSEP590 – Model Checking and Automated Verification Lecture outline for July 9, 2003.
BDDs1 Binary Tree Representation The recursive Shannon expansion corresponds to a binary tree Example: Each path from the root to a leaf corresponds to.
CS357 Lecture 13: Symbolic model checking without BDDs Alex Aiken David Dill 1.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Binary Decision Diagrams Prof. Shobha Vasudevan ECE, UIUC ECE 462.
How CTL model checking works
Propositional Calculus: Boolean Functions and Expressions
ECE 667 Synthesis and Verification of Digital Systems
Binary Decision Diagrams
Automatic Verification of Industrial Designs
Formal Methods in software development
CSCI1600: Embedded and Real Time Software
Binary Decision Diagrams
Binary Decision Diagrams
Formal Methods in software development
Verifying Programs with BDDs Sept. 22, 2006
Switching Lemmas and Proof Complexity
Presentation transcript:

Model Checking Lecture 4

Outline 1 Specifications: logic vs. automata, linear vs. branching, safety vs. liveness 2 Graph algorithms for model checking 3Symbolic algorithms for model checking 4Pushdown systems

Model-checking problem I |= S system model: state-transition graph system property: -safety v. weak v. strong fairness -logic v. spec v. monitor automata -linear v. branching

Model-Checking Algorithms = Graph Algorithms

Graph Algorithms Given: labeled graph (Q,, A, [ ] ) Cost: each node access and edge access has unit cost Complexity: in terms of |Q| = n...number of nodes | | = m... number of edges Reachability and s.c.c.s: O(m+n)

The Graph-Algorithmic View is Problematic -The graph is given implicitly (by a program) not explicitly (e.g., by adjacency lists). -Building an explicit graph representation is exponential, but usually unnecessary (on-the-fly algorithms). -The explicit graph representation may be so big, that the unit-cost model is not realistic. -A class of algorithms, called symbolic algorithms, do not operate on nodes and edges at all.

Symbolic Model-Checking Algorithms Given: a symbolic theory, that is, an abstract data type called region with the following operations: pre, pre, post, post : region region,, \ : region region region, = : region region bool, > < : A region, Q : region

Intended Meaning of Symbolic Theories region...set of states,, \,, =,...set operations = { q Q | [q] = a } >a< = { q Q | [q] a } pre (R) = { q Q | ( r R) q r } pre (R) = { q Q | ( r)( q r r R )} post (R) = { q Q | ( r R) r q } post (R) = { q Q | ( r)( r q r R )}

If the state of a system is given by variables of type Vals, and the transitions of the system can be described by operations Ops on Vals, then the first-order theory FO (Vals, Ops) is an adequate symbolic theory: region...formula of FO (Vals, Ops),, \,, =,, Q...,,,,, f, t pre (R(X)) = ( X)( Trans(X,X) R(X) ) post (R(X)) = ( X)( R(X) Trans(X,X) ) post (R(X)) = ( X)( Trans(X,X) R(X) )

If FO (Vals, Ops) admits quantifier elimination, then the propositional theory ZO (Vals, Ops) is an adequate symbolic theory: each pre/post operation is a quantifier elimination

Example: Boolean Systems -all system variables X are boolean -region: quantifier-free boolean formula over X -pre, post: boolean quantifier elimination Complexity: PSPACE

Example: Presburger Systems -all system variables X are integers -the transition relation Trans(X,X) is defined using only and -region: quantifier-free formula of (Z,, ) -pre, post: quantifier elimination

An iterative language for writing symbolic model-checking algorithms -only data type is region -expressions: pre, post,,, \,, =,,, Q -assignment, sequencing, while-do, if-then-else

Example: Reachability a S := R := while R S do S := S R R := pre(R)

A recursive language for writing symbolic model-checking algorithms: The Mu-Calculus a = ( R) (a pre(R))

Syntax of the Mu-Calculus ::= a | a | | | pre( ) | pre( ) | ( R) | ( R) | R pre = R... region variable

Semantics of the Mu-Calculus [[ a ]] E := [[ a ]] E := >a< [[ ]] E := [[ ]] E [[ ]] E [[ pre( ) ]] E := pre( [[ ]] E ) E maps each region variable to a region.

Operational Semantics of the Mu-Calculus [[ ( R) ]] E := S := ; repeat S := S; S := [[ ]] E(R S) until S=S; return S [[ ( R) ]] E := S := Q; repeat S := S; S := [[ ]] E(R S) until S=S; return S

Denotational Semantics of the Mu-Calculus [[ ( R) ]] E := smallest region S such that S = [[ ]] E(R S) [[ ( R) ]] E := largest region S such that S = [[ ]] E(R S) These regions are unique because all operators on regions (,, pre, pre) are monotonic.

a = ( R) (a pre(R)) b U a = ( R) (a (b pre(R))) a = ( R) (a pre(R)) = ( R) ( S) ((a pre(R)) pre(S))

-every / alternation adds expressiveness -all omega-regular languages in alternation depth 2 -model checking complexity: O( (| | (m+n)) d ) for formulas of alternation depth d -most common implementation (SMV, Mocha): use BDDs to represent boolean regions

Binary Decision Diagrams -canonical data structure for representing quantifier- free boolean formulas -equivalence checking in constant time -in practice, model checkers spend more than 90% of their time in pre-image or post-image computation -almost synonymous with symbolic model checking -SAT solvers superior in bounded model checking, which requires no termination (i.e., equivalence) check

Binary Decision Tree -order k boolean variables x 1,..., x k -binary tree of height k+1, each leaf labeled 0 or 1 -leaf of path left, right, right,... gives value of boolean formula if x 1 =0, x 2 =1, x 3 =1, etc.

Truth TableDecision Tree –Vertex represents decision –Follow green (dashed) line for value 0 –Follow red (solid) line for value 1 –Function value determined by leaf value –Along each path, variables occur in the variable order –Along each path, a variable occurs exactly once

(Reduced Ordered) Binary Decision Diagram 1Identify isomorphic subtrees (this gives a dag) 2Eliminate nodes with identical left and right successors 3Eliminate redundant tests For a given boolean formula and variable order, the result is unique. (The choice of variable order may make an exponential difference!)

Merge equivalent leaves aa a Reduction rule #1

y x z x Merge isomorphic nodes y x z x y x z x Reduction rule #2

Eliminate redundant tests y x y Reduction rule #3

Initial graphReduced graph Canonical representation of Boolean function For given variable ordering, two functions equivalent if and only if their graphs are isomorphic Test in linear time (x 1 x 2 ) x 3

Constants Unique unsatisfiable function Unique tautology Variable Treat variable as function Odd parity Linear representation Typical function (x 1 x 2 ) x 4 No vertex labeled x 3 independent of x 3 Many subgraphs shared Examples

Good orderingBad ordering Linear growthExponential growth Effect of variable ordering (a 1 b 1 ) (a 2 b 2 ) (a 3 b 3 )

Bit-serial computer analogy Operation –Read inputs in sequence; produce 0 or 1 as function value. –Store information about previous inputs to correctly deduce function value from remaining inputs. Relation to BDD Size –Processor requires K bits of memory at step i. –BDD has ~2 K branches crossing level i.

K = 2K = n (a 1 b 1 ) (a 2 b 2 ) (a 3 b 3 ) Good orderingBad ordering

Dynamic variable reordering Invented by Richard Rudell, Synopsys Periodically attempt to improve ordering for all BDDs –Part of garbage collection –Move each variable through ordering to find its best location Has proved very successful

Lower bound for multiplication (Bryant 1991) Integer multiplier circuit –n-bit input words A and B –2n-bit output word P Boolean function –Middle bit (n-1) of product Complexity –Exponential BDD for all possible variable orderings Mult n a0a0 a n-1 b0b0 b n-1 p0p0 p n-1 pnpn p 2n-1 Actual Numbers 40,563,945 BDD nodes to represent all outputs of 16-bit multiplier Grows 2.86x per bit of word size Intractable Function

BDD operations,,,, x n ab n.var = x n.false = a n.true = b BDD node - BDD manager maintains a directed acyclic graph of BDD nodes - ite(x,a,b) returns a node with variable x, left child a, and right child b.

if (a = false b = false) return false if (a = true) return b if (b = true) return a if (a = b) return a if (a.var < b.var) return ite(a.var, and(a.false,b), and(a.true,b)) if (b.var < a.var) return ite(b.var, and(a,b.false), and(a,b.true)) // a.var = b.var return ite(a.var, and(a.false,b.false), and(a.true,b.true)) and(a,b) Complexity: O(|a| |b|)

not(a) if (a = true) return false if (a = false) return true return ite(a.var, not(a.false), not(a.true)) Complexity: O(|a|)

cofactor(a,x,p) if (x < a.var) return a if (x > a.var) return ite(a.var, cofactor(a.false,x,p), cofactor(a.true,x,p)) // x = a.var if (p) return a.true else return a.false Complexity: O(|a|)

Operations returning BDD: or(a,b) not(and(not(a),not(b))) exists(a,x) or(cofactor(a,x,false), cofactor(a,x,true)) forall(a,x) and(cofactor(a,x,false), cofactor(a,x,true)) Derived operations Operations returning boolean: implies(a,b) (or(not(a),b) = true) iff(a,b) (a = b)

substitute(a,x,y) Assumptions - a is independent of y - x and y are adjacent in variable order if (a = true a = false) return a if (a.var > x) return a if (a.var < x) return ite(a.var, substitute(a.false,x,y), substitute(a.true,x,y)) if (a.var = x) return ite(y,a.false,a.true)

Symbolic reachability analysis with BDDs Vector of state variables: X = (x 1,…,x n ) Init predicate: I[X] Transition relation: T[X,X] Error predicate: E[X] R[X] = I[X] do { S[X] = R[X] R[X] = exists(and(S[X],T[X,X]), X) R[X] = substitute(R[X],X,X) R[X] = or(R[X],S[X]) } while (R S) Invariant: For each i, x i and x i are adjacent in variable order