systems on graphs spans, graphs and concurrency rfc walters ct 2008 calais 23rd june 2008

34
Systems on graphs Spans, graphs and concurrency RFC Walters CT 2008 Calais 23rd June 2008

Upload: daisy-chandler

Post on 05-Jan-2016

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Systems on graphs Spans, graphs and concurrency RFC Walters CT 2008 Calais 23rd June 2008

Systems on graphsSpans, graphs and concurrency

RFC Walters

CT 2008Calais 23rd June 2008

Page 2: Systems on graphs Spans, graphs and concurrency RFC Walters CT 2008 Calais 23rd June 2008

1. Span(ReflexiveGraphs) and concurrency(with Nicoletta Sabadini)

In 1997 Katis, Sabadini and I introduced the use of the cartesian bicategory Span(ReflexiveGraphs) as an algebra for modelling concurrent systems.

Hasn’t as yet been used by the concurrency community but it should be.

Considering Span just as a category, the algebra we considered was the monoidal structure, and the fact that each object has a separable algebra structure, namely the diagonal considered as a span, the opposite of the diagonal, the projection and the opposite of the projection, a structure shared with Rel, Cospan, etc.Carboni and I called categories (in 1987) with such a structure wscc categories.

Page 3: Systems on graphs Spans, graphs and concurrency RFC Walters CT 2008 Calais 23rd June 2008

=

=

(Carboni, Walters, Cartesian bicategories I, JPAA 1987)

1. Span(ReflexiveGraphs) and concurrency

Page 4: Systems on graphs Spans, graphs and concurrency RFC Walters CT 2008 Calais 23rd June 2008

We can draw string diagrams of expressions in this algebra. All the examples I will consider have as objects products of one vertex graphs, so we will indicate on the the wires the arcs only. We will indicate labelling by the reflexive edge by epsilon.

A typical span will be represented as:

a,b,

c,d,

e, bd,/ e

a,c,//

1. Span(ReflexiveGraphs) and concurrency

Page 5: Systems on graphs Spans, graphs and concurrency RFC Walters CT 2008 Calais 23rd June 2008

0 1

3 2

0

2 3

Philosophera=take

b=release

Forka=taken

b=released

a,b, a,b,

a,b, a,b,

a/

/a/bb/

/a

/ba/

b/

An example (dining philosopher)1. Span(ReflexiveGraphs) and concurrency

Page 6: Systems on graphs Spans, graphs and concurrency RFC Walters CT 2008 Calais 23rd June 2008

A table of dining philosophers

Algebraically,

The evaluation of the expression has 124 states and many arcs!

1. Span(ReflexiveGraphs) and concurrency

Page 7: Systems on graphs Spans, graphs and concurrency RFC Walters CT 2008 Calais 23rd June 2008

For the next section I would like to consider a slightly different category: spans of reflexive graphs which are jointly monic on arcs. That is, given the source and target, the labelling determines the arc. Examples above were such.

Only difference is that the composition is not pullback, but pullback reflected.

Call this category TLTS.

The category Rel of relations between pointed sets is a subcategory – in which all the graphs involved are one vertex graphs.

The name TLTS means “two-sided labelled transtion systems” because it corresponds to the computer science notion of transition system, but there is a left and right labelling and the alphabet includes the reflexive edge.

1. Span(ReflexiveGraphs) and concurrency

Page 8: Systems on graphs Spans, graphs and concurrency RFC Walters CT 2008 Calais 23rd June 2008

2. Broadcast communication (with de Francesco, Sabadini)

One of the most common ways of joining components is not

but something more like the following:

The bottom wire is called a bus. The component can talk directly to each other through the medium of the bus.

Page 9: Systems on graphs Spans, graphs and concurrency RFC Walters CT 2008 Calais 23rd June 2008

2. Broadcast communication

How do we describe this in TLTS?

First approximation: consider the expression

R TS

This expression certainly acts like broadcast – in a transition of the whole systems the transitions of each component must have the same label on the “bus”.

Page 10: Systems on graphs Spans, graphs and concurrency RFC Walters CT 2008 Calais 23rd June 2008

2. Broadcast communication

However often in broadcast communication there is a protocol between the components and the bus.

The general notion of broadcast communication depends on the following fact:

