Program correctness Transition systems

Slides:



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

Global States.
Distributed Snapshots: Determining Global States of Distributed Systems Joshua Eberhardt Research Paper: Kanianthra Mani Chandy and Leslie Lamport.
Distributed Computing 5. Snapshot Shmuel Zaks ©
CS 267: Automated Verification Lecture 8: Automata Theoretic Model Checking Instructor: Tevfik Bultan.
Automatic Verification Book: Chapter 6. What is verification? Traditionally, verification means proof of correctness automatic: model checking deductive:
PROTOCOL VERIFICATION & PROTOCOL VALIDATION. Protocol Verification Communication Protocols should be checked for correctness, robustness and performance,
Temporal Logic and the NuSMV Model Checker CS 680 Formal Methods Jeremy Johnson.
CS6133 Software Specification and Verification
Uncoordinated Checkpointing The Global State Recording Algorithm Cristian Solano.
The Assembly Language Level
Formal verification in SPIN Karthikeyan Bhargavan, Davor Obradovic CIS573, Fall 1999.
Distributed Computing 5. Snapshot Shmuel Zaks ©
Ordering and Consistent Cuts Presented By Biswanath Panda.
Slide 10B.1 Copyright © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. An Introduction to Object-Oriented Systems Analysis and Design with.
Lecture 4&5: Model Checking: A quick introduction Professor Aditya Ghose Director, Decision Systems Lab School of IT and Computer Science University of.
Concurrency CS 510: Programming Languages David Walker.
Software Engineering, COMP201 Slide 1 Protocol Engineering Protocol Specification using CFSM model Lecture 30.
Chapter 17 Theoretical Issues in Distributed Systems
Timed UML State Machines Ognyana Hristova Tutor: Priv.-Doz. Dr. Thomas Noll June, 2007.
Distributed Computing 5. Snapshot Shmuel Zaks ©
Verifiable Programming Reason about imperative sequential programs such as Java programs Imperative program –defines state space defined by collection.
Benjamin Gamble. What is Time?  Can mean many different things to a computer Dynamic Equation Variable System State 2.
Tufts Wireless Laboratory School Of Engineering Tufts University “Verifying Noninterference in a Cyber-Physical System – The Advanced Electric Power Grid”
CS6133 Software Specification and Verification
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Communicating Real-Time State Machines (CRSM) State machines that communicate synchronously Unique unidirectional channels are used for the communication.
13-1 Chapter 13 Concurrency Topics Introduction Introduction to Subprogram-Level Concurrency Semaphores Monitors Message Passing Java Threads C# Threads.
Lecture 4 Introduction to Promela. Promela and Spin Promela - process meta language G. Holzmann, Bell Labs (Lucent) C-like language + concurrency dyamic.
Fault tolerance and related issues in distributed computing Shmuel Zaks GSSI - Feb
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Ordering of Events in Distributed Systems UNIVERSITY of WISCONSIN-MADISON Computer Sciences Department CS 739 Distributed Systems Andrea C. Arpaci-Dusseau.
Software Systems Verification and Validation Laboratory Assignment 4 Model checking Assignment date: Lab 4 Delivery date: Lab 4, 5.
Introduction to distributed systems description relation to practice variables and communication primitives instructions states, actions and programs synchrony.
Fundamentals of Fault-Tolerant Distributed Computing In Asynchronous Environments Paper by Felix C. Gartner Graeme Coakley COEN 317 November 23, 2003.
Communicating Timed Automata Pavel Krčál Wang Yi Uppsala University [CAV’06]
Complexity of Compositional Model Checking of Computation Tree Logic on Simple Structures Krishnendu Chatterjee Pallab Dasgupta P.P. Chakrabarti IWDC 2004,
Ordering of Events in Distributed Systems UNIVERSITY of WISCONSIN-MADISON Computer Sciences Department CS 739 Distributed Systems Andrea C. Arpaci-Dusseau.
UPPAAL Real-Time Systems Lab. Seolyoung, Jeong.
Global state and snapshot
Basic concepts of Model Checking
Formal methods: Lecture
LPV: a new technique, based on linear programming, to formally prove or disprove safety properties J-L Lambert, valiosys.
CPE555A: Real-Time Embedded Systems
PROTOCOL CORRECTNESS Tutorial 3 Theoretical
CIS 842: Specification and Verification of Reactive Systems
Formal verification in SPIN
Timed Automata II CS 5270 Lecture Lecture5.
Global state and snapshot
Automatic Verification
Choreographies: the idea
Analysis of Communication Models in Web Service Compositions Marco Pistore University of Trento Joint work with Raman Kazhamiakin.
Monitors Chapter 7.
COT 5611 Operating Systems Design Principles Spring 2012
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
Model Checking for an Executable Subset of UML
Java Programming Loops
Parallel execution Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
Monitors Chapter 7.
Concurrency: Mutual Exclusion and Process Synchronization
Monitors Chapter 7.
Abstraction.
Design Yaodong Bi.
Chapter 22 Object-Oriented Systems Analysis and Design and UML
Program correctness Linear Time Temporal Logic
Program correctness Model-checking CTL
Lecture 5 Scanning.
CIS825 Lecture 5 1.
COT 5611 Operating Systems Design Principles Spring 2014
Software Testing and QA Theory and Practice (Chapter 5: Data Flow Testing) © Naik & Tripathy 1 Software Testing and Quality Assurance Theory and Practice.
Presentation transcript:

