• Aucun résultat trouvé

Pattern Matching and Membership for Hierarchical Message Sequence Charts

N/A
N/A
Protected

Academic year: 2022

Partager "Pattern Matching and Membership for Hierarchical Message Sequence Charts"

Copied!
32
0
0

Texte intégral

(1)

Hierarhial Message Sequene Charts

BlaiseGenest andAnaMusholl

LIAFA,UniversitéParis VII2,pl.Jussieu,ase7014 F-75251Paris edex05e-mail:

{genest,musholl}liafa.jussieu.fr

Abstrat. Several formalisms and tools for software development use

hierarhy for system design, for instane stateharts and diagrams in

UML.Messagesequeneharts(MSCs) areastandardizednotationfor

asynhronouslyommuniatingproesses.ThenormZ.120inludesalso

hierarhialHMSCsinformofHigh-levelMSCs(HMSC).Algorithmson

MSCsrarelytakeinto aountall possibilities overedby thenorm. In

partiular,hierarhyis not takeninto aount sine the modelusually

onsidered are MSC-graphs that orrespond to the unfolding of (hier-

arhial) HMSCs. However, omplexity an inrease exponentially by

unfolding.Theaimofthispaperistoshowthatbasialgorithmsanbe

designedsuhthattheyavoidtheostlyunfoldingofhierarhialMSCs

and HMSCs. We onsider the membership and the pattern mathing

problemtoillustratethewaytoproeed.Weshowthatthemembership

problem for hierarhial HMSCs is PSPACE-omplete.Seond,we de-

sribeapolynomial-timealgorithmforthepattern-mathingproblemon

hierarhialMSCs.

1 Introdution

It isommonto usemaros towrite aprogramortospeifythe behaviorofa

system.Marosorhierarhialspeiationsallowamodulardesignofomplex

systemsandhavetheadvantageofbeingmoresuintanduser-friendly.Several

formalismsandtoolsforsoftwaredevelopmentusehierarhyforsystemdesign.

