• No results found

Bigraphs with sharing

N/A
N/A
Protected

Academic year: 2021

Share "Bigraphs with sharing"

Copied!
31
0
0

Loading.... (view fulltext now)

Full text

(1)

Contents lists available atScienceDirect

Theoretical

Computer

Science

www.elsevier.com/locate/tcs

Bigraphs

with

sharing

Michele Sevegnani

,

Muffy Calder

School of Computing Science, Sir Alwyn Williams Building, Lilybank Gardens, University of Glasgow, G12 8RZ, Glasgow, United Kingdom

a

r

t

i

c

l

e

i

n

f

o

a

b

s

t

r

a

c

t

Article history: Received2August2013

Receivedinrevisedform27January2015 Accepted4February2015

Availableonline19February2015 CommunicatedbyU.Montanari Keywords: Bigraphs Matching Spatialmodels Semantics Rewriting

Bigraphical Reactive Systems (BRS) were designed by Milner as a universal formalism for modellingsystemsthat evolveintime, locality, co-locality andconnectivity. Butthe underlying model of location (the place graph) is a forest, which means there is no straightforward representation of locations that can overlap or intersect. This occurs in many domains, for example in wireless signalling, social interactions and audio communications. Here,wedefinebigraphswithsharing,whichsolvesthisproblembyan extensionofthebasicformalism:wedefinetheplacegraphas adirectedacyclicgraph, thus allowinganaturalrepresentationof overlappingorintersecting locations.We give acomplete presentationof thetheory ofbigraphs withsharing, includinga categorical semantics,algebraicproperties,andseveralessentialproceduresforcomputation:bigraph withsharingmatching,aSATencodingofmatching,andcheckingafragmentofthelogic BiLog.Weshowthatmatchingisaninstanceofthe NP-completesub-graphisomorphism problem and our approach based on a SAT encoding is also efficient for standard bigraphs.Wegiveanoverviewof BigraphER (BigraphEvaluator& Rewriting),anefficient implementation of bigraphs with sharing that provides manipulation, simulation and visualisation.ThematchingengineisbasedontheSATencodingofthematchingalgorithm. Examplesfromthe802.11CSMA/CARTS/CTSprotocolandanetworkmanagementsupport systemillustratetheapplicabilityofthenewtheory.

