Formal Methods for Software Engineering Part II: Modelling & Analysis of System Behaviour.

Slides:



Advertisements
Similar presentations
Recognising Languages We will tackle the problem of defining languages by considering how we could recognise them. Problem: Is there a method of recognising.
Advertisements

Recognising Languages We will tackle the problem of defining languages by considering how we could recognise them. Problem: Is there a method of recognising.
Theory of Computing Lecture 23 MAS 714 Hartmut Klauck.
Formal Methods for Software Engineering Lecture 5, Part II: FSP.
Theory Of Automata By Dr. MM Alam
PROTOCOL VERIFICATION & PROTOCOL VALIDATION. Protocol Verification Communication Protocols should be checked for correctness, robustness and performance,
Concurrency: introduction1 ©Magee/Kramer 2 nd Edition Concurrency State Models and Java Programs Jeff Magee and Jeff Kramer.
CSC321 §6 Modelling Processes using FSP 1 Section 6 Modelling Processes using FSP.
Process Algebra (2IF45) Probabilistic Process Algebra Suzana Andova.
Process Algebra (2IF45) Probabilistic Process Algebra Suzana Andova.
Introduction to Computability Theory
1 Introduction to Computability Theory Lecture2: Non Deterministic Finite Automata Prof. Amos Israeli.
A testing scenario for probabilistic automata Marielle Stoelinga UC Santa Cruz Frits Vaandrager University of Nijmegen.
1 The SOCK SAGA Ivan Lanese Computer Science Department University of Bologna Italy Joint work with Gianluigi Zavattaro.
An Introduction to Input/Output Automata Qihua Wang.
Introduction to the Theory of Computation John Paxton Montana State University Summer 2003.
Semantics of LOTOS Answering the question: Which processes are equivalent? Basic LOTOS: ignore ! and ?...pure synchronization Dining philosophers example:
Bridging the gap between Interaction- and Process-Oriented Choreographies Talk by Ivan Lanese Joint work with Claudio Guidi, Fabrizio Montesi and Gianluigi.
Software Engineering, COMP201 Slide 1 Protocol Engineering Protocol Specification using CFSM model Lecture 30.
Specification Formalisms Book: Chapter 5. Properties of formalisms Formal. Unique interpretation. Intuitive. Simple to understand (visual). Succinct.
1 Ivan Lanese Computer Science Department University of Bologna Italy Concurrent and located synchronizations in π-calculus.
Semantics with Applications Mooly Sagiv Schrirber html:// Textbooks:Winskel The.
EECS 20 Chapter 3 Sections State Machines Continued Last time we Introduced the deterministic finite state machine Discussed the concept of state.
CSE 311: Foundations of Computing Fall 2014 Lecture 23: State Minimization, NFAs.
Concurrency: introduction1 ©Magee/Kramer Concurrency State Models and Java Programs Jeff Magee and Jeff Kramer.
A summary of our activities about WSI Philippe Giabbanelli CMPT 894 – Spring 2008.
Process Algebra (2IF45) Probabilistic Branching Bisimulation: Exercises Dr. Suzana Andova.
Basics of automata theory
1 Unit 1: Automata Theory and Formal Languages Readings 1, 2.2, 2.3.
Concurrency: processes & threads1 ©Magee/Kramer Chapter 2 Processes & Threads.
Software Verification 2 Automated Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität and Fraunhofer Institut für.
Concurrency: introduction1 ©Magee/Kramer 2 nd Edition COMP60611 Fundamentals of Parallel and Distributed Systems Lecture 5 Introduction to Concurrency:
SDS Foil no 1 Process Algebra Process Algebra – calculating with behaviours.
Communication and Concurrency: CCS
Lecture 05: Theory of Automata:08 Kleene’s Theorem and NFA.
Reactive systems – general
2G1516 Formal Methods2005 Mads Dam IMIT, KTH 1 CCS: Operational Semantics And Process Algebra Mads Dam Reading: Peled 8.3, 8.4, 8.6 – rest of ch. 8.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
2015 Concurrency: processes & threads 1 ©Magee/Kramer 2 nd Edition Chapter 2 Processes & Threads.
CSC321 §6 Modelling Processes using FSP 1 Chapter 6 Modelling Processes using FSP.
Analysis of Concurrent Software Models Using Partial Order Views Qiang Sun, Yuting Chen,
1 Qualitative Reasoning of Distributed Object Design Nima Kaveh & Wolfgang Emmerich Software Systems Engineering Dept. Computer Science University College.
CS3505: DATA LINK LAYER. data link layer  phys. layer subject to errors; not reliable; and only moves information as bits, which alone are not meaningful.
Internet Security CSCE 813 Communicating Sequential Processes.
11/19/20151 Metodi formali nello sviluppo software a.a.2013/2014 Prof.Anna Labella.
Holger Hermanns Formal Methods for Software Engineering Part III: Applications of Formal Methods Lecture 8: SDL.
CSCI1600: Embedded and Real Time Software Lecture 11: Modeling IV: Concurrency Steven Reiss, Fall 2015.
2G1516 Formal Methods2005 Mads Dam IMIT, KTH 1 CCS: Processes and Equivalences Mads Dam Reading: Peled 8.5.
Recognising Languages We will tackle the problem of defining languages by considering how we could recognise them. Problem: Is there a method of recognising.
Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1 Chapter 1 Regular Languages Some slides are in courtesy.
UNIT - I Formal Language and Regular Expressions: Languages Definition regular expressions Regular sets identity rules. Finite Automata: DFA NFA NFA with.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Process Algebra (2IF45) Abstraction Parallel composition (short intro) Suzana Andova.
Process Algebra (2IF45) Analysing Probabilistic systems Dr. Suzana Andova.
Operational Semantics Mooly Sagiv Tel Aviv University Sunday Scrieber 8 Monday Schrieber.
Today’s Agenda  Quiz 4  Temporal Logic Formal Methods in Software Engineering1.
CS 367: Model-Based Reasoning Lecture 7 (02/05/2002) Gautam Biswas.
Concurrency: processes & threads1 ©Magee/Kramer 2 nd Edition Chapter 2 Processes & Threads.
Sequence diagrams Lecture 5. Main terms  Interaction  Life line  Activation  Executable behavior and derived behavior  Messages  Trajectory  Frame.
7/7/20161 Formal Methods in software development a.a.2015/2016 Prof.Anna Labella.
Laurea Triennale in Informatica – Corso di Ingegneria del Software I – A.A. 2006/2007 Andrea Polini VII. System Specification (I)
Formal Methods for Software Engineering
Prof. Dr. Holger Schlingloff 1,2 Dr. Esteban Pavese 1
Dr. Eng Amr T. Abdel-Hamid
Clockless Computing COMP
SS 2018 Software Verification ML, state machines
Formal Methods in software development
Formal Methods in software development
Linear Time Properties
Presentation transcript:

