⋆ Is it a “Good” Encoding of Mixed Choice? (Technical Report) Kirstin Peters and Uwe Nestmann TU Berlin, Germany Abstract. This technical report contains the proofs to the lemmata and theorems of [PN12] as well as some additional material. As main contributions [PN12] presents an encoding of mixed choice in the context of the π-calculusand a criterion to measure whether thedegree of distribution in process networks is preserved. 2 1 Technical Preliminaries 1 0 2 1.1 The π-Calculus n Our source language is the monadic π-calculus as described for instance in [SW01]. As already demonstrated in a [Pal03] the most interesting operator for a comparison of the expressive power between the full π-calculus and its J asynchronous variant is mixed choice, i.e., choice between input and output capabilities. Thus we denote the full 6 π-calculus also by π . Let N denote a countably infinite set of names with τ ∈/ N and N the set of co-names, i.e., m ] N ={n|n∈N}. We use lower case letters a,a′,a1,...,x,y,... to range over names. O L Definition 1 (πm). The set of process terms of the synchronous π-calculus (with mixed choice), denoted by Pm, . is given by s c [ P ::= (νn)P | P1 |P2 | [a=b]P | y∗(x).P | πi.Pi i∈I 1 X v where π ::= y(x) | yhzi | τ for some names n,a,b,x,y,z ∈N and a finite index set I. 0 1 The interpretationofthe definedprocesstermsis asusual.Moreoverwe considertwosubcalculiofπ .The process 4 m terms P of π —the π-calculus with separate choice—are obtained by restricting the choice primitive, such that in 1 s s . each choice either no input guarded or no output guarded alternatives appear. 1 0 Definition 2 (π ). The set of process terms of the π-calculus (with separate choice), denoted by P , is given by 2 s s 1 : P ::= (νn)P | P1 |P2 | [a=b]P | y∗(x).P | πiI.Pi | πiO.Pi v i∈I i∈I i X X X where πI ::= y(x) | τ and πO ::= yhzi | τ for some names n,a,b,x,y,z ∈N and a finite index set I. r a Finally, the process terms P of the asynchronous π-calculus π [Bou92,HT91] are obtained by restricting each a a sum to be of length zero or one and requiring, that outputs can only guard the empty sum. Definition 3 (π ). The set of process terms of the asynchronous π-calculus, denoted by P , is given by a a P ::= 0 | (νn)P | P |P | [a=b]P | yhz˜i.P | y(x˜).P | τ.P | y∗(x˜).P 1 2 for some names n,a,b,y ∈N and some finite sequences of names x˜,z˜⊂N. Note that we augment all three variants of the π-Calculus with matching, because we need it at least in π to a encode mixed choice. Of course, the presence of match influences the expressive power of π . However, we do not a know, whether the use of match in the encoding of mixed choice can be circumvented, although there are reasons indicating that this is indeed not possible. We left the consideration of this problem to further research. WeusecapitallettersP,P′,P ,...,Q,R,...torangeoverprocesses.Letfn(P),bn(P),andn(P)denotesthesets 1 of free names, bound names and all names occurring in P, respectively. Their definitions are completely standard. Givenaninputprefixy(x)oranoutputprefixyhxiwecallythesubjectandxtheobjectoftheaction.Moreoverwe denotethesubjectofanactionalsoaslinkorchannelname,whilewedenotetheobjectasvalueorparameter.Note ⋆ This work was supported by theDFG (German Research Foundation),grant NE-1505/2-1. that in case the object does not matter we omit it, i.e., we abbreviate an input guarded term y(x).P or an output guarded term yhxi.P such that x6∈fn(P) by y.P or y.P, respectively. Moreover we denote the empty sum with 0 andoftenomititincontinuations.Asusualwesometimesnotateasum π .P byπ .P +...+π .P . i∈{i1,...,in} i i i1 i1 in in We use σ,σ′,σ1,... to range over substitutions. A substitution is aPmapping {x1/y1,...,xn/yn} from names to names. The application of a substitution on a term {x1/ ,...,xn/ }(P) is defined as the result of simultaneously y1 yn replacing all free occurrences of y by x for i ∈ {1,...,n}, possibly applying alpha-conversion to avoid capture i i or name clashes. For all names N \{y ,...,y } the substitution behaves as the identity mapping. Let id denote 1 n identity,i.e.idistheemptysubstitution.Wenaturallyextendsubstitutionstoco-names,i.e.∀n∈N .σ(n)=σ(n) for all substitutions σ. Moreover,let x˜ denote a sequence of names. For simplicity, we occasionally treat x˜ as a set. So x˜⊂M denotes a sequence of names of the set M, |x˜| is the length of the sequence x˜, and y ∈ x˜ denotes that y is one of the names within the sequence x˜. Accordingly, we use the notion of sequence to abbreviate multiple restrictions, i.e., (νx˜)P , (νx )...(νx )P for a sequence of names x˜ = x ,...,x . Moreover we naturally extend substitutions 1 n 1 n to sequences of names, i.e., σ(x˜) , σ(x ),...,σ(x ) and x˜/ P , {x1/ ,...,xn/ }P for two sequences of 1 n y˜ y1 yn names x˜=x ,...,x and y˜=y ,...,y . 1 n 1 n (cid:8) (cid:9) P ≡Q if Q can be obtained from P by renaming one or more of the bound names in P, silently avoiding nameclashes P |0≡P P |Q≡Q|P P |(Q|R)≡(P |Q)|R [a=a]P ≡P (νn)0≡0 (νn)(νm)P ≡(νm)(νn)P P |(νn)Q≡(νn)(P |Q) if n∈/ fn(P) Fig.1. Structuralcongruence. The reduction semantics of π , π , andπ are jointly givenby the transitionrules in Figure 2, where structural m s a congruence, denoted by ≡, is given by the rules in Figure 1. Note that the rule Com for communication in π is a a a simplified versionofthe ruleCom forcommunicationinπ orπ .The differencesbetweenthese tworulesresult m,s m s from the differences in the syntax, i.e. the lack of choice and the fact that only input can be used as guard in π . a The same can be observed for the rules Tau and Rep . As usual, we use ≡ if we refer to alpha-conversion (the a a α first rule of Figure 1) only. Taum,s ...+τ.P +...7−→P Taua τ.P 7−→P Comm,s (...+y(x).P +...)|(...+yhzi.Q+...)7−→{z/x}P |Q Coma y(x˜).P |yhz˜i7−→ z˜/x˜ P if |x˜|=|z˜| Repm,s y∗(x).P |(...+yhzi.Q+(cid:8)...)(cid:9)7−→{z/x}P |Q|y∗(x).P Repa y∗(x˜).P |yhz˜i7−→ z˜/x˜ P |y∗(x˜).P if |x˜|=|z˜| P 7−→P′ P 7−→P(cid:8)′ (cid:9) P ≡P′ P′7−→Q′ Q′≡Q Par Res Cong P |Q7−→P′ |Q (νx)P 7−→(νx)P′ P 7−→Q Fig.2. Concurrent reduction semantics. Let P 7−→ (P 67−→) denote existence (non-existence) of a step from P, i.e. there is (no) P′ ∈ P such that P 7−→P′. Moreover,let =⇒ be the reflexive and transitive closure of 7−→ and let 7−→∞ define an infinite sequence of steps. In Section1.3, we preZsentseveralcriteriato measure the qualityof anencoding.The firstof these criteriarelies on the notion of a context. A context C([·] ,...,[·] ) is a π-term, i.e., a π -term in case of Definition 7, with n 1 n a so-calledholes.Pluggingtheπ -termsP ,...,P inthisorderintotheholes[·] ,...,[·] ofthecontext,respectively, a 1 n 1 n yieldsatermdenotedC(P ,...,P ).Therefore,weconsideracontextasafunctionfromtermsintoterms,e.g.,the 1 n context C([·] ,...,[·] )∈ P ×...×P →P maps n π -terms onto a π -term. Sometimes, we refer to P ,...,P 1 n a a a a a 1 n as the parameters of the context C. Note that a context may bind some free names of P ,...,P . The arity of a 1 n context is the number of its holes. Asusualwewilluseequivalencerelationstocompareπ-termsbymeansoftheirbehaviour.Moreover,asexplained inSection1.3,weuse anequivalenceto abstractfromjunk,i.e.,remainsofencodedtermsthatarenolongerofany use.Sinceweuseareductionsemantics,astandardequivalencetocompareπ -termsisbarbedcongruence,denoted m by ∼=. Its definition relies on the notion of an observable or barb (we refer to [SW01] for a detailed explanation). Definition 4 (Observable). Let P ∈P . Then P has an input observable y, denoted by P ↓ , if P can perform m y an input on y, i.e., ∃P′,P′′ ∈P .∃x˜⊂N .∃z ∈N .P ≡(νx˜)(P′ |y(z).P′′)∧y ∈/ x˜ m and P has an output observable y, denoted by P ↓ , if P can perform an output on y, i.e., y ∃P′,P′′ ∈P .∃x˜⊂N .∃z ∈N .P ≡(νx˜)(P′ |yhzi.P′′)∧y ∈/ x˜. m 1.2 Abbreviations To shorten the presentation and ease the readability of the rather lengthy encoding function in the next section, we use some abbreviations on π -terms. First note that we defined only monadic versions of the calculi π , π , a m s and π , where over any link exactly one value is transmitted. However, within the presented encoding functions, a we treat the target language π as if it allows for polyadic communication. More precisely, we allow asynchronous a links to carry any number of values from zero to five, of course under the requirement that within each π -term a no link name is used twice with different multiplicities. Note that these polyadic actions can be simply translated into monadic actionsby a standardencoding asgivenin [SW01]. Thus, wesilently use the polyadicversionofπ in a the following. Second, as already done in [Nes00], we use the following abbreviations to define boolean values and a conditional construct. Definition 5 (Tests on Booleans). Let B , {⊤,⊥} be the set of boolean values, where ⊤ denotes true and ⊥ denotes false. Let l,t,f ∈N and P,Q∈P . Then a boolean instantiation of l, i.e., the allocation of a boolean value to a link a l, and a test-statement on a boolean instantiation are defined by lh⊤i , l(t,f).t lh⊥i , l(t,f).f testl thenP elseQ , (νt,f) lht,fi|t.P |f.Q for some t,f ∈/ fn(P)∪fn(Q). (cid:0) (cid:1) Finally, we define forwarders,i.e., a simple process to forwardeachreceivedmessage along some specified set of links. Definition 6 (Forwarder). Let I be a finite index set and for all i ∈ I let y and y be channel names with i multiplicity n∈N, then a forwarder is given by: y ։{y |i∈I} , y∗(x ,...,x ). y hx ,...,x i i 1 n i 1 n ! i∈I Y In case of a singleton set we omit the brackets, i.e., y ։y′ , y ։{y′}. 1.3 Quality Criteria for Encodings Within this paper we consider two encodings, (1) an encoding from π into π presented in [Nes00], denoted by s a · s, and (2) a new encoding from π into π , denoted by · m. To measure the quality of such an encoding, a m a a Gorla [Gor10] suggested five criteria well suited for language comparison. Accordingly, we consider an encoding to be “good”, if it satisfies Gorla’s five criteria. J K J K As in[Gor10],an encoding is a mapping from a sourceinto a targetlanguage;in ourcase, π andπ are source m s languages and π is the target language. To distinguish terms on these languages or definitions for the respective a encodings, we use m, s, and a as super- and subscripts. Thereby, the superscript usually refers to the source and the subscript the target language. Moreover, we use S,S′,S ,... to range over terms of the source languages and 1 T,T′,T ,... to range over terms of the target language. 1 The five conditions are divided into two structural and three semantic criteria. The structural criteria include (1) compositionality and (2) name invariance. The semantic criteria include (3) operational correspondence, (4) divergence reflection and (5) success sensitiveness. Note that for the definition of name invariance and operational correspondence a behavioural equivalence ≍ on the target language is assumed. Its purpose is to describe the abstract behaviour of a target process, where abstract basically means with respect to the behaviour of the source term. Intuitively, an encoding is compositionalif the translationof an operator depends only on the translation of its parameters. To mediate between the translations of the parameters the encoding defines a unique context for each operator, whose arity is the arity of the operator. Moreover,the context can be parametrised on the free names of the corresponding source term. Definition 7 (Criterion 1: Compositionality). The encoding · is compositional if, for every k-ary operator op of π andfor everysubsetof names N,thereexists ak-arycontextCN ([·] ,...,[·] )suchthat, for all S ,...,S m op 1 k 1 k with fn(S )∪...∪fn(S )=N, it holds that 1 k J K op(S ,...,S ) =CN ( S ,..., S ). 1 k op 1 k If the context is again the original operator,i.e., if an operator is translated by encoding its parameters and apply J K J K J K the renaming policy, as in (νx)P = νϕ (x) P , we call this encoding rigid. Note that Gorla requires that JK the parallel composition operator “|” is binary and unique in the source as well as in the target language. Thus, (cid:0) (cid:1) compositionality prevents fJrom introKducing a globaJl coKordinator or to use global knowledge, i.e., knowledge about surrounding source terms or the structure of the parameters. The secondstructuralcriterionstates thatthe encoding shouldnotdependonspecific namesusedin the source term. This is important, since sometimes it is necessary to translate a source term name into a sequences of names or reserve some names for the encoding function. To ensure that there are no conflicts between these reserved names and the source term names, the encoding is equipped with a renaming policy ϕ , i.e., a substitution from JK namesintosequencesofnames1.Sincewetranslatesourcetermnamesonlyintosinglenames,therenamingpolicies introduced by · s and · m are injective substitutions from names into names. Basedon such a renaming policy a a an encoding is independent of specific names if it preservesall substitutions σ on source terms by a substitution σ′ on target terms such that σ′ respects the changes made by the renaming policy. J K J K Definition 8 (Criterion 2: Name Invariance). The encoding · is name invariant if, for every S and σ, it holds that J K ≡ σ′( S ) if σ is injective α σ(S) (≍σ′( S ) otherwise J K where σ′ is such that ϕ (σ(n))=σJ′ ϕ (Kn) for every n∈N. JK JK J K The first semantic criterion and us(cid:0)ually th(cid:1)e most elaborate one to prove is operational correspondence, which consists of a soundness and a completeness condition. Completeness requires that every computation of a source term can be emulated by its translation, i.e., the translation does not reduce the computations of the source term. Note that encodings often translate single source term steps into a sequence of target term steps. We call such a sequenceanemulationofthecorrespondingsourcetermstep.Soundness requiresthateverycomputationofatarget term corresponds to some computation of the corresponding source term, i.e., the translation does not introduce new computations. 1 To keep distinct names distinct Gorla assumes that ∀n,m ∈ N . n 6= m implies ϕ (n)∩ϕ (m) = ∅, where ϕ (x) is JK JK JK simply considered as set here. Definition 9 (Criterion 3: Operational Correspondence). Let · be an arbitrary encoding. Then, two op- erational criteria are defined as follows. Completeness:For all S =⇒S′, it holds thatJ KS =⇒≍ S′ . Soundness: For all S =⇒T, there exists an S′ such that S =⇒S′ and T =⇒≍ S′ . Z J KZ J K J KZ Note that the definition of operational correspondence relies on the equivalence ≍ to get rid of junk possibly left Z Z J K over within computations of target terms (compare to Section 2.4 for a discussionof that equivalence). Sometimes, we refer to the completeness criterion of operational correspondence as operational completeness and, accordingly, for the soundness criterion as operational soundness. The next criterion concerns the role of infinite computations in encodings. Definition 10 (Criterion 4: Divergence Reflection). The encoding · reflects divergence if, for every S, S 7−→ω implies S 7−→ω. J K The last criterion links the behaviour of source terms to the behaviour of their encodings. With Gorla [Gor10], we J K assume a success operator Xas part of the syntax of both the source and the target language, i.e., of π , π , and m s π . Since Xcan not be further reduced, the operational semantics is left unchanged in all three cases. Moreover, a note that n(X) = fn(X) = bn(X) = ∅, so also interplay of Xwith the rules of structural congruence is smooth and does not require explicit treatment. The test for reachability of success is standard. Definition 11 (Success). A process P ∈P may lead to success, denoted as P ⇓X, if (and only if) it is reducible to a process containing a top-level unguarded occurrence of X, i.e. ∃P′,P′′ ∈P .P =⇒P′∧P′ ≡P′′ |X. Note that we choose may-testing here. Finally, an encoding preserves the abstract behaviour of the source term if Z it and its encoding answer the tests for success in exactly the same way. Definition 12 (Criterion 5: Success Sensitiveness). The encoding · is success sensitive if, for every S, S ⇓Xif and only if S ⇓X. J K Thiscriteriononlylinksthebehavioursofsourcetermsandtheirliteraltranslations,butnotoftheircontinuations. J K To do so, Gorla relates success sensitiveness and operational correspondence by requiring that the equivalence on the target language never relates two processes with different success behaviours. Definition 13 (Success Respecting). ≍ ⊆ Pa×Pa is success respecting if, for every P and Q with P ⇓Xand Q6⇓X, it holds that P 6≍Q. 2 Correctness of the Encodings Let us first present the full representations of the encodings · s in Figure 3 and · m in Figure 4. Note that in a a [Nes00,NP00] slightly different version of π and π are used, namely τ is no prefix and there are neither a match s a operator nor a success operator in the syntax of π and π . We choose the respective encodings to be rigid except s a J K J K for source terms guarded by τ. Since τ guarded terms can reduce without a communication partner,we implement their translation by a simple test-statement on their sum lock in both encodings. InthefollowingwewillargueforthecorrectnessoftheseencodingswithrespecttothecriteriaofGorlapresented in Section 1.3. 2.1 Structural Criteria The first two criteria to prove are the structural criteria; compositionality and name invariance. An encoding is compositionalifit defines a fixedcontextfor eachoperatorincluding holes forthe translationofits parameters.By Definition 7 of compositionality the context is allowed to depend on the free names of the parameters. However, both presented encodings, · s and · m, do not use that feature, i.e., the contexts do not depend on any names. a a By Figure 3 and Figure 4 both encodings are obviously compositional. Let us have a closer looJk aKt the cJonKtexts. In the encodings of restriction, matching and success the context is usedonlytotranslatesourcetermnamesaccordingtotherenamingpolicy.Apartfromthattheencodingsarerigid. The encoding of the sum operator inserts a positive instantiation of a fresh sum lock and splits up the encodings of the summands in parallel because there is no sum operator in the target language. Therefore of course we have (νx)P sa , (νϕsa(x)) P sa P |Q s , P s | Q s a a a J K J K [a=b]P sa , [ϕsa(a)=ϕsa(b)] P sa J Ks J K J K J πi.Pi K , (νl) lh⊤i| Jπi.PKi sa tXi∈I |a Yi∈I ! τ.P s , testl then lh⊥iJ| P sK elselh⊥i a a yhzi.P sa , (νs) ϕsa(y(cid:0))hl,s,ϕsa(z)i(cid:1)|s. P sa J K J K Jy(x).P Ksa , (νr)(cid:16)r |r∗.ϕsa(y) l′,s,ϕsa(xJ) .tKes(cid:17)tl thentestl′ thenlh⊥i|l′h⊥i|s | P sa (cid:0) (cid:0) (cid:1) elselh⊤i|l′h⊥i|r J K J K elselh⊥i|ϕsa(y) l′,s,ϕsa(x) y∗(x).P sa , ϕsa(y)∗(l,s,ϕsa(x)).testl thenlh⊥i|s | P sa elselh⊥(cid:10)i (cid:11)(cid:1) X s , X a J K J K Here ϕJsa isKsome arbitrary injective substitution such that ∀n∈N .ϕsa(n)∩{l,l′,r,s}=∅. Fig.3. Encoding from πs into πa. to consider the sum operator as binary operator with an index set and a set of its summands as parameters, or as unary operator with the set or list2 of its summands as parameter. We left the question whether there is an encoding from π into π with the binary sum operator as an open question to further research. The encodings of m a input andoutputguardedtermsandthe encodingoftermsguardedby τ introducerathersmallcontexts.However, in case of · m the contexts introduced to translate the binary parallel operator and replicated input are rather a complicated and huge. Remember that we claim in Section 1.3 that the parallel operator is binary. Comparing its encoding with the encoding of the sum operator we observe that this claim may be crucial because it forbids the J K introduction of a global coordinator for all parallel terms as the sum lock is for all the summands of a sum. Nameinvariancefollowsbythefactthatnamesaretranslatedintosinglenamesagainandthatconflictsbetween names used by the encoding functions and translated source term names are ruled out by the renaming policy. Lemma 1. The encoding · s is name invariant. a J K Proof. By Definition 8 it suffice to show, that: ∀S ∈P .∀σ ⊆N .∃σ′ ⊆N . σ(S) s ≡ σ′( S s)∧∀z ∈N .ϕs(σ(z))=σ′(ϕs (z)) s a α a a a Without loss of generality let σ ={y1/ ,...Jyn/ } fKor some nJ∈NK. We choose x1 xn σ′ , ϕsa(y1)/ϕsa(x1),...,ϕsa(yn)/ϕsa(xn) . n o So ∀z ∈N .ϕs (σ(z))=σ′(ϕs(z)). We proceed with an induction over the structure of S. a a Base Case: Since n(X) = ∅ = n(0) and fn (νl)lh⊤i = ∅, we have σ(X) s = X s = X= σ′(X) = σ′( X s) a a a and σ(0) s = 0 s =(νl)lh⊤i=σ′ (νl)lh⊤i =σ′( 0 s). a a (cid:0) (cid:1) a Induction Hypothesis: ∀S ∈P .∀σ ⊆N .∃σ′ ⊆N . σ(S) s ≡Jσ′( SK s) J K J K s (cid:0) (cid:1) a α a J K J K J K 2 Usually an unordered set of summands suffice to describeJa sum sKince usualJly wKe consider sums as being reflexive and symmetric,i.e., A+A=AandA+B=B+A.Ifforsomereasonswehavetoabandonreflexivityand/orsymmetry,e.g. in case of a randomised version of thecalculi, an ordered list might bethe betterchoice to describe a sum. (νx)P ma , (νϕma (x)) P ma P |Q ma , (νmo,mi,po,up,pi,up,co,ci) J K (νpo,pi) JP maK |pi ։{mi,p(cid:0)i,up}|po ։{mo,po,up} J K m |(νpo,pi(cid:0)) Q a (cid:1) J(cid:0) |cKohmii|co∗(mi).po(y,ls,s,z). J K(νmi,up)(mi∗ y′,lr,r . y′(cid:0)=y rhlr,ls,ls,s,zi|mi,up y′,lr,r |(ν(cid:0)mi)(mi,(cid:1)up(cid:0)։(cid:2) mi |co(cid:3)hmii)) (cid:10) (cid:11)(cid:1) |po,uphy,ls,s,zi |cihmoi|ci∗(mo).pi(cid:1)(y,lr,r). (νmo,up)(mo∗ y′,ls,s,z (cid:0). y′ =y rhls,lr,ls,s,zi|mo,up y′,ls,s,z |(ν(cid:0)mo)(mo,up(cid:1)։(cid:0)(cid:2)mo |cih(cid:3)moi)) (cid:10) (cid:11)(cid:1) |pi,uphy,lr,ri |po,up ։po |pi,up ։pi (cid:1)(cid:1) [a=b]P ma , [ϕma (a)=ϕma (b)] P(cid:1)ma m J πi.Pi K , (νl) lh⊤i| πJi.PiK ma tXi∈I |a Yi∈I ! τ.P m , testl thenlh⊥i|J P mKelselh⊥i a a yhzi.P ma , (νs) pohϕma (y),l,s,ϕma (z)i|s. P ma J K J K y(x).P ma , (νr)(cid:0)pihϕma (y),l,ri|r∗(l1,l2,−,s,ϕma(cid:1)(x)). J K J K tes(cid:0)tl1 then testl2 thenl1h⊥i|l2h⊥i|s | P ma elsel1h⊤i|l2h⊥i elsel1h⊥i Jy∗(x).P Kma , (νl,r,cr1,cr2,(cid:0)ro,ri) (cid:1) (cid:1) J K pihϕsa(y),l,ri|r∗(−,−(cid:0),ls,s,ϕsa(x)).testlsthenlsh⊥i|s|cr1hϕma (x)i elselsh⊥i J K s |rihϕa(y),l,ri|lh⊤i|cr2hro,rii |cr1∗(ϕma (x)).cr2(ro,ri).(νmo,mi,po,up,pi,up,ro,up,ri,up,co,ci,mo,up,mi,up) ro ։{mo,ro,up}|ri ։{mi,ri,up} (cid:0) m |(νpo,pi) P a (cid:0) |cohmii|co∗(mi).po(y,ls,s,z). J (νKmi,up) mi∗ y′,lr,r . y=(cid:0)y′ rhlr,ls,ls,s,zi|mi,up y′,lr,r (cid:0) |(ν(cid:0)mi)(mi,(cid:1)up(cid:0)։(cid:2) mi |co(cid:3)hmii) (cid:10) (cid:11)(cid:1) |po,uphy,ls,s,zi (cid:1) |cihmoi|ci∗(mo).p(cid:1)i(cid:1)(y,lr,r). (νmo,up) mo∗ y′,ls,s,z . (cid:0) y=y′ rhls,lr,ls,s,zi|mo,up y′,ls,s,z (cid:0) |(νm(cid:0) o)(mo,up(cid:1)։(cid:0)(cid:2)mo |cih(cid:3)moi) (cid:10) (cid:11)(cid:1) |pi,uphy,lr,ri (cid:1) |(νro,ri)(cr2hro,rii|po,up ։(cid:1){po,ro}|ro,up ։ro |pi,up ։{pi,ri}|ri,up ։ri) X sa , X (cid:1)(cid:1) Here ϕma is someJarbKitrary injective substitution such that ∀n∈N .ϕma (n)∩N =∅, where N is the set of reserved names, i.e., N ={po,pi,po,up,pi,up,mo,mi,mo,up,mi,up,co,ci,l,ls,lr,l1,l2,s,r,cr1,cr2,ri,ro,ri,up,ro,up,y,y′,z,t,f}. m Fig.4. Encoding · a from πm intoπa. J K Induction Step: Let x′ ∈ N be such that x′ ∈/ n(σ) ∪ fn(P). Then ϕm(x′) ∈/ n(σ). Moreover, since ∀n ∈ a N .ϕm(n)∈/ {l,l′,r,s}, we have n(σ′)∩{l,l′,r,s}=∅. Note that: a σ x′/ (P) s = x′/ ,yi/ |yi/ ∈σ∧x 6=x (P) s x x xi xi i a a r (cid:16)n o (cid:17)z ≡αrnϕsa(x′)/ϕsa(x),ϕsa(yi)/ϕsa(xi) |yi/xio∈σ∧zxi 6=x ( P sa) by IH = nϕsa(x′)/ϕsa(x),ϕsa(yi)/ϕsa(xi) |ϕsa(yi)/ϕsa(xi) ∈σ′∧ϕosaJ(xi)K6=ϕsa(x) ( P sa) =nσ′ ϕsa(x′)/ϕsa(x) ( P sa) o J K (cid:16)n o (cid:17) We proceed by a case split. J K Case of S =(νx)P: Then σ(S) s = σ((νx)P) s ≡ σ (νx′) x′/ (P) s = (νx′)σ x′/ (P) s a a α x x a a J K =(Jνϕsa(x′)) σK x′/rx ((cid:16)P) san≡α (oνϕsa((cid:17)xz′))σ′r ϕsa(x′)/ϕ(cid:16)san(x) (oP sa(cid:17))z =σ′ (νϕsa(xr′))(cid:16)nϕsa(x′)o/ϕsa(x)(cid:17)z( P sa) ≡α σ′((ν(cid:16)ϕnsa(x)) P sa)o=Jσ′(K S(cid:17) sa). (cid:16) n o (cid:17) Case of S =P |Q: Then J K J K J K σ(S) s = σ(P |Q) s = σ(P)|σ(Q) s = σ(P) s | σ(Q) s ≡ σ′( P s)|σ′( Q s) a a a a a α a a =σ′( P s | Q s)=σ′( P |Q s). a a a J K J K J K J K J K J K J K Case of S =[a=b]P:JTheKn J K J K σ(S) s = σ([a=b]P) s = [σ(a)=σ(b)]σ(P) s =[ϕs(σ(a))=ϕs (σ(b))] σ(P) s a a a a a a ≡ [σ′(ϕs(a))=σ′(ϕs (b))]σ′( P s)=σ′([ϕs(a)=ϕs (b)] P s)=σ′( S s). α a a a a a a a J K J K J K J K Case of S = i∈I πi.Pi: Then J K J K J K P s s σ(S) s = σ π .P = σ(π .P ) =(νl) lh⊤i| σ(π .P ) s a i i i i i i a t !| t | ! Xi∈I a Xi∈I a Yi∈I J K J K ≡ (νl) lh⊤i| σ′( π .P s) =σ′ (νl) lh⊤i| π .P s =σ′( S s). α i i a i i a a ! !! i∈I i∈I Y Y J K J K J K Case of S =τ.P: Then σ(S) s = σ(τ.P) s = τ.σ(P) s =testl thenlh⊥i| σ(P) s elselh⊥i a a a a ≡ testl thenlh⊥i|σ′( P s) elselh⊥i=σ′ testl thenlh⊥i| P s elselh⊥i α a a J K =Jσ′( S s)K. J K J K a (cid:0) (cid:1) J K J K Case of S =yhzi.P: ThenJ K s σ(S) s = σ(yhzi.P) s = σ(y)hσ(z)i.σ(P) a a a r z =(νs) ϕs (σ(y))hl,s,ϕs(σ(x))i|tests then σ(P) s else0 J K J a K a a (cid:16) (cid:17) ≡ (νs) σ′(ϕs (y))hl,s,σ′(ϕs(x))i|tests thenσ′( P s) else0 α a a J K a (cid:16) (cid:17) =σ′ (νs) ϕs (y)hl,s,ϕs(x)i|tests then P s else0 =σ′( S s). a a a J K a (cid:16) (cid:16) (cid:17)(cid:17) J K J K Case of S =y(x).P: Then σ(S) s = σ(y(x).P) s ≡ σ y(x′). x′/ (P) s = σ(y)(x′).σ x′/ (P) s a a α x x a a =(νr) r |r∗.ϕs(σ(yr))(l(cid:16)′,s,ϕs(xn′)).o (cid:17)z r (cid:16)n o (cid:17)z J K J Ka a te(cid:0)stl thentestl′ thenlh⊥i|l′h⊥i|sh⊤i| σ x′/ (P) s elselh⊤i|l′h⊥i|sh⊥i|r x a elselh⊥i|ϕs(σ(y))hl′,s,ϕs(x′)i r (cid:16)n o (cid:17)z a a ≡α (νr) r |r∗.σ′(ϕsa(y))(l′,s,ϕsa(x′)). (cid:1) tes(cid:0)tl thentestl′ thenlh⊥i|l′h⊥i|sh⊤i|σ′ ϕsa(x′)/ϕsa(x) ( P sa) elselh⊤i|l′h⊥i|sh⊥i|r (cid:16)n o (cid:17) J K elselh⊥i|σ′(ϕs (y))hl′,s,ϕs(x′)i a a =σ′ (νr) r |r∗.ϕsa(y)(l′,s,ϕsa(x′)). (cid:1) (cid:0) testl(cid:0)thentestl′ thenlh⊥i|l′h⊥i|sh⊤i| ϕsa(x′)/ϕsa(x) ( P sa) elselh⊤i|l′h⊥i|sh⊥i|rn o J K elselh⊥i|ϕs(y)hl′,s,ϕs(x′)i a a ≡α σ′ (νr) r |r∗.ϕsa(y)(l′,s,ϕsa(x)). (cid:1)(cid:1) (cid:0)testl (cid:0)thentestl′ thenlh⊥i|l′h⊥i|sh⊤i| P sa elselh⊤i|l′h⊥i|sh⊥i|r elselh⊥i|ϕs(y)hl′,s,ϕs(x)i a a J K =σ′( S sa). (cid:1)(cid:1) Case of S =y∗(x).P: Then J K σ(S) s = σ(y∗(x).P) s ≡ σ y∗(x′). x′/ (P) s = σ(y)∗(x′).σ x′/ (P) s a a α x x a a =ϕs (σ(y))∗(l,s,ϕs(xr′)).t(cid:16)estl thennlh⊥oi|sh(cid:17)⊥iz| σr x′/ (P) (cid:16)snelseolh⊥i(cid:17)|zsh⊥i J K Ja K a x a ≡α σ′(ϕsa(y))∗(l,s,ϕsa(x′)).testl thenlh⊥i|sh⊥ir|σ′(cid:16)nϕsa(ox′)/ϕsa((cid:17)x)z ( P sa) elselh⊥i|sh⊥i =σ′ ϕsa(y)∗(l,s,ϕsa(x′)).testl thenlh⊥i|sh⊥i| ϕsa((cid:16)xn′)/ϕsa(x) ( PosaJ) elsKel(cid:17)h⊥i|sh⊥i ≡ σ(cid:16)′ ϕs(y)∗(l,s,ϕs(x)).testl thenlh⊥i|sh⊥i|nP s elseloh⊥i|sh⊥i (cid:17) α a a a J K =σ′( S s). (cid:0) a (cid:1) J K ⊓⊔ Lemma 2. The encodinJg K· m is name invariant. a Proof. By Definition 8 it suffice to show, that: J K ∀S ∈P .∀σ ⊆N .∃σ′ ⊆N . σ(S) m ≡ σ′( S m)∧∀z ∈N .ϕm(σ(z))=σ′(ϕm(z)) m a α a a a Without loss of generality let σ ={y1/ ,...yn/ } for some n∈N. We choose x1 J xn K J K σ′ , ϕma(y1)/ϕma(x1),...,ϕma(yn)/ϕma(xn) . n o So ∀z ∈N .ϕm(σ(z))=σ′(ϕm(z)). We proceed with an induction over the structure of S. a a Base Case: Since n(X)=∅=n(0) and fn (νl)lh⊤i =∅, we have σ(X) m = X m =X=σ′(X)=σ′( X m) a a a and σ(0) m = 0 m =(νl)lh⊤i=σ′ (νl)lh⊤i =σ′( 0 m). a a (cid:0) (cid:1) a Induction Hypothesis: ∀S ∈Pm .∀σ ⊆N(cid:0).∃σ′ ⊆N(cid:1). σ(S) ma J≡α σ′(KS maJ) K J K Induction Step: Let x′ ∈ N be such that x′ ∈/ n(σ) ∪ fn(P). Then ϕm(x′) ∈/ n(σ). Moreover, since ∀z ∈ J K J K J K a N .ϕm(z)∈/ N, where a J K J K N ={p ,p ,p ,p ,m ,m ,m ,m ,c ,c ,l,l ,l ,l ,l ,s,r,c ,c ,r ,r ,r ,r ,y,y′,z,t,f}, o i o,up i,up o i o,up i,up o i s r 1 2 r1 r2 i o i,up o,up we have n(σ′)∩N =∅. Note that: σ x′/ (P) m = x′/ ,yi/ |yi/ ∈σ∧x 6=x (P) m x x xi xi i a a r (cid:16)n o (cid:17)z ≡αrnϕma(x′)/ϕma(x),ϕma(yi)/ϕma(xi) |yi/oxi ∈σz∧xi 6=x ( P ma) by IH = nϕma(x′)/ϕma(x),ϕma(yi)/ϕma(xi) |ϕma(yi)/ϕma(xi) ∈σ′∧oϕmaJ(xiK)6=ϕma (x) ( P ma ) =nσ′ ϕma(x′)/ϕma(x) ( P ma ) o J K (cid:16)n o (cid:17) We proceed by a case split. J K Case of S =(νx)P: Then σ(S) m = σ((νx)P) m ≡ σ (νx′) x′/ (P) m = (νx′)σ x′/ (P) m a a α x x a a J K =(Jνϕma (x′)) Kσ x′/rx ((cid:16)P) man≡αo(νϕma(cid:17)(xz′))σ′r ϕma(x′)/(cid:16)ϕnma(x) o( P(cid:17)maz) =σ′ (νϕma (xr′))(cid:16)nϕma(x′o)/ϕma(x(cid:17))z( P ma) ≡α σ′((ν(cid:16)ϕnma (x)) P mao)=Jσ′(K S(cid:17) ma ). (cid:16) n o (cid:17) Case of S =P |Q: Then J K J K J K σ(S) m = σ(P |Q) m = σ(P)|σ(Q) m a a a = (νc,m ,m ,p ,p ,c ,c ,m ,m ) o i o,up i,up o i o,up i,up J K J c |(νpo,Kpi) Jσ(P) ma |procKLeftOutReq|(cid:0)procLeftInReq |(νpo,pi) (cid:0) σ(Q) ma |procRightOutReq|procRightInRe(cid:1)q J K |pushReq (cid:0) (cid:1) J K ≡α (νc,mo,m(cid:1)i,po,up,pi,up,co,ci,mo,up,mi,up) c |(νpo,pi) σ( P ma )|procLeftOutReq|(cid:0)procLeftInReq |(νpo,pi) (cid:0)σ′( Q ma )|procRightOutReq|procRightInR(cid:1)eq J K |pushReq (cid:0) (cid:1) J K =σ′ (νc,mo,m(cid:1)i,po,up,pi,up,co,ci,mo,up,mi,up) (cid:0) c |(νpo,pi) P ma |procLeftOutReq|pro(cid:0)cLeftInReq |(νpo,pi) (cid:0) Q ma |procRightOutReq|procRightInRe(cid:1)q J K |pushReq (cid:0) (cid:1) =σ′( S ma ). (cid:1)(cid:1) J K Case of S =[a=b]P: Then J K σ(S) m = σ([a=b]P) m = [σ(a)=σ(b)]σ(P) m =[ϕm(σ(a))=ϕm(σ(b))] σ(P) m a a a a a a ≡ [σ′(ϕm(a))=σ′(ϕm(b))]σ′( P m)=σ′([ϕm(a)=ϕm(b)] P m)=σ′( S m). α a a a a a a a J K J K J K J K Case of S = π .P : Then i∈I i i J K J K J K P m m σ(S) m = σ π .P = σ(π .P ) =(νl) lh⊤i| σ(π .P ) m a i i i i i i a t !| t | ! Xi∈I a Xi∈I a Yi∈I J K J K ≡ (νl) lh⊤i| σ′( π .P m) =σ′ (νl) lh⊤i| π .P m =σ′( S m). α i i a i i a a ! !! i∈I i∈I Y Y Case of S =τ.P: Then J K J K J K σ(S) m = σ(τ.P) m = τ.σ(P) m =testl thenlh⊥i| σ(P) m elselh⊥i a a a a ≡ testl thenlh⊥i|σ′( P m) elselh⊥i=σ′ testl thenlh⊥i| P m elselh⊥i α a a J K =Jσ′( S mK). J K J K a (cid:0) (cid:1) J K J K J K