Model Checking Lecture 1. Model checking, narrowly interpreted: Decision procedures for checking if a given Kripke structure is a model for a given formula.

Slides:



Advertisements
Similar presentations
1 Verification by Model Checking. 2 Part 1 : Motivation.
Advertisements

The Quest for Correctness Joseph Sifakis VERIMAG Laboratory 2nd Sogeti Testing Academy April 29th 2009.
Model Checking Lecture 1.
Model Checking Lecture 2. Three important decisions when choosing system properties: 1automata vs. logic 2branching vs. linear time 3safety vs. liveness.
Modeling issues Book: chapters 4.12, 5.4, 8.4, 10.1.
M ODEL CHECKING -Vasvi Kakkad University of Sydney.
Algorithmic Software Verification VII. Computation tree logic and bisimulations.
CS 267: Automated Verification Lecture 8: Automata Theoretic Model Checking Instructor: Tevfik Bultan.
Part 3: Safety and liveness
1 Model checking. 2 And now... the system How do we model a reactive system with an automaton ? It is convenient to model systems with Transition systems.
An Introduction to the Model Verifier verds Wenhui Zhang September 15 th, 2010.
ECE Synthesis & Verification - L271 ECE 697B (667) Spring 2006 Synthesis and Verification of Digital Systems Model Checking basics.
Program correctness The State-transition model A global state S  s 0 x s 1 x … x s m {s k = local state of process k} S0  S1  S2  … Each state transition.
Model Checking I What are LTL and CTL?. and or dreq q0 dack q0bar.
Timed Automata.
Model Checking basic concepts and techniques Sriram K. Rajamani.
卜磊 Transition System. Part I: Introduction  Chapter 0: Preliminaries  Chapter 1: Language and Computation Part II: Models  Chapter.
Model Checking I What are LTL and CTL?. and or dreq q0 dack q0bar D D.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Review of topics Final exam : -May 2nd to May 7 th - Projects due on May 7th.
Model Checking. Used in studying behaviors of reactive systems Typically involves three steps: Create a finite state model (FSM) of the system design.
Lecture 4&5: Model Checking: A quick introduction Professor Aditya Ghose Director, Decision Systems Lab School of IT and Computer Science University of.
Modeling Software Systems Lecture 2 Book: Chapter 4.
Specification Formalisms Book: Chapter 5. Properties of formalisms Formal. Unique interpretation. Intuitive. Simple to understand (visual). Succinct.
Review of the automata-theoretic approach to model-checking.
ESE601: Hybrid Systems Introduction to verification Spring 2006.
1 Formal Engineering of Reliable Software LASER 2004 school Tutorial, Lecture1 Natasha Sharygina Carnegie Mellon University.
Abstract Verification is traditionally done by determining the truth of a temporal formula (the specification) with respect to a timed transition system.
Cheng/Dillon-Software Engineering: Formal Methods Model Checking.
Regular Model Checking Ahmed Bouajjani,Benget Jonsson, Marcus Nillson and Tayssir Touili Moran Ben Tulila
Linear and Branching Time Safety, Liveness, and Fairness
1 Introduction to SMV and Model Checking Mostly by: Ken McMillan Cadence Berkeley Labs Small parts by: Brandon Eames ISIS/Vanderbilt.
Representing distributed algorithms Why do we need these? Don’t we already know a lot about programming? Well, you need to capture the notions of atomicity,
Model Checking Lecture 4 Tom Henzinger. Model-Checking Problem I |= S System modelSystem property.
Benjamin Gamble. What is Time?  Can mean many different things to a computer Dynamic Equation Variable System State 2.
Model Checking Lecture 3 Tom Henzinger. Model-Checking Problem I |= S System modelSystem property.
CIS 842: Specification and Verification of Reactive Systems Lecture Specifications: Sequencing Properties Copyright , Matt Dwyer, John Hatcliff,
CS6133 Software Specification and Verification
Specifying and Verifying Event-based Fairness Enhanced Systems 1 ICFEM 2008 Specifying and Verifying Event-based Fairness Enhanced Systems Jun SUN, Yang.
Sept COMP60611 Fundamentals of Parallel and Distributed Systems Lecture 15 More Advanced Program Properties: Temporal logic and jSpin John Gurd,
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
6.852: Distributed Algorithms Spring, 2008 Class 13.
Lectures on Model Checking Stolen from lectures of Tom Henzinger - EE219C (CS294)
卜磊 Transition System. Definitions and notations Reactive System The intuition is that a transition system consists of a set of possible.
Program correctness The State-transition model The set of global states = so x s1 x … x sm {sk is the set of local states of process k} S0 ---> S1 --->
Program correctness The State-transition model A global states S  s 0 x s 1 x … x s m {s k = set of local states of process k} S0  S1  S2  Each state.
Hwajung Lee. The State-transition model The set of global states = s 0 x s 1 x … x s m {s k is the set of local states of process k} S0  S1  S2  Each.
CIS 842: Specification and Verification of Reactive Systems Lecture INTRO-Examples: Simple BIR-Lite Examples Copyright 2004, Matt Dwyer, John Hatcliff,
Lecture 5 1 CSP tools for verification of Sec Prot Overview of the lecture The Casper interface Refinement checking and FDR Model checking Theorem proving.
Hwajung Lee. The State-transition model The set of global states = s 0 x s 1 x … x s m {s k is the set of local states of process k} S0  S1  S2  Each.
Verification & Validation By: Amir Masoud Gharehbaghi
VIS Technology Transfer Course Session 7 Fairness Constraints and Monitors Serdar Tasiran.
1 CSEP590 – Model Checking and Automated Verification Lecture outline for July 9, 2003.
1 Temporal logic. 2 Prop. logic: model and reason about static situations. Example: Are there truth values that can be assigned to x,y simultaneously.
Program Correctness. The designer of a distributed system has the responsibility of certifying the correctness of the system before users start using.
Software Systems Verification and Validation Laboratory Assignment 4 Model checking Assignment date: Lab 4 Delivery date: Lab 4, 5.
Model Checking Lecture 1: Specification Tom Henzinger.
Introduction to distributed systems description relation to practice variables and communication primitives instructions states, actions and programs synchrony.
Model Checking Lecture 2. Model-Checking Problem I |= S System modelSystem property.
CS5270 Lecture 41 Timed Automata I CS 5270 Lecture 4.
Model Checking Lecture 2 Tom Henzinger. Model-Checking Problem I |= S System modelSystem property.
Four Lectures on Model Checking Tom Henzinger University of California, Berkeley.
Program Synthesis is a Game
Atomicity, Non-determinism, Fairness
ITEC452 Distributed Computing Lecture 5 Program Correctness
CSEP590 – Model Checking and Automated Verification
Computer Aided Verification 計算機輔助驗證 Model Checking (Part I) 模型檢驗 (一)
Introduction to verification
COMP60621 Designing for Parallelism
Presentation transcript:

