Models of Concurrency

Similar documents
MPRI C-2-3: Concurrency (Part 1 of 4)

Concurrent Processes and Reaction

A Note on Scope and Infinite Behaviour in CCS-like Calculi p.1/32

An introduction to process calculi: Calculus of Communicating Systems (CCS)

The State Explosion Problem

Trace Refinement of π-calculus Processes

Communicating and Mobile Systems

Communication and Concurrency: CCS. R. Milner, A Calculus of Communicating Systems, 1980

Review of The π-calculus: A Theory of Mobile Processes

Communication and Concurrency: CCS

EMBEDDED SYSTEMS WILLIAM C. ROUNDS AND HOSUNG SONG

Formalising the π-calculus in Isabelle

From CCS to Hybrid π via baby steps. Bill Rounds CSE, U of Michigan

A Weak Bisimulation for Weighted Automata

The Expressivity of Universal Timed CCP: Undecidability of Monadic FLTL and Closure Operators for Security

Business Process Management

Formal Techniques for Software Engineering: CCS: A Calculus for Communicating Systems

Decidable Subsets of CCS

Semantics and Verification

Strong bisimilarity can be opened

Complex Systems Design & Distributed Calculus and Coordination

Modal and Temporal Logics

A π-calculus with preorders

A Behavioral Congruence for Concurrent Constraint Programming with Nondeterministic Choice

The Calculus of Communicating Systems

Temporal logics and explicit-state model checking. Pierre Wolper Université de Liège

Automata-Theoretic Model Checking of Reactive Systems

Embedded systems specification and design

Concurrency theory. proof-techniques for syncronous and asynchronous pi-calculus. Francesco Zappa Nardelli. INRIA Rocquencourt, MOSCOVA research team

Process Algebras and Concurrent Systems

Introduction to Kleene Algebras

Timo Latvala. March 7, 2004

7. Queueing Systems. 8. Petri nets vs. State Automata

Automata-based Verification - III

Design and Analysis of Distributed Interacting Systems

Equations, contractions, and unique solutions

T Reactive Systems: Temporal Logic LTL

Semantic Equivalences and the. Verification of Infinite-State Systems 1 c 2004 Richard Mayr

Information Systems Business Process Modelling I: Models

Some techniques and results in deciding bisimilarity

Automata-based Verification - III

Postprint.

Temporal Logic. Stavros Tripakis University of California, Berkeley. We have designed a system. We want to check that it is correct.

Timo Latvala. February 4, 2004

Communicating Parallel Processes. Stephen Brookes

Time and Timed Petri Nets

Models for Concurrency

Helsinki University of Technology Laboratory for Theoretical Computer Science Research Reports 66

Mobile Processes in Bigraphs. Ole Høgh Jensen. October 2006

Failure Diagnosis of Discrete Event Systems With Linear-Time Temporal Logic Specifications

Lecture Notes On THEORY OF COMPUTATION MODULE -1 UNIT - 2

Computer-Aided Program Design

Introduction to process algebra

Logic Model Checking

Automata on Infinite words and LTL Model Checking

Temporal Logic Model Checking

Chapter 3: Linear temporal logic

Theory of Computation

Time(d) Petri Net. Serge Haddad. Petri Nets 2016, June 20th LSV ENS Cachan, Université Paris-Saclay & CNRS & INRIA

DES. 4. Petri Nets. Introduction. Different Classes of Petri Net. Petri net properties. Analysis of Petri net models

CS256/Spring 2008 Lecture #11 Zohar Manna. Beyond Temporal Logics

The π-calculus Semantics. Equivalence and Value-Passing. Infinite Sums 4/12/2004

The Join calculus A calculus of mobile agents

Linear Temporal Logic and Büchi Automata

Partial model checking via abstract interpretation

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2017

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Alan Bundy. Automated Reasoning LTL Model Checking

Sanjit A. Seshia EECS, UC Berkeley

Bounded Stacks, Bags and Queues

Introduction to Temporal Logic. The purpose of temporal logics is to specify properties of dynamic systems. These can be either

Temporal & Modal Logic. Acronyms. Contents. Temporal Logic Overview Classification PLTL Syntax Semantics Identities. Concurrency Model Checking

