On Polymorphic Sessions and Functions
Abstract
This work exploits the logical foundation of session types to determine what kind of type discipline for the \(\pi \)calculus can exactly capture, and is captured by, \(\lambda \)calculus behaviours. Leveraging the proof theoretic content of the soundness and completeness of sequent calculus and natural deduction presentations of linear logic, we develop the first mutually inverse and fully abstract processesasfunctions and functionsasprocesses encodings between a polymorphic session \(\pi \)calculus and a linear formulation of System F. We are then able to derive results of the session calculus from the theory of the \(\lambda \)calculus: (1) we obtain a characterisation of inductive and coinductive session types via their algebraic representations in System F; and (2) we extend our results to account for value and process passing, entailing strong normalisation.
1 Introduction
Dating back to Milner’s seminal work [29], encodings of \(\lambda \)calculus into \(\pi \)calculus are seen as essential benchmarks to examine expressiveness of various extensions of the \(\pi \)calculus. Milner’s original motivation was to demonstrate the power of link mobility by decomposing higherorder computations into pure name passing. Another goal was to analyse functional behaviours in a broad computational universe of concurrency and nondeterminism. While operationally correct encodings of many higherorder constructs exist, it is challenging to obtain encodings that are precise wrt behavioural equivalence: the semantic distance between the \(\lambda \)calculus and the \(\pi \)calculus typically requires either restricting process behaviours [45] (e.g. via typed equivalences [5]) or enriching the \(\lambda \)calculus with constants that allow for a suitable characterisation of the term equivalence induced by the behavioural equivalence on processes [43].
Encodings in \(\pi \)calculi also gave rise to new typing disciplines: Session types [20, 22], a typing system that is able to ensure deadlockfreedom for communication protocols between two or more parties [23], were originally motivated “from process encodings of various data structures in an asynchronous version of the \(\pi \)calculus” [21]. Recently, a propositionsastypes correspondence between linear logic and session types [8, 9, 54] has produced several new developments and logicallymotivated techniques [7, 26, 49, 54] to augment both the theory and practice of sessionbased messagepassing concurrency. Notably, parametric session polymorphism [7] (in the sense of Reynolds [41]) has been proposed and a corresponding abstraction theorem has been shown.
Our work expands upon the proof theoretic consequences of this propositionsastypes correspondence to address the problem of how to exactly match the behaviours induced by session \(\pi \)calculus encodings of the \(\lambda \)calculus with those of the \(\lambda \)calculus. We develop mutually inverse and fully abstract encodings (up to typed observational congruences) between a polymorphic sessiontyped \(\pi \)calculus and the polymorphic \(\lambda \)calculus. The encodings arise from the proof theoretic content of the equivalence between sequent calculus (i.e. the session calculus) and natural deduction (i.e. the \(\lambda \)calculus) for secondorder intuitionistic linear logic, greatly generalising [49]. While fully abstract encodings between \(\lambda \)calculi and \(\pi \)calculi have been proposed (e.g. [5, 43]), our work is the first to consider a twoway, both mutually inverse and fully abstract embedding between the two calculi by crucially exploiting the linear logicbased session discipline. This also sheds some definitive light on the nature of concurrency in the (logical) session calculi, which exhibit “don’t care” forms of nondeterminism (e.g. processes may race on stateless replicated servers) rather than “don’t know” nondeterminism (which requires less harmonious logical features [2]).
In the spirit of Gentzen [14], we use our encodings as a tool to study nontrivial properties of the session calculus, deriving them from results in the \(\lambda \)calculus: We show the existence of inductive and coinductive sessions in the polymorphic session calculus by considering the representation of initial Falgebras and final Fcoalgebras [28] in the polymorphic \(\lambda \)calculus [1, 19] (in a linear setting [6]). By appealing to full abstraction, we are able to derive processes that satisfy the necessary algebraic properties and thus form adequate uniform representations of inductive and coinductive session types. The derived algebraic properties enable us to reason about standard data structure examples, providing a logical justification to typed variations of the representations in [30].
We systematically extend our results to a session calculus with \(\lambda \)term and process passing (the latter being the core calculus of [50], inspired by Benton’s LNL [4]). By showing that our encodings naturally adapt to this setting, we prove that it is possible to encode higherorder process passing in the firstorder session calculus fully abstractly, providing a typed and prooftheoretically justified reenvisioning of Sangiorgi’s encodings of higherorder \(\pi \)calculus [46]. In addition, the encoding instantly provides a strong normalisation property of the higherorder session calculus.

§ 3.1 develops a functionsasprocesses encoding of a linear formulation of System F, LinearF, using a logically motivated polymorphic session \(\pi \)calculus, Poly\(\pi \), and shows that the encoding is operationally sound and complete.

§ 3.2 develops a processesasfunctions encoding of Poly\(\pi \) into LinearF, arising from the completeness of the sequent calculus wrt natural deduction, also operationally sound and complete.

§ 3.3 studies the relationship between the two encodings, establishing they are mutually inverse and fully abstract wrt typed congruence, the first twoway embedding satisfying both properties.

§ 4 develops a faithful representation of inductive and coinductive session types in Poly\(\pi \) via the encoding of initial and final (co)algebras in the polymorphic \(\lambda \)calculus. We demonstrate a use of these algebraic properties via examples.

