Soft Session Types (Long Version)

We show how systems of sessions types can enforce interactions to be bounded for all typable processes. The type system we propose is based on Lafont's soft linear logic and is strongly inspired by recent works about session types as intuitionistic l…

Authors: Ugo Dal Lago, Paolo Di Giamberardino

Soft Session T yp es Ugo Dal Lago ∗ P aolo D i Giam b erardino † June 24, 2018 Abstract W e sho w how systems of session types can enforce interactions to b e b ound ed for all typable processes. The type system w e p rop ose is based on Lafon t’s soft linear logic and is strongly inspired b y recent w orks ab out session typ es as in tuitionistic linear logic formula s. Our mai n result is the existence, for every typable process, of a p olynomial boun d on the le ngth of reduction sequences starting from it and on th e size of its reducts. 1 In tro duc tion Session t yp es are one of the m os t succes sful paradigms around which communication can be disciplined in a concurren t or ob ject-ba sed environmen t. They can come in many differen t flav ors, depe nding on the under lying progra mming language and on the degr ee of flexibility they a llow when defining the s tructure of sessions . As an example, sy stems of session types for m ulti-par ty int era ction hav e b een r ecently int ro duced [8], while a for m o f higher-or der session has b een shown to b e definable [11]. Recur sive t yp e s, on the other hand, ar e part of the standar d to olset of session t yp e theories since their inceptio n [7]. The key property induced b y sys tems of session types is the following: if tw o (or more) pro cesse s can b e typed w ith “dual” ses sion type s , then they can in terac t with each o ther without “g oing wrong”, i.e. av oiding situa tions whe r e one party needs some data with a c e rtain t yp e and the other(s) offer so mething of a different, incompatible type. Sometimes, one w ould like to g o b eyond that and design a type system which g uarantees strong er pr op erties, including quantitativ e ones . An example of a prop erty that w e find particularly interesting is the following: suppo se that t wo pro cesses P and Q interact by crea ting a sessio n having t yp e A throug h which they co mm unicate. Is this in teraction guar anteed to b e finite? How long would it la st? Moreover, P and Q may be force d to interact w ith other proces ses in order to b e able to offer A . The question could then b ecome: can the global amount of in tera ction be kept under control? In other words, one could b e interested in pr oving the int er action ind uc e d by sessions to b e b ounde d . This problem has b een a lmost negle c ted by the rese a rch communit y in the ar e a of s ession t yp es, altho ug h it is the manifesto of the so-called implicit computational co mplexity (ICC), where one aims a t giving machine-free characterizations of complexity classes ba s ed on pr ogramming lang ua ges and logica l systems. Linear logic ( LL in the following) has been introduced tw ent y-five years ago by Jean-Yv es Girard [6]. One of its grea test merits has b een to allow a finer analys is of the computational conten t o f bo th int uitionistic and classical logic . In turn, this is made pos sible by distinguishing m ultiplicative as well as additive connectives, by an inv olutive notion of negation, a nd by giving a new status to structura l rules allowing them to b e a pplicable o nly to mo dal formulas. One of the many co nsequences of this new, r e fined wa y of lo o king at pro of theory has b een the introduction of natural characterizations of complexity classes b y frag ments of linear logic. This is p o ssible bec ause linear lo gic so mehow “isolates” complexit y in the mo dal fragment of the logic (which ∗ Unive rs i t` a di Bologna & INRIA Sophia An tip olis, dallago@c s.unibo.it † Dipartiment o di Matematica e Informatica, Universit` a di Cagliari , digiambe @unica.it 1 is so lely r esp onsible for the hyperexp o nent ial complexity of cut elimination in, say intuitionistic logic), which can then be re stricted so a s to get exactly the expressive power needed to capture small complexity classes. O ne of the simplest and most elegant of those systems is Lafont’s so ft linear log ic ( SLL in the following), which ha s b een shown to co rresp ond to p olynomia l time in the realm of class ical [9], quantum [5] and higher-o rder concur rent computation [4]. Recently , Caires a nd Pfenning [1] ha ve shown how a s ystem of sessio n t yp es can be built around int uitionistic linear logic, by introducing π D ILL , a t yp e system for the π -calculus where types and rules are derived from the ones of intuitionistic linear lo gic. In their sy s tem, multip lica tive connectives like ⊗ and ⊸ allow to mo del sequentialit y in sessions, while the additive connectives & and ⊕ model e xternal and internal choice, r esp ectively . The moda l connective !, on the other hand, allows to model a ser ver of t yp e ! A which can o ffer the functionality ex pressed by A man y times. In this pap er, we study a restr iction of π DILL , c alled π DSLL , which can b e thought of as b eing derived fro m π DIL L in the s ame w ay as SLL is obtained from LL . In o ther words, the op erator ! behaves in π DSL L in the sa me wa y as in SL L . The main res ult we prov e ab out π DSLL is prec is ely ab out bo unded in terac tio n: whenever P ca n be typed in π DSLL and P → n Q , then b o th n a nd | Q | (the size of the pr o cess Q , to b e defined later) ar e poly nomially related to | P | . This ensures an a bs tract but quite strong form of bo unded in teractio n. Another, p erha ps more “interactiv e” formulation of the same result is the fo llowing: if P and Q interact via a channel o f type A , then the “ complexity” of this interaction is bo unded by a p olynomial on | P | + | Q | , whos e degree o nly depe nds o n A . The pr o of o f b o unded interaction for π DSLL is structurally similar to the one o f po lynomial time soundness for SL L , but there a re a few p eculiarities which makes the argument more complicated (see Section 5 for mo re details). W e see this pap er as the first successful attempt to bring techniques from implicit co mputa- tional complexity into the realm of s e ssion t yp es. Although pr oving bo unded int era ction has b een techn ica lly nontrivial, due to the p eculiarities of the π -ca lculus, we think the main contribution of this work lies in showing that b ounded termination can be enforced by a natural adaptation o f known systems o f session types. 2 An Informal Accoun t on π DI LL In this sectio n, we will outline the main prop erties of π D ILL , a session type system recently int ro duced by Cair e s and Pfenning [1, 2]. F or more informa tion, please consult the t wo cited pap ers. In π DILL , sessio n types a r e nothing more than fo r mulas of (prop ositional) intuitionistic line a r logic without a toms but with (multiplicativ e) constants: A ::= 1 | A ⊗ A | A ⊸ A | A ⊕ A | A & A | ! A. These types are assig ned to channels (names ) by a for mal system der iving judgments in the form Γ; ∆ ⊢ P :: x : A, where Γ and ∆ are contexts assig ning types to channels, and P is a pro c e ss of the name-pa ssing π -calculus. The judgment ab ov e can be read as follows: the pr o cess P a cts on the channel x according to the sessio n type A whenever comp ose d with pro cesses be having according to Γ and ∆ (eac h on a s pe c ific c hannel). Inf or mally , the v ario us constructions on sessio n t yp es can b e explained as follows: • 1 is the type o f an empty sessio n c hannel. A pro c e ss offering to communicate v ia a session channel t yp ed this way simply synchronizes with another pro c e s s thr o ugh it without exchanging anything. This is meant to be an abstraction for all ground ses s ion types, e.g. natura l num b ers, lists, etc. In linea r logic, this is the unit for ⊗ . • A ⊗ B is the type of a s ession ch annel x through which a message carrying another c hannel with t yp e A is sent. After per forming this actio n, the underlying pro cess behaves accor ding to B on the same channel x . 2 • A ⊸ B is the adjoint to A ⊗ B : on a channel with this type, a pr o cess comm unicate by first per forming an input and receiv ing a channel with type A , then acting a ccording to B , again on x . • A ⊕ B is the type of a channel on which a pro c ess either sends a s pe cial messag e inl and per forms according to A or sends a sp ecial message inr and p er forms accor ding to B . This corres p o nds to internal choice. • The type A & B ca n be assigned to a channel x on which the underlying pro ces s offer s the po ssibility o f choos ing betw een pro ceeding a ccording to A or to B , b oth on x . So, in a sense, & mo dels externa l choice. • Finally , the type ! A is a ttributed to a channel x only if a pro cess r ep eatedly receive a channel y through x , then b ehaving on y acco rding to A . In o ther words, ! A is the type of a pro ces s which offers to op en new sessio n of t yp e A . The ass ig nments in Γ and ∆ are o f tw o different natures: • An assignment of a type A to a channel x in ∆ sig nals the need by P o f a pro ces s offering a session of type A on the channel x ; for this reason, ∆ is ca lle d the line ar c ontext ; • An as signment of a t yp e A to a c hannel x in Γ, on the other ha nd, represents the need by P of a pro cess offering a session of type ! A on the c hannel x ; th us, Γ is the exp onential c ontext . Typing rules π DILL are very similar to the ones of DILL , itself one o f the many p oss ible formulations of linear logic as a sequent calculus. In particular, there are tw o cut rules, each corre sp o nding to a different p or tion of the cont ext: Γ; ∆ 1 ⊢ P :: x : A Γ; ∆ 2 , x : A ⊢ Q :: T Γ; ∆ 1 , ∆ 2 ⊢ ( ν x )( P | Q ) :: T Γ; ∅ ⊢ P :: y : A Γ , x : A ; ∆ ⊢ Q :: T Γ; ∆ ⊢ ( ν x )(! x ( y ) .P | Q ) :: T Please observe how cutting a pro cess P ag ainst an a ssumption in the exp o nential context requires to “wrap” P ins ide a replicated input: this allows to turn P int o a server . In or de r to illustrate the intuitions a bove, we now give an example. Suppose that a pro cess P mo dels a s ervice which acts on x as follows: it receives tw o natural num b er s, to b e interpreted as the num b er and secr et co de of a cr edit car d a nd, if they c orresp o nd to a v alid account, r eturns an MP3 file and a rece ipt co de to the client. O therwise, the session terminates . T o do s o , P needs to interact with a nother ser vice (e.g. a banking service ) Q through a channel y . The ba nking service, a mong o thers, provides a w ay to v er ify whether a given num b er and co de co rresp ond to a v alid credit card. In π DILL , the pr o cess P would receive the type ∅ ; y : ( N ⊸ N ⊸ 1 ⊕ 1 )& A ⊢ P :: x : N ⊸ N ⊸ ( S ⊗ N ) ⊕ 1 , where N and S a re pseudo-types for natura l num b er s and MP 3s, resp ectively . A is the type o f all the other functionalities Q provides. As an example, P could b e the following pro ce s s: x ( nm 1 ) .x ( c d 1 ) .y . inl ; ( ν nm 2 ) y h nm 2 i . ( ν c d 2 ) y h c d 2 i . y . cas e ( x . in l ; ( ν mp ) x h mp i . ( ν rp ) x h rp i , x. inr ; 0) Observe how the credit card num b er and secret co de forwarded to Q are not the o nes sent by the client: the flow of infor mation ha pp ening inside a pro c e ss is abstra cted awa y in π DILL . Similarly , one can write a pro cess Q and assig n it a type as follows: ∅ ; ∅ ⊢ Q :: y : ( N ⊸ N ⊸ 1 ⊕ 1 )& A . Putting the t wo deriv ations together , we obtain ∅ ; ∅ ⊢ ( ν x )( P | Q ) :: x : N ⊸ N ⊸ ( S ⊗ N ) ⊕ 1 . Let us now make an observ a tion whic h will probably b e a ppreciated b y the reader familiar with linear logic. The pro cesses P and Q can be typed in π DIL L without the use of any exp onential rule, nor of cut. What allows to t yp e the par allel comp osition ( ν x )( P | Q ), on the o ther hand, is precisely the cut rule. The interaction b etw een P and Q corresp onds to the elimination of that cut. Since there isn’t any expo nent ial around, this pr o cess must be finite, since the size of the underlying pro cess shr inks at every s ingle r eduction step. F rom a pr o cess-a lg ebraic point of view, on the other hand, the finiteness of the interaction is an immedia te consequence of the absence o f any replicatio n in P and Q . 3 The banking ser vice Q can only serve one single sessio n and would v anish a t the end o f it. T o make it into a p ersistent server offering the same kind o f session to po ssibly many differen t clients, Q must b e put into a replica tion, o btaining R =! z ( y ) .Q . In R , the channel z can b e given t yp e !(( N ⊸ N ⊸ 1 ⊕ 1 )& A ) in the empty context. The pro cess P should b e somehow adapted to b e able to interact with R : befo r e per forming the tw o outputs on y , it’s neces sary to “spawn” R by per forming an o utput on z a nd passing y to it. This way we obtain a pr o cess S such that ∅ ; z :!(( N ⊸ N ⊸ 1 ⊕ 1 )& A ) ⊢ S :: x : N ⊸ N ⊸ ( S ⊗ N ) ⊕ 1 , and the comp o sition ( ν z )( S | R ) ca n be g iven the sa me t yp e as ( ν x )( P | Q ). Of c ourse, S could hav e used the c hannel z more than once, initiating distinct sessions. This is mean t to mo de l a situation in which the sa me c lie n t interacts with the same s e rver b y cr eating more than one session with the same type , itse lf do ne by p erforming m or e than one output o n the same channel. Of course, ser vers can themselves dep end o n other servers. And these dep endencies are naturally mo deled by the expo nential mo dality of linear logic. 3 On Bounded Int eraction In π DILL , the p oss ibilit y of mo deling p ersistent servers which in turn dep end on other servers makes it p os sible to type pro ce sses which ex hibit a very co mplex and combinatorially heavy interactive behavior. Consider the following pro cesses , the fir st one para meter ized o n a natural num b er i ∈ N : dupser i . = ! x i ( y ) . ( ν z ) x i +1 h z i . ( ν w ) x i +1 h w i . ; dup client . = ( ν y ) x 0 h y i ; ser . =! x ( y ) . 0 In π DI LL , these pro cesse s can b e t yp ed as follows: ∅ ; x i +1 :! 1 ⊢ dupser i :: x i :! 1 ; ∅ ; x 0 :! 1 ⊢ dup client :: z : 1 ; ∅ ; ∅ ⊢ s er :: x :! 1 . Then, for every n ∈ N o ne can type the parallel co mpo sition mulser n +1 . = ( ν x 1 . . . x n )( dupser n || . . . || dupser 0 ) as follows ∅ ; x n :! 1 ⊢ mu lser n :: x 0 :! 1 . Informally , mulser n is a per sistent se r ver which offers a session t yp e 1 on a channel x 0 , provided a ser ver with the same functionality is av ailable on x n . The pro ce ss mu lser n is the paralle l comp osition o f n s ervers in the form dupser i , each s pawning tw o different sess ions provided by dupser i +1 on the same channel x i +1 . The pro cess mulser n cannot be further reduced. But notice that, once ser , mulser n and dup client are co mpo sed, the following exp o ne ntial blowup is b o und to happ en: ( ν x 0 )( ser | mulser n | dup client ) ≡ ( ν x 0 . . . x n )( ser | dupser n || . . . || dupser 0 | dup client ) → ( ν x 0 . . . x n )( ser | dupser n || . . . || dupser 1 | P 1 ) → 2 ( ν x 1 . . . x n )( ser | dupser n || . . . || dupser 2 | P 2 | P 2 ) → 4 ( ν x 2 . . . x n )( ser | dupser n || . . . || dupser 3 | P 3 || . . . || P 3 | {z } 4 times ) → ∗ ( ν x n )( ser | dupser n | P n || . . . || P n | {z } 2 n times ) → 2 n 0 . 4 Here, for every i ∈ N the pro ces s P i is s imply ( ν y ) x i h y i . ( ν z ) x i h z i . Notice that b oth the num b er or reduction steps and the size of intermediate pro cesses are exp onential in n , while the size of the initial pro ces s is linear in n . This is a p erfectly legal pro ces s in π DIL L . Mo reov er the type ! 1 of the channel x 0 through w hich dup client and mulser n communicate do es not contain a ny informa tion ab out the “complexity” of the interaction: it is the sa me for every n . The deep reas ons why this phenomenon can happen lie in the very general (and “gener ous”) rules governing the behavior of the exp onential mo dality ! in linear lo gic. It is this generality that allows the embedding of prop os itio nal intuitionistic logic into linear logic. Since the c omplexity of normalizatio n for the former [12 , 10] is nonele men tar y , the exp onential blowup describ ed ab ov e is not a sur prise. It would b e desir able, on the o ther hand, to b e s ure that the interaction caused b y any pro cess P is b o unded: whenev er P → n Q , then there’s a r e asonably low upper b ound to bo th n a nd | Q | . This is prec isely what we achiev e by restricting π D ILL into π DSL L . 4 π DS LL : Syn tax and Main Prop erties In this section, the syntax of π DSL L will b e introduced. Mo reov er, some basic op erationa l prop erties will b e s ta ted a nd proved. 4.1 The Pro cess Algebra π DSLL is a t yp e sys tem for a fair ly standard π -ca lculus, exactly the one on top of which π DIL L is defined: Definition 1 (Pro cess es) Given an infinite set of na mes or channels x, y , z , . . . , t he set of pro- cesses is define d as fol lows: P ::= 0 | P | Q | ( ν x ) P | x ( y ) .P | x h y i .P | ! x ( y ) .P | x. inl ; P | x. inr ; P | x. case ( P , Q ) The only non- standard constructs are the la st three, whic h allow to define a c hoice mechanism: the pro cess x. case ( P , Q ) can evolv e as P or as Q after having r eceived a signal in the form inl o inr throug h x . Pro cesse s sending such a signal through the c hannel x , then contin uing like P are, res pe c tively , x. inl ; P and x. inr ; P . The set of names o c curring free in the pro ce ss P (hereb y denoted fn ( P )) is defined as usual. The same holds for the capture av oiding substitution of a name x for y in a pro cess P (denoted P { x/y } ), and for α -equiv alence b etw een pro cess es (deno ted ≡ α ). Structural congr uence is an equiv alence relation identifying those pro cesses which are syn tac- tically different but can b e considered eq ual for very simple structural r easons: Definition 2 (Structural Co ngruence) The r elation ≡ , c al le d str uctural co ngruence , is the le ast c ongruenc e on pr o c esses satisfying t he fol lowing seven axioms: P ≡ Q whenever P ≡ α Q ; ( ν x )0 ≡ 0; P | 0 ≡ P ; ( ν x )( ν y ) P ≡ ( ν y )( ν x ) P ; P | Q ≡ Q | P ; (( ν x ) P ) | Q ≡ ( ν x )( P | Q ) whenever x / ∈ fn ( Q ); P | ( Q | R ) ≡ ( P | Q ) | R. F o r mal sy s tems for reduction and la be lle d s e mantics can b e defined in a standard wa y . W e refer the reader to [1] for more details. A quantit ative a ttr ibute of pro cesses whic h is delica te to mo del in pro cess alg ebras is their size : how can we measure the size of a pro cess? In particular , it is not stra ightf or ward to define a measure which b oth reflects the “ n umber of s ymbols” in the pro cess and is in v ariant under structural cong ruence (this wa y facilitating a ll pro ofs). A go o d co mpromise is the following: 5 Definition 3 (Pro cess Si ze) The size | P | of a pr o c ess P is define d by induction on the structure of P as fol lows: | 0 | = 0; | x ( y ) .P | = | P | + 1; | x. inl ; P | = | P | + 1; | P | Q | = | P | + | Q | ; | x h y i .P | = | P | + 1; | x. inr ; P | = | P | + 1; | ( ν x ) P | = | P | ; | ! x ( y ) .P | = | P | + 1; | x. case ( P, Q ) | = | P | + | Q | + 1 . According to the definition above, the empty pro cess 0 has null size, while r estriction do es no t increase the size of the underlying pro cess. This allo ws for a definition of size whic h remains inv a riant under structural cong ruence. The price to pay is the fo llowing: the “num b er of symbols ” of a pr o cess P can be arbitr arily big ger than | P | (e.g. for every n ∈ N , | ( ν x ) n P | = | P | ). How e ver, we hav e the following: Lemma 1 F or every P, Q , | P | = | Q | whenever P ≡ Q . Mor e over, ther e is a p olynomial p : N → N such that for every P , t her e is Q with P ≡ Q and the num b er of symb ols in Q is at most p ( | Q | ) . Pro of. The fact P ≡ Q implies | P | = | Q | can b e proved by a simple insp ection of Definition 1 . The second part o f the lemma c a n b e prov ed by induction on P once the p olyno mial p is fixed a s p ( x ) = x 2 . ✷ 4.2 The T yp e System The language of types of π D SLL is exactly the same a s the one of π DILL , a nd the interpretation of t yp e cons tructs do es not change (see Section 2 for s o me infor ma l details). T yping judgments and t yping rules, how ever, are significa nt ly different, in particular, in the tr eatment of the exp onential connective !. More sp ecifically , π DILL allows to give type to the following pro ces ses: • F or every t yp e A , there is a pro ces s D ER A such that ∅ ; x :! A ⊢ DER A :: y : A . As an ex ample, DER 1 is ( ν z ) x h z i . Intuitiv ely , DER A is a pro ces s op ening a new s ession of type A b y calling a server of type ! A . • F or every t yp e A , there is a pr o cess CONT A such that ∅ ; x :! A ⊢ CONT A :: y :! A ⊗ ! A . Int uitively , CONT A is a pro cess offering firs t a sessio n o f type ! A a nd then pro ceeding as ! A along the channel y . All this with the need o f only a server of type ! A fro m x . As an exa mple, CONT 1 is ( ν w ) ( s h w i . ((! w ( y ) . ( ν z ) x h z i ) | (! s ( y ) . ( ν z ) x h z i ))) . • F or every type A , there is also a pro cess DIG A such that ∅ ; x :! A ⊢ DIG A :: y :!! A , whic h turns a server into a server of servers. The r eader is invited to define DIG 1 as an exer c ise. As we will see at the end of this section, o nly DER A can b e given a type in π DSLL , while CONT A and DIG A cannot. In π DSLL , typing judgments b ecome s y nt actica l expressio ns in the for m Γ; ∆; Θ ⊢ P :: x : A. First of all, obse r ve how the context is divided into thr e e ch unks now: Γ and ∆ hav e to b e inter- preted as exp onential cont exts, while Θ is the usua l linear context from π DIL L . The necessity of having two exp o nential con texts is a cons e quence of the finer, less canonical expo nential discipline of SL L compared to the one of LL . W e use the following terminolog y: Γ is said to be the aux iliary context, while ∆ is the multiplexor con text. Typing r ule s are in Figure 1. The rules gov erning the typing constant 1 , the m ultiplicatives ( ⊗ and ⊸ ) and the a dditives ( ⊕ a nd &) are exact analo g ues o f the ones fro m π DILL . The only differences come from the presence of tw o exp onential contexts: in binary multiplicativ e rules ( ⊗ R and ⊸ L ) the auxiliar y context is treated multiplicativ ely , while the multiplexor context is treated 6 Γ; ∆; Θ ⊢ P :: T Γ; ∆; Θ , x : 1 ⊢ P :: T 1 L Γ; ∆; ∅ ⊢ 0 :: x : 1 1 R Γ; ∆; Θ , y : A, x : B ⊢ P :: T Γ; ∆; Θ , x : A ⊗ B ⊢ x ( y ) .P :: T ⊗ L Γ 1 ; ∆; Θ 1 ⊢ P :: y : A Γ 2 ; ∆; Θ 2 ⊢ Q :: x : B Γ 1 , Γ 2 ; ∆; Θ 1 , Θ 2 ⊢ ( ν y ) x h y i . ( P | Q ) :: x : A ⊗ B ⊗ R Γ 1 ; ∆; Θ 1 , y : A ⊢ P :: T Γ 2 ; ∆; Θ 2 , x : B ⊢ Q :: T Γ 1 , Γ 2 ; ∆; Θ 1 , Θ 2 , x : A ⊸ B ⊢ ( ν y ) x h y i . ( P | Q ) :: T ⊸ L Γ; ∆; Θ , y : A ⊢ P :: x : B Γ; ∆; Θ ⊢ x ( y ) .P :: x : A ⊸ B ⊸ R Γ; ∆; Θ , x : A ⊢ P :: T Γ; ∆; Θ , x : B ⊢ P :: T Γ; ∆; x : A ⊕ B , Θ ⊢ y . cas e ( P, Q ) :: T ⊕ L Γ; ∆; Θ ⊢ P :: x : A Γ; ∆; Θ ⊢ x. inl ; P :: x : A ⊕ B ⊕ R 1 Γ; ∆; Θ ⊢ P :: x : B Γ; ∆; Θ ⊢ x. inr ; P :: x : A ⊕ B ⊕ R 2 Γ; ∆; Θ , x : A ⊢ P :: T Γ; ∆; Θ , x : A & B ⊢ x. inl ; P :: T & L 1 Γ; ∆; Θ , x : B ⊢ P :: T Γ; ∆; Θ , x : A & B ⊢ x. inr ; P :: T & L 2 Γ; ∆; Θ ⊢ P :: x : A Γ; ∆; Θ ⊢ P :: x : B Γ; ∆; Θ ⊢ y . case ( P, Q ) :: x : A & B & R Γ; ∆ , x : A ; Θ , y : A ⊢ P :: T Γ; ∆ , x : A ; Θ ⊢ ( ν y ) x h y i .P :: T ♭ # Γ; ∆; Θ , y : A ⊢ P :: T Γ , x : A ; ∆; Θ ⊢ ( ν y ) x h y i .P :: T ♭ ! Γ; ∆ , x : A ; Θ ⊢ P :: T Γ; ∆; Θ , x :! A ⊢ P :: T ! L # Γ , x : A ; ∆; Θ ⊢ P :: T Γ; ∆; Θ , x :! A ⊢ P :: T ! L ! Γ; ∅ ; ∅ ⊢ Q :: y : A ∅ ; ∆; !Γ ⊢ ! x ( y ) .Q :: x :! A ! R Γ 1 ; ∆; Θ 1 ⊢ P :: x : A Γ 2 ; ∆; Θ 2 , x : A ⊢ Q :: T Γ 1 , Γ 2 ; ∆; Θ 1 , Θ 2 ⊢ ( ν x )( P | Q ) :: T cut ∆; ∅ ; ∅ ⊢ P :: y : A Γ; ∆ , x : A ; Θ ⊢ Q :: T Γ; ∆; Θ ⊢ ( ν x )(! x ( y ) .P | Q ) :: T cut # Γ 1 ; ∅ ; ∅ ⊢ P :: y : A Γ 2 , x : A ; ∆; Θ ⊢ Q :: T Γ 1 , Γ 2 ; ∆; Θ ⊢ ( ν x )(! x ( y ) .P | Q ) :: T cut ! Figure 1: T yping rules for π DSLL . 7 additively , as in π DI LL 1 . Now, co nsider the rules gov erning the e x po nential connective !, which are ♭ ! , ♭ # , ! L ! , ! L # and ! R : • The rules ♭ ! and ♭ # bo th a llow to spawn a ser ver. This co rresp onds to turning an ass umption x : A in the linear context in to one y : A in one of the exp onential contexts; in ♭ # , x : A could be already prese nt in the m ultiplexor context, while in ♭ ! this cannot happ en; • The rules ! L ! and ! L # lift a n assumption in the exp onential contexts to the linear context; this requires changing its t yp e fr om A to ! A ; • The rule ! R allows to turn an or dinary pro cess into a server, by pack aging it int o a r e plicated input and mo difying its type. Finally there a re thr e e cut rules in the system, namely cut , cut ! and cut # : • cut is the usual linear cut r ule, i.e. the natur a l generaliz a tion of the one from π DI LL . • cut ! and cu t # allow to eliminate an assumption in one of the the tw o ex po nent ial contexts. In b oth ca ses, the pro cess which a llows to do that m ust b e t y pable with empt y linear and m ultiplexor contexts. Observe how b oth CONT A and DIG A are not typable in π DSLL . T ake, as an example, CONT 1 : the tw o o ccurr ences o f x ar e in the sc op e of a r eplicated input, and this pattern is not allowed in the restricted setting of soft linear logic. On the other hand, DER A is indeed t ypable. Actually , a genera liz ation o f it called MUL T n A (where n ≥ 0) can b e typed as follows ∅ ; ∅ ; x :! A ⊢ MUL T n A :: y : A ⊗ . . . ⊗ A | {z } n + 2 times . F o r example, MUL T 2 1 is the following pro cess: ( ν x ) y h x i . ( ν x 1 ) y h x 1 i . ( ν x 2 ) y h x 2 i . 4.3 Bac k to Our Example Let us now reco nsider the example pro cesses introduced in Sectio n 3. The basic building blo ck ov er whic h everything is built was the proc ess dupser i =! x i ( y ) . ( ν z ) x i +1 h z i . ( ν w ) x i +1 h w i . . W e claim that for every i , the pro ces s dupser i is not t ypable in π DSL L . T o understand wh y , observe that the only way to type a r e plic a ted input like dupser i is by the typing rule ! R , and that its premise requires the bo dy of the replicated input to b e typable with empty line a r and multiplexor contexts. A quick insp ection on the typing rules reveals that every name in the aux iliary cont ext o ccurs (free ) exactly once in the underlying pro cess (provided we count t wo o ccurrences in the branches of a cas e as just a single o ccur rence). How ever, the na me x i +1 app ears twic e in the bo dy of dupser i . A slight v ariation on the example ab ove, o n the other hand, c an b e t yp ed in π DSLL , but this requires changing its type. 4.4 Sub ject Reduction A basic prop erty most type sys tems for functional langua ges s atisfy is sub ject reduction: typing is preser ved along r eduction. F or pro cesses , this is o ften true for internal r eduction: if P → Q and ⊢ P : A , then ⊢ Q : A . In this section, a sub ject reduction result for π DSL L will be given and some ide a s o n the underlying pro of will be describ ed. Some co ncepts outlined here will b ecome necessary ingredients in the pro o f o f b o unded interaction, to b e done in Section 5 b elow. Sub ject reduction is proved by closely following the pa th tra ced by Caires a nd Pfenning; as a cons equence, we pro ceed quite quickly , concentrating our a ttent ion on the differences with their pro o f. When proving sub ject reduction, o ne constantly w or k with t yp e deriv ations . This is partic- ularly true here, where (internal) r eduction corr esp onds to the cut-elimination pr o cess. A linear 1 The reader familiar with linear logic and pro of nets wi ll r ecognize in the different treatmen t of the auxiliary and multiplexor context s, one of the basic pri ncipl es of SLL : c ontr action is forbidd en on the auxiliary do ors of exp onenti al b oxes . The c hannel names conta ined in the auxiliary con text corresp ond to the auxiliary doors of exponent ial b oxes, so we treat them multiplicativ ely . The cont raction effect induced by the additiv e tr eatmen t of the channel names in the multiplexor conte xt corr esponds to the multiplexing r ul e of SLL . 8 1 L ( x, D ) b D z 1 R 0 ⊗ L ( x, y .z . E ) x ( y ) . b E z ⊗ R ( D , E ) ( ν y ) x h y i . ( b D y | b E x ) ⊸ L ( x, D , y. E ) ( ν y ) x h y i . ( b D y | b E z ) ⊸ R ( x. D ) x ( y ) . b E x cut ( D , x. E ) ( ν x )( b D x | b E z ) cut ! ( D , x. E ) ( ν x )(! x ( y ) . b D y | b E z ) cut # ( D , x. E ) ( ν x )(! x ( y ) . b D y | b E z ) ♭ ! ( x, y . E ) ( ν y ) x h y i . b E z ♭ # ( x, y . E ) ( ν y ) x h y i . b E z ! R ( D , x 1 , . . . , x n ) ! x ( y ) . b D y ! L ! ( x. D ) b D z ! L # ( x. D ) b D z ⊕ L ( x, y . D , z . E ) y . cas e ( b D x , b E z ) ⊕ R 1 ( D ) x. inl ; b D x ⊕ R 2 ( D ) y . inr ; b D y & L 1 ( x, y . E ) x. inl ; b D z & L 2 ( x, y . D ) y . inr ; b D z & R ( D , E ) z . case ( b D z , b E z ) Figure 2: Extraction of pro cesses from pro of ter ms . notation for pro ofs in the fo rm of pr o of t erms can be eas ily defined, allowing for more compact descriptions. As a n e x ample, a pro o f in the form π : Γ 1 ; ∆; Θ 1 ⊢ P :: x : A ρ : Γ 2 ; ∆; Θ 2 , x : A ⊢ Q :: T Γ 1 , Γ 2 ; ∆; Θ 1 , Θ 2 ⊢ ( ν x )( P | Q ) :: T cut corres p o nds to the pr o of ter m cut ( D , x. E ), where D is the pro o f term for π and E is the pro o f term for ρ . If D is a pr o of ter m corresp onding to a t yp e deriv ation for the pro cess P , w e write b D = P . F r om now on, pr o of terms will often take the place of pro cesses: Γ; ∆; Θ ⊢ D :: T stands for the existence o f a type der iv atio n D with conclus ion Γ; ∆; Θ ⊢ b D :: T . The notation Γ; ∆; Θ ⊢ D P :: T stands for the ex istence of a t yp e deriv a tion D s uch that Γ; ∆; Θ ⊢ D :: T and b D = P . A pro of term D is said to be nor mal if it do es not contain any instance s of cut rules. In Figure 2 we show in detail how pro cesses ar e asso cia ted with pro of terms. Sub ject reduction will be proved b y s howing that if P is typable b y a t yp e deriv a tio n D and P → Q , then a t yp e deriv ation E for Q exists. Actually , E can be obtained by manipulating D us ing techniques der ived fr om cut-eliminatio n. Noticeably , not ev ery cut-elimination rule is necessary to prove sub ject reduction. In other words, we a re in presence of a weak corres po ndence betw een pro of terms and pro cess e s, and remain fa r from a ge nuine Curry- How ard corresp ondence. Those manipulations of pro o f-terms which are nece s sary to prov e sub ject reduction can be classified as follows: • First of all, a binary relatio n = ⇒ on pro of terms called c omputational r e duct ion can be defined. A t the logical level, this cor resp onds to prop er cut-elimination steps, i.e. those cut-elimination steps in which tw o rules intro ducing the sa me c onnective interact. At the pro cess level, com- putational reduction co rresp ond to in ternal reductio n. = ⇒ is not symmetric. Computational reduction rules are g iven in Figure 3. W e str ess that Lemma 3 b elow is needed in order to prop erly define so me cases of computatio nal reduction. • A binar y relation 7− → on pro of terms called shift r e duction , distinct fro m = ⇒ , must b e in tro - 9 ( cut / ⊗ R / ⊗ L ) : cut (( ⊗ R ( D , E )) , x. ⊗ L ( x, y .x. F )) = ⇒ cut ( D , y . cut ( E , x. F )) ( cut / ⊸ L / ⊸ R ) : cut ( ⊸ R ( y . D ) , x. ⊸ L ( x, E , x. F )) = ⇒ cut ( cut ( E , y . D ) , x. F ) ( cut / & R / & L 1 ) : cut (& R ( D , E ) , x. & L 1 ( x, y . F )) = ⇒ c ut ( D , x. F ) ( cut / & R / & L 2 ) : cut (& R ( D , E ) , x. & L 2 ( x, y . F )) = ⇒ c ut ( E , x. F ) ( cut / ⊕ R 1 / ⊕ L ) : cut ( ⊕ R 1 ( D ) , x. ⊕ L ( x, y . E , z . F )) = ⇒ cut ( D , x. E ) ( cut / ⊕ R 2 / ⊕ L ) : cut ( ⊕ R 2 ( D ) , x. ⊕ L ( x, y . E , z . F )) = ⇒ cut ( D , x. F ) ( cut ! / − /♭ ! ) : cut ! ( D , x.♭ ! ( x, y . E )) = ⇒ cut ( D ⇓ , y . cut # ( D , x. E ⇓ )) ( cut # / − /♭ # ) : cut # ( D , x.♭ # ( x, y . E )) = ⇒ cut ( D ⇓ , y . cut # ( D , x. E )) Figure 3: Computational r eduction rules ( cut / ! R / ! L ! ) : cut (! R ( D , x 1 , . . . , x n ) , x. ! L ! ( x. E )) 7− → ! L ! ( x 1 . ! L ! ( x 2 . . . . ! L ! ( x n . cut # ( D , y . E )) . . . )) ( cut / ! R / ! L # ) : cut (! R ( D , x 1 , . . . , x n ) , x. ! L # ( x. E )) 7− → ! L ! ( x 1 . ! L ! ( x 2 . . . . ! L ! ( x n . cut # ( D , y . E )) . . . )) Figure 4: Shift r eduction rules duced. A t the pro ce s s level, it corres po nds to structural congr ue nc e . As = ⇒ , 7− → is not a symmetric relatio n. Shift reduction rules ar e given in Figure 4. • Finally , an equiv alence relation ≡ on pro of terms called pr o of e quivalenc e is necessar y . At the logical level, this co rresp onds to the so-called commuting conv ersions, while at the pro cess level, the induced pro cesse s ar e either structurally congruent or strongly bisimilar. Equiv alence rules are given in Figure 5. The reflexive and tra nsitive closur e of 7− → ∪ ≡ is denoted with ֒ → , i.e. ֒ → = ( 7− → ∪ ≡ ) ∗ . T o help the reader unders ta nd the rules defining = ⇒ , 7− → and ≡ , let us give some relev ant examples: • Let us consider the pro of term D = cut (( ⊗ R ( F , G )) , x. ⊗ L ( x, y .x. H )) which cor r esp onds to the ⊗ -case of cut elimination. B y a c omputational reduction rule, D = ⇒ E = cut ( F , y . c ut ( G , x. H )). F r o m the pro ces s side, b D = ( ν x )((( ν y ) x h y i . ( b F | b G )) | x ( y ) . b H ) and b E = ( ν x )( ν y )(( b F | b G ) | b H ), where b E is the pro cess obtained from b D by internal passing the channel y throug h the channel x . • Let D = cut (! R ( F , x 1 , . . . , x n ) , x. ! L ! ( x. G )) be the pro of obtained by comp osing a pro of F (whose last rule is ! R ) with a pro of G (whose la st rule is ! L ! ) thro ug h a cut rule. A shift r eduction rule tells us that D 7− → E = ! L ! ( x 1 . ! L ! ( x 2 . . . . ! L ! ( x n . cut ! ( F , y . G )) . . . )), which corresp o nds to the op ening of a box in S LL . The shift reduction do es not have a cor resp onding reduction step at pro cess level, since b D ≡ b E ; nevertheless, it is defined a s an asymmetric rela tion, for technical reasons connected to the pro of of b o unded int er a ction. • Let D = cut # ( F , x. cut ( G , y. H )). A defining rule for pro of equiv alence ≡ , s tates that in D the cut # rule can be p ermuted over the cu t rule, by duplicating F ; namely D ≡ E = cut ( cut # ( F , x. G ) , y . cu t # ( F , x. H )). This is po ssible beca us e the channel x b elongs to the m ul- tiplexor co nt exts of bo th G , H , such cont exts b eing treated additively . At the pr o cess level, b D = ( ν x )((! x ( y ) . b F ) | ( ν y )( b G | b H )) , while b E = ( ν y )((( ν x )(! x ( y ) . b F ) | b G )) | (( ν x )(! x ( y ) . b F ) | b H ))), b D and b E b eing str ongly bisimilar. The rest o f this section is dev oted to pr oving the following result: Theorem 1 (Sub ject Reduction) L et Γ; ∆; Θ ⊢ D :: T . Supp ose that b D = P → Q . Then ther e is E such that b E = Q , D ֒ → = ⇒ ֒ → E and Φ; Ψ ; Θ ⊢ E :: T , wher e Γ , ∆ = Φ , Ψ . The str ucture of the pro of o f Theor em 1 is divided into three steps, each of them consisting in o ne or more auxilia r y results: 1. First, given a pro ces s P and a t yping deriv atio n D of P , we establish a connection b etw een t yping and lab elled semantics, showing that the visible actions of P behav e acco rding to the t yp es a ssigned to the channels in P by D (Lemma 4). 2. Second, we take t wo pro cesses P and Q communicating with each other on the same channel 10 Structural Con v ersions ( cut / − / cu t 1 ) : cut ( D , x. cut ( E x , y . F y )) ≡ cu t ( cut ( D , x. E x ) , y . F y ) ( cut / − / cu t 2 ) : cut ( D , x. cut ( E , y . F xy )) ≡ cu t ( E , x. cut ( D , y. F xy )) ( cut / − / cu t ! ) : cut ( D , x. cut ! ( E , y . F xy )) ≡ cu t ! ( E , y . cut ( D , x. F xy )) ( cut / cut ! / − ) : c ut ( cut ! ( D , y . E y ) , x. F x ) ≡ cut ! ( D , y . c ut ( E y , x. F x )) ( cut / − / cu t # ) : cut ( D , x. cut # ( E , y . F xy )) ≡ cu t # ( E , y . cut ( D , x. F xy )) ( cut / cut # / − ) : cut ( cut # ( D , y . E y ) , x. F x ) ≡ cut # ( D , y . c ut ( E y , x. F x )) ( cut / 1 R / 1 L ) : cut ( 1 R , x. 1 L ( x, D )) ≡ D Strong Bisimi larities ( cut # / − / cu t ) : cut # ( D , x. cut ( E x , y . F xy )) ≡ cu t ( cut # ( D , x. E x ) , y . c ut # ( D , x. F xy )) ( cut # / − / cu t # ) : cut # ( D , x. cut # ( E x , y . F xy )) ≡ cu t # ( D , x. cut # ( E x , y . cut # ( D , x. F xy ))) ( cut # / − / cu t ! ) : cut # ( D , x. cut ! ( E x , y . F xy )) ≡ cu t ! ( E x , y . cut # ( D , x. F xy )) ( cut ! / − / cu t 1 ) : cut ! ( D , x. cut ( E x , y . F y )) ≡ cu t ( cut ! ( D , x. E x ) , y . F y ) ( cut ! / − / cu t 2 ) : cut ! ( D , x. cut ( E , y. F xy )) ≡ cu t ( E , y . cut ! ( D , x. F xy )) ( cut ! / − / cu t ! ) 1 : cut ! ( D , x. cut ! ( E x , y . F y )) ≡ cu t ! ( cut ! ( D , x. E x ) , y . F y ) ( cut ! / − / cu t ! ) 2 : c ut ! ( D , x. cut ! ( E , y . F xy )) ≡ cu t ! ( E , x. cut ! ( D , y . F xy )) ( cut ! / − / cu t # ) : cut ! ( D , x. cut # ( E x , y . F xy )) ≡ cu t # ( E x , y . cut ! ( D , x. F xy )) ( cut # / − / cu t # ) 0 : cut # ( D , x. cut # ( E x , y . F xy )) ≡ cu t # ( E x , y . cut # ( D , x. F xy )) (if y / ∈ F V ( b F )) ( cut # / − / − 0 ) : cut # ( D , x. E ) ≡ E (if x / ∈ F N ( b E )) Commuting Co n v ersio n s ( cut / − / 1 L ) : cut ( D , x. 1 L ( y , E x )) ≡ 1 L ( y , c ut ( D , x. E x )) ( cut / − / ! L ! ) : cut ( D , x. ! L ! ( y . E xz )) ≡ ! L ! ( y . cut ( D , x. E xz )) ( cut / − / ! L # ) : cut ( D , x. ! L # ( y . E xz )) ≡ ! L # ( y . cut ( D , x. E xz )) ( cut / 1 L / − ) : cut ( 1 L ( y , D ) , x. E x ) ≡ 1 L ( y , cut ( D , x. E x )) ( cut / ! L ! / − ) : cut (! L ! ( y . D z ) , x. E x ) ≡ ! L ! ( y . cut ( D z , x. E xz )) ( cut / ! L # / − ) : cut (! L # ( y . D z ) , x. E x ) ≡ ! L # ( y . cut ( D z , x. E xz )) ( cut ! / − / 1 L ) : cut ! ( D , x. 1 L ( y , E x )) ≡ 1 L ( y , c ut ! ( D , x. E x )) ( cut ! / − / ! L ! ) : c ut ! ( D , x. ! L ! ( y . E xz )) ≡ ! L ! ( y . cut ! ( D , x. E xz )) ( cut ! / − / ! L # ) : cut ! ( D , x. ! L # ( y . E xz )) ≡ ! L # ( y . cut ! ( D , x. E xz )) ( cut # / − / 1 L ) : cut # ( D , x. 1 L ( y , E x )) ≡ 1 L ( y , c ut # ( D , x. E x )) ( cut # / − / ! L ! ) : cut # ( D , x. ! L ! ( y . E xz )) ≡ ! L ! ( y . cut # ( D , x. E xz )) ( cut # / − / ! L # ) : cut # ( D , x. ! L # ( y . E xz )) ≡ ! L # ( y . cut # ( D , x. E xz )) Figure 5: Equiv alence rules 11 x , and the cor resp onding typing der iv ations D , E , resp ectively . F or a ll p ossible t yp e assigne - men t of x , we show that b y compo sing D and E with a cut rule and per forming some pro of manipulation we can obtain a pro of F such that F is a typing deriv ation for the pro cess R obtained by p erforming the communication of P and Q (lemmas 5 , 6, 7, 8, 9, 10, 11). 3. Finally , we show that if a pro cess P is typable by a type deriv ation D and P → Q , then a t yp e deriv a tion E for Q exists. This is done by showing that the int erna l re ductio n which brings from P to Q is a consequence o f the c o mmun icatio n o f tw o subpro cesses of P . This communication can o nly happ en in pr esence of a cut on the corr esp onding pr o of terms, so we conclude using the previous lemmas. The following prop ositio ns state the co rresp ondence s b etw een the pr o of ter ms manipulation rules describ ed ab ov e and r elations ov er pro c esses: we omit the pro ofs, le aving to the reader the verifi- cation of ea ch c a se. Prop ositi o n 1 L et Γ; ∆; Θ ⊢ D :: T and Φ; Ψ; Σ ⊢ E :: S . If D = ⇒ E , t hen b D → b E . Prop ositi o n 2 L et Γ; ∆; Θ ⊢ D :: T and Φ; Ψ; Σ ⊢ E :: S . If D 7− → E , t hen b D is e quivalent to b E mo dulo stru ctur al c ongruenc e. Prop ositi o n 3 L et Γ; ∆; Θ ⊢ D :: T and Φ; Ψ; Σ ⊢ E :: S . If D ≡ E , then b D is e quivalent t o b E mo dulo stru ctur al c ongruenc e or str ong bisimilarity. Before pro c eeding to Sub ject Reduction, we give the following tw o lemmas, co ncerning structur al prop erties of the t yp e s ystem: the first o ne s tates that in a pro of der iv ation the multiplexor context can b e weak ened. The sec o nd says that in a pro o f deriv a tio n a s sumptions in the auxiliar y context can b e “lifted” to the multiplexor context, while the underlying pro ces s stays the same. Lemma 2 (W eak e ning lemm a) If Γ; ∆; Θ ⊢ D :: T and whenever ∆ ⊆ Φ , it holds that Γ; Φ; Θ ⊢ D :: T . Pro of. By a simple induction on the structure of D . ✷ Lemma 3 (Lifting l e mma) If Γ; ∆; Θ ⊢ D :: T then ther e exists an E such that ∅ ; Γ , ∆; Θ ⊢ E :: T wher e b E = b D . We denote E by D ⇓ . Pro of. Again, a simple induction on the structure of the pro of term D . ✷ The following is sort of a ge ne r ation lemma ( s ( α ) denotes the sub ject of the actio n α ): Lemma 4 L et Γ; ∆; Θ ⊢ D P :: x : T . 1. If P α − → Q and T = 1 then s ( α ) 6 = x . 2. If P α − → Q and y : 1 ∈ Θ then s ( α ) 6 = y . 3. If P α − → Q and s ( α ) = x and T = A ⊗ B then α = ( ν y ) x h y i . 4. If P α − → Q and s ( α ) = y and y : A ⊗ B ∈ Θ then α = y ( z ) . 5. If P α − → Q and s ( α ) = x and T = A ⊸ B then α = x ( y ) . 6. If P α − → Q and s ( α ) = y and y : A ⊸ B ∈ Θ then α = ( ν z ) y h z i . 7. If P α − → Q and s ( α ) = x and T = A & B then α = x. inl ; or α = x. inr ; . 8. If P α − → Q and s ( α ) = y and y : A & B ∈ Θ then α = y . inl ; or α = y . inr ; . 9. If P α − → Q and s ( α ) = x and T = A ⊕ B then α = x. inl ; or α = x. inr ; . 10. If P α − → Q and s ( α ) = y and y : A ⊕ B ∈ Θ then α = y . inl ; or α = y . inr ; 11. If P α − → Q and s ( α ) = x and T = ! A then α = x ( y ) . 12. If P α − → Q and s ( α ) = y and y :! A or y ∈ Γ or y ∈ ∆ or y ∈ Φ then α = ( ν z ) y h z i . Pro of. T rivial from definitions. ✷ Crucial to the pro of of the Sub ject Reduction Theo rem is a n analysis of how pro cesses interacting with their en viro nment s p er forming dual action can co mm unicate when comp osed by a cut rule. 12 Lemma 5 Assume that: 1. Γ 1 ; ∆; Θ 1 ⊢ D :: x : A ⊗ B with b D = P ( ν y ) x h y i − − − − − → Q ; 2. Γ 2 ; ∆; Θ 2 , x : A ⊗ B ⊢ E :: z : C with b E = R x ( y ) − − − → S . Then: 1. cut ( D , x. E ) ֒ → = ⇒ ֒ → F for some F ; 2. Γ 1 , Γ 2 ; ∆; Θ 1 , Θ 2 ⊢ F :: z : C , wher e b F ≡ ( ν x )( Q | S ) . Pro of. By simultaneous inductio n on D 1 , D 2 . The pr op erty stated in the lemma holds als o fo r the system π DILL (see [1]); since the pro o f technique is essentially the sa me mo dulo some minor details, we o mit the pro of. ✷ Lemma 6 Assume 1. Γ 1 ; ∆; Θ 1 ⊢ D 1 P 1 :: x : A ⊸ B with P 1 x ( y ) − − − → Q 1 2. Γ 2 ; ∆; Θ 2 , x : A ⊸ B ⊢ D 2 P 2 :: z : C with P 2 ( ν y ) x h y i − − − − − → Q 2 Then 1. cut ( D 1 , x. D 2 ) ֒ → = ⇒ ֒ → D for some D ; 2. Γ 1 , Γ 2 ; ∆; Θ 1 , Θ 2 ⊢ D R :: z : C for some R ≡ ( ν x )( ν y )( Q 1 | Q 2 ) . Pro of. See the pro of of Lemma 5 . ✷ Lemma 7 Assume 1. Γ 1 ; ∆; Θ 1 ⊢ D 1 P 1 :: x :! A with P 1 x ( y ) − − − → Q 1 2. Γ 2 ; ∆; Θ 2 , x :! A ⊢ D 2 P 2 :: z : C wi th P 2 ( ν y ) x h y i − − − − − → Q 2 Then 1. cut ( D 1 , x. D 2 ) ֒ → = ⇒ ֒ → D for some D ; 2. Γ 1 , Γ 2 ; ∆; Θ 1 , Θ 2 ⊢ D R :: z : C for some R ≡ ( ν x )( ν y )( Q 1 | Q 2 ) . Pro of. See the pro of of Lemma 5 . ✷ Lemma 8 Assume 1. Γ 1 ; ∆; Θ 1 ⊢ D 1 P 1 :: x : A & B with P 1 x. inl ; − − − − → Q 1 2. Γ 2 ; ∆; Θ 2 , x : A & B ⊢ D 2 P 2 :: z : C with P 2 x. inl ; − − − − → Q 2 Then 1. cut ( D 1 , x. D 2 ) ֒ → = ⇒ ֒ → D for some D ; 2. Γ 1 , Γ 2 ; ∆; Θ 1 , Θ 2 ⊢ D R :: z : C for some R ≡ ( ν x )( Q 1 | Q 2 ) . Pro of. See the pro of of Lemma 5 . ✷ Lemma 9 Assume 1. Γ 1 ; ∆; Θ 1 ⊢ D 1 P 1 :: x : A ⊕ B with P 1 x. inl ; − − − − → Q 1 . 2. Γ 2 ; ∆; Θ 2 , x : A ⊕ B ⊢ D 2 P 2 :: z : C with P 2 x. inl ; − − − − → Q 2 . Then 1. cut ( D 1 , x. D 2 ) ֒ → = ⇒ ֒ → D for some D ; 2. Γ 1 , Γ 2 ; ∆; Θ 1 , Θ 2 ⊢ D R :: z : C for some R ≡ ( ν x )( Q 1 | Q 2 ) . Pro of. See the pro of of Lemma 5 . ✷ Lemma 10 Assume 1. Γ 1 ; ∅ ; ∅ ⊢ D 1 P 1 :: x : A 2. Γ 2 , x : A ; ∆; Θ ⊢ D 2 P 2 :: z : C with P 2 ( ν y ) x h y i − − − − − → Q 2 Then 1. cut ! ( D 1 , x. D 2 ) ֒ → = ⇒ ֒ → c ut # ( D 1 , x. D ) for some D wher e x / ∈ F V ( b D ) ; 2. Γ; Φ; Θ ⊢ D R :: z : C fo r some R ≡ ( ν y )( P 1 | Q 2 ) , wher e Γ , Φ = Γ 1 , Γ 2 , x : A, ∆ . 13 Pro of. By induction on D 2 . W e have different cases, dep ending fro m the la st rules of D 2 . Let us just write do wn so me r elev a n t cas e : • Suppos e D 2 = ♭ ! ( x, y . E ); then P 2 ≡ ( ν y ) x h y i .Q 2 and Γ 2 , x : A ; ∆; Θ ⊢ E Q 2 :: z : C by inv ersio n. Now cut ! ( D 1 , x.♭ ! ( x, y . E )) = ⇒ cut ( D 1 ⇓ , y . cut # ( D 1 , x. E ⇓ )) by ( cut ! / − /♭ ! ) ≡ cut # ( D 1 , x. cut ( D 1 ⇓ , y . E ⇓ )) by ( cut / − / cut # ). W e pick D = cut ( D 1 ⇓ , y . E ⇓ ); then Γ; Φ; Θ ⊢ D Q 2 :: z : C for some Q 2 ≡ ( ν y )( P 1 | Q 2 ), where Γ , Φ = Γ 1 , Γ 2 , x : A, ∆. • Suppos e D 2 = cut # ( E 1 , y . E 2 ); then ∆; ∅ ; ∅ ⊢ E 1 R 1 :: w : C a nd Γ 2 , x : A ; ∆; Θ ⊢ E 2 R 2 :: z : B with P 2 ( ν y ) x h y i − − − − − → R 1 | R ′ 2 , by inv ersio n. Now by induction h yp othesis, cut ! ( D 1 , x. E 2 ) ֒ → = ⇒ ֒ → cut # ( D 1 , x. F ) for some F (where x / ∈ F V ( b F )), and Γ; Φ; Θ 2 ⊢ F S :: z : B for some S = ( ν y )( P 1 | R ′ 2 ). cut ! ( D 1 , x. cut # ( E 1 , y . E 2 )) ≡ cut # ( E 1 , y . cut ! ( D 1 , x. E 2 )) by ( cut ! / − / cut # ), ֒ → = ⇒ ֒ → c ut # ( E 1 , y . cut # ( D 1 , x. F )) by co ngruence, ≡ cut # ( D 1 , x. cut # ( E 1 , y . F )) by ( cut # / − / cut # ) 0 . Pick D = cut # ( E 1 , y . F ). Then R = ( ν y ) R 1 | S by cut, a nd Γ; Φ; Θ ⊢ D R :: z : C for some R ≡ ( ν y )( P 1 | Q 2 ). This concludes the pro of. ✷ Corollary 1 Assume 1. Γ 1 ; ∅ ; ∅ ⊢ D 1 P 1 :: x : A 2. Γ 2 , x : A ; ∆; Θ ⊢ D 2 P 2 :: z : C with P 2 ( ν y ) x h y i − − − − − → Q 2 Then 1. cut ! ( D 1 , x. D 2 ) ֒ → = ⇒ ֒ → D for some D ; 2. Γ; Φ; Θ ⊢ D R :: z : C for some R ≡ ( ν x )(! x ( y ) .P 1 | ( ν y )( P 1 | Q 2 )) , wher e Γ , Φ = Γ 1 , Γ 2 , ∆ Pro of. F ollows from Lemma 1 0. ✷ Lemma 11 Assume 1. ∆; ∅ ; ∅ ⊢ D 1 P 1 :: x : A 2. Γ; ∆ , x : A ; Θ ⊢ D 2 P 2 :: z : C with P 2 ( ν y ) x h y i − − − − − → Q 2 Then : 1. cut # ( D 1 , x. D 2 ) ֒ → = ⇒ ֒ → c ut # ( D 1 , x. D ) for some D ; 2. Φ; Ψ , x : A ; Θ ⊢ D R :: z : C for some R ≡ ( ν x )( ν y )( P 1 | Q 2 ) , wher e Φ , Ψ = Γ , ∆ . Pro of. By induction on D 2 . W e have different cases, dep ending fro m the la st rules of D 2 . Let us just write do wn so me r elev a n t cas e s: • D 2 = cut ( E 1 , y . E 2 ). Assume Γ = Γ 1 , Γ 2 and Θ = Θ 1 , Θ 2 . Now Γ 1 ; ∆ , x : A ; Θ 1 ⊢ E 1 R 1 :: w : B and Γ 2 ; ∆ , x : A ; Θ , w : B ⊢ E 2 R 2 :: z : C by in version. W e have t wo cas es:either P 2 ( ν y ) x h y i − − − − − → R ′ 1 | R 2 or P 2 ( ν y ) x h y i − − − − − → R 1 | R ′ 2 . First ca se: cut # ( D 1 , x. E 1 ) ֒ → = ⇒ ֒ → c ut # ( D 1 , x. F ) for some F ; then Γ 1 ; ∆ , x : A ; Θ 1 ⊢ F S :: w : B for so me S = ( ν y )( P 1 | R ′ 1 ) b y induc- tion hypothesis; cut # ( D 1 , x. cut ( E 1 , y . E 2 )) ≡ cut ( cut # ( D 1 , x. E 1 ) , y . c ut # ( D 1 , x. E 2 )) by ( cut # / − / cut ), ֒ → = ⇒ ֒ → c ut ( cut # ( D 1 , x. F ) , y . cut # ( D 1 , x. E 2 )) by cong ruence ≡ cut # ( D 1 , x. cut ( F , y . E 2 )) by ( cut # / − / cut ). P ick D = cu t ( F , y . E 2 ); then R = ( ν y ) S | R 2 by cut. Then Γ; ∆ , x : A ; Θ ⊢ D R :: z : C for some R ≡ ( ν y )( P 1 | Q 2 ). Second case: cu t # ( D 1 , x. E 2 ) ֒ → = ⇒ ֒ → cut # ( D 1 , x. F ) for some F ; then Γ 2 ; ∆ , x : A ; Θ 2 ⊢ F S :: w : B for so me S = ( ν y )( P 1 | R ′ 2 ) by induction hypothesis ; cut # ( D 1 , x. cut ( E 1 , y . E 2 )) ≡ cu t ( cut # ( D 1 , x. E 1 ) , y . c ut # ( D 1 , x. E 2 )) by ( cut # / − / cut ), ֒ → = ⇒ ֒ → cut ( cut # ( D 1 , x. E 1 ) , y . c ut # ( D 1 , x. F )) b y co ngruence, ≡ cut # ( D 1 , x. cut # ( E 1 , y . F )) by ( cut # / − / cut ) . Pick D = cut # ( E 1 , y . F ); then R = ( ν y ) R 1 | S by cut. Then Γ; ∆ , x : A ; Θ ⊢ D R :: z : C for some R ≡ ( ν y )( P 1 | Q 2 ). • D 2 = cut # ( E 1 , y . E 2 ). ∆; ∅ ; ∅ ⊢ E 1 R 1 :: w : B Γ; ∆ , x : A, w : B ; Θ ⊢ E 2 R 2 :: z : C b y inv e rsion. Now P 2 ( ν y ) x h y i − − − − − → R 1 | R ′ 2 ; cut # ( D 1 , x. E 2 ) ֒ → = ⇒ ֒ → cu t # ( D 1 , x. F ) for some F and Γ; ∆ , x : A, w : B ; Θ ⊢ F S :: w : B fo r some S = ( ν y )( P 1 | R ′ 2 ) by induction h yp oth- esis. cut # ( D 1 , x. cut # ( E 1 , y . E 2 )) ≡ cut # ( D 1 , x. cut # ( E 1 , y . cut # ( D 1 , x. E 2 ))) b y ( cut # / − / c ut # ) ֒ → = ⇒ ֒ → cut # ( D 1 , x. cut # ( E 1 , y . cut # ( D 1 , x. F ))) by cong ruence, ≡ cut # ( D 1 , x. cut # ( E 1 , y . F )) by ( cut # / − / cut # ) . P ick D = cut # ( E 1 , y . F ); then P 2 = ( ν y ) R 1 | S by cut. Then Γ; ∆ , x : A ; Θ ⊢ D R :: z : C for some R ≡ ( ν y )( P 1 | Q 2 ). 14 This concludes the pro of. ✷ Corollary 2 Assume 1. ∆; ∅ ; ∅ ⊢ D 1 P 1 :: x : A 2. Γ; x : A, ∆; Θ ⊢ D 2 Q 1 :: z : C wi th Q 1 ( ν y ) x h y i − − − − − → Q ′ 1 Then 1. cut # ( D 1 , x. D 2 ) ֒ → = ⇒ ֒ → D for some D ; 2. Φ; Ψ; Θ ⊢ D Q 2 :: z : C for some Q 2 ≡ ( ν x )(! x ( y ) .P 1 | ( ν y )( P 1 | Q ′ 1 )) , wher e Φ , Ψ = Γ , ∆ . Pro of. This follows fr o m Lemma 11. ✷ W e are finally able to give a pr o of of Sub ject Reductio n for π DS LL : Pro of. (of T he o rem 1) W e rea son by induction o n the s tructure of D . Since b D = P → Q the only po ssible last rules o f D can b e: 1 L , ! L ! , ! L # , a linear cut ( cut ) o r a n e x po nential cut ( cut ! or cut # ). In all the other cases , the underlying pro ces s ca n only per form a visible action, as can be e a sily verified by insp ecting the rules from Figur e 1 . W ith this o bserv ation in mind, let us insp e ct the op era tional semantics deriv ation proving that P → Q . At some p oint we will find tw o subpro cesses o f P , call them R a nd S , whic h communicate, ca us ing an internal reduction. W e here claim that this can o nly happe n in presence of a cut, and only the communication b etw een R and S m ust o ccur along the channel inv olved in the cut. No w, it’s only a matter of showing that the just describ ed situation can b e “resolved” preserv ing types, and this can b e done using the previo us lemmas. Some relev ant case: • D = cut ! ( D 1 , x. D 2 ); assume Γ = Γ 1 , Γ 2 and P ≡ ( ν x )! x ( w ) .P 1 | P 2 . Now Γ 1 ; ∅ ; ∅ ⊢ D 1 P 1 :: x : C and Γ 2 , x : A ; ∆; Θ ⊢ D 2 P 2 :: z : A , by inv ersio n; from P → Q either P 2 → Q 2 and Q = ( ν x )! x ( w ) .P 1 | Q 2 or P 2 ( ν y ) x h y i − − − − − → Q 2 and Q = ( ν x )! x ( w ) .P 1 | ( ν y ) P 1 | Q 2 . First case: Γ 2 , x : A ; ∆; Θ ⊢ E 2 Q 2 :: z : A for some E 2 with D 2 ֒ → = ⇒ ֒ → E 2 by i.h.; cut ! ( D 1 , x. D 2 ) ֒ → = ⇒ ֒ → cut ! ( D 1 , x. E 2 ) by cong r uence. Pick E = cut ! ( D 1 , x. E 2 ); then Γ; ∆; Θ ⊢ E Q :: z : A b y cut ! . Second case: cut ! ( D 1 , x. D 2 ) ֒ → = ⇒ ֒ → E for some E ; then Γ; ∆; Θ ⊢ E R :: z : A for s ome R ≡ Q b y Corollar y 1. • D = cut # ( D 1 , x. D 2 ). No w, P ≡ ( ν x )! x ( w ) .P 1 | P 2 and ∆; ∅ ; ∅ ⊢ D 1 P 1 :: x : C , Γ; ∆ , x : A ; Θ ⊢ D 2 P 2 :: z : A , b y in version; from P → Q either P 2 → Q 2 and Q = ( ν x )! x ( w ) .P 1 | Q 2 or P 2 ( ν y ) x h y i − − − − − → Q 2 and Q = ( ν x )! x ( w ) .P 1 | ( ν y ) P 1 | Q 2 First case: Γ; ∆ , x : A ; Θ ⊢ E 2 Q 2 :: z : A for some E 2 with D 2 ֒ → = ⇒ ֒ → E 2 by i.h. and cut # ( D 1 , x. D 2 ) ֒ → = ⇒ ֒ → cut # ( D 1 , x. E 2 ) by congruence. Pick E = cut # ( D 1 , x. E 2 ); then Γ; ∆; Θ ⊢ E Q :: z : A by cut # Second case: cut # ( D 1 , x. D 2 ) ֒ → = ⇒ ֒ → E for some E ; then Γ; ∆; Θ ⊢ E R :: z : A for some R ≡ Q by Corollar y 2. This concludes the pro of. ✷ 5 Pro v ing P olynomial B ounds In this section, we prove the main res ult of this pap er , namely some poly nomial b ounds on the length o f internal r eduction sequences and on the size of intermediate results for pro c esses typable in π DILL . In other w or ds, interaction will b e shown to be b ounded. The simplest formulation of this result is the following: Theorem 2 F or every typ e A , t her e is a p olynomial p A such that whenever ∅ ; ∅ ; x : A ⊢ D :: y : 1 and ∅ ; ∅ ; ∅ ⊢ E :: x : A wher e D and E ar e normal and ( ν x )( b D | b E ) → n P , it holds that n, | P | ≤ p A ( | b D | + | b E | ) 15 Int uitively , what Theo rem 2 says is that the complexity of the interaction b etw een tw o pro cesses t ypable w itho ut cuts a nd c o mmun icating through a channel with session t yp e A is p olynomial in their sizes, where the sp ecific po lynomial inv olved o nly depends on A itself. In o ther words, the complexity of the interaction is no t only b ounded, but can b e somehow “read o ff ” fro m the t yp es of the co mmun icating par ties. How do es the pro of of Theorem 2 look like? Conce ptua lly , it can be thought of a s being structured into four steps: 1. First of all, a natural n umber W ( D ) is attributed to any pro of term D . W ( D ) is said to b e the weight of D . 2. Secondly , the weigh t of any pro of term is shown to strictly decrease along co mputational reduction, not to increas e along shifting r eduction and to stay the same for equiv a le n t pro of terms. 3. Thirdly , W ( D ) is shown to b e bounded by a p olyno mial on | b D | , where the exp onent only depe nds on the nesting depth of b oxes of D , denoted B ( D ). 4. Finally , the b ox depth B ( D ) o f any pro of term D is shown to b e “readable” from its type int erfa c e. This is exactly what we a re going to do in the re st of this section. Please o bserve how po int s 1 – 3 ab ov e allow to prov e the following s tr onger result, from which Theorem 2 easily follows, given po int 4: Prop ositi o n 4 F or every n ∈ N , ther e is a p olynomial p n such that for every pr o c ess P with Γ; ∆; Θ ⊢ P :: T , if P → m Q , then m, | Q | ≤ p B ( P ) ( | P | ) . 5.1 Preliminary Definitions Some conce pts hav e to b e given b efore w e can em bar k in the pro of of Pro p o sition 4. First of all, we ne e d to define what the b ox-depth of a pro ces s and of a pr o of term are . Simply , given a proc e ss P , its b ox- depth B ( P ) is the nesting-level of replicatio ns 2 in P . As an example, the b ox-depth of ! x ( y ) . ! z ( w ) . 0 is 2, while the one o f ( ν x ) y ( z ) is 0. F o r mally , given a pro of term D its b ox depth B ( D ) is defined as follows, by induction on the structure of D : B ( 1 L ( x, D )) = B ( D ) B ( ⊕ R 1 ( D )) = B ( D ) B ( 1 R ) = 0 B ( ⊕ R 2 ( D )) = B ( D ) B ( ⊗ L ( x, y .z . D )) = B ( D ) B ( ♭ ! ( x, y . D )) = B ( D ) B ( ⊗ R ( D , E )) = max { B ( D ) , B ( E ) } B ( ♭ # ( x, y . D )) = B ( D ) B ( ⊸ L ( x, D , y . E )) = ma x { B ( D ) , B ( E ) } B (! L ! ( x. D )) = B ( D ) B ( ⊸ R ( x. D )) = B ( D ) B (! L # ( x. D )) = B ( D ) B (& L 1 ( x, y . D )) = B ( D ) B (! R ( x 1 , . . . , x n , D )) = 1 + B ( D ) B (& L 2 ( x, y . D )) = B ( D ) B ( cut ( D , x. E )) = max { B ( D ) , B ( E ) } B (& R ( D , E )) = max { B ( D ) , B ( E ) } B ( cut ! ( D , x. E )) = max { B ( D ) + 1 , B ( E ) } B ( ⊕ L ( x, y . D , z . E )) = max { B ( D ) , B ( E ) } B ( cut # ( D , x. E )) = max { B ( D ) + 1 , B ( E ) } Analogously , the b ox-depth of a pro of term D is simply B ( b D ). Now, suppo se that Γ; ∆; Θ ⊢ D :: T a nd that x : A b elongs to either Γ or ∆, i.e. that x is an “exp onential” channel in D . A key parameter is the virtual numb er of o c curr enc es of x in D , which is denoted a s FO ( x, D ). This para meter , as its name sugge s ts, is not simply the num b er o f literal oc currences of x in D , but takes into a ccount pos sible duplications derived from cuts. So, for example, FO ( w , cu t ! ( D , x. E )) = F O ( x, E ) · FO ( w, D ) + FO ( w , E ), while F O ( w, ⊗ R ( D , E )) is merely 2 This terminology is derived from l i near logic, where pro ofs obtained b y the promotion rule are usually called boxes 16 FO ( w, D ) + FO ( w , E ). Obviously , FO ( w , ♭ ! ( x, w . D )) = 1 and FO ( w , ♭ # ( x, w . D )) = 1. F ormally: FO ( w , 1 L ( x, D )) = F O ( w, D ) FO ( w, 1 R ) = 0 FO ( w, ⊗ L ( x, y .z . D )) = FO ( w, D ) FO ( w, ⊗ R ( D , E )) = FO ( w, D ) + FO ( w , E ) FO ( w, ⊸ L ( x, D , y . E )) = FO ( w , D ) + FO ( w, E ) FO ( w, ⊸ R ( x. D )) = FO ( w, D ) FO ( w, cut ( D , x. E )) = FO ( w, D ) + FO ( w , E ) FO ( w, cut ! ( D , x. E )) = FO ( x, E ) · FO ( w, D ) + FO ( w , E ) FO ( w, cut # ( D , x. E )) = FO ( x, E ) · FO ( w, D ) + FO ( w , E ) FO ( w , ♭ ! ( x, w . D )) = 1 FO ( w , ♭ # ( x, w . D )) = 1 FO ( w , ♭ ! ( x, y . D )) = 0 FO ( w , ♭ # ( x, y . D )) = 0 FO ( w, ! L ! ( x. D )) = FO ( w, D ) FO ( w , ! L # ( x. D )) = FO ( w, D ) FO ( w, ! R ( x 1 , . . . , x n , D )) = 0 FO ( w, ⊕ L ( x, y . D , z . E )) = FO ( w, D ) + FO ( w, E ) FO ( w, ⊕ R 1 ( D )) = FO ( w , D ) FO ( w, ⊕ R 2 ( D )) = FO ( w , D ) FO ( w, & L 1 ( x, y . D )) = FO ( w , D ) FO ( w, & L 2 ( x, y . D )) = FO ( w , D ) FO ( w, & R ( D , E )) = FO ( w, D ) + FO ( w , E ) A channel in either the auxilia ry or the exp onential context c an “floa t” to the linear co nt ext as an effect of r ules ! L ! or ! L # . F rom that moment on, it can only b e treated as a linear channel. As a consequence, it makes sense to define the duplic ability factor of a pr o of term D , written D ( D ), simply as the maximum of FO ( x, D ) o ver all instances of the rules ! L ! or ! L # in D , wher e x is the inv olved channel. F or example, D (! L ! ( x. D )) = max { D ( D ) , FO ( y , D ) } and D ( ⊸ L ( x, D , y . E )) = max { D ( D ) , D ( E ) } . F ormally , the duplicability facto r D ( D ) of D is defined a s follows: D ( 1 L ( x, D )) = D ( D ) D ( ⊕ R 1 ( D )) = D ( D ) D ( 1 R ) = 0 D ( ⊕ R 2 ( D )) = D ( D ) D ( ⊗ L ( x, y .z . D )) = D ( D ) D ( ♭ ! ( x, y . D )) = D ( D ) D ( ⊗ R ( D , E )) = max { D ( D ) , D ( E ) } D ( ♭ # ( x, y . D )) = D ( D ) D ( ⊸ L ( x, D , y . E )) = max { D ( D ) , D ( E ) } D (! L ! ( x. D )) = ma x { D ( D ) , FO ( y , D ) } D ( ⊸ R ( x. D )) = D ( D ) D (! L # ( x. D )) = ma x { D ( D ) , FO ( y , D ) } D (& L 1 ( x, y . D )) = D ( D ) D (! R ( x 1 , . . . , x n , D )) = D ( D ) D (& L 2 ( x, y . D )) = D ( D ) D ( cut ( D , x. E )) = max { D ( D ) , D ( E ) } D (& R ( D , E )) = max { D ( D ) , D ( E ) } D ( cut ! ( D , x. E )) = max { D ( D ) , D ( E ) } D ( ⊕ L ( x, y . D , z . E )) = max { D ( D ) , D ( E ) } D ( cut # ( D , x. E )) = max { D ( D ) , D ( E ) } It’s now po ssible to give the definition of W ( D ), namely the weight of the pro of ter m D . Befor e doing that, ho wev er, it is neces s ary to give a parameter ized no tion of weigh t, denoted W n ( D ). Int uitively , W n ( D ) is defined s imilarly to | b D | . How ever, every input and output action in b D can po ssibly count for more than one: 17 • Everything inside D in ! R ( x 1 , . . . , x n , D ) counts for n ; • Everything inside D in either cut ! ( D , x. E ) o r cut # ( D , x. E ) co unt s for FO ( x, E ). F o r example, W n ( cut # ( D , x. E )) = FO ( x, E ) · W n ( D ) + W n ( E ), while W n (& L 2 ( x, y . D )) = 1 + W n ( D ). F o r mally: W n ( 1 L ( x, D )) = W n ( D ) W n ( 1 R ) = 0 W n ( ⊗ L ( x, y .z . D )) = 1 + W n ( D ) W n ( ⊗ R ( D , E )) = 1 + W n ( D ) + W n ( E ) W n ( ⊸ L ( x, D , y . E )) = 1 + W n ( D ) + W n ( E ) W n ( ⊸ R ( x. D )) = 1 + W n ( D ) W n ( cut ( D , x. E )) = W n ( D ) + W n ( E ) W n ( cut ! ( D , x. E )) = FO ( x, E ) · W n ( D ) + W n ( E ) W n ( cut # ( D , x. E )) = FO ( x, E ) · W n ( D ) + W n ( E ) W n ( ♭ ! ( x, y . D )) = 1 + W n ( D ) W n ( ♭ # ( x, y . D )) = 1 + W n ( D ) W n (! L ! ( x. D )) = W n ( D ) W n (! L # ( x. D )) = W n ( D ) W n (! R ( x 1 , . . . , x n , D )) = n · ( W n ( D ) + 1) W n ( ⊕ L ( x, y . D , z . E )) = 1 + W n ( D ) + W n ( E ) W n ( ⊕ R 1 ( D )) = 1 + W n ( D ) W n ( ⊕ R 2 ( D )) = 1 + W n ( D ) W n (& L 1 ( x, y . D )) = 1 + W n ( D ) W n (& L 2 ( x, y . D )) = 1 + W n ( D ) W n (& R ( D , E )) = 1 + W n ( D ) + W n ( E ) Now, W ( D ) is simply W D ( D ) ( D ). 5.2 Monotonicit y Results The crucia l ingredient for proving p olynomial b ounds are a series of res ults ab out how the weigh t D evolves when D is put in r elation with ano ther pro of term E by wa y of either = ⇒ , 7− → or ≡ . Lemma 12 F or every D , D ( D ) = D ( D ⇓ ) and for every n , W n ( D ) = W n ( D ⇓ ) . Whenever a pro of ter m D computationally r educes to E , the underlying weigh t is guara nteed to strictly decrea s e: Prop ositi o n 5 If Γ; ∆; Θ ⊢ D :: T and D = ⇒ E , then Φ; Ψ; Θ ⊢ E :: T (wher e Γ , ∆ = Φ , Ψ ) , D ( E ) ≤ D ( D ) and W ( E ) < W ( D ) . Pro of. By induction o n the pro o f that D = ⇒ E . So me int er e sting cases: • Suppos e that D = cut ( ⊸ R ( y . F ) , x. ⊸ L ( x, G , x. H )) = ⇒ cu t ( cut ( G , y . F ) , x. H ) = E . Then, D ( D ) = max { D ( F ) , D ( G ) , D ( H ) } = D ( E ); W ( D ) = W D ( D ) ( D ) = 3 + W D ( D ) ( F ) + W D ( D ) ( G ) + W D ( D ) ( H ) > 2 + W D ( E ) ( F ) + W D ( E ) ( G ) + W D ( E ) ( H ) = W D ( E ) ( E ) = W ( E ) . • Suppos e that D = cut (& R ( F , G ) , x. & L 1 ( x, y . H )) = ⇒ cut ( F , x. H ) = E . Then, D ( D ) = max { D ( F ) , D ( G ) , D ( H ) } = D ( E ); W ( D ) = W D ( D ) ( D ) = 3 + W D ( D ) ( F ) + W D ( D ) ( G ) + W D ( D ) ( H ) > 2 + W D ( E ) ( F ) + W D ( E ) ( G ) + W D ( E ) ( H ) = W D ( E ) ( E ) = W ( E ) . 18 • Suppos e that D = cut ! ( F , x.♭ ! ( x, y . G )) = ⇒ cut ( F ⇓ , y . cut # ( F , x. G ⇓ )) = E . Then, D ( D ) = max { D ( F ⇓ ) , D ( G ⇓ ) } = max { D ( F ) , D ( F ) , D ( G ) } = D ( E ); W ( D ) = W D ( D ) ( D ) = FO ( x, ♭ ! ( x, y . G )) · W D ( D ) ( F ⇓ ) + W D ( D ) ( ♭ ! ( x, y . G )) = W D ( D ) ( F ) + W D ( D ) ( ♭ ! ( x, y . G )) = W D ( D ) ( F ) + 1 + W D ( D ) ( G ) ≥ W D ( E ) ( F ) + 1 + W D ( E ) ( G ) > W D ( E ) ( F ) + W D ( E ) ( G ) = W D ( E ) ( F ) + 0 · W D ( E ) ( F ) + W D ( E ) ( G ) = W D ( E ) ( F ) + FO ( x, G ) · W D ( E ) ( F ) + W D ( E ) ( G ) = W D ( E ) ( E ) = W ( E ) . • Suppos e that D = cu t # ( F , x.♭ # ( x, y . G )) = ⇒ cut ( F ⇓ , y . cut # ( F , x. G )) = E . Then we can pr o ceed exactly a s in the previous cas e. This concludes the pro of. ✷ Shift r eduction, on the other hand, is not guar anteed to induce a strict decrea se on the underlying weigh t which, how ever, cannot increa se: Prop ositi o n 6 If Γ; ∆; Θ ⊢ D :: T and D 7− → E , then Γ; ∆; Θ ⊢ E :: T , D ( E ) ≤ D ( D ) and W ( E ) ≤ W ( D ) . Pro of. By induction o n the pro o f that D 7− → E . So me int er e sting cases: • Suppos e that D = cut (! R ( x 1 , . . . , x n , F ) , x. ! L ! ( x. G )) 7− → ! L ! ( x 1 . ! L ! ( x 2 . . . . ! L ! ( x n . cut ! ( F , y . G )))) = E . Then, D ( D ) = max { D ( F ) , D ( G ) } = D ( E ) W ( D ) = W D ( D ) ( D ) = D ( D ) · W D ( D ) ( F ) + W D ( D ) ( G ) ≥ F O ( y , G ) · W D ( D ) ( F ) + W D ( D ) ( G ) = FO ( y , G ) · W D ( E ) ( F ) + W D ( E ) ( G ) = W D ( E ) ( E ) = W ( E ) . • Suppos e that D = cu t (! R ( x 1 , . . . , x n , F ) , x. ! L # ( x. G )) 7− → ! L # ( x 1 . ! L # ( x 2 . . . . ! L # ( x n . cut # ( F , y . G )))) = E . Then we can pr o ceed as in the pr evious cas e. This concludes the pro of. ✷ Finally , equiv a lence leav es the weigh t unchanged: Prop ositi o n 7 If Γ; ∆; Θ ⊢ D :: T and D ≡ E , then Γ; ∆; Θ ⊢ E :: T , D ( E ) = D ( D ) and W ( E ) = W ( D ) . Pro of. By induction o n the pro o f that D ≡ E . Some interesting c ases: • Suppos e that D = cut ( F , x. cut ( G x , y . H y )) ≡ cut ( cut ( F , x. G x ) , y . H y ) = E . Then: D ( D ) = max { D ( F ) , D ( G x ) , D ( H y ) } = D ( E ) W ( D ) = W D ( D ) ( D ) = W D ( D ) ( F ) + W D ( D ) ( G x ) + W D ( D ) ( H y ) = W D ( E ) ( F ) + W D ( E ) ( G x ) + W D ( E ) ( H y ) = W D ( E ) ( E ) = W ( E ) . 19 • Suppos e that D = cut ( F , x. cut ( G , y . H xy )) ≡ cut ( G , x. cut ( F , y . H xy )) = E . Then we can pr o ceed as in the pr evious cas e. • Suppos e that D = cut ( F , x. cut ! ( G , y . H xy )) ≡ cut ! ( G , y . cut ( F , x. H xy )) = E . Then, since FO ( y , F ) = 0, D ( D ) = max { D ( F ) , D ( G ) , D ( H xy ) } = D ( E ) W ( D ) = W D ( D ) ( D ) = W D ( D ) ( F ) + FO ( y , H xy ) · W D ( D ) ( G ) + W D ( D ) ( H xy ) = W D ( D ) ( F ) + FO ( y , cut ( F , x. H xy )) · W D ( D ) ( G ) + W D ( D ) ( H xy ) = W D ( E ) ( F ) + FO ( y , cut ( F , x. H xy )) · W D ( E ) ( G ) + W D ( E ) ( H xy ) = W D ( E ) ( E ) = W ( E ) . • Suppos e that D = cu t # ( F , x. cut ( G x , y . H xy )) ≡ cut ( cut # ( F , x. G x ) , y . c ut # ( F , x. H xy )) = E . Then, D ( D ) = max { D ( F ) , D ( G x ) , D ( H xy ) } = D ( E ) W ( D ) = FO ( x, cut ( G x , y . H xy )) · W D ( D ) ( F ) + W D ( D ) ( G x ) + W D ( D ) ( H xy ) = ( FO ( x, G x ) + FO ( x, H xy )) · W D ( D ) ( F ) + W D ( D ) ( G x ) + W D ( D ) ( H xy ) = ( FO ( x, G x ) · W D ( D ) ( F ) + FO ( x, H xy )) · W D ( D ) ( F ) + W D ( D ) ( G x ) + W D ( D ) ( H xy ) = W D ( D ) ( cut # ( F , x. G x )) + W D ( D ) ( cut # ( F , x. H xy )) = W D ( D ) ( E ) = W D ( E ) ( E ) = W ( E ) . This concludes the pro of. ✷ Now, consider again the sub ject reduction theorem (Theorem 1): what it guar antees is that whenever P → Q and b D = P , there is E with b E = Q and D ֒ → = ⇒ ֒ → E . In view of the three prop ositions w e hav e just stated and prov ed, it’s clear that W ( D ) > E . Altogether , this implies that W ( D ) is a n upp er b o und on the num b er or in terna l reductio n steps b D can p erform. But is W ( D ) itself b ounded? 5.3 Bounding the W eigh t What kind o f b ounds can w e exp ect to prov e for W ( D )? More sp ecifically , how r elated are W ( D ) and | b D | ? Lemma 13 Supp ose Γ; ∆; Θ ⊢ D :: T . Th en 1. If x ∈ Γ , then FO ( x, D ) ≤ 1 ; 2. If x ∈ ∆ , then FO ( x, D ) ≤ | D | ; 3. If x ∈ Θ , then FO ( x, D ) = 0 ; Pro of. By induction on the structure of a type deriv atio n π for Γ; ∆; Θ ⊢ D :: T . Some interesting cases: • If π is ρ 1 : Γ 1 ; ∆; Θ 1 ⊢ D 1 :: z : A ρ 2 : Γ 2 ; ∆; Θ 2 ⊢ D 2 :: y : B Γ 1 , Γ 2 ; ∆; Θ 1 , Θ 2 ⊢ ⊗ R ( D 1 , D 2 ) :: y : A ⊗ B ⊗ R 20 then FO ( x, ⊗ R ( D 1 , D 2 )) = FO ( x, D 1 ) ≤ 1 if x ∈ Γ 1 FO ( x, ⊗ R ( D 1 , D 2 )) = FO ( x, D 2 ) ≤ 1 if x ∈ Γ 2 FO ( x, ⊗ R ( D 1 , D 2 )) = FO ( x, D 1 ) + FO ( x, D 1 ) ≤ | D 1 | + | D 2 | ≤ | ⊗ R ( D 1 , D 2 ) | if x ∈ ∆ FO ( x, ⊗ R ( D 1 , D 2 )) = FO ( x, D 1 ) = 0 if x ∈ Θ 1 FO ( x, ⊗ R ( D 1 , D 2 )) = FO ( x, D 2 ) = 0 if x ∈ Θ 2 • If π is Γ 1 ; ∅ ; ∅ ⊢ ∅ :: D 1 z : A Γ 2 ; Γ 1 , y : A ; Θ ⊢ D 2 :: T Γ 2 ; Γ 1 ; Θ ⊢ cut # ( D 1 , y . D 2 ) :: T cut # then: FO ( x, cut # ( D 1 , y . D 2 )) = FO ( y , D 2 ) · FO ( x, D 1 ) + FO ( x, D 2 ) ≤ | D 2 | · 1 + | D 1 | ≤ | cut # ( D 1 , y . E 2 ) | if x ∈ Γ 1 FO ( x, cut # ( D 1 , y . D 2 )) = FO ( y , D 2 ) · FO ( x, D 1 ) + FO ( x, D 2 ) ≤ | D 2 | · 0 + 1 = 1 if x ∈ Γ 2 FO ( x, cut # ( D 1 , y . E 2 )) = FO ( y , D 2 ) · FO ( x, D 1 ) + FO ( x, D 2 ) ≤ | D 2 | · 0 + 1 = 1 if x ∈ Θ • If π is Γ 1 ; ∅ ; ∅ ⊢ ∅ :: D 1 z : A Γ 2 ; ∆; Θ ⊢ D 2 :: T Γ 2 ; ∆; Θ ⊢ cut w ( D 1 , y . D 2 ) :: T cut w then: FO ( x, cut w ( D 1 , y . D 2 )) = FO ( y , D 2 ) · FO ( x, D 1 ) + FO ( x, D 2 ) ≤ 0 · 1 + 0 = 0 if x ∈ Γ 1 FO ( x, cut w ( D 1 , y . D 2 )) = FO ( y , D 2 ) · FO ( x, D 1 ) + FO ( x, D 2 ) ≤ 0 · 0 + 1 = 1 if x ∈ Γ 2 FO ( x, cut w ( D 1 , y . E 2 )) = FO ( y , D 2 ) · FO ( x, D 1 ) + FO ( x, D 2 ) ≤ 0 · 0 + | D 2 | ≤ | cut # ( D 1 , y . E 2 ) | if x ∈ ∆ FO ( x, cut w ( D 1 , y . E 2 )) = FO ( y , D 2 ) · FO ( x, D 1 ) + FO ( x, D 2 ) ≤ 0 · 0 + 1 = 1 if x ∈ Θ This concludes the pro of. ✷ Lemma 14 Supp ose Γ; ∆; Θ ⊢ D :: T . Th en D ( D ) ≤ | D | . Pro of. An easy induction on the structure of a t yp e der iv ation π for Γ; ∆; Θ ⊢ D :: T . Some int ere s ting cases: • If π is Γ 1 ; ∅ ; ∅ ⊢ ∅ :: D 1 z : A Γ 2 ; ∆ , y : A ; Θ ⊢ D 2 :: T Γ 2 ; ∆ , Γ 1 ; Θ ⊢ cut # ( D 1 , y . D 2 ) :: T cut # then, by Lemma 13 and b y induction hypothesis: D ( cut # ( D 1 , y . D 2 )) = max { D ( D 1 ) , D ( D 2 ) } ≤ max {| D 1 | , | D 2 |} ≤ | cut # ( D 1 , y . D 2 ) | 21 This concludes the pro of. ✷ Lemma 15 If Γ; ∆; Θ ⊢ D :: T , then for every n ≥ D ( D ) , W n ( D ) ≤ | b D | · n B ( b D )+1 . Pro of. By induction o n the structure of D . Some interesting cases: • If D = ⊗ R ( E , F ), then: W n ( ⊗ R ( E , F )) = 1 + W n ( E ) + W n ( F ) ≤ 1 + | E | · n B ( E )+1 + | F | · n B ( F )+1 ≤ 1 + ( | E | + | F | ) · n max { B ( E )+1 , B ( F )+1 } ≤ (1 + | E | + | F | ) · n max { B ( E )+1 , B ( F )+1 } ≤ | ⊗ R ( E , F ) | · n B ( ⊗ R ( E , F ))+1 • If D = cut ! ( D , x. E ), then: W n ( cut ! ( D , x. E )) = FO ( x, E ) · ( W n ( D ) + 1) + W n ( E ) ≤ FO ( x, E ) · ( | D | · n B ( D )+1 + 1 ) + | E | · n B ( E )+1 ≤ n · | D | · n B ( D )+1 + n + | E | · n B ( E )+1 ≤ | D | · n B ( D )+2 + n B ( E )+1 + | E | · n B ( E )+1 ≤ ( | D | + | E | + 1) · n max { B ( D )+2 , B ( E )+1 } = | cut ! ( D , x. E ) | · n B ( cut ! ( D ,x. E )) . • If D = ! R ( x 1 , . . . , x n , E ), then: W n (! R ( x 1 , . . . , x n , E )) = n · ( W n ( E ) + 1) ≤ n · | E | · n B ( E )+1 + n ≤ | E | · n B ( E )+2 + n B ( E )+2 = (1 + | E | ) · n B (! R ( x 1 ,...,x n , E ))+1 = | ! R ( x 1 , . . . , x n , E ) | · n B (! R ( x 1 ,...,x n , E ))+1 . This concludes the pro of. ✷ 5.4 Putting Ev erything T ogether W e now hav e almost all the necessar y ingr e die nts to obtain a pro of o f Pr op osition 4: the only missing tales ar e the b ounds on the siz e of any reducts, since the p olynomial bounds on the length of int er na l reductions ar e ex a ctly the ones from Lemma 1 5. Obs erve, how ever, that the latter induces the former: Lemma 16 Supp ose that P → n Q . Then | Q | ≤ n · | P | . Pro of. By induction on n , enriching the statement as follows: whenever P → n Q , b o th | Q | ≤ n · | P | and | R | ≤ | P | for every s ubpro cess R of Q in the form ! x ( y ) .S . ✷ Lemma 17 F or every D , B ( D ) = B ( b D ) and | D | = | b D | . Finally: 22 Pro of. [Pro p o sition 4] Let { q n } n ∈ N the polyno mials coming from Lemma 1 5. The p olynomia ls we are lo o king for are defined a s follows: p n ( x ) = q n ( x ) + x · q n ( x ) . Now, supp ose that P → m Q . By Theore m 1 , there are pro o f ter ms D , E such that P = b D , Q = b E and D ( ֒ → = ⇒ ֒ → ) m E . Now, from prop os itions 5, 6 and 7, it follows that W ( D ) ≥ m + W ( E ) ≥ m. As a cons equence, by Lemma 15 and L e mma 17, m ≤ q B ( D ) ( | D | ) ≤ q B ( P ) ( | P | ) ≤ p B ( P ) ( | P | ) . By Lemma 1 6, it follows that | Q | ≤ m · | P | ≤ q B ( P ) ( | P | ) · | P | ≤ p B ( P ) ( | P | ) . This concludes the pro of. ✷ Let us now consider Theorem 2: how can we deduce it from Pr op osition 4? Everything bo ils down to show that for no rmal pro cesses, the b ox-depth can b e read off fr o m their t yp e. In the following lemma, B ( A ) and B (Γ) are the nesting depths of ! inside the type A and inside the types app earing in Γ (for every type A a nd context Γ). Lemma 18 Supp ose that Γ; ∆; Θ ⊢ D :: x : A and that D is normal. Then B ( b D ) = max { B (Γ) , B (∆) , B (Θ) , B ( A ) } . Pro of. An easy induction on D . ✷ The pro o f of b ounded int era ction is s imila r in str uc tur e to the one o f p olynomia l time soundness for SLL (see [9]). How ever, the p eculiar ities of dual systems and of pro cess algebr as mak e it slightly more complicated. As an example, some of the stro ng bisimilarities o n pro o f terms which are nece s sary to simulate pro ces s reduction (e.g . ( cut # / − / cut ), see Figure 5 ) exhibit complicated combinatorial b ehaviors, which need to be taken into acco unt here. 6 Conclusions In this paper, we introduced a v a riation on Caires and Pfenning’s π D ILL , called π DSL L , being inspired by Lafont’s soft linear logic. The key feature of π DSLL is the fact that the amount of interaction induced b y allowing tw o pro ces ses to in teract with each other is bounded by a po lynomial whose degr ee ca n be “read off ” from the type of the session channel through which they communicate. What we co nsider the main achievemen t of this pa p er is the “trans fer of technology” from the functional w or ld of implicit computationa l complexity to the concurrent framework of π -calc ulus and ses sion t yp es, ra ther than the pro of of the p olynomial b o unds itself, which can b e o btained by a dapting the ones in [5] or in [4] (although this an ywa y presents s ome technical difficulties due to the low-lev el nature of the π -calculus compared to the lambda ca lculus or to hig her -order π -calculus). Another asp ect that w e find in teresting is the fo llowing: it seems that the constr a ints on pro cesses induced by the adoption of the more s tringent t yping discipline π D SLL , as opp ose d to π DILL , are quite natural and do not rule out too many interesting examples. In particular , the way sessions can b e defined rema ins essentially untouc hed: what changes is the wa y sessions can b e offered, i.e. the disc ipline governing the offer ing of multiple sessions by servers. All the ex amples in [1] and the one from Sectio n 2 ar e indeed t ypable in π DSLL . T o pics for future work include the acco mmo da tion of recursive type s in to π DSLL . This co uld be easier than exp ected, due to the robustness of light logics to the presence of r ecursive types [3]. 23 References [1] Lu ´ ıs Caires & F ra nk P fenning (2 0 10): Session T yp es as Intuitionistic Li ne ar Pr op ositions . In: CO NCUR 2010 , LNCS 62 69. Springer, pp. 222–23 6. [2] Lu ´ ıs Ca ires, Ber nardo T oninho & F rank Pfenning (20 11): Dep endent Session T yp es via Intu- itionistic Line ar T yp e The ory . In: PPDP 20 11 . A CM Press, pp. 161 –172 . T o app ear . [3] Ugo Dal La go & Patric k Baillo t (2006): On light lo gics, uniform enc o dings and p olynomial time . Ma thematical Structures in Computer Science 1 6(4), pp. 713– 733. [4] Ugo Dal Lago , Simone Ma r tini & Davide Sang iorgi (2010): Light L o gics and Higher-Or der Pr o c esses . In: EXPRESS’10 , EP TCS 41. pp. 46– 60. [5] Ugo Dal Lago, Andrea Masini & Marg herita Zorzi (2010): Quant um implicit c omputational c omplexity . Theor. Comput. Sci. 411(2), pp. 377 –409. [6] Jean-Yves Girar d (198 7): Line ar L o gic . Theor. Comput. Sci. 5 0, pp. 1– 102. [7] Kohei Honda, V asco Th udich um V asconc e los & Makoto Kub o (199 8): L anguage Primitives and T yp e Discipline for Structur e d Co mmu n ic ation-Base d Pr o gr amming . In: E SOP 1998 , LNCS 138 1. pp. 12 2–13 8 . [8] Kohei Honda, Nobuko Y os hida & Marco Car bo ne (20 08): Multip arty asynchr onous session typ es . In: P OPL 2008 . ACM Pres s, pp. 27 3 –284 . [9] Yv es Lafont (2004): Soft line ar lo gic and p olynomial time . Theo r. Comput. Sci. 318(1 - 2), pp. 163–1 80. [10] Harry G. Mairs on (1992): A Simple Pr o of of a The or em of Statman . Theor. Comput. Sci. 103(2), pp. 38 7–394 . [11] Dimitris Mostro us & Nobuko Y oshida (2007): Two Session T yping S ystems for Higher-Or der Mobile Pr o c ess es . In: TLCA 20 07 , L NCS 458 3 . pp. 321–33 5. [12] Richard Statman (1979): The T yp e d lamb da-Calculus is not Elementary R e cursive . Theor. Comput. Sci. 9, pp. 73–8 1. 24

Original Paper

Loading high-quality paper...

Comments & Academic Discussion

Loading comments...

Leave a Comment