©2015TheAuthors.PublishedbyElsevierB.V.Thisisanopenaccessarticleunderthe CCBYlicense(http://creativecommons.org/licenses/by/4.0/).

1. Introduction

BigraphicalReactiveSystems[1]weredesignedbyMilnerasauniversalformalismformodellinginteractingsystemsthat evolveintimeandspace.Theyprovideintuitive representationsforsystemswithevolvinglocality,co-locality,and connec-tivity.Inthecourseofworkingwithpracticalapplicationsofbigraphsformodellingdifferentaspectsofwirelessnetworking protocolsandmanagement,wediscoveredtherewasnostraightforwardwaytorepresentoverlappingorintersectingspatial locationsinbigraphs.But,overlapsarefundamentaltowirelesssignallingandtootherdomainssuchassocialinteractions andaudiocommunications.Consider forinstance,the wireless networkdrawn inFig. 1a. Aspatial modelbased ontrees cannotrepresentthefactthatmachineAiscurrentlyoccupyingaspacelocation coveredby bothA’ssignalandB’ssignal, butnotbyC’ssignal.

Wehavetherefore extendedstandardbigraphsto bigraphswithsharing, whichallowforoverlapping locations.This re-quiresdefiningtheplacegraphsofBRSasdirectedacyclicgraphs(DAGs),insteadofforests.Anexampleplacegraphwith sharingrepresentingthetopologyofthewireless networkinFig. 1aisgiveninFig. 1b.Thethreestations aredenotedby A, B,andC,whileSindicateswirelesssignalranges.Wewilldescribeindetailthisnotationinthefollowingsection.

*

Correspondingauthor.

E-mail addresses:[email protected](M. Sevegnani),[email protected](M. Calder). http://dx.doi.org/10.1016/j.tcs.2015.02.011

0304-3975/©2015TheAuthors.PublishedbyElsevierB.V.ThisisanopenaccessarticleundertheCCBYlicense (http://creativecommons.org/licenses/by/4.0/).

(2)

Fig. 1. Diagram of a wireless network of three stations (a) and a place graph with sharing representing its topology (b).

Fig. 2. Example bigraph B (a) and its constituents: place graph BP(b) and link graph BL(c).

Inthispaperwegiveacompletepresentationofthetheoryofbigraphswithsharing,includingacategoricalsemantics, algebraic properties,andseveralessentialprocedures forcomputation:bigraph withsharingmatching,aSAT encoding of matching,andcheckingafragmentofthelogic BiLog.Ineachcasewebuildontheexistingresultsfor(standard)bigraphs andourextensionsareconservativeinthesensethattheystillapplytostandardbigraphs.Wealsogiveanoverviewofour implementation,called BigraphER,whichprovidesanefficientimplementationofcomputation,simulation,andvisualisation forbigraphswithsharing.

Whenitisnecessarytodistinguishthedifferenttypesofbigraphs,werefertobigraphsasdefinedbyMilnerasstandard bigraphs.Wedonotrepeattheformaldefinitionshere,butreferthereaderto[1].

The paper is organised as follows. In the next Section we give an informal overview of bigraphs with sharing and discusswhyan explicitrepresentationofsharingisrequired.InSection 3weshow thatthe newcomposition andtensor productoperatorsretainthesamepropertiesasthestandardoperators,andthenwegiveacategoricalsemanticsandresults concerning algebraicformsandnormalisation.InSection 4wedefinea matchingalgorithmforbigraphswithsharingand give anoverviewofaSATencoding.Ourapproachleads toamoreefficientsolutionforstandardbigraphs,comparedwith the standardapproachthatisbasedon inference.InSection 5weshow howcheckinga substantialfragment ofthelogic

BiLog canbereducedtoourmatching,andinSection6wegiveanoverviewof BigraphER,ourimplementationofBRSwith sharing.Finally,in Section7we discussapplicationsofbigraphswithsharing andinSections 8and9wediscussrelated workandourconclusionsandplansforfuturework.

2. Bigraphswithsharing

2.1. Informaloverviewofstandardbigraphsandbigraphswithsharing

ThegraphicalformofanexamplestandardbigraphB isdrawninFig. 2a.Entities,realorvirtual,areencodedbynodes, represented asovals andcircles.Theirspatial placement is described by node nesting. Nodesare assigneda type, called control, denoted hereby the labels A, B and C.A set of controls identifies a signature. Interactionsbetween agents are represented bylinks like,forinstance,the edgeconnectingthe B-nodeandthe C-node.Eachnode can havezero,oneor manyports,indicatedbybullets.Nodesofthesamecontrolhavealsothesamenumberofports.Dashedrectanglesdenote regions,alsocalledroots.Therôleofaregionistospecifyadjacentpartsofthesystem.Shadedsquaresarecalledsites.They encode partsofthesystemthathavebeenabstractedaway.Notethatthereisnosignificanceinwherealinkcrossesthe boundaryofanodeinabigraph.Abigraphcanhaveinnernames andouternames.Inourexample, y isan outername.By conventioninthegraphicalform,innernamesandouternamesaredrawnbelowandabovethebigraph,respectively.They encode links(or potential links)to other bigraphsrepresentingthe externalenvironment orcontext. Elementsforminga bigraph, namelynodesandedges, canbe assigneduniqueidentifiers,collectivelycalledthesupport ofa bigraph.When a bigraphicalstructureisassignedasupport,itiscalledconcrete.

(3)

Fig. 3. Example bigraph with sharing G (a) and its place graph GP(b).

Fig. 4. An example bigraph with sharing (a) and two possible encodings (b) and (c).

Summarising,locality isrepresented bynode placing whileconnectivity isencodedby thelinksofthe bigraph.Thisis madeexplicitbydefiningbigraphsintermsoftheconstituentnotionsofplacegraph andlinkgraph.Aplacegraphisaforest whose rootsare the regions ofthe corresponding bigraph and leavesare its sites andatomic nodes(i.e. nodes withno children).Alinkgraphisastructuredescribingthelinkageofabigraph.Itconsistsofahypergraphwhoseverticesarethe namesandnodesofthecorrespondingbigraphandhyperedgesareitslinks.Placegraph BP andlinkgraph BL ofexample

bigraph B aredrawninFigs. 2band2c,respectively.

The capabilitiesof a bigraph to interactwiththe external environment are recordedin its interface.For example,we write B

: 

1

,

∅

→ 

1

,

{

y

}

to indicatethat B has one site, one region,no inner namesand

{

y

}

is its setofouter names. Informally,thecomposition oftwobigraphs F (oftencalledthecontext) andG,written F

G,isobtainedby insertingG’s regionsin F ’ssitesandbymerginglinksoncommonnames,i.e.innernamesinF thatarethesameasouternamesinG. Theotherfundamentaloperationonbigraphsistensorproduct,denotedby

.Itisonlydefinedoverbigraphswithdisjoint interfacesanditconsistsofputtingtwobigraphsside-by-side.

The dynamicaltheory of bigraphsisdefinedin termsofrewrite rules, calledreactionrules. Areaction rule R



R consistsofapairofbigraphsthatcanbeinsertedintothesamehostbigraph.Left-hand sideR (alsocalledredex)specifies thepatterntobechanged,whileright-handside(orreactum)R specifiesthechangedpattern.Asetofbigraphsandaset ofreaction rulesthat define how thebigraphscan evolveover time forma BigraphicalReactiveSystem(BRS).Thereaction relation onbigraphsinducedbythereactionrulesofaBRSiswrittenwithanarrowthus:



.

Wehaveextendedstandardbigraphstobigraphswithsharing,sothatspatiallocationscanoverlap.Thisinducesalocality modelbasedondirectedacyclicgraphsinsteadofforests.AnexamplebigraphwithsharingG isgiveninFig. 3a.Theonly differencecomparedwithstandardbigraph B inFig. 2aisthatthenodeofcontrol C isnowplacedwithintheintersection ofthetwo A-nodes, i.e. C isshared.Thiscanalsobe seeninthe DAGforplacegraph GP drawninFig. 3binwhichtwo

edgesfrom A to C arepresent.Thedefinitionoflinkgraphisunaffectedbytheintroductionofsharing,thus GL

=

BL (see Fig. 2c).

2.2. Whyextendbigraphstorepresentsharingexplicitly

The explicitintroduction ofsharing is justified by considering thedisadvantages of encoding sharing within standard bigraphs.Weconsidertwopossibleencodings.

The firstencoding consistsof theintroduction ofdummycontrolsto representintersections ofnodes.Forinstance, if nodesAandBareoverlapping,theirintersectionisrepresentedasaseparatenodeofcontrolA

B.Agraphical representa-tionisgiveninFig. 4b.Theimmediateconsequenceofthisapproachisthat placegraphsarestillrepresentable byforests. However, a major disadvantage is that the numberof dummynodes to be addedgrows exponentially with thenumber ofintersectingnodes.Moreover,thisencoding isnotcompletebecauseitcannotrepresentsharingwhennonodesare in-volved. Toprove this, considerthe exampleof aC-node shared by two regions.It is possibleto createa dummyregion containing C,howeverwecannot assignacontrol toit.Hence,welosetrackofwhowassharingthenode. Thiscanbea limitingfactorespeciallyinthedefinitionofreactionrules.AnothershortcomingisthatanodesharedbetweenAandBis placedinsidethedummynodeA

B,thusbothAandBappearasiftheydonothaveachild.

Thesecond encodingconsistsofkeepingacopyofasharednode insideeach ofitsparentsandconnectingthecopies witha speciallink.Forexample,when anode C issharedbetween AandB, bothA andB containa node ofcontrol C andthetwoCsarelinked together.This isdrawninFig. 4c.NotethatcontrolCisdefinedexactlyasCbutwithanextra

(4)

porttohandlethespeciallink.However,thisapproachdoesnotallowonetoexpresssharingwithoutnodes,e.g.twonodes sharingasite,andnodesorsiteswithnoparents.Anotherdisadvantageofthisapproachisthatlinksareusedtorepresent localityinsteadofconnectivity,goingagainstthespiritofbigraphs,inwhichthetwonotionsarekeptdistinct.

Although other encodings are possible, they all present similar problems. In conclusion, our simple extension yields several advantages. First, its completeness allows for the representation of arbitrary place graphs with sharing. Second, the modellingphase ismorenaturalandimmediate,becausenoadditionallinks, copiesofnodesandcontrolshavetobe introduced. Third, thestructure ofplacegraphs withsharingappears tohavemanysimilarities withstandard categorical notionsaswewillshowinthenextsection.Inparticular,itmakesplacegraphsself-dual.

2.3. Definitions

In thefollowing weintroduce formal definitionsofbigraphswithsharing, theirconstituents andtheir operations.We establishsomenotationalconventionsbelow.

Wefrequentlyinterpretanaturalnumberasafiniteordinal,namelym

= {

0

,

. . . ,

m

1

}

.Wewrite S

T toindicatethe unionofsetsknownorassumedtobedisjoint.Ifafunction f hasdomain S andS

S,then f



S denotestherestriction of f to S .Fortwofunctions f and g withdisjointdomains S andT wewrite f

g forthefunctionwithdomain S

T such that

(

f

g

)



S

=

f and

(

f

g

)



T

=

g.We writeIdS fortheidentity functionontheset S.Givenabinary relation

rel

A

×

B,wedenotethedomainrestrictionofrel overS

A byS



rel.Similarly,wewriterel



S fortherangerestriction ofrel overS

B.Wealsoindicateset

{

b

| (

a

,

b

)

rel

}

,thetransitiveclosureandtheinverseofrel bywritingrel

(

a

)

,rel+and rel−1, respectively. Indefining bigraphswe assume that names,node-identifiers, edge-identifiers andcontrolsare drawn from fourinfinitesets, respectively

X

,

V

,

E

and

K

,disjointfromeach other.We denote identifiersby lower-case letter: x, y,z fornames, v,u fornodes,ande0

,

e1

,

. . .

foredges.Upper-caseletters A

,

B

,

. . .

areusedtodenotebigraphsandtheir

constituents.Wewrite X

,

Y

,

. . .

toindicatesetsofnames.Weuse



asashorthandforinterface



0

,

∅

. 2.3.1. Placegraphs

Placegraphs withsharing are DAGstructuresasin Fig. 3b.Their formal definitionisa generalisation ofthestandard formulationbasedonforestsgivenin[1].

Definition1(Concrete placegraphwithsharing).Aconcreteplacegraphwithsharing

F

= (

VF

,

ctrlF

,

prntF

)

:

m

n

is a triple having an inner interface m and an outer interface n. These index the sites andregions of the place graph, respectively. F hasafinitesetVF

V

ofnodes,acontrolmapctrlF

:

VF

K

,andaparentrelation

prntF

⊆ (

m

VF

)

× (

VF

n

)

thatisacyclici.e.

(

v

,

v

)

/

prnt+F foranyv

VF.

TheonlydifferencewithMilner’sdefinitionisthatprntF isnowabinaryrelationinsteadofafunction.Thismodification is sufficienttoallowforsitesandnodestohavezeroormoreparents.Specialplacegraphs calledidentities,idm

:

m

m,

andsymmetries,

γm

,n

:

m

+

n

n

+

m,aredefinedasinstandardbigraphs(seeFig. 7).

Compositionandtensorproductaretheoperationsthatallowcombinationofplacegraphs.Theyaredefinedasfollows:

Definition2 (Composition forplacegraphswithsharing).If F

:

k

m and G

:

m

n aretwo concrete place graphs with sharingwithVF

VG

= ∅

,theircomposite

G

F

= (

V

,

ctrl

,

prnt

)

:

k

n

hasnodesV

=

VF

VG andcontrolmapctrl

=

ctrlF

ctrlG.Itsparentrelationprnt

⊆ (

k

V

)

× (

V

n

)

isgivenby: prntdef

=

prntG

prnt

prntF

where

prntF

=

prntF



VF prntG

=

VG



prntG prnt

= (

m



prntG

)

◦ (

prntF



m

) .

Definition3(Tensor productforplacegraphs).IfG0

:

m0

n0 andG1

:

m1

n1 aretwoconcreteplacegraphswithsharing

withVF

VG

= ∅

,theirtensorproduct

(5)

hasnodesV

=

VG0

VG1 andcontrolmapctrl

def

=

ctrlG0

ctrlG1.Itsparentrelationprnt

⊆ ((

m0

+

m1

)

V

)

× (

V

(

n0

+

n1

))

isdefinedasfollows: prntG0

prnt(m0,n0) G1 where, prnt(m0,n0) G1

= {(

v

,

w

)

| (

v

,

w

)

prntG1and v

,

w

VG1

}

{(

m0

+

i

,

w

)

| (

i

,

w

)

prntG1, w

VG1and i

m1

}

{(

v

,

n0

+

i

)

| (

v

,

i

)

prntG1, v

VG1and i

n1

}

{(

m0

+

i

,

n0

+

j

)

| (

i

,

j

)

prntG1, i

m1and j

n1

} .

2.3.2. Linkgraphs

Here we recall the standard definition oflink graphs given in [1]. The arity ofa control K is the numberof portsa K-nodecanhave.Itisindicatedbyar

(

K

)

=

n.

Definition4(Concrete linkgraph).Aconcretelinkgraph

F

= (

VF

,

EF

,

ctrlF

,

linkF

)

:

X

Y

isaquadruplehavinganinnerface X andanouterfaceY ,bothfinitesubsetsof

X

,calledrespectivelytheinnerandouter namesofthelinkgraph.F hasfinitesets VF

V

ofnodesand EF

E

ofedges,a controlmapctrlF

:

VF

K

anda link

map

linkF

:

X

PF

EF

Y

where PF def

= {(

v

,

i

)

|

i

ar

(

ctrlF

(

v

))

}

isthesetofportsof F .Thus

(

v

,

i

)

istheithportofnode v.Weshallcall X

PF the

points ofF ,andEF

Y itslinks.

Thesetsofpointsandthesetofportsofalinkl aredefinedby

pointsF

(

l

)

def

= {

p

|

linkF

(

p

)

=

l

}

portsF

(

l

)

def

=

pointsF

(

l

)

\

X

.

Anedgeisidle ifithasnopoints.IdentitiesovernamesetsaredefinedbyidX

= (∅,

∅,

∅,

IdX

)

:

X

X .

2.3.3. Bigraphswithsharing

Likeastandardbigraph,abigraph withsharingissimplythepairofitsconstituents:aplacegraphwithsharinganda linkgraph.

Definition5(Concrete bigraphwithsharing).Aconcretebigraph

F

= (

VF

,

EF

,

ctrlF

,

prntF

,

linkF

)

: 

k

,

X

 → 

m

,

Y



consists of a concrete place graph with sharing FP

= (

V

F

,

ctrlF

,

prntF

)

:

k

m and a concrete link graph FL

=

(

VF

,

EF

,

ctrlF

,

linkF

)

:

X

Y .Wewritetheconcretebigraphwithsharingas F

= 

FP

,

FL



.

Thecompositionoftwoconcretebigraphswithsharing A and B isobtainedbyseparatelycomposingtheirplacegraphs withsharingandlinkgraphs.Formally, A

B

= 

AP

BP

,

AL

BL



.Thesameholdsforthedefinitionoftensorproduct,i.e.

A

B

= 

AP

BP

,

AL

BL



.Thesupportofaconcretebigraph F ,is

|

F

|

=

V

F

EF.Theidentifiersofnodesandedgescan

be variedinadisciplined waybymeans ofa supporttranslation.Milner’sdefinitionalsoapplies tobigraphswithsharing. Werecallithere.

Definition6(Support translation).GiventwobigraphswithsharingF

,

G

: 

k

,

X



→ 

m

,

Y



,asupporttranslation

ρ

: |

F

|

→ |

G

|

fromF toG consistsofapairofbijections

ρV

:

VF

VG and

ρE

:

EF

EG thatrespectstructureasfollows:

1.

ρ

preservescontrols, i.e.ctrlG

ρ

V

=

ctrlF.It follows that

ρ

induces a bijection

ρP

:

PF

PG on ports, definedby

ρ

P

((

v

,

i

))

def

= (

ρ

V

(

v

),

i

)

.

2.

ρ

commuteswiththestructuralmapsasfollows:

prntG

◦ (

Idm

ρ

V

)

= (

Idn

ρ

V

)

prntF linkG

◦ (

IdX

ρ

P

)

= (

IdY

ρ

E

)

linkF

.

(6)

Fig. 5. Graphicalformsforbigraph

B

:→ 1,{y}:nestingdiagram (a)andstratifieddiagram (c).Thecorrespondingplacegraph

B

P:01 isgivenin (b).

Given F andthebijection

ρ

,theseconditionsuniquelydetermineG.WethereforedenoteG by

ρ



F , andcallitthesupport translationofF by

ρ

.WecallF andG supportequivalent,andwewriteF



G,ifsuchatranslationexists.Supporttranslation isdefinedsimilarlyforplacegraphsandlinkgraphs.

Since thedefinition oflinkgraph isnot affectedby the introductionofsharing intheplace graph,alsothe following standarddefinitionappliestobigraphswith sharing:

Definition7(Lean-supportequivalence). Twobigraphswithsharing F and G arelean-supportequivalent,written F



G,if theyaresupportequivalentignoringtheiridleedges.

An abstract bigraphwithsharingcanbe viewedasalean-support equivalenceclassofconcretebigraphswithsharing. Informally,aproceduretoturnaconcretebigraphwithsharingintoanabstractbigraphwithsharing,consistsofdiscarding all its identifiers andidle edges.1 It is also possible to do the reverse, namelyfrom abstract to concrete bigraphswith sharing:

Definition8(Concretion,abstraction).IfG isanabstractbigraphwithsharing,thenaconcretebigraphwithsharing



G ,called aconcretion ofG,isobtainedbyassigningtoeachnodeauniqueidentifierv

V

andtoeachedgeauniqueidentifiere

E

. Dually,bigraphG iscalledtheabstraction of



G.

Observethatanytwoconcretions



A,



B ofthesamebigrapharealwayslean-supportequivalent. 2.4. Graphicalnotation

Bigraphswithsharingcanberepresentedgraphicallybyusingamodifiedversion ofthenesting diagramsforstandard bigraphsinwhichintersectingnodesandregionsareallowed.

Twoexamples aregivenin Fig. 3aandFig. 5a.Thisnotation isbased onVenndiagramsanditis adequateto quickly specifysimplemodels.However,itcanbedifficulttodrawallthepossibleintersectionswhenthereareseveral(e.g.more thanthree)intersectingnodes.Moreover,thereareothertwomajordrawbacks:

Emptyintersectionsaremeaningless.Theseoftenarisewhentherearemorethantwonodesoverlapping.Forinstance, thepartoftheintersectionbetweentheAandC-nodesnotinB(i.e.

(

A

C

)

\

B)inFig. 5aisempty.

Itisimpossibletorepresentanodesharingaplacewithoneofitsancestors.

Toovercometheselimitations,weintroduceanewgraphicalform,calledstratifiednotation.Inthisnotation,weexplicitly represent the underlyingDAG structure of theplacing graph by specifyinghow places are shared. An examplestratified

1 Inourimplementation,weslightlymodifiedMilner’sdefinitionofcompositionforconcretelinkgraphsinordertoavoidthecreationofidleedges.In thisway,supportequivalenceissufficienttorepresentabstractbigraphs.

(7)

representation of bigraph B

:



→ 

1

,

{

y

}

is given in Fig. 5c. Note the similarities with the graphical representation of corresponding place graph BP

:

0

1 inFig. 5b.In the stratifiedrepresentation,nodes are organisedin differentlayers.

Inthe example,we havetwolayers. Thebottom one contains thechildren (nodesandsites), whilethetop one contains their parents(nodes andregions).ThesearenodesD,E, F,G andA,B,C,respectively. Eachnodein thebottomlayeris placedintoadifferentregion.Thisallowsthenodestobesharedbydifferentcombinationsofparents.Eachparentnodein thetop layercontains asite. Thenesting ofthenodesisspecifiedby thedashededges connectingthetwo layers.Inthe example,thefirstregioncontainingtheD-nodeisconnectedtothesitesintheBandC-nodes.ThismodelsthefactthatD issharedbyBandC.TheorphannodeGhasaplaceclosure,hencetherearenoedgesconnectingitsregiontothetoplayer. Therepresentationoflinksisnot changed.Notethat withthisnotation meaninglessintersectionsare notrepresented.In particulartheydonotarisebecauseemptyregionsarenotallowedtooccurinthebottomlayer.Notethatwhenabigraph hasamorecomplexnestingstructure,itispossibletousemorethantwolayers.

ThestratifiednotationiscloselyrelatedtothenormalformforbigraphswithsharingwewillintroduceinProposition 15. Moreover,theautomateddrawingroutinesforbigraphswithsharingimplementedinourtool BigraphER arebasedonthis notation(refertoSection6formoredetails).

In the remainder ofthis document it isassumed that bigraphsallow sharing, unless statedotherwise. Therefore, we oftenwrite“bigraph”tomean“bigraphwithsharing”.

3. Propertiesofbigraphswithsharing

In this section we list some propertiesof bigraphs withsharing. We begin by showing that composition andtensor productforplacegraphswithsharingenjoythesamepropertiesofthecorrespondingoperationsforstandardplacegraphs.

Lemma1(Associativity ofcomposition).IfA

:

m

n,B

:

k

m,C

:

h

k arethreeconcreteplacegraphswithsharingwithdisjoint nodesets,thenA

◦ (

B

C

)

= (

A

B

)

C .

Lemma2(Neutral elementsforcomposition).ForanyconcreteplacegraphwithsharingG

:

m

n,G

idm

=

G

=

idn

G.

Lemma3(Associativity oftensorproduct).If A

:

m0

n0,B

:

m1

n1,C

:

m2

n2arethreeconcreteplacegraphswithsharing

withdisjointnodesets,thenA

⊗ (

B

C

)

= (

A

B

)

C .

Lemma4(Neutral elementfortensorproduct).ForanyconcreteplacegraphwithsharingG

:

m

n thefollowingholdsG

id0

=

G

=

id0

G.

Wenowpresentsomepropertiescharacterisingcompositionofconcreteplacegraphs.Theywillbeusefulforthe defini-tionofthematchingalgorithmforbigraphswithsharinginSection4.Thefirstpropertystatesthatallthedescendantsofa node v inF arealsoin F .

Lemma5.GiventwoplacegraphsG

:

m

n andF

:

k

m suchthat

B

:

k

n

=

G

F

.

Foranynodev

VF,if

(

v

,

v

)

prnt+B,thenv

∈ (

k

VF

)

.

Anotherpropertyspecifies that inanyvalidcomposition G

F , when anode orsite v in F hasaparent setoverlapping withG,then G providesasetofsitessothat v’sparentsetcanbe constructedinthecomposition.Thedualpropertyon thechildrensetofanodeorregioninG alsoholds.

Lemma6.GiventwoplacegraphsG

:

m

n andF

:

k

m suchthat

B

:

k

n

=

G

F

.

Foranynodeorsitev

∈ (

k

VF

)

suchthat

(

prntB

 (

VG

n

))(

v

)

=

P ,withP

= ∅

,thereexistsasetS

m suchthat

(

prntF



m

)(

v

)

=

S



sS

prntG

(

s

)

=

P

Lemma7.GiventwoplacegraphsG

:

m

n andF

:

k

m suchthat

B

:

k

n

=

G

F

.

Foranynodeorregionv

∈ (

VG

n

)

suchthat

(

prntB1

 (

k

VF

))(

v

)

=

C ,withC

= ∅

,thereexistsasetR

m suchthat

(

prntG1



m

)(

v

)

=

R



rR

(8)

3.1. Categoricalsemantics

Bigraphswithsharingandtheiroperationscanbedefinedinthegeneralframeworkofcategorytheory.Letusrecallhere thedefinitionsoftwonon-standardkindsofcategoriesintroducedbyMilnerin[1]todefinestandardabstractandconcrete bigraphswithinacategoricalsemantics.

Definition9(Spm category).Apartialmonoidalcategoryissymmetric(spm) if,wheneverX

Y isdefined,thereisanarrow

γ

X,Y

:

X

Y

Y

X calledasymmetry,satisfyingthefollowingequationswhenthecompositionsandproductsaredefined:

1.

γ

X,

=

idX

2.

γ

Y,X

γ

X,Y

=

idXY

3.

γ

X1,Y1

◦ (

f

g

)

= (

g

f

)

γ

X0,Y0 for f

:

X0

X1andg

:

Y0

Y1 4.

γ

XY,Z

= (

γ

X,Z

idY

)

◦ (

idX

γ

Y,Z

)

Afunctorbetweenspmcategoriespreservesunit,productandsymmetries.

Definition10 (s-category). An s-category



C is a precategory inwhich each arrow f is assigned a finite support

|

f

|

S

. Further,



C possessesapartialtensorproduct,unitandsymmetries,asinanspmcategory.TheidentitiesidIandsymmetries

γ

I,J areassignedemptysupport.Inaddition:

For f

:

I

J and g

:

J

K ,thecomposition g

f isdefinediff J

=

J and

|

f

|

∩ |

g

|

= ∅

;then

|

g

f

|

= |

g

|

|

f

|

.

For f

:

I0

I1 and g

:

J0

J1,thetensorproduct f

g is definediff Ii

Ji isdefined(i

=

0

,

1)and

|

f

|

∩ |

g

|

= ∅

;

then

|

f

g

|

= |

f

|

|

g

|

.

Weadoptthefollowingnotationalconventions.Givenasignature

K

,wewriteBg



(

K)

andBg

(

K)

toindicatethe precat-egoryofconcretebigraphsandthecategoryofabstractbigraphs,respectively.Similarly,Pg



(K)

(Lg



(K)

)andPg

(K)

(Lg

(K)

) denotetheprecategoryofconcreteplace(link)graphsandthecategoryofabstractplace(link)graphs,respectively.

We beginbyshowingthatconcreteplacegraphswithsharingformans-category.Todoso,wehavetointerpretthem asaprecategory.

Proposition8(Precategory ofconcreteplacegraphswithsharing).Givenasignature

K

,SPg



(

K)

istheprecategorywhosearrowsare concreteplacegraphswithsharingasgiveninDefinition 1andobjectsarefiniteordinals.Identitiesareplacegraphsidm

:

m

m and

compositionissetoutinDefinition 2.

Beforepresentingthemainresult,weprovebifunctorialityoftensorproductforconcreteplacegraphswithsharing.

Lemma9(Bifunctoriality 1).If A0

:

n0

n1,A1

:

n1

n2,B0

:

m0

m1andB1

:

m1

m2arefourconcreteplacegraphswith

sharingwithdisjointnodesets,then

(

A1

B1

)

◦ (

A0

B0

)

= (

A1

A0

)

⊗ (

B1

B0

)

.

Lemma10(Bifunctoriality 2).Ifidmandidnaretwoplacegraphswithsharingthenidm

idn

=

idmn.

Wenowcancastconcreteplacegraphswithsharingtos-categories:

Proposition11.Givenasignature

K

,precategorySPg



(

K)

equippedwithafinitesupportVF foreveryarrowF

:

m

n,apartial

tensorproductlikeinDefinition 3andsymmetries

γm

,n,isans-category.

We proved that concreteplace graphswith sharingbelong to thesamekind ofcategory ofPg



(

K)

.Therefore, SPg



(

K)

togetherwithLg



(K)

canbeusedtoforms-categorySBg



(K)

ofconcretebigraphswithsharing.Thespmcategoryofabstract bigraphs withsharing isthen obtained by applyinga lean-support quotientfunctor

[·]

: 

SBg

(K)

SBg

(K)

defined asin standard bigraphs. Usualprojection functorslike

F

P

:

SBg

(

K)

SPg

(

K)

and

F

L

:

SBg

(

K)

Lg

(

K)

can alsobedefinedby dropping thelinkgraphandtheplacegraph,respectively.Since functionsarebinary relations,Pg

(K)

isa sub-categoryof

SPg

(

K)

.Thisrelationshipbetweenthetwocategoriesismadeexplicitbyinclusionfunctor

I

:

Pg

(

K)

SPg

(

K)

.Following the same argument, Pg



(K)

is a sub-category of SPg



(K)

with

I

acting as inclusion functor. The relationships between

SPg

(K)

andothercategoriesaresummarisedinFig. 6.Byanabuseofnotation,wewrite

I

,

I

toindicateinclusionfunctors,

F

P,

F

Pforfunctorsprojectingintoplacegraphs,and

[·]

todenotelean-supportquotientfunctors.

Wenowshowthatbigraphswithsharingformawidecategory,i.e.thereexistsafunctorwidthwhichallowstointerpret any bigraphwithsharing asafunction betweenfiniteordinals. First,we define functor

W

:

SPg

(

K)

Rel to movefrom bigraphswithsharingtothecategoryofbinaryrelationsbetweenordinals.Itactsastheidentityonobjectsandisdefined oneveryarrowGP

:

m

n asfollows:

(9)

Fig. 6. Bigraphical categories.

Note that Rel corresponds tothe class ofnode-free placegraphs withsharing. Second,we define functor width to move directlyto Finord by mappingevery siteof abigraph withsharing tothe setof itsregion ancestors.In moredetail, for everyarrowGP

:

m

n andforeverysitei

m wedefine

width

(

G

)(

i

)

=

j such that j

2nand

x

j

.(

i

,

x

)

prnt+G

.

ApropertyenjoyedbySPg

(K)

isself-duality.Thiscanbeprovedbyshowingthattheinverseofanyarrowisstillaplace graphwithsharing.Inmoredetail,foreveryarrowG

:

m

n wecanconstructitsinversearrowGop

:

n

m inwhichsites

andregions areswapped, prntGop

=

prntG1,andGop is itselfan arrowofSPg

(K)

. Notethatplace graphswithoutsharing arenotself-dual.Forexample,ifwetrytoconstructtheinverseofjoin

:

2

1,weobtainprnt−1

(

0

)

=

0 andprnt−1

(

0

)

=

1, whichisnotafunction.ThereforejoinopisnotanarrowofPg

(K)

.

Finally,wecharacteriseepimorphisms(epis)andmonomorphisms(monos)inSPg

(K)

.Therearetwoconsiderationsthat help understanding their definitions. The first one is that epis are the inversearrows of monos, and vice versa, dueto self-dualityofplacegraphs withsharing. Notethatthisisnot thecaseinstandard bigraphs.The second considerationis thatepis(monos)instandardplacegraphsarealsoepis(monos)inplacegraphswithsharing,sincePg

(K)

isasub-category ofSPg

(K)

.

Letusintroducesometerminology.Aregionisidle ifithasnochildrenwhereasasiteisanorphan ifithasnoparents. Twositeswiththesameparentsarecalledsiblings and,dually,tworegionswiththesamechildrenarecalledpartners.

Proposition12(Epis forplacegraphswithsharing).Aconcreteplacegraphwithsharingisepiiffnoregionisidleandnotworegions arepartners.

Proposition13(Monos forplacegraphswithsharing).Aconcreteplacegraphwithsharingismonoiffnotwositesaresiblingsand nositeisanorphan.

EpisandmonosinSBg

(K)

arethearrowsinwhichboththeplacegraphandthelinkgraphareepiandmono, respec-tively.

3.2. Algebraandnormalform

Wenowshowthat bigraphswithsharingcanbeexpressedbymeansofcomposition andtensorproductstartingfrom a minimal set ofelementary building blocks. Thisresults in an algebraic form similar to the one for standard bigraphs introduced byMilnerin[1].Alsoinbigraphswithsharing, nodesareintroduced byonlyone kindofelementarybigraph calledions. ForeachcontrolK withar

(

K

)

=

n,an ionconsistsofasingleK-nodethat iswithinone region,contains asite andhasportslinkedbijectivelyton distinctnames



x.NotationKx

:

1

→ 

1

,

{

x

}

expressesthisbigraph.Thecorresponding

elementary place graph is indicated by K

:

1

1. Two additional elementary place graphs are required: 0

:

1

0 and split

:

1

2.Theyarethedualbigraphsof1

:

0

1 and join

:

2

1,respectively.Theyareessentialtorepresentorphans andsharedplaces.TheentiresetofelementaryplacegraphsissummarisedinFig. 7.

Node-freeplacegraphswithsharing,againcalledplacings,arerangedoverby

φ,

ψ,

. . .

.Aplacingwithoneregionand n sitesisdenotedbymergen,wheremerge0

=

1,merge1

=

id1 andmerge2

=

join.Dually,weindicateaplacingwithonesite

andn regionsbysharen.Notethatshare0

=

0,share1

=

id1andshare2

=

split.

Inthefollowing,B,G,

ω

,

ψ

,etc. aretreatedasexpressionsforbigraphs,butequality‘

=

’issemantical,i.e.B

=

B means that B and B denotethe samebigraph andnot that they areidentical expressions.Formally,thisis ashorthand forthe moreverbose

|

B

=

B .

Proposition14.Everyplacegraphwithsharingcanbeexpressedasanexpressioncontainingonlytheelementaryplacegraphsgiven inFig. 7asconstantsandcompositionandtensorproductasoperators.

(10)

Fig. 7. Elementary place graphs. The additional elementary place graphs required to express sharing are split:1→2 and 0:1→0.

Proof. Weprovethepropositionbyinductiononthenumberofnodesoftheplacegraphwithsharing.Forthebasecase weshowthatnode-freeplacegraphs,i.e.placings,satisfytheproposition.Aplacing

ψ

:

m

n maybeexpressedas

ψ

= (

mergen0

⊗ · · · ⊗

mergenn−1

)

π

(

sharem0

⊗ · · · ⊗

sharemm−1

)

(1) where



imi

=

m,



ini

=

n and

π

:

n

n isapermutation.Sinceapermutation maybegeneratedbycompositionand

tensorproductofsymmetries

γm

,n,thepropositionholds.

Now,letB

:

m

n beaplacegraphwithsharingwithk

+

1 nodes.Then,ithasaconcretion



B

:

m

n withsupportV . Letv

V beanodeinwhichnoneofitschildrenarenodes(wecallitaleaf ).SuchanodemustexistbyacyclicityofprntB.

Notethat v canstillhavem

m sitesaschildren.Formally,

(

u

,

v

)

prntB ifandonlyifu

m .Withoutlossofgenerality weassumectrl

(

v

)

=

K.Let



B1

:

m

+

1

n betheplacegraphobtainedfrom



B byremovingnode v andsubstitutingitwith

asite.Furthermore,let



B0

:

m

m

+

1 betheplacegraphcontainingthesitesin



B andv.Thenwehavethat



B

= 

B1

◦ 

B0.

Bydroppingthesupportswecanwrite B

=

B1

B0.ButB0 canbedefinedintermsofelementaryplacegraphsasfollows: B0

= ψ ◦ (

idm

K

)

◦ φ

with

ψ

:

m

+

1

m

+

1

φ

:

m

m

+

1

.

Therefore,thestatementfollowsbyinductivehypothesisonB1 sinceithask nodes.

2

The constructionpresented intheproof abovecan beadoptedto definea normalformforplace graphswithsharing. Intuitively,aplacegraphwithsharing B canbeexpressedbyiterativelyapplyingtheprocedurefortheconstructionofB0,

untilallitsnodesareconsumed.Theonlydifferenceisthatalltheleafsareremovedinonegoinsteadofremovingonlya singleleafateachstep.Wemakethisprecisebyintroducingthenotionofnormalisedlevels.

Definition11(Level).Alevel L

:

m

n isaplacegraphwithsharingthatcanbeexpresseduniquely,uptopermutations,as

L

= (



i<nl

Ki

idl

)

◦ φ ,

withplacing

φ

:

m

n expressedasin(1).

Definition12(Normalised levels).Taketwolevels L1

:

m1

m2andL0

:

m0

m1 givenby L1

= (

K1

K

idl1

)

◦ φ

1 L0

= (

K0

idl0

)

◦ φ

0 K1

=



i<m2−l1−1 Ki K0

=



i<m1−l0 Ki

with

φ

0

:

m0

m1 and

φ

1

:

m1

m2 placings.Wesaythat L1 andL0arenormalised if

((

K1

idl1+1

)

◦ φ

1

)

◦ ((

K0

K

idl0

)

◦ φ

0

)

=

L1

L0

,

foranyK andanyplacings

φ

0

:

m0

m1

+

1

φ

1

:

m1

+

1

m2

.

In words,thismeans thatK isnot aleaf.Thus, itcannot bepushed downa levelandL0 isalreadyamaximal setof

leafsinL1

L0.Whenconsideringseverallevels Ln

◦ · · · ◦

L0,wesaythatthelevelsarenormalisedifeverypairofadjacent

(11)

Fig. 8. Graphical representation of SNF for place graph with sharing B.

Proposition15(SNFforplacegraphswithsharing).EveryplacegraphwithsharingB

:

m

n canbeexpresseduniquely,upto permutations,as

B

= ψ ◦

Ll−1

◦ · · · ◦

L0

where

ψ

isaplacingandeachLiisanormalisedlevel.

AgraphicalexplanationofthedefinitionisshowninFig. 8.

Example1.WenowuseSNFtoexpressplacegraphBP

:

0

1 giveninFig. 5b: BP

=

merge

3

L1

L0 L1

= (

A

B

C

id0

)

◦ φ

φ

= (

id1

merge2

merge3

)

◦ (

id2

γ

1,1

id2

)

◦ (

share3

share2

id1

0

)

L0

= (

E

D

F

G

id0

)

◦ (

1

1

1

1

) .

Thisnormalformcanalsobeextendedtorepresentbigraphswithsharing.Sincenodesaretheonlystructureincommon betweenlinkgraphsandplacegraphs,itsufficestoreplacethenodegeneratordescribedabovewiththeionKx

:

1

→ 

1

,

{

x

}

definedforstandardbigraphs.Hence,extendedlevels L

:

m

→ 

n

,

X



aredefinedasfollows:

L

= (



i<nl

K{ xi}

idl

)

◦ φ ,

where X

=



i

{ 

xi

}

.Since normalisationisdefinedoverplace graphs,thedefinitionofnormalised levelsisnot affectedby

theintroductionofions.

Proposition16(SNFforbigraphswithsharing).EverybigraphwithsharingG

: 

m

,

X



→ 

n

,

Y



maybeexpressed,uptopermutations andrenaming,as

G

= (ψ ⊗

ω

)

Sl−1

◦ · · · ◦

S0 Si

=

Li

idXi

where

ψ

isaplacingwithouterinterfacen,

ω

isalinkingwithouterinterfaceY ,andeachLiisanormalisedextendedlevel.Alsothe

innerfaceofL0ism andX0

=

X .

The algebraic operators defined forstandard bigraphs(e.g. merge product (_



_), parallel product (_

|

_)and nesting (_

.

_))canalsobeusedtoexpressbigraphswithsharing.However,anadditionaloperatorcapableofexpressingsharingis required.Wedefineshareexpressions as

share F by

φ

in Gdef

=

G

◦ (φ ⊗

idX

)

F

where

φ

isaplacingandalltheoperationsareassumeddefined.

3.2.1. Axiomsforbigraphicalequality

Wenowintroduce asetofaxiomsthat allowproof ofeveryvalidequationbetweenbigraphicalexpressions. Wewrite



B

=

B toindicateequalityinferredfromtheaxioms.Recallthattheexistence offunctor

W

:

SPg

(

K)

Rel assuresthat anyplacing

φ

:

m

n isalsoarelationbetweenfiniteordinalsm andn.Thus,

φ

canalsobeviewedasanarrowincategory

Rel.In[2,Theorem7],Mimramprovesthatacompleteaxiomatisation ofRel isgivenbytheequationaltheoryofqualitative bicommutative bialgebrae. Thisallows us todefine a completeaxiomatisation for placings withsharing asa supersetof

(12)

Table 1

Axiomsfor(standard)placegraphequality. Categoricalaxioms: A◦id= A=id◦A (cat1) A◦ (BC)= (AB)C (cat2) A⊗id= A=idA (cat3) A⊗ (BC)= (AB)C (cat4) idI⊗idJ=idIJ (cat5) (A1◦A0)⊗ (B1◦B0)= (A1⊗B1)◦ (A0⊗B0) (cat6) γI,=idI (cat7) γJ,IγI,J=idIJ (cat8) γI,K◦ (AB)= (BA)γH,J (A:HI,B:JK) (cat9) Placeaxioms:

join◦ (join⊗id1)=join◦ (id1⊗join) (plc1) join◦ (1⊗id1)=id1 (plc2)

joinγ1,1=join (plc3)

Table 2

Additionalaxiomsforplacegraphswithsharingequality. Co-monoidaxioms:

(split⊗id1)split= (id1⊗split)split (co-plc1)

(0⊗id1)split=id1 (co-plc1)

γ1,1◦split=split (co-plc1)

Bialgebraaxioms:

splitjoin= (joinjoin)◦ (id1⊗γ1,1⊗id1)◦ (splitsplit) (bia1)

0join=00 (bia2)

split1=11 (bia3)

0◦1=id0 (bia4)

joinsplit=id1 (bia5)

the axioms for Pg

(K)

introduced by Milner. These are reported in Table 1. The additional axiomsthat are required to obtaincompletenessoverplacegraphswithsharingformthequalitativebialgebra

(

{

0

},

join

,

1

,

split

,

0

,

γ

1,1

)

.Theyaregiven

inTable 2.

Proposition17(Completeness).ThesetofaxiomsinTables 1 and2iscompleteforexpressionsdenotingplacegraphswithsharing. Formally,B

=

B implies



B

=

B forallexpressionsB,B .

Proof(Outline). First,weshowthat



B

=

E and



B

=

E ,whereE andE areSNFexpressions.ObservethatProposition 15

assures thatsuch expressionsexistforanyplacegraphwithsharing.Second,we showthat thetwonormalformscanbe provenequal,i.e.



E

=

E .Thisamountstoshowingthatthetwoexpressionsonlydifferbypermutationsoftheionsinthe levels:



E

ψ

Ll−1

◦ · · · ◦

L0

=

E

ψ

L l1

◦ · · · ◦

L 0

 ψ ◦

Ll−1

(



i Ki

idl

)

◦ φ ◦ · · · ◦

L0

= ψ

L l1

(



i Kπ(i)

idl

)

◦ φ

◦ · · · ◦

L 0

(13)

Table 3

Axiomsforlinkgraphequality. Linkaxioms: x/x=idx (lnk1) z/(Y y)◦ (idYy/X)=z/Y X (lnk2) /yy/x=/x (lnk3) /yy/=id (lnk4) Nodeaxiom: (id1⊗α)◦Kx=Kα(x) (node)



E

=

ψ

ψ

◦ (

π

idl

)

◦(



i Ki

idl

)

◦ (

π

idl

)

◦ φ

◦ · · · ◦

L 0

..

.

whereequalitybetweenexpressionsforplacings(e.g.

 ψ = ψ

◦ (

π

idl

)

)canbeprovedbycompletenessoftheaxiomsin Tables 1 and2forexpressionsofplacingswithsharing.

2

Example2.Considerthefollowingexpressionsofplacingswithsharing:

φ

= (

id1

join

)

◦ (

split

id1

)

φ

= (

join

join

)

◦ (

share3

id1

) .

WenowshowhowtheadditionalaxiomsinTable 2arerequiredtoproveequalitybetween

φ

and

φ

:

 φ = φ

 φ = (

join

join

)

◦ (((

split

id1

)

split

)

id1

)

by definition of share3

 φ = (

join

join

)

◦ (((

split

id1

)

split

)

⊗ (

id1

id1

))

by(cat1)

 φ = (

join

join

)

◦ (

split

id1

id1

)

◦ (

split

id1

)

by(cat6)

 φ = (

join

join

)

◦ (

split

id2

)

◦ (

split

id1

)

by(cat5)

 φ = ((

join

split

)

⊗ (

join

id2

))

◦ (

split

id1

)

by(cat6)

 φ = ((

join

split

)

join

)

◦ (

split

id1

)

by(cat1)

Atthispoint,theonlywaytoreducetheright-handsideisbyinvokinganadditionalaxiomasfollows:

 φ = (

id1

join

)

◦ (

split

id1

)

by(bia5).

ThisresultcanbeextendedtoSBg

(K)

byincludingMilner’saxiomsforexpressionsoverlinkingsgiveninTable 3.Recall thatelementaryclosures andelementarysubstitutions aredenotedby

/

x

: {

x

}

→ ∅

and y

/

X

:

X

→ {

y

}

,respectively.

4. Matchingofbigraphswithsharing

ThebigraphmatchingproblemisacomputationaltaskinwhichabigraphP ,calledpattern,andabigraphT ,calledtarget, aregivenasinput,andonemustdeterminewhetherP occursinT .Thisproblemplaysafundamentalrôleinthedefinition ofBRSasan instanceoftheproblemariseseverytime areactionruleisapplied,inparticularwhentheoccurrencesofa redexneedtobecomputed.Moreover,wewillshowinSection5thatitispossibletoreducetheverificationofpredicates expressedin afragment of BiLog to one ormoreinstances ofbigraphmatching. Letusformally define an occurrenceas follows:

Definition13(Occurrence,matching).Abigraph P occurs inabigraph T iftheequation T

=

C

◦ (

P

idI

)

D holdsforsome

interface I

= 

m

,

X



andbigraphsC andD.Twooccurrencesaredefinedtobethesameiftheydifferonlybyapermutation on C ’ssitesand D’srootsorby abijectiverenamingon theinnernamesof C andtheouter namesof D.We saythat P matches T or P isamatch in T whenP occursinT .

(14)

Fig. 9. Match T=C◦ (P⊗idI)D.

Identifying matchesinvolvingrenamingsandpermutationsontheinterfacesisessential tocountcorrectlythenumber ofmatches. Further,inastochasticsettingthisallows forthecomputation ofstochasticrates [3].Wecall bigraphsC and D thecontext and theparameter (of P ), respectively. Thedecomposition ofabigraph T inducedby occurrence P canbe describedconvenientlybymeansofdiagramsasinFig. 9.ObservethatidentityidI isnecessarytoallownodesinC tohave

childrenalsoinD,andtoallowC andD tosharelinksthatdonotinvolveP .Thisistheonlydifferencewiththedefinition ofmatchingforstandardbigraphsintroducedbyMilner,inwhich I

= 

0

,

X



.

Whenconsideringconcretebigraphs,thesupportsof



T and



P havetobecompatibleinordertofindavalidoccurrence.

Definition14(Concrete occurrence).Let



P and



T betwoconcretebigraphs.Wesaythereisaconcreteoccurrence of



P in



T if P occursinT ,withP andT theabstractionsof



P and



T ,respectively.

Thedefinitionaboveimpliesthatwhen



P occursin



T ,thereexistsasupporttranslation

ρ

suchthat



T

= 

C

◦ (

P

idI

)

◦ 

D

and



P

=

ρ



P .Moreover,



-equivalentoccurrencesareregardedasthesame.Thedecompositioninducedbyanoccurrence canbedescribedbyapair

(ι,

η

)

,inwhichthefirstelementisasupporttranslationfromVP to VP

VT (i.e.

ι

=

ρ

V)and

η

isa mappingfromthelinksof P to thelinksofT . Notethat

ρE

η

becauseunlike

ρE

,

η

mapsbothouternamesand edges.

4.1. Algorithm

We nowpresentagraph-theoreticmatchingalgorithmforconcretebigraphswithsharing,afterintroducingsome defi-nitionsandnotationalconventions.Equivalentlinksaredefinedasfollows:

Definition15.Taketwolinksl

,

k inabigraph F

: 

m

,

X



→ 

n

,

Y



.Equivalencerelation

=

.

isdefinedasfollows

l

=

.

k iff count

(

l

)

=

count

(

k

)

and

τ

(

l

)

=

τ

(

k

)

where

τ

(

l

)

=

name if l

Y

edge if l

EFand points

(

l

)

PF open-edge otherwise

andcount

(

l

)

def

= {{

v

| (

v

,

i

)

ports

(

l

)

}}

isamultiset.

WealsodefineanexplicittransformationfromconcreteplacegraphstoDAGsasfollows.

Definition16(Underlying graph).Let F

= (

VF

,

ctrlF

,

prntF

)

:

m

n beaconcreteplacegraph.Directedgraph

G

F

= (

V

,

E

)

is

calledtheunderlyinggraph ofF .ThesetofnodesisV

=

VF andthesetofedgesisE

=

VF,VF



prntF



VF.

The transformation consists of dropping all the roots and sites from bigraph F . An important property is that any control-preserving graph isomorphism

ι

betweentwo underlying graphs is a support translation

ρV

between the corre-spondingplacegraphswhensitesandrootsareignored.Formally,

ι

:

G

F

G

G isabijectionsuchthatctrlF

(

u

)

=

ctrlG

(ι(

u

))

,

ctrlF

(

v

)

=

ctrlG

(ι(

v

))

and

(

u

,

v

)

prntF iff

(

ι

(

u

),

ι

(

v

))

prntG

.

Thisisequivalenttowriting

(

VG



prntG



VG

)

ι

=

ι

◦ (

VF



prntF



VF

) .

Hence,

ι

satisfies Definition 6 when roots and sites are ignored. This correspondence between

ι

and

ρV

motivates the reductionofthematchingproblemtothesub-graphisomorphismproblem.

Graphisomorphismsandmapsbetweenlinksareindicatedby

ι

and

η

,respectively.Wewrite

G



T todenotethesub-graph

of

G

T thatisisomorphic via

ι

to

G

P.Therefore,V



T

VT istherangeof

ι

.When anisomorphismisappliedtoaport we

(15)

Fig. 10. Example wireless network of three stations (a) and its bigraphical representation (b).

Fig. 11. Example reaction rule R R modelling a station moving to a space location not covered by other signals.

not considered.Inthefollowing,we assumethepatternandthetargetare P

: 

m

,

X



→ 

n

,

Y



andT

: 

m

,

X



→ 

n

,

Y



, respectively.Finally,thesetofidlelinksofconcretebigraph P isdefinedby

PL idle

def

= {

l

EP

Y

|

pointsP

(

l

)

= ∅} .

We are now ready to presentthe matching algorithm. We begin with an informal outline. The inputsof the algorithm are twoconcretebigraphs: thefirstbeingthepatternwhilethe secondis thetarget.The outputis thesetofpairs

(ι,

η

)

specifyingalltheoccurrencesofthepatterninthetarget.Thefirstphaseofthealgorithmconsistsofinvokingaprocedure that solves thesub-graph isomorphismproblem. Theunderlyinggraphs ofthe patternandthetarget areused asinputs. Theoutputisasetofgraphisomorphisms.Inthenextphase,thealgorithmchecksthateveryisomorphismobtainedinthe previousphasesatisfiesthefollowingcompatibility conditions:

Nodecontrolsarepreserved.

Thepatternhassitesandrootsallowingfortheconstructionofacontextandaparameterbydecomposingthetarget.

Nonodeinthecontexthasanancestorinthepattern.

Alltheisomorphismsfailingtopassanyofthechecksabovearediscarded.Finally,outputpairsarecomputedbyassociating every compatibleisomorphismwitha mappingfromthepatternlinkstothe targetlinks. Eachmappingensuresthat the linkgraphofthepatterncanbecomposedwiththelinkgraphofacontextandthelinkgraphofaparameter,bothobtained bydecomposingthetarget.Iftheprocedurefailstobuildsuchamapping,thenthecorrespondingisomorphismisdiscarded. Beforepresentingthefullspecificationofthealgorithm,weillustratewithasimpleexamplehowthealgorithmcomputes theoccurrencesinamatchinginstance.

Example3.ConsiderthewirelessnetworkgiveninFig. 10aanditsbigraphicalencodingB

:



→ 

1

,

{

aA

,

aB

,

aC

}

describedin Fig. 10b.Inthismodel,nodesofcontrolMandSencodestationsandwirelesssignals,respectively.Moreover,eachstation islinkedtoitssignalandanouternameencodingitsuniquenetworkaddress.Nowtakereactionrule R



R described bythediagraminFig. 11whichmodelsastationmovingtoaspacelocationnotcoveredbyothersignals.Ontheleft-hand side,theregioncontainingtheM-noderepresentsthefactthatthestationmaybewithintherangeofzeroormoresignals (besidesitsownsignal).Ontheright-handside,themachinecanonlybeintherangeofitssignal.Inordertocomputeall thebigraphsthatcanbegeneratedbyapplyingrule R



R to B,wehavetocomputealltheoccurrencesof R inB.

Accordingtothealgorithmoutlinedabove,thefirststepconsistsofcomputingconcretions



B and



R.Thenasetofgraph isomorphisms between the underlyinggraphs of the pattern andthe target are computed. In thiscase, there are seven possibleisomorphisms andall ofthemsatisfy thethree compatibilityconditions.Intuitively,each isomorphismassociates theedgewithformS

MintheplacegraphofthepatterngiveninFig. 12btoallthesevenedgeswiththesameformin

References

Related documents

The standard lifetime allowance, which is the total value of pension savings that can be accumulated without a tax recovery charge when a pension or lump sum is taken, reduced

[4] SAE Vehicle Network for Multiplexing and Data Communications Standards Committee, SAE J2178/3, “Class B Data Communication Network Messages: Frame IDs for Single Byte Forms

The present study, which looked at undergraduate level students, found that there was a statistically significant relationship, where Spearman’s r = .476, between online

The fourth recommendation covers the need for empirical support before the introduction of new data exclusivity protection or an increase in such protection. Thus far, policymakers

The purpose of this study is to assess the Cost and Benefits of Journals subscribed in the ‘Mohindar Singh (MS) Randhawa Library, Punjab Agricultural University,

The National Committee for the Prevention of Elder Abuse defines older adult abuse as “any form of mistreatment that results in harm or loss to an older person” and includes

• Arctic Fibre/Quintillion Networks create clean low latency path from US west coast through Alaska to NE Asia = Seattle to Tokyo &lt;104 ms; Seattle to London &lt;114ms.. •