Formal Methods for Software Engineering Part II: Modelling & Analysis of System Behaviour

Ed BrinksmaFMSE, Lecture 4 Contents Part I In Part I we used Z as a formalism to model the static aspects of software systems, i.e. ndefinition of system states & data structures ndefinition of operations & preconditions The tool Z-Eves was used for specification support and analysis.

Ed BrinksmaFMSE, Lecture 4 Contents Part II In this part we introduce FSP as a formalism to model the dynamic aspects of software systems, i.e. ndefinition of system behaviour (control flow) ndefinition of control distribution (concurrency) We introduce the tool LTSA for modelling support and analysis.

Ed BrinksmaFMSE, Lecture 4 FSP and LTS Models are described using state machines, known as Labelled Transition Systems. These are described textually as Finite State Processes and displayed and analysed by the LTSA analysis tool.  LTS - graphical form  FSP - algebraic form

Ed BrinksmaFMSE, Lecture 4 LTS: a definition A labelled transition system T consists of the following ingredients: 1. a set S of states 2. a set L of actions 3. a set -> of transitions of the form s-a->t with s,t  S and a  L or a=tau 4. an initial state s 0  S We also write T=(S,L,->, s 0 ).

Ed BrinksmaFMSE, Lecture 4 Modelling Processes A process is modelled as a finite LTS which transits from state to state by executing a sequence of atomic actions. a light switch LTS on  off  on  off  on  off  … a sequence of actions or trace on 01 off

