Multiport Interaction Nets and Concurrency Damiano Mazza Institut - - PowerPoint PPT Presentation
Multiport Interaction Nets and Concurrency Damiano Mazza Institut - - PowerPoint PPT Presentation
Multiport Interaction Nets and Concurrency Damiano Mazza Institut de Math ematiques de Luminy Marseilles, France CONCUR 2005 San Francisco, 23 August 2005 Interaction Net Systems: cells, wires, nets Interaction Net Systems were introduced
Interaction Net Systems: cells, wires, nets
Interaction Net Systems were introduced by Yves Lafont (1990) as a generalization
- f MLL proof-nets. The basic elements of an Interaction Net System (INS for
short) are cells and wires:
α . . .
auxiliary ports principal port wire
Wires can be used to connect occurrences of cells to form nets:
δ δ γ γ γ γ δ ε ε ε ε
A set Σ of cells is called an alphabet. Slide 1/19
Interaction Net Systems: interaction
When two cells are connected through their principal ports, they form an active pair. Active pairs can be reduced by means of interaction rules of the following form:
α . . . . . . β → . . . . . . α ⊲ ⊳ β
◮ α ⊲ ⊳ β is a net whose free ports are in bijection (implicitly given by the graphical
representation) with the auxiliary ports of α, β.
◮ Reduction step: replace an active pair α, β of a net µ with α ⊲ ⊳ β (this is why
a bijection is needed), yielding a new net µ′. We then write µ → µ′.
◮ An INS is defined by an alphabet (maybe infinite, but denumerable) and a set of
interaction rules (at most one per active pair).
◮ We can use a type discipline to limit the possible connections/active pairs.
Slide 2/19
Interaction Net Systems: properties
◮ Strong confluence → no reduction strategies → strong determinism. ◮ Turing-completeness: given a Turing machine, there exists an INS simulating it. ◮ The “right” syntax for the Geometry of Interaction (Girard, 1988, Gonthier-Abadi-
L´ evy, 1992, Interaction Combinators, Yves Lafont, 1995).
◮ All of these properties are a consequence of the locality of interaction. ◮ Limitation: INS’s model distributed, but sequential computation, i.e., there is no
parallel-or, gustave, etc. → truly concurrent behavior is excluded. Slide 3/19
Multiport Interaction Net Systems
Cells are allowed to have more than one principal port (multicells, opposed to mono- cells). Active pairs are still cells having one of their principal ports wired together:
α σi β σj . . . . . . . . . . . . . . . . . . . . . . . . − → . . . . . . . . . . . . αi ⊲ ⊳ βj
We have used the two wirings σi and σj just for graphical convenience; they are not part of the interaction. Notice that a multicell can be involved in several active pairs; the choice of which
- ne is reduced is non-deterministic. Thus, in general, we have lost confluence, but
we have gained in expressive power (parallel-or is easily encodable). Slide 4/19
The “core” π-calculus
The “core” π-calculus (Cπ for short) can be seen as a synchronous and extended version of the Pict language (Pierce and Turner, 1997): Prefixes:
π ::= xy
- x(z)
Extended prefixes:
κ ::= x(z)
- π
Processes:
P, Q ::= 0
- π.P
- P | Q
- ν(z)P
- κ ⊲ P
Reduction:
xy.P | x(z).Q − → P | Q{y/z} xy.P | x(z) ⊲ Q − → P | Q{y/z} | x(z) ⊲ Q x(z) ⊲ P | x(z).Q − → ν(z)(P | Q) | x(z) ⊲ P
Structural congruence: as in the finite π-calculus, i.e., no such thing as
!P ≡ P | !P
Slide 5/19
Names as multicells
We shall now define an encoding of · of Cπ processes into Multiport Interaction Nets. The key point is encoding names, i.e., concurrent communication channels. Multicells are going to be fundamental here:
Xm m principal ports . . .
i/o requests input queue
- utput queue
synchronization
Slide 6/19
Synchronization
Prefixes are encoded by means of two binary monocells π−, π+:
Xm+2 . . . . . . . . . π+ π− − + N C N C
xy.P | x(z).Q | R − → P | Q{y/z} | R
Slide 7/19
Synchronization
Upon interaction, prefixes become queue constructors:
. . . π+ ρ− . . . Xm+1 − + N C N C
xy.P | x(z).Q | R − → P | Q{y/z} | R
Slide 7/19
Synchronization
The i/o queues are built according to the (non-deterministic) reduction order:
. . . Xm − + ρ+ ρ− N C N C
xy.P | x(z).Q | R − → P | Q{y/z} | R
Slide 7/19
Synchronization
The top elements of the two queues eventually meet, implementing synchronization:
. . . Xm ρ+ ρ− N C C N
xy.P | x(z).Q | R − → P | Q{y/z} | R
Slide 7/19
Synchronization
The name sent is connected to the receiver, and the two continuations communicate:
. . . Xm N C C N
xy.P | x(z).Q | R − → P | Q{y/z} | R
Slide 7/19
Name passing
We use a family of monocells Bn (of arity n) to collect the occurrences of a name bound by an input prefix. Name passing is thus implemented by the following rule:
Bn − → . . . . . . . . . . . . . . . ωi Xm+1 Xm+n . . . . . .
Slide 8/19
Guards
To encode guards, we use two families of monocells Λ+
n , Λ− n , of arity 2n:
Λ+
k
Λ−
n
→ . . . . . . . . . . . .
Suppose P is already defined; then we build the net .P as follows:
. . . µ . . . . . . x1 xk c active pairs
contained in P
P = . . . x1 xk µ . . . . . . . . . Λ
k+c
.P = = ⇒
In practice, active pairs (both present and future) are “inhibited”, and restored upon synchronization. Slide 9/19
Replication
We can use two standard duplicator cells δ+, δ−, with the following rules:
− → δn δ1 α α α δ . . . . . . . . . . . . δ+ δ− − → α is any cell except Xm and δ− ωi Xm+1 . . . . . . − → Xm+2 . . . . . . δ+
Problem: only reduced nets containing no Xm or δ cells can be duplicated. Slide 10/19
Replicated guards
Suppose that .P is a net containing n X-cells and (among others) k free ports labelled with the name z:
. . . z z . . . Xm1 . . . Xmn .P = µ . . . . . .
Then, we define ⊲P and ⊲P z as follows:
. . . z z µ . . . . . . . . . . . . !Xm1 !Xk+1 µ . . . σ . . . Nn . . . . . . !Xmn !Xm1 Nn+1 . . . . . . !Xmn . . . ⊲P ⊲P z
Slide 11/19
Replicated guards
We also add a zeroary monocell ϕ with the following interaction rules:
→ ϕ Nn . . . . . . ϕ ϕ . . . Xm . . . ϕ → !Xm
The following property holds:
σ ⊲P . . . ϕ δ− δ+ .P . . . σ ⊲P . . . δ1 δn →∗ . . .
Slide 12/19
Replicated prefixes
Additional monocells !π−, !π+ (arity 4) and !ρ−, !ρ+ (arity 5) are used to encode replicated prefixes and their respective queue constructors. Synchronization of replicated prefixes involves dispatching duplicators and ϕ cells appropriately:
!ρ+ !ρ− − → ϕ δ+ δ+ δ− δ+ ϕ δ+ δ+ δ+ δ− !π+ !π−
There is of course also the “asymmetric” case in which a !ρ cell interacts with a
ρ− cell, in which duplicators are dispatched only on one side.
Slide 13/19
Inductive definition of the encoding
◮ 0 is the empty net. ◮ P | Q is the net obtained by juxtaposing P and Q. ◮ π.P is the following net, depending on the nature of π:
x π+ .P +
xy.P =
. . . y . . . . . . Bn .P − π− x
x(z).P =
. . .
In the encoding of the input prefix, the n free ports of .P − labelled by z are connected to the Bn cell. Slide 14/19
Inductive definition of the encoding
◮ κ ⊲ P is the following net, depending on the nature of κ:
!π+ x x y ⊲P + . . . Bn . . . . . . . . . ⊲P − x !π− x . . . x ⊲P z x !π+ x(z) ⊲ P x(z) ⊲ P xy ⊲ P
◮ If P has m free ports labelled by z, then ν(z)P is the net obtained from P by connecting all such free ports to the free ports of the following net:
. . . Xm
Remark: this is the only case in which active pairs may be introduced. Slide 15/19
The strong encoding
So far the encoding is only able to implement synchronizations which are due on restricted channels, so we force our processes to be “closed”: Definition 1 Let x range over fn(P); if in P there are m free ports labelled by
x, we define [P] as the net obtained from P by connecting all such ports to a Xm+1 cell, which will be left with one free port labelled by x:
Xm+1 . . . x
[P] is virtually identical to ν( x)P, where x are the free names of P , the only
difference being that we want to remember the names we artificially bound. Slide 16/19
Readback
The encoding commutes with reduction only modulo a readback procedure:
. . . Q−
n
. . . Xm Q+
p
. . .
- Xm+n+p
π+ π− !π− !π+ . . . . . . . . . Xm+1 . . . x
- m
m x x
The readback procedure “undoes” the choices made in queuing up prefixes and removes artificial name restrictions. We denote by
ν the readback of a net ν.
Only the reduction of active pairs involving ρ and/or !ρ cells affects the readback. We write µ ։ ν iff the reduction from µ to ν contains exactly one such reduction. Slide 17/19
Properties of the encoding
Proposition 1 If P ≡ Q, then P = Q and [P] = [Q]. This would be impossible if we had admitted !P ≡ P | !P . Notice also that the converse is false; in fact, whenever z does not appear in the prefix π,
ν(z)π.P = π.ν(z)P.
Theorem 2 Let P be a Cπ process.
- 1. The observables of P are in bijection with the free principal ports of P.
- 2. If P
τ
→ Q, then [P] ։ ν and ν = Q.
- 3. If [P] ։ ν, then there exists Q such that P
τ