Π-calculus

From testwiki
Jump to navigation Jump to search

Template:Short description

In theoretical computer science, the Template:Pi-calculus (or pi-calculus) is a process calculus. The Template:Pi-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.

The Template:Pi-calculus has few terms and is a small, yet expressive language (see Template:Section link). Functional programs can be encoded into the Template:Pi-calculus, and the encoding emphasises the dialogue nature of computation, drawing connections with game semantics. Extensions of the Template:Pi-calculus, such as the spi calculus and applied Template:Pi, have been successful in reasoning about cryptographic protocols. Beside the original use in describing concurrent systems, the Template:Pi-calculus has also been used to reason about business processes[1] and molecular biology.[2]

Informal definition

The Template:Pi-calculus belongs to the family of process calculi, mathematical formalisms for describing and analyzing properties of concurrent computation. In fact, the Template:Pi-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 Template:Pi-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[3] (a precise definition is given in the following section):

  • concurrency, written PQ, where P and Q are two processes or threads executed concurrently.
  • communication, where
    • input prefixing c(x).P is a process waiting for a message that was sent on a communication channel named c before proceeding as Template:Nowrap binding the name received to the name Template:Nowrap Typically, this models either a process expecting a communication from the network or a label c usable only once by a goto c operation.
    • output prefixing cy.P describes that the name y is emitted on channel c before proceeding as Template:Nowrap Typically, this models either sending a message on the network or a goto c operation.
  • replication, written !P, which may be seen as a process which can always create a new copy of Template:Nowrap Typically, this models either a network service or a label c waiting for any number of goto c operations.
  • creation of a new name, written (νx)P, which may be seen as a process allocating a new constant Template:Mvar within Template:Nowrap The constants of Template:Nowrap are defined by their names only and are always communication channels. Creation of a new name in a process is also called restriction.
  • the nil process, written 0, is a process whose execution is complete and has stopped.

Although the minimalism of the Template:Pi-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 Template:Nowrap have been proposed which take into account distribution or public-key cryptography. The applied Template:Nowrap due to Abadi and Fournet [1] put these various extensions on a formal footing by extending the Template:Nowrap with arbitrary datatypes.

A small example

Below is a tiny example of a process which consists of three parallel components. The channel name Template:Mvar is only known by the first two components.

(νx)(xz.0|x(y).yx.x(y).0)|z(v).vv.0

The first two components are able to communicate on the channel Template:Mvar, and the name Template:Mvar becomes bound to Template:Mvar. The next step in the process is therefore

(νx)(0|zx.x(y).0)|z(v).vv.0

Note that the remaining Template:Mvar is not affected because it is defined in an inner scope. The second and third parallel components can now communicate on the channel name Template:Mvar, and the name Template:Mvar becomes bound to Template:Mvar. The next step in the process is now

(νx)(0|x(y).0|xx.0)

Note that since the local name Template:Mvar has been output, the scope of Template:Mvar is extended to cover the third component as well. Finally, the channel Template:Mvar can be used for sending the name Template:Mvar. After that all concurrently executing processes have stopped

(νx)(0|0|0)

Formal definition

Syntax

Let Χ be a set of objects called names. The abstract syntax for the Template:Pi-calculus is built from the following BNF grammar (where x and y are any names from Χ):[4]

P,Q::=x(y).PReceive on channel x, bind the result to y, then run P|xy.PSend the value y over channel x, then run P|P|QRun P and Q simultaneously|(νx)PCreate a new channel x and run P|!PRepeatedly spawn copies of P|0Terminate the process

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 set of free names of a process in Template:Pi–calculus are defined inductively by the table below. The set of bound names of a process are defined as the names of a process that are not in the set of free names.

Construct Free names
0 None
ax.P a; x; all free names of P
a(x).P a; free names of P except for x
P|Q All free names of P and Q
(νx)P Free names of P except for x
!P All free names of P

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:

  • PQ if Q can be obtained from P by renaming one or more bound names in P.