Classes and conversions

MAKING THE UNOBSERVABLE, UNOBSERVABLE.

Chapter Five: Nondeterministic Finite Automata

Timed Automata. Semantics, Algorithms and Tools. Zhou Huaiyang

From Liveness to Promptness

Finite State Automata

Petri nets. s 1 s 2. s 3 s 4. directed arcs.

A Propositional Dynamic Logic for Instantial Neighborhood Semantics

EECS 144/244: Fundamental Algorithms for System Modeling, Analysis, and Optimization

PSL Model Checking and Run-time Verification via Testers

Automata, Logic and Games: Theory and Application

Introduction to mcrl2

Simulation of Spiking Neural P Systems using Pnet Lab

Communicating Multi-Stack Visibly Pushdown Processes

Chapter 4: Computation tree logic

Using the π-calculus. Evolution. Values As Names 3/24/2004

A Graph Rewriting Semantics for the Polyadic π-calculus

Structure Preserving Bisimilarity,

Trace-based Process Algebras for Real-Time Probabilistic Systems

2. Elements of the Theory of Computation, Lewis and Papadimitrou,

Linear-time Temporal Logic

A Modern Mathematical Theory of Co-operating State Machines

Finite Automata and Languages

Information and Computation

What You Must Remember When Processing Data Words

Trace- and Failure-Based Semantics for Responsiveness

Timed Automata VINO 2011

Distributed Processes and Location Failures (Extended Abstract)

Transcription:

Models of Concurrency GERARDO SCHNEIDER UPPSALA UNIVERSITY DEPARTMENT OF INFORMATION TECHNOLOGY UPPSALA, SWEDEN Thanks to Frank Valencia Models of Concurrency p.1/57

Concurrency is Everywhere Concurrent Systems: Multiple agents (processes) that interact among each other. Key issues : Message-Passing & Shared-Memory Synchronous & Asynchronous Reactive Systems Mobile Systems Secure Systems Timed Systems Models of Concurrency p.2/57

Concurrency is Everywhere Concurrent Systems: Multiple agents (processes) that interact among each other. Example: The Internet (a complex system!). It combines many of the before-mentioned issues! Models of Concurrency p.2/57

Concurrency: A Serious Challenge Need for Formal Models to describe and analyze concurrent systems. Models for sequential computation (functions f: Inputs Outputs ) don t apply; Concurrent computation is usually: Non-Terminating Reactive (or Interactive) Nondeterministic (Unpredictable)....etc. Models of Concurrency p.3/57

Concurrency: A Serious Challenge Formal models must be simple, expressive, formal and provide techniques (e.g., λ calculus) Models of Concurrency p.4/57

Concurrency: A Serious Challenge In concurrency theory: There are several (too many?) models focused in specific phenomena. New models typically arise as extensions of well-established ones. There is no yet a canonical (all embracing) model for concurrency. Models of Concurrency p.4/57

Concurrency: A Serious Challenge In concurrency theory: There are several (too many?) models focused in specific phenomena. New models typically arise as extensions of well-established ones. There is no yet a canonical (all embracing) model for concurrency. Why?...Probably because concurrency is a very broad (young) area. Models of Concurrency p.4/57

Concurrency: a Serious Challenge Some Well-Established Concurrency Models: Process Algebras (Process Calculi): Milner s CCS & Hoare s CSP (Synchronous communication) Milner s π-calculus (CCS Extension to Mobility) Saraswat s CCP (Shared Memory Communication) Petri Nets: First well-established concurrency theory extension of automata theory Models of Concurrency p.5/57

Agenda Basic concepts from Automata Theory CCS Basic Theory Process Logics Applications: Concurrency Work Bench (?) π-calculus Petri Nets Models of Concurrency p.6/57

Automata Definition: An automata A over an alphabet Act is a tuple (Q, Q 0, Q f, T ) where S(A) = Q = {q 0, q 1,...} is the set of states S 0 (A) = Q 0 Q is the set of initial states S f (A) = Q f Q is the set of accepting (or final) states T (A) = T Q Act Q is the set of transitions Usually (q, a, q ) T is written as q a q Models of Concurrency p.7/57