Program correctness Transition systems Spring 2007 Program correctness Transition systems  Marcello Bonsangue

Formal Verification Verification techniques comprise a modelling framework M,  to describe a system a specification language  to describe the properties to be verified a verification method M ,    to establish whether a model satisfies a property Slide 2

Transition Systems A very general modelling framework Intuitively: a system evolves from one state to another under the action of a transition inc - - 1 dec dec dec inc inc 2 - A modulo 3 counter Slide 3

Example: an assignment States: s:Var -> Val x := x+1 s s’ where s’=s[s(x)+1/x] and { f(y) if x  y f[v/x](y) = v if x = y Slide 4

Example: a digicode 3 keys: A, B, C The door open when ABA is keyed 1 2 3 4 C B,C Slide 5

Digicode’s executions 1 11, 12 111, 112, 121, 122, 123 ... 1 1 2 3 1 2 1 2 1 2 1 2 3 1 2 1 2 3 1 4 Slide 6

A few definitions Transition system: <S,L,> S set of states L set of transition labels  SxLxS transition relation Path: a sequence  of infinite transitions which follow each other For example 3  1  2 2 … is a path of the digicode B A A Slide 7

Adding data Real-life systems consist of control and data. We can model them by control = states+transitions data = state variables A transition system interact with state variables in two ways guards a transition cannot occur if the condition does not holds assignment a transition can modify the value of some state variables Slide 8

Back to the digicode We do not tolerate more than 3 mistakes (recorded by the variable m) B,C A m<3m:=m+1 A m<3m:=m+1 m<3m:=m+1 A B 1 2 3 4 C m<3m:=m+1 m<3m:=m+1 B,C m<3m:=m+1 m<3m:=m+1 A,C m=3m:=m+1 B,C B,C m=3m:=m+1 m=3m:=m+1 Err Slide 9

Unfolding From a theoretical point of view, transition systems with state variables are not strictly necessary, as we can unfold them into ordinary transition systems. The new states correspond to the old ones + a component for each variable giving its value no more guards and assignment on the new transitions Slide 10

Unfolding: example The digicode with error counting A B A m=0 B,C C 1 m=0 2 3 4 B,C C B,C A A B A 1 2 3 4 m=1 B,C C B,C A A B A 1 2 3 4 m=2 B,C C B,C A A B A m=3 1 2 3 4 A,C B,C B,C Slide 11 Err m=4

Composing systems Systems often consists of cooperating subsystems. Next we describe how to obtain a global transition system form its subsystem by having them cooperate There are many ways to cooperate: product (no interaction) synchronous product by message passing by asynchronous channels by shared variables Slide 12

Product Subsystems do not interact with each other The resulting transition system <S,L,> is the cartesian product of the transition systems <S1,L1,> ,…, <Sn,Ln,> representing the subsystems S = S1 x … xSn L = L1 x … x Ln <s1,…,sn> <t1,…tn> if for all i, si ti <e1,…,en> ei Slide 13

Example Few transitions of the product of two modulo 3 counters 0,2 1,2 2,2 inc,inc inc,inc 0,1 1,1 1,2 inc,dec inc,inc inc,inc 1,0 0,0 2,0 Slide 14

Synchronized Product Subsystems interact by doing some step together (synchronization). To synchronize subsystems we restrict the transitions allowed in their cartesian product. A synchronization set Sync  L1 x … x Ln define the labels of those transitions corresponding to a synchronization. Transitions with other labels are forbidden. Slide 15

Sync = { <inc,inc>, <dec,dec> } Example Few transitions of two counters counting at the same time Sync = { <inc,inc>, <dec,dec> } inc,inc 0,2 inc,inc inc,inc 1,2 2,2 dec,dec dec,dec 0,1 inc,inc 1,1 inc,inc 1,2 dec,dec dec,dec 1,0 0,0 2,0 inc,inc Slide 16

Sync = { <inc,->, <dec,->, <-,inc>, <-,dec>} Example Few transitions of two counters counting one at the time Sync = { <inc,->, <dec,->, <-,inc>, <-,dec>} dec,- 0,2 1,2 2,2 -,inc inc,- inc,- -,inc -,inc 0,1 1,1 2,1 inc,- inc,- -,dec -,inc -,inc -,inc 1,0 0,0 2,0 inc,- inc,- Slide 17

Message Passing A special case of synchronized product Two special sets of labels !m emission of message m ?m reception of message m In message passing, only transitions in which a given emission is executed simultaneously with the corresponding reception will be permitted Slide 18

Example: An elevator An elevator in a three floors building consists of a cabin which goes up and down three doors which open an close a controller which commands the three doors and the cabin Elevator requests from people at one of the three floors are not modeled, as they are the environment outside the system Slide 19

Example: An elevator The cabin The i-th door 1 2 C O ?down ?up ?up ?up 1 2 ?down ?down The i-th door ?close(i) ?open(i) ?open(i) C O ?close(i) Slide 20

Example: An elevator The controller !close(2) !down !open(2) !up !down free2 on2 2->0 !open(2) !up !down !close(1) free1 on1 !up !down !open(1) !down !up 0->2 !close(0) !up free0 on0 !open(0) Slide 21

Example: An elevator The synchronization Sync = {<?open(0),-,-,-,!open(0)>,<?close(0),-,-,-,!close(0)>, <-,?open(1),-,-,!open(1)>,<-,?close(1),-,-,!close(1)>, <-,-,?open(2),-,!open(2)>,<-,-,?close(2),-,!close(2)>, <-,-,-,?down,!down>,<-,-,-,?up,!up>} Slide 22

Asynchronous Messages Like message passing, but messages are not received instantly. Emitted messages but not yet received remain in a communication channel, usually a FIFO buffer A communication channel can be modeled by a transition system with a variable (for the buffer content) Slide 23

Example: Producer Buffer Consumer x=0 buf= buf=yw y=0 !send(x) x:=x+1 x=0 ?send(x) buf:=bufx Buffer ?send(x) buf:=bufx buf= buf=yw buf=yw  ?receive(y); buf:=w buf=y ?receive(y) Consumer ?receive(y) y=0 Slide 24