Ed BrinksmaFMSE, Lecture 4 A Simple Transmission Protocol SENDER = (in -> send -> getack -> SENDER). insend getack 012 recout ack 012 RECEIVER = (rec -> out -> ack -> RECEIVER). get put 01 BUFFER = (get -> put -> BUFFER).

Ed BrinksmaFMSE, Lecture 4 Composing the System ||MEDIUM = (a:BUFFER||b:BUFFER) /{send/a.get,rec/a.put,ack/b.get,getack/b.put}. ||SYSTEM = (SENDER || MEDIUM ||RECEIVER). Sender Receiver Buffer 1 Buffer 2 in send rec out ack getack Medium

Ed BrinksmaFMSE, Lecture 4 The System Behaviour insendrecoutack getack u parallel composition with synchronized communication u equivalent single process can be calculated (with LTSA)

Ed BrinksmaFMSE, Lecture 4 Observable Behaviour Observable behaviour abstracts away from internal system actions. Sender Receiver in send rec out ack getack Medium ||SYSTEM = (SENDER||MEDIUM||RECEIVER).

Ed BrinksmaFMSE, Lecture 4 Observable Behaviour Observable behaviour abstracts away from internal system actions. Sender Receiver in out Medium ||SYSTEM = System

Ed BrinksmaFMSE, Lecture 4 Observable Behaviour Observable behaviour abstracts away from internal system actions. ||SYSTEM = intau outtau tau denotes internal action

Ed BrinksmaFMSE, Lecture 4 Observable Behaviour Observable behaviour abstracts away from internal system actions. minimise SYSTEM in out 01 Same LTS as: SYS=(in->out->SYS).

Ed BrinksmaFMSE, Lecture 4 Behavioural Equivalence In what sense is the minimized process SYS comparable to When can we identify system states?

Ed BrinksmaFMSE, Lecture 4 Bisimulation Idea: identify states that - can imitate each other’s observable steps leading to - states that again can be identified An observable step consists of either - observing nothing, or - observing a non-internal action

Ed BrinksmaFMSE, Lecture 4 Example intau outtau

Ed BrinksmaFMSE, Lecture 4 Observable Steps lObserving nothing: s==>t: s=t or s-tau->…-tau->t i.e. s reaches t by doing nothing, or by executing internal actions only. lObserving non-internal action: s=a=>t: s==>s’-a->t’==>t for some s’,t’ i.e. s reaches t by doing a, possibly preceeded or followed by some internal actions

Ed BrinksmaFMSE, Lecture 4 Examples atau b cb ==>0, 0=a=>1, 0=a=>2 1==>1, 1==>2, 1=b=>3, 1=c=>2 2==>2, 2=c=>2 3==>3, 3=b=>3

Ed BrinksmaFMSE, Lecture 4 Weak Bisimulation Relations Let R be a relation between states,then R is a weak bisimulation relation iff for all (s,t)  R and all observable actions a: - if for some s’: s==>s’ then for some t’: t==>t’ such that (s’,t’)  R - if for some s’: s=a=>s’ then for some t’: t=a=>t’ such that (s’,t’)  R - if for some t’: t==>t’ then for some s’: s==>s’ such that (s’,t’)  R - if for some t’: t=a=>t’ then for some s’: s=a=>s’ such that (s’,t’)  R

Ed BrinksmaFMSE, Lecture 4 Equivalent Transition Systems Two transition systems T and U are observably equivalent iff there is a weak bisimulation relation R with (t 0,u 0 )  R with t 0 and u 0 their respective initial states.

Ed BrinksmaFMSE, Lecture 4 Example c T a a c tau b cb S a b b c

Ed BrinksmaFMSE, Lecture 4 Negative Example ab c bc 0123 a a b c bc ?

Ed BrinksmaFMSE, Lecture 4 Traces Again Let T=(S,L,->,s 0 ) be a labelled transition system. nTraces(T) is the set of strings a 1 …a n  L* such that there is an s  L with s 0 =a 1 =>…=a n =>s nTwo LTSs T and U are trace equivalent iff Traces(T)=Traces(U)

Ed BrinksmaFMSE, Lecture 4 Example atau b cb 0123 Traces:  (empty trace), a,ab,abb,abbb,abbbb,… a,ac,acc,accc,acccc,…