Model Checking Lecture 1

Model checking, narrowly interpreted: Decision procedures for checking if a given Kripke structure is a model for a given formula of a modal logic.

Why is this of interest to us? Because the dynamics of a discrete system can be captured by a Kripke structure. Because some dynamic properties of a discrete system can be stated in modal logics.  Model checking = System verification

Model checking, generously interpreted: Algorithms for system verification which operate on a system model (semantics) rather than a system description (syntax).

There are many different model-checking problems: for different (classes of) system models for different (classes of) system properties

A specific model-checking problem is defined by I |= S “implementation” (system model) “specification” (system property) “satisfies”, “implements”, “refines” (satisfaction relation)

A specific model-checking problem is defined by I |= S “implementation” (system model) “specification” (system property) “satisfies”, “implements”, “refines” (satisfaction relation) more detailedmore abstract

Characteristics of system models which favor model checking over other verification techniques ongoing input/output behavior (not: single input, single result) concurrency (not: single control flow) control intensive (not: lots of data manipulation)

Examples -control logic of hardware designs -communication protocols -device drivers !

Paradigmatic example: mutual-exclusion protocol loop out: x1 := 1; last := 1 req: await x2 = 0 or last = 2 in: x1 := 0 end loop. loop out: x2 := 1; last := 2 req: await x1 = 0 or last = 1 in: x2 := 0 end loop. || P1 P2

Model-checking problem I |= S system modelsystem property satisfaction relation

Model-checking problem I |= S system modelsystem property satisfaction relation

Important decisions when choosing a system model -variable-based vs. event-based -interleaving vs. true concurrency -synchronous vs. asynchronous interaction -clocked vs. speed-independent progress -etc.

Particular combinations of choices yield CSP Petri nets I/O automata Reactive modules etc.

While the choice of system model is important for ease of modeling in a given situation, the only thing that is important for model checking is that the system model can be translated into some form of state-transition graph.

a a,bb q1 q3q2

State-transition graph Q set of states{q1,q2,q3} A set of observations{a,b}   Q  Q transition relation q1  q2 [ ]: Q  2 A observation function [q1] = {a}

The translation from a system description to a state-transition graph usually involves an exponential blow-up !!! e.g., n boolean variables  2 n states This is called the “state-explosion problem.”

State-transition graphs are not necessarily finite-state, but they don’t handle well: -recursion (need push-down models) -environment interaction (need game models) -process creation We will talk about some of these issues briefly in a later lecture.

Model-checking problem I |= S system modelsystem property satisfaction relation

Three important decisions when choosing system properties 1operational vs. declarative: automata vs. logic 2may vs. must: branching vs. linear time 3prohibiting bad vs. desiring good behavior: safety vs. liveness

Three important decisions when choosing system properties 1operational vs. declarative: automata vs. logic 2may vs. must: branching vs. linear time 3prohibiting bad vs. desiring good behavior: safety vs. liveness The three decisions are orthogonal, and they lead to substantially different model-checking problems.

Three important decisions when choosing system properties 1operational vs. declarative: automata vs. logic 2may vs. must: branching vs. linear time 3prohibiting bad vs. desiring good behavior: safety vs. liveness The three decisions are orthogonal, and they lead to substantially different model-checking problems.

Safety vs. liveness Safety: something “bad” will never happen Liveness: something “good” will happen (but we don’t know when)