Automaton Example a a q A b q 0 ɛ q f b q B a A over {a, b} with S(A) = {q 0, q A, q B, q f }, S 0 (A) = {q 0 }, S f (A) = {q f }, a T (A) = {q 0 q A,...}. b Models of Concurrency p.8/57

Regular Sets Definition (Acceptance, Regularity) A over Act accepts s = a 1...a n Act if there a are q 1 a 0 q 1, q 2 a 1 q 2,..., q n n 1 q n in T (A) s.t., q 0 S o (A) and q n S f (A). The language of (or recognized by) A, L(A), is the set of sequences accepted by A. Models of Concurrency p.9/57

Regular Sets Definition (Acceptance, Regularity) Regular sets are those recognized by finite-state automata (FSA): I.e., S is regular iff S = L(A) for some FSA A. Regular Expressions (e.g., a.(b + c) ) are equally expressive to FSA. Models of Concurrency p.9/57

Automata: Some Nice Properties Proposition: 1. Deterministic and Non-Deterministic FSA are equally expressive. 2. Regular sets are closed under (a) union, (b) complement, (c) intersection. Models of Concurrency p.10/57

Automata: Exercises Exercises: (1) Prove 2.b and 2.c. (2) Prove that emptiness problem of a given FSA is decidable. (3) Prove that language equivalence of two given FSA is decidable. (4) Let B a FSA. Construct a FSA A such that s L(A) iff for every suffix s of s, s L(B) Models of Concurrency p.11/57

Automata Theory; what is it good for Classic Automata Theory is solid and foundational, and it has several applications in computer science. Models of Concurrency p.12/57

Automata Theory; what is it good for Classic Automata Theory is solid and foundational, and it has several applications in computer science. Example: Two Vending-Machines coffee A 1 s 0 2$ tea 2$ s 1 s 2 Models of Concurrency p.12/57

Automata Theory; what is it good for Classic Automata Theory is solid and foundational, and it has several applications in computer science. Example: Two Vending-Machines coffee A 2 s 0 2$ tea 2$ s 1 s 2 tea 2$ s 4 Models of Concurrency p.12/57

Automata Theory; what is it good for Classic Automata Theory is solid and foundational, and it has several applications in computer science. Example: Two Vending-Machines If L(A 1 ) = L(A 2 ) then language equivalence (trace equivalence) is too weak for interactive behaviour! Models of Concurrency p.12/57

Automata Theory: The Problem The theory allows to deduce that a (b + c) = a b + a c Models of Concurrency p.13/57

Automata Theory: The Problem The theory allows to deduce that a (b + c) = a b + a c b p 2 a q 1 b q 2 p 0 a p 1 c p 3 q 0 a q 1 c q 3 Models of Concurrency p.13/57

Automata Theory: The Problem The theory allows to deduce that a (b + c) = a b + a c That is, the automata in the example are equivalent and we want to differentiate them We need a stronger equivalence that does not validate the above. Models of Concurrency p.13/57

Simulation & Bisimulation Relations Transition Systems are just automata in which final and initial states are irrelevant Definition: Let T be transition system. A relation R S(T ) S(T ) is a simulation iff for every (p, q) R: If p a p then there exists q such that a q q and (p, q ) R A relation R is a bisimulation iff R and its converse R 1 are both simulations. Models of Concurrency p.14/57

Bisimilarity Definition: We say that p simulates q iff there exists a simulation R such that (p, q) R. Also, p and q are bisimilar, written p q, if there exists a bisimulation R such that (p, q) R. Example: In the previous example p 0 simulates q 0 but q 0 cannot simulate p 0, so p 0 and q 0 are not bisimilar. Question: If p simulates q and q simulates p; are p and q bisimilar? Models of Concurrency p.15/57

Bisimilarity Definition: We say that p simulates q iff there exists a simulation R such that (p, q) R. Also, p and q are bisimilar, written p q, if there exists a bisimulation R such that (p, q) R. Example: In the previous example p 0 simulates q 0 but q 0 cannot simulate p 0, so p 0 and q 0 are not bisimilar. Question: If p simulates q and q simulates p; are p and q bisimilar? Answer: No! P = a.0 + a.b.0 and Q = a.b.0 Models of Concurrency p.15/57

