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

Similar documents
Concurrent Processes and Reaction

Models of Concurrency

MAKING THE UNOBSERVABLE, UNOBSERVABLE.

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

Making the unobservable, unobservable

Semantics and Verification

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

Communication and Concurrency: CCS

Equations, contractions, and unique solutions

Strong bisimilarity can be opened

Trace Refinement of π-calculus Processes

The Calculus of Communicating Systems

Formalising the π-calculus in Isabelle

A π-calculus with preorders

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

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

COSE212: Programming Languages. Lecture 1 Inductive Definitions (1)

Recursion in Coalgebras

Finitely Branching LTS s from Reaction Semantics for Process Calculi

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

Correspondence between Kripke Structures and Labeled Transition Systems for Model Minimization

A Behavioral Congruence for Concurrent Constraint Programming with Nondeterministic Choice

Dipartimento di Informatica Università degli Studi di Verona

Universität Augsburg. Institut für Informatik. Bisimulation on Speed: Lower Time Bounds. Gerald Lüttgen and Walter Vogler.

Information and Computation

Recursive equations in higher-order process calculi

Linear Forwarders. 1 Introduction. Philippa Gardner 1, Cosimo Laneve 2, and Lucian Wischik 2

TRINITY COLLEGE DUBLIN. First-Order Reasoning for Higher-Order Concurrency

A Weak Bisimulation for Weighted Automata

COSE212: Programming Languages. Lecture 1 Inductive Definitions (1)

Relating Reasoning Methodologies in Linear Logic and Process Algebra

Decidable Subsets of CCS

EMBEDDED SYSTEMS WILLIAM C. ROUNDS AND HOSUNG SONG

CS411 Notes 3 Induction and Recursion

CS522 - Programming Language Semantics

Business Process Management

arxiv: v1 [cs.lo] 16 Apr 2018

Structure Preserving Bisimilarity,

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

The State Explosion Problem

COMP4141 Theory of Computation

A few bridges between operational and denotational semantics of programming languages

Nominal Completion for Rewrite Systems with Binders

An Equational Axiomatization for Multi-Exit Iteration

Propositional and Predicate Logic - IV

A Propositional Dynamic Logic for Instantial Neighborhood Semantics

Probabilistic Applicative Bisimulation and Call-by-Value Lam

Topics in Concurrency

Operationally-Based Theories of Program Equivalence

Congruence of Bisimulation in a Non-Deterministic Call-By-Need Lambda Calculus

T Reactive Systems: Temporal Logic LTL

Deriving structural labelled transitions for mobile ambients

How to Prove Similarity a Precongruence in Non-Deterministic Call-by-Need Lambda Calculi

Distributed Processes and Location Failures (Extended Abstract)

Postprint.

INTRODUCTION TO LOGIC. Propositional Logic. Examples of syntactic claims

Streams and Coalgebra Lecture 2

Bisimulation and coinduction in higher-order languages

CCS: Syntax & Semantics (Final Version)

Madhavan Mukund Chennai Mathematical Institute

Timed Automata VINO 2011

Modelling Membranes with Brane Calculi

Name-passing calculi: from fusions to preorders and types

On Compensation Primitives as Adaptable Processes

Formal Methods for Specifying and Verifying Distributed Algorithms Process Algebra vs I/O Automata

A semantic framework for open processes

Overview of Today s Lecture

Supplementary Notes on Inductive Definitions

A Semantic Framework for Open Processes

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

Communicating Parallel Processes. Stephen Brookes

Mechanics 1: Coordinates

TROPICAL SCHEME THEORY

A behavioural theory for a π-calculus with preorders

Lecture Notes. Advanced Discrete Structures COT S

On Expressiveness and Behavioural Theory of Attribute-based Communication

Model Theory of Modal Logic Lecture 5. Valentin Goranko Technical University of Denmark

CHAPTER 8: EXPLORING R

Deducing Interactions in Partially Unspecified Biological Systems

cis32-ai lecture # 18 mon-3-apr-2006

Liveness of Communicating Transactions

ESE601: Hybrid Systems. Introduction to verification

Communicating Transactions (Extended Abstract)

Full abstraction for nominal exceptions and general references

Lecture Notes on Inductive Definitions

Algebraic Approach to Automata Theory

Computational Soundness of a Call by Name Calculus of Recursively-scoped Records. UMM Working Papers Series, Volume 2, Num. 3.

Categories, Proofs and Programs

Coalgebra, lecture 10: Algebra and Coalgebra for Regular Expressions

Propositional Logic Language

Declarative event based models of concurrency and refinement in psi-calculi

Advanced Process Calculi

CS3110 Fall 2013 Lecture 11: The Computable Real Numbers, R (10/3)

Topics in Concurrency

6c Lecture 14: May 14, 2014

Bialgebraic Methods in Structural Operational Semantics

On the specification of modal systems: a comparison of three frameworks

Nominal Syntax and Semantics

Inducing syntactic cut-elimination for indexed nested sequents

Extending Howe s Method to Early Bisimulations for Typed Mobile Embedded Resources with Local Names

Transcription:

An introduction to process calculi: Calculus of Communicating Systems (CCS) Lecture 2 of Modelli Matematici dei Processi Concorrenti Paweł Sobociński University of Southampton, UK Intro to process calculi: CCS p.1/25

Introduction In the first lecture we discussed behavioural preorders and equivalences, in particular bisimilarity. This lecture is an introduction to a well-known process-calculus, the Calculus of Communicating Systems (CCS) introduced by Robin Milner in the early 1980 s. Process calculi: a pseudo-programming language which usually focuses on a small language feature; usually try to eliminate syntactic sugar and extra programmer-friendly features; idea is to isolate basic principles and reasoning techniques. Intro to process calculi: CCS p.2/25

CCS focuses on a very simple paradigm of synchronous handshakes. processes a?p and a!q, when executing in parallel (a?p a!q); can synchronise their execution by synchronising on channel a; after the synchronisation continue as P and Q, respectively; a?p a!q P Q; Intro to process calculi: CCS p.3/25

CCS syntax Assume that we have a set of names A and a countable set of process variables. P ::= 0 a?p a!p P P P + P νap X µx.p NB. sometimes a?p is written ap and a!p is written ap. In early texts νap is written P \a. a?p : input on a and proceed as P ; a!p : output on a and proceed as P ; τp : perform an internal reduction and proceed as P ; P 1 P 2 : put P 1 and P 2 in parallel; P 1 + P 2 : act either as P 1 or as P 2 ; νap : treat a as a local channel visible only in P ; Intro to process calculi: CCS p.4/25

Recursion Infinite behaviour can be added to CCS in several (nonequivalent) ways. P ::=... X µx.p The expression µx.p stands for treats the X as a recursive variable in P. Idea: µx.a?x a?a?...; µx.p X P P...; µx.a!(b?x + c?x)? Intro to process calculi: CCS p.5/25

Contexts and Congruences Definition 1 (Contexts). C ::= P C C P C + P P + C νac a?c a!c Definition 2 (Substitution). Given a term P and a context C, let C[P] denote the term obtained by substituting P for. Free names may be captured! Definition 3. A relation R on the terms of CCS is said to be a congruence when P RQ σ(p)rσ(q) for all operations σ of CCS. More formally, if PRQ then C[P]RC[Q] for all contexts C. Intro to process calculi: CCS p.6/25

Structural congruence P Q denotes the same system as Q P ; We quotient the raw syntax via a relation which is a congruence with respect to the operations of CCS. Definition 4 (SC). Let be the smallest congruence which includes the following: (P Q) R P (Q R) P Q Q P P 0 P (P + Q) + R P + (Q + R) P + Q Q + P P + 0 P νa(p Q) (νap) Q (a / Q) νap νbp[b/a] (b / P) µx.p P[µX.P/X] Remark 5. Contexts are not quotiented by SC. This is because we want the contexts to have the power to bind. Intro to process calculi: CCS p.7/25

Reduction semantics 1 Idea, basic reduction: a?p 1 + P 2 a!q 1 + Q 2 P 1 Q 1 Letting l a,p1,p 2,Q 1,Q 2 def = a?p 1 + P 2 a!q 1 + Q 2 r a,p1,p 2,Q 1,Q 2 def = P 1 Q 1 we want, for all a,p 1,P 2,Q 1,Q 2 l a,p1,p 2,Q 1,Q 2 r a,p1,p 2,Q 1,Q 2 Intro to process calculi: CCS p.8/25

Reduction semantics 2 But parallel composition shouldn t inhibit reduction, so that if P P then for all Q we should also have P Q P Q. Similarly, νap νap. Evaluation contexts: E ::= P νa Definition 6. P P iff a,p 1,P 2,Q 1,Q 2 and evaluation context E such that P E[l a,p1,p 2,Q 1,Q 2 ] and P E[r a,p1,p 2,Q 1,Q 2 ]. Intro to process calculi: CCS p.9/25

SOS There is a useful way of presenting the reduction semantics using structural operational semantics (SOS). a?p 1 +P 2 a!q 1 +Q 2 P 1 Q 1 P P P Q P Q P P νap νap The rules above generate a transition system (which we can think of as an LTS with only one label); we will refer to this as the reduction transition system. Intro to process calculi: CCS p.10/25

Examples s s s c t c t M 1 def = s?(c! + t!) M 2 def = s?c! + s?t! Coffee drinker C 1 def = s!c?0; Simulation 1: C 1 M 1 c?0 (c!0 + t!0) 0 Simulation 2: C 1 M 2 c?0 t!0 Intro to process calculi: CCS p.11/25

Process equivalence? What is a good notion of process equivalence? we can try bisimilarity on the reduction LTS... but then, for instance, a!p b!p. In fact, all processes which do not reduce are bisimilar. Clearly, this is not sufficient. Intro to process calculi: CCS p.12/25

Contextual equivalence A canonical process equivalence for a process language is contextual equivalence. The idea originally arose in the theory of the λ-calculus. Idea: Processes P and Q can be distinguished if in some context C they behave differently. we can try taking the largest bisimulation which is also a congruence; this almost works, the problem is that processes which can always reduce are equated; Intro to process calculi: CCS p.13/25

Reduction barbed congruence One sensible definition of a contextual equivalence for CCS is reduction barbed congruence. Definition 7. A barb is a basic observation. In CCS it makes sense to take the instantaneous ability to input or output on a name. We say that P a iff P νk(a!p 1 + P 2 P 3 ) or P νk(a?p 1 + P 2 P 3 ) and a / k. Definition 8. Reduction barb congruence Let = be the largest equivalence relation which is a congruence; barb-closed: if P = Q and P a then Q a ; reduction-closed: if P = Q and P P then Q, Q Q and Q = Q (for all contexts C, C[P] = C[Q], bisimulation on the reduction LTS) Intro to process calculi: CCS p.14/25

Examples Claim 9 (Firewall). νa.a! = 0. Proof.? Intro to process calculi: CCS p.15/25

Problems with contextual equivalence = is a priori defined to be a congruence; thus, in principle, to check that P = Q we have to have a proof which takes into account an infinite number of arbitrarily complex contexts C Intro to process calculi: CCS p.16/25

LTS characterisation We will give a labelled transition system on which bisimulation characterises contextual equivalence, ie it is sound: =; it is complete: =. Intro to process calculi: CCS p.17/25

LTS for CCS a?p a? P (IN) a!p a! P (OUT) P a! P Q a? Q (TAU) P Q τ P Q P α P P Q α P Q (PAR) P α P νap α νap (a/ α) (NU) P P P α Q Q Q (STRCONG) P α Q Intro to process calculi: CCS p.18/25

Example Lemma 10 (Firewall). νa.a! 0 Proof. Obvious, since both sides do not have any transitions. Lemma 11 (Expansion). If a b then a? b! a?b! + b!a?. Proof. {(a? b!,a?b! + b!a?), (b!,b!), (a?,a?), (0, 0)} is a bisimulation. Intro to process calculi: CCS p.19/25

Proof of soundness Theorem 12. is a congruence. Proof. We ll do the case Q. We will prove that R = {(P 1 R,P 2 R),P 1 P 2 } is a bisimulation. Suppose that P 1 Q α R. We ll do the case α = τ. If P 1 τ P 1 and R P 1 Q then also P 2 τ P 2 such that P 1 P 2. Then P 2 Q τ P 2 Q, but (R,P 2 Q) R. The case Q τ Q such that R P 1 Q is similar. The other possibility is, P 1 a! P 1 and Q a? Q and R P 1 Q. But then P 2 a! P 2 such that P 1 P 2 and so P 2 Q τ P 2 Q. (note the case P 1 a? P 1, Q a! Q is symmetric) Intro to process calculi: CCS p.20/25

Congruent bisimilarities Having a congruent bisimilarity is quite useful because it allows the use of a familiar algebraic principle substituting equal for equal. It can also reduce the burden of constructing bisimulations since bisimulations can be deconstructed: Example 13. If P 1 Q 1 and P 2 Q 2 then P 1 P 2 Q 1 Q 2. Proof. P 1 P 2 Q 1 P 2 Q 1 Q 2. Intro to process calculi: CCS p.21/25

Proof of soundness Lemma 14. P a iff P a! or P a?. Lemma 15. P τ P iff P P. Theorem 16. =. Proof. Recall that = is defined to be the largest barb and reduction closed congruence. is reduction and barbed closed (the two lemmas) and is a congruence. Hence =. Intro to process calculi: CCS p.22/25

Proof of completeness Theorem 17. =. We need to make sure that the label transitions do not observe too much about the processes. Hence for each label α, we ll find a context which observes the label. Intro to process calculi: CCS p.23/25

Weak equivalences Weak in the jargon of process calculists means that internal reductions are not observable. Definition 18 (Weak bisimulation). A relation R is a weak bisimulation when PRQ and P τ P then Q τ Q PRQ and P α P (α τ) then Q τ α τ Q ; the symmetric versions of the above hold. Definition 19. We will write τp for νa(a! a?p) where a is fresh for P. Example 20. τa! a!. Intro to process calculi: CCS p.24/25

Weak bisimilarity not a congruence The counterexample is very simple, we have τa! a!, but τ a!+b! a!+b!. Weak bisimilarity behaves better with respect to other operators. Intro to process calculi: CCS p.25/25