Axioms for parallel composition:

  • P|QQ|P
  • (P|Q)|RP|(Q|R)
  • P|0P

Axioms for restriction:

  • (νx)(νy)P(νy)(νx)P
  • (νx)00

Axiom for replication:

  • !PP|!P

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 Template:Mvar may be extruded by an output action, causing the scope of Template:Mvar to be extended. In cases where Template:Mvar is a free name of Q, alpha-conversion may be used to allow extension to proceed.

Reduction semantics

We write PP if P can perform a computation step, following which it is now P. This reduction relation is defined as the least relation closed under a set of reduction rules.

The main reduction rule which captures the ability of processes to communicate through channels is the following:

  • xz.P|x(y).QP|Q[z/y]
where Q[z/y] denotes the process Q in which the free name z has been substituted for the free occurrences of y. If a free occurrence of y occurs in a location where z would not be free, alpha-conversion may be required.

There are three additional rules:

  • If PQ then also P|RQ|R.
This rule says that parallel composition does not inhibit computation.
  • If PQ, then also (νx)P(νx)Q.
This rule ensures that computation can proceed underneath a restriction.
  • If PP and PQ and QQ, then also PQ.

The latter rule states that processes that are structurally congruent have the same reductions.

The example revisited

Consider again the process

(νx)(xz.0|x(y).yx.x(y).0)|z(v).vv.0

Applying the definition of the reduction semantics, we get the reduction

(νx)(xz.0|x(y).yx.x(y).0)|z(v).vv.0(νx)(0|zx.x(y).0)|z(v).vv.0

Note how, applying the reduction substitution axiom, free occurrences of y are now labeled as z.

Next, we get the reduction

(νx)(0|zx.x(y).0)|z(v).vv.0(νx)(0|x(y).0|xx.0)

Note that since the local name Template:Mvar has been output, the scope of Template:Mvar 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

(νx)(0|0|0)

Finally, using the axioms for parallel composition and restriction, we get

0

Labelled semantics

Alternatively, one may give the pi-calculus a labelled transition semantics (as has been done with the Calculus of Communicating Systems).
In this semantics, a transition from a state P to some other state P after an action α is notated as:

  • PαP

Where states P and P represent processes and α is either an input action a(x), an output action ax, or a silent action Template:Mvar.[5]

A standard result about the labelled semantics is that it agrees with the reduction semantics up to structural congruence, in the sense that PP if and only if PτP [6]

Extensions and variants

The syntax given above is a minimal one. However, the syntax may be modified in various ways.

A nondeterministic choice operator P+Q can be added to the syntax.

A test for name equality [x=y]P can be added to the syntax. This match operator can proceed as P if and only if Template:Mvar and y are the same name. Similarly, one may add a mismatch operator for name inequality. Practical programs which can pass names (URLs or pointers) often use such functionality: for directly modeling such functionality inside the calculus, this and related extensions are often useful.

The asynchronous Template:Pi-calculus[7][8] allows only outputs with no continuation, i.e. output atoms of the form xy, yielding a smaller calculus. However, any process in the original calculus can be represented by the smaller asynchronous Template:Pi-calculus using an extra channel to simulate explicit acknowledgement from the receiving process. Since a continuation-free output can model a message-in-transit, this fragment shows that the original Template:Pi-calculus, which is intuitively based on synchronous communication, has an expressive asynchronous communication model inside its syntax. However, the nondeterministic choice operator defined above cannot be expressed in this way, as an unguarded choice would be converted into a guarded one; this fact has been used to demonstrate that the asynchronous calculus is strictly less expressive than the synchronous one (with the choice operator).[9]