Road Map We have seen: Basic Classic Automata theory, and Transition Systems, Bisimilarity Next: Process Calculi, in particular CCS. Processes represented as transition systems and their behavioural equivalence given by bisimilarity. Models of Concurrency p.16/57

Process Calculi: Key Issues (Syntax) Constructs that fit the intended phenomena E.g. Atomic actions, parallelism, nondeterminism, locality, recursion. (Semantics) How to give meaning to the constructs E.g. Operational, denotational, or algebraic semantics (Equivalences) How to compare processes E.g. Observable Behaviour, process equivalences, congruences... Models of Concurrency p.17/57

Process Calculi: Key Issues (Specification) How to specify and prove process properties E.g. Logic for expressing process specifications (Hennessy-Milner Logic) (Expressiveness) How expressive are the constructs? Models of Concurrency p.17/57

CCS: Calculus for Synchron. Communic. Underlying sets (basic atoms) A set N = a, b,... of names and N = {a a N } of co-names A set L = N N of labels (ranged over by l, l,...) A set Act = L {τ} of actions (ranged over by a, b,...) Action τ is called the silent or unobservable action Actions a and a are complementary : a = a Models of Concurrency p.18/57

CCS: Process Syntax P, Q,... := 0 a.p P Q P +Q P \a A(a 1,..., a n ) Bound names of P, bn(p ): Those with a bound occurrence in P. Free names of P, fn(p ): Those with a not bound occurrence in P. For each (call) A(a 1,..., a n ) there is a unique process definition A(b 1... b n ) = P, with fn(p ) {b 1,..., b n }. The set of all processes is denoted by P. Models of Concurrency p.19/57

CCS: Operational Semantics ACT a.p a P P a P SUM Q 1 P + Q a SUM 2 P P + Q a Q a Q P a P COM 1 P Q a P Q Q a Q COM 2 P Q a P Q P l P Q l Q COM 3 P Q τ P Q Models of Concurrency p.20/57

CCS: Operational Semantics RES P P \a a P a P \a if a a and a a REC P a A[b 1,..., b n /a 1,..., a n ] P a A(b 1,..., b n ) P if A(a 1,..., a n ) def = P A Models of Concurrency p.20/57

CCS: Operational Semantics RES P P \a a P a P \a if a a and a a REC P a A[b 1,..., b n /a 1,..., a n ] P a A(b 1,..., b n ) P if A(a 1,..., a n ) def = P A Notation: Instead of P \a we will use the infix notation: (νa)p ( new operator). Models of Concurrency p.20/57

CCS: Bisimilarity The labelled transition system of CCS has P as its states and its transitions are those given by the operational (labelled) semantics. Hence, define P Q iff the states corresponding to P and Q are bisimilar. Exercise Write a CCS expression for the vending machine (in parallel with some thirsty user:-). Models of Concurrency p.21/57

CCS: Bisimilarity Questions Do we have? - P Q Q P - P 0 P - (P Q) R P (Q R) - (νa)0 0 - P (νa)q (νa)(p Q) - (νa)p (νb)p [b/a] Models of Concurrency p.21/57

CCS: The expansion law Notice that a.0 b.0 is bisimilar to the summation form a.b.0 + b.a.0 More generally, we have the expansion law which allows to express systems in summation form. Models of Concurrency p.22/57

CCS: The expansion law Notice that a.0 b.0 is bisimilar to the summation form a.b.0 + b.a.0 More generally, we have the expansion law I.e. (ν a)(p 1... P n ) Σ{a i.(ν a)(p 1... P i... P n) P i Σ{τ.(ν a)(p 1... P i... P j... P n ) P i + a i P i, a, a i a} l P i, P j l P j} Models of Concurrency p.22/57

CCS: The expansion law Notice that a.0 b.0 is bisimilar to the summation form a.b.0 + b.a.0 So, every move in (ν a)(p 1... P n ) is either one of the P i or a communication between some P i and P j Models of Concurrency p.22/57

Congruence Issues Suppose that P Q. We would like P R Q R More generally, we would like C[P ] C[Q] where C[.] is a process context Models of Concurrency p.23/57

Congruence Issues Suppose that P Q. We would like P R Q R More generally, we would like C[P ] C[Q] where C[.] is a process context I.e., we want to be a congruence. The notion of congruence allows us to replace equals with equals Models of Concurrency p.23/57

Congruence Issues Suppose that P Q. We would like P R Q R More generally, we would like C[P ] C[Q] where C[.] is a process context Question. How can we prove that is a congruence? Models of Concurrency p.23/57

Observable Behaviour In principle, P and Q should be equivalent iff another process (the environment, an observer) cannot observe any difference in their behaviour Notice τ.p P, although τ is an unobservable action. So could be too strong So, we look for other notion of equivalence focused in terms of observable actions (i.e., actions, l l L) Models of Concurrency p.24/57

Observations l Think of any as an observation; or that an action a by P can be observed by an action a by P s environment An experiment e as a sequence l 1.l 2... l n of observable actions Notation: If s = a 1... a n Act then define s = = ( ) τ a 1 ( ) τ... ( ) τ a n ( τ ) Models of Concurrency p.25/57

Observations l Think of any as an observation; or that an action a by P can be observed by an action a by P s environment An experiment e as a sequence l 1.l 2... l n of observable actions e Notice that = for e = l 1.l 2... l n L denotes a sequence of observable actions inter-spread with τ actions: The notion of experiment. Models of Concurrency p.25/57

Trace Equivalence Definition: (Trace Equivalence) P and Q are trace equivalent, written P t Q, iff for every experiment (here called trace) e = l 1... l n L P = e iff Q = e Models of Concurrency p.26/57

Trace Equivalence Examples. τ.p t P (nice!) a.b.0 + a.c.0 t a.(b.0 + c.0) (not that nice!) a.b.0 + a.0 t a.b.0 (not sensitive to deadlocks) a.0 + b.0 t (νc)(c.0 c.a.0 c.b.0) Models of Concurrency p.26/57

Failures Equivalence Definition: (Failures Equivalence) A pair (e, L), where e L (i.e. a trace) and L L, is a failure for P iff (1)P e l = P (2) P for all l L, (3)P τ P and Q are failures equivalent, written P f Q, iff they have the same failures. Fact f t. Models of Concurrency p.27/57

Failures Equivalence Examples τ.p f P a.b.0 + a.c.0 f a.(b.0 + c.0) (Exercise) a.b.0 + a.0 f a.b.0. a.0 + b.0 f (νc)(c.0 c.a.0 c.b.0) (Exercise) a.(b.c.0 + b.d.0) f a.b.c.0 + a.b.d.0. Let D = τ.d. We have τ.0 f D. Models of Concurrency p.27/57

Weak Bisimilarity Definition: A symmetric binary relation R on processes is a weak bisimulation iff for every (P, Q) R: If P = e P and e L then there exists Q such that Q = e Q and (P, Q ) R. P and Q are weakly bisimilar, written P Q iff there exists a weak bisimulation containing the pair (P, Q). Models of Concurrency p.28/57

Weak Bisimilarity Examples. τ.p P, a.τ.p a.p However, a.0 + b.0 a.0 + τ.b.0 a.(b.c.0 + b.d.0) a.b.c.0 + a.b.d.0 (Exercise) Let D = τ.d. We have τ.0 D. a.0 + b.0 (νc)(c.0 c.a.0 c.b.0) (Exercise) Models of Concurrency p.28/57

An alternative definition of weak bisimulation Verifying bisimulation using the previous definition could be hard (there are infinitely many experiments e!). Fortunately, we have an alternative formulation easier to work with: Proposition: R is a weak bisimulation iff If P = a P and a Act then there exists Q such that Q = â Q and (P, Q ) R. Where â = a if a L (i.e. observable), otherwise â = ɛ. Models of Concurrency p.29/57

Road Map We have seen: Basic Classic Automata theory, and Transition Systems, Bisimilarity Also: Process Calculi, in particular CCS. Processes represented as transition systems and their behavioural equivalence given by bisimilarity. Next: Process Logics Models of Concurrency p.30/57

