Вы находитесь на странице: 1из 35

Introduction to CCS

Syntax of CCS
Semantics of CCS
Value Passing CCS

Modelling, Specification and Verification of


Reactive Systems

Milner’s Calculus of Communicating Systems (CCS)

Plan for this part of the course:


Informal introduction to CCS
Syntax of CCS
Semantics of CCS
Milner’s Calculus of Communicating Systems (CCS) Reactive Systems: Mod., Spec. and Ver.
Introduction to CCS Calculus of Communicating Systems
Syntax of CCS Process Algebra
Semantics of CCS CCS Intuitively
Value Passing CCS Parallelism and Renaming

How to Describe LTSes?

Syntax −→ Semantics
unknown entity known entity

−→ what (denotational) or
programming language
how (operational) it computes

−→ Labelled Transition Systems


???
CCS (Milner 1980)

Milner’s Calculus of Communicating Systems (CCS) Reactive Systems: Mod., Spec. and Ver.
Introduction to CCS Calculus of Communicating Systems
Syntax of CCS Process Algebra
Semantics of CCS CCS Intuitively
Value Passing CCS Parallelism and Renaming

How to Describe LTSes?

Syntax −→ Semantics
unknown entity known entity

−→ what (denotational) or
programming language
how (operational) it computes

−→ Labelled Transition Systems


???
CCS (Milner 1980)

Milner’s Calculus of Communicating Systems (CCS) Reactive Systems: Mod., Spec. and Ver.
Introduction to CCS Calculus of Communicating Systems
Syntax of CCS Process Algebra
Semantics of CCS CCS Intuitively
Value Passing CCS Parallelism and Renaming

How to Describe LTSes?

Syntax −→ Semantics
unknown entity known entity

−→ what (denotational) or
programming language
how (operational) it computes

−→ Labelled Transition Systems


???
CCS (Milner 1980)

Milner’s Calculus of Communicating Systems (CCS) Reactive Systems: Mod., Spec. and Ver.
Introduction to CCS Calculus of Communicating Systems
Syntax of CCS Process Algebra
Semantics of CCS CCS Intuitively
Value Passing CCS Parallelism and Renaming

How to Describe LTSes?

Syntax −→ Semantics
unknown entity known entity

−→ what (denotational) or
programming language
how (operational) it computes

−→ Labelled Transition Systems


???
CCS (Milner 1980)

Milner’s Calculus of Communicating Systems (CCS) Reactive Systems: Mod., Spec. and Ver.
Introduction to CCS Calculus of Communicating Systems
Syntax of CCS Process Algebra
Semantics of CCS CCS Intuitively
Value Passing CCS Parallelism and Renaming

Calculus of Communicating Systems

CCS
Process algebra called “Calculus of Communicating Systems”.

Insight of Robin Milner (1980, developed from earlier work)


Concurrent (parallel) processes have an algebraic structure.

P1 op P2 ⇒ P1 op P2

Milner’s Calculus of Communicating Systems (CCS) Reactive Systems: Mod., Spec. and Ver.
Introduction to CCS Calculus of Communicating Systems
Syntax of CCS Process Algebra
Semantics of CCS CCS Intuitively
Value Passing CCS Parallelism and Renaming

Process Algebra
Basic Principle
1 Define a few atomic processes (modelling the simplest process
behaviour).
2 Define new composition operations (building more complex
process behaviour from simpler ones).

Example
1 atomic instruction: assignment (e.g. x:=2 and x:=x+2)
2 new operators:
sequential composition (P1 ; P2 )
parallel composition (P1 | P2 )
Now e.g. (x:=1 | x:=2); x:=x+2; (x:=x-1 | x:=x+5) is a
process.
Milner’s Calculus of Communicating Systems (CCS) Reactive Systems: Mod., Spec. and Ver.
Introduction to CCS Calculus of Communicating Systems
Syntax of CCS Process Algebra
Semantics of CCS CCS Intuitively
Value Passing CCS Parallelism and Renaming

Process Algebra
Basic Principle
1 Define a few atomic processes (modelling the simplest process
behaviour).
2 Define new composition operations (building more complex
process behaviour from simpler ones).

Example
1 atomic instruction: assignment (e.g. x:=2 and x:=x+2)
2 new operators:
sequential composition (P1 ; P2 )
parallel composition (P1 | P2 )
Now e.g. (x:=1 | x:=2); x:=x+2; (x:=x-1 | x:=x+5) is a
process.
Milner’s Calculus of Communicating Systems (CCS) Reactive Systems: Mod., Spec. and Ver.
Introduction to CCS Calculus of Communicating Systems
Syntax of CCS Process Algebra
Semantics of CCS CCS Intuitively
Value Passing CCS Parallelism and Renaming

A CCS Process: Black-Box View

What is a CCS Process to its Environment?


A CCS process is a computing agent that may communicate with
its environment via its interface.
Interface = Collection of communication ports/channels, together
with an indication of whether they are used for input or output.

Example: A Computer Scientist


Process interface: coffee (input port)
coin, pub (output ports)

Question: How do we describe the behaviour of the “black-box”?

Milner’s Calculus of Communicating Systems (CCS) Reactive Systems: Mod., Spec. and Ver.
Introduction to CCS Calculus of Communicating Systems
Syntax of CCS Process Algebra
Semantics of CCS CCS Intuitively
Value Passing CCS Parallelism and Renaming

A CCS Process: Black-Box View

What is a CCS Process to its Environment?


A CCS process is a computing agent that may communicate with
its environment via its interface.
Interface = Collection of communication ports/channels, together
with an indication of whether they are used for input or output.

Example: A Computer Scientist


Process interface: coffee (input port)
coin, pub (output ports)

Question: How do we describe the behaviour of the “black-box”?

Milner’s Calculus of Communicating Systems (CCS) Reactive Systems: Mod., Spec. and Ver.
Introduction to CCS Calculus of Communicating Systems
Syntax of CCS Process Algebra
Semantics of CCS CCS Intuitively
Value Passing CCS Parallelism and Renaming

CCS Basics (Sequential Fragment)

Nil (or 0) process (the only atomic process)


action prefixing (a.P)
def
names and recursive definitions ( = )
nondeterministic choice (+)

This is Enough to Describe Sequential Processes


Any finite LTS can be described (up to isomorphism) by using the
operations above.

Milner’s Calculus of Communicating Systems (CCS) Reactive Systems: Mod., Spec. and Ver.
Introduction to CCS Calculus of Communicating Systems
Syntax of CCS Process Algebra
Semantics of CCS CCS Intuitively
Value Passing CCS Parallelism and Renaming

CCS Basics (Sequential Fragment)

Nil (or 0) process (the only atomic process)


action prefixing (a.P)
def
names and recursive definitions ( = )
nondeterministic choice (+)

This is Enough to Describe Sequential Processes


Any finite LTS can be described (up to isomorphism) by using the
operations above.

Milner’s Calculus of Communicating Systems (CCS) Reactive Systems: Mod., Spec. and Ver.
Introduction to CCS Calculus of Communicating Systems
Syntax of CCS Process Algebra
Semantics of CCS CCS Intuitively
Value Passing CCS Parallelism and Renaming

CCS Basics (Parallelism and Renaming)

parallel composition (|)


(synchronous communication between two components =
handshake synchronization)
restriction (P r L)
relabelling (P[f ])

Milner’s Calculus of Communicating Systems (CCS) Reactive Systems: Mod., Spec. and Ver.
Introduction to CCS Calculus of Communicating Systems
Syntax of CCS Process Algebra
Semantics of CCS CCS Intuitively
Value Passing CCS Parallelism and Renaming

CCS Basics (Parallelism and Renaming)

parallel composition (|)


(synchronous communication between two components =
handshake synchronization)
restriction (P r L)
relabelling (P[f ])

Milner’s Calculus of Communicating Systems (CCS) Reactive Systems: Mod., Spec. and Ver.
Introduction to CCS Calculus of Communicating Systems
Syntax of CCS Process Algebra
Semantics of CCS CCS Intuitively
Value Passing CCS Parallelism and Renaming

CCS Basics (Parallelism and Renaming)

parallel composition (|)


(synchronous communication between two components =
handshake synchronization)
restriction (P r L)
relabelling (P[f ])

Milner’s Calculus of Communicating Systems (CCS) Reactive Systems: Mod., Spec. and Ver.
Introduction to CCS
Notation
Syntax of CCS
CCS Process Expressions
Semantics of CCS
CCS Defining Equations
Value Passing CCS

Definition of CCS (channels, actions, process names)


Let
A be a set of channel names (e.g. tea, coffee are channel
names)

L = A ∪ A be a set of labels where


A = {a | a ∈ A}
(elements of A are called names and those of A are called
co-names)
by convention a = a