The polyadic Template:Pi-calculus allows communicating more than one name in a single action: xz1,...,zn.P (polyadic output) and x(z1,...,zn).P (polyadic input). This polyadic extension, which is useful especially when studying types for name passing processes, can be encoded in the monadic calculus by passing the name of a private channel through which the multiple arguments are then passed in sequence. The encoding is defined recursively by the clauses

xy1,,yn.P is encoded as (νw)xw.wy1..wyn.[P]

x(y1,,yn).P is encoded as x(w).w(y1)..w(yn).[P]

All other process constructs are left unchanged by the encoding.

In the above, [P] denotes the encoding of all prefixes in the continuation P in the same way.

The full power of replication !P is not needed. Often, one only considers replicated input !x(y).P, whose structural congruence axiom is !x(y).Px(y).P|!x(y).P.

Replicated input process such as !x(y).P can be understood as servers, waiting on channel Template:Mvar to be invoked by clients. Invocation of a server spawns a new copy of the process P[a/y], where a is the name passed by the client to the server, during the latter's invocation.

A higher order Template:Pi-calculus can be defined where not only names but processes are sent through channels. The key reduction rule for the higher order case is

xR.P|x(Y).QP|Q[R/Y]

Here, Y denotes a process variable which can be instantiated by a process term. Sangiorgi established that the ability to pass processes does not increase the expressivity of the Template:Pi-calculus: passing a process P can be simulated by just passing a name that points to P instead.

Properties

Turing completeness

The Template:Pi-calculus is a universal model of computation. This was first observed by Milner in his paper "Functions as Processes",[10] in which he presents two encodings of the lambda-calculus in the Template:Pi-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, "Template:Mvar is bound to term M" – as replicating agents that respond to requests for their bindings by sending back a connection to the term M.

The features of the Template:Pi-calculus that make these encodings possible are name-passing and replication (or, equivalently, recursively defined agents). In the absence of replication/recursion, the Template:Pi-calculus ceases to be Turing-complete. This can be seen by the fact that bisimulation equivalence becomes decidable for the recursion-free calculus and even for the finite-control Template:Pi-calculus where the number of parallel components in any process is bounded by a constant.[11]

Bisimulations in the Template:Pi-calculus

Template:See also

As for process calculi, the Template:Pi-calculus allows for a definition of bisimulation equivalence. In the Template:Pi-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 Template:Pi-calculus: Early, late and open bisimilarity. This stems from the fact that the Template:Pi-calculus is a value-passing process calculus.

In the remainder of this section, we let p and q denote processes and R denote binary relations over processes.

Early and late bisimilarity

Early and late bisimilarity were both formulated by Milner, Parrow and Walker in their original paper on the Template:Pi-calculus.[12]

A binary relation R over processes is an early bisimulation if for every pair of processes (p,q)R,

  • whenever pa(x)p then for every name y there exists some q such that qa(x)q and (p[y/x],q[y/x])R;
  • for any non-input action α, if pαp then there exists some q such that qαq and (p,q)R;
  • and symmetric requirements with p and q interchanged.

Processes p and q are said to be early bisimilar, written peq if the pair (p,q)R for some early bisimulation R.

In late bisimilarity, the transition match must be independent of the name being transmitted. A binary relation R over processes is a late bisimulation if for every pair of processes (p,q)R,

  • whenever pa(x)p then for some q it holds that qa(x)q and (p[y/x],q[y/x])R for every name y;
  • for any non-input action α, if pαp implies that there exists some q such that qαqand (p,q)R;
  • and symmetric requirements with p and q interchanged.

Processes p and q are said to be late bisimilar, written plq if the pair (p,q)R for some late bisimulation R.

Both e and l suffer from the problem that they are not congruence relations in the sense that they are not preserved by all process constructs. More precisely, there exist processes p and q such that peq but a(x).pea(x).q. One may remedy this problem by considering the maximal congruence relations included in e and l, known as early congruence and late congruence, respectively.

Open bisimilarity

Fortunately, a third definition is possible, which avoids this problem, namely that of open bisimilarity, due to Sangiorgi.[13]