Process Logic: Verification and Specification Process can be used to specify and verify the behaviour system (E.g. Vending Machines). E.g., 2p.tea.0 + 2p.coffe.0 specify a machine which does not satisfy the behaviour specified by a 2p.(tea.0 + coffe.0) In Computer Science we use logics for specification and verification of properties. A logic whose formulae can express, e.g., P will never not execute a bad action, or P eventually executes a good action Models of Concurrency p.31/57

Hennessy&Milner Logic The syntax of the logic: F := true false F 1 F 2 F 1 F 2 K F [K]F where K is a set of actions The boolean operators are interpreted as in propositional logic Models of Concurrency p.32/57

Hennessy&Milner Logic The syntax of the logic: F := true false F 1 F 2 F 1 F 2 K F [K]F where K is a set of actions K F (possibility) asserts (of a given P ): It is possible for P to do a a K and then evolve into a Q that satisfy F [K]F (necessity) asserts (of a given P ): If P can do a a K then it must evolve into a Q which satisfies F Models of Concurrency p.32/57

Hennesy&Milner Logic: Semantics The compliance of P with the specification F, written P = F, is given by: P = false P = true P = F 1 F 2 iff P = F 1 and P = F 2 P = F 1 F 2 iff P = F 1 or P = F 2 P = K F iff for some Q P a Q, a K and Q = F P = [K]F iff if P a Q and a K then Q = F Models of Concurrency p.33/57

Hennesy&Milner Logic: Semantics Example. Let Also let P 1 = a.(b.0 + c.0), P 2 = a.b.0 + a.c.0 F = {a} ( {b} true {c} true) Notice that P 1 = F but P 2 = F. Theorem P Q if and only, for every F, P = F iff Q = F. Models of Concurrency p.33/57

A Linear Temporal Logic The syntax of the formulae is given by F := true false L F 1 F 2 F 1 F 2 F F where L is a set of non-silent actions. Formulae assert properties of traces Boolean operators are interpreted as usual L asserts (of a given trace s) that the first action of s must be in L {τ} Models of Concurrency p.34/57

A Linear Temporal Logic The syntax of the formulae is given by F := true false L F 1 F 2 F 1 F 2 F F where L is a set of non-silent actions. F asserts (of a given trace s) that at some point in s, F holds. F asserts (of a given trace s) that at every point in s, F holds. Models of Concurrency p.34/57

Temporal Logic: Semantics An infinite sequence of actions s = a 1.a 2... satisfies (or is a model of) F, written s = F, iff s, 1 = F, where s, i = true s, i = false s, i = L iff a i L τ s, i = F 1 F 2 iff s, i = F 1 or s, i = F 2 s, i = F 1 F 2 iff s, i = F 1 and s, i = F 2 s, i = F iff for all j i s, j = F s, i = F iff there is a j i s.t. s, j = F Models of Concurrency p.35/57

Temporal Logic: Semantics Moreover, iff whenever P ŝ = s.τ.τ.... P = F s = then ŝ = F, where Models of Concurrency p.35/57

Temporal Logic: Example Example. Consider A(a, b, c) def = a.(b.a(a, b, c) + c.a(a, b, c)) and B(a, b, c) def = a.b.b(a, b, c) + a.c.b(a, b, c). Notice that the trace equivalent processes A(a, b, c) and B(a, b, c) satisfy (b c) I.e. they always eventually do b or c Models of Concurrency p.36/57

Temporal Logic: Example Theorem If P t Q then for every linear temporal formula F, P = F iff Q = F Question. Does the other direction of the theorem hold? Models of Concurrency p.36/57

Temporal Logic: Exercises Exercises: Which one of the following equivalences are true? - (F G) F G? - (F G) F G? - F F? - F F? Models of Concurrency p.37/57

Temporal Logic: Exercises Exercises: Which one of the following equivalences are true? - (F G) F G - (F G) F G - F F - F F Models of Concurrency p.37/57

Road Map Basic classic automata theory and the limitation of language equivalence. Bisimilarity Equivalence for automata (transition systems). CCS Behaviour transitions systems Behaviour using: bisimilarity, trace equivalence, failures equivalence, weak bisimilarity Specification of properties using HM and Temporal Logics. Models of Concurrency p.38/57

Road Map Basic classic automata theory and the limitation of language equivalence. Bisimilarity Equivalence for automata (transition systems). CCS Mobility and the π calculus Models of Concurrency p.38/57