Act = L ∪ {τ } is the set of actions where


τ is the internal or silent action
(e.g. τ , tea, coffee are actions)

K is a set of process names (constants) (e.g. CM).


Milner’s Calculus of Communicating Systems (CCS) Reactive Systems: Mod., Spec. and Ver.
Introduction to CCS
Notation
Syntax of CCS
CCS Process Expressions
Semantics of CCS
CCS Defining Equations
Value Passing CCS

Definition of CCS (channels, actions, process names)


Let
A be a set of channel names (e.g. tea, coffee are channel
names)

L = A ∪ A be a set of labels where


A = {a | a ∈ A}
(elements of A are called names and those of A are called
co-names)
by convention a = a

Act = L ∪ {τ } is the set of actions where


τ is the internal or silent action
(e.g. τ , tea, coffee are actions)

K is a set of process names (constants) (e.g. CM).


Milner’s Calculus of Communicating Systems (CCS) Reactive Systems: Mod., Spec. and Ver.
Introduction to CCS
Notation
Syntax of CCS
CCS Process Expressions
Semantics of CCS
CCS Defining Equations
Value Passing CCS

Definition of CCS (channels, actions, process names)


Let
A be a set of channel names (e.g. tea, coffee are channel
names)

L = A ∪ A be a set of labels where


A = {a | a ∈ A}
(elements of A are called names and those of A are called
co-names)
by convention a = a

Act = L ∪ {τ } is the set of actions where


τ is the internal or silent action
(e.g. τ , tea, coffee are actions)

K is a set of process names (constants) (e.g. CM).


Milner’s Calculus of Communicating Systems (CCS) Reactive Systems: Mod., Spec. and Ver.
Introduction to CCS
Notation
Syntax of CCS
CCS Process Expressions
Semantics of CCS
CCS Defining Equations
Value Passing CCS

Definition of CCS (channels, actions, process names)


Let
A be a set of channel names (e.g. tea, coffee are channel
names)

L = A ∪ A be a set of labels where


A = {a | a ∈ A}
(elements of A are called names and those of A are called
co-names)
by convention a = a

Act = L ∪ {τ } is the set of actions where


τ is the internal or silent action
(e.g. τ , tea, coffee are actions)

K is a set of process names (constants) (e.g. CM).


Milner’s Calculus of Communicating Systems (CCS) Reactive Systems: Mod., Spec. and Ver.
Introduction to CCS
Notation
Syntax of CCS
CCS Process Expressions
Semantics of CCS
CCS Defining Equations
Value Passing CCS

Definition of CCS (expressions)


P := K | process constants (K ∈ K)
α.P
P | prefixing (α ∈ Act)
i∈I Pi | summation (I is an arbitrary index set)
P1 |P2 | parallel composition
P rL | restriction (L ⊆ A)
P[f ] | relabelling (f : Act → Act) such that
f (τ ) = τ
f (a) = f (a)

The set of all terms generated by the abstract syntax is the set of
CCS process expressions (and is denoted by P).
Notation
P P
P1 + P2 = i∈{1,2} Pi Nil = 0 = i∈∅ Pi

Milner’s Calculus of Communicating Systems (CCS) Reactive Systems: Mod., Spec. and Ver.
Introduction to CCS
Notation
Syntax of CCS
CCS Process Expressions
Semantics of CCS
CCS Defining Equations
Value Passing CCS

Definition of CCS (expressions)


P := K | process constants (K ∈ K)
α.P
P | prefixing (α ∈ Act)
i∈I Pi | summation (I is an arbitrary index set)
P1 |P2 | parallel composition
P rL | restriction (L ⊆ A)
P[f ] | relabelling (f : Act → Act) such that
f (τ ) = τ
f (a) = f (a)

The set of all terms generated by the abstract syntax is the set of
CCS process expressions (and is denoted by P).
Notation
P P
P1 + P2 = i∈{1,2} Pi Nil = 0 = i∈∅ Pi

Milner’s Calculus of Communicating Systems (CCS) Reactive Systems: Mod., Spec. and Ver.
Introduction to CCS
Notation
Syntax of CCS
CCS Process Expressions
Semantics of CCS
CCS Defining Equations
Value Passing CCS

Definition of CCS (expressions)


P := K | process constants (K ∈ K)
α.P
P | prefixing (α ∈ Act)
i∈I Pi | summation (I is an arbitrary index set)
P1 |P2 | parallel composition
P rL | restriction (L ⊆ A)
P[f ] | relabelling (f : Act → Act) such that
f (τ ) = τ
f (a) = f (a)