Ed BrinksmaFMSE, Lecture 4 (Non)determinism An LTS T=(S,L,->,s 0 ) is deterministic iff for every trace  of T there is a unique state s  S with s 0 =  =>s. ab c bc 0123 a a b c bc deterministic nondeterministic 0=a=>1 and 0=a=>2 Trace sets are identical!

Ed BrinksmaFMSE, Lecture 4 FACTS Let T and U be LTSs. nIf T and U are observation equivalent then T and U are trace equivalent. nIf T and U are trace equivalent then T and U generally are not observation equivalent. nIf T and U are deterministic then they are trace equivalent iff they are observation equivalent. Do we need nondeterministic processes?

Ed BrinksmaFMSE, Lecture 4 Nondeterminism What happens with our protocol if a Buffer can lose data? BUFFER = (get -> put -> BUFFER |get -> BUFFER). nondeterminism Compiled: SENDER Compiled: BUFFER Compiled: RECEIVER Composition: SYSTEM = SENDER || MEDIUM.a:BUFFER || MEDIUM.b:BUFFER || RECEIVER State Space: 3 * 2 * 2 * 3 = 36 Composing potential DEADLOCK States Composed: 7 Transitions: 8 in 0ms SYSTEM minimising.... Minimised States: 5 in 60ms in tau out tau Deadlock state

Ed BrinksmaFMSE, Lecture 4 Revision 1 Keep sending until a getack is received SENDER = (in -> send -> WAIT), WAIT = (getack -> SENDER |send -> WAIT). Keep sending ack s until a rec is received RECEIVER = (rec -> OUT), OUT = (out -> ack -> WAIT), WAIT = (rec -> OUT |ack -> WAIT).

Ed BrinksmaFMSE, Lecture 4 Analysis Compiled: SENDER Compiled: BUFFER Compiled: RECEIVER Composition: SYSTEM = SENDER || MEDIUM.a:BUFFER || MEDIUM.b:BUFFER || RECEIVER State Space: 3 * 2 * 2 * 4 = 48 Composing States Composed: 34 Transitions: 57 in 50ms SYSTEM minimising..... Minimised States: 17 in 110ms This cannot be equivalent to the 2-state Sys process with Sys=(in->out->Sys). Reason: There is no difference between send actions that are repeated and those related to a new in action.

Ed BrinksmaFMSE, Lecture 4 Revision 2 Alternating Bit Protocol: send along a bit that is flipped to distinguish old and new data and acknowledgements. range B= 0..1 SENDER = (in -> SENDING[0]), SENDING[b:B] = (send[b] -> SENDING[b] |getack[1-b] -> SENDING[b] |getack[b] -> in -> SENDING[1-b]). RECEIVER = (rec[0] -> out -> ACKING[0]), ACKING[b:B] = (ack[b] -> ACKING[b] |rec[b] -> ACKING[b] |rec[1-b] -> out -> ACKING[1-b]). BUFFER = (get[b:B] -> put[b] -> BUFFER |get[b:B] -> BUFFER). ||MEDIUM = (a:BUFFER || b:BUFFER) /{send/a.get,rec/a.put,ack/b.get,getack/b.put}. ||SYSTEM = (SENDER || MEDIUM ||

Ed BrinksmaFMSE, Lecture 4 Does It Work? Composition: SYSTEM = SENDER || MEDIUM.a:BUFFER || MEDIUM.b:BUFFER || RECEIVER State Space: 5 * 3 * 3 * 6 = 270 Composing States Composed: 45 Transitions: 86 in 0ms intau out tau in tau out tau in tau outtau in tau intau out tau out tau out tau out tau in tau intau out

Ed BrinksmaFMSE, Lecture 4 Minimization in out 01 The Alternating Bit system (service) is observational equivalent with a 1-place buffer

Ed BrinksmaFMSE, Lecture 4 Summary lDynamic system behaviour can be modelled by LTS/FSP specifications lLTS/FSP models can composed and analysed using the LTSA tool lLTS/FSP models can be minimized to observational equivalent behaviours using bisimulations lNondeterminism is an essential modelling feature for system behaviours