warwick.ac.uk/lib-publications
Original citation:
Murawski, Andrzej S., Ramsay , S. J. and Tzevelekos, N.. (2017) Reachability in pushdown
register automata. Journal of Computer and System Sciences, 87. pp. 58-83.
Permanent WRAP URL:
http://wrap.warwick.ac.uk/86773
Copyright and reuse:
The Warwick Research Archive Portal (WRAP) makes this work of researchers of the
University of Warwick available open access under the following conditions.
This article is made available under the Creative Commons Attribution 4.0 International
license (CC BY 4.0) and may be reused according to the conditions of the license. For more
details see:
http://creativecommons.org/licenses/by/4.0/
A note on versions:
The version presented in WRAP is the published version, or, version of record, and may be
cited as it appears here.
Contents lists available atScienceDirect
Journal
of
Computer
and
System
Sciences
www.elsevier.com/locate/jcss
Reachability
in
pushdown
register
automata
✩
A.S. Murawski
a,
S.J. Ramsay
a,
∗
,
N. Tzevelekos
baDepartmentofComputerScience,UniversityofWarwick,CoventryCV47AL,UK
bSchoolofElectronicEngineeringandComputerScience,QueenMaryUniversityofLondon,LondonE14NS,UK
a
r
t
i
c
l
e
i
n
f
o
a
b
s
t
r
a
c
t
Articlehistory:
Received 19 November 2014
Received in revised form 9 January 2017 Accepted 13 February 2017
Available online 8 March 2017
Keywords: Register automata Pushdown automata Reachability Infinite alphabets Complexity
Weinvestigatereachabilityinpushdownautomataoverinfinitealphabets.Weshowthat, in terms of reachability/emptiness, these machines can be faithfully represented using only 3r elements of the alphabet, where r is the number of registers. We settle the complexityofassociatedreachability/emptinessproblems.Incontrasttoregisterautomata, theemptinessproblemforpushdownregisterautomataisEXPTIME-complete,independent of the register storage policy used. We also solve the global reachability problem by representing pushdown configurations with a special register automaton. Finally, we examineextensionsofpushdown storagetohigherordersand show thatreachability is undecidableatorder2.
©2017ElsevierInc.Allrightsreserved.
1. Introduction
Recent yearshaveseenlively interestinautomata overinfinitealphabets.Thishaslargely beendrivenby applications which, althoughdiverse, hadacommonthread indealing withalphabets ofpotentiallyunbounded size forwhich finite-domain abstractions were deemed unsatisfactory.A casein point are markuplanguages [20,4], mostnotably XML. Here, documentscontaindatavalueswhoserangeispotentiallyunboundedandqueriesareallowedtoperformcomparisontests on such data.Asimilar scenariooccursinreference-based programminglanguages,suchasobject-oriented [6,2,12,17]or ML-like languages[18,19]. Insuch languages,memoryis managed withthehelp ofreferencenames thatcan be created afreshandcomparedforequalitybutareotherwise abstract.Other examplesincludearray-accessing programs[1],which areallowed tousethearraytostoreandcompareelementsofanunboundeddomain,aswellasprogramswithrestricted integerparameters[7].
Suchapplicationscallforarobusttheoryofautomataoverinfinitealphabetswhichcanleadtoanunderstanding compa-rabletothatofthefinite-alphabetsetting.Suchatheorywillexposethelimitsofthismodelofcomputationandestablisha complexity-theoreticguideforapplications.Alotofthegroundwork,surveyedin[22,3],wasalreadydedicatedto uncover-inganotionof“regularity”intheinfinite-alphabetcase.Veryearlyinthatwork,awaywasproposedtoextendtheconcept offinitememorytoinfinitealphabetswhichconsistedin introducingafixednumberofregistersforstoringelementsofthe alphabet[13].Theconstructedautomata,calledFinite-MemoryAutomata[13]orRegisterAutomata[20],wouldotherwiselook justasfinite-stateautomatawherethetransitionlabelswouldalsoinvolveindicesreferringtoregisteraddresses.Building on the successofthis work,another strandaimed to identifythe infinite-alphabet“context-free”languages. Tothisend,
✩ Research supported by the Engineering and Physical Sciences Research Council (EP/J019577/1) and the Royal Academy of Engineering (Tzevelekos,
10216/111).
*
Corresponding author.E-mailaddresses:[email protected](A.S. Murawski), [email protected](S.J. Ramsay), [email protected](N. Tzevelekos).
Table 1
Complexity of the emptiness problem.
Register discipline S F S#0 M F RA NL-c NP-c PSPACE-c PDRA EXPTIME-c EXPTIME-c EXPTIME-c
ChengandKaminski[8]introducedanotionofcontext-freegrammarsoverinfinitealphabetsanddefinedacorresponding notion ofpushdown automata.Later, Segoufinpresented asimilar definition in[22],albeit couched ina waysuitable to processdatawords.
Ourpaperisdevotedtostudyingexactlysuchcontext-freecomputationalscenariosthroughaninvestigationofpushdown registersystems(PDRS),devicesinwhichregistersare integratedwitha pushdownstore.Althoughoffoundationalnature, the work is largely motivated by the pertinence of such machines to software model checking [6,2]. A particular such applicationisingame-semantics-basedverification[19,16],wherebythesemanticsofprogramsisalgorithmicallygivenby means ofvariantsofpushdown registersystems,which inturnare used asmodels to befed inprocedures forchecking programequivalence.Wepresentseveralnewresultsonthecomplexityofreachabilitytesting, whichaltogetherfilla gap inthetheoryof“context-free”languagesoverinfinitealphabets.Morespecifically,wemakethefollowingcontributions.
Alphabetdistinguishability Afinite-memoryautomaton[13]withrregisterscanstorerelementsoftheinfinitealphabetat anyinstant.Infact,suchautomataareonlycapableofrememberingrelementsoftheinfinitealphabetoverthecourseofa run—foranyacceptingrunonecanconstructanotheroneinvolvingonlyr elementsofthealphabet.1 Hereweshowthat, eventhoughpushdownregistersystemshavenoboundonthenumberofelementsofthealphabetthattheycanstoreat anyinstant,overthecourseofaruntheycanreally“remember”atmost3r ofthem.Moreprecisely,weshowthatforany runofaPDRSwithrregistersthereexistsanequivalentrun,i.e.withthesameinitialandfinalconfigurations,butinwhich every configurationcontainsregister assignmentsdrawn fromonly 3r elements. Moreover,no smallernumberisenough: weexhibitafamilyofPDRSwhoserunsrequirerememberingatleast3relements.
Reachabilitytesting Theabove-mentionedresultyieldsanobviousmethodologyforreductionstothefinite-alphabetsetting, whichimmediatelyimpliesdecidabilityofassociatedreachabilityandlanguageemptinessproblems.Whilethedecidability of emptiness has already been proved in [8]using context-free grammars,we provide exact complexity bounds forthe problem,namely,EXPTIME-completeness.
Inthepushdown-freesetting,languagenonemptinesswasknowntobeNL-,NP- andPSPACE-complete,dependingonthe registerdiscipline.Threeregisterassignmentdisciplines havebeenstudiedintheliterature,whichwe shallcall singleand full(S F),singleandinitiallyempty(S#0)andmultipleandfull(M F).Asingleassignmentdisciplinerequiresthatthecontents
ofallregistersbedistinct,whereasamultipleassignmentdisciplineallowsforduplicateregistercontents.Afullassignment discipline,ontheotherhand,requiresthatatall timesevery registermustcontainsome letterfromtheinfinitealphabet, whereas an initially empty discipline allows registers to be empty at the start of a run. The complexity of emptiness for register automata according to the assumed register discipline is given in the first row of Table 1: in the S F case the problemis NL-complete,asit coincides with emptiness ofthe underlying finite-state automaton; inthe S#0 caseit
becomes NP-complete[21],asone isabletousethe registerstoencode booleanassignments;whileinthe M F caseone isableto encodea linear-sizetape withthe registers,andthereforetheproblemisPSPACE-complete [10].In contrast,in thepushdowncase,weshowthatsuchdistinctionsdonotaffectthecomplexity:evenifidenticalelements canbekeptin differentregisters,theproblemcanstillbesolvedinEXPTIMEanditisEXPTIME-hardalreadyinthecasewhereonlydistinct elementsareallowed.Inthelattercase,thehardnessproofistechnicallyinvolvedsincesequencesofdistinctnamesdonot provide asupportive framework forrepresentingmemory content(as neededinreduction argumentsusing computation histories).
Globalreachability We give a simple,exponential-time algorithmfor globalreachability analysis. This analysisasks fora representationofallconfigurationsfromwhichaspecifiedsetoftargetconfigurationscanbereached.Inthefinite-alphabet caseit iswell known that, ifthetarget set isregular, the setof configurations thatreach it can becaptured by afinite automaton [5]. We prove an analogousresult in theinfinite-alphabet setting: givena PDRS
S
and a registerautomaton definingasetoftargetconfigurationsT ofS
,ouralgorithmconstructsanewregisterautomatonthatrepresentsexactlythe setofconfigurationsthatcanreachsomeconfigurationinT.Toensurethealgorithmisasmoothanalogyofthesaturation algorithm of[5],it manipulates a particularlysuccinct variant ofregister automatawhich we call a registermanipulating registerautomaton(RMRA),butweshowthatsuchmachinescanalwaysbetransformedtoamachineoftheusualkindfor atmostanexponentialincreaseinsize.Higher-order Higher-order pushdown automata [15] take the idea of pushdown storage further by allowing for nesting. Standardpushdownstoreisconsideredtobeorder1,whiletheelementsstoredinan order-k (k
>
1)pushdownstoreare(
k−
1)
-pushdownstores.Inthefinitealphabetsettingthisleadstoaninfinitehierarchyofdecidablemodelsofcomputation witha(
k−
1)
-EXPTIME-completeproblematorderk.Weexaminehowthemodelbehavesintheinfinitealphabetsetting, aftertheadditionofafixednumberofregistersforstoringelementsoftheinfinitealphabet.We firstobservethat onecanno longerestablishauniformbound onthenumberofsymbolsoftheinfinitealphabet that sufficetorepresentarbitraryruns. Theexistence ofsucha boundwouldimplydecidabilityoftheassociated reacha-bilityproblems,butthelackofa boundisnotsufficientforestablishingundecidability:indeed,thedecidableclassofdata automatafrom[4]containsanautomatonthatcanrecognise allwordsconsistingofdistinctletters.Still,weshowthatthe reachabilityproblemforhigher-orderregisterpushdownautomataisundecidable,alreadyatorder2 andwithoneregister.
2. Basicdefinitions
Letusassume acountably infinitealphabet
D
ofdatavaluesornames.Weintroduce asimpleformalism for compu-tations basedona finitenumberofD
-valuedregistersanda pushdownstore. Writing[
r]
for{
1,
· · ·
,
r}
, byan r-register assignmentwemeananinjectivemapfrom[
r]
toD
.WewriteRegr forthesetofallsuchassignments.2Definition1.Apushdownr-registersystem(r-PDRS)isatuple
S
=
Q,
qI,
τ
I,
δ
,where:•
Q isafinitesetofstates,withqI∈
Q beinginitial,•
τ
I∈
Regr istheinitialr-registerassignment,•
andδ
⊆
Q×
Opr×
Q isthetransitionrelation,withOpr
= {
i•,
push(
i),
pop(
i)
|
1≤
i≤
r}
∪ {
pop•}
.3Theoperationsexecutedineachtransitionhavethefollowingmeaning:thei•operationrefreshesthecontentofthei-th register;push
(
i)
pushesthesymbolcurrentlyinthei-thregisteronthestack;pop(
i)
popsthestackifthetopsymbolisthe same asthat storedinthe i-thregister;pop• popsthestack ifthetop ofthestackiscurrentlynotpresentinanyofthe registers.Thissemanticsisgivenformallybelow.Definition2.Aconfigurationofanr-PDRS
S
isatriple(
q,
τ
,
s)
∈
Q×
Regr×
D
∗.Wesaythat(
q2,
τ
2,
s2)
isasuccessorof(
q1,
τ
1,
s1)
,written(
q1,
τ
1,
s1)
(
q2,
τ
2,
s2)
,if(
q1,
op,
q2)
∈
δ
forsomeop∈
Oprandoneofthefollowingconditionsholds.•
op=
i•,∀
j.
τ
2(
i)
=
τ
1(
j)
,∀
j=
i.
τ
2(
j)
=
τ
1(
j)
ands2=
s1.•
op=
push(
i)
,τ
2=
τ
1ands2=
τ
1(
i)
s1.•
op=
pop(
i)
,τ
2=
τ
1 andτ
1(
i)
s2=
s1.•
op=
pop•,τ
2=
τ
1 and,forsomed∈
D
,∀
j.
τ
1(
j)
=
dandds2=
s1.Atransitionsequenceof
S
isasequenceρ
=
κ
0,
· · ·
,
κ
k ofconfigurationswithκ
jκ
j+1,forall0≤
j<
k.Wesaythatρ
endsinastateqifqk
=
q,whereqkisthestateinκ
k.Wecallρ
arunifκ
0=
(
qI,
τ
I,
)
.Example3.Inthisexamplewewillgoalittlewaybeyondourdefinitionandconsideraregisterpushdownautomatonrather thanaregisterpushdownsystem,sothatwecanmotivatethedefinitionofPDRSbylookingataparticularlanguageofwords thatisaccepted.Anr-PDRAisanr-PDRSequippedwithanadditionalfamilyoftransitions
{
i}
i∈[r]andadistinguishedsubsetoffinal states.Atransitioni can betakenonlyifthenext letteroftheinput wordmatches thecontentsofregisteri and the action of taking the transitionis to consume the letter. The following example is a 2-PDRAaccepting the language
{
w wR|
w∈
D
∗}
ofwords wfollowedbytheirownreverse.q0
q1
q2
q3
q4
q5
q6
q7 q8 q9
q10
2• 2• push
(
2)
1•1•
1
push
(
1)
ε
1• 1•1
pop
(
1)
pop(
2)
2 Thus, register assignments here are singleand full(S F).
Wedraw themachine’sonly finalstate circled.Theinitial registerassignmentis unimportant,butletussaythat itis
{
1→
a,
2→
b}
.Thebehaviour ofthemachineis asfollows.Starting fromstate q0,theautomatonfirst guessesaletter cfrom the infinitealphabet
D
to use as a ‘bottom of stack’marker and storesit inregister 2. To ensure that the guess isotherwiseunconstrained,thisisimplemented bytwo consecutive2• transitions(asingle 2• transitionwouldallow for guessinganyletterofD
undertheconstraintthatit isdifferentfroma andb).Themachine thenpushesthis‘bottomof stack’markerontothestackandmovesintothelooponstateq3.Duringthisloop,thewordwisconsumedfromtheinputby firstguessing thenext input letterusingtwo consecutive1• transitionsandthen readingitinusing the1 transition. The last part ofthe loop has the machine store each consumed letteron the stack. At the point atwhich the machine nondeterministically chooses to enter q7 ,the configuration has the form
(
q7,
{
1→
d,
2→
c}
,
wc)
where d is the finalletter of w.In the loop on q7 themachine readsin wR and, asin the finite-alphabetcase, the reversalof the wordis
ensuredbypoppingw offthestack.Finally,whenthestackhasbeenexhaustedexceptforthe‘bottomofstack’symbolc, thenthemachinemaytakethetransitiontoq2andthusaccept.
Remark4. r-PDRS is meantto be a minimalistic modelallowing usto studyreachability inthe infinite-alphabetsetting withregisters andpushdownstorage.Existingrelatedmodels[8,22]featuretransitionsofamorecompoundshape,which canbereadilytranslatedintosequencesofPDRStransitions.
Forinstance,atransitionofaninfinite-alphabetpushdownautomaton[8]typicallyinvolvesarefreshment(i•)followed by pop(pop
(
j)
) anda sequenceofpushes(push(
j)
).Thisdecompositionleads toalinearblow-up insizefortranslations ofreachabilityquestionsintother-PDRSsetting.Forregisterpushdownautomata[22],anadditionalcomplicationistheir use of non-injective register assignments. Observe, though, that transitions in the non-injective framework can be easily mimicked usinginjective registerassignments provided we keep trackof thepartitions determined by duplicated values inthe originalautomaton.The book-keepingcan be implementedinside thecontrol state,which leadsto an exponential blow-up inthesize ofthesystem, becausethe numberofallpossible partitionsisexponential.Notethat thenumber of registersdoesnotchangeduringsuchasimulation.Anotherdifferenceisthatregisterpushdownautomata[22]aretailored towards datalanguages, i.e.a stacksymbol is an element ofD
paired up witha tag drawnfrom a finiteset. From this perspective,r-PDRSsuseasingletonsetoftags.Still,richertagsetscouldbeencodedviasequences ofelementsofD
(for example,tosimulatethei-thout ofk tags,we couldpushsequences oftheformd1id2 ford1,
d2∈
D
withd1=
d2). Thisreductionisachievableinpolynomialtime.
Following [13,8,20], we mostly useinjective registerassignments. Thisis done toallow usto explore whetherthe re-striction still leads to asymptotically moreefficient reachabilitytesting, as inthe pushdown-free case. Ona foundational note,injectivity givesa moreessentialtreatmentoffreshnesswithrespecttoasetofregisters: non-injectiveassignments canbe easily usedtoencode PSPACEcomputationsthat havelittletodowiththeinteraction betweenfinite control(and pushdown)andfreshness.
Namepermutations There is a natural action of the group of permutations of
D
on stacks, assignments, runs, etc. For instance,givena permutationπ
:
D
→
D
andan assignmentτ
,the resultofapplyingπ
toτ
is theregisterassignmentπ
·
τ
givenby{
(
i,
π
(
d))
|
(
i,
d)
∈
τ
}
.Similarly,π
·
s=
π
(
dn)
· · ·
π
(
d1)
foranystacks=
dn· · ·
d1 while,ontheother hand,π
·
q=
q forall statesq.Hence,π
·
(
q,
τ
,
s)
=
(
q,
π
·
τ
,
π
·
s)
and, forρ
=
κ
0· · ·
κ
n a transitionsequence,π
·
ρ
isthesequence
π
·
κ
0,
· · ·
,
π
·
κ
n.Notethat,aslongasourconstructionsinvolvefinitelymanynames,theywillalwayshaveafinitesupport:wesaythata setS
⊆
D
supportssome(nominal)elementxif,forallpermutationsπ
,ifπ
(
n)
=
nforalln∈
Sthenπ
·
x=
x.Accordingly,thesupport
ν
(
x)
ofxisthesmallestsetS supportingx.Forexample,ν
(
τ
)
= {
τ
(
i)
|
i∈ [
r]}
,forallassignmentsτ
.The sup-portofarunρ
=
κ
0· · ·
κ
n isν
(
ρ
)
=
nj=0
ν
(
κ
j)
,i.e.itconsistsofallelementsofD
thatoccurinit.Thefinite-supportsettingcanbeformallydescribedbymeansofnominalsets[11]andclosureresultssuchasthefollowinghold.
Fact5(Closureunderpermutations).Fixanr-PDRSandlet
ρ
beatransitionsequenceandπ
:
D
→
D
apermutation.Thenπ
·
ρ
isalsoatransitionsequence.3. Distinguishability
Deviceswithrregistersbutwithoutpushdownstorage,suchasfinite-memoryautomata[13],cantakeadvantageofthe registerstodistinguishr elementsof
D
fromtherest.Consequently,anyruncan bereplacedwitharunthatendsinthe samestate,yetissupportedbymerelyrelementsoftheinfinitealphabet[13,Proposition 4].With extra pushdown storage, an r-PDRS is capable of storing unboundedly many elements of
D
. Nevertheless, the restrictednature ofthestack makes itpossible toplacea finitebound on thesize ofthesupport neededforarun to a givenstate,whichisagainafunctionofthenumberofregisters.Lemma6(Limiteddistinguishability).Fixanr-PDRS.Foreverytransitionsequence
ρ
=
(
q0,
τ
0,
)
n(
qn,
τ
n,
)
,thereisatransitionProof. Theproofisbyinductiononn.Whenn
≤
1,theresultistrivial.Otherwise,wedistinguishtwocases. Inthefirstcase,thetransitionsequenceisoftheform:(
q0,
τ
0,
)
(
q1,
τ
1,
d)
n−2(
qn−1,
τ
n−1,
d)
(
qn,
τ
n,
)
in whichthe first transitionisby push
(
i)
(sod=
τ
1(
i)
), thelast transitionis by pop(
j)
or pop• andthe stackdoesnotempty until thefinal transition. Sinced isnever poppedfromthestack during themiddlesegment, also
(
q1,
τ
1,
)
n−2(
qn−1,
τ
n−1,
)
isa validtransitionsequenceandhence,fromthe inductionhypothesis,thereis atransitionsequencebe-tweenthesametwoconfigurationsusingnomorethan3rnames.Byaddingdtothebottomofeverystackinthissequence one obtains another validtransitionsequence:
(
q1,
τ
1,
d)
n−2(
qn−1,
τ
n−1,
d)
withτ
1=
τ
1 andτ
n−1=
τ
n−1, andthenewsequencefeatures
≤
3rnames.Itfollowsthatthelattercanbeextendedtotherequired:(
q0,
τ
0,
)
(
q1,
τ
1,
d)
n−2(
qn−1,
τ
n−1,
d)
(
qn,
τ
n,
)
sinceneither push
(
i)
,norpop(
j)/
pop•changetheregisters. Otherwise,thetransitionsequenceisoftheform:(
q0,
τ
0,
)
k(
qk,
τ
k,
)
n−k(
qn,
τ
n,
)
with0
<
k<
n.Itfollowsfromtheinductionhypothesisthattherearesequences:ρ
1=
(
q0,
τ
0,
)
k(
qk,
τ
k,
)
ρ
2=
(
qk,
τ
k,
)
n−k(
qn,
τ
n,
)
with
τ
0=
τ
0,τ
n=
τ
n,τ
k=
τ
kandwhicheach,individually,usenomorethan3r names.LetN⊇
ν
(
τ
0)
∪
ν
(
τ
k)
∪
ν
(
τ
n)
beasetofnamesofsize3r.Weaimtomap
ν
(
ρ
1)
andν
(
ρ
2)
intoN byinjectionsiand j respectively.Foriweseti(
a)
=
aforanya
∈
(
ν
(
τ
0)
∪
ν
(
τ
k))
andotherwisechoosesome distinctb∈
N\
(
ν
(
τ
0)
∪
ν
(
τ
k))
.Similarly,for j we set j(
a)
=
a foranya
∈
(
ν
(
τ
k)
∪
ν
(
τ
n))
andotherwisechoosesomedistinctb∈
N\
(
ν
(
τ
k)
∪
ν
(
τ
n))
.Notethat thesechoicesare alwayspossiblebecause
|
ν
(
ρ
1)
|
≤ |
N|
≥ |
ν
(
ρ
2)
|
.Finally,weextendiand j topermutationsπ
i andπ
jonD
.Sincetransitionsequencesareclosedunderpermutations(Fact 5):
(
q0,
π
i·
τ
0,
)
k(
qk,
π
i·
τ
k=
π
j·
τ
k,
)
n−k(
qn,
π
j·
τ
n,
)
isavalidtransitionsequencewith
π
i·
τ
0=
τ
0,π
j·
τ
n=
τ
n andwhichissupportedbyasubsetofN.2
Corollary7.Fixanr-PDRS
S
andastateq ofS
.IfthereisarunofS
endinginq thenthereisarunofS
endinginq thatissupported byatmost3r distinctnames.The 3rboundgivenabove isoptimalinthesense thatthereexists anr-PDRSsuchthatall runsto acertainstate will havetorelyon3relementsof
D
.Lemma8(Mostdiscriminatingr-PDRS).Thereexistsanr-PDRS
Q,
qI,
τ
I,
andq
∈
Q suchthat|
ν
(
ρ
)
|
=
3r foranyrunρ
endinginq.
Proof. Considerthefollowinghigh-leveldescriptionofanr-PDRS.Themachineproceedsasfollows:
1. Pushregistersinnumericalorder,twice,toobtainstack
τ
I(
r)
· · ·
τ
I(
1)
τ
I(
r)
· · ·
τ
I(
1)
.2. Refreshregistersbyperformingi• forall1
≤
i≤
r.Letthenewassignmentbeτ
1.3. Performpop•r-times,thusensuringthat,foreach1
≤
i,
j≤
r,τ
I(
i)
=
τ
1(
j)
.4. Pushallregistersinnumericalorder,toobtainstack
τ
1(
r)
· · ·
τ
1(
1)
τ
I(
r)
· · ·
τ
I(
1)
.5. Refreshallregisters.Letthenewassignmentbe
τ
2.6. Performpop• 2r-times,thusensuringthat,foreachi
,
j,τ
2(
i)
=
τ
1(
j)
andτ
2(
i)
=
τ
I(
j)
.7. Silentlytransitiontostateq.
Now observe that the conditions in steps 3 and 6 and the fact that register assignments are injective ensure that
|
ν
(
τ
I)
∪
ν
(
τ
1)
∪
ν
(
τ
2)
| =
3r.Hence,anyrunreachingqissupportedbyexactly3rdistinctnames.2
Remark9.The3rboundgivenabovecanbeadaptedtotheautomatapresentationsof[8,22]yieldingbounds3r
+
(
1)
.An adaptationofLemma 8improvesuponExample6of[8],wherealanguagerequiring2r−
1 differentsymbolswaspresented.4. ReachabilityisEXPTIME-complete
Weconsiderthefollowingdecisionproblem.
r-PDRSReach:Givenanr-PDRS
S
andq∈
Q,istherearunofS
endinginq?Weshallshowthattheproblem(anditscounterpartsforalltheothercloselyrelatedmachinemodels)isEXPTIME-complete. Notethatreachabilityisequivalenttolanguagenon-emptinessintheautomatacase.
4.1. ReachabilityisEXPTIME-solvable
Theorem10. r-PDRS Reachand languageemptinessforinfinite-alphabet pushdownautomata[8]andregister pushdown au-tomata[22]aresolvableinexponentialtime.
Proof. Lemma 6 yields an exponential-time reductionof r-PDRSReach to theclassic reachability problemforpushdown systemsoverfinitealphabets[5]:onecanreplacether
D
-valuedregisterswithr[
3r]
-valuedregisters,andthenincorporate them intothe finitecontrol (for asingly-exponential blow-up ofthestate space). Since thelatter problemissolvablein polynomialtime,itfollowsthatr-PDRSReachisinEXPTIME.By Remark 4, the emptiness problem for infinite-alphabet pushdown automata [8] can be reduced to r-PDRSReach in polynomial time, immediatelyyielding the EXPTIMEupper bound.4 Forregisterpushdown automata [22] we have an exponential-timereductiontor-PDRSReach,whichdoesnotyieldtherequiredbound.However,recallthatthetranslation intor-PDRSpreservesthenumberofregisters,soLemma 6 stillimpliesalinearupperboundforthenumberof
D
-values neededforfindinganacceptingrun.Consequently,wecanreducelanguageemptiness ofregisterpushdownautomatatoa reachabilityproblemforpushdownsystemsatanexponentialcost.SincethelatterisinP,theformerisinEXPTIME.2
4.2. ReachabilityisEXPTIME-hard
Thebound givenaboveis tight:we simulateapolynomial-spaceTuringmachine withastack (i.e.apolynomial-space auxiliarypushdownautomaton[9]),whichhasanEXPTIME-completehaltingproblem. Areductionfromthemorefamiliar alternating polynomial-spaceTuringmachineswouldalsobe possible,butCook’smodeliscloserto r-PDRS,whichallows ustoconcentrateonthemainissueofencodingbinarymemorycontentwithouttheneedtomodelalternation.
Theorem11.r-PDRSReachisEXPTIME-hard.
Wefirstgiveanoutlineoftheargumentbeforedescribingtheproofindetail.
4.2.1. Argumentoutline
Letusassumeanauxiliarypushdownautomaton
M
workingoverabinarytapeofsizenandastackalphabetofsizek. We canassume WLOGthat every transitionofM
performs asingle pushorpop (butnot both)along witharead/write bytheheadfollowedbyaheadmovement.Moreover,letusassumethatthestackalphabetofM
includesadistinguished symbol$ markingthebottomofthestackandthat,additionally,M
startswith$ onthestackandhaltswhenitispopped ($ isnotusedotherwise).Finally,weletthetapeofM
initiallycontainonly0’s.Weshallconstructa
(
6n+
k+
1)
-PDRSS
suchthatM
terminatesiffS
reachesadesignated“final”state.Theregisters ofS
willbedividedinto4groups:τ
=
τ
0τ
1τ
2τ
3ofsizesk
+
1,2n,2nand2nrespectively.•
τ
0 will containD
-valuescoding the k stack symbolsand an auxiliary symbol # (we write # forˆ
the letter which encodes#,etc.).Itwillbeleftuntouchedthroughoutthesimulation.•
τ
1andτ
2willbeusedtoencodethen-bittapeofM
duringpush- andpop-transitionsrespectively.•
τ
3 will have an auxiliary role andin particular will ensure the integrity of the tape when changing frompop- to push-transitions.The simulation must maintain a representation of the current tape and stack content of
M
(as well as the current state, headpositionetc.). SinceS
is itselfequippedwitha pushdownstack,we shalluseits stackto representthestack ofM
by puttingsome distinguishedk-elementsubset ofD
inbijection withthe stackalphabet.A naturalcandidateforrepresenting the tape content of
M
is theregisters ofS
.However, the requirement that the registerassignment be an injective map whose rangeisD
makes constructingan encoding difficult:in anygivenregister assignment,there are no non-trivialrelationshipsbetweentheelements!Hence,toencodeinformationweareforcedtousetheregisterassignment inconjunctionwithotherdata.Let usconsider two registerassignments
τ
andτ
of length 2n.We say that such a pairis compatible just if, forall 1≤
j≤
n:{
τ
(
2j−
1),
τ
(
2j)
} = {
τ
(
2j−
1),
τ
(
2j)
}
.
(1)Although anygiven registerassignment cannot encode anymeaningful information,a pairof compatibleregister assign-mentscanbeusedtogethertorepresentatapetbyageneralisedxor,written
τ
[
τ
]
:τ
[
τ
]
(
j)
=
0 iffτ
(
2j)
=
τ
(
2j).
Inotherwords,thetapecontentatposition1
≤
j≤
nis0 ifτ
andτ
agreeontheorderofthedatavalues{
τ
(
2j−
1),
τ
(
2j)
}
and1 ifthey arethetranspositionofeach other.We canthinkofthenotationτ
[
τ
]
asabinary functionofτ
andτ
,in whichcaseithasthepropertythatanyequation:τ
[
τ
] =
tcanbe solveduniquelyfor
τ
,τ
ort (giventheotherparameters).Thisfactbecomesessentialtoensuringtheintegrityof the tape encoding whenchanging fromsimulatinga pop tosimulating a pushtransition. Notethat although thisbinary function iscommutative,theasymmetricnotationreflectsthefact that,byconvention,wewillview thefirstargumentas beingprimary,oftenwritingthatτ
isanencodingoft withrespecttothemaskτ
.Weconstruct
S
suchthat,wheninaconfigurationwithregisterassignmentτ
whichisfaithfullysimulatingapush tran-sitionofM
withtapecontentt,wehaveτ
1[
τ
I1]
=
t.Whensimulatingapoptransitioninsuchaconfiguration,wehaveτ
2[
τ
I2]
=
t.In other words,themasksusedare just theinitial registerassignments togroups1 and2 respectively.Consequently,wehavetheinvariantthat,inanyfaithfulsimulationof
M
reachingaconfigurationwithassignmentτ
,τ
1and
τ
I1arecompatibleandτ
2andτ
I2arecompatible.At eachstepofthesimulation,
S
needsto queryitsrepresentationofthetapeinordertodeterminewhichtransition ofM
toapply,whichentailscomputing,e.g.τ
1[
τ
I1]
.However, duetotheinjectivityconstraintonregisterassignments,for
S
tobeabletoaccessapairofcompatibleregisterassignments,atleastonemustbestoredonthestack.Hence,S
will use thestacknot onlytoencode the stackcontentofM
,butalsoaspartoftheencoding ofits tapecontent bystoring copiesofthemasksτ
I1 andτ
I2 sothatthey arealwaysaccessiblewhenneeded.Thisdualuseforthestackrequiresaconsiderableamountofbookkeeping.
Thekeyproblemtoovercomeistoensurethatthemasks
τ
I1andτ
I2arealwaysavailableatthetopofthestackwhenthey are neededfordecoding.Letusfirstconsider
τ
I2 whichis somewhateasierbecauseit isusedforpop transitions.Since
M
haltsonlywithanemptystack,weknowthatforeverypoptransitionmade,theremusthavealreadybeenmade a correspondingpush transition.Hence, wearrangeforS
,whensimulatingapushtransitionwithastackofheighth,to additionallypushan extracopyofτ
I2 (whichithasstoredinits registers)so thatitisavailable atthetopofthestack whenthemachinenextreturnstoastackofheighth,shoulditberequiredtosimulatethecorrespondingpoptransition.Ensuringtheavailabilityof
τ
I1 forthepurposeofsimulatingpushtransitionsismuchmoredifficult.Itisnotpossibleto“pre-load”thestackwithcopiesof
τ
I1 inthesamewayasforτ
I2because(i)thelengthofsequencesofconsecutivepushtransitionsisnotknownand(ii)thedualuseofthestackrequiresthat copiesof
τ
I1mustbeinterleavedwithdatavaluessimulatingthelettersofthestackalphabetpushedby
M
.Mattersarefurthercomplicatedbythefactthat looking up thevalueofτ
I1inordertocomputeτ
1[
τ
I1]
requirespoppingitoffthetopofthestack.Considerthesimulationoftwoconsecutivepushtransitions.Aspartofthesimulationofthefirsttransition,
τ
I1 mustbepoppedandhencelost.Theinjectivity constraintontheregistersensuresthat theonlywaythatitcouldbe preserved(bytemporarilypoppingitinto theregisters)wouldbeatthecostoflosing
τ
1 instead.However,bythetimethesecondtransitionissimulated,anothercopyisrequiredtobeaccessible(i.e.beatthetopofthestackagain).Wecannot“pre-load”thestackwithcopiesof
τ
I1,we cannot temporarilystore itin theregistersandaccessing acopyconsumes it.Hence we areforcedto construct
S
in suchawaythatitcomputesτ
1[
τ
I1]
withoutaccessingτ
I1atall.Toachievethis,wearrangeforS
toguessamaskτ
1,compute
τ
1[
τ
1]
withrespecttothisguessandplacetheguessedmaskonthestack.Duringthelatersimulationofpop transitions,whenS
hassomesparecapacityinits registersbecauseτ
1 isnolongerusedtoencode tapecontent,itwillbeabletodischargetheobligationofverifyingthatitguessed
τ
1=
τ
I1.So far, we havediscussed theneed tostore three kindsofentities on thestack, namely:representations ofthe stack letters of
M
,copies ofthe maskτ
I2 andunverified guesses ofthe maskτ
I1.In fact, to be ableto switch from tapeencoding using register group
2 to tape encoding usingregister group 1 (which happens wheneverS
simulatesM
performingapopfollowedbyapush)withoutlossofinformation,weneedtomaintainadditionalentities.s
=
si0 si1
τ
I2 si3τ
I2 si3si−01 si−11
τ
I2 si−31τ
I2 si−31..
.
..
.
..
.
..
.
..
.
..
.
(2)
with
|
si1|
= |
τ
I2|
= |
si3|
=
2nand|
s i0
|
=
1 (andarbitraryi).Thetopstacksymbolisinthetop-leftcorner,theelementbelowitonthestackisonitsright,si−01isbelowsi
3etc.Eachsj0abovecorrespondstoanon-# stacksymbol(asspecified
by
τ
0).Theguessedmasks, tobeverifiedlater,willbestoredassj1.Torepresentthetapeatpops,wewillusethemask
τ
I2.Oursimulationwillmakesurethat thisiscorrectlystoredon thestackduringpushes.Finally,theelements sj3
,
τ
I2,
sj3 willbeusedtosupportthesimulationwhenitswitchesfrompopstopushes.Theelementsj3 willalsobeamask.Therewillalsobe“exceptional”rows,whichhavetheform:
si#
= ˆ
# si3τ
I2 si1τ
I2 si3 (3)where# is
ˆ
theencodingof# inτ
I0.Theserowswillbeusedtoverifythecorrectnessofsj3,aswediscusslater.Thus, ineach rowwe store astack symboland 5 masks.The purposeof themasksis tohelp usdetermine thetape content of
M
.Onthe other hand,thecurrentstack ofM
can be recoveredby projecting out thefirst columnofs and erasinganyoccurrenceof#.ˆ
Wenextdefinethedifferentstepsofthesimulation.Initially,thereisaninitialisationsteppushingarows0onthestack;
S
reachesitsfinalstatepreciselywhenitsuccessfullypops s0.RecallthateverytransitionofM
includesapushorapopaction.Accordingly,thestatesof
S
havetwomodes:apush-modeandpop-mode.EachtransitionofS
non-deterministically guessesthemode ofthenext state(ofS
).S
simulatesthepush-transitionsofM
usingτ
1[
si1]
asitstape;itsimulates thepoponesusingτ
2[
τ
I2]
asitstape.Thesimulationonlygoesthroughifthemasksoftheseencodingsarecorrect,thatis,ifsi1
=
τ
I1foralli.Put otherwise,inanacceptingcomputationofS
,allmaskssi1 thatappearonthestackmustbe equaltoτ
I1.Initialisation
S
startsoffbypushingthefollowingrow:s0
= ˆ
$τ
I1τ
I2τ
I3τ
I2τ
I3 (4)Recallherethatthetapeof
M
isassumedtobeinitiallyempty, andthisiscapturedby ourinitialencoding:τ
I1[
s01]
=
0
· · ·
0 (sinceτ
I1=
s01).Push-mode Duringthisphase,
S
usesτ
1 to representthetape ofM
,whileτ
0,
τ
2,
τ
3 stayunchanged. AssumingS
hasstackcontentasin(2)or(3)andthecurrentregisterassignmentis:τ
=
τ
I0τ
1τ
2τ
3thecurrenttapecontent(accordingtothesimulation)is:
t
=
τ
1[
si1]
.
Moreover,byconstruction,weshallhave
τ
2=
τ
I2.Nowsuppose
M
istoperformapush-transitionq−−−−−−−−→
x,y,z,push(C) q,wherexisthecurrentlyscannedsymboltobe over-writtenwith y,theheadmovement isindicatedby z∈ {
L,
R,
N}
andC isthestacksymboltobepushed.Assumethatthe currentheadpositionis1≤
j≤
n(S
willkeeptrackofitinitsstate).Inordertosimulatethetransition,S
firstneedsto retrieveτ
1[
si1]
(
j)
.Onewaytodothatwouldbetosimplypopsi1offthestack.However,thatwouldbecatastrophicfor oursimulation sincethere isnoguarantee atthispointthat si1 isacorrect mask(i.e. equalto
τ
I1);poppingit woulddestroyit,thus annihilatinganypossibilityofverifyingits correctness.5 Thus,instead,
S
will guesswhat thevalueof si1
mightbeandoperateaccordingtotheguess. Moreover,theguesswillbepushedonthestackforsubsequentverification inthepop-mode.
Moreprecisely,
S
firstpushesthewordτ
2τ
3τ
2τ
3.Itthenproducesaguesssi+11ofthemasksi1whichisconsistent with reading x at the current head position,in thatτ
1[
si1+1]
(
j)
=
x. Thisis achievedby non-deterministically pushing5 Note that pushing initially τ
consecutivepairsofelements of
τ
1,subjecttothepreviousrequirementandtheconstraintexpressedby equation(1).It nextperformstheoperationsofM
(asinstructedby yandz)accordingtothetapeτ
1[
si+11]
.Thus,aftertheseoperations, theregisterassignmentandtopofthestackreadτ
=
τ
I0τ
1τ
I2τ
3 si+1=
si+11τ
I2τ
3τ
I2τ
3where
τ
1[
si+11]
isthenewtapecontent(inparticular,wehavewritten yinbit j).Finally,
S
choosesthekindofthenexttransition.Ifitisapush,thenCˆ
ispushedonthestack(thenamecorresponding to C). Otherwise,beforeswitchingto pop-mode,ithastotransfer itstape-encoding fromτ
1 toτ
2.Weachieve thisby simultaneouslymoving si+11 fromthestackintoτ
1andchangingτ
I2intoτ
2 sothatτ
2[
τ
I2]
=
τ
1[
si+11]
.Thiscanbeexecuted bypoppingsi+11
(
2j)
andcomparingitwithτ
1(
2j)
foreachbit1≤
j≤
nand,then,depending ontheoutcome, swappingthecontentsofregisters2j−
1 and2jineachofτ
1andτ
2inordertoreflectthedesiredchange.Finally,wepushsi+11 backonthestack,followedby C
ˆ
toarriveatτ
=
τ
I0 si+11τ
2τ
3 si+1
= ˆ
C si+11
τ
I2τ
3τ
I2τ
3with
τ
2[
τ
I2]
=
τ
1[
si+11]
.Pop-mode
S
nowusesτ
2 asthetape.LetthecurrentconfigurationofS
havestackasin(2)andletτ
=
τ
I0τ
1τ
2τ
3sothat
τ
2[
τ
I2]
istherepresentedtapecontent.Suppose that
M
’s headscans position j andthe next transitionisto be q−−−−−−−→
x,y,z,pop(C) q, where si0= ˆ
C.Recallthatτ
1,
si1,
· · ·
,
s11areguessesfrompreviouspushtransitions(orfromexceptionalpushes,stilltobediscussed),whiles01=
τ
I1by(4).Toverifytheguesses,itsufficestoverifythatτ
1=
si1and,atthenextpop,verifythatτ
1=
si−11,etc.Thus,S
will firstpop Cˆ
fromthe stackandthenpop si1,simultaneously checkingthat it equals
τ
1 (otherwiseit willblock).Nextwe pop
τ
I2 todetermineτ
2[
τ
I2]
andperformtheinstruction(
x,
y,
z)
bychangingτ
2 toτ
2(andupdating theheadpositioninthestate).Thus,weobtain
τ
=
τ
I0τ
1τ
2τ
3 si
=
si3τ
I2 si3havingverifiedthat
τ
1=
si1.Now
S
guesses thekindofthenext transition. Ifitis tobe apop,S
pops the remainderof si.Otherwise,S
should switch topush-mode andinparticular changeitstape-storing routinefromτ
2 toτ
1.Thatis,τ
1 needsto beupdatedto
τ
1 such thatτ
1[ ˆ
τ
1]
=
t, for an appropriate maskτ
ˆ
1, where t=
τ
2[
τ
I2]
is the currenttape. Also, having nowpreserveditsvalueaccordingtotheencoding,
τ
2 shouldbechangedbacktoτ
I2.We are nowfaced withthefollowing obstacle.Updating
τ
1 toτ
1 wouldmake uslose thecurrentτ
1.Thiswould breakoursimulationas, althoughS
hasverifiedτ
1=
si1,itremainsto checkthatτ
1 isthesameasallthose guessed masks still on thestack, i.e.si−11,
. . . ,
s11. Since entering push-moderequires that we overwritethe contentsof
τ
1, wewould like to preserve its currentassignment on the stack. However, doing thisdirectly is impossiblesince we need to obtain
τ
I2 fromlowerdown thestackinordertodecode thecurrenttapecontentsτ
2.Weovercomethisby storinginthestackaguessfor
τ
1,alongwithauxiliarymaskswhichwillallowustoverifythisguesswhenpopping.Moreover,weshallpick
τ
ˆ
1=
τ
1.Hence,S
operatesasfollows.•
Itfirstpopssi3andstoresitinτ
3.•
Then,itpopsτ
I2andstoresitinτ
2and,atthesametime,itcopiest inτ
1andτ
3,thatis,itupdatesthemtoτ
1and
τ
3respectively,suchthatt=
τ
1[
τ
1]
=
τ
3[
s i3
]
.•
Itpushesτ
I2backonthestack.•
Itthenmakesaguessτ
1ofτ
1andpushesitonthestack.Whiledoingso,itupdatesτ
3tothemasksi3satisfyingτ
1[
τ
1]
=
τ
3[
si3]
.•
Finally,itpushes#sˆ
i3τ
I2onthestack.Thus,weendupwith
and the automaton switches to push-mode. Note that
τ
1 usesτ
1 as a mask, yet we haveτ
1 on the stack instead. Nevertheless,byconstruction:τ
1=
τ
1iff
τ
1[
τ
1] =
τ
1[
τ
1]
iff
τ
3[
si3] =
τ
3[
si3]
iff si3
=
si3.
Thus, when popping the row si#, the automaton will additionally check that si3
=
si3 andthus verify that the correct maskτ
1hasbeenstoredonthestack.Finally,wediscussthecasewhen
S
isinpop-modeandthetopofthestackisasin(3).Insuchacase,thepoptransition ofS
istakenindependentlyofM
.Inparticular,letτ
=
τ
I0τ
1τ
2τ
3 .•
S
startsbypopping# andˆ
si3,andstoresthelatterinτ
3.•
Next,itpopsτ
I2andsi1,andchecksthatthelatterisequaltoτ
1.•
Finally,itpopsτ
I2andsi3,andchecksthatthelatterisequaltosi3(whichisnowstoredinτ
3).Thus,accordingtoourdiscussionabove,
S
correctlyverifiesthecontinuityofthemaskssi1whileconsumingtherowsi#. Altogether,theaboveconstructionyieldsa(
6n+
k+
1)
-PDRSS
ofpolynomialsizewithrespectton.Moreover,S
popss0 iffitmakesconsistentguessesformasksusedinitsfirstcomponentand,therefore,faithfullysimulatestheoperationsofM
leadingtopoppingtheterminatingsymbolfromitsstack.4.2.2. Argumentindetail
Wenowmaketheabovesketchmoreprecise.
Proof. Let
M
=
Q,
qI,
T,
δ
beanauxiliarypushdownautomatonoperatingoverabinarytapeofsizenandstackalphabet{
1,
· · ·
,
k}
,with$∈ {
1,
· · ·
,
k}
beingadistinguished bottom-of-stacksymbol.M
hasinitialstate qI,andlet usassume itstransitionrelationisofthefollowingtype,
δ
⊆
Q×
Opk×
Q,withOpk
= {
0,
1}
2× {
L,
R,
N} × {
push(
i),
pop(
i)
|
1≤
i≤
k}
.
Thatis,ineverytransition,
M
readsabitxfromitscurrentheadposition,writesback y,movesthehead(Left,Right,or No-move),andpushesor popsa symbol fromthestack. Moreover, weassume thatM
hasinitial tape0· · ·
0 andinitial stack$,andM
haltswhenitpops$ fromthestack($ isnotusedotherwise).Weconstructa
(
k+
1+
6n)
-PDRSS
suchthatM
pops$ fromthestackiffS
reachesadesignatedstateqF.Inparticular,S
=
(
Q× {
1,
· · ·
,
n} × {↑
,
↓}
)
∪ {
qI} ∪
Q,
qI,
τ
I, δ
where each state ofthe form
(
q,
j,
↓
)
[resp.(
q,
j,
↑
)
] is said to be inpush-mode [pop-mode]. The index j indicates the positionoftheheadonthetapeofM
.Thus,atitsinitialposition,M
readsthefirstbitofthetapeandcanonlyperform apush. Qisasetofauxiliarystatesofpolynomialsizeinn,whichwegraduallyspecifybelow.Theinitialassignmentτ
I isarbitrary;wedividetheregistersinto4groups(ofsizesk
+
1,2n,2nand2nrespectively)andwriteregisterassignmentsτ
intheform:
τ
=
τ
0::
τ
1::
τ
2::
τ
3.
Wemoreover stipulatethat,throughouttheoperation of
S
,the valuesofitsgroup-0registers remainfixed and,foreach i=
1,
2,
3 and1≤
j≤
n,{
τ
i(
2j−
1),
τ
i(
2j)
} = {
τ
Ii(
2j−
1),
τ
Ii(
2j)
}
.
Thedisciplineimposedaboveisinstrumentedsoastoencodeann-sizetapeineachof
τ
1,
τ
2,
τ
3.Inparticular,foreach i=
1,
2,
3 and2n-componentsτ
i,
τ
ˆ
i,wecandefineann-tapeτ
i[ ˆ
τ
i]
bysetting,τ
i[ ˆ
τ
i]
(
j)
=
0 iffτ
i(
2j)
= ˆ
τ
i(
2j)
forall1
≤
j≤
n.Wecallτ
ˆ
i themaskoftheencoding. OurPDRSS
willsimulatetheoperationsofM
usingjustsuchan encoding.Ontheotherhand,thestackisgroupedintorowsoftwopossibleforms:si