Proposition In a symmetric monoidal category if (X, c) is a commutative comoid object and (Y,m) is a commutative monoid then there is an induced commutative monoid structure on Hom(X,Y), defined as follows:Given

then the multiplication of f and g is

f

g

c m

(In the category of relations this is local intersection.)

Page 11: Systems on graphs Spans, graphs and concurrency RFC Walters CT 2008 Calais 23rd June 2008

2. Broadcast communication

We will apply this in TLTS in the case that X is the identity of the tensor, so the comonoid structure is trivial and the monoid structure is a commutative monoid in Rel.

Given a commutative monoid (Y,m,e) in Rel of pointed sets we define broadcast composition of one-sided labelled transition systems R,S,T, … based on this monoid as:

m m m

R S T U

and denote it R || S || T || U.

As an expression in TLTS it is:

but it is independent of the order, for example, R||S||T||U=R||U||T||S so that R can communicate directly with U, for example.

Page 12: Systems on graphs Spans, graphs and concurrency RFC Walters CT 2008 Calais 23rd June 2008

2. Broadcast communication

What is a commutative monoid in TLTS with object a one vertex graph = a commutative monoid in Rel of pointed sets?

Consists of an alphabet including the reflexive edge,and a commutative associative operation m where the compositite of two letters is a set of letters.The identity is a subset e of the alphabet.

Example: m a b c e={,a,b,c}, 0=empty set 0 0 0 a 0 a 0 0 b 0 0 b 0 c 0 0 0 c

This is just the the monoid with multiplication

Notice m is a partial function but e not.

This example is the pure broadcast we described above.

Page 13: Systems on graphs Spans, graphs and concurrency RFC Walters CT 2008 Calais 23rd June 2008

2. Broadcast communication

Example (Robin Milner’s CCS): The alphabet has an involution, and a special symbol m a a b b e= a a b b a a 0 0 0 0 a a b 0 0 0 b b 0 0 0 0 b b 0 0 0 0 0 0 0 0 0

This means that two process can “shake hands” on the bus, but only two – inhibits other transitions. The other possibility is that one component does a transition with label a on the bus.

a

aa

a

a

a

R S T R S T

a a

R T S

Page 14: Systems on graphs Spans, graphs and concurrency RFC Walters CT 2008 Calais 23rd June 2008

2. Broadcast communication

Notes:1. Traditional process algebras (Hoare, Milner) are based on the parallel

operation of broadcast. The more basic operations are tensor and composition – broadcast is a derived operation, non-canonical since it depends on the choice of a monoid.

(Span(Graph) should be used!)

2. A special case of commutative monoid in Rel has been introduced by Winskel – called a synchronization algebra. It is a set with a partial associative and commutative multiplication (no identity). He does not allow relations and hence for him pure broadcast does not have an identity.

3. Taking broadcast as basic operation has lead to the theory of “interleaving” and the great debate “interleaving versus true concurrency”. Clearly there is interleaving on a bus, not so with more general communication. Span(Rgraph) has both.

4. Abramsky makes similar comments (to 1) in “Retracing paths in process algebras” but in view of the general acceptance of Plotkin’s SOS (syntactic operational semantics), and the influence of Milner, with little effect.

Page 15: Systems on graphs Spans, graphs and concurrency RFC Walters CT 2008 Calais 23rd June 2008

Non-reflexive graphs and synchronization

An important special case of broadcast is the clock signal in synchronous machines. The clock has one vertex and one non-reflexive edge.

2. Broadcast communication

clock UTS

If every non-reflexive edge of S,T,U is labelled by the clock signal then this expression evaluates to the product, in non-reflexive Graphs, of the graphs consisting of the non-reflexive edges.

This really arises from the fact that there is a product preserving functor from Graphs to ReflexiveGraphs/clock. (Lawvere)

Page 16: Systems on graphs Spans, graphs and concurrency RFC Walters CT 2008 Calais 23rd June 2008

Systems in computer science may be described in two ways:

(i) as a composition of processes – eg by process algebra,

(ii) as a geometry with an associated state space.

This section relates these points of view.

The geometry in (ii) is usually finite (or at most, finitely recursively defined).

The geometry may represent distribution or control.

3. Geometry+state space versus Algebra of processes(with Rosebrugh, Sabadini)

Page 17: Systems on graphs Spans, graphs and concurrency RFC Walters CT 2008 Calais 23rd June 2008

FlowchartPetri net

Digital circuit

Analog circuit Dining philosophers

(all except the last diagram taken from wikipedia pages)

3. Geometry+state space versus Algebra of processes

Page 18: Systems on graphs Spans, graphs and concurrency RFC Walters CT 2008 Calais 23rd June 2008

Notice that though all these examples have finite geometry, in each case there is a state space understood, and in the flow chart, analog circuit, and (perhaps) the Petri net, the state space is infinite.

The state space is continuous in the analog circuit.

Our result will allow us to describe all these examples and their behaviours in a uniform way.

In the flow chart the geometry might be better called control. In other examples the geometry is spatial distribution.

In the dining philospher example we see two levels of geometry, distribution and control.

3. Geometry+state space versus Algebra of processes

Page 19: Systems on graphs Spans, graphs and concurrency RFC Walters CT 2008 Calais 23rd June 2008

What geometry?

In each case the geometry is (not a topological space but) a monoidal graph, i.e. it consists it consists of a set A of arcs (the components), a set V of vertices (the wires); the source and target of each component is a word in the vertices. Monoidal graphs form a presheaf category MonGraph.

If there are input and output wires, the geometry is a cospan of monoidal graphs, between objects which are discrete graphs (no arcs).

Denote the category of such cospans as Cspn(MonGraph).

3. Geometry+state space versus Algebra of processes

Page 20: Systems on graphs Spans, graphs and concurrency RFC Walters CT 2008 Calais 23rd June 2008

Categories of state spaces

Consider a category, preferably a topos, E whose objects are apt for being state spaces of systems. Suppose also there is an object I (or objects) which parametrize behaviours: i.e. Hom(I,X) is the set of behaviours of object X.

Example 1. E=Graphs. The objects which parametrize motion are the graphs In=0->1->…->n. A behaviour in X is a path in the graph X. Behaviours, by virtue of a famillial cocategory structure on the In, form a category.

3. Geometry+state space versus Algebra of processes

Page 21: Systems on graphs Spans, graphs and concurrency RFC Walters CT 2008 Calais 23rd June 2008

Example 2. Let C be a topos of smooth spaces, and smooth maps. Then take E to be C/T, T the tangent space functor. The behaviour parametrizer is R->R2, t->(t,1), R the real numbers.If Y= Rn then TY=YxY. Then a behaviour of (p,v):X->TY=YxY is a function f:R->X such that (p·f)=v·f

In the special case that X=Y and (p,v)=(1,v) then (p,v) is just a vector field on X and f satisfies f=v·f

We will see that the more general case allows us to consider mixed equations and differential equations, and hence components which a computer scientist might call non-deterministic.

Katis, Sabadini, Walters, On the algebra of systems with feedback & boundary, Rendiconti del Circolo

Matematico di Palermo Serie II, Suppl. 63 (2000)

3. Geometry+state space versus Algebra of processes

Page 22: Systems on graphs Spans, graphs and concurrency RFC Walters CT 2008 Calais 23rd June 2008

We may picture such state spaces and behaviours as follows:

3. Geometry+state space versus Algebra of processes

Notice that there may be many or no vectors at a point in Y (non-deterministic).

Page 23: Systems on graphs Spans, graphs and concurrency RFC Walters CT 2008 Calais 23rd June 2008

Systems with geometry and state space

I have described two separate things geometry and state space.

Now to combine them.What is a geometry with a state space?

The answer is that there are two cases – a covariant one and a contravariant one.

A covariant state space associated with the geometry G in the category E is a monoidal graph morphism from G to cospan(E). Contravariant is a morphism to span(E). The covariant case regards control, the contravariant regards distribution.

3. Geometry+state space versus Algebra of processes

Page 24: Systems on graphs Spans, graphs and concurrency RFC Walters CT 2008 Calais 23rd June 2008

Contravariant case: each component has a state space which is reflected on the boundary – so each component yields a span of state spaces.

Examples – circuits, dining philosophers.

Covariant case: The input and output boundaries are “initial” and “final” states, hence a component yields a cospan.

Examples: flowcharts, Petri nets.

3. Geometry+state space versus Algebra of processes

Page 25: Systems on graphs Spans, graphs and concurrency RFC Walters CT 2008 Calais 23rd June 2008