A binary relation R over processes is an open bisimulation if for every pair of elements (p,q)R and for every name substitution σ and every action α, whenever pσαp then there exists some q such that qσαq and (p,q)R.

Processes p and q are said to be open bisimilar, written poq if the pair (p,q)R for some open bisimulation R.

Early, late and open bisimilarity are distinct

Early, late and open bisimilarity are distinct. The containments are proper, so ole.

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. 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 pa if process p immediately allows an input or an output on name a.

A binary relation R over processes is a barbed bisimulation if it is a symmetric relation which satisfies that for every pair of elements (p,q)R we have that

(1) pa if and only if qa for every name a

and

(2) for every reduction pp there exists a reduction qq

such that (p,q)R.

We say that p and q are barbed bisimilar if there exists a barbed bisimulation R where (p,q)R.

Defining a context as a Template:Pi term with a hole [] we say that two processes P and Q are barbed congruent, written PbQ, if for every context C[] we have that C[P] and C[Q] are barbed bisimilar. It turns out that barbed congruence coincides with the congruence induced by early bisimilarity.

Applications

The Template:Pi-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 Template:Pi-calculus, the Spi-calculus, as a formal notation for describing and reasoning about cryptographic protocols. The spi-calculus extends the Template:Pi-calculus with primitives for encryption and decryption. In 2001, Martin Abadi and Cedric Fournet generalised the handling of cryptographic protocols to produce the applied Template:Pi calculus. There is now a large body of work devoted to variants of the applied Template:Pi calculus, including a number of experimental verification tools. One example is the tool ProVerif [2] due to Bruno Blanchet, based on a translation of the applied Template:Pi-calculus into Blanchet's logic programming framework. Another example is Cryptyc [3], 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 Template:Pi-calculus would become a description tool for modeling business processes. By July 2006, there is discussion in the community about how useful this would be. Most recently, the Template:Pi-calculus has formed the theoretical basis of Business Process Modeling Language (BPML), and of Microsoft's XLANG.[14]

The Template:Pi-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 Template:Pi-calculus.[2] Following this seminal paper, other authors described the whole metabolic network of a minimal cell.[15] In 2009, Anthony Nash and Sara Kalvala proposed a Template:Pi-calculus framework to model the signal transduction that directs Dictyostelium discoideum aggregation.[16]

History

The Template:Pi-calculus was originally developed by Robin Milner, Joachim Parrow and David Walker in 1992, based on ideas by Uffe Engberg and Mogens Nielsen.[17] 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 Template:Pi-calculus as an attempt to capture the uniformity of values and processes in actors.[18]

Implementations

The following programming languages implement the Template:Pi-calculus or one of its variants:

Notes

Template:Reflist

References

Template:Concurrent computing Template:Authority control

  1. OMG Specification (2011). "Business Process Model and Notation (BPMN) Version 2.0", Object Management Group. p.21
  2. 2.0 2.1 Template:Cite journal
  3. Template:Cite web
  4. A Calculus of Mobile Processes part 1 page 10, by R. Milner, J. Parrow and D. Walker published in Information and Computation 100(1) pp.1-40, Sept 1992
  5. Robin Milner, Communicating and Mobile Systems: The Pi Calculus, Cambridge University Press, Template:ISBN. 1999
  6. Sangiorgi, D., & Walker, D. (2003). p51, The Pi-Calculus. Cambridge University Press.
  7. Template:Cite book
  8. Template:Cite book
  9. Template:Cite journal
  10. Template:Cite journal
  11. Template:Cite journal
  12. Template:Cite journal
  13. Template:Cite journal
  14. "BPML | BPEL4WS: A Convergence Path toward a Standard BPM Stack." BPMI.org Position Paper. August 15, 2002.
  15. Template:Cite journal
  16. Template:Cite journal
  17. Template:Cite journal
  18. Template:Cite journal