Mobility What kind of process mobility are we talking about? Processes move in the physical space of computing sites Processes move in the virtual space of linked processes Links move, in the virtual space of linked processes Models of Concurrency p.39/57

Mobility What kind of process mobility are we talking about? Links move, in the virtual space (of linked processes) The last one is the π-calculus choice; for economy, flexibility, and simplicity. The π calculus extends CCS with the ability of sending private and public links (names). Models of Concurrency p.39/57

π Calculus: Syntax P := P P Σ i I α i.p (νa)p!p if a = b then P where α := τ a(b) a(x) Names=Channels=Ports=Links. a(b).p : send b on channel a and then activate P a(x).p : receive a name on channel a (if any), and replace x with it in P Models of Concurrency p.40/57

π Calculus: Syntax P := P P Σ i I α i.p (νa)p!p if a = b then P where α := τ a(b) a(x) (νa).p : create a fresh name a private to P (νa)p and a(x).q are the only binders!p : replicate P i.e.,!p represents P P P... Models of Concurrency p.40/57

Mobility: Example Client & Printer-Server: The printer-server Serv = (νp) (s(r).r(p) p(j).p rint) The Client Client = s(c).c(plink).plink(job) The System Client Serv. Models of Concurrency p.41/57

Mobility: Exercises Write an agent that - Reads sthg from port a and sends it twice along port b - Reads two ports and sends the first along the second - Sends b and c on channel a so that only one (sequential) process receive both b and c - Contains three agents P, Q, R such that P can communicate with both Q and R; but Q and R cannot communicate - Generates infinitely many different names and send them along channel a. Models of Concurrency p.42/57

Reaction Semantics of π The reactive semantics of π consists of a structural congruence and the reactive rules. The structural congruence describe irrelevant syntactic aspects of processes The reactive rules describe the evolutions due to synchronous communication between processes. Models of Concurrency p.43/57

Structural Congruence Definition: (Structural Congruence) The relation is the smallest process equivalence satisfying: P Q if P can be alpha-converted into Q. P 0 P, P Q Q P, (P Q) R P (Q R) (νa)0 0, (νa)(νb)p (νb)(νa)p (νa)(p Q) P (νa)q if a fn(p )!P P!P Models of Concurrency p.44/57

Structural Congruence Examples. Notice that (νc)(a(b) 0) a(b). Do we have? 1. (νa)p P if a fn(p ) 2. x(y).y(z) x(z).y(y) 3. x y x.y + y.x 4. x(y).x(z) y(z).z(y) y(y).y(z) x(z).x(y) Models of Concurrency p.45/57

Structural Congruence Examples. Notice that (νc)(a(b) 0) a(b). Do we have? 1. (νa)p P if a fn(p ) True! 2. x(y).y(z) x(z).y(y) 3. x y x.y + y.x 4. x(y).x(z) y(z).z(y) y(y).y(z) x(z).x(y) Models of Concurrency p.45/57

Structural Congruence Examples. Notice that (νc)(a(b) 0) a(b). Do we have? 1. (νa)p P if a fn(p ) True! 2. x(y).y(z) x(z).y(y) Not true! (... x(d)) 3. x y x.y + y.x 4. x(y).x(z) y(z).z(y) y(y).y(z) x(z).x(y) Models of Concurrency p.45/57

Structural Congruence Examples. Notice that (νc)(a(b) 0) a(b). Do we have? 1. (νa)p P if a fn(p ) True! 2. x(y).y(z) x(z).y(y) Not true! (... x(d)) 3. x y x.y + y.x Not true! (If y = x then: a(x, x).(x y) a(x, x).(xy + y.x)) 4. x(y).x(z) y(z).z(y) y(y).y(z) x(z).x(y) Models of Concurrency p.45/57

Structural Congruence Examples. Notice that (νc)(a(b) 0) a(b). Do we have? 1. (νa)p P if a fn(p ) True! 2. x(y).y(z) x(z).y(y) Not true! (... x(d)) 3. x y x.y + y.x Not true! (If y = x then: a(x, x).(x y) a(x, x).(xy + y.x)) 4. x(y).x(z) y(z).z(y) y(y).y(z) x(z).x(y) True! Models of Concurrency p.45/57

