Turing Impossibility Properties for Stack Machine Programming J.A.Bergstra,C.A.Middelburg 2 InformaticsInstitute,FacultyofScience,UniversityofAmsterdam, 1 0 SciencePark904,1098XHAmsterdam,theNetherlands 2 e-mail:[email protected], [email protected] n a J 9 Abstract Thestrong,intermediate,andweakTuringimpossibilitypropertiesare 2 introduced. Some facts concerning Turing impossibility for stack machine pro- grammingare triviallyadaptedfrompreviouswork. Severalintriguingquestions ] O are raised aboutthe Turing impossibility propertiesconcerningdifferentmethod interfacesforstackmachineprogramming. L . s Keywords instructionsequenceprocessing,functionalunit,haltingproblem,au- c [ tosolvability 1 v 8 1 Introduction 2 0 Theworkpresentedinthispaperconstitutesaminoradaptationtoasimplifiedset- 6 ting,andacorrespondingreformulationofthecontentofour[4].Werefertothat . 1 paperforfurthertechnicalexplanationsoftheformalismusedbelow,forthejus- 0 tificationofterminology,aswellasformoreinformationconcerningconnections 2 withpreviouswork.1Byhighlightingresultsfrom[4]fromadifferentperspective 1 theirrelevanceforunderstandingthemethodologicalimpactofthewell-knownre- : v cursiveunsolvabilityofthehaltingproblem,inwhichwefirmlybelieve,becomes i X moreapparent.Like[4]thispaperfocusesontheoff-linehaltingproblem,which unliketheon-linehaltingproblemanalyzedin[6]neednotalwaysgivewaytoa r a diagonalargument. Thispaperconcernsaninvestigationofissuesrelatingtothehaltingproblem perceivedintermsofinstructionsequences.PositioningTuring’sresultof[8]re- garding the recursive unsolvability of the halting problem as a result about pro- 1 In[4] thefocus ison modeling Turingmachine computation, whileinthispaper the focusisonstackmachines.Inaddition[4]explainsthesemanticsofinstructionsequences viathreadalgebra(see[3])andinthispaperwewilluseanoperationalsemanticsinstead. 2 J.A.Bergstra,C.A.Middelburg grams rather than machines, and taking instruction sequences as programs, we analysetheautosolvabilityrequirementthataprogramofacertainkindmustsolve thehaltingproblemforallprogramsofthatkind. Below we will use the term execution both in connection with instructions andinconnectionwithinstructionsequences.Thisisnotentirelyconsistentwith [1]whereexecutionisgivenaratherconfinedmeaning,involvingtheuseofreal computingdevices.Hereinstructionsequencesaremathematicalobjectsandtheir execution, by necessity is merely a mathematical or logical model for the (real) puttingintoeffectof(physicalrepresentationsof)instructionsequences.2 The paperfollowsthe organizationof [4], beginningwith a surveyofthe in- structionsequencenotationthatwillbeusedusedinthispaper(Section2).Next, weintroduceservicesandacompositionoperatorforservicesfamilies(Section3). InSection4anoperationalsemanticsisprovidedforinstructionsequencesunder executioninacontextofservicefamilies.InSection5following[4],weaddtwo operators,named•, and !, that are related to the processingof instructionsby a service family. Then, as in [4] we propose to comply with conventions that ex- cludetheuseoftermsthatarenotreallyintendedtodenoteanything(Sections6). Thereafter,weintroducetheconceptofafunctionalunitandrelatedconcepts(Sec- tion7).Then,wedefineautosolvabilityandrelatednotionsintermsoffunctional unitsrelatedtostackmachines(Section8).InSection9wespecifyafamiliarmenu ofmethodnamesandoperationsonstacks.InSection10weintroducethestrong, intermediate,andweakTuringimpossibilitypropertiesforprogrammingenviron- ments.equippedwithagivenandfixedwaytoencodeinstructionsequencesinto functionalunitstates.Afterthat,wegivepositiveandnegativeresultsconcerning theautosolvabilityofthehaltingproblem(Section11).InSection12weprovidea numberofquestionsconcerningTuringimpossibilityforstackmachineprogram- ming.Finally,wemakesomeconcludingremarks(Section13). 2 PGLBwithBooleanTermination Inthissection,we introducetheprogramnotationPGLB (PGLBwith Boolean bt termination).In [2], a hierarchyof programnotationsrooted in programalgebra ispresented.OneoftheprogramnotationsthatbelongtothishierarchyisPGLB (ProGrammingLanguageB).Thisprogramnotationisclosetoexistingassembly languagesandhasrelativejumpinstructions.PGLB isPGLBextendedwithtwo bt termination instructions that allow for the execution of an instruction sequence to yield a Boolean value at termination.The extension makes it possible to deal naturally with instruction sequencesthat implementsome test, which is relevant throughoutthepaper. In PGLB , it is assumed that a fixed but arbitrary non-emptyfinite set A of bt basic instructions has been given. The intuition is that the issuing of a basic in- structionin mostinstanceseffectsthe modificationofa state andinallinstances 2 Infactexecutionasusedinthispapercorrespondsto“directlyputtingintoeffect”as usedin[1].Instructionsaresaidtobeexecutedaswell,oralternativelyinstructionsaresaid tobeissued,thusfollowingacommonterminologyincomputerarchitecture. TuringImpossibilityPropertiesforStackMachineProgramming 3 producesa reply at its completion. The possible replies are t (standing for true) andf(standingforfalse),andtheactualreplyisinmostinstancesstate-dependent. Therefore,successive executionsof the same basic instruction may produce dif- ferentreplies. PGLB hasthefollowingprimitiveinstructions: bt – foreacha∈A,aplainbasicinstructiona; – foreacha∈A,apositivetestinstruction+a; – foreacha∈A,anegativetestinstruction−a; – foreachl∈N,aforwardjumpinstruction#l; – foreachl∈N,abackwardjumpinstruction\#l; – aplainterminationinstruction!; – apositiveterminationinstruction!t; – anegativeterminationinstruction!f. PGLB instructionsequenceshavetheformu ;...;u ,whereu ,...,u areprim- bt 1 k 1 k itiveinstructionsofPGLB . bt In the process of executing a PGLB instruction sequence, these primitive bt instructionshavethefollowingeffects: – theeffectofapositivetestinstruction+aisthatbasicinstructionaisexecuted andtheexecutionproceedswiththenextprimitiveinstructioniftisproduced andotherwisethenextprimitiveinstructionisskippedandtheexecutionpro- ceedswiththeprimitiveinstructionfollowingtheskippedone–ifthereisno primitiveinstructiontoproceedwith,deadlockoccurs; – theeffectofanegativetestinstruction−aisthesameastheeffectof+a,but withtheroleofthevalueproducedreversed; – the effectof a plain basic instructiona is the same as the effectof +a, but a runalwaysproceedsasiftisproduced; – theeffectofaforwardjumpinstruction#l isthattheexecutionproceedswith thelth nextprimitiveinstruction–iflequals0orthereisnoprimitiveinstruc- tionstoproceedwith,deadlockoccurs; – the effect of a backward jump instruction \#l is that the execution proceeds withthelthpreviousprimitiveinstruction–iflequals0orthereisnoprimitive instructiontoproceedwith,deadlockoccurs; – theeffectoftheplainterminationinstruction!isthattheexecutionterminates andindoingsodoesnotdeliveravalue; – theeffectofthepositiveterminationinstruction!tisthattheexecutiontermi- natesandindoingsodeliverstheBooleanvaluet; – theeffectofthenegativeterminationinstruction!f isthattheexecutiontermi- natesandindoingsodeliverstheBooleanvaluef. AsimpleexampleofaPGLB instructionsequenceis bt +a;#2;\#2;b;!t. When executing this instruction sequence, first the basic instruction a is issued repeatedlyuntilitsexecutionproducesthe replyt, nextthe basic instructionb is executed,andafterthattherunterminateswithdeliveryofthevaluet. 4 J.A.Bergstra,C.A.Middelburg From Section 7, we will use a restricted version of PGLB called PGLB bt sbt (PGLBwithstrictBooleantermination).TheprimitiveinstructionsofPGLB are sbt theprimitiveinstructionsofPGLB withtheexceptionoftheplainterminationin- bt struction.Thus,PGLB instructionsequencesarePGLB instructionsequences sbt bt inwhichtheplainterminationinstructiondoesnotoccur. WewillwriteIStodenotethesetofPGLB instructionsequencesbelow.We bt will view this set of instruction sequencesas a sort in a many-sortedalgebra for whichthesortnameISwillbeused.FurthereachPGLB instructionsequenceis bt usedasaconstantofsortISdenotingitself.3 3 ServicesandServiceFamilies Inthissection,we introduceservicefamiliesandacompositionoperatorforser- vicefamilies.Westartbyintroducingservices. It is assumed that a fixed but arbitrary non-empty finite set M of methods hasbeengiven.Aserviceisabletoprocesscertainmethods.Theprocessingofa methodmay involvea changeofthe service.At completionofthe processingof amethod,theserviceproducesareplyvalue.ThesetR ofreplyvaluesistheset {t,f,d}.Thereplyvaluedstandsfordivergent. Forexample,aservicemaybeabletoprocessmethodsforpushinga natural numberonastack(push:n),testingwhetherthetopofthestackequalsanatural number(topeq:n),andpoppingthetopelementfromthestack(pop).Execution ofapushingmethodorapoppingmethodchangestheservice,becauseitchanges thestackwithwhichitdeals,andproducesthereplyvaluetifnostackoverflow or stack underflow occurs and f otherwise. Execution of a testing method does notchangetheservice,becauseitdoesnotchangesthestackwithwhichitdeals, and produces the reply value t if the test succeeds and f otherwise. Attempted processingofamethodthattheserviceisnotabletoprocesschangestheservice intoonethatisnotabletoprocessanymethodandproducesthereplyd. InSF,thealgebraictheoryofservicefamiliesintroducedbelow,thefollowing isassumedwithrespecttoservices: – asetS ofserviceshasbeengiventogetherwith: – foreachm∈M,atotalfunction ¶ :S →S; ¶ m – foreachm∈M,atotalfunctionr :S →R; m satisfyingtheconditionthatthereexistsauniqueS∈S with ¶ (S)=Sand ¶ m r (S)=dforallm∈M; m When dealing with examples and applications we will assume that a suffi- ciently large collection of services is available and that a name is known for eachofthose.Inadditionforeachnameallequationsthatdeterminethegraphs of ¶ andr areavailable. ¶ m m – asignatureS S hasbeengiventhatincludesthefollowingsort: – thesortSofservices; 3 ThistreatmentofthesortISisashortcutofthepresentationof[4]and[2]wherethe sortofthreadsisusedasabehavioralabstractionofinstructionsequences. TuringImpossibilityPropertiesforStackMachineProgramming 5 andthefollowingconstantandoperators: – theemptyserviceconstantd :S; – foreachm∈M,thederivedserviceoperator ¶ :S→S; ¶ m – S andS S aresuchthat: – eachserviceinS canbedenotedbyaclosedtermofsortS; – theconstantd denotestheuniqueS∈S suchthat ¶ (S)=Sandr (S)= ¶ m m dforallm∈M; ¶ ¶ – ifclosedtermt denotesserviceS,then (t)denotesservice (S). ¶ m ¶ m WhenarequestismadetoserviceStoprocessmethodm: – ifr (S)6=d,thenSprocessesm,producesthereplyr (S),andnextproceeds m m ¶ as (S); ¶ m – ifr (S)=d,thenSisnotabletoprocessmethodmandproceedsasd . m Theemptyserviced istheuniqueservicethatisunabletoprocessanymethod. Itisalsoassumedthatafixedbutarbitrarynon-emptyfinitesetF offocihas beengiven.Fociplaytheroleofnamesofservicesintheservicefamilyofferedby anexecutionarchitecture.Aservicefamilyisasetofnamedserviceswhereeach nameoccursonlyonce. SFhasthesorts,constantsandoperatorsinS S andinadditionthefollowing sort: – thesortSFofservicefamilies; andthefollowingconstantandoperators: – theemptyservicefamilyconstant0/:SF; – foreach f ∈F,theunarysingletonservicefamilyoperator f. :S→SF; – thebinaryservicefamilycompositionoperator ⊕ :SF×SF→SF; – foreachF ⊆F,theunaryencapsulationoperator¶ :SF→SF. F We assume that there is a countably infinite set of variables of sort SF which includesu,v,w. Termsare builtasusualin the many-sortedcase (see e.g. [9,7]). Weuseprefixnotationforthesingletonservicefamilyoperatorsandinfixnotation fortheservicefamilycompositionoperator. Theservicefamilydenotedby0/ istheemptyservicefamily.Theservicefamily denotedbyaclosedtermoftheform f.H consistsofonenamedserviceonly,the serviceconcernedistheservicedenotedbyH,andthenameofthisserviceis f. The service family denoted by a closed term of the form C⊕D consists of all namedservicesthatbelongtoeithertheservicefamilydenotedbyCortheservice familydenotedbyD. Inthecase wherea namedservicefromthe servicefamily denoted by C and a named service from the service family denoted by D have thesamename,theycollapseto anemptyservicewith thenameconcerned.The servicefamilydenotedbyaclosedtermoftheform¶ (C)consistsofallnamed F serviceswithanamenotinF thatbelongtotheservicefamilydenotedbyC.Thus, theservicefamiliesdenotedbyclosedtermsoftheforms f.H and¶ (C)donot {f} collapsetoanemptyserviceinservicefamilycomposition. 6 J.A.Bergstra,C.A.Middelburg Table1 AxiomsofSF u⊕0/ =u SFC1 ¶F(0/)=0/ SFE1 u⊕v=v⊕u SFC2 ¶F(f.H)=0/ if f ∈F SFE2 (u⊕v)⊕w=u⊕(v⊕w) SFC3 ¶F(f.H)= f.H if f ∈/F SFE3 f.H⊕f.H′= f.d SFC4 ¶F(u⊕v)=¶F(u)⊕¶F(v) SFE4 Table2 Definingequationsforthefocioperation foci(0/)=0/ foci(f.H)={f} foci(u⊕v)=foci(u)∪foci(v) Usingthesingletonservicefamilyoperatorsandtheservicefamilycomposi- tionoperator,anyfinite numberof possiblyidenticalservicescan be broughtto- getherinaservicefamilyprovidedthattheservicesconcernedaregivendifferent names. Theemptyservicefamilyconstantandtheencapsulationoperatorsareprimar- ilymeanttoaxiomatizetheoperatorsthatareintroducedinSection4. TheaxiomsofSFaregiveninTable1.Inthistable, f standsforanarbitrary focusfromF andH andH′standforarbitraryclosedtermsofsortS.Theaxioms ofSFsimplyformalizetheinformalexplanationgivenabove. The foci operation foci defined by the equations in Table 2 (for foci f ∈F andtermsH ofsortS)providesthecollectionoffocithatoccurwithinaservice family. Knowledge of this collection plays a role when defining the operational semanticsofinstructionsequencesactingonaservicefamily.Theoperationfoci gives, for each service family, the set of all foci that serve as names of named servicesbelongingtotheservicefamily. GivenaservicefamilyC,if f 6∈foci(C)thenCcanbewrittenas¶ (C′),and {f} if f ∈foci(C)thenCcanbewrittenas f.H∪¶ (C′)forasuitableserviceH and {f} anappropriateservicefamilyC′. 4 Operationalsemantics For the set A of basic instructions, we take the set {f.m| f ∈F,m∈M}. Let 1≤i≤k, and let p=u ;...;u be a PGLB instruction sequence, with basic 1 k bt instructionsinA,andforthatreasona closedIStermandletC denoteaservice familyandatthesametimeaclosedSFterm.Thenatriple(i,p,C)canbereadas theconfigurationconsistingof pactingonservicefamilyCwithprogramcounter atvalueiwhen pisexecuted.Configurationsarecomputationalstatesbutwewill onlyusethetermstateforservicesandservicefamilies,andspeakofaconfigura- tioniftheinstructionsequenceisincludedaswellaspositionalinformationabout theinstructionwhichisnexttobeissued,thatisaprogramcounter. From a non-terminal configuration (i,p,C), subsequent computational steps startwithissuingtheith primitiveinstruction,i.e.u.Bydefault,arunstartsatthe i firstprimitiveinstruction.Fortechnicalreasonsconfigurationswithi=0ori>k willbeconsideredaswell. TuringImpossibilityPropertiesforStackMachineProgramming 7 Theoperationalsemanticsdescribeshowaconfigurationcandevelopstepby stepintootherconfigurations.Terminalconfigurationsareconfigurationsthatsat- isfyanyofthefollowingconditions: – u =!,oru =!t,oru =!f,or i i i – i=0ori>0,or – u ≡ f.m,oru ≡+f.m,oru ≡−f.mforafocus f suchthat f 6∈foci(C). i i i Ifu =!,oru =!t,oru =!f,thentheconfigurationiscorrectlyterminating.In i i i allothercasestheterminatingconfigurationspecifiesanerroneousstateindicating incorrecttermination.4 Thesequenceofstepsfromaconfigurationiscalledacomputation.Eachstep involveseithertheexecutionofajumportheapplicationofamethodtoaservice. Theserviceinvolvedin the processingofa methodisthe servicewhosenameis the focus of the basic instruction in question. After proceeding 0 or more steps a computation can but need not end in a terminal configuration. If it ends in a terminalconfigurationthecomputationissaidtoconverge,otherwiseitproceeds foreveranditissaidtodiverge.Iftheterminalconfigurationiscorrectlyterminat- ing,thecomputationissaidtobesuccessful,otherwisetheterminalconfiguration isincorrectlyterminatingandthecomputationissaidtobeunsuccessful. Computation steps for configurations are generated by the following four rules:5 u ≡#k i 1. fw-jmp (i,p,C)−−−−−−→(i+k,p,C) u ≡\#k i 2. bw-jmp (i,p,C)−−−−−−→(i−. k,p,C) u ≡ f.m∨(u ≡+f.m∧r (H)=t)∨(u ≡−f.m∧r (H)=f) i i m i m 3. (i,p,f.H⊕¶ (C))−−b−-a−c−→t (i+1,p,f. ¶ H⊕¶ (C))) {f} ¶ m {f} (u ≡+f.m∧r (H)=f)∨(u ≡−f.m∧r (H)=t) i m i m 4. (i,p,f.H⊕¶ (C))−−b−-a−c−→t (i+2,p,f. ¶ H⊕¶ (C))) {f} ¶ m {f} An instruction sequence may interact with the named services from the ser- vice family offered by an execution architecture. That is, during its executed an instructionsequencemayissueabasicinstructionforthepurposeofrequestinga namedservicetoprocessamethodandtoreturnareplyvalueatcompletionofthe processingofthemethod. 4 Incorrectterminationcanbeunderstoodtorepresenttheoccurrenceofanerrorduring acomputation.Forinstanceexecutionoftheinstructionsequence#1;\#5;!willleadtoan errorafterthefirstinstructionhasbeenexecutedandforthatreasonthebackwardjumpin thesecondinstructionconstitutesafaultintheinstructionsequence. 5 Asusual,wewritei−. jforthemonusofiand j,i.e.i−. j=i−jifi≥ jandi−. j=0 otherwise. 8 J.A.Bergstra,C.A.Middelburg 5 Applyandreplyoperators Inthissection,wecombinethesortISwiththesortSFandextendthecombina- tionwithtwooperators,calledapplyoperatorandreplyoperatorrespectively,that relatetothiskindofinteractionbetweeninstructionsequencesandservices. The reply operator is concerned with the effects of service families on the Booleanvaluesthatcomputationspossiblydeliverattheirtermination.Thereply operator does not always produce Boolean values: it produces special values in caseswherenoBooleanvalueisdeliveredatterminationornoterminationtakes place.Theapplyoperatordeterminesthesuccessiveeffectthatbasicinstructions issuedduringaterminatingexecutionhaveonaservicefamily.Theapplyoperator ismadetotalbystipulatingthatitproducestheemptyservicefamilyinthecaseof divergingcomputations. Bothoperatorsmentionedaboveareconcernedwiththeprocessingofmethods byservicesfroma servicefamilyin pursuanceofbasic instructionsissued when aninstructionsequenceisexecuted. Wewilluseinadditionthefollowingsort: – thesortRofreplies; andthefollowingconstantsandoperators: – thereplyconstantst,f,d,m:R; – thebinaryapplyoperator • :IS×SF→SF; – thebinaryreplyoperator ! :IS×SF→R. Weuseinfixnotationfortheapplyandreplyoperators. The service family denotedby a closed term of the form p•C is the service familythatresultsfromprocessingthemethodofeachbasicinstructionissuedby theinstructionsequence pbytheserviceintheservicefamilydenotedbyCwith thefocusofthebasicinstructionasitsnameifsuchaserviceexists. The value denoted by p!C is the Boolean value serving as the flag of the terminationinstructionatwhichcomputationstartingfromtheinitialconfiguration (1,p,C) comes to a halt if that computationterminatescorrectly and in addition thisterminationinstructioncarriesaBooleanvalue. The value m (standing for meaningless) is yielded if the computation termi- nates correctly ending with the program counter at a termination instruction not carryinga Booleanvalue,andthe resultis thevalued (standingfordivergent)if the computation does not correctly terminate. Formally the connection between computationsandtheapplyandreplyoperatorsisasfollows(againassumingthat kisthenumberofinstructionsin p=u ;...;u ): 1 k – if(1,p,C)producesadivergentcomputationthen p•C=0/ and p!C=d. – if(1,p,C)producesanincorrectlyterminatingcomputation,sayinsomecon- figuration (i,p,D) that satisfies one of these five conditions: i=0, or i>k, oru ≡ f.m,oru ≡+f.m,oru ≡−f.mforsomebasicinstruction f.m (for i i i which f 6∈foci(D)mustnecessarilyhold),then p•C=0/ and p!C=d. – if(1,p,C)producesacorrectlyterminatingcomputation,sayendinginacon- figuration,(i,p,D)suchthat1≤i≤k,andeitheru ≡!,oru ≡!t,oru ≡!f, i i i TuringImpossibilityPropertiesforStackMachineProgramming 9 then p•C=D. Further in this case: if u ≡! then p!C=m, if u ≡!t then i i p!C=t,andifu ≡!f then p!C=f. i Wewritep↓uiffp!u=torp!u=forp!u=m.Wewritep↓Buiffp!u=t or p!u=f. 6 RelevantUseConventions Inthesettingofservicefamilies,setsoffociplaytheroleofinterfaces.Thesetof all foci that serve as namesof named services in a service family is regardedas theinterfaceofthatservicefamily.Therearecasesinwhichprocessingdoesnot terminateor,evenworse(becauseitisstaticallydetectable),interfacesofservices familiesdonotmatch.Inthecaseofnon-termination,thereisnothingthatwein- tendto denoteby a term ofthe form p•C or p!C. Inthe case ofnon-matching servicesfamilies,thereisnothingthatweintendtodenotebyatermoftheform C⊕D.Moreover,inthecaseofterminationwithoutaBooleanreply,thereisnoth- ingthatweintendtodenotebyatermoftheform p!C. Weproposetocomplywiththefollowingrelevantuseconventions: – p•Cisonlyusedifitisknownthat p↓C; – p!Cisonlyusedifitisknownthat p↓BC;6 – C⊕Disonlyusedifitisknownthatfoci(C)∩foci(D)=0/. Theconditionfoundinthefirstconventionisjustifiedbythefactthatx•u=0/ if x↑u. We do not have x•u=0/ only if x↑u. For instance, !t•0/ =0/ whereas !t↓0/.Similarremarksapplytotheconditionfoundinthesecondconvention. Theideaofrelevantuseconventionsistakenfrom[5],whereitplaysacentral roleinanaccountofthewayinwhichmathematiciansusuallydealwithdivision byzeroinmathematicaltexts.Inthesequel,wewillcomplywiththerelevantuse conventionsdescribedabove. 7 FunctionalUnits Inthissection,weintroducetheconceptofafunctionalunitandrelatedconcepts. It is assumed that a non-emptyfinite or countablyinfinite set S of states has beengiven.Asbefore,itisassumedthatanon-emptyfinitesetM ofmethodshas beengiven.However,inthesettingoffunctionalunits,methodsserveasnamesof operationsonastatespace.Forthatreason,themembersofM willhenceforthbe calledmethodnames. 6 Ifitturnsoutthatinsomecasep!C=fafailurehasoccurredbecausebyusingIfp!C thebeliefisimplicitlyassumedthat p↓BC.Aplausiblecauseforthatstateofaffairsisan instructionsequencingfault.Thatisamismatchbetweeninstructionsequencer intentions andtheoperationalsemanticsoftheinstructionsequencethatwasconstructed,forinstance ifatsomeplace!waswrittenwhere!twasmeant.Anotherplausiblecauseisthatamistake wasmadeconcerningthechoicewhichinstructionsequencefromalibraryofgivenonesto execute. 10 J.A.Bergstra,C.A.Middelburg AmethodoperationonSisatotalfunctionfromStoB×S.Apartialmethod operation on S is a partial function from S to B×S. We write MO(S) for the set of all method operations on S. We write Mr and Me, where M ∈ MO(S), forthe uniquefunctionsR:S→B andE:S→S, respectively,such thatM(s)= (R(s),E(s))foralls∈S. A functional unit for S is a finite subset H of M ×MO(S) such that (m,M)∈H and (m,M′)∈H implies M =M′. We write FU(S) for the set of all functionalunits for S. We write I(H), where H ∈FU(S), for the set {m∈M |∃M∈MO(S)•(m,M)∈H}.WewritemH,whereH ∈FU(S)and m∈I(H),fortheuniqueM∈MO(S)suchthat(m,M)∈H. WelookuponthesetI(H),whereH ∈FU(S),astheinterfaceofH.It lookstobeconvenienttohaveanotationfortherestrictionofafunctionalunitto asubsetofitsinterface.Wewrite(I,H),whereH ∈FU(S)andI ⊆I(H ), forthefunctionalunit{(m,M)∈H |m∈I}. Let H ∈FU(S). Then an extension of H is an H′ ∈FU(S) such that H ⊆H′. Accordingtothedefinitionofafunctionalunit,0/ ∈FU(S).Bythatwehave a unique functional unit with an empty interface, which is not very interesting initself.However,whenconsideringservicesthatbehaveaccordingtofunctional units,0/ isexactlythefunctionalunitaccordingtowhichtheemptyserviced (the servicethatisnotabletoprocessanymethod)behaves. WewillusePGLB instructionsequencestoderivepartialmethodoperations sbt fromthemethodoperationsofafunctionalunit.WewriteL(f.I),whereI⊆M, forthesetofallPGLB instructionsequences,takingtheset{f.m|m∈I}asthe sbt setAofbasicinstructions. The derivationof partialmethodoperationsfromthe methodoperationsof a functionalunitinvolvesserviceswhoseprocessingofmethodsamountstoreplies and service changes according to correspondingmethod operations of the func- tional unit concerned. These services can be viewed as the behaviours of a ma- chine, on which the processing in question takes place, in its different states. We take the set FU(S)×S as the set S of services. We write H (s), where H ∈FU(S) and s∈S, for the service (H,s). The functions ¶ and r are ¶ m m definedasfollows: ¶ (H(s))= H(meH(s)) ifm∈I(H) ¶ m 0/(s′) ifm∈/I(H), ( mr (s) ifm∈I(H) r (H(s)) = H m d ifm∈/I(H), ( where s′ is a fixed but arbitrarystate in S. We assume that each H(s)∈S can be denoted by a closed term of sort S. In this connection, we use the following notationalconvention:foreachH(s)∈S,wewriteH(s)foranarbitraryclosed term of sort S that denotes H(s). The ambiguity thus introduced could be ob- viatedbydecoratingH(s)whereveritstandsforaclosedterm.However,inthis paper,itisalwaysimmediatelyclearfromthecontextwhetheritstandsforaclosed