Oneofthemostprominentexamplesistheformalismofstateharts[11℄,whihis

aomponentofseveralobjet-orientednotations,suhastheUniedModeling

Language (UML). Besides stateharts, UML widely uses several kinds of dia-

grams(ativity,interationdiagramset),allbasedontheITUstandardZ.120

of message sequene harts (MSCs). Whilestateharts extendnite state ma-

hinesbyhierarhyandommuniationmehanisms,MSCsareavisualnotation

forasynhronouslyommuniatingproesses.TheusualappliationofMSCsin

teleommuniationisforapturingrequirementsofommuniationprotoolsin

formofsenariosinearlydesignstages.MSCsusuallyrepresentinompletespe-

iations, obtainedfrom apreliminary viewofthe systemthat abstrats away

severaldetailssuhasvariablesormessageontents.High-levelMSCs(HMSCs)

ombinebasiMSCsusinghoieanditeration,thusdesribingpossiblyinnite

olletions of senarios. For abstrat speiations aswith HMSCs, hierarhy

(2)

whihanbeveryabstrat,adesigner should be ableto merge dierentspei-

ation asesyielding thesameabstrat senarioandto use thissenarioasa

maro.Byusing marosdesignersmayidentify subsenarioswhihhaveto be

renedatalaterstage.

Algorithms on MSCs rarely take into aount the whole spetrum of the

HMSC standard denition. In partiular, hierarhy is not taken into aount

sinethemodelsusuallyonsideredareMSC-graphs,thatorrespondtotheun-

foldingof(hierarhial)HMSCs.However,omplexityaninreaseexponentially

by unfolding. Theaim of this paper is to show that this exponential blow-up

is avoidablein many ases,by avoiding theexpensive unfoldingand using the

hierarhyforomputingthedesiredresultsinamodularway.Weusetehniques

stemmingfromombinatorisonompressedtexts,sinehierarhialMSCde-

nitionsanbeseenasakindofompressionbymeansofStraight-LinePrograms

(SLP).

In this paper we onsider two fundamental problems for hierarhial HM-

SCs,that arealledherenestedhigh-level MSCs(nHMSCsforshort): member-

shipproblemandpatternmathing.However,wethinkthetehniquesdesribed

herean beused to solveotheralgorithmiproblems onnHMSCs aswell.The

membershipproblemisabasiquestion,askingforinstanewhetheranegative

senarioours inasystemspeiation,oraskingwhether apositive senario

isredundant,sinealreadyoveredbythespeiation.Withouthierarhy,the

membership problem for HMSCshas been shown to be NP-omplete,[1℄. The

reasonfor this omplexity blow-up (ompared to nite-state mahines) is that

MSCsarepartial-ordermodels.We showthathierarhyyieldsasmallinrease

in omplexity, preiselyweshowthat the membership problem fornHMSCs is

PSPACE-omplete. Surprisingly, hierarhyalone is the soure of theomplex-

ity.Weshownamelythat themembershipproblemforhierarhialautomatais

alreadyPSPACE-omplete.Thisresultshowsadierenebetweenmembership

and reahability,sinereahabilityforommuniatinghierarhialautomata is

alreadyEXPSPACE-omplete[12℄.

TheseondproblemonsideredinthispaperispatternmathingfornMSCs.

GiventwonMSCs

M, N

,wewanttoknowwhether

M

oursasapatternof

N

.A

polynomialtimesolutionforthisproblemisnotimmediate.Weapplysomenie

ombinatorialtehniquesstemmingfrompatternmathingonompressedtexts

andweobtainanalgorithmoftime

O(|C M | 2 · |M | 2 · |N | 2 )

,where

|M |, |N|

denote

thesizes of thedesriptionof

M

and

N

, and

|C M |

is the numberof onneted

omponentsintheommuniationgraphof

M

.Thisquestionsubsumesthetest

ofequalityoftwonMSC,andshowsthatequalityisdeidableinPTIMEaswell.

Related work. Regarding the omplexity of extended nite state mahines,

[12℄ onsidersthereahabilityandtraeequivaleneproblemsfor ommuniat-

ing FSMs(Finite States Mahines). Model-hekinghierarhialFSMsagainst

LTL and CTL properties is the topi of [4℄. The paper [3℄ ombines hierar-

hyandonurreny,analyzingtheomplexityofseveralproblems(reahability,

equivaleneet.)forommuniating,hierarhialFSMs.

(3)

reently,e.g. deteting raes[2,18℄, model-heking[5℄, pattern mathing with

gaps[19℄,inferene[1℄andrealizability[17,9,14℄,model-hekingagainstpartial-

order logis[16,21℄.HierarhialMSCshavebeenalso onsideredin [5℄forthe

model-hekingproblem.WenotehoweverthatourdenitionofnestedHMSCs

apturesalargerlassofMSCspeiationsthan[5℄.

An extendedabstrat of this paper waspresentedat LATIN'02 [8℄.As ad-

ditional resultweshowherehowto extend thepolynomialtime algorithm for

patternmathingnMSCsto theasewherethepatternisnotonneted.

2 Syntax and Semantis of Nested MSCs

Weadoptthedenition of(basi)messagesequeneharts (MSCforshort), as

desribedin theITU-standard[13℄.

Denition1. (Message Sequene Charts.) A messagesequene hart isa

tuple

M = hP, E, C, ℓ, m, <i

where:

P

isaniteset ofproesses,

E

isaniteset ofevents,

C

isanitesetof names formessages andloal ations,

ℓ : E → T = {i!j(a), i?j(a), i(a) | i 6= j ∈ P, a ∈ C}

labels eah event with

its type: on proess

i ∈ P

,the type iseither a send

i!j(a)

of message

a

to

proess

j

,or a reeive

i?j(a)

of message

a

from proess

j

,or a loal event

i(a)

. The labeling

partitions the set of events by type (send, reeive, or

loal),

E = S S · R S ·

L

,andbyproess,

E = S ·

i∈P E i

.Wedenote by

P (e)

the

proessof event

e

(i.e.,

P (e) = i

i

e ∈ E i

).

m : S → R

isabijetion mathingeahsendtotheorresponding reeive.If

m(s) = r

, then

ℓ(s) = i!j(a)

and

ℓ(r) = j?i(a)

for some proesses

i, j ∈ P

andsomemessagename

a ∈ C

.Wedenotetheevents

s, r

asmathingevents

andthepair

(s, r)

asmessage.

< ⊆ E × E

isanaylirelationbetween eventsonsistingof:

atotalorder on

E i

,for everyproess

i ∈ P

,and

• s < r

,whenever

m(s) = r

.

Theupperleft partofFigure 1depitsanMSC Monthree proesseswith

twomessagesandfourevents.Eahvertialline orrespondstoaproess,with

timeinreasingfromtoptobottom.

Forthequestionsonsideredhere,messagenamesareirrelevant.Thus,send

eventswillbeoftype

i!j

andreeiveeventsoftype

i?j

.Moreover,wheneverwe

referto anMSC in this paper, we meanatually its isomorphismlass, where

anisomorphismonthesetofevents

E

isabijetionthatisompatible withthe

typefuntion

and themessagefuntion

m

.

For ommuniationprotoolsit isnaturalto assumethateahommunia-

tion hannel delivers messages rst-in-rst-out (FIFO). We assume the FIFO

onditionthroughoutthepaper.Thatis,forallmessages

(e k , f k )

,

k = 1, 2

,suh

(4)

that

ℓ(e 1 ) = ℓ(e 2 )

and

ℓ(f 1 ) = ℓ(f 2 )

we requirethat

e 1 < e 2

i

f 1 < f 2

. The

reexive-transitivelosure

of the aylirelation

<

is apartial orderalled

visual order.Everytotalorder on

E

extending

isthenalled linearizationof

M

. A onguration (prex)

C

of an MSC

M

is a downward losed subset of

events,thatis,if

e < f ∈ E

with

f ∈ C

,then

e ∈ C

.

Notethat with the FIFOmessageorder,anytotalorder on aset of events

E

denes at mostoneMSC. We obtainthis MSCfrom theeventsequene by

mathing the

n

-th sendfrom

i

to

j

with the

n

-th reeiveon

j

from

i

, foreah

pairofdistintproesses

i, j

.

Aspeialaseofthepatternmathingproblemonsideredinthepaperisthe

equalitytestoftwo(nested)MSCs.Inorderto hektheequalityoftwoMSCs

M, N

(i.e.,uptoisomorphism)oneanhooseanylinearizationof

M

andhek

whether it is a linearization of

N

, too. An alternative approah, that will be used inouralgorithms,is tohekequalityoneahproess.Thus,foranMSC

M = hP, E, C, ℓ, m, <i

and a proess

i ∈ P

we let

M | i

denote the projetion

of

M

on the set

E i

of events loated on

i

. We have

M = N

if and only if

M

and

N

have thesame set of proesses,that is

P(M ) = P(N ) = P

, and if

theirprojetiononanyproessisequal,thatis

M | i = N | i

foreah

i ∈ P

(upto

isomorphism).NotethatbothtestsrelyontheFIFOorderofmessages.Without

theFIFOorder,alinearization(ortheprojetionsonproesses)doesnotsue

forreoveringtheMSC.Forexample,thelinearization

s 1 s 2 r 1 r 2

where

s 1 , s 2

are

sendsand

r 1 r 2

arereeivesfrom proess1toproess2,anproduetwoMSCs,

onewhere

m(s 1 ) = r 1 , m(s 2 ) = r 2

andonewhere

m(s 1 ) = r 2 , m(s 2 ) = r 1

.

Wefollowthe ITU norm and dene nestedMSCs (nMSC for short) by al-

lowing the reuse of an already dened MSC in adenition. Thedenition we

givebelowaimsatpreservingthevisualharaterofMSCs(seealsoFigure1).

Denition2. (Nested MSC, nMSC.) A nested MSC

M = (M q ) n q=1

is a

nite sequene ofmarosof the form

M q = hP q , E q , B q , ϕ q , C, ℓ q , m q , < q i

.

Eahmaro

M q

onsistsof:

Anite set

E q

ofevents.

Anite set

P q

of proesses.

Anite set

B q

of referenes (boxes)usedby

M q

.

A funtion

ϕ q

that assoiates eah referene

b ∈ B q

with an index

q <

ϕ q (b) ≤ n

. Thus, referene

b

refers to the maro

M ϕ q (b)

.We require that

P ϕ q (b) ⊆ P q

.

The type funtion

ℓ q : E q −→ T

, that assoiates eah event with a type

i!j, i?j

or

i(a)

, with

i, j ∈ P q

,

i 6= j

and

a ∈ C

. The labeling

partitions

the set of events by type (send, reeive, or loal),

E q = S q S ·

R q S ·

L q

, and

byproess,

E q = S ·

i∈P E q,i

.Wedenote by

P (e)

the proess ofevent

e

(i.e.,

P(e) = i

i

e ∈ E q,i

).

The messagefuntion

m q : S q −→ R q

that maps eah (send) event of type

i!j

with a(reeive)event oftype

j?i

,forall

i 6= j

.

Theaylirelation

< q

overthesetofeventsandreferenes

E q ∪ B q

,dened

by:

(5)

Foreahproess

k ∈ P q

,therelation

< q

isatotalorderovertheset

E q,k

of eventsloated on

k

andthe setof referenes

b ∈ B q

with

k ∈ P ϕ q (b)

.

• e < q f

whenever

m q (e) = f

in

M q

.

The nesting depth of

M

isthe maximal

d

suh that thereexists somesequene

q 1 < · · · < q d+1

with

ϕ q j (b) = q j+1

for some

b ∈ B q j

,for all

1 ≤ j ≤ d

.

We dene the indies suhthat the lowest levels of hierarhy, whih stands

forlevelswhihdonotusereferenestootherlevel,orrespondstosmallindies.

M S

S

S M S

S M

S

P

M M h

h g

g g

b 5

b 2

b 3 b 1

b 4 1 2 3

1 2 3 1 2 3

1 2 3

k

k

k

e

f

Fig.1.AnnMSC

P

usingtworeferenes,

S

and

M

.

Example 1. Consider thenMSC

P

in Figure 1.It uses three referenes,

B P = {b 1 , b 2 , b 3 }

that orrespond to

ϕ P (b 1 ) = ϕ P (b 3 ) = S

and

ϕ P (b 2 ) = M

. The

nesting depth of

P

is 2. The visual order

< P

of

P

requires on proess 1 the

order

b 1 < P e < P b 2 < P b 3

.Notiethat thedenition ofanMSC forbids

(f, e)

to beamessage,with

f

thesendand

e

thereeive,sinethiswouldontradit

theayliityof

< P

, evenintheasewhere

M

wouldbeempty.

Thesemantisof annMSC is theMSC dened byreplaing eah referene

of

M

bytheorrespondingMSC.Indutivelyitsuesto denethesemantis of nMSCs of nesting depth one. Let

M = (M q ) n q=1

be an nMSC of nesting

(6)

depthone,with

M q = hP q , E q , B q , ϕ q , C, ℓ q , m q , < q i

.Forsimplifyingthenotation below,wewriteinsteadof

ϕ 1 (b)

just

b

.

The MSC

hP, E, C, ℓ, m, <i

dened by

M = (M q ) n q=1

is given by

P = P 1

,

E = S ·

b∈B 1 E b S ·

E 1

,

ℓ = ∪ n q=1 ℓ q

and

m = ∪ n q=1 m q

.Thevisualorder

<

isdened

by

e < f

ifandonlyifeither

m(e) = f

,or

P (e) = P (f )

andoneofthefollowing

onditionsholds:

e, f ∈ E 1

and

e < 1 f

,

e, f ∈ E b

and

e < b f

,

e ∈ E 1 , f ∈ E b

and

e < 1 b

,

e ∈ E b , f ∈ E 1

and

b < 1 f

,

e ∈ E b , f ∈ E b

and

b < 1 b

,

where

b, b ∈ B 1

.Forsimpliity, wedenote the MSCdened by

M = (M q ) n q=1

as

M

,too.

Example 2. For the nMSC

P

in Figure 1, the lower right part of the piture

showstheMSCdened by

S

.Note that event

g ∈ E M

ourstwiein

S

for

simpliity,wedenotebothourrenesas

g

.

Notealso that thesemantis requires that

b 1 < 1 e

, but this doesnotmean

that all events of

S = ϕ P (b 1 )

must happen before

e ∈ E P

. Forinstane, the

rst ourrene of

g

in

S

preedes event

e

of

P

, but the seond ourrene is

onurrentwith

e

.

Obviously,asyntatiallyorretnMSC

M

mightnotyieldanMSCbeause

oftheFIFOorder.Forexample,themessage

(e, f )

of

P

wouldviolatetheFIFO

onditionif

M

wouldontainamessagefromproess1toproess3.Fortunately, itanbeveriedeasily(polynomialtime)whether annMSCsatisestheFIFO

ondition. To test for the FIFO ondition, it sues to test that there is no

e < g < h < f

and no

e < b < f

with

b

ontainingasend from

i

to

j

, where

(e, f ), (g, h)

aretwomessagesfrom

i

to

j

.

Size of nMSC. For omplexity estimations we will denote by

the overall

numberof proesses.The size ofan nMSC

M

is denoted as

|M |

. It represents

the size of thesyntatial desription of

M

, where anevent is ofsize oneand

thesizeofarefereneisthenumberofitsproesses.

3 Nested High-Level MSC

AnMSCanonlydesribeanitesenario.Forspeifyingmoreomplexbehav-

iors,in partiularinnitesetsof senarios,the ITUnorm proposesto ompose

MSCsinform ofMSC-graphs,byusing hoieanditeration.

Denition3. (MSC-graph)AnMSC-graphisgivenasatuple

G = hV, E, s, f, ϕi

,

where:

(V, E)

isadiretedgraph withstartingvertex

s ∈ V

andnalvertex

f ∈ V

.

Eahvertex

v

is labeledbythe MSC

ϕ(v)

.

(7)

eralizeMSC-graphstohierarhial HMSCs(ornestedhigh-levelMSCs,nHMSC

forshort).

Denition4. (Nested high-level MSC.) An nHMSC is a nite sequene

G = (G q ) n q=1

, where eah

G q

is either a labeled graph or an nMSC. A labeled

graph

G q

isatuple

hV q , E q , ϕ q , s q , f q i

onsistingof:

Adiretedgraph

(V q , E q )

withstarting vertex

s q

andnalvertex

f q

.

Afuntion

ϕ q

thatassoiateseahvertex

v

withareferene

q < ϕ q (v) ≤ n

,

representing

G ϕ q (v)

.

Thus, a node in an nHMSC anbemapped either to some graphorto an

nMSC.Thisdenitionombineshierarhialautomataasdenedin[4℄withour

denition of nMSC. The speial ase where there is only one proess (i.e., no

onurreny)yields thehierarhialautomata usedin[4℄

1

.

We rst need to dene the omposition of two MSCs

N 1 N 2

with

N k = hP k , E k , C k , ℓ k , m k , < k i

.Intuitively,wejustgluetogetherthetwodiagramsproess- wise.Let

N 1 N 2 = hP, E, C, ℓ, m, <i

with

E = E 1 S ·

E 2

,

P = P 1 ∪P 2

,

C = C 1 ∪ C 2

,

ℓ = ℓ 1 ∪ ℓ 2

,

m = m 1 ∪ m 2

and

< = < 1 ∪ < 2 ∪ [

i∈P

E 1,i × E 2,i .

ThesemantisofannHMSC

G = (G q ) n q=1

isa(possiblyinnite)setofMSCs

L(G)

denedreursively.If

G q

isannMSC,then

L(G q )

isasingletononsisting

of theMSCdened by

G q

. Letus onsider alabeledgraph

G q

. Then

L(G q )

is

thesetofMSCsassoiatedwiththeaeptingpathsof

G q

,thatis,pathsstarting

in

s q

andendingin

f q

.With apath

v 1 , . . . , v n

in

G q

weassoiatetheset ofall

MSCs

M 1 · · · M n

,where

M i ∈ L(G ϕ q (v i ) )

forall

1 ≤ i ≤ n

.Thesetofexeutions

of

G

isdenedas

L(G) = L(G 1 )

.

Asin[1℄wealsoonsideraweakersemantisfornHMSCs,thatdoesnotuse

the omposition of MSCs (alled weak losure in [1℄). This semantisis based

on taking the produt of the sequential behaviors of single proesses. Several

algorithmiproblemsanbesolvedmoreeientlyfortheweaklosureofMSC-

graphs.Thismakesitinterestingtoompareitwiththeusualsemantisalsoin

thesettingofnHMSCs.

WeaklosureofnHMSC.Let

G

beannHMSC.Then

L w (G)

denotestheset

ofMSCs

M

suhthatforeahproess

i

thereissomeMSC

N ∈ L(G)

suhthat

M | i

isequalto

N | i

.Notethat

L(G) ⊆ L w (G)

andthattheinlusionisstrit,in

general(see[1℄).

1

Atually, [4℄ allows several nal nodes in eah automaton, whih ounts for the

omplexityoftheiralgorithms.

(8)

a b G i

G i

Fig.2.AnnHMSC

G i+1

generating

(a + b) 2 i 1

with

G 1 = ǫ

.

4 Membership Problem

ChekingthemembershipofanMSC

M

inanMSC-graph

G

isusedtypiallyfor

hekingthatnobadsenarioanourinagivenspeiation.Anotherapplia-

tionishekingwhetheragoodsenarioisalreadyoveredbythespeiation.

Cheking membership is notan easy task already beause of the onurreny

impliedbytheMSComposition,allthemorein thepreseneofhierarhy.The

MSC membership problem

M ∈ ? L(G)

with

M

anMSC and

G

an MSC-graph

wasonsideredin[1℄,togetherwiththeweakmembershipproblem

M ∈ ? L w (G)

.

Theresultsof[1℄anbesummarizedasfollows:

TheMSCmembership problem isNP-omplete. Adeterministi algorithm

oftime

O(|G| · |M | )

solvesit2,where

isthenumberofproesses.

Theweak MSCmembershipproblemissolvablein time

O(|G| · |M |)

.

SotheMSCmembershipproblemissolvableinpolynomialtimeifwexthe

numberofproesses.

4.1 Hierarhial MembershipProblem

Themembershipproblemseemsapriori morediultforannMSC

M

against

an nHMSC

G

, sinethe naive approah of guessing apath of

G

and heking

equality with

M

is too expensive (both the path of

G

and the MSC dened

by

M

anbeofexponentialsize).However,itis easyto showthat weantest membershipinpolynomialspae:

Theorem1(Hierarhial MSC MembershipProblem) Given an nMSC

M

andannHMSC

G

,wean deide whether

M ∈ ? L(G)

inpolynomialspae.

2

Thisisaslightlyimprovedruntimeomparedtotheresultstatedin[1℄.

(9)

L(G)

andwemathitagainstthenMSC

M

,howeverexpandingneither

M

nor

G

.Reall thatfor testingequalityoftwoMSCs

M, N

,itsuesto hooseone

linearizationof

N

and hekwhether it isalinearizationof

M

. Hene,wean

hoose the linearization of the MSC in

G

(as long as we do not exlude any

MSC in

L(G)

, that is as longas we do notexlude every linearizationof one MSC).Weonsideronlythelinearizationsin

Lin 0 (G)

,where

Lin 0 (G)

isdened

reursively.If

G q

is annMSC, then

Lin 0 (G q )

is theset oflinearization of

G q

.

With apath

v 1 , . . . , v n

in

G q

weassoiatethesetof alllinearizations

u 1 · · · u n

,

where

u i ∈ Lin 0 (G ϕ q (v i ) )

forall

1 ≤ i ≤ n

.Letus onsideralabeledgraph

G q

.

Then

Lin 0 (G q )

isthesetoflinearizationsassoiatedwiththeaeptingpathsof

G q

,thatis,pathsstartingin

s q

andendingin

f q

.Wedene

Lin 0 (G) = Lin 0 (G 1 )

.

Intuitively,itmeansthatwedonotonsiderlinearizations

uavbw

ofpath

v 1 · · · v n

where

a

belongstoanode

v i

and

b

to

v j

with

j < i

,thatiseverynodeneedsto

befully exeutedbeforethenextnodeanbeonsidered.

Weneedto storeaongurationof

M

,orrespondingto theeventsalready mathedwiththeeventsfrom

G

.Sineaongurationisadownwardlosedset

ofevents,itanbestoredasatupleof

events(remindthat

isthenumberof

proesses),representingthelasteventoftheongurationoneahproess.Suh

atupleisoflinearsizew.r.t.thesizeof

M

.Eahevent

e

of

M = (M q ) n q=1

willbe

representedbyasequene

b 1 , . . . , b m

ofreferenesorrespondingtotheunfolding ofreferenesyielding

e

.Thatis,weindutivelyremind

b m

for

e ∈ E ϕ(b m )

where

b m

isarefereneof

ϕ(b m−1 )

,plustheposition of

e

in

M ϕ(b m )

.Thus,eahevent

anbestoredusinglinear-sizememory.Inourgure1,therstourreneof

g

in

P

orrespondsto

(b 1 , b 4 , g)

,theseondourreneto

(b 1 , b 5 , g)

,andsoon.

Similarly,weanstoretheurrentongurationofthelinearizationin

Lin 0 (G)

inspaepolynomialin

|G|

(aneventof

G

isrepresentedbyasequeneofnodes thenofreferenes).Sineanewnodeisstartedonlywhenthepreviousnodeis

fully exeuted, thelast eventfor everyproess belongsto thesamenode. The

non-deterministialgorithmonsistsin guessingasuessorongurationof

G

,

obtainedbyextendingtheurrentongurationbyanevent

e

suhthatthenew

onguration is still aprex of somelinearizationin

Lin 0 (G)

. Then we hek

that

e

an extendthe urrent linearizationof

M

as well. Thealgorithm stops

whentheongurationthatorrespondstothepathbeingguessedin

G

isequal

to

M

andthepathof

G

isaepting.

2

Theorem2belowshowsthatPSPACEisthelowestomplexityweanobtain

forthehierarhialmembershipproblem.Thelowerboundholdsevenifthereis

onlyoneproess(Theorem2),orifthegraph

G

isnothierarhial(Theorem3),

but notboth(Theorem4).Thisshowsalsothat xingthenumberofproesses

doesnotlowertheomplexityoftheproblem,unlikeinthenonhierarhialase.

WeshowthePSPACElowerboundforthefollowingproblem:givenastraight-

line program

W

(see below) and a hierarhial automaton

A

, test whether

W ∈ L(A)

.This questionorrespondsto thehierarhialmembership problem

(10)

withasingleproess.Notiealsothattheweakmembershipproblem

M ∈ ? L w (G)

[1℄anbereduedto thisquestion.

Straight-line programs. A straight-line program (SLP for short) over the

alphabet

Σ

is aontext-freegrammar withvariables

V = {X 1 , . . . , X k }

, initial

variable

X 1

and rules from

V × (V ∪ Σ) +

. The rules are suh that there is

exatlyoneruleforeahleft-hand side variableand if

X i −→ α

, theneah

X j

in

α

satises

j > i

.

Theonstraintsontherules makethat anyvariable

X i

generatesaunique

word.For onveniene, we denote the word generated by the variable

X i

also

as

X i

. Thelengthofavariable

X i

representsthelengthofthewordgenerated

by

X i

andisdenotedas

||X i ||

.Clearly,

||X i ||

anbeatmostexponentialinthe number of rules. The size

|X i |

of an SLP is the sumof thesizes of the rules.

Withoutlossofgenerality,weanassumethatrulesareofsize2,thatisofthe

form

X −→ Y Z

with

Y, Z ∈ V ∪ Σ

.

SineanyMSC

M

is determinedby itsprojetions

(M | i ) i∈P

, annMSC

M

anbeidentiedwith

SLPs

L 1 , . . . , L

.TheSLP

L i

generatestheprojetion

M | i

of

M

onthe set of eventsof proess

i ∈ P

. We denotethe variables used

by

L i

as

X | i

, where

X ∈ {M q | q = 1 · · · n}

. The initial variable of eah

L i

is

M n | i

. Atually, the SLPs are not in Chomsky normal form to preserve this

representationofnMSCs.

Example 3. ForthenMSC

P

isFigure1wehavethefollowingSLPgenerating

theprojetiononproess1:

P | 1 → S| 1 eM| 1 S| 1

,

S| 1 → M | 1 hM | 1

and

M | 1 → k

.

Theorem2 ItisPSPACE-ompletetohekwhether

W ∈ L(A)

forsomeSLP

W

andhierarhialautomaton

A

.Ifthe alphabetisunary,thenthemembership

problem isNP-omplete.

Remark1 TheNP-hardnessresultintheunaryasefollowsalsofrom [23℄.

Proof.Werstredue(1-in-3)SATtotheunarymembershipproblem,sine

weusethisredutioninthegeneralase,too.ThisproblemisNP-omplete,see

[24,6℄.

Let

ϕ = ∧ m j=1 C(α j , β j , γ j )

be an instane of (1-in-3) SAT over

n

variables

(x i ) i=1,n

.Here,alause

C(α j , β j , γ j )

istrueiexatlyoneoftheliterals

α j , β j , γ j

istrue.Weusetheunaryalphabet

{a}

.Note thatanyword

x ∈ a

isuniquely

dened byitslength.

Weassoiatewitheahlause

C j = C(α j , β j , γ j )

theword

w j ∈ a

oflength

4 j

.ThiswordanbedenedbyanSLPofpolynomialsize.Let

W = w 1 · · · w m ∈ a

be theword oflength

P m

j=1 4 j

. Theautomaton

A

onsists ofasequene of

hoies with transitions labeledby

t i

and

f i

, for

i

varying from 1to

n

, where

t i = P

j∈R i 4 j

and

R i = {j | x i ∈ {α j , β j , γ j }}

.Inthesameway,

f i = P

j∈S i 4 j

and

S i = {j | (¬x i ) ∈ {α j , β j , γ j }}

.

(11)

t

f

A t

f

1

1

n

n

Anypath

ρ

of

A

orrespondstoavaluation

σ

where eahvariable

x i

istrue

ifthepathhooses

t i

,andfalseifithooses

f i

.Let

n j

bethenumberofliterals

of

C j

that areset trueby

σ

. Reallthat

σ

satisestheformula

ϕ

i

n j = 1

for

all

j

.Itiseasytoseethat

ρ

islabeledbytheword

L ∈ a

oflength

P m j=1 n j 4 j

.

Notie that sine eah lause hasthree literals,

n j ∈ {0, 1, 2, 3}

for all

j

. The

lengthof

L

inbase4isthus

(n m n m−1 . . . n 1 0) 4

.Wehave

W = L

i

(11 . . . 10) 4

=

(n m n m−1 . . . n 1 0) 4

,thusi

n j = 1

forall

j

.Thatis,thereisapathin

A

labeled

by

W

i there is avaluation satisfying

ϕ

, whih implies that the membership

problemforhierarhialautomatononaunaryalphabet isNP-hard.

WenowshowtherststatementofTheorem2.Wereduethe(1-in-3)QBF

(one-in-threequantiedboolean formula)to thehierarhialmembershipprob-

lem. Let

ϕ

be an instane of (1-in-3) QBF of the form

ϕ = Q n x n · · · Q 1 x 1 ψ

,

where

Q i ∈ {∃, ∀}

andtheformula

ψ

isoftheform

m j=1 C(α j , β j , γ j )

.Asbefore,

alause

C(α j , β j , γ j )

istrueiexatlyoneliteralistrue.ThePSPACE-hardness ofthisproblemisshownin[24,6℄.

Theidea is to makethe valuations of thevariables orrespondto pathsin

the hierarhial automaton

(A i ) i=0,n

and to validate the valuations using the

SLPs

(W i ) i=0,n

.Wedenetheautomata

A i

and theSLPs

W i

byindution on

i = 0, . . . , n

.Here,weusethebinaryalphabet

{a, b}

.Theletter

a

will havethe

samemeaning asin theNP-ase, and the letter

b

will be used asadelimiting

symbol.

We dene the words

w j , t i , f i ∈ a

with respet to

ψ

as before. That is,

eah

w j

is assoiated with lause

C j

and

t i , f i

are assoiated withvariable

x i

.

Moreover, we assoiate with eah variable

x i

the word

w i+m ∈ a

of length

4 i+m

. Let

W 0 = w 1 · · · w n+m

bethewordof

a

oflength

P n+m

j=1 4 j

,andlet

A 0

beanautomatononsisting ofone

ǫ

-transition from itsinitial statetoits nal state.Letalso

S 0

beanautomatononsistingofonetransitionlabeledby

b

.The

SLP-ompressedwords

(W i ) i=1,n

,aredenedby:

W i −→ W i−1

, if

Q i = ∃

,

W i −→ W i−1 b W i−1

,if

Q i = ∀

.

Thereursive denition of the automata

(A i ) i=1,n

and

(S i ) i=0,n−1

is illus-

tratedinthegurebelow.Transitionsareeitherlabeledby

ǫ

,orbyxt

i = t i w i+m

orxf

i = f i w i+m

. The automatonon theleft denes

A i

when

Q i = ∀

, theau-

tomatoninthemiddledenes

A i

when

Q i = ∃

,andtheautomatonontheright

denes

S i

.Notethatthesymbol

b

isonlygeneratedby

S 0

.Inthegurewereall

itspositionbymarkinga

b

asideeah

S i

.

(12)

A i A i-1

xt i

xf i

A i xt i

A i-1 xf i

Sn-i

n-i-1

S S n-i-1

xt i+1

xf i+1

b b

A i-1

b S n-i

Theoverall ideaisasfollows.Thevaluesof

x i+1 , . . . , x n

arealreadyhosen

whenanautomatonalls

A i

(fromahigherhierarhylevel).Theautomaton

A i

ontheleftsets

x i

true,thenuses

S n−i

toreoverthexedvaluesof

x i+1 , . . . x n

,

andnallyitsets

x i

false.Theautomaton

A i

inthemiddleguesseswhether

x i

is

true(bytakingthetransitionlabeledbyxt

i

)orfalse(byhoosingthetransition

labeledbyxf

i

).Ifithoosesbothtransitionslabeledbyxt

i ,

xf

i

ornoneofthem,

then thewordlabeling thispathwill notbeequalto

W n

beause

W n

ontains

exatlyoneourreneof

w i+m

betweenanytwoonseutive

b

's.Weillustrate

how

A i

works on gure 3, that shows the unfolding of the automaton

A 2

for

ϕ = ∀x 2 ∀x 1 ψ

ontheleftandfor

ϕ = ∃x 2 ∀x 1 ψ

ontheright.

Toillustratehow

S n−i

reoversthevaluesof

x i+1 , . . . , x n

,weshow

S n−i

for

n = 9, i = 7

inthegurebelow.

S 2

xf 9 b

b

xf 8

xt 9

xf 9

xt 8

b b

xt 9

S 1 S 0

A i

and

S i

aredesignedsothatanypathof

A i

islabeledbyatmostonext

i

andatmostonexf

i

betweenanytwoonseutive

b

's,foreah

i

(foronveniene,

we suppose that eah automaton starts and ends with a tive

b

transition).

Thatis,apathanbelabeledbyxt

i

andxf

i

,butnotbytwoxf

i

ortwoxt

i

.By

ontradition,assumethattherearetwoonseutive

b

'sin

A i

suhthatthereis

apathfrom onetoanotherlabeledbytwoxt

j

(the asexf

j

issymmetri).We

taketheminimal

A i

whihensuresthis. Bytheminimalityof

A i

,this anonly

happeneitherbeauseoftherstxt

j

transitionof

A i

,orbetween

S n−i

andone

ofthetwo

A i−1

.Sinein

S n−i

allxt

k

ourafterthe(unique)

b

,there isnoxt

j

(13)

A 2

xt 2

xf 2 b b

xt 2

xf 2

b xt 1

xf 1

A

1

xt 2

xf 2 b b

xt 1

xf 1

A 1 xt

2

xf 2 b b

xt 1

xf 1

A 1

A 2

xt 2

xf 2 S 1

Fig.3.Unfoldingof

A 2

for

Q 2 x 2 Q 1 x 1 = ∀ x 2 ∀ x 1

ontheleft,andontheright,unfolding

of

A 2

for

Q 2 x 2 Q 1 x 1 = ∃ x 2 ∀ x 1

(14)

in

A i−1

before its rst

b

(if any).It alreadyshowsaontraditionin thease where

Q i = ∃

. Considernow the ase

Q i = ∀

. Forthe samereason asbefore,

there an beat mostonext

j

betweenthelast

b

of

A i−1

and the

b

in

S n−i

,for

all

k < i

.Finally,betweenthe

b

of

S n−i

andtherst

b

oftheseond

A i−1

there

anbeat mostonext

k

with

k > i

(from

S n−i

)andatmostonext

k

with

k < i

(from

A i−1

).Thus,in allasesweontradittheassumptionon

A i

.

Letusprovethat

W n ∈ L(A n )

ithereexistsasatisfyingvaluationtree

V T

for

ϕ

. A valuation tree

V T

is a binary tree of height

n + 1

suh that its root

(level

n

)islabeledby

x n

andallnodesonlevel

l

arelabeledby

x l

.Theleavesare

onlevel

0

,andareunlabeled.Anode

v

labeledby

x i

orrespondstoavaluation

σ(v)

ofthevariables

x i+1 , . . . , x n

.Forinstane,ifthevaluationforanodeis

x n

istrue, thenitshildrenmustevaluate

x n

totrue,and evaluate

x n−1

either to

trueorfalse.Moreover,anodeonlevel

k

havetwohildrenif

x k

is universally quantied (one hild evaluate

x k

to trueand theother oneto false),and one

hildif

x k

isexistentiallyquantied.WesaythatavaluationtreesatisesaQBF formula

ϕ = Q n x n · · · Q 1 x 1 ψ

ifforeveryvaluationofeveryleaf,

ψ

istrue.

Usingthepropertywejustshowed,weannote that betweenanytwoon-

seutive

b

'sofanypathof

A n

,thereareatmostthree

w j

andtwo

w i+m

forany

1 ≤ j ≤ m, 1 ≤ i ≤ n

. Thus ouroding in base fourfordetermining whethera

lauseis true,isstill appliable.Hene,apath

ρ

of

A n

islabeledby

W n

ifor

all

1 ≤ k ≤ n + m

thereisexatlyone

w k

betweenanytwoonseutive

b

's.

Assumethat

V T

isavaluationtreeshowingthat

ϕ

istrue.Avaluation

σ(v)

denes twowords

T (v), F (v)

asfollows: theword

T (v)

isthe onatenationof allxt

j

where

j > i

and

x j

istruein

σ(v)

. Theword

F (v)

istheonatenation of all xf

j

where

j > i

and

x j

is false in

σ(v)

. Let

v

be anode of

V T

labeled

by

x i

. Wedene the word

ρ(v) = T −1 (v)W i F −1 (v)

. Wereall that

T (v), F (v)

arewordsover

a

,hene

T −1 (v)W i F −1 (v)

is thewordthatresultsfrom

W i

by

deleting

|T (v)|

many a's in the prex and by deleting

|F (v)|

many a'sin the

sux.

Letusshowbyindution on level

i

that

ρ(v)

is in

L(A i )

foranynode

v

of

V T

onlevel

i

.

If

v

is a leaf of

V T

, then it denes an aepting valuation for

ψ

, hene

T (v)F (v) = W 0

using the sameargumentas in the NP-hardness ase. Hene

ρ(v) = W 0 W 0 −1 = ǫ ∈ L(A 0 )

.

Consideran internal node

v

labeled by

x i

with

Q i = ∀

. Let

v 1 , v 2

be the

hildrenof

v

,with

v 1

orrespondingto

x i

true,and

v 2

to

x i

false.Byindution

letussupposethat

ρ(v 1 )

,

ρ(v 2 )

arein

L(A i−1 )

.Then,

ρ(v) = T −1 (v)W i F −1 (v) = T −1 (v)W i−1 bW i−1 F −1 (v)

= T −1 (v)T (v 1 )ρ(v 1 )F (v 1 )bT (v 2 )ρ(v 2 )F(v 2 )F −1 (v)

=

xt

i ρ(v 1 )F (v 1 )bT (v 2 )ρ(v 2 )

xf

i

Weusedintheequationsabove

T −1 (v)T (v 1 ) =

xt

i

forthepositivehild

v 1

of

v

and

F −1 (v)F(v 2 ) =

xf

i

forthenegativehild

v 2

of

v

.Moreover,

F (v 1 )bT (v 2 ) =

(15)

F (v)bT (v) ∈ L(S n−i )

sine the indies of false variables in

σ(v 1 )

and of true

variablesin

σ(v 2 )

formapartitionof

{i+1, . . . , n}

.Thisshowsthat

ρ(v) ∈ L(A i )

.

Consideraninternal node

v

that islabeledby

x i

with

Q i = ∃

. Assume by

symmetry that

v 1

is the hild of

v

in

V T

(thus,

x i

is true).By indution we

assumethat

ρ(v 1 )

isin

L(A i−1 )

.Itiseasytoshownowthat

ρ(v) ∈ L(A i )

using:

ρ(v) = T −1 (v)W i F −1 (v) = T −1 (v)W i−1 F −1 (v)

= T −1 (v)T (v 1 )ρ(v 1 )F (v 1 )F −1 (v)

=

xt

i ρ(v 1 )

Forthereversediretiontheargumentsaresimilar.Fromaword

W = W n

of

A = A n

,weobtainsubwords

ρ(v)

in

L(A i )

asabove,labeledby

T −1 (v)W i F −1 (v)

.

Foreah leaf

v

thismeansthat

σ(v)

satisesexatlyone literalperlause.

2

Theorem2showsimmediatelythat thehierarhialmembership problemis

PSPACE-hard evenwith oneproess,byenodingthe alphabet

{a, b}

by loal

ationsonasingleproess.Similarargumentsanbeusedfortheasewhere

G

isanMSC-graphwithnohierarhy,asshowninthefollowingtheorem.

Theorem3 ThehierarhialMSCmembershipproblem

M ∈ ? L(G)

isPSPACE-

omplete. The lower boundholdseven if

G

isan MSC-graph, orifthere isonly

oneproess.

Proof.Theproblemweredue fromis(1-in-3)QBF.Let

F

beaninstaneof

(1-in-3)QBF of the form

F = (Q n x n ) . . . (Q 1 x 1 )ϕ

, where

Q i ∈ {∃, ∀}

and the

formula

ϕ

isoftheform

∧ j=1...m R(α j,1 , α j,2 , α j,3 )

,with

α j,k

literals.

Theideaistoletvaluationsofthevariablestoorrespondtopathsof

G

and

to validate thevaluationsusing the nMSC

M

. Wedene thegraph

G

andthe

nMSC

M

byindutionon

F = F n

.Let

F i = (Q i x i ) F i−1

,with

F 0 = ϕ

.Eah

F i

willdetermine

G i , M i

.

TheproessesusedintheonstrutionareSC

1 , . . . ,

SC

m

andRC

1 , . . . ,

RC

m

,

plusVY

1 , . . . ,

VN

n

andVN

1 , . . . ,

VN

n

.Here

V

meansavariableand

C

alause,

S

standsforsend,

R

forreeive,

Y

foryesand

N

forno.

For all

i

, let MY

i

be the MSC onsisting of amessage from VY

i

to VN

i

,

then bak from VN

i

to VY

i

, and a message from SC

j

to RC

j

for all

j

suh

that

x i ∈ {α j,1 , α j,2 , α j,3 }

. Symmetrially,letMN

i

be theMSConsisting ofa

messagefromVN

i

toVY

i

,thenbakfromVY

i

toVN

i

,andamessagefromSC

j

toRC

j

forall

j

suhthat

¬x i ∈ {α j,1 , α j,2 , α j,3 }

.

M 0

is an MSC onsisting of one message from SC

j

to RC

j

, for all

j

. The

MSC-graph

G 0

onsists of

4n

verties,labeledby MY

i

, MN

i

,or

. Thegraph

hoosesbetweenMY

i

andMN

i

forall

i

,asdepitedbelow:

(16)

MY

MN

G 0 MY

MN

1

1

n

n

Notethatallmessagesdened aboveommute,exeptfortheonesbetween

VY

i

andVN

i

.Let

a i

bethemessagefromVY

i

toVN

i

,and

b i

themessagefrom

VN

i

toVY

i

. Wewillusetheorderbetween

a i

,

b i

asfollows:Thesequene

a i b i

meansthat

x i

istrue,while

b i a i

meansthat

x i

isfalse.

Assumenowthat

G i−1 , M i−1

arealreadydened,andthat thereare

f

uni-

versalquantiersin

F i−1

.Forsimpliity,wedenote

a = a i

and

b = b i

.Notethat

inavaluationtreefor

F

showingthat

F

istrue,eahvalue0or1assignedtothe

variable

x i

isusedby

2 f

leaves.Avaluationtreeisdenedasusual,byassigning

eah universally quantied variable two hildren labeled 0 and 1, respetively

eahexistentiallyquantiedvariableonehildlabeled0or1.

If

F i = ∀x i F i−1

, then let

M i = (ab) 2 f M i−1 S i (ba) 2 f M i−1

(see Figure 4.1).

The MSC

S i

is used for synhronizing proesses ourring in

M i

. It ontains

a message between eah (ordered) pair of proesses of

M i

(in some arbitrary

order). Note that using thehierarhywe andesribe

(ab) 2 f

, andthus

M i

, by

anexpressionofpolynomialsize.

Let

G i = (V i , E i )

,where

V i = V i−1 ∪{e 0 }

and

E i = E i−1 ∪{(

Fin

, e 0 ), (e 0 ,

In

)}

.

The initial node In (the nal node Fin , respetively) of

G i

is the sameas for

G i−1

.Thevertex

e 0

islabeledbythesynhronizationMSC

S i

.

G i

G i-1

M

VY VN

i

M i-1

ba

S S

VY VN

M i-1

e 0

i i i i

i i

ab

Thedenition of

M i , G i

anbe explainedintuitivelyasfollows.Let

ρ

bea

pathof

G i

labeledby

M i

.Note thattheMSC

S i

ourringin

M i

hasto math

theMSC

S i

of

e 0

.Thus

ρ = ρ 1 e 0 ρ 2

,with

ρ 1

anaeptingpathof

G i−1

labeledby

(ab) 2 f M i−1

and

ρ 2

anaeptingpathof

G i−1

labeledby

(ba) 2 f M i−1

.Eahtime

ρ j

goes through

G 0

(whih happens

2 f

times),

ρ j

onsumes either

ab

of MY

i

or

ba

of MN

i

, so

ρ j

onsumesallourrenesof

a, b

in

(ab) 2 f

. Inpartiular,all

ourrenesonsumedby

ρ 1

areoftheform

ab

,whihensuresthatthevaluation

of

x i

assoiatedwith

ρ 1

isonsistent(

x i

is true).Thesameholdsfor thepath

ρ 2

,wherethevalueof

x i

isforedtobefalse.

Références

Documents relatifs

Now that HMSCs (a global specification) and communicating finite state machines (a set of local reactive machines, without global control) are defined, we can describe the

Unité de recherche INRIA Rennes, Irisa, Campus universitaire de Beaulieu, 35042 RENNES Cedex Unité de recherche INRIA Rhône-Alpes, 655, avenue de l’Europe, 38330 MONTBONNOT ST

The experimental results show that our client-side algorithms make average query execution more than two times faster than with regular TPF while only requiring 10% of the number

[8] Behrooz Razeghi, Slava Voloshynovskiy, Dimche Kostadinov, and Olga Taran, “Privacy preserving iden- tification using sparse approximation with ambiguiza- tion,” in Proceedings

L’archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des

This hierarchy also provides us with a theorem of the alternative (or duality theorem) which uses a non linear polynomial, a discrete analogue of the celebrated Farkas Lemma in

As an application of this estimate, we prove a Liouville theorem which states that harmonic maps between Euclidiean space ( Rn , go ) and Riemannian manifolds are

Instead of proving directly existence and uniqueness in the optimal matching problem, we solve in Section 3 another optimization problem, and we will show in Section 4 that it