§ 4.2 and 4.3 study termpassing and processpassing session calculi, extending our encodings to provide embeddings into the firstorder session calculus. We show full abstraction and mutual inversion results, and derive strong normalisation of the higherorder session calculus from the encoding.
In order to introduce our encodings, we first overview Poly\(\pi \), its typing system and behavioural equivalence (§ 2). We discuss related work and conclude with future work (§ 5). Detailed proofs can be found in [52].
2 Polymorphic Session \(\pi \)Calculus
This section summarises the polymorphic session \(\pi \)calculus [7], dubbed Poly\(\pi \), arising as a process assignment to secondorder linear logic [15], its typing system and behavioural equivalences.
2.1 Processes and Typing
The syntax of session types is that of (intuitionistic) linear logic propositions which are assigned to channels according to their usages in processes: \(\mathbf {1}\) denotes the type of a channel along which no further behaviour occurs; Open image in new window denotes a session that waits to receive a channel of type A and will then proceed as a session of type B; dually, \(A~\otimes ~B\) denotes a session that sends a channel of type A and continues as B; \( A~ \& ~B\) denotes a session that offers a choice between proceeding as behaviours A or B; \(A \oplus B\) denotes a session that internally chooses to continue as either A or B, signalling appropriately to the communicating partner; \(!A\) denotes a session offering an unbounded (but finite) number of behaviours of type A; \(\forall X.A\) denotes a polymorphic session that receives a type B and behaves uniformly as \(A\{B/X\}\); dually, \(\exists X.A\) denotes an existentially typed session, which emits a type B and behaves as \(A\{B/X\}\).
In the remainder of this work we write \(\equiv \) for a standard \(\pi \)calculus structural congruence extended with the clause \([x\leftrightarrow y] \equiv [y\leftrightarrow x]\). In order to streamline the presentation of observational equivalence [7, 36], we write \(\equiv _!\) for structural congruence extended with the socalled sharpened replication axioms [46], which capture basic equivalences of replicated processes (and are present in the proof dynamics of the exponential of linear logic). A transition \(P \xrightarrow {~\alpha ~} Q\) denotes that P may evolve to Q by performing the action represented by label \(\alpha \). An action \(\alpha \) (\(\overline{\alpha }\)) requires a matching \(\overline{\alpha }\) (\(\alpha \)) in the environment to enable progress. Labels include: the silent internal action \(\tau \), output and bound output actions (\(\overline{x\langle y\rangle }\) and \(\overline{(\nu z)x\langle z\rangle }\)); input action x(y); the binary choice actions (\(x.\mathsf {inl}\), \(\overline{x.\mathsf {inl}}\), \(x.\mathsf {inr}\), and \(\overline{x.\mathsf {inr}}\)); and output and input actions of types (\(\overline{x\langle A\rangle }\) and x(A)).
The labelled transition relation is defined by the rules in Fig. 1, subject to the side conditions: in rule \((\mathsf {res})\), we require \(y\not \in { fn}(\alpha )\); in rule \((\mathsf {par})\), we require \({ bn}(\alpha ) \cap { fn}(R) = \emptyset \); in rule \((\mathsf {close})\), we require \(y\not \in { fn}(Q)\). We omit the symmetric versions of \((\mathsf {par})\), \((\mathsf {com})\), \((\mathsf {lout})\), \((\mathsf {lin})\), \((\mathsf {close})\) and closure under \(\alpha \)conversion. We write \(\rho _1 \rho _2\) for the composition of relations \(\rho _1, \rho _2\). We write \(\xrightarrow {}\) to stand for \(\xrightarrow {\tau }\equiv \). Weak transitions are defined as usual: we write \({\mathop {\Longrightarrow }\limits ^{}}\) for the reflexive, transitive closure of \(\xrightarrow {\tau }\) and \(\xrightarrow {}^+\) for the transitive closure of \(\xrightarrow {\tau }\). Given \(\alpha \ne \tau \), notation \({\mathop {\Longrightarrow }\limits ^{\alpha }}\) stands for \({\mathop {\Longrightarrow }\limits ^{~}}\xrightarrow {\alpha }{\mathop {\Longrightarrow }\limits ^{~}}\) and \({\mathop {\Longrightarrow }\limits ^{\tau }}\) stands for \({\mathop {\Longrightarrow }\limits ^{}}\).
As in [8, 9, 36, 54], the typing discipline enforces that channel outputs always have as object a fresh name, in the style of the internal mobility \(\pi \)calculus [44]. We clarify a few of the key rules: Rule \({{\forall }\mathsf {R}}\) defines the meaning of (impredicative) universal quantification over session types, stating that a session of type \(\forall X.A\) inputs a type and then behaves uniformly as A; dually, to use such a session (rule \({{\forall }\mathsf {L}}\)), a process must output a type B which then warrants the use of the session as type \(A\{B/X\}\). Rule Open image in new window captures session input, where a session of type Open image in new window expects to receive a session of type A which will then be used to produce a session of type B. Dually, session output (rule \({{\otimes }\mathsf {R}}\)) is achieved by producing a fresh session of type A (that uses a disjoint set of sessions to those of the continuation) and outputting the fresh session along z, which is then a session of type B. Linear composition is captured by rule \(\mathsf {cut}\) which enables a process that offers a session x : A (using linear sessions in \(\varDelta _1\)) to be composed with a process that uses that session (amongst others in \(\varDelta _2\)) to offer z : C. As shown in [7], typing entails Subject Reduction, Global Progress, and Termination.
Observational Equivalences. We briefly summarise the typed congruence and logical equivalence with polymorphism, giving rise to a suitable notion of relational parametricity in the sense of Reynolds [41], defined as a contextual logical relation on typed processes [7]. The logical relation is reminiscent of a typed bisimulation. However, extra care is needed to ensure wellfoundedness due to impredicative type instantiation. As a consequence, the logical relation allows us to reason about process equivalences where type variables are not instantiated with the same, but rather related types.
Typed Barbed Congruence ( Open image in new window ). We use the typed contextual congruence from [7], which preserves observable actions, called barbs. Formally, barbed congruence, noted Open image in new window , is the largest equivalence on welltyped processes that is \(\tau \)closed, barb preserving, and contextually closed under typed contexts; see [7, 52] for the full definition.
Logical Equivalence ( Open image in new window ). The definition of logical equivalence is no more than a typed contextual bisimulation with the following intuitive reading: given two open processes P and Q (i.e. processes with nonempty lefthand side typings), we define their equivalence by inductively closing out the context, composing with equivalent processes offering appropriately typed sessions. When processes are closed, we have a single distinguished session channel along which we can perform observations, and proceed inductively on the structure of the offered session type. We can then show that such an equivalence satisfies the necessary fundamental properties (Theorem 2.3).
The logical relation is defined using the candidates technique of Girard [16]. In this setting, an equivalence candidate is a relation on typed processes satisfying basic closure conditions: an equivalence candidate must be compatible with barbed congruence and closed under forward and converse reduction.
Definition 2.1
 1.
If \((P, Q) \in \mathcal {R}~{:}{:}~z{:}A~\!\Leftrightarrow \!~B\), Open image in new window , and Open image in new window then \((P', Q') \in \mathcal {R}~{:}{:}~z{:}A~\!\Leftrightarrow \!~B\).
 2.
