• No results found

We show now that our constructions support system evolution in a quite general sense. A PF-system may evolve horizontally or vertically. Horizontal evolution concatenates pipelines, with data transformations possibly serving as glue between the parts. Vertical evolution refines a pipeline by substituting a component through an entire subsystem. Both operations are vital in composing systems from smaller ones, so that larger systems can be built up through a suitable sequence of them.

8.1 Concatenation

LetG1, γ and G2, χ be two PF-systems, Gi =Vi, Ei. The idea in concatenating both is to pipe the output from the first system to the input of the second one, hence

V1∩ V2 = B1 = W2

should hold: the output nodes from the first system should coincide with the input nodes for the second one; otherwise, these systems do not share nodes. Neither an input node nor an output node carries any functionality in our model, but by lumping them together, we may wish to perform some work (combining pipes often requires some transformation, e.g., of formats, between input and output). Hence we assume for each node n ∈ B1 = W2 the existence of a Kleisli morphism

a (τ, n) :

k,n|k, n ∈ E1} → T

n,j|n, j ∈ E2} . This permits defining the τ -concatenation G1, γ +τG2, χ as H, κ with

H := V1∪ V2, E1∪ E2, κk,n :=

γk,n, k, n ∈ E1, χk,n, otherwise,

a (κ, n) :=





a (γ, n) , n ∈ V1\ (W1∪ B1), a (τ, n) , n ∈ B1,

a (χ, n) , n ∈ V2\ (W2∪ B2).

We get as a consequence of Proposition 6:

Proposition 7 Under the conditions above, H, κ := G1, γ +τG2, χ is a PF-system, and P (κ, H) = P (χ, G2)∗ (a (τ, n1)×T. . .×Ta (τ, nk))∗P (γ, G1) ,

where B1 = W2={n1, . . . , nk}. 2

Thus τ provides the glue for composing the PF-systems, and the work being done exhibits the work performed when combining both systems. The glue alluded at here is different from but similar in function to the glue introduced in [34].

8.2 Substitution

Systems are often built through successive stages of refinements, where a part of a system is first represented as a node, and this node is then replaced in subsequent steps by an entire subsystem. This may graphically be described as glass-box refinement, see [7, 14.5].

LetGi =Vi, Ei be dags with respective roots Wi and leaves Bi, and let n ∈ V1 be a node such that (dots taken inG1)

•n = W2, n• = B2.

Thus an incoming edge for n comes from a root inG2, and an outgoing edge goes to a leaf in G2. For technically simplifying the representation, we assume that only the nodes in W2∪ B2 are common to V1 and V2. We assume further that we have a selection map

ψ : W2∪ B2→ V2\ (W2∪ B2)

which will help constructing new edges when absorbingG2 into G1 by associating with each root or leaf an inner node as source or target of an edge, as we will see. We require that ψ[W2]∩ ψ[B2] =∅, since otherwise cycles in the replacement graph would result. Define the ψ-replacement

G1[G2\ψn]

of node n through graphG2 as the graph U, D by U := (V1\ {n}) ∪ V2, D := 

E1∩ (V1\ {n})2

∪ E2

{w, ψ(w)|w ∈ W2} ∪ {ψ(b), b|b ∈ B2}.

Thus we build the new graph by combining all nodes with the exception of n, the node to be replaced. All edges leading into n or out of it are removed, and replaced by edges intoG2: if

w, n ∈ E1 is an edge inG1, the node w must be a root inG2, then this edge will be replaced in the replacement graph by the edge w, ψ(w), similarly for edges n, b ∈ E1. Since the graphsG1 and G2 do not have cycles, and since ψ assigns by assumption different nodes to roots and to leaves,U, D does not have any cycles either.

We apply this construction to PF-systems now. Suppose that in addition to the assumptions made so far G2, γ and G2, χ are PF-systems. For getting our machinery going, the new edges need labels from X; these edges should not violate the typing constraints imposed on node n. Call the selection map ψ viable iff

∀w ∈ W2 : γw,n= χw,ψ(w)∧ ∀b ∈ B2 : γn,b= χψ(b),b

holds. Hence the Kleisli morphismsa (γ, n) and P (χ, G2) have the same signatures.

We define the PF-system

G1[G2\ψn], γ[χ\ψn]

in the obvious way by taking the values γ, and χ for edges in E1 or in E2, resp., depending on where they come from, and by setting for the new edges

γ[χ\ψn]w,ψ(w):= γw,n,

similarly for γ[χ\ψn]ψ(b),b. The labels for the nodes are left unchanged, coming either from γ or from χ. Then Proposition 6 implies that we may compute the work for the composed system in these steps:

• compute P (χ, G2), hence the work of the system which is to refine node n,

• substitute for a (γ, n) the morphism P (χ, G2), leaving the rest of γ alone; technically:

form γ[P (χ, G2)\n],

• compute the work done by the PF-system based on graph G1 with the modified value for γ.

Formally:

Proposition 8 Let the selection map ψ be viable, then

P (γ[χ\ψn],G1[G2\ψn]) =P (γ[P (χ, G2)\n], G1) . 2

Reading this equation from left to right, we see what happens when a node is substituted by an entire subsystem. Reading it from right to left it permits us to state the effect of shrinking a subsystem into a single node — this may be helpful when system evolution goes both ways, expanding nodes to subsystems, and replacing a subsystem by another one.

To illustrate: The PF-system in Figure 1 shall be refined as an extension to and a continuation of the discussion in Section 2. Node 2 will be replaced by the subsystem depicted in Figure 5.

A B

C

X2 Y1

Y2

X5

X6

v1 c1

c2 v2 X3

Figure 5: Replacing Subsystem Assign relations with the following signatures to the inner nodes:

RA ⊆ (X2× X3)× (Y1× Y2) , RB ⊆ Y1× X5,

RC ⊆ Y2× X6.

The work being done by this subsystem is then given by

{x2, x3, x5, x6|∃y1 ∈ Y1, y2 ∈ Y2:x2, x3, y1, y2 ∈ RA,y1, x5 ∈ RB,y2, x6 ∈ RC} The reader is invited to formulateG2, χ and a viable map ψ. Proposition 8 then gives the work of the entire system, when the replacement has been done, as

{x1, x2, x7, x8|∃x3 ∈ X3, x4 ∈ X4, x5∈ X5, x6 ∈ X6∃y1 ∈ Y1, y2 ∈ Y2:

x1, x3, x4 ∈ R1,x2, x3, y1, y2 ∈ RA,y1, x5 ∈ RB,y2, x6 ∈ RC

x4, x5, x7 ∈ R3,x6, x8 ∈ R4}.

1 3 The resulting system is given in Figure 6.

For the stochastic case one similarly assumes that stochastic relations KA: X2× X3  H × Y1× Y2, KB : Y1 H × X5,

KC : Y2 H × X6

are assigned to the subsystem’s nodes. The monoid H should be commutative in view of Proposition 5. The work is computed through the Kleisli product, yielding an expression for the measure K2(x2, x3) in terms of KA, KBand KCwhich is then substituted into the integral elaborated in Example 3. Specifically, the subsystem’s work is described by the stochastic relation Ks: X2× X3  H × X5× X6 such that for Q⊆ H × X5× X6

Note the accumulating behavior of the monoid’s elements.

This integral is needed, because the final equation describing the system’s work before replace-ment in Example 3 requires us to describe integration with respect to K2(x1, x3). Substituting,

we get from that equation



H×X3×X4



H×Y1×Y2



H×X6



H×X5



H×X7

K4(x6)({h1, x8|g1(hahchb)gh1, x7, x8 ∈ F }) K3(x4, x5)(dg, x7) ×

× KB(y1)(dhb, x5)KC(y2)(dhc, x6) KA(x1, x2)(dha, y1, y2) ×

× K1(x1)(dg1, x3, x4).

This formidable expression describes the probability that inputx1, x2 produces an element of the Borel set F ⊆ H × X7× X8. It is interesting to see how each component leaves its trace in the result’s monoid compartment.

Related documents