![]() | ||
In theoretical computer science, the π-calculus (or pi-calculus) is a process calculus. The π-calculus allows channel names to be communicated along the channels themselves, and in this way it is able to describe concurrent computations whose network configuration may change during the computation.
Contents
- Informal definition
- Process constructs
- A small example
- Syntax
- Structural congruence
- Reduction semantics
- The example revisited
- Labelled semantics
- Extensions and variants
- Turing completeness
- Bisimulations in the calculus
- Early and late bisimilarity
- Open bisimilarity
- Early late and open bisimilarity are distinct
- Barbed equivalence
- Applications
- History
- Implementations
- References
The π-calculus is elegantly simple, it has very few terms and so is a very small language [2], yet is very expressive. Functional programs can be encoded into the π-calculus, and the encoding emphasises the dialogue nature of computation, drawing connections with game semantics. Extensions of the π-calculus, such as the spi calculus and applied π, have been successful in reasoning about cryptographic protocols. Beside the original use in describing concurrent systems, the π-calculus has also been used to reason about business processes and molecular biology.
Informal definition
The π-calculus belongs to the family of process calculi, mathematical formalisms for describing and analyzing properties of concurrent computation. In fact, the π-calculus, like the λ-calculus, is so minimal that it does not contain primitives such as numbers, booleans, data structures, variables, functions, or even the usual control flow statements (such as if-then-else
, while
).
Process constructs
Central to the π-calculus is the notion of name. The simplicity of the calculus lies in the dual role that names play as communication channels and variables.
The process constructs available in the calculus are the following (a precise definition is given in the following section):
c
usable only once by a goto c
operation.goto c
operation.c
waiting for any number of goto c
operations.Although the minimalism of the π-calculus prevents us from writing programs in the normal sense, it is easy to extend the calculus. In particular, it is easy to define both control structures such as recursion, loops and sequential composition and datatypes such as first-order functions, truth values, lists and integers. Moreover, extensions of the π-calculus have been proposed which take into account distribution or public-key cryptography. The applied π-calculus due to Abadi and Fournet [3] put these various extensions on a formal footing by extending the π-calculus with arbitrary datatypes.
A small example
Below is a tiny example of a process which consists of three parallel components. The channel name x is only known by the first two components.
The first two components are able to communicate on the channel x, and the name
Note that the remaining
Note that since the local name x has been output, the scope of x is extended to cover the third component as well. Finally, the channel x can be used for sending the name x. After that all concurrently executing processes have stopped
Syntax
Let Χ be a set of objects called names. The abstract syntax for the π-calculus is built from the following BNF grammar (where x and y are any names from Χ):
In the concrete syntax below, the prefixes bind more tightly than the parallel composition (|), and parentheses are used to disambiguate.
Names are bound by the restriction and input prefix constructs. Formally, the sets of free and bound names of a process in π–calculus are defined inductively as follows.
Structural congruence
Central to both the reduction semantics and the labelled transition semantics is the notion of structural congruence. Two processes are structurally congruent, if they are identical up to structure. In particular, parallel composition is commutative and associative.
More precisely, structural congruence is defined as the least equivalence relation preserved by the process constructs and satisfying:
Alpha-conversion:
Axioms for parallel composition:
Axioms for restriction:
Axiom for replication:
Axiom relating restriction and parallel:
This last axiom is known as the "scope extension" axiom. This axiom is central, since it describes how a bound name x may be extruded by an output action, causing the scope of x to be extended. In cases where x is a free name of
Reduction semantics
We write
The main reduction rule which captures the ability of processes to communicate through channels is the following:
There are three additional rules:
The latter rule states that processes that are structurally congruent have the same reductions.
The example revisited
Consider again the process
Applying the definition of the reduction semantics, we get the reduction
Note how, applying the reduction substitution axiom, free occurrences of
Next, we get the reduction
Note that since the local name x has been output, the scope of x is extended to cover the third component as well. This was captured using the scope extension axiom.
Next, using the reduction substitution axiom, we get
Finally, using the axioms for parallel composition and restriction, we get
Labelled semantics
Alternatively, one may give the pi-calculus a labelled transition semantics (as has been done with the Calculus of Communicating Systems). Transitions in this semantics are of the form:
This notation signifies that
A standard result about the labelled semantics is that it agrees with the reduction semantics in the sense that
Extensions and variants
The syntax given above is a minimal one. However, the syntax may be modified in various ways.
A nondeterministic choice operator
A test for name equality
The asynchronous π-calculus allows only outputs with no suffix, i.e. output atoms of the form
The polyadic π-calculus allows communicating more than one name in a single action:
All other process constructs are left unchanged by the encoding.
In the above,
The full power of replication
Replicated input process such as
A higher order π-calculus can be defined where not only names but processes are sent through channels. The key reduction rule for the higher order case is
Here,
Turing completeness
The π-calculus is a universal model of computation. This was first observed by Milner in his paper "Functions as Processes", in which he presents two encodings of the lambda-calculus in the π-calculus. One encoding simulates the eager (call-by-value) evaluation strategy, the other encoding simulates the normal-order (call-by-name) strategy. In both of these, the crucial insight is the modeling of environment bindings – for instance, "x is bound to term
The features of the π-calculus that make these encodings possible are name-passing and replication (or, equivalently, recursively defined agents). In the absence of replication/recursion, the π-calculus ceases to be Turing-powerful. This can be seen by the fact that bisimulation equivalence becomes decidable for the recursion-free calculus and even for the finite-control π-calculus where the number of parallel components in any process is bounded by a constant.
Bisimulations in the π-calculus
As for process calculi, the π-calculus allows for a definition of bisimulation equivalence. In the π-calculus, the definition of bisimulation equivalence (also known as bisimilarity) may be based on either the reduction semantics or on the labelled transition semantics.
There are (at least) three different ways of defining labelled bisimulation equivalence in the π-calculus: Early, late and open bisimilarity. This stems from the fact that the π-calculus is a value-passing process calculus.
In the remainder of this section, we let
Early and late bisimilarity
Early and late bisimilarity were both formulated by Milner, Parrow and Walker in their original paper on the π-calculus.
A binary relation
Processes
In late bisimilarity, the transition match must be independent of the name being transmitted. A binary relation
Processes
Both
Open bisimilarity
Fortunately, a third definition is possible, which avoids this problem, namely that of open bisimilarity, due to Sangiorgi.
A binary relation
Processes
Early, late and open bisimilarity are distinct
Early, late and open bisimilarity are distinct. The containments are proper, so
In certain subcalculi such as the asynchronous pi-calculus, late, early and open bisimilarity are known to coincide. However, in this setting a more appropriate notion is that of asynchronous bisimilarity.
The reader should note that, in the literature, the term open bisimulation usually refers to a more sophisticated notion, where processes and relations are indexed by distinction relations; details are in Sangiorgi's paper cited above.
Barbed equivalence
Alternatively, one may define bisimulation equivalence directly from the reduction semantics. We write
A binary relation
and
(2) for every reductionsuch that
We say that
Defining a context as a π term with a hole [] we say that two processes P and Q are barbed congruent, written
Applications
The π-calculus has been used to describe many different kinds of concurrent systems. In fact, some of the most recent applications lie outside the realm of traditional computer science.
In 1997, Martin Abadi and Andrew Gordon proposed an extension of the π-calculus, the Spi-calculus, as a formal notation for describing and reasoning about cryptographic protocols. The spi-calculus extends the π-calculus with primitives for encryption and decryption. In 2001, Martin Abadi and Cedric Fournet generalised the handling of cryptographic protocols to produce the applied π calculus. There is now a large body of work devoted to variants of the applied π calculus, including a number of experimental verification tools. One example is the tool ProVerif [4] due to Bruno Blanchet, based on a translation of the applied π-calculus into Blanchet's logic programming framework. Another example is Cryptyc [5], due to Andrew Gordon and Alan Jeffrey, which uses Woo and Lam's method of correspondence assertions as the basis for type systems that can check for authentication properties of cryptographic protocols.
Around 2002, Howard Smith and Peter Fingar became interested that π-calculus would become a description tool for modelling business processes. By July 2006, there is discussion in the community about how useful this would be. Most recently, the π-calculus has formed the theoretical basis of Business Process Modeling Language (BPML), and of Microsoft's XLANG.
The π-calculus has also attracted interest in molecular biology. In 1999, Aviv Regev and Ehud Shapiro showed that one can describe a cellular signaling pathway (the so-called RTK/MAPK cascade) and in particular the molecular "lego" which implements these tasks of communication in an extension of the π-calculus. Following this seminal paper, other authors described the whole metabolic network of a minimal cell.
History
The π-calculus was originally developed by Robin Milner, Joachim Parrow and David Walker in 1992, based on ideas by Uffe Engberg and Mogens Nielsen. It can be seen as a continuation of Milner's work on the process calculus CCS (Calculus of Communicating Systems). In his Turing lecture, Milner describes the development of the π-calculus as an attempt to capture the uniformity of values and processes in actors.
Implementations
The following programming languages are implementations either of the π-calculus or of its variants: