Content uploaded by Ugo Montanari

Author content

All content in this area was uploaded by Ugo Montanari on Sep 10, 2015

Content may be subject to copyright.

Logical Methods in Computer Science

Vol. 9(3:16)2013, pp. 1–65

www.lmcs-online.org

Submitted Apr. 5, 2012

Published Sep. 17, 2013

CONNECTOR ALGEBRAS FOR C/E AND P/T NETS’ INTERACTIONS

ROBERTO BRUNI

a

, HERN

´

AN MELGRATTI

b

, UGO MONTANARI

c

, AND PAWE L SOBOCI

´

NSKI

d

a,c

Dipartimento di Informatica, Universit`a di Pisa - Largo Bruno Pontecorvo 3, I-56127 Pisa, Italy

e-mail address: {bruni,ugo}@di.unipi.it

b

Departamento de Computaci´on, FCEyN, Universidad de Buenos Aires - CONICET. Pabell´on I,

Ciudad Universitaria, (C1428EGA) Buenos Aires, Argentina

e-mail address: hmelgra@dc.uba.ar

d

ECS, University of Southampton, SO17 1BJ United Kingdom

e-mail address: ps@ecs.soton.ac.uk

Abstract. A quite ﬂourishing research thread in the recent literature on component-

based systems is concerned with the algebraic properties of diﬀerent classes of connectors.

In a recent paper, an algebra of stateless connectors was presented that consists of ﬁve

kinds of basic connectors, namely symmetry, synchronization, mutual exclusion, hiding

and inaction, plus their duals, and it was shown how they can be freely composed in series

and in parallel to model sophisticated “glues”. In this paper we explore the expressiveness

of stateful connectors obtained by adding one-place buﬀers or unbounded buﬀers to the

stateless connectors. The main results are: i) we show how diﬀerent classes of connectors

exactly correspond to suitable classes of Petri nets equipped with compositional interfaces,

called nets with boundaries; ii) we show that the diﬀerence between strong and weak

semantics in stateful connectors is reﬂected in the semantics of nets with boundaries by

moving from the classic step semantics (strong case) to a novel banking semantics (weak

case), where a step can be executed by taking some “debit” tokens to be given back during

the same step; iii) we show that the corresponding bisimilarities are congruences (w.r.t.

composition of connectors in series and in parallel); iv) we show that suitable monoidality

laws, like those arising when representing stateful connectors in the tile model, can nicely

capture concurrency (in the sense of step semantics) aspects; and v) as a side result, we

provide a basic algebra, with a ﬁnite set of symbols, out of which we can compose all P/T

nets with boundaries, fulﬁlling a long standing quest.

1. Introduction

A successful and widely adopted approach to modern software architectures is the so-called

component-based approach [42]. At its core, it is centred around three main kinds of el-

ements: processing elements (also called components), data elements and connecting ele-

ments (also called connectors). The main idea is to assemble heterogeneous and separately

2012 ACM CCS: [Theory of computation]: Models of computation—Concurrency; Formal languages

and automata theory—Formalisms.

Key words and phrases: C/E nets with boundaries; P/T nets with boundaries; connector algebras; tiles.

LOGICAL METHODS

IN COMPUTER SCIENCE DOI:10.2168/LMCS-9(3:16)2013

c

R. Bruni, H. Melgratti, U. Montanari, and P. Soboci

´

nski

CC

Creative Commons

2 R. BRUNI, H. MELGRATTI, U. MONTANARI, AND P. SOBOCI

´

NSKI

developed components that exchange data items via their programming interfaces by syn-

thesising the appropriate “glue” code, i.e., by linking components via connectors. In this

sense, connectors must take care of all those aspects that lie outside of the scopes of individ-

ual components and for which the operating infrastructure is held responsible. Typically,

components and connectors are made available and assembled oﬀ-the-shelf. To favour their

re-usability, their semantic properties, including requirements and oﬀered guarantees must

be unambiguously speciﬁed. Thus, connectors are ﬁrst class entities and assessing rigorous

mathematical theories for them is of crucial relevance for the analysis of component-based

systems.

Connectors can live at diﬀerent levels of abstraction (architecture, software, processes)

and several kinds of connectors have been studied in the literature [1, 26, 14, 11, 6]. Here

we focus on the approach initiated in [13] and continued in [14], where a basic algebra of

stateless connectors was presented. It consists of ﬁve kinds of basic connectors (plus their

duals), namely symmetry, synchronisation, mutual exclusion, hiding and inaction. The

connectors can be composed in series or in parallel and the resulting circuits are equipped

with a normal form axiomatization. These circuits are quite expressive: they can model

the coordination aspects of the architectural design language CommUnity [26] and, using in

addition a simple 1-state buﬀer, the classic set of “channels” provided by the coordination

language Reo [1] (see [2]).

In [49, 15] the aforementioned stateless connectors were presented in process algebra

form and given a subtly diﬀerent operational semantics, emphasising the role of the algebra

of labels, in particular with a label 0 meaning inaction [49] and, in [15] with a monoidal

structure (of which 0 is the identity). Moreover, they were extended with certain simple

buﬀer components: one-place buﬀers in [49] and unbounded buﬀers in [15]. In both cases

close semantic correspondences were shown to exist with certain versions of Petri nets, called

nets with boundaries. They come equipped with left- and right-interfaces to be exploited

for composition. Interfaces are just plain lists of ports (not just shared places) that are used

to coordinate the ﬁring of net transitions with the surrounding environment.

Petri nets [45] are frequently used both in theoretical and applied research to specify

systems and visualise their behaviour. On the other hand, process algebras are built around

the principle of compositionality: their semantics is given structurally so that the behaviour

of the whole system is a function of the behaviour of its subsystems. As a consequence, the

two are associated with diﬀerent modelling methodologies and reasoning techniques. This

paper improves and extends the results of [49, 15], which were initial and fragmented in

the two aforementioned papers. Our results bridge the gap between the Petri net theory

and process algebra by showing very close semantic correspondence between a family of

process algebras based on connectors on the one hand and a family of nets with boundaries

on the other. Still, we want to stress out the fact that our operators for composition of

systems and interaction are fundamentally diﬀerent to those traditionally considered by

process algebraists.

As usual, in the case of Condition/Event systems (C/E nets), each place can contain

a token at most, and transitions compete both for resources in their presets and their

postsets—two transitions that produce a token at the same place cannot ﬁre together. In the

case of Place/Transition systems (P/T nets), each place can contain an unbounded number

of tokens, arcs between places and transitions are weighted, with the weights deﬁning how

many tokens are produced/consumed in each place by a single ﬁring of the transition, and

CONNECTOR ALGEBRAS FOR C/E AND P/T NETS’ INTERACTIONS 3

the ﬁring of a transition is allowed also when some tokens are already present in its post-

set. In both cases, ports of the interface can be connected to transitions to account for the

interactions with the environment when a transition ﬁres.

We focus on the step semantics, where (multi)sets of transitions can ﬁre at the same

time. In the case of P/T nets we consider two diﬀerent kinds of semantics: an ordinary

ﬁring semantics in which a concurrently enabled multiset of transitions can ﬁre together, as

well as a second semantics in which any multiset of transitions can ﬁre together when the

number of tokens consumed from each place does not exceed the number of tokens available

at the beginning plus those that are produced. This means that not all of the transitions

are necessarily enabled at the start: by analogy with the bank system, we can consider that

the multiset of transitions is enabled by each place in the net initially taking some “loan”

tokens that are given back after the ﬁring. Because of this analogy we will refer to this

semantics as the banking semantics. The weak semantics resembles the ﬁring condition for

P/T nets with a/sync places proposed in [32, 33, 34], in which tokens in a/sync places can

be produced and consumed at the same execution step.

In the case of C/E nets we also consider two diﬀerent kinds of semantics: in the strong

one, non-interfering sets of enabled transitions can ﬁre at the same time; in the weak one,

multisets of transitions can ﬁre at the same time, as for P/T nets, as long as the capacity of

places is not exceeded after the ﬁring. Still, several alternatives are also possible, depending

on the order in which the tokens are assumed to be consumed and produced during the step.

For example, if we assume that ﬁrst all transitions consume the tokens and then new tokens

are produced, we have a step semantics that is more liberal than the strong one, but stricter

than the weak one. Essentially, the possible diﬀerent semantics are those studied for nets

with (place) capacities in [21], when regarding C/E nets as P/T nets with capacity one for

all places. All the alternatives are discussed in Remark 6.3, and the results presented in

this paper smoothly extend to each variant.

On the process algebra side, we call Petri calculus the calculus of connectors accounting

for C/E nets and P/T calculus the one accounting for P/T nets. Quite surprisingly, we show

that the same set of stateless connectors is needed to deal with C/E nets with boundaries

and with P/T nets with boundaries. The diﬀerence is the use of one-state buﬀers for C/E

nets and unbounded buﬀers for P/T nets. Our studies also show that the correspondence

results between connectors and nets carry over the preferred model of coordination, just

depending on the absence or presence of a simple rule (called (Weak)) for composing consec-

utive steps of the operational semantics, using a natural monoidal structure on the set of

labels. Remark 6.3 shows that the diﬀerent semantics for C/E nets can be easily classiﬁed

by changing the operational semantics rules for one-state buﬀers.

While the Petri calculus relies on a ﬁnite set of symbols and rules, one possible drawback

of the P/T calculus is that it requires a ﬁnite scheme of rules, that are parametric on some

natural numbers. Then, we show that by using the tile model [27] this limitation can

be overcome and P/T nets can be modelled using a ﬁnite set of symbols and tiles. The

technical key to achieve the main result is the functoriality of the monoid of observations

w.r.t. the so-called vertical composition of tiles. To be more precise, since interfaces are

lists of ports and we want to observe, at each port, how many steps are performed and how

many tokens are exchanged during each step, we take lists of sequences of natural numbers

as observations. Since we want to deal with a ﬁnite set of symbols, we represent any natural

number n as the sequence of symbol 1 of length n. Notably, the observation 0 is just the

identity of the category of observations. Roughly, the functoriality law of the monoid of

4 R. BRUNI, H. MELGRATTI, U. MONTANARI, AND P. SOBOCI

´

NSKI

observations establishes that observations at diﬀerent ports are not necessarily “aligned” or

synchronised. Yet, in the strong case, we want to separate the tokens exchanged in one step

from the tokens exchanged at the next step. This is achieved by introducing an additional

symbol τ as a separator and we show that it can be used to align independent sequences

by a default policy.

Overall, the Petri calculus and tile model provide small, basic algebras of nets, out of

which we can build any C/E and P/T nets with boundaries compositionally. As discussed in

the section on related work, this result provides our personal answer to a long-standing quest

for the universal algebra, both sound and complete, of nets. Although we are aware that

the constants we start from reduce nets to their very basic atoms and hence their algebra is

very ﬁne grained and cannot provide by itself the right level of abstraction for manipulating

complex systems, we argue that one can still look for building suitable “macros” as derived

operators on our basic atoms and then work in the corresponding subalgebra. Note also

that the only forms of composition we rely on are the parallel and sequential compositions

that constitute essential operations and should always be present. We think the key novel

issue in our setting is a simple but powerful notion of interface, that exposes “pending arcs”,

unlike classical approaches, where places and/or transitions are exposed. Additionally, it

allows to attach many competing pending arcs to the same port.

Origin of the work. In [49] the fourth author employed essentially the same stateful ex-

tension of the connector algebra to compose Condition-Event (C/E) Petri nets (with con-

sume/produce loops). Technically speaking, the contribution in [49] can be summarised

as follows. C/E nets with boundaries are ﬁrst introduced that can be composed in series

and in parallel and come equipped with a bisimilarity semantics. Then, a suitable instance

of the wire calculus from [48] is presented, called Petri calculus, that models circuit dia-

grams with one-place buﬀers and interfaces. The ﬁrst result enlightens a tight semantics

correspondence: it is shown that a Petri calculus process can be deﬁned for each net such

that the translation preserves and reﬂects the semantics. The second result provides the

converse translation, from Petri calculus to nets. Unfortunately, some problems arise in the

latter direction that complicate a compositional deﬁnition of the encoding: Petri calculus

processes must be normalised before translating them, via a set of transformation rules that

add new buﬀers to the circuit (and thus new places to the net). The diﬀerence between the

work in [49] and the results presented in this paper are: i) by improving the deﬁnition of

C/E nets with boundaries we simplify the translation from Petri calculus to nets, avoiding

the normalisation procedure and giving a compositional encoding; ii) the weak semantics

is novel to this paper. The idea of composing nets via boundaries made of ports was novel

to [49].

In [15] the ﬁrst three authors exploited the tile model to extend the correspondence re-

sult of [49] to deal with P/T nets with boundaries, providing an elegant and compositional

translation from the relevant tile model to P/T nets that neither involves normalising trans-

formation, nor introduces additional places. During the preparation of this full version, we

realised that since the τ observations were not considered there, the semantics addressed

in the correspondence was the weak one, not the strong one. As a consequence, the main

theorem, stating the correspondence in both directions, worked in one direction only (from

nets to tiles) and not in the opposite direction (tiles allowed for more behaviours than nets).

The diﬀerence between the work in [15] and the results presented in this paper are: i) we

changed the arity of the symbol for modelling tokens (from arity (1, 1) to (0, 1)) because we

CONNECTOR ALGEBRAS FOR C/E AND P/T NETS’ INTERACTIONS 5

found it more convenient in many proofs (but the change has no consequences whatsoever

on the overall expressiveness of the model); ii) we ﬁxed the correspondence theorems for

the strong case by introducing the τ observations (only one basic tile needs to be adjusted);

iii) we ﬁxed the correspondence theorems for the weak case by ﬁnding a more compact and

elegant presentation of the P/T net semantics (in terms of multisets of transitions instead of

processes). Incidentally the idea of the banking semantics for our weak coordination model

originated from the tile semantics in [15].

The deﬁnition of the P/T calculus is also a novel contribution of this paper. Its main

advantages are: i) in the strong case, it can be seen as the natural extension of the Petri

calculus (where only 0 and 1 are observed) to deal with P/T nets (where any natural

number can be observed); ii) the extension to the weak case relies on exactly the same rule

as the Petri calculus ((Weak)); iii) it oﬀers a convenient intermediate model for proving the

correspondence between the tile model and the P/T nets with boundaries.

Roadmap. The content of this paper is of a rather technical nature but is self-contained, in

the sense that we do not assume the reader be familiar with nets, process algebras, category

theory or tile model. As it may be evident by the above introduction, this work addresses

the expressiveness of connectors models along several dimension: i) semantics, we can move

from the strong view (“clockwork” steps) to the weak view (that matches with banking

semantics); ii) models, we can move from C/E nets to P/T nets; iii) algebras, we can move

from the Petri calculus and P/T calculus to instances of the tile model.

The ﬁrst part of the paper is devoted to two categories of nets with boundaries, C/E

nets and P/T nets. The transitions of the composed net are minimal synchronisations (see

Deﬁnitions 3.2 and 4.3) of transitions of the original nets. To each model of net we assign

a labelled semantics, in the case of P/T nets we study both a strong semantics and a weak

semantics that captures the banking semantics of P/T nets. The key results (Theorem 3.8

for C/E nets and Theorem 4.9 for P/T nets) are that labelled transitions are compatible

with composition of nets. These results guarantee that (labelled) bisimilarity of nets is

always compositional.

Next we study the process algebraic approaches. First the Petri calculus, with a strong

and weak semantics. The important result is Proposition 6.7 which states that both strong

and weak bisimilarity is a congruence with respect to the two operations. Next we extend the

Petri calculus with unbounded buﬀers, obtaining the P/T calculus, again with appropriate

strong and weak semantics. We then develop enough theory of the calculi to show that they

are semantically equivalent to their corresponding model of nets with boundaries. Our ﬁnal

technical contribution is a reformulation of the P/T calculus in the tile framework.

Structure of the paper. In detail, the paper is structured as follows: Section 2 ﬁxes the

main notation and gives the essential background on C/E nets and P/T nets. Section 3

introduces C/E nets with boundaries, together with their labelled semantics. Section 4

introduces P/T nets with boundaries, under both the strong and weak labelled semantics.

In Section 5 we show that both the models are actually monoidal categories and that there

are functors that take nets to their underlying processes—bisimilarity classes with respect

to the labelled semantics. Section 6 introduces the Petri calculus, ﬁxing its syntax, its

strong and weak operational semantics and the corresponding bisimulation equivalences.

P/T calculus, introduced in Section 7, extends the Petri calculus by allowing unbounded

6 R. BRUNI, H. MELGRATTI, U. MONTANARI, AND P. SOBOCI

´

NSKI

buﬀers and by generalising the axioms of the Petri calculus to deal with natural numbers

instead of just 0 and 1. In Section 8 we translate process algebra terms to nets; these

translations are easy because there are simple nets that account for the basic connectors

and so our translations can be deﬁned compositionally. In Section 9 we develop enough

of the process algebra theory thats allow us to give a translation from net models to the

process algebras. All the translations in Sections 8 and 9 both preserve and reﬂect labelled

transitions. Section 10 recasts the P/T calculus within the tile model. First, some essential

deﬁnition on the tile model are given. Then, an instance of the tile model, called Petri

tile model, is introduced. In the strong case the tile model includes a special observation

τ that is used to mark a separation between the instant a token arrives in a place and the

instant it is consumed from that place. In the weak case, the τ are just (unobservables)

identities, so that the same token can arrive and depart from a place in the same step. The

main result regarding the tile model shows that the Petri tile calculus is as expressive as the

P/T calculus and therefore, by transitivity, as the P/T nets with boundaries. Section 11

accounts for the comparison with some strictly related approaches in the literature. Finally,

some concluding remarks are given in Section 12.

2. Background

For n ∈ N write n

def

= {0, 1, . . . , n − 1} for the nth ordinal (in particular, 0

def

= ∅). For sets

X and Y we write X + Y for {(x, 0) | x ∈ X} ∪ {(y, 1) | y ∈ Y }. A multiset on a set X is

a function X → N. The set of multisets on X is denoted M

X

. We shall use U, V to range

over M

X

. For U, V ∈ M

X

, we write U ⊆ V iﬀ ∀x ∈ X : U(x) ≤ V(x).

We shall frequently use the following operations on multisets:

∪ : M

X

× M

X

→ M

X

: (U ∪ V)(x)

def

= U(x) + V(x)

− : M

X

× M

X

→ M

X

: (U − V)(x)

def

= U(x) −V(x) when V ⊆ U

· : N ×M

X

→ M

X

: (k · U)(x)

def

= kU(x)

+ : M

X

× M

Y

→ M

X+Y

: (U + V)(z)

def

=

(

U(x) if z = (x, 0)

V(y) if z = (y, 1)

−|

Y

: M

X

→ M

Y

: M

Y

(y)

def

= M

X

(y) when Y ⊆ X

Given a ﬁnite set X and U ∈ M

X

let |U|

def

=

P

x∈X

U(x). Given a ﬁnite X, if f : X → M

Y

and U ∈ M

X

then we shall abuse notation and write f(U) =

S

x∈X

U(x) · f(x). Another

slight abuse of notation will be the use of ∅ ∈ M

X

for the multiset s.t. ∅(x) = 0 for all

x ∈ X.

Given f : X → Y and U ⊆ Y , we will write f

−1

(U) to the denote the inverse image (or

preimage) of the set U under f, i.e., f

−1

(U) = {x ∈ X |f(x) ∈ U}.

Throughout this paper we use two-labelled transition systems (cf. Deﬁnition 2.1).

Depending on the context, labels will be words in {0, 1}

∗

or N

∗

, and will be ranged over

by α, β, γ. Write #α for the length of a word α. Let i ∈ [1, #α], we denote by α

i

the ith

element of α. Let α, β ∈ N

∗

with #α = #β, then we denote by α + β the sequence such

that #(α + β) = #α and (α + β)

i

= α

i

+ β

i

for any i ∈ [1, #α].

CONNECTOR ALGEBRAS FOR C/E AND P/T NETS’ INTERACTIONS 7

The intuitive idea is that a transition p

α

−→

β

q means that a system in state p can, in a

single step, synchronise with α on its left boundary, β on it right boundary and change its

state to q.

Deﬁnition 2.1 (Two-labelled transition system). Fix a set of labels A (in this paper

A = {0, 1} or A = N). For k, l ∈ N, a (k, l)-transition is a two-labelled transition of

the form

α

−→

β

where α, β ∈ A

∗

, #α = k and #β = l. A (k, l)-labelled transition system

((k, l)−LTS) is a transition system that consists of (k, l)-transitions: concretely, it is a pair

(V, T ) where V is a set of states, and T ⊆ V × A

∗

× A

∗

× V , where for all (v, α, β, v

0

) ∈ T

we have #α = k and #β = l. A two-labelled transition system is a family of (k, l)-labelled

transition systems for k, l ∈ N.

Deﬁnition 2.2 (Bisimilarity). A simulation on a two-labelled transition system is a relation

S on its set of states that satisﬁes the following: if (v, w) ∈ S and v

α

−→

β

v

0

then ∃w

0

s.t.

w

α

−→

β

w

0

and (v

0

, w

0

) ∈ S. A bisimulation is a relation S where both S and S

op

, the inverse

(or opposite) relation, are simulations. Bisimilarity is the largest bisimulation relation and

can be obtained as the union of all bisimulations.

2.1. Petri Nets. Here we introduce the underlying models of nets, together with the dif-

ferent notions of ﬁring semantics that are considered in the paper.

Deﬁnition 2.3 (C/E net). A C/E net is a 4-tuple N = (P, T,

◦

−, −

◦

) where:

1

− P is a set of places;

− T is a set of transitions;

−

◦

−, −

◦

: T → 2

P

are functions.

A C/E net N is ﬁnite when both P and T are ﬁnite sets. For a transition t ∈ T ,

◦

t and t

◦

are called, respectively, its pre- and post-sets. Moreover, we write

◦

t

◦

for

◦

t ∪ t

◦

.

The obvious notion of net homomorphisms f : N → M is a pair of functions f

T

: T

N

→

T

M

, f

P

: P

N

→ P

M

such that

◦

−

N

; 2

f

P

= f

T

;

◦

−

M

and −

◦

N

; 2

f

P

= f

T

; −

◦

M

, where

2

f

P

(X) =

S

x∈X

{f

P

(x)}.

Notice that Deﬁnition 2.3 allows transitions t with both empty pre- and post-sets, that

is,

◦

t = t

◦

= ∅. Such transitions (e.g., transition ζ in Fig. 3), while usually excluded for

ordinary nets, are necessary when deﬁning nets with boundaries in Section 3 (see Deﬁni-

tion 3.1).

Transitions t 6= u are said to be independent when

◦

t ∩

◦

u = ∅ and t

◦

∩ u

◦

= ∅.

A set U of transitions is said to be mutually independent when for all t, u ∈ U, if t 6= u then

t and u are independent.

Given a set of transitions U let

◦

U

def

=

S

u∈U

◦

u and U

◦

def

=

S

u∈U

u

◦

.

Given a net N = (P, T,

◦

−, −

◦

), a (C/E) marking is a subset of places X ⊆ P . We

shall use the notation N

X

to denote the marking X of net N .

Deﬁnition 2.4 (C/E ﬁring semantics). Let N = (P, T,

◦

−, −

◦

) be a C/E net, X, Y ⊆ P

and for U ⊆ T a set of mutually independent transitions, write:

N

X

→

U

N

Y

def

=

◦

U ⊆ X, U

◦

∩ X = ∅ & Y = (X\

◦

U) ∪U

◦

.

1

In the context of C/E nets some authors call places conditions and transitions events.

8 R. BRUNI, H. MELGRATTI, U. MONTANARI, AND P. SOBOCI

´

NSKI

Remark 2.5. Notice that Deﬁnition 2.3 allows the presence of transitions t for which there

exists a place p with p ∈

◦

t and p ∈ t

◦

. Some authors refer to this as a consume/produce

loop. The semantics in Deﬁnition 2.4 implies that such transitions can never ﬁre. We will

return to this in Remark 3.10, and in Remark 6.3 where we consider alternative semantics

for nets with boundaries.

Places of a Place/Transition net (P/T net) can hold zero, one or more tokens and arcs

are weighted. The state of a P/T net is described in terms of (P/T) markings, i.e., (ﬁnite)

multisets of tokens available in the places of the net.

Deﬁnition 2.6 (P/T net). A P/T net is a 4-tuple (P, T,

◦

−, −

◦

) where:

• P is a set of places;

• T is a set of transitions;

•

◦

−, −

◦

: T → M

P

.

Let X ∈ M

P

, we write N

X

for the P/T net N with marking X.

We can extend

◦

− and −

◦

in the obvious way to multisets of transitions: for U ∈ M

T

deﬁne

◦

U

def

=

S

t∈T

U(t) ·

◦

t and similarly U

◦

def

=

S

t∈T

U(t) ·t

◦

.

Deﬁnition 2.7 (P/T strong ﬁring semantics). Let N = (P, T,

◦

−, −

◦

) be a P/T net,

X, Y ∈ M

P

and t ∈ T . For U ∈ M

T

a multiset of transitions, write:

N

X

→

U

N

Y

def

=

◦

U ⊆ X, U

◦

⊆ Y & X −

◦

U = Y − U

◦

.

Although the conditions

◦

U ⊆ X and U

◦

⊆ Y in the above deﬁnition are redundant

(since X −

◦

U and Y − U

◦

are deﬁned only under such assumption), we explicitly state

them in order to stress this requirement for ﬁring. Also, we remark that Deﬁnition 2.4 can

be obtained as a special case of Deﬁnition 2.7 when considering only 1-safe markings, i.e.,

markings that hold at most one token. Indeed, the conditions

◦

U ⊆ X and U

◦

⊆ Y with

X and Y 1-safe only holds when U is a set of mutually independent transitions.

Deﬁnition 2.8 (P/T weak ﬁring semantics). Let N = (P, T,

◦

−, −

◦

) be a P/T net, X, Y ∈

M

P

and U ∈ M

T

. Write:

N

X

⇒

U

N

Y

def

= Y ∪

◦

U = X ∪ U

◦

.

Let N, M be P/T nets, a net homomorphism f : N → M is a pair of functions f

T

: T

N

→

T

M

, f

P

: P

N

→ P

M

such that such that

◦

−

N

; f

P

= f

T

;

◦

−

M

and −

◦

N

; f

P

= f

T

; −

◦

M

.

Example 2.9. Figure 1 depicts a simple P/T net N. We use the traditional graphical

representation in which places are circles, transitions are rectangles and directed edges

connect transitions to its pre- and post-set. When considering the strong semantics, the net

N

{p

1

}

can evolve as follows: N

{p

1

}

→

{t

1

}

N

{p

2

}

→

{t

2

}

N

{p

1

}

. . .. We remark that transition

t

2

cannot be ﬁred at N

{p

1

}

since the side condition X −

◦

t of Deﬁnition 2.7 is not satisﬁed

(in fact, {p

1

}−

◦

t

2

is not deﬁned). When considering the weak semantics, the net N

{p

1

}

has

additional transitions such as N

{p

1

}

⇒

{t

1

,t

2

}

N

{p

1

}

, in which t

2

can be ﬁred by consuming

in advance the token that will be produced by t

1

.

We need to consider another kind of weak semantics of P/T nets that is related to C/E

nets in that markings hold at most one token.

CONNECTOR ALGEBRAS FOR C/E AND P/T NETS’ INTERACTIONS 9

p

1

p

2

t

2

t

1

Figure 1: A simple P/T net N.

Deﬁnition 2.10 (P/T restricted weak ﬁring semantics). Let N = (P, T,

◦

−, −

◦

) be a P/T

net, X, Y ⊆ P and U ∈ M

T

. Write:

N

X

⇒

U

N

Y

def

= Y ∪

◦

U = X ∪ U

◦

.

where the operation ∪ refers to multiset union and the sets Y and X are considered as

multisets.

Note that Deﬁnition 2.10 is a special case of Deﬁnition 2.8, when considering just 1-safe

markings.

3. C/E Nets with boundaries

In Deﬁnition 2.3 we recalled the notion of C/E nets together with a ﬁring semantics in

Deﬁnition 2.4.

In this section we introduce a way of extending C/E nets with boundaries that allows

nets to be composed along a common boundary. We give a labelled semantics to C/E nets

with boundaries in Section 3.1. The resulting model is semantically equivalent to the strong

semantics of the Petri Calculus, introduced in Section 6; the translations are amongst the

translations described in Sections 8 and 9.

In order to illustrate marked C/E nets with boundaries, it will ﬁrst be useful to change

the traditional graphical representation of a net and use a representation closer in spirit to

that traditionally used in string diagrams.

2

The diagram on the left in Fig. 2 demonstrates

the traditional graphical representation of a (marked) net. Places are circles; a marking is

represented by the presence or absence of tokens. Each transition t ∈ T is a rectangle; there

are directed edges from each place in

◦

t to t and from t to each place in t

◦

. This graphical

language is a particular way of drawing hypergraphs; the right diagram in Fig. 2 demon-

strates another graphical representation, more suitable for drawing nets with boundaries.

Places are again circles, but each place has exactly two ports (usually drawn as small black

triangles): one in-port, which we shall usually draw on the left, and one out-port, usually

drawn on the right. Transitions are simply undirected links—each link can connect to any

number of ports. Connecting t to the out-port of p means that p ∈

◦

t, connecting t to p’s

in-port means that p ∈ t

◦

. The position of the “bar” in the graphical representation of each

link is irrelevant, they are used solely to distinguish individual links. A moment’s thought

ought to convince the reader that the two ways of drawing nets are equivalent, in that they

both faithfully represent the same underlying formal structures.

2

See [47] for a survey of classes of diagrams used to characterise free monoidal categories.

10 R. BRUNI, H. MELGRATTI, U. MONTANARI, AND P. SOBOCI

´

NSKI

Figure 2: Traditional and alternative graphical representations of a net.

Independence of transitions in C/E nets is an important concept—only independent

transitions are permitted to ﬁre concurrently. We will say that any two transitions t, u with

t 6= u that are not independent are in contention, and write t#u. Then, in ordinary C/E

nets, t#u precisely when t 6= u and

◦

t ∩

◦

u 6= ∅ or t

◦

∩u

◦

6= ∅. In particular, the ﬁring rule

for the semantics of C/E nets (Deﬁnition 2.4) can be equivalently restated as follows:

N

X

→

U

N

Y

def

=

◦

U ⊆ X, U

◦

∩ X = ∅, Y = (X\

◦

U) ∪U

◦

& ∀u, v ∈ U. ¬(u#v).

Our models connect transitions to ports on boundaries. Nets that share a common

boundary can be composed—the transitions of the composed net are certain synchronisa-

tions between the transitions of the underlying nets, as we will explain below. Connecting

two C/E net transitions to the same port on the boundary introduces a new source of

contention—moreover this information must be preserved by composition. For this reason

the contention relation is an explicit part of the structure of C/E nets with boundaries.

The model of C/E nets with boundaries originally proposed in [49] lacked the contention

relation and therefore the translation between Petri calculus terms and nets was more

involved. Moreover, the model of C/E nets with boundaries therein was less well-behaved

in that composition was suspect; for example bisimilarity was not a congruence with respect

to it. Incorporating the contention relation as part of the structure allows us to repair these

shortcomings and obtain a simple translation of the Petri calculus that is similar to the

other translations in this paper.

We start by introducing a version of C/E nets with boundaries. Let k, l, m, n range

over ﬁnite ordinals.

Deﬁnition 3.1 (C/E nets with boundaries). Let m, n ∈ N. A (ﬁnite, marked) C/E net

with boundaries N

X

: m → n, is an 8-tuple (P, T, X, #,

◦

−, −

◦

,

•

−, −

•

) where:

− (P, T,

◦

−, −

◦

) is a ﬁnite C/E net;

−

•

−: T → 2

m

and −

•

: T → 2

n

connect each transition to a set of ports on the left

boundary m and right boundary n;

− X ⊆ P is the marking;

− # is a symmetric and irreﬂexive binary relation on T called contention.

The contention relation must include all those transitions that are not independent in the

underlying C/E net, and those that share a place on the boundary, i.e. for all t, u ∈ T

where t 6= u:

(i) if

◦

t ∩

◦

u 6= ∅, then t#u;

CONNECTOR ALGEBRAS FOR C/E AND P/T NETS’ INTERACTIONS 11

0

1

0

1

2

↵

✏

⇣

a

b

c

d

Figure 3: Representation of a net with boundaries N

∅

: 2 → 3. Here T = {α, β, γ, δ, , ζ}

and P = {a, b, c, d}. The non-empty values of

◦

− and −

◦

are: α

◦

= {a},

◦

β = {a}, β

◦

= {b, c, d},

◦

γ = {b},

◦

δ = {c},

◦

= {d}. The non-empty values of

•

− and −

•

are:

•

α = {0},

•

= {0}, γ

•

= {1}, δ

•

= {1}, ζ

•

= {2}. Of course

when the same port name appears in the left and right boundaries (e.g., 0) it

denotes diﬀerent nodes.

(ii) if t

◦

∩ u

◦

6= ∅, then t#u;

(iii) if

•

t ∩

•

u 6= ∅, then t#u;

(iv) if t

•

∩ u

•

6= ∅, then t#u.

Transitions t, t

0

∈ T are said to have the same footprint when

◦

t =

◦

t

0

, t

◦

= t

0◦

,

•

t =

•

t

0

and t

•

= t

0

•

. From an operational point of view, transitions with the same footprint are

indistinguishable. We assume that if t and t

0

have the same footprint then t = t

0

. This

assumption is operationally harmless and somewhat simpliﬁes reasoning about composition.

An example of C/E net with boundaries is pictured in Fig. 3. Note that ζ is a transition

with empty pre and postset, and transitions δ and γ are in contention because they share

a port.

The notion of independence of transitions extends to C/E nets with boundaries: t, u ∈ T

are said to be independent when ¬(t#u). We say that a set U of transitions is mutually

independent if ∀u, v ∈ U. ¬(u#v).

The obvious notion of homomorphism between two C/E nets extends that of ordinary

nets: given nets N

X

, M

Y

: m → n, f : N

X

→ M

Y

is a pair of functions f

T

: T

N

→ T

M

,

f

P

: P

N

→ P

M

such that f

P

(X) = Y , f

T

(t)#f

T

(u) implies t#u,

◦

−

N

; 2

f

P

= f

T

;

◦

−

M

,

−

◦

N

; 2

f

P

= f

T

; −

◦

M

,

•

−

N

= f

T

;

•

−

M

and −

•

N

= f

T

; −

•

M

. A homomorphism is an

isomorphism iﬀ its two components are bijections; we write N

X

∼

=

M

Y

when there is an

isomorphism from N

X

to M

Y

.

The main operation on nets with boundaries is composition along a common bound-

ary. That is, given nets M

X

: l → m, N

Y

: m → n we will deﬁne a net M

X

; N

Y

: l → n.

Roughly, the transitions of the composed net M

X

; N

Y

are certain sets of transitions of the

two underlying nets that synchronise on the common boundary. Thus in order to deﬁne

the composition of nets along a shared boundary, we must ﬁrst introduce the concept of

synchronisation.

Deﬁnition 3.2 (Synchronisation of C/E nets). Let M

X

: l → m and N

Y

: m → n be C/E

nets. A synchronisation is a pair (U, V ), with U ⊆ T

M

and V ⊆ T

N

mutually independent

sets of transitions such that:

− U + V 6= ∅;

− U

•

=

•

V .

12 R. BRUNI, H. MELGRATTI, U. MONTANARI, AND P. SOBOCI

´

NSKI

The set of synchronisations inherits an ordering pointwise from the subset order, i.e. we

let (U

0

, V

0

) ⊆ (U, V ) when U

0

⊆ U and V

0

⊆ V . A synchronisation is said to be minimal

when it is minimal with respect to this order. Let Synch(M, N) denote the set of minimal

synchronisations.

Note that synchronisations do not depend on the markings of the underlying nets, but

on the sets of transitions T

M

and T

N

. Consequently, Synch(M, N) is ﬁnite because T

M

and T

N

are so. It could be also the case that Synch(M, N) is the empty set . Notice that

any transition in M or N not connected to the shared boundary m (trivially) induces a

minimal synchronisation—for instance if t ∈ T

M

with t

•

= ∅, then ({t}, ∅) is a minimal

synchronisation.

The following result shows that any synchronisation can be decomposed into a set of

minimal synchronisations.

Lemma 3.3. Suppose that M

X

: k → n and N

Y

: n → m are C/E nets with boundaries

and (U, V ) is a synchronisation. Then there exists a ﬁnite set of minimal synchronisations

{(U

i

, V

i

)}

i∈I

such that (i) U

i

∩ U

j

= V

i

∩ V

j

= ∅ whenever i 6= j, (ii)

S

i

U

i

= U and (iii)

S

i

V

i

= V .

Proof. See Appendix A.

Minimal synchronisations serve as the transitions of the composition of two nets along a

common boundary. Thus, given (U, V ) ∈ Synch(M, N) let

◦

(U, V )

def

=

◦

U +

◦

V , (U, V )

◦

def

=

U

◦

+ V

◦

,

•

(U, V )

def

=

•

U and (U, V )

•

def

= V

•

. For (U, V ), (U

0

, V

0

) ∈ Synch(M, N),

(U, V )#(U

0

, V

0

) iﬀ (U, V ) 6= (U

0

, V

0

) and

− U ∩ U

0

6= ∅ or ∃u ∈ U, u

0

∈ U

0

such that u#u

0

(as transitions of M), or

− V ∩ V

0

6= ∅ ∃v ∈ V, v

0

∈ V

0

such that v#v

0

(as transitions of N);

Having introduced minimal synchronisations we may now deﬁne the composition of two

C/E nets that share a common boundary.

Deﬁnition 3.4 (Composition of C/E nets with boundaries). When M

X

: l → m and

N

Y

: m → n are C/E nets, deﬁne their composition, M ; N

X+Y

: l → n, as follows:

− places are P

M

+ P

N

, the “enforced” disjoint union of places of M and N;

− transitions are obtained from the set of minimal synchronisations Synch(M, N), after

removing any redundant transitions with equal footprint

3

;

− the marking is X + Y .

We must verify that # as deﬁned on Synch(M, N) above satisﬁes the conditions on

the contention relation given in Deﬁnition 3.1. Indeed if

◦

(U, V ) ∩

◦

(U

0

, V

0

) 6= ∅ then one

of

◦

U ∩

◦

U

0

and

◦

V ∩

◦

V

0

must be non-empty. Without loss of generality, if the ﬁrst is

nonempty then there exist u ∈ U, u

0

∈ U

0

with

◦

u ∩

◦

u

0

6= ∅, thus either u = u

0

, in which

case U ∩U

0

6= ∅, or u#u

0

in M—thus by construction

◦

(U, V )#

◦

(U

0

, V

0

) in the composition,

as required. The remaining conditions are similarly easily shown to hold. An example of a

composition of two C/E nets is illustrated in Fig. 4.

Remark 3.5. Two transitions in the composition of two C/E nets may be in contention

even though they are mutually independent in the underlying C/E net, as illustrated by

Fig. 5.

3

It is possible that two or more minimal synchronisations share the same footprint and in that case only

one is retained. The precise identity of the transition that is kept is irrelevant.

CONNECTOR ALGEBRAS FOR C/E AND P/T NETS’ INTERACTIONS 13

1

2

↵

1

↵

2

↵

3

↵

4

{↵

2

, ↵

3

},

1

{↵

1

, ↵

3

},

1

↵

4

,

2

Figure 4: Composition of two C/E nets.

↵

1

↵

2

↵

1

,

↵

2

,

Figure 5: Composition of two nets with boundaries. Note that α

1

#α

2

implicitly in the left-

most net, and (α

1

, β)#(α

2

, β) in the composition. This is emphasised graphically

with the jagged line in the rightmost diagram.

Remark 3.6. Any ordinary C/E net N (Deﬁnition 2.3) can be considered as a net with

boundaries N : 0 → 0 as there is exactly one choice for functions

•

−, −

•

: T → 2

0

and

the contention relation consists of all pairs of transitions that are not independent in N.

Composition of two nets N : 0 → 0 and M : 0 → 0 is then just the disjoint union of the

two nets: the set of places is P

N

+ P

M

, the minimal synchronisations are precisely ({t}, ∅),

t ∈ T

N

and (∅, {t

0

}), t

0

∈ T

M

, and the contention relation is the union of the contention

relations of N and M.

3.1. Labelled semantics of C/E nets with boundaries. For any k ∈ N, there is a

bijection p−q : 2

k

→ {0, 1}

k

with

pUq

i

def

=

(

1 if i ∈ U

0 otherwise.

Similarly, with slight abuse of notation, we deﬁne p−q : M

k

→ N

k

by

pUq

i

def

= U(i)

14 R. BRUNI, H. MELGRATTI, U. MONTANARI, AND P. SOBOCI

´

NSKI

10

00*

00

00*

00

01*

00

01*

00

11*

00

01*

10

00*

00

10*

Figure 6: Part of a labelled transition system for simple C/E net 2 → 3. The symbol ∗ is

used as shorthand for any label in {0, 1}.

Deﬁnition 3.7 (C/E Net Labelled Semantics). Let N : m → n be a C/E net with bound-

aries and X, Y ⊆ P

N

. Write:

N

X

α

−→

β

N

Y

def

= ∃ mutually independent U ⊆ T

N

s.t.

N

X

→

U

N

Y

, α = p

•

Uq & β = pU

•

q (3.1)

It is worth emphasising that no information about precisely which set U of transitions

has been ﬁred is carried by transition labels, merely the eﬀect of the ﬁring on the bound-

aries. Notice that we always have N

X

0

m

−−→

0

n

N

X

, as the empty set of transitions is vacuously

mutually independent.

A transition N

X

α

−→

β

N

Y

indicates that the C/E net N evolves from marking X to

marking Y by ﬁring a set of transitions whose connections are recorded by α on the left

interface and β on the right interface. We give an example in Fig. 6.

Labelled semantics is compatible with composition in the following sense.

CONNECTOR ALGEBRAS FOR C/E AND P/T NETS’ INTERACTIONS 15

Theorem 3.8. Suppose that M : k → n and N : n → m are C/E nets with boundaries,

and X, X

0

⊆ P

M

and Y, Y

0

⊆ P

N

markings. Then M; N

X+Y

α

−→

β

M; N

X

0

+Y

0

iﬀ there exists

γ ∈ {0, 1}

n

such that

M

X

α

−→

γ

M

X

0

and N

Y

γ

−→

β

N

Y

0

.

Proof. See Appendix A.

The above result is enough to show that bisimilarity is a congruence with respect to

the composition of nets over a common boundary.

Proposition 3.9. Bisimilarity of C/E nets is a congruence w.r.t. ‘ ;’.

Proof. See Appendix A.

Remark 3.10. Consider the composition of the three nets with boundaries below.

d :0! 2

e :2! 0

N :2! 2

The result is a net with boundaries 0 → 0 with a single place and a single consume/produce

loop transition. As we have observed in Remark 2.5, this transition cannot ﬁre with the

semantics of nets that we have considered so far. Globally, the transition cannot ﬁre because

its postset is included in the original marking. The fact that the transition cannot ﬁre is

also reﬂected locally, in light of Theorem 3.8: indeed, locally, for the transition to be able

to ﬁre, there would need to be a transition N

{?}

11

−−→

11

N

{?}

, but this is not possible because

there is a token present in the postset of the transition connected to the lower left boundary.

It is possible to relax the semantics of nets in order to allow such transitions to ﬁre, as we

will explain in Remark 6.3.

Remark 3.11. In Remark 3.6 we noted that any ordinary net N can be considered as a

net with boundaries N : 0 → 0. For such nets, the transition system of Deﬁnition 3.7 has

transitions with only one label (since there is nothing to observe on the boundaries) and

thus corresponds to an unlabelled step-ﬁring semantics transition system. In particular, it

follows that, while the transition systems generated for nets N : 0 → 0 are diﬀerent, they

are all bisimilar; we feel that this is compatible with the usual view on labelled equivalences

in that they capture behaviour that is observable from the outside: a net N : 0 → 0 does

not have a boundary and thus there is no way of interacting with it and therefore no way

of telling apart two such nets. One can, of course, allow the possibility of observing the

ﬁring of certain transitions (possibly all) by connecting them to ports on the boundary. Let

N be a net with n = #T

N

transitions. A corresponding net with boundaries that makes

transitions observable over the right interface is as follows: N : 0 → n with

•

t = ∅ for all

t ∈ T

N

,

•

: T

N

→ n any injective function, and the contention relation containing only

those pairs of transitions that are in contention in the underlying C/E net N.

16 R. BRUNI, H. MELGRATTI, U. MONTANARI, AND P. SOBOCI

´

NSKI

4. P/T nets with boundaries

This section extends the notion of nets with boundaries to P/T nets. The contention relation

no longer plays a role, and connections of transitions to boundary ports are weighted.

Deﬁnition 4.1 (P/T net with boundaries). Let m, n ∈ N. A (ﬁnite, marked) P/T net with

boundaries N

X

: m → n is a tuple N = (P, T,

◦

−, −

◦

,

•

−, −

•

) where:

− (P, T,

◦

−, −

◦

) is a ﬁnite P/T net;

−

•

− : T → M

m

and −

•

: T → M

n

are functions that assign transitions to the left and

right boundaries of N ;

− X ∈ M

P

.

As in Deﬁnition 3.1 we assume that transitions have distinct footprints.

Remark 4.2. For reasons that will become clear when we study the process algebraic

account, we will sometimes refer to P/T nets with boundaries that have markings which

are subsets (X ⊆ P ) of places instead of a multiset (X ∈ M

P

) of places as weak C/E nets

with boundaries.

The notion of net homomorphism extends to marked P/T nets with the same bound-

aries: given N

X

, M

Y

: m