Reactive Rules TAU τ.p + M P REACT (a(x).p + M) (a(b).q + N) P [b/x] Q STRUCT P P Q Q if P Q and P Q PAR P P P Q P Q RES P P (νa)p (νa)p Models of Concurrency p.46/57

Reactive Rules How to express that a private channel can / cannot be exported? Models of Concurrency p.47/57

Reactive Rules How to express that a private channel can / cannot be exported? Example: ((νa)x(a).0) x(y).p How can we reflect that x communicate with x? Models of Concurrency p.47/57

Reactive Rules How to express that a private channel can / cannot be exported? Example: ((νa)x(a).0) x(y).p How can we reflect that x communicate with x? It seems that the rules do not allow to do so This is hidden somewhere; where? Models of Concurrency p.47/57

Reactive Rules How to express that a private channel can / cannot be exported? Example: ((νa)x(a).0) x(y).p How can we reflect that x communicate with x? It seems that the rules do not allow to do so This is hidden somewhere; where? Answer: In the STRUCT rule! Models of Concurrency p.47/57

Reactive Rules Example. Give reductions for x(z).y(z)!(νy)x(y).q Models of Concurrency p.48/57

π: Some Remarks We have not considered in this course: How to introduce recursion: recursive operator vs. replication Notions of process equivalence: weak, early, open, late bisimulations; barbed congruence Variants of semantics: symbolic, late, early semantics, etc Models of Concurrency p.49/57

Road Map Basic classic automata theory and the limitation of language equivalence. Bisimilarity Equivalence for automata (transition systems). CCS Mobility and the π calculus Petri Nets Models of Concurrency p.50/57

Petri Nets A Petri net is a bipartite graph whose Classes of nodes (places) represent system conditions and resources Each place can contain tokens Transitions represent system activities First model for (true) concurrency (Petri, 1962) Widely used for analysis and verification of concurrent systems Models of Concurrency p.51/57

Petri Nets (more formally) A Petri net is a tuple N = (P, A, T, M 0 ): P is a finite set of places A is a finite set of actions (or labels) T M(P ) A M(P ) is a finite set of transitions M 0 is the initial marking where M(P ) is a collection of multisets (bags) over P Models of Concurrency p.52/57

Graphical representation P 1 P 2 t P 3 P 4 Marking M : is a mapping from places to the set of natural numbers M(P 1 ) = 3 M(P 2 ) = 1 M(P 3 ) = 1 M(P 4 ) = 2 Models of Concurrency p.53/57

Transition relation (firing) P 1 P 2 t P 3 P 4 Models of Concurrency p.54/57

Transition relation (firing) P 1 P 2 P 1 P 2 t t P 3 P 4 P 3 P 4 Models of Concurrency p.54/57

Petri Nets: Some remarks Petri nets are infinite-state systems Example: P 1 P 2 Starting with M(P 1 ) = 1 and M(P 2 ) = 0 (10) Firing the transition successively gives: 11, 12, 13, 14,... Exercise: How to generate the Natural numbers, using Petri nets? Models of Concurrency p.55/57

Example: mutex W 1 W 2 R = 0? R := 0 R := 1 R := 0 R = 0? R := 1 C 1 C 2 Models of Concurrency p.56/57

Example: mutex W 1 W 2 R = 0? R := 0 R := 1 R := 0 R = 0? R := 1 C 1 C 2 C 1 W 1 W 2 C 2 R = 0 Models of Concurrency p.56/57

Example: mutex W 1 W 2 R = 0? R := 0 R := 1 R := 0 R = 0? R := 1 C 1 C 2 C 1 W 1 W 2 C 2 R = 0 Models of Concurrency p.56/57

Example: mutex W 1 W 2 R = 0? R := 0 R := 1 R := 0 R = 0? R := 1 C 1 C 2 C 1 W 1 W 2 C 2 R = 0 Models of Concurrency p.56/57

Road Map Basic classic automata theory and the limitation of language equivalence. Bisimilarity Equivalence for automata (transition systems). CCS Mobility and the π calculus Petri Nets Models of Concurrency p.57/57