The total state space of a system: is then given by a colimit in the covariant case, and a limit in the contravariant case.

The behaviours are given by homming in from the parametrizing object(s).

Example E=Graphs

3. Geometry+state space versus Algebra of processes

Page 26: Systems on graphs Spans, graphs and concurrency RFC Walters CT 2008 Calais 23rd June 2008

EExample E=smooth spaces

3. Geometry+state space versus Algebra of processes

Page 27: Systems on graphs Spans, graphs and concurrency RFC Walters CT 2008 Calais 23rd June 2008

IIn analogue circuits what seems to be a diagonal is in fact a component – which satisfies the Kirchoff laws for voltages and currents. The alowed expressions are compact closed ones, not the full wscc expressions.

3. Geometry+state space versus Algebra of processes

Page 28: Systems on graphs Spans, graphs and concurrency RFC Walters CT 2008 Calais 23rd June 2008

Discrete spaces with state vs algebras of processes

What now is the promised connection between the two points of view? The following 2 results:

Proposition 2. Cspn(MonGraph/G) is the free wscc category on the monoidal graph G.

This is a generalization of the earlier result.Now if C is a wscc category, let |C| denote the underlying monoidal graph of C. The identity monoidal graph morphism induces a wscc functor Cspn(MonGraph/|C|)->C.

Proposition 3. The induced functor Cspn(MonGraph/|span(E)|)->span(E)

is the total state space functor described above (limit case).Similarly for cospan (colimit case).

3. Geometry+state space versus Algebra of processes

Page 29: Systems on graphs Spans, graphs and concurrency RFC Walters CT 2008 Calais 23rd June 2008

The meaning of the theorem is that total space, and hence the behaviour of a system described as a monoidal graph morphism phi: G->span(E) can be calculated in two ways:

(i) by calculating a limit of a diagram

(ii) by expressing G in terms of the wscc operations in Cspn(MonGraph/|span(E)|) and evaluating the same expression instead in span(E).

(i) is the geometric point of view; (ii) is the compositional point of view.

A special case of this was presented at CT2007.

3. Geometry+state space versus Algebra of processes

Page 30: Systems on graphs Spans, graphs and concurrency RFC Walters CT 2008 Calais 23rd June 2008

Examples

1. The Boolean circuit

2. The analogue circuit

3. Geometry+state space versus Algebra of processes

Page 31: Systems on graphs Spans, graphs and concurrency RFC Walters CT 2008 Calais 23rd June 2008

End of lecture

Page 32: Systems on graphs Spans, graphs and concurrency RFC Walters CT 2008 Calais 23rd June 2008

States real numbers, labels real numbersDisplayed a typical transition where

T’-T=T1+T2+T3+T4-4T

T

T T

T

T1

T3T2

T4

T

T’

Another example – the heat equation

Page 33: Systems on graphs Spans, graphs and concurrency RFC Walters CT 2008 Calais 23rd June 2008

The discrete heat equation

Page 34: Systems on graphs Spans, graphs and concurrency RFC Walters CT 2008 Calais 23rd June 2008

ABSTRACT

Systems on graphsR.F.C. Walters Abstract. Most systems in computer science have as underlying geometry somekind of finite (or recursively defined) graph, possibly evolving in time, a fact sharedwith many continuous systems, for example classical electrical circuits, or quantumexperiments. Further, associated to the geometry is state space, constructed compo-sitionally in correspondence with the geometry. We describe a model based on spansand cospans (see also [1],[2],[3]) which permits the description of a wide variety ofsystems with these properties. We relate behaviours described as paths in the statespace to formal behaviours described by rewrite rules.

References[1] P. Katis, N. Sabadini, R.F.C. Walters, On the algebra of systems with feedbackand boundary, Rendiconti del Circolo Matematico di Palermo Serie II, Suppl. 63:pp 123–156, 2000.[2] P. Katis, N. Sabadini, R.F.C. Walters, A formalisation of the IWIM Model, in:Proc. Coordination 2000, Lecture Notes in Computer Science 1906, pp 267–283,Springer Verlag, 2000.[3] R. Rosebrugh, N. Sabadini, R.F.C.Walters, Calculating colimits compositionally,to appear in Lecture Notes in Computer Science, Springer Verlag, 2008.Joint work with Nicoletta Sabadini.