Safety vs. liveness for sequential programs Safety: the program will never produce a wrong result (“partial correctness”) Liveness: the program will produce a result (“termination”)

Safety vs. liveness for sequential programs Safety: the program will never produce a wrong result (“partial correctness”) Liveness: the program will produce a result (“termination”) induction on control flow well-founded induction on data

Safety vs. liveness for state-transition graphs Safety: those properties whose violation always has a finite witness (“if something bad happens on an infinite run, then it happens already on some finite prefix”) Liveness: those properties whose violation never has a finite witness (“no matter what happens along a finite run, something good could still happen later”)

a a,bb q1 q3q2 Run: q1  q3  q1  q3  q1  q2  q2  Trace: a  b  a  b  a  a,b  a,b 

State-transition graph S = ( Q, A, , [] ) Finite runs:finRuns(S)  Q * Infinite runs: infRuns(S)  Q  Finite traces:finTraces(S)  (2 A ) * Infinite traces: infTraces(S)  (2 A ) 

Safety: the properties that can be checked on finRuns Liveness: the properties that cannot be checked on finRuns

Safety: the properties that can be checked on finRuns Liveness: the properties that cannot be checked on finRuns (they need to be checked on infRuns) This is much easier.

Example: Mutual exclusion It cannot happen that both processes are in their critical sections simultaneously.

Example: Mutual exclusion It cannot happen that both processes are in their critical sections simultaneously. Safety

Example: Bounded overtaking Whenever process P1 wants to enter the critical section, then process P2 gets to enter at most once before process P1 gets to enter.

Example: Bounded overtaking Whenever process P1 wants to enter the critical section, then process P2 gets to enter at most once before process P1 gets to enter. Safety

Example: Starvation freedom Whenever process P1 wants to enter the critical section, provided process P2 never stays in the critical section forever, P1 gets to enter eventually.

Example: Starvation freedom Whenever process P1 wants to enter the critical section, provided process P2 never stays in the critical section forever, P1 gets to enter eventually. Liveness

a a,bb q1 q3q2 infRuns  finRuns

a a,bb q1 q3q2 infRuns  finRuns  closure

Example: Starvation freedom Whenever process P1 wants to enter the critical section, provided process P2 never stays in the critical section forever, P1 gets to enter eventually. Liveness

a a,bb q1 q3q2 Fairness constraint: the green transition cannot be ignored forever

a a,bb q1 q3q2 Without fairness: infRuns = q1 (q3 q1) * (q2)   (q1 q3)  With fairness: infRuns = q1 (q3 q1) * (q2) 

Two important types of fairness 1 Weak (Buchi) fairness: a specified set of transitions cannot be enabled forever without being taken 2 Strong (Streett) fairness: a specified set of transitions cannot be enabled infinitely often without being taken

a a,bb q1 q3q2 Strong fairness

a a,b q1 q2 Weak fairness

Weak fairness is sufficient for asynchronous models (“no process waits forever if it can move”). Strong fairness is necessary for modeling synchronous interaction (rendezvous). Strong fairness is makes model checking more difficult.

Fair state-transition graph S = ( Q, A, , [], WF, SF) WF set of weakly fair actions SF set of strongly fair actions where each action is a subset of 

Fairness changes only infRuns, not finRuns.  Fairness can be ignored for checking safety properties.

Three important decisions when choosing system properties 1operational vs. declarative: automata vs. logic 2may vs. must: branching vs. linear time 3prohibiting bad vs. desiring good behavior: safety vs. liveness The three decisions are orthogonal, and they lead to substantially different model-checking problems.

Branching vs. linear time Branching time: something may (or may not) happen (e.g., every req may be followed by grant) Linear time: something must (or must not) happen (e.g., every req must be followed by grant)

One is rarely interested in may properties, but certain may properties are easy to model check, and they imply interesting must properties. (This is because unlike must properties, which refer only to observations, may properties can refer to states.)

Fair state-transition graph S = ( Q, A, , [], WF, SF ) Finite runs:finRuns(S)  Q * Infinite runs: infRuns(S)  Q  Finite traces:finTraces(S)  (2 A ) * Infinite traces: infTraces(S)  (2 A ) 

Linear time: the properties that can be checked on infTraces Branching time: the properties that cannot be checked on infTraces

LinearBranching Safety finTracesfinRuns LivenessinfTracesinfRuns

a a aa a bbcc Same traces, different runs

Linear time is conceptually simpler than branching time (words vs. trees). Branching time is often computationally more efficient. (Because branching-time algorithms can work with given states, whereas linear-time algorithms often need to “guess” sets of possible states.)

Three important decisions when choosing system properties 1operational vs. declarative: automata vs. logic 2may vs. must: branching vs. linear time 3prohibiting bad vs. desiring good behavior: safety vs. liveness The three decisions are orthogonal, and they lead to substantially different model-checking problems.

LinearBranching Safety SafeTL LivenessLTL CTL Logics

Automata Safety:finite automata Liveness:omega automata Linear:language containment Branching:simulation

Automata Safety:finite automata Liveness:omega automata Linear:language containment for word automata Branching:language containment for tree automata