The set of all terms generated by the abstract syntax is the set of
CCS process expressions (and is denoted by P).
Notation
P P
P1 + P2 = i∈{1,2} Pi Nil = 0 = i∈∅ Pi

Milner’s Calculus of Communicating Systems (CCS) Reactive Systems: Mod., Spec. and Ver.
Introduction to CCS
Notation
Syntax of CCS
CCS Process Expressions
Semantics of CCS
CCS Defining Equations
Value Passing CCS

Definition of CCS (expressions)


P := K | process constants (K ∈ K)
α.P
P | prefixing (α ∈ Act)
i∈I Pi | summation (I is an arbitrary index set)
P1 |P2 | parallel composition
P rL | restriction (L ⊆ A)
P[f ] | relabelling (f : Act → Act) such that
f (τ ) = τ
f (a) = f (a)

The set of all terms generated by the abstract syntax is the set of
CCS process expressions (and is denoted by P).
Notation
P P
P1 + P2 = i∈{1,2} Pi Nil = 0 = i∈∅ Pi

Milner’s Calculus of Communicating Systems (CCS) Reactive Systems: Mod., Spec. and Ver.
Introduction to CCS
Notation
Syntax of CCS
CCS Process Expressions
Semantics of CCS
CCS Defining Equations
Value Passing CCS

Definition of CCS (expressions)


P := K | process constants (K ∈ K)
α.P
P | prefixing (α ∈ Act)
i∈I Pi | summation (I is an arbitrary index set)
P1 |P2 | parallel composition
P rL | restriction (L ⊆ A)
P[f ] | relabelling (f : Act → Act) such that
f (τ ) = τ
f (a) = f (a)

The set of all terms generated by the abstract syntax is the set of
CCS process expressions (and is denoted by P).
Notation
P P
P1 + P2 = i∈{1,2} Pi Nil = 0 = i∈∅ Pi

Milner’s Calculus of Communicating Systems (CCS) Reactive Systems: Mod., Spec. and Ver.
Introduction to CCS
Notation
Syntax of CCS
CCS Process Expressions
Semantics of CCS
CCS Defining Equations
Value Passing CCS

Definition of CCS (expressions)


P := K | process constants (K ∈ K)
α.P
P | prefixing (α ∈ Act)
i∈I Pi | summation (I is an arbitrary index set)
P1 |P2 | parallel composition
P rL | restriction (L ⊆ A)
P[f ] | relabelling (f : Act → Act) such that
f (τ ) = τ
f (a) = f (a)

The set of all terms generated by the abstract syntax is the set of
CCS process expressions (and is denoted by P).
Notation
P P
P1 + P2 = i∈{1,2} Pi Nil = 0 = i∈∅ Pi

Milner’s Calculus of Communicating Systems (CCS) Reactive Systems: Mod., Spec. and Ver.
Introduction to CCS
Notation
Syntax of CCS
CCS Process Expressions
Semantics of CCS
CCS Defining Equations
Value Passing CCS

Definition of CCS (expressions)


P := K | process constants (K ∈ K)
α.P
P | prefixing (α ∈ Act)
i∈I Pi | summation (I is an arbitrary index set)
P1 |P2 | parallel composition
P rL | restriction (L ⊆ A)
P[f ] | relabelling (f : Act → Act) such that
f (τ ) = τ
f (a) = f (a)

The set of all terms generated by the abstract syntax is the set of
CCS process expressions (and is denoted by P).
Notation
P P
P1 + P2 = i∈{1,2} Pi Nil = 0 = i∈∅ Pi

Milner’s Calculus of Communicating Systems (CCS) Reactive Systems: Mod., Spec. and Ver.
Introduction to CCS
Notation
Syntax of CCS
CCS Process Expressions
Semantics of CCS
CCS Defining Equations
Value Passing CCS

Precedence

Precedence
1 restriction and relabelling (tightest binding)

2 action prefixing
3 parallel composition
4 summation


Example: R + a.P|b.Q r L means R + (a.P)|(b.(Q r L)) .

Milner’s Calculus of Communicating Systems (CCS) Reactive Systems: Mod., Spec. and Ver.
Introduction to CCS
Notation
Syntax of CCS
CCS Process Expressions
Semantics of CCS
CCS Defining Equations
Value Passing CCS

Precedence