If \((P, Q) \in \mathcal {R}~{:}{:}~z{:}A~\!\Leftrightarrow \!~B\) then, for all \(P_0\) such that \(\cdot \vdash P_0~{:}{:}~z{:}A\) and \(P_0 {\mathop {\Longrightarrow }\limits ^{}} P\), we have \((P_0, Q) \in \,\mathcal {R}~{:}{:}~z{:}A~\!\Leftrightarrow \!~B\). Symmetrically for Q.
To define the logical relation we rely on some auxiliary notation, pertaining to the treatment of type variables arising due to impredicative polymorphism. We write \(\omega : \varOmega \) to denote a mapping \(\omega \) that assigns a closed type to the type variables in \(\varOmega \). We write \(\omega (X)\) for the type mapped by \(\omega \) to variable X. Given two mappings \(\omega : \varOmega \) and \(\omega ' : \varOmega \), we define an equivalence candidate assignment \(\eta \) between \(\omega \) and \(\omega '\) as a mapping of equivalence candidate \(\eta (X)~{:}{:}~{}{:}\omega (X)\,\!\Leftrightarrow \!\,\omega '(X)\) to the type variables in \(\varOmega \), where the particular choice of a distinguished righthand side channel is delayed (i.e. to be instantiated later on). We write \(\eta (X)(z)\) for the instantiation of the (delayed) candidate with the name z. We write \(\eta : \omega ~\!\Leftrightarrow \!~\omega '\) to denote that \(\eta \) is a candidate assignment between \(\omega \) and \(\omega '\); and \(\hat{\omega }(P)\) to denote the application of mapping \(\omega \) to P.
We define a sequentindexed family of process relations, that is, a set of pairs of processes (P, Q), written \(\varGamma ; \varDelta \vdash P \approx _{\mathtt {L}}Q~{:}{:}~ T [\eta : \omega \,\!\Leftrightarrow \!\,\omega ']\), satisfying some conditions, typed under \(\varOmega ; \varGamma ; \varDelta \vdash T\), with \(\omega : \varOmega \), \(\omega ' : \varOmega \) and \(\eta : \omega \,\!\Leftrightarrow \!\,\omega '\). Logical equivalence is defined inductively on the size of the typing contexts and then on the structure of the righthand side type. We show only select cases (see [52] for the full definition).
Definition 2.2

\(P \approx _{\mathtt {L}}Q~{:}{:}~ z{:}X [\eta : \omega \,\!\Leftrightarrow \!\,\omega '] \text { iff } (P,Q) \in \eta (X)(z)\)

Open image in new window \(P \approx _{\mathtt {L}}Q~{:}{:}~ z{:}A\multimap B [\eta : \omega \,\!\Leftrightarrow \!\,\omega ']\) iff \(\forall P', y.~(P \xrightarrow {z(y)} P') \Rightarrow \exists Q'. Q {\mathop {\Longrightarrow }\limits ^{z(y)}} Q'\) s.t. \(\forall R_1,R_2.R_1 \approx _{\mathtt {L}}R_2~{:}{:}~ y{:}A [\eta : \omega \,\!\Leftrightarrow \!\,\omega '] (\nu y)(P' \,\, R_1) \approx _{\mathtt {L}}(\nu y)(Q' \,\, R_2)~{:}{:}~ z{:}B [\eta : \omega \,\!\Leftrightarrow \!\,\omega ']\)

\(P \approx _{\mathtt {L}}Q~{:}{:}~ z{:}A\otimes B [\eta : \omega \,\!\Leftrightarrow \!\,\omega ']\) iff \(\forall P', y.~~(P \xrightarrow {\overline{(\nu y)z\langle y\rangle }} P') \Rightarrow \exists Q'. Q {\mathop {\Longrightarrow }\limits ^{\overline{(\nu y)z\langle y\rangle }}} Q'\) s.t. \(\exists P_1,P_2,Q_1,Q_2. \ P' \equiv _!P_1 \mid P_2 \wedge Q' \equiv _!Q_1 \mid Q_2\wedge P_1 \approx _{\mathtt {L}}Q_1~{:}{:}~ y{:}A [\eta : \omega ~\!\Leftrightarrow \!~\omega '] \wedge P_2 \approx _{\mathtt {L}}Q_2~{:}{:}~ z{:}B [\eta : \omega ~\!\Leftrightarrow \!~\omega ']\)

\(P \approx _{\mathtt {L}}Q~{:}{:}~ z{:}\forall X. A [\eta : \omega ~\!\Leftrightarrow \!~\omega ']\) iff \(\forall B_1 , B_2 ,P',\mathcal {R}~{:}{:}~{}{:}B_1~\!\Leftrightarrow \!~B_2.~~( P \xrightarrow {z(B_1)} P' )\) implies Open image in new window
For the sake of readability we often omit the \(\eta : \omega ~\!\Leftrightarrow \!~ \omega '\) portion of Open image in new window , which is henceforth implicitly universally quantified. Thus, we write Open image in new window (or Open image in new window ) iff the two given processes are logically equivalent for all consistent instantiations of its type variables.
It is instructive to inspect the clause for type input (\(\forall X.A\)): the two processes must be able to match inputs of any pair of related types (i.e. types related by a candidate), such that the continuations are related at the open type A with the appropriate type variable instantiations, following Girard [16]. The power of this style of logical relation arises from a combination of the extensional flavour of the equivalence and the fact that polymorphic equivalences do not require the same type to be instantiated in both processes, but rather that the types are related (via a suitable equivalence candidate relation).
Theorem 2.3
 Parametricity:

If \(\varOmega ; \varGamma ; \varDelta \vdash P~{:}{:}~z{:}A\) then, for all \(\omega , \omega ' : \varOmega \) and \(\eta : \omega ~\!\Leftrightarrow \!~\omega '\), we have \(\varGamma ; \varDelta \vdash \hat{\omega }(P) \approx _{\mathtt {L}}\hat{\omega '}(P)~{:}{:}~ z{:}A [\eta : \omega ~\!\Leftrightarrow \!~\omega ']\).
 Soundness:

If Open image in new window then Open image in new window , for any closing \(\mathcal {C}[]\).
 Completeness:
3 To LinearF and Back
We now develop our mutually inverse and fully abstract encodings between Poly\(\pi \) and a linear polymorphic \(\lambda \)calculus [55] that we dub LinearF. We first introduce the syntax and typing of the linear \(\lambda \)calculus and then proceed to detail our encodings and their properties (we omit typing ascriptions from the existential polymorphism constructs for readability).
Definition 3.1
The syntax of types is that of the multiplicative and exponential fragments of secondorder intuitionistic linear logic: \({{\lambda } x{:}A.M}\) denotes linear \(\lambda \)abstractions; \({M\,N}\) denotes the application; \({\langle M \otimes N \rangle }\) denotes the multiplicative pairing of M and N, as reflected in its elimination form Open image in new window which simultaneously deconstructs the pair M, binding its first and second projection to x and y in N, respectively; \(!M\) denotes a term M that does not use any linear variables and so may be used an arbitrary number of times; Open image in new window binds the underlying exponential term of M as u in N; \({{\varLambda } X.M}\) is the type abstraction former; M[A] stands for type application; Open image in new window is the existential type introduction form, where M is a term where the existentially typed variable is instantiated with A; Open image in new window unpacks an existential package M, binding the representation type to X and the underlying term to y in N; the multiplicative unit \({\mathbf {1}}\) has as introduction form the nullary pair \({\langle \rangle }\) and is eliminated by the construct Open image in new window , where M is a term of type \({\mathbf {1}}\). Booleans (type \({\mathbf {2}}\) with values \({\mathsf {T}}\) and \({\mathsf {F}}\)) are the basic observable.
The typing judgment in LinearF is given as \({\varOmega ; \varGamma ; \varDelta \vdash M : A}\), following the DILL formulation of linear logic [3], stating that term M has type A in a linear context \(\varDelta \) (i.e. bindings for linear variables x : B), intuitionistic context \({\varGamma }\) (i.e. binding for intuitionistic variables u : B) and type variable context \(\varOmega \). The typing rules are standard [7]. The operational semantics of the calculus are the expected callbyname semantics with commuting conversions [27]. We write \({\Downarrow }\) for the evaluation relation. We write Open image in new window for the largest typed congruence that is consistent with the observables of type \({\mathbf {2}}\) (i.e. a socalled Morrisstyle equivalence as in [5]).
3.1 Encoding LinearF into Session \(\pi \)Calculus
We define a translation from LinearF to Poly\(\pi \) generalising the one from [49], accounting for polymorphism and multiplicative pairs. We translate typing derivations of \(\lambda \)terms to those of \(\pi \)calculus terms (we omit the full typing derivation for the sake of readability).
Proof theoretically, the \(\lambda \)calculus corresponds to a proof term assignment for natural deduction presentations of logic, whereas the session \(\pi \)calculus from § 2 corresponds to a proof term assignment for sequent calculus. Thus, we obtain a translation from \(\lambda \)calculus to the session \(\pi \)calculus by considering the proof theoretic content of the constructive proof of soundness of the sequent calculus wrt natural deduction. Following Gentzen [14], the translation from natural deduction to sequent calculus maps introduction rules to the corresponding right rules and elimination rules to a combination of the corresponding left rule, cut and/or identity.
Since typing in the session calculus identifies a distinguished channel along which a process offers a session, the translation of \(\lambda \)terms is parameterised by a “result” channel along which the behaviour of the \(\lambda \)term is implemented. Given a \(\lambda \)term M, the process \(\llbracket M \rrbracket _z\) encodes the behaviour of M along the session channel z. We enforce that the type \(\mathbf {2}\) of booleans and its two constructors are consistently translated to their polymorphic Church encodings before applying the translation to Poly\(\pi \). Thus, type \(\mathbf {2}\) is first translated to Open image in new window , the value \(\mathsf {T}\) to Open image in new window and the value \(\mathsf {F}\) to Open image in new window . Such representations of the booleans are adequate up to parametricity [6] and suitable for our purposes of relating the session calculus (which has no primitive notion of value or result type) with the \(\lambda \)calculus precisely due to the tight correspondence between the two calculi.
Definition 3.2
To translate a (linear) \(\lambda \)abstraction \(\lambda x{:}A.M\), which corresponds to the proof term for the introduction rule for Open image in new window , we map it to the corresponding Open image in new window rule, thus obtaining a process \(z(x).\llbracket M\rrbracket _z\) that inputs along the result channel z a channel x which will be used in \(\llbracket M\rrbracket _z\) to access the function argument. To encode the application \(M\,N\), we compose (i.e. \(\mathsf {cut}\)) \(\llbracket M\rrbracket _x\), where x is a fresh name, with a process that provides the (encoded) function argument by outputting along x a channel y which offers the behaviour of \(\llbracket N\rrbracket _y\). After the output is performed, the type of x is now that of the function’s codomain and thus we conclude by forwarding (i.e. the \(\mathsf {id}\) rule) between x and the result channel z.
The encoding for polymorphism follows a similar pattern: To encode the abstraction \(\varLambda X.M\), we receive along the result channel a type that is bound to X and proceed inductively. To encode type application M[A] we encode the abstraction M in parallel with a process that sends A to it, and forwards accordingly. Finally, the encoding of the existential package Open image in new window maps to an output of the type A followed by the behaviour \(\llbracket M \rrbracket _z\), with the encoding of the elimination form Open image in new window composing the translation of the term of existential type M with a process performing the appropriate type input and proceeding as \(\llbracket N \rrbracket _z\).
Example 3.3
Theorem 3.4

If \(\varOmega ; \varGamma ; \varDelta \vdash M : A\) and \(M \xrightarrow {} N\) then \(\llbracket M \rrbracket _z {\mathop {\Longrightarrow }\limits ^{}} P\) such that Open image in new window

If \(\llbracket M \rrbracket _z \xrightarrow {} P\) then \(M \xrightarrow {}^+ N\) and Open image in new window
3.2 Encoding Session \(\pi \)calculus to LinearF
Definition 3.5
For instance, the encoding of a process Open image in new window , typed by rule Open image in new window , results in the corresponding Open image in new window introduction rule in the \(\lambda \)calculus and thus is Open image in new window . To encode the process \((\mathbf {\nu }y)x\langle y \rangle .(P \mid Q)\), typed by rule Open image in new window , we make use of substitution: Given that the subprocess Q is typed as \(\varOmega ; \varGamma ; \varDelta ' , x{:}B \vdash Q~{:}{:}~z{:}C\), the encoding of the full process is given by Open image in new window . The term Open image in new window consists of the application of x (of function type) to the argument Open image in new window , thus ensuring that the term resulting from the substitution is of the appropriate type. We note that, for instance, the encoding of rule \({{\otimes }\mathsf {L}}\) does not need to appeal to substitution – the \(\lambda \)calculus \(\mathsf {let}\) style rules can be mapped directly. Similarly, rule \({{\forall }\mathsf {R}}\) is mapped to type abstraction, whereas rule \({{\forall }\mathsf {L}}\) which types a process of the form \(x\langle B \rangle .P\) maps to a substitution of the type application x[B] for x in Open image in new window . The encoding of existential polymorphism is simpler due to the \(\mathsf {let}\)style elimination. We also highlight the encoding of the \(\mathsf {cut}\) rule which embodies parallel composition of two processes sharing a linear name, which clarifies the use/offer duality of the intuitionistic calculus – the process that offers P is encoded and substituted into the encoded user Q.
Theorem 3.6
If \(\varOmega ; \varGamma ; \varDelta \vdash P~{:}{:}~z{:}A\) then Open image in new window .
Example 3.7
By the behaviour of \((\mathbf {\nu }z)(P\mid Q)\), which consists of a sequence of cuts, and its encoding, we have that Open image in new window and Open image in new window .
In general, the translation of Definition 3.5 can introduce some distance between the immediate operational behaviour of a process and its corresponding \(\lambda \)term, insofar as the translations of cuts (and left rules to non \(\mathsf {let}\)form elimination rules) make use of substitutions that can take place deep within the resulting term. Consider the process at the root of the following typing judgment Open image in new window , derivable through a \(\mathsf {cut}\) on session x between instances of Open image in new window and Open image in new window , where the continuation process \(w(z).\mathbf{0}\) offers a session Open image in new window (and so must use rule \({{\mathbf {1}}\mathsf {L}}\) on x). We have that: \((\mathbf {\nu }x)(x(y).P_1 \mid (\mathbf {\nu }y)x\langle y \rangle .(P_2 \mid w(z).\mathbf{0})) \xrightarrow {} (\mathbf {\nu }x,y)(P_1 \mid P_2 \mid w(z).\mathbf{0})\). However, the translation of the process above results in the term Open image in new window , where the redex that corresponds to the process reduction is present but hidden under the binder for z (corresponding to the input along w). Thus, to establish operational completeness we consider full \(\beta \)reduction, denoted by \(\xrightarrow {}_\beta \), i.e. enabling \(\beta \)reductions under binders.
Theorem 3.8
(Operational Completeness). Let \(\varOmega ; \varGamma ; \varDelta \vdash P~{:}{:}~z{:}A\). If \(P\xrightarrow {}Q\) then Open image in new window .
As shown in [36], commuting conversions are sound wrt observational equivalence, and thus we formulate operational soundness through a notion of extended process reduction, which extends process reduction with the reductions that are induced by commuting conversions. Such a relation was also used for similar purposes in [5] and in [26], in a classical linear logic setting. For conciseness, we define extended reduction as a relation on typed processes modulo \(\equiv \).
Definition 3.9
 1.
\(\mathcal {C}[(\mathbf {\nu }y)x\langle y\rangle .P] \mid x(y).Q \mapsto \mathcal {C}[(\mathbf {\nu }y)(P \mid Q)]\);
 2.
\(\mathcal {C}[(\mathbf {\nu }y)x\langle y \rangle .P] \mid \, !x(y).Q \mapsto \mathcal {C}[(\mathbf {\nu }y)(P \mid Q)] \mid \,!x(y).Q\); and
 3.
\((\mathbf {\nu }x)(!x(y).Q) \mapsto \mathbf {0}\)
Theorem 3.10
(Operational Soundness). Let \(\varOmega ; \varGamma ; \varDelta \vdash P~{:}{:}~z{:}A\) and Open image in new window , there exists Q such that \(P\mapsto ^* Q\) and Open image in new window .
3.3 Inversion and Full Abstraction
Having established the operational preciseness of the encodings toandfrom Poly\(\pi \) and LinearF, we establish our main results for the encodings. Specifically, we show that the encodings are mutually inverse upto behavioural equivalence (with fullness as its corollary), which then enables us to establish full abstraction for both encodings.
Theorem 3.11
(Inverse). If \(\varOmega ; \varGamma ; \varDelta \vdash M : A\) then Open image in new window . Also, if \(\varOmega ; \varGamma ; \varDelta \vdash P~{:}{:}~z{:}A\) then Open image in new window .
Corollary 3.12
(Fullness). Let \(\varOmega ; \varGamma ; \varDelta \vdash P~{:}{:}~z{:}A\). \(\exists M\) s.t. \(\varOmega ; \varGamma ; \varDelta \vdash M : A\) and \(\varOmega ; \varGamma ; \varDelta \vdash \llbracket M \rrbracket _z \approx _{\mathtt {L}}P~{:}{:}~z{:}A\) Also, let \(\varOmega ; \varGamma ; \varDelta \vdash M : A\). \(\exists P\) s.t. \(\varOmega ; \varGamma ; \varDelta \vdash P~{:}{:}~z{:}A\) and Open image in new window .
We now state our full abstraction results. Given two LinearF terms of the same type, equivalence in the image of the \(\llbracket {}\rrbracket _z\) translation can be used as a proof technique for contextual equivalence in LinearF. This is called the soundness direction of full abstraction in the literature [18] and proved by showing the relation generated by Open image in new window forms Open image in new window ; we then establish the completeness direction by contradiction, using fullness.
Theorem 3.13
(Full Abstraction). Open image in new window iff Open image in new window .
We can straightforwardly combine the above full abstraction with Theorem 3.11 to obtain full abstraction of the Open image in new window translation.
Theorem 3.14
(Full Abstraction). Open image in new window iff Open image in new window .
4 Applications of the Encodings
In this section we develop applications of the encodings of the previous sections. Taking advantage of full abstraction and mutual inversion, we apply nontrivial properties from the theory of the \(\lambda \)calculus to our sessiontyped process setting.
In § 4.1 we study inductive and coinductive sessions, arising through encodings of initial Falgebras and final Fcoalgebras in the polymorphic \(\lambda \)calculus.
In § 4.2 we study encodings for an extension of the core session calculus with term passing, where terms are derived from a simplytyped \(\lambda \)calculus. Using the development of § 4.2 as a stepping stone, we generalise the encodings to a higherorder session calculus (§ 4.3), where processes can send, receive and execute other processes. We show full abstraction and mutual inversion theorems for the encodings from higherorder to firstorder. As a consequence, we can straightforwardly derive a strong normalisation property for the higherorder processpassing calculus.
4.1 Inductive and Coinductive Session Types
The study of polymorphism in the \(\lambda \)calculus [1, 6, 19, 40] has shown that parametric polymorphism is expressive enough to encode both inductive and coinductive types in a precise way, through a faithful representation of initial and final (co)algebras [28], without extending the language of terms nor the semantics of the calculus, giving a logical justification to the Church encodings of inductive datatypes such as lists and natural numbers. The polymorphic session calculus can express fairly intricate communication behaviours, including generic protocols through both existential and universal polymorphism (i.e. protocols that are parametric in their subprotocols). Using our fully abstract encodings between the two calculi, we show that session polymorphism is expressive enough to encode inductive and coinductive sessions, “importing” the results for the \(\lambda \)calculus, which may then be instantiated to provide a sessiontyped formulation of the encodings of data structures in the \(\pi \)calculus of [30].
Inductive and Coinductive Types in System F. Exploring an algebraic interpretation of polymorphism where types are interpreted as functors, it can be shown that given a type F with a free variable X that occurs only positively (i.e. occurrences of X are on the lefthand side of an even number of function arrows), the polymorphic type \(\forall X.((F(X) \rightarrow X) \rightarrow X)\) forms an initial Falgebra [1, 42] (we write F(X) to denote that X occurs in F). This enables the representation of inductively defined structures using an algebraic or categorical justification. For instance, the natural numbers can be seen as the initial Falgebra of \(F(X) = \mathbf {1}+ X\) (where \(\mathbf {1}\) is the unit type and \(+\) is the coproduct), and are thus already present in System F, in a precise sense, as the type \(\forall X.((\mathbf {1}+ X) \rightarrow X) \rightarrow X\) (noting that both \(\mathbf {1}\) and \(+\) can also be encoded in System F). A similar story can be told for coinductively defined structures, which correspond to final Fcoalgebras and are representable with the polymorphic type \(\exists X. (X \rightarrow F(X)) \times X\), where \(\times \) is a product type. In the remainder of this section we assume the positivity requirement on F mentioned above.
Theorem 4.1
(Universality of \(\mathsf {foldP}\)). \(\forall Q\) such that Open image in new window we have Open image in new window
Theorem 4.2
(Universality of \(\mathsf {unfoldP}\)). \(\forall Q\) and Fcoalgebra A s.t \(\cdot ; \cdot ; y_1{:}A \vdash Q~{:}{:}~y_2 {:}T_f\) we have that Open image in new window .
Example 4.3
Example 4.4
4.2 Communicating Values – Sess\(\pi \lambda \)
At the level of processes, offering a session of type \(\tau \wedge A\) (i.e. a process of the form \(z\langle M \rangle .P\)) is encoded according to the translation of the type: we first send a fresh name x which will be used to access the encoding of the term M. Since M can be used an arbitrary number of times by the receiver, we guard the encoding of M with a replicated input, proceeding with the encoding of P accordingly. Using a session of type \(\tau \supset A\) follows the same principle. The input cases (and the rest of the process constructs) are completely homomorphic.
Lemma 4.5
(Compositionality). Let \(\varPsi , x{:}\tau \vdash M : \sigma \) and \(\varPsi \vdash N : \tau \). We have that Open image in new window
Theorem 4.6
 1.
If \(\varPsi \vdash M : \tau \) and \(\llbracket M\rrbracket _z \xrightarrow {} Q\) then \(M \xrightarrow {}^+ N\) such that Open image in new window
 2.
If \(\varPsi ; \varGamma ; \varDelta \vdash P~{:}{:}~z{:}A\) and \(\llbracket P \rrbracket \xrightarrow {} Q\) then \(P \xrightarrow {}^+ P'\) such that Open image in new window
 3.
If \(\varPsi \vdash M : \tau \) and \(M \xrightarrow {} N\) then \(\llbracket M \rrbracket _z {\mathop {\Longrightarrow }\limits ^{}} P\) such that Open image in new window
 4.
If \(\varPsi ; \varGamma ; \varDelta \vdash P~{:}{:}~z{:}A\) and \(P \xrightarrow {} Q\) then \(\llbracket P \rrbracket \xrightarrow {}^+ R\) with Open image in new window
The process equivalence in Theorem 4.6 above need not be extended to account for data (although it would be relatively simple to do so), since the processes in the image of the encoding are fully erased of any data elements.
Relating the Two Encodings. We prove the two encodings are mutually inverse and preserve the full abstraction properties (we write \(=_\beta \) and \(=_{\beta \eta }\) for \(\beta \) and \(\beta \eta \)equivalence, respectively).
Theorem 4.7
(Inverse). If \(\varPsi ; \varGamma ; \varDelta \vdash P~{:}{:}~z{:}A\) then Open image in new window . Also, if \(\varPsi \vdash M : \tau \) then Open image in new window .
The equivalences above are formulated between the composition of the encodings applied to P (resp. M) and the process (resp. \(\lambda \)term) after applying the translation embedding the nonlinear components into their linear counterparts. This formulation matches more closely that of § 3.3, which applies to linear calculi for which the target languages of this section are a strict subset (and avoids the formalisation of process equivalence with terms). We also note that in this setting, observational equivalence and \(\beta \eta \)equivalence coincide [3, 31]. Moreover, the extensional flavour of Open image in new window includes \(\eta \)like principles at the process level.
Theorem 4.8
Let \(\cdot \vdash M : \tau \) and \(\cdot \vdash N : \tau \). Open image in new window iff Open image in new window . Also, let \(\cdot \vdash P~{:}{:}~z{:}A\) and \(\cdot \vdash Q~{:}{:} ~z{:}A\). We have that Open image in new window iff Open image in new window .
We establish full abstraction for the encoding of \(\lambda \)terms into processes (Theorem 4.8) in two steps: The completeness direction (i.e. from lefttoright) follows from operational completeness and strong normalisation of the \(\lambda \)calculus. The soundness direction uses operational soundness. The proof of Theorem 4.8 uses the same strategy of Theorem 3.14, appealing to the inverse theorems.
4.3 HigherOrder Session Processes – Sess\(\pi \lambda ^+\)
Theorem 4.9
(Strong Normalisation). Let \(\varPsi ; \varGamma ; \varDelta \vdash P~{:}{:}~z{:}A\). There is no infinite reduction sequence starting from P.
Theorem 4.10
(Inverse Encodings). If \(\varPsi ; \varGamma ; \varDelta \vdash P~{:}{:}~z{:}A\) then Open image in new window . Also, if \(\varPsi \vdash M : \tau \) then Open image in new window .
Theorem 4.11
Let \(\vdash M : \tau \), \(\vdash N : \tau \), \(\vdash P~{:}{:}~z{:}A\) and \( \vdash Q~{:}{:}~z{:}A\). Open image in new window iff Open image in new window and Open image in new window iff Open image in new window .
5 Related Work and Concluding Remarks
Process Encodings of Functions. Toninho et al. [49] study encodings of the simplytyped \(\lambda \)calculus in a logically motivated session \(\pi \)calculus, via encodings to the linear \(\lambda \)calculus. Our work differs since they do not study polymorphism nor reverse encodings; and we provide deeper insights through applications of the encodings. Full abstraction or inverse properties are not studied.
Sangiorgi [43] uses a fully abstract compilation from the higherorder \(\pi \)calculus (HO\(\pi \)) to the \(\pi \)calculus to study full abstraction for Milner’s encodings of the \(\lambda \)calculus. The work shows that Milner’s encoding of the lazy \(\lambda \)calculus can be recovered by restricting the semantic domain of processes (the socalled restrictive approach) or by enriching the \(\lambda \)calculus with suitable constants. This work was later refined in [45], which does not use HO\(\pi \) and considers an operational equivalence on \(\lambda \)terms called open applicative bisimulation which coincides with LévyLongo tree equality. The work [47] studies general conditions under which encodings of the \(\lambda \)calculus in the \(\pi \)calculus are fully abstract wrt LévyLongo and Böhm Trees, which are then applied to several encodings of (callbyname) \(\lambda \)calculus. The works above deal with untyped calculi, and so reverse encodings are unfeasible. In a broader sense, our approach takes the restrictive approach using linear logicbased session typing and the induced observational equivalence. We use a \(\lambda \)calculus with booleans as observables and reason with a Morrisstyle equivalence instead of tree equalities. It would be an interesting future work to apply the conditions in [47] in our typed setting.
Wadler [54] shows a correspondence between a linear functional language with session types GV and a sessiontyped process calculus with polymorphism based on classical linear logic CP. Along the lines of this work, Lindley and Morris [26], in an exploration of inductive and coinductive session types through the addition of least and greatest fixed points to CP and GV, develop an encoding from a linear \(\lambda \)calculus with session primitives (Concurrent \(\mu \)GV) to a pure linear \(\lambda \)calculus (Functional \(\mu \)GV) via a CPS transformation. They also develop translations between \(\mu \)CP and Concurrent \(\mu \)GV, extending [25]. Mapping to the terminology used in our work [17], their encodings are shown to be operationally complete, but no results are shown for the operational soundness directions and neither full abstraction nor inverse properties are studied. In addition, their operational characterisations do not compose across encodings. For instance, while strong normalisation of Functional \(\mu \)GV implies the same property for Concurrent \(\mu \)GV through their operationally complete encoding, the encoding from \(\mu \)CP to \(\mu \)GV does not necessarily preserve this property.
Types for \(\pi \)calculi delineate sequential behaviours by restricting composition and name usages, limiting the contexts in which processes can interact. Therefore typed equivalences offer a coarser semantics than untyped semantics. Berger et al. [5] study an encoding of System F in a polymorphic linear \(\pi \)calculus, showing it to be fully abstract based on game semantics techniques. Their typing system and proofs are more complex due to the finegrained constraints from game semantics. Moreover, they do not study a reverse encoding. Orchard and Yoshida [33] develop embeddings toandfrom PCF with parallel effects and a sessiontyped \(\pi \)calculus, but only develop operational correspondence and semantic soundness results, leaving the full abstraction problem open.
Polymorphism and Typed Behavioural Semantics. The work of [7] studies parametric session polymorphism for the intuitionistic setting, developing a behavioural equivalence that captures parametricity, which is used (denoted as Open image in new window ) in our paper. The work [39] introduces a typed bisimilarity for polymorphism in the \(\pi \)calculus. Their bisimilarity is of an intensional flavour, whereas the one used in our work follows the extensional style of Reynolds [41]. Their typing discipline (originally from [53], which also develops typepreserving encodings of polymorphic \(\lambda \)calculus into polymorphic \(\pi \)calculus) differs significantly from the linear logicbased session typing of our work (e.g. theirs does not ensure deadlockfreedom). A key observation in their work is the coarser nature of typed equivalences with polymorphism (in analogy to those for IOsubtyping [38]) and their interaction with channel aliasing, suggesting a use of typed semantics and encodings of the \(\pi \)calculus for finegrained analyses of program behaviour.
FAlgebras and LinearF. The use of initial and final (co)algebras to give a semantics to inductive and coinductive types dates back to Mendler [28], with their strong definability in System F appearing in [1, 19]. The definability of inductive and coinductive types using parametricity also appears in [40] in the context of a logic for parametric polymorphism and later in [6] in a linear variant of such a logic. The work of [55] studies parametricity for the polymorphic linear \(\lambda \)calculus of this work, developing encodings of a few inductive types but not the initial (or final) algebraic encodings in their full generality. Inductive and coinductive session types in a logical process setting appear in [26, 51]. Both works consider a calculus with builtin recursion – the former in an intuitionistic setting where a process that offers a (co)inductive protocol is composed with another that consumes the (co)inductive protocol and the latter in a classical framework where composed recursive session types are dual each other.
Conclusion and Future Work. This work answers the question of what kind of type discipline of the \(\pi \)calculus can exactly capture and is captured by \(\lambda \)calculus behaviours. Our answer is given by showing the first mutually inverse and fully abstract encodings between two calculi with polymorphism, one being the Poly\(\pi \) session calculus based on intuitionistic linear logic, and the other (a linear) System F. This further demonstrates that the linear logicbased articulation of namepassing interactions originally proposed by [8] (and studied extensively thereafter e.g. [7, 9, 25, 36, 50, 51, 54]) provides a clear and applicable tool for messagepassing concurrency. By exploiting the proof theoretic equivalences between natural deduction and sequent calculus we develop mutually inverse and fully abstract encodings, which naturally extend to more intricate settings such as process passing (in the sense of HO\(\pi \)). Our encodings also enable us to derive properties of the \(\pi \)calculi “for free”. Specifically, we show how to obtain adequate representations of least and greatest fixed points in Poly\(\pi \) through the encoding of initial and final (co)algebras in the \(\lambda \)calculus. We also straightforwardly derive a strong normalisation result for the higherorder session calculus, which otherwise involves nontrivial proof techniques [5, 7, 12, 13, 36]. Future work includes extensions to the classical linear logicbased framework, including multiparty session types [10, 11]. Encodings of session \(\pi \)calculi to the \(\lambda \)calculus have been used to implement session primitives in functional languages such as Haskell (see a recent survey [32]), OCaml [24, 34, 35] and Scala [48]. Following this line of work, we plan to develop encodingbased implementations of this work as embedded DSLs. This would potentially enable an exploration of algebraic constructs beyond initial and final coalgebras in a session programming setting. In particular, we wish to further study the meaning of functors, natural transformations and related constructions in a sessiontyped setting, both from a more fundamental viewpoint but also in terms of programming patterns.
Footnotes
 1.
For simplicity, in this section, we define the process semantics through a reduction relation.
Notes
Acknowledgements
The authors thank Viviana Bono, Dominic Orchard and the reviewers for their comments, suggestions and pointers to related works. This work is partially supported by EPSRC EP/K034413/1, EP/K011715/1, EP/L00058X/1, EP/N027833/1, EP/N028201/1 and NOVA LINCS (UID/CEC/04516/2013).
References
 1.Bainbridge, E.S., Freyd, P.J., Scedrov, A., Scott, P.J.: Functorial polymorphism. Theor. Comput. Sci. 70(1), 35–64 (1990)MathSciNetCrossRefGoogle Scholar
 2.Balzer, S., Pfenning, F.: Manifest sharing with session types. In: ICFP (2017)Google Scholar
 3.Barber, A.: Dual intuitionistic linear logic. Technical report ECSLFCS96347. School of Informatics, University of Edinburgh (1996)Google Scholar
 4.Benton, P.N.: A mixed linear and nonlinear logic: proofs, terms and models. In: Pacholski, L., Tiuryn, J. (eds.) CSL 1994. LNCS, vol. 933, pp. 121–135. Springer, Heidelberg (1995). https://doi.org/10.1007/BFb0022251CrossRefMATHGoogle Scholar
 5.Berger, M., Honda, K., Yoshida, N.: Genericity and the \({\pi }\)calculus. Acta Inf. 42(2–3), 83–141 (2005)MathSciNetCrossRefGoogle Scholar
 6.Birkedal, L., Møgelberg, R.E., Petersen, R.L.: Linear abadi and plotkin logic. Log. Methods Comput. Sci. 2(5), 1–48 (2006)MathSciNetMATHGoogle Scholar
 7.Caires, L., Pérez, J.A., Pfenning, F., Toninho, B.: Behavioral polymorphism and parametricity in sessionbased communication. In: Felleisen, M., Gardner, P. (eds.) ESOP 2013. LNCS, vol. 7792, pp. 330–349. Springer, Heidelberg (2013). https://doi.org/10.1007/9783642370366_19CrossRefMATHGoogle Scholar
 8.Caires, L., Pfenning, F.: Session types as intuitionistic linear propositions. In: Gastin, P., Laroussinie, F. (eds.) CONCUR 2010. LNCS, vol. 6269, pp. 222–236. Springer, Heidelberg (2010). https://doi.org/10.1007/9783642153754_16CrossRefGoogle Scholar
 9.Caires, L., Pfenning, F., Toninho, B.: Linear logic propositions as session types. Math. Struct. Comput. Sci. 26(3), 367–423 (2016)MathSciNetCrossRefGoogle Scholar
 10.Carbone, M., Lindley, S., Montesi, F., Schuermann, C., Wadler, P.: Coherence generalises duality: a logical explanation of multiparty session types. In: CONCUR 2016, vol. 59, pp. 33:1–33:15. Sch. Dag. (2016)Google Scholar
 11.Carbone, M., Montesi, F., Schurmann, C., Yoshida, N.: Multiparty session types as coherence proofs. In: CONCUR 2015, vol. 42, pp. 412–426. Sch. Dag. (2015)Google Scholar
 12.Demangeon, R., Hirschkoff, D., Sangiorgi, D.: Mobile processes and termination. In: Palsberg, J. (ed.) Semantics and Algebraic Specification. LNCS, vol. 5700, pp. 250–273. Springer, Heidelberg (2009). https://doi.org/10.1007/9783642041648_13CrossRefMATHGoogle Scholar
 13.Demangeon, R., Hirschkoff, D., Sangiorgi, D.: Termination in higherorder concurrent calculi. J. Log. Algebr. Program. 79(7), 550–577 (2010)MathSciNetCrossRefGoogle Scholar
 14.Gentzen, G.: Untersuchungen über das logische schließen. Math. Z. 39, 176–210 (1935)MathSciNetCrossRefGoogle Scholar
 15.Girard, J.: Linear logic. Theor. Comput. Sci. 50, 1–102 (1987)MathSciNetCrossRefGoogle Scholar
 16.Girard, J., Lafont, Y., Taylor, P.: Proofs and Types. CUP, Cambridge (1989)MATHGoogle Scholar
 17.Gorla, D.: Towards a unified approach to encodability and separation results for process calculi. Inf. Comput. 208(9), 1031–1053 (2010)MathSciNetCrossRefGoogle Scholar
 18.Gorla, D., Nestmann, U.: Full abstraction for expressiveness: history, myths and facts. Math. Struct. Comput. Sci. 26(4), 639–654 (2016)MathSciNetCrossRefGoogle Scholar
 19.Hasegawa, R.: Categorical data types in parametric polymorphism. Math. Struct. Comput. Sci. 4(1), 71–109 (1994)MathSciNetCrossRefGoogle Scholar
 20.Honda, K.: Types for dyadic interaction. In: Best, E. (ed.) CONCUR 1993. LNCS, vol. 715, pp. 509–523. Springer, Heidelberg (1993). https://doi.org/10.1007/3540572082_35CrossRefGoogle Scholar
 21.Honda, K.: Session types and distributed computing. In: Czumaj, A., Mehlhorn, K., Pitts, A., Wattenhofer, R. (eds.) ICALP 2012. LNCS, vol. 7392, pp. 23–23. Springer, Heidelberg (2012). https://doi.org/10.1007/9783642315855_4CrossRefGoogle Scholar
 22.Honda, K., Vasconcelos, V.T., Kubo, M.: Language primitives and type discipline for structured communicationbased programming. In: Hankin, C. (ed.) ESOP 1998. LNCS, vol. 1381, pp. 122–138. Springer, Heidelberg (1998). https://doi.org/10.1007/BFb0053567CrossRefGoogle Scholar
 23.Honda, K., Yoshida, N., Carbone, M.: Multiparty asynchronous session types. In: POPL 2008, pp. 273–284 (2008)Google Scholar
 24.Imai, K., Yoshida, N., Yuen, S.: Sessionocaml: a sessionbased library with polarities and lenses. In: Jacquet, J.M., Massink, M. (eds.) COORDINATION 2017. LNCS, vol. 10319, pp. 99–118. Springer, Cham (2017). https://doi.org/10.1007/9783319597461_6CrossRefGoogle Scholar
 25.Lindley, S., Morris, J.G.: A semantics for propositions as sessions. In: Vitek, J. (ed.) ESOP 2015. LNCS, vol. 9032, pp. 560–584. Springer, Heidelberg (2015). https://doi.org/10.1007/9783662466698_23CrossRefGoogle Scholar
 26.Lindley, S., Morris, J.G.: Talking bananas: structural recursion for session types. In: ICFP 2016, pp. 434–447 (2016)MathSciNetCrossRefGoogle Scholar
 27.Maraist, J., Odersky, M., Turner, D.N., Wadler, P.: Callbyname, callbyvalue, callbyneed and the linear lambda calculus. T. C. S. 228(1–2), 175–210 (1999)MathSciNetMATHGoogle Scholar
 28.Mendler, N.P.: Recursive types and type constraints in secondorder lambda calculus. In: LICS 1987, pp. 30–36 (1987)Google Scholar
 29.Milner, R.: Functions as processes. In: Paterson, M.S. (ed.) ICALP 1990. LNCS, vol. 443, pp. 167–180. Springer, Heidelberg (1990). https://doi.org/10.1007/BFb0032030CrossRefGoogle Scholar
 30.Milner, R., Parrow, J., Walker, D.: A calculus of mobile processes I and II. Inf. Comput. 100(1), 1–77 (1992)MathSciNetCrossRefGoogle Scholar
 31.Ohta, Y., Hasegawa, M.: A terminating and confluent linear lambda calculus. In: Pfenning, F. (ed.) RTA 2006. LNCS, vol. 4098, pp. 166–180. Springer, Heidelberg (2006). https://doi.org/10.1007/11805618_13CrossRefMATHGoogle Scholar
 32.Orchard, D., Yoshida, N.: Session types with linearity in Haskell. In: Gay, S., Ravara, A. (eds.) Behavioural Types: From Theory to Tools. River Publishers, Gistrup (2017)Google Scholar
 33.Orchard, D.A., Yoshida, N.: Effects as sessions, sessions as effects. In: POPL 2016, pp. 568–581 (2016)CrossRefGoogle Scholar
 34.Padovani, L.: A Simple Library Implementation of Binary Sessions. JFP 27 (2016)Google Scholar
 35.Padovani, L.: Contextfree session type inference. In: Yang, H. (ed.) ESOP 2017. LNCS, vol. 10201, pp. 804–830. Springer, Heidelberg (2017). https://doi.org/10.1007/9783662544341_30CrossRefGoogle Scholar
 36.Pérez, J.A., Caires, L., Pfenning, F., Toninho, B.: Linear logical relations for sessionbased concurrency. In: Seidl, H. (ed.) ESOP 2012. LNCS, vol. 7211, pp. 539–558. Springer, Heidelberg (2012). https://doi.org/10.1007/9783642288692_27CrossRefGoogle Scholar
 37.Pfenning, F., Griffith, D.: Polarized substructural session types. In: Pitts, A. (ed.) FoSSaCS 2015. LNCS, vol. 9034, pp. 3–22. Springer, Heidelberg (2015). https://doi.org/10.1007/9783662466780_1CrossRefGoogle Scholar
 38.Pierce, B.C., Sangiorgi, D.: Typing and subtyping for mobile processes. Math. Struct. Comput. Sci. 6(5), 409–453 (1996)MathSciNetMATHGoogle Scholar
 39.Pierce, B.C., Sangiorgi, D.: Behavioral equivalence in the polymorphic picalculus. J. ACM 47(3), 531–584 (2000)MathSciNetCrossRefGoogle Scholar
 40.Plotkin, G., Abadi, M.: A logic for parametric polymorphism. In: Bezem, M., Groote, J.F. (eds.) TLCA 1993. LNCS, vol. 664, pp. 361–375. Springer, Heidelberg (1993). https://doi.org/10.1007/BFb0037118CrossRefGoogle Scholar
 41.Reynolds, J.C.: Types, abstraction and parametric polymorphism. In: IFIP Congress, pp. 513–523 (1983)Google Scholar
 42.Reynolds, J.C., Plotkin, G.D.: On functors expressible in the polymorphic typed lambda calculus. Inf. Comput. 105(1), 1–29 (1993)MathSciNetCrossRefGoogle Scholar
 43.Sangiorgi, D.: An investigation into functions as processes. In: Brookes, S., Main, M., Melton, A., Mislove, M., Schmidt, D. (eds.) MFPS 1993. LNCS, vol. 802, pp. 143–159. Springer, Heidelberg (1994). https://doi.org/10.1007/3540580271_7CrossRefGoogle Scholar
 44.Sangiorgi, D.: \({\Pi }\)calculus, internal mobility, and agentpassing calculi. Theor. Comput. Sci. 167(1&2), 235–274 (1996)MathSciNetCrossRefGoogle Scholar
 45.Sangiorgi, D.: Lazy functions and mobile processes. In: Proof, Language, and Interaction: Essays in Honour of Robin Milner, pp. 691–720 (2000)Google Scholar
 46.Sangiorgi, D., Walker, D.: The \({\pi }\)Calculus: A Theory of Mobile Processes. Cambridge University Press, Cambridge (2001)MATHGoogle Scholar
 47.Sangiorgi, D., Xu, X.: Trees from functions as processes. In: Baldan, P., Gorla, D. (eds.) CONCUR 2014. LNCS, vol. 8704, pp. 78–92. Springer, Heidelberg (2014). https://doi.org/10.1007/9783662445846_7CrossRefGoogle Scholar
 48.Scalas, A., Dardha, O., Hu, R., Yoshida, N.: A linear decomposition of multiparty sessions for safe distributed programming. In: ECOOP 2017 (2017)Google Scholar
 49.Toninho, B., Caires, L., Pfenning, F.: Functions as sessiontyped processes. In: Birkedal, L. (ed.) FoSSaCS 2012. LNCS, vol. 7213, pp. 346–360. Springer, Heidelberg (2012). https://doi.org/10.1007/9783642287299_23CrossRefGoogle Scholar
 50.Toninho, B., Caires, L., Pfenning, F.: Higherorder processes, functions, and sessions: a monadic integration. In: Felleisen, M., Gardner, P. (eds.) ESOP 2013. LNCS, vol. 7792, pp. 350–369. Springer, Heidelberg (2013). https://doi.org/10.1007/9783642370366_20CrossRefMATHGoogle Scholar
 51.Toninho, B., Caires, L., Pfenning, F.: Corecursion and nondivergence in sessiontyped processes. In: Maffei, M., Tuosto, E. (eds.) TGC 2014. LNCS, vol. 8902, pp. 159–175. Springer, Heidelberg (2014). https://doi.org/10.1007/9783662459171_11CrossRefGoogle Scholar
 52.Toninho, B., Yoshida, N.: On polymorphic sessions and functions: a tale of two (fully abstract) encodings (long version). CoRR abs/1711.00878 (2017)Google Scholar
 53.Turner, D.: The polymorphic picalculus: Theory and implementation. Technical report ECSLFCS96345. School of Informatics, University of Edinburgh (1996)Google Scholar
 54.Wadler, P.: Propositions as sessions. J. Funct. Program. 24(2–3), 384–418 (2014)MathSciNetCrossRefGoogle Scholar
 55.Zhao, J., Zhang, Q., Zdancewic, S.: Relational parametricity for a polymorphic linear lambda calculus. In: Ueda, K. (ed.) APLAS 2010. LNCS, vol. 6461, pp. 344–359. Springer, Heidelberg (2010). https://doi.org/10.1007/9783642171642_24CrossRefGoogle Scholar
Copyright information
Open Access This chapter is licensed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license and indicate if changes were made. The images or other third party material in this book are included in the book's Creative Commons license, unless indicated otherwise in a credit line to the material. If material is not included in the book's Creative Commons license and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder.