Session types are a popular approach to typing message-passing concurrency [11, 18, 12]. They describe communication over channels as sequences of communication actions. This way, e.g., the session type types a channel as follows: send an integer, receive a boolean, and close the channel. Due to its simplicity and expressiveness, the -calculus [16, 17]—the paradigmatic model of concurrency and interaction—is a widely used setting for studying session types.
In a line of work developed by Caires, Pfenning, Wadler, and several others, the theory of session types has been given strong logical foundations. Caires and Pfenning discovered a Curry-Howard correspondence between a form of session types for the -calculus and Girard’s linear logic : session types correspond to linear logic propositions, type inference rules to sequent calculus, and communication to cut reduction . The resulting session type system ensures important correctness properties for communicating processes: protocol fidelity, communication safety, deadlock freedom, and strong normalization.
As in standard logic, there are two “schools” of linear logic: classical  and intuitionistic . The differences between classical and intuitionistic linear logic are known—see, e.g., [6, 13]. This dichotomy also appears in the logical foundations of session types: while Caires and Pfenning’s correspondence relies on intuitionistic linear logic , Wadler developed a correspondence based on classical linear logic . Superficial differences between the resulting type systems include the number of typing rules (the intuitionistic system has roughly twice as many rules as the classical system) and the shape/meaning of typing judgments (in the intuitionistic system, judgments have a rely-guarantee reading not present in the classical system). In turn, these differences follow from the way in which each system internalizes duality: the classical system provides a more explicit account of duality than the intuitionistic system.
We are interested in going beyond these superficial differences, so as to establish a formal comparison between the two type systems. This seems to us an indispensable step in consolidating the logical foundations of message-passing concurrency. To our knowledge, the only available comparison is informal: Caires, Pfenning, and Toninho  observed that a more fundamental difference concerns the locality principle for shared channels. The principle states that received channels cannot be used for further reception, i.e., only the output capability of channels can be sent . In session-based concurrency, shared channels define services; clients connect to services by sending a linear channel. Locality of shared channels therefore means that received channels cannot be used to provide a service. Well-known from a foundational perspective, locality has been promoted as a sensible principle for distributed implementations of (object-oriented) languages based on the -calculus . The observation in  is that Caires and Pfenning’s intuitionistic interpretation of session types enforces locality of shared channels , whereas Wadler’s classical interpretation does not: processes that break locality are well-typed in .
The existence of a class of processes that is typable in one system but not in the other immediately frames the desired formal comparison as an expressiveness question: the type system in  can be considered to be more expressive than the one in . To formally examine this question, the first step is defining a basic framework of reference in which both type systems can be objectively compared. To this end, we build upon Girard’s Logic of Unity , which subsumes classical, intuitionistic and linear logic in one system. In the same spirit, we develop United Linear Logic (): a logic that subsumes classical and intuitionistic linear logic. Following the Curry-Howard correspondence by Caires and Pfenning, we interpret as a session type system for the -calculus, dubbed . The class of -typable processes therefore contains processes induced by type systems derived from both intuitionistic and classical interpretations of linear logic. Using , we corroborate and formalize Caires, Pfenning, and Toninho’s observation as inclusions between classes of typable processes: our technical results are that (i) precisely captures the class of processes typable under the classical interpretation and that (ii) the class of processes typable under the intuitionistic interpretation is strictly included in .
This paper is structured as follows. In Section 2 we introduce , explain the Curry-Howard interpretation as the session type system , and detail the correctness properties for processes derived by typing. Section 3 formally establishes the differences between the classical and intuitionistic interpretations of linear logic as session type systems. Section 4 concludes the paper.
2 United Linear Logic as a Session Type System
In this section, we introduce United Linear Logic (), a logic based on the linear fragment of Girard’s Logic of Unity . We present as a session type system for the -calculus [16, 17], dubbed , following the Curry-Howard correspondences established by Caires and Pfenning  and by Wadler .
Propositions / Types.
Propositions in correspond to session types in ; they are defined as follows:
propositions / types are generated by the following grammar:
Session types represent sequences of communication actions that should be performed along channels. Table 1 gives the intuitive reading of the interpretation of propositions as session types. Note that there are two types for reception: from classical and from intuitionistic linear logic.
|and||Close the channel|
|Send a channel of type and continue as|
|and||Receive a channel of type and continue as|
|Repeatedly provide a service of type|
|Connect to a service of type|
does not include the additives and of linear logic. Although the Logic of Unity does include these connectives, we leave them out from (and ), because their interpretation as session types—internal and external choice, respectively—largely coincides in many presentations of logic-based session types. Therefore they are not particularly insightful in our formal comparison. They can be easily accommodated in , with the possibility of choosing between binary choice (as in e.g. [3, 5]) and -ary choice (as in e.g. [19, 4]).
The duality of propositions is given in Definition 2.2. In duality is reflected by the intended reciprocity of protocols between two parties: when a process on one side of a channel sends, the process on the opposite side must receive, and vice versa.
Duality () is given by the following set of equations:
It is easy to see that duality is an involution: . As usual, we decree that . From this, we can derive the relation between and by means of their duals:
is a type system for the -calculus processes defined as follows:
Process terms are generated by the following grammar:
Process constructs for inaction , channel restriction , and parallel composition have standard readings. The same applies to constructs for output, input, and replicated input prefixes, which are denoted , , and , respectively. Process denotes a forwarder that “fuses” channels and . We consider also constructs and , which specify the explicit closing of channels: their synchronization represents the explicit de-allocation of linear resources. These constructs result from the non-silent interpretation of , which, as explained in , leads to a Curry-Howard correspondence that is stronger than correspondences with silent interpretations of (such as those in [3, 5]).
Processes can be syntactically different, but still exhibit the same behavior. Such processes are structurally congruent, in the sense of the following definition:
Structural congruence () is given by the following set of equations, where denotes equality up to capture-avoiding -conversion, and gives the set of free names in , i.e. the complement of : the names in bound by restriction and (replicated) input and :
In a Curry-Howard correspondence, computation is related to cut reduction in the logic. Cut reduction removes cuts from an inference tree, which reduces the size of the tree without changing the result of the inference. In the correspondence between linear logic and the -calculus, cut reduction is related to communication, defined by the following reduction relation:
Reduction of process terms () is given by the following relation:
The inference system of is a sequent calculus with sequents of the form in which is a collection of propositions that can be indefinitely used, and and collect propositions that must be used linearly (exactly once). With respect to the Logic of Unity, we added a left rule for and a right rule for , and removed rules that allow propositions to switch sides in a sequent.
’s typing inference system annotates sequents with process terms and channel names to form typing judgments of the following form:
In this interpretation, (resp. and ), the unrestricted (resp. linear) context of , consists of assignments of the form , where is a channel and is a proposition/type. In a correct inference, these contexts together contain exactly the free channel names of the process term . We write to denote an empty context. ’s inference rules are given in Figure 1. Note that some rules are labeled with an ‘’, which we use to distinguish a class of rules to be used in the formal comparison in the next section.
Cut reduction and identity expansion.
Caires, Pfenning, and Toninho  showed that the validity of session type interpretations of linear logic propositions can be demonstrated by checking that cut reductions in typing inferences do correspond to reductions of processes, as well as by showing that the identity axiom of any type can be expanded to a larger process term with forwarding of a smaller type. Following this approach, can be shown valid for all reductions, using CutR as well as CutL, and expansions, using IdR as well as IdL.
As is usual for Curry-Howard correspondences for concurrency, the cut elimination property of linear logic means that has the soundness/subject reduction (Theorem 2.1) and progress (Theorem 2.2) properties.
If and , then .
By induction on the structure of the proof of , using cut reduction. ∎
For any process , if and only if there are processes and and channels such that , where .
If and , then there exists such that .
The liveness assumption tells us that is a parallel composition of a process that is guarded by some non-persistent communication and some other process . The fact that ’s proof has an empty context allows us to infer that and must have been composed using a Cut rule and that must be guarded by a prefix that is dual to . Therefore, a reduction can take place. ∎
3 Comparing Expressivity through United Linear Logic
is a suitable framework for a rigorous comparison of the expressivity of session type systems based on linear logic. In this section, we compare the class of processes typable in to the classes of processes typable in a classical and intuitionistic interpretation of linear logic. For this comparison to be fair, the differences between these classes need to come only from typing, so the process languages need to be the same. This means that our classical and intuitionistic interpretations need to type process terms as given in the previous section, with the same features as those in : explicit closing, a separate unrestricted context, and identity as forwarding.
|Explicit closing||Separate unrestricted context||Identity as forwarding|
Our intuitionistic and classical session type interpretations of linear logic are denoted and , respectively. Their respective rules are given in Figure 3 and Figure 3. is based on the work by Caires, Pfenning and Toninho .
It is worth noticing that, because of the features we require for our type systems, we could not directly base our classical interpretation on by Caires, Pfenning and Toninho  nor on Wadler’s . Therefore, we have designed as a combination of features from and . Table 2 compares these features in , and ; the differences are merely superficial:
Explicit closing of sessions concerns a non-silent interpretation of and in the logic that entails a reduction on processes (which, in turn, corresponds to cut reduction). In contrast, implicit closing is due to a silent interpretation and corresponds to (structural) congruences in processes.
Sequents with a separate unrestricted context are of the form , which can also be written as where contains only types of the form .
The identity axiom can be interpreted as the forwarding process, which enables to account for polymorphism. The forwarding process, however, is not usually present in session -calculi.
Before we study the expressivity of these three systems, it is important to take note of the difference in the forms of their typing judgments. For , , and , respectively, they are as follows:
has one-sided sequents, whereas has two-sided sequents (like ), but with exactly one channel/type pair on the right of the turnstile. Compare, for example, ’s inference rule for and the rules for and (see Figure 1):
Locality is a well-known principle in concurrency research . The idea is that freshly created channels are local. Local channels are modifiable, in the sense that they can be used for inputs. Once a channel has been transmitted to another location, it becomes non-local, and thus immutable: it can only be used for outputs—inputs are no longer allowed. This makes locality particularly relevant for giving formal semantics to distributed programming languages; a prime example is the join calculus , whose theory relies on (and is deeply influenced by) the locality principle .
guarantees locality for shared channels: a server can be defined using a replicated input, so the channel on which this server would be provided cannot be received earlier in the process. Consider the following example, taken from :
Let us attempt to find a typing for in this process using . We can apply the cut rule to split the parallel composition, of which the left component is . Now, there are two rules we can apply (read bottom-up):
In both cases, the received channel ends up on the left of the turnstile. There are no rules in to define a service on a channel on the left and there is no way to move the channel to the right. Hence, we cannot find a typing for in . In contrast, this process can be typed in as follows, given :
() () ()
The rely-guarantee distinction of is what makes it enforce locality for shared channels. The distinction is visible in ’s distinction between left and right in its judgments. Despite the two-sidedness of its sequents, can also type non-local processes. This is due to the full symmetry in the inference rules: anything that can be done on the left of the turnstile can be done on the right. As we will show formally in the rest of this section, this symmetry corresponds to the single-sidedness of : and can type exactly the same processes. We will also show formally that , and thus , can type more processes than , because of the restriction of the right side of the turnstile to exactly one channel/type pair, making an asymmetrical typing system.
Our formal results rely on the sets of processes typable in the three typing systems, given in Definition 3.1.
Let denote the set of all processes induced by Definition 2.3. Then
Our first observation is that all -typable processes are -typable. Moreover, the reverse is true as well. For the latter fact we need to convert a typing inference with one-sided sequents to a two-sided system, which means that we need the ability to control the side of the turnstile specific propositions end up on. This is taken care of by Lemma 3.1, which is an extension of [5, Prop.5.1, p.19] to include exponential types ( and ). The main result, Theorem 3.2, is that and type exactly the same processes.
For any typing contexts and process such that , we have .
By induction on the structure of the type inference tree. If the last inferred proposition is to be moved to the left, after type inversion, the appropriate left rule can be used where a right rule was used. Other propositions can be moved using the induction hypothesis. ∎
There are two things to prove: , and . (i) can be proven by induction on the structure of the typing inferences. The idea is that for every rule of there is an analogous rule in . As for (ii), for any such that , it suffices to show that there are such that . This can be done by induction on the structure of the typing inference of . After type inversion, the induction hypothesis can be used, which moves channel/type pairs to either side of the turnstile. This results in many subcases, each of which can be solved with appropriate applications of rule analogous to the last used rule, using Lemma 3.1 in some cases. ∎
The comparison between and can be done similarly. However, it is more interesting to examine the set of inference rules. If we restrict all sequents in a typing inference to have exactly one channel/type on the right of the turnstile, we end up with a subset of usable inference rules: those marked with an ‘’ in Figure 1. Upon further examination, we see that this set of rules coincides exactly with the set of inference rules for . The consequence is that can type all -typable processes. Finally, any /-typable process violating the locality principle suffices to show the second main result, Theorem 3.3: is less expressive than . An important corollary of Theorem 3.2 and Theorem 3.3 is that is less expressive than , confirming the observation by Caires, Pfenning, and Toninho .
Definition 3.2 (-degree).
The size of the right side of a sequent is the sequent’s -degree. Given contexts and process , the sequent has -degree .
By induction on the structure of the typing inference, it can be shown that all processes in have typing inferences using only those rules in Figure 1 marked with an . It follows by contradiction that the last applied rule cannot be without an , and the usage of -marked rules in the rest of the inference follows from the induction hypothesis. The -marked rules with -degree 1 coincide exactly with the typing inference rules of , and so it follows that . Clearly, is a subset of . Now, given , there are several ways to type the process in , but all of them use sequents of -degree different from 1, so it is not in . Hence, , confirming the thesis. ∎
Using Girard’s Logic of Unity  as a basis, we have developed United Linear Logic as a means to formally compare the session type systems derived from concurrent interpretations of classical and intuitionistic linear logic. Much as Logic of Unity is a logic that encompasses classical, intuitionistic and linear logic, the session type system interpretation of (dubbed ), can type all - and -typable processes. This allows us to compare type systems based on different linear logics.
In , judgments distinguish between several channels whose behavior is being relied on (on the left of the judgment) and a single behavior provided along a designated channel (on the right). To retain this rely-guarantee reading, uses two-sided sequents in its typing inferences. However, does not distinguish between the sides of its sequents; it is fully symmetrical. This symmetry allows it to mimic the single-sidedness of ’s sequents: placing a mirror besides ’s inference rules reveals the inference rules of . Similarly, can be recovered from by restricting the right side of its sequents to exactly one channel. Not all inference rules remain usable, resulting in an asymmetrical system that coincides exactly with .
Our results formally corroborate the observation by Caires, Pfenning and Toninho: the difference between session type systems based on classical and intuitionistic linear logic is in the enforcement of locality . is able to type non-local processes, because it does not distinguish between linear channels, received or not, because of its single-sided sequents. Similarly, can type non-local processes because of its symmetry. Restricting into removes exactly those rules needed to violate the locality principle. This reveals that respects locality because of its asymmetry.
We are grateful to Joseph Paulus for initial discussions. We would also like to thank the anonymous reviewers for their suggestions, which were helpful to improve the presentation.
-  Andrew Barber & Gordon D. Plotkin (1996): Dual Intuitionistic Linear Logic. Technical Report ECS-LFCS-96-347, University of Edinburgh, School of Informatics, Laboratory for Foundations of Computer Science, Edinburgh.
-  Luís Caires & Frank Pfenning (2010): Session Types as Intuitionistic Linear Propositions. In Paul Gastin & François Laroussinie, editors: CONCUR 2010 - Concurrency Theory, Lecture Notes in Computer Science, Springer Berlin Heidelberg, pp. 222–236, doi:10.1007/978-3-642-15375-416.
-  Luís Caires, Frank Pfenning & Bernardo Toninho (2012): Towards Concurrent Type Theory. In: Proceedings of the 8th ACM SIGPLAN Workshop on Types in Language Design and Implementation, ACM, pp. 1–12, doi:10.1145/2103786.2103788.
-  Luís Caires, Frank Pfenning & Bernardo Toninho (2016): Linear Logic Propositions as Session Types. Mathematical Structures in Computer Science 26(3), pp. 367–423, doi:10.1017/S0960129514000218.
-  Bor-Yuh Evan Chang, Kaustuv Chaudhuri & Frank Pfenning (2003): A Judgmental Analysis of Linear Logic. Technical Report CMU-CS-03-131R, Department of Computer Science, Carnegie Mellon University, doi:10.1184/R1/6587498.v1.
-  Cédric Fournet, Georges Gonthier, Jean-Jacques Levy, Luc Maranget & Didier Rémy (1996): A Calculus of Mobile Agents. In Ugo Montanari & Vladimiro Sassone, editors: CONCUR ’96: Concurrency Theory, Lecture Notes in Computer Science, Springer, Berlin, Heidelberg, pp. 406–421, doi:10.1007/3-540-61604-767.
-  Cédric Fournet & Cosimo Laneve (2001): Bisimulations in the Join-Calculus. Theoretical Computer Science 266(1), pp. 569–603, doi:10.1016/S0304-3975(00)00283-8.
-  Jean-Yves Girard (1987): Linear Logic. Theoretical Computer Science 50(1), pp. 1–101, doi:10.1016/0304-3975(87)90045-4.
-  Jean-Yves Girard (1993): On the Unity of Logic. Annals of Pure and Applied Logic 59(3), pp. 201–217, doi:10.1016/0168-0072(93)90093-S.
-  Kohei Honda (1993): Types for Dyadic Interaction. In Eike Best, editor: CONCUR’93, Springer Berlin Heidelberg, Berlin, Heidelberg, pp. 509–523, doi:10.1007/3-540-57208-235.
-  Kohei Honda, Vasco T. Vasconcelos & Makoto Kubo (1998): Language Primitives and Type Discipline for Structured Communication-Based Programming. In Chris Hankin, editor: Programming Languages and Systems, Springer Berlin Heidelberg, Berlin, Heidelberg, pp. 122–138, doi:10.1007/BFb0053567.
-  Olivier Laurent (2018): Around Classical and Intuitionistic Linear Logics. In: Proceedings of the 33rd Annual ACM/IEEE Symposium on Logic in Computer Science, LICS ’18, ACM, Oxford, United Kingdom, pp. 629–638, doi:10.1145/3209108.3209132.
-  Massimo Merro (2000): Locality and Polyadicity in Asynchronous Name-Passing Calculi. In Jerzy Tiuryn, editor: Foundations of Software Science and Computation Structures, Lecture Notes in Computer Science, Springer, Berlin, Heidelberg, pp. 238–251, doi:10.1007/3-540-46432-816.
-  Massimo Merro & Davide Sangiorgi (2004): On Asynchrony in Name-Passing Calculi. Mathematical Structures in Computer Science 14(5), pp. 715–767, doi:10.1017/S0960129504004323.
-  Robin Milner, Joachim Parrow & David Walker (1992): A Calculus of Mobile Processes, I. Information and Computation 100(1), pp. 1–40, doi:10.1016/0890-5401(92)90008-4.
-  Davide Sangiorgi & David Walker (2003): The Pi-Calculus: A Theory of Mobile Processes. Cambridge University Press.
-  Kaku Takeuchi, Kohei Honda & Makoto Kubo (1994): An Interaction-Based Language and Its Typing System. In Costas Halatsis, Dimitrios Maritsas, George Philokyprou & Sergios Theodoridis, editors: PARLE’94 Parallel Architectures and Languages Europe, Springer Berlin Heidelberg, Berlin, Heidelberg, pp. 398–413, doi:10.1007/3-540-58184-7118.
-  Philip Wadler (2012): Propositions As Sessions. In: Proceedings of the 17th ACM SIGPLAN International Conference on Functional Programming, ICFP ’12, ACM, Copenhagen, Denmark, pp. 273–286, doi:10.1145/2364527.2364568.