Precedence
1 restriction and relabelling (tightest binding)

2 action prefixing
3 parallel composition
4 summation


Example: R + a.P|b.Q r L means R + (a.P)|(b.(Q r L)) .

Milner’s Calculus of Communicating Systems (CCS) Reactive Systems: Mod., Spec. and Ver.
Introduction to CCS
Notation
Syntax of CCS
CCS Process Expressions
Semantics of CCS
CCS Defining Equations
Value Passing CCS

Definition of CCS (defining equations)

CCS program
A collection of defining equations of the form
def
K = P

where K ∈ K is a process constant and P ∈ P is a CCS process


expression.
Only one defining equation per process constant.
def
Recursion is allowed: e.g. A = a.A | A.

Milner’s Calculus of Communicating Systems (CCS) Reactive Systems: Mod., Spec. and Ver.
Introduction to CCS
Motivation
Syntax of CCS
SOS Rules for CCS
Semantics of CCS
Examples
Value Passing CCS

Semantics of CCS

Syntax Semantics
CCS −→ LTS
(collection of defining equations) (labelled transition systems)

HOW?

Milner’s Calculus of Communicating Systems (CCS) Reactive Systems: Mod., Spec. and Ver.
Introduction to CCS
Motivation
Syntax of CCS
SOS Rules for CCS
Semantics of CCS
Examples
Value Passing CCS

Semantics of CCS

Syntax Semantics
CCS −→ LTS
(collection of defining equations) (labelled transition systems)

HOW?

Milner’s Calculus of Communicating Systems (CCS) Reactive Systems: Mod., Spec. and Ver.
Introduction to CCS
Motivation
Syntax of CCS
SOS Rules for CCS
Semantics of CCS
Examples
Value Passing CCS

Semantics of CCS

Syntax Semantics
CCS −→ LTS
(collection of defining equations) (labelled transition systems)

HOW?

Milner’s Calculus of Communicating Systems (CCS) Reactive Systems: Mod., Spec. and Ver.
Introduction to CCS
Motivation
Syntax of CCS
SOS Rules for CCS
Semantics of CCS
Examples
Value Passing CCS

Structural Operational Semantics for CCS


Structural Operational Semantics (SOS)—G. Plotkin 1981
Small-step operational semantics where the behaviour of a system
is inferred using syntax driven rules.

Given a collection of CCS defining equations, we define the


a
following LTS (Proc, Act, {−→| a ∈ Act}):
Proc = P (the set of all CCS process expressions)
Act = L ∪ {τ } (the set of all CCS actions including τ )
transition relation is given by SOS rules of the form:

premises
RULE conditions
conclusion
Milner’s Calculus of Communicating Systems (CCS) Reactive Systems: Mod., Spec. and Ver.
Introduction to CCS
Motivation
Syntax of CCS
SOS Rules for CCS
Semantics of CCS
Examples
Value Passing CCS

Structural Operational Semantics for CCS


Structural Operational Semantics (SOS)—G. Plotkin 1981
Small-step operational semantics where the behaviour of a system
is inferred using syntax driven rules.

Given a collection of CCS defining equations, we define the


a
following LTS (Proc, Act, {−→| a ∈ Act}):
Proc = P (the set of all CCS process expressions)
Act = L ∪ {τ } (the set of all CCS actions including τ )
transition relation is given by SOS rules of the form:

premises
RULE conditions
conclusion
Milner’s Calculus of Communicating Systems (CCS) Reactive Systems: Mod., Spec. and Ver.
Introduction to CCS
Motivation
Syntax of CCS
SOS Rules for CCS
Semantics of CCS
Examples
Value Passing CCS

SOS rules for CCS (α ∈ Act, a ∈ L)


α
Pj −→ Pj0
ACT α SUMj P α j ∈I
α.P −→ P i∈I Pi −→ Pj0
α α
COM1 P −→ P 0 COM2 Q −→ Q 0
α α
P|Q −→ P 0 |Q P|Q −→ P|Q 0
0 a
0 a
COM3 P −→ P τ Q 0−→0 Q
P|Q −→ P |Q
α α
RES P −→ P 0 α, α 6∈ L REL P −→ P 0
α
P r L −→ P 0 r L f (α)
P[f ] −→ P 0 [f ]
α
CON P −→ P 0 K def
= P
α
K −→ P 0

Milner’s Calculus of Communicating Systems (CCS) Reactive Systems: Mod., Spec. and Ver.

Вам также может понравиться