Substructural Parametricity
Abstract
Ordered, linear, and other substructural type systems allow us to expose deep properties of programs at the syntactic level of types. In this paper, we develop a family of unary logical relations that allow us to prove consequences of parametricity for a range of substructural type systems. A key idea is to parameterize the relation by an algebra, which we exemplify with a monoid and commutative monoid to interpret ordered and linear type systems, respectively. We prove the fundamental theorem of logical relations and apply it to deduce extensional properties of inhabitants of certain types. Examples include demonstrating that the ordered types for list append and reversal are inhabited by exactly one function, as are types of some tree traversals. Similarly, the linear type of the identity function on lists is inhabited only by permutations of the input. Our most advanced example shows that the ordered type of the list fold function is inhabited only by the fold function.
Keywords and phrases:
Substructural type systems, logical relations, ordered logicCopyright and License:
2012 ACM Subject Classification:
Theory of computation Type structuresAcknowledgements:
The authors thank Bob Atkey and Stephanie Balzer for helpful comments regarding related work.Funding:
This material is based upon work supported by the United States Air Force Office of Scientific Research under grant number A210038S002 (Tristan Nguyen, program manager). Any opinions, findings and conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of the AFOSR.Editors:
Maribel FernándezSeries and Publisher:
Leibniz International Proceedings in Informatics, Schloss Dagstuhl – Leibniz-Zentrum für Informatik
1 Introduction
Substructural type systems and parametric polymorphism are two mechanisms for capturing precise behavioral properties of programs at the type level, enabling powerful static reasoning. The goal of this paper is to give a theoretical account of these mechanisms in combination.
Substructural type systems have been investigated since the advent of linear logic, starting with the seminal paper by Girard and Lafont [18]. Among other applications, with substructural type systems one can avoid garbage collection, update memory in place [27, 28], make message-passing [16, 12] or shared memory concurrency [17, 35] safe, model quantum computation [15], or reason efficiently about imperative programs [26]. Substructural type systems have thus been incorporated into languages that seek to offer such guarantees, such as Rust, Koka, Haskell, Oxidized OCaml, and ProtoQuipper.
Parametricity, originally introduced for System F [42], enables the idea that programs whose types involve universal quantification over type parameters have certain strong semantic properties. This idea supports powerful program reasoning principles such as representation independence across abstraction boundaries [30] and “theorems for free” that can be derived about all inhabitants of certain types, for example that every inhabitant of is equivalent to the identity function [46].
The theory of substructural logics and type systems is now relatively well understood, including several ways to integrate substructural and structural type systems [9, 38, 19]. It is therefore somewhat surprising that we do not yet know much about how parametricity and its applications interact with them. The main foray into substructural parametricity is a paper by Zhao et al. [47] that accounts for a polymorphic dual-intuitionistic linear logic. They point out that logical relations on closed terms are problematic because substitution obscures linearity. Their solution was to construct a logical relation on open terms, necessitating the introduction of “semantic typing” judgments that mirror the syntactic type system, which complicates their definition and application.
In this paper, we follow an approach using constructive resource semantics in the style of Reed et al. [39, 41, 40] to construct logical relations on closed terms. We start with an ordered type system [37, 36, 24], which may be considered the least permissive among substructural type systems and therefore admits a pleasantly minimal definition. However, the construction is generic with respect to certain properties of the resource algebra, which allows us to extend it also to linear and unrestricted types. Consequences of our development include that certain polymorphic types are only inhabited by the polymorphic append and reverse functions on lists. Similarly, certain types are only inhabited by functions that swap or maintain the order of pairs. The most advanced application shows that the ordered type of fold over lists is inhabited only by the fold function.
We conjecture that the three substructural modes we investigate – ordered, linear, and unrestricted – can also be combined in an adjoint framework [9, 19] but leave this to future work. Similarly, we simplify our presentation by defining only a unary logical relation since it is sufficient to demonstrate proof-of-concept, but nothing stands in the way of a more general definition (for example, to support representation-independence results).
2 A Minimalist Fragment
We start with a small fragment of the Lambek Calculus [25, 29], extended with parametric polymorphism [43]. This fragment is sufficient to illustrate the main ideas behind our constructions. For the sake of simplicity we choose a Curry-style formulation of typing, concentrating on properties of untyped terms rather than intrinsically typed terms. This allows the same terms to inhabit ordered, linear, and unrestricted types and thereby focus on semantic rather than syntactic issues.
In this fragment, we have (read “ fuse ”) which, logically, is a noncommutative conjunction. We have two forms of implication: (read: “ under ”, originally written as ) which is true if from the hypothesis placed at the left end of the antecedents we can deduce , and (read: “ over ”, originally written as ) which is true if from the hypothesis placed at the right end of the antecedents we can prove . Lambek’s original notation was suitable for the sequent calculus and its applications in linguistics, but is less readable for natural deduction and functional programming.
Our basic typing judgment has the form where consists of hypotheses , and is an ordered context . We make the standard presuppositions that and for every in , and that both type variables and term variables are pairwise distinct. The rules are show in Figure 1.
Here are a few example judgments that hold or fail. We elide the context .
The strictures of the typing judgment imply that certain types may be uninhabited, or may be inhabited by terms that are extensionally equivalent (i.e., that yield the same outputs for all closed inputs) to a small number of possibilities. To count the number of linear functions, translate and and similarly for unrestricted functions.
| Types | Ordered | Linear | Unrestricted |
|---|---|---|---|
| 1 | 1 | 1 | |
| 0 | 0 | 2 | |
| 1 | 2 | 4 | |
| 1 | 2 | 4 | |
| 0 | 1 | 1 | |
| 1 | 1 | 1 |
Because our intended application language based on adjoint natural deduction [19] is call-by-value, we can give a straightforward big-step operational semantics [22] relating a term to its final value. Because this evaluation does not directly interact with or benefit from substructural properties, we show it without further comment in Figure 2. It has the property of preservation that if and then . Jang et al. give an account [19] that exploits linearity and other substructural properties, although not the lack of exchange.
3 An Algebraic Logical Predicate
Because of our particular setting, we define two mutually dependent logical predicates: for closed terms and for closed values. In addition, the relation is parameterized by elements from an algebraic domain which may have various properties. For the ordered case, it should be a monoid, for the linear case a commutative monoid. However, the rules themselves do not require this for the pure sets of terms. We use for the binary operation on the monoid, and for its unit.
Ignoring polymorphism for now, we write and , which is defined by
We can see how the algebraic structure of the monoid tracks information about order if its operation is not commutative.
The key step, as usual in logical predicates of this nature, is the case for universal quantification and type variables. We map type variables to relations between monoid elements and values in where is a closed type. We use to denote this mapping from type variables to sets of values and write it as a superscript on .
The mapping is just passed through identically in the cases of the relation defined above.
We can already verify some interesting properties. As a first example we show that the logical predicates are nonempty.
Example 1.
Proof.
Because the -term is a value, we need to check
By definition, this is true if for an arbitrary and relation we have
Using the definition of the logical predicate for right implication twice and one intermediate step of evaluation, this holds iff
for all with and . By evaluation, this is true iff
Now we can apply the definition of , splitting into and and reducing it to
Both of these hold because, by assumption, and .
More interesting, perhaps, is the reverse.
Example 2.
If
then is extensionally equal to , in that for any closed type and closed terms , it must be the case that . In particular, it can not be .
Proof.
We choose our monoid to be the free monoid over two generators and and we choose an arbitrary closed type and two elements and . Moreoever, we pick relating only and .
From the definitions (and skipping over some simple properties regarding evaluation), we obtain
By the clauses for , and we conclude that
for some values and with and . Because the only value related to is and the only value related to is , we conclude and . Therefore
Since and were chosen arbitrarily, we see that is extensionally equal to .
4 The Fundamental Theorem
The fundamental theorem of logical predicates states that every well-typed term is in the predicate. Our relations also include terms that are not well-typed, which can occasionally be useful when one exceeds the limits of static typing.
We need a few standard lemmas, adapted to this case. We only spell out one.
Lemma 3 (Compositionality).
Define such that iff . Then iff
Proof.
By induction on .
We would like to prove the fundamental theorem by induction over the structure of the typing derivation. Since our logical relation is defined for closed terms, we need a closing substitution , i.e., a substitution of closed terms into the typing context of the term for which we seek to prove the fundamental theorem by induction, such that the application of to is a closed term. We therefore extend the definition of the logical relation to substitutions and contexts as follows:
Due to the associativity of the monoid operation and concatenation of contexts, this constitutes a valid definition.
Theorem 4 (Fundamental Theorem (purely ordered)).
Assume , a mapping with domain , and closing substitution . Then .
Proof.
By induction on the structure of the given typing derivation. We show a few cases.
- Case:
-
Then by assumption and definition, and since is a value.
- Case:
-
Given Assumption (1) By definition By definition By ind. hyp. By reverse evaluation, closed By definition, discharging (1) By definition - Case:
-
Given and for some , , , and with and By definition By ind. hyp. By ind. hyp. with By definition with By definition By definition By properties of substitution Since and - Case:
-
Given an arbitrary relation Assumption (1) Since fresh By ind. hyp. By definition, discharging (1) - Case:
-
Given By ind. hyp. Define iff By definition for By definition By compositionality (Lemma 4) By definition
Because typing implies that the logical predicate holds, the earlier examples now apply to well-typed terms.
Theorem 5 (Section 3 revisited).
If
then is extensionally equivalent to .
Proof.
We just note that
since and and the empty mapping suffices without any free type variables. Then we appeal to the reasoning in Section 3.
5 Unrestricted Functions
We are interested in properties of functions such as list append or list reversal, or higher-order functions such as fold. This requires inductive types, but the functions on them are not used linearly. For example, append has a recursive call in the case of a nonempty list, but none in the case of an empty list. We could introduce a general modality for this purpose. A simpler alternative that is sufficient for our situation is to introduce unrestricted function types (usually coded as in linear logic or in ordered logic). This path has been explored previously [37] with different motivations. There, an open logical relation was defined on the negative monomorphic fragment in order to show the existence of canonical forms, a property that is largely independent of ordered typing.
Adding unrestricted functions is rather straightforward in typing by using two kinds of variables: those that are ordered and those unrestricted. Then, in the logical predicate, unrestricted variables must not use any resources, that is, they are assigned the unit element of the monoid during the definition.
The generalized judgment has the form where contains type assignments for variables that can be used in an unrestricted (not linear and not ordered) way. All the previous rules are augmented by propagating from the conclusion to all premises. Because our term language is untyped, no extensions are needed there. Similarly, the rules of our dynamics do not need to change.
We extend the logical predicate using arguments not afforded any resources.
The fundamental theorem extends in a straightforward way.
Theorem 6 (Fundamental Theorem (mixed ordered/unrestricted)).
Assume , a mapping with domain , and two closing substitutions and . Then .
Proof.
By induction on the structure of the given typing derivation.
An interesting side effect of these definitions is that if we omit ordered functions but retain pairs we obtain the “usual” formulation of closed logical predicates, including certain consequences of parametricity for the ordinary -calculus.
Theorem 7.
If
then is extensionally equivalent to one of 4 functions: , , , or .
Proof.
By the fundamental theorem, we have
We use this for an abitrary closed type with two arbitary values , and and relation with and . Exploiting the definition, we get
Using the definition of function twice and skipping over some evaluation and reverse evaluation, we obtain
This means that with and . Because of the definition of there are 4 possibilities for , namely , , and . This in turn means is extensionally equal to one of the 4 functions shown.
6 Sums, Twist, and Recursive Types
At this point, we are at a crossroads. Because we would like to prove theorems regarding more complex data structures such as lists, trees, or streams, we could extend the development with general inductive and coinductive types and their recursors. We conjecture that this is possible and leave it to future work. The other path is to work with purely positive types, including recursive ones whose values can be directly observed. In this approach, the definition of the logical predicate is quite easy to extend. It becomes a nested inductive definition: either the type becomes smaller or, once we encounter a purely positive type and recursion is possible, from then on the terms become strictly smaller. In this paper we take the latter approach, which excludes coinductive types such as streams from consideration, but still yields many interesting and intuitive consequences.
We take the opportunity to also round out our language with sums and twist (the symmetric counterpart of fuse). We use a signature defining equirecursive type names that may be arbitrarily mutually recursive. Because such type definitions are otherwise closed, they constitute metavariables in the sense of contextual modal type theory [31]. Each type definition (for a context of type variables as in previous sections) must be contractive, that is, its definiens cannot be be another type name. Moreover, must be purely positive, which is interpreted inductively.
The language of terms does not change much because type names are equirecursive.
We add the type (“twist”), symmetric to , since encoding it as requires rewriting terms, flipping the order of pairs. For it is merely the typechecking that changes. This allows more types to be assigned to the same term. We allow silent unfolding of type definitions, so there are no explicit rules for .
The logical predicate is also extended in a straightforward manner. We assume the signature is fixed and therefore do not carry it explicitly through the definitions.
Because we have equirecursive type definitions, the last clause is usually applied silently. The definition of the logical predicate is no longer straightforwardly inductive on the structure of the type. However, we see that for purely positive types (the only ones involved in recursion), the value in the definition becomes strictly smaller in each clause if type definitions are contractive. In other words, we now have a nested inductive definition of the logical predicate, first on the type, and when the type is purely positive, on the structure of the value.
We can also add recursion to our term language with the key proviso that we either restrict ourselves to certain patterns of recursion (for example, primitive recursion), or termination is guaranteed by other external means (for example, an analysis using sized types [2]). This assumption allows us to maintain the structure of the logical predicate, even if it is no longer a means to prove termination (which we are not interested in for this paper).
Lemma 8 (Compositionality (including purely positive equirecursive types)).
Define such that iff . Then iff .
Proof.
By nested induction on the definition of the logical predicate for , first on the structure of and second on the structure of the value when a purely positive type has been reached.
Theorem 9 (Fundamental Theorem (including purely positive recursive types)).
Assume , a mapping with domain , and two closing substitutions and . Then .
Proof.
By induction on the structure of the given typing derivation. When reasoning about functions and recursion, we need the assumption of termination.
7 Free Theorems for Ordered Lists
We start with some theorems about ordered lists, not unlike those analyzed by Wadler [46], but much sharper due to substructural typing. We define two versions of ordered lists, one that is ordered left-to-right and one that is ordered right-to-left. Both of these use exactly the same representation; just their typing is different.
The following will be a useful lemma about ordered lists.
Lemma 10 (Ordered Lists).
Proof.
By unrolling the definitions of the logical predicate and the equirecursive nature of the definition of lists.
For the applications, we abbreviate lists, writing for .
Now we state a first property of lists that follows as a consequence of our parameterized logical predicate.
Theorem 11.
If then is extensionally equal to the identity function on lists.
Proof.
By the fundamental theorem, we have
To construct a relation we pick an arbitary closed type . For the monoid, we pick the one freely generated by and define
for arbitrary elements . By definition, we obtain, for ,
Again by definition, that’s the case iff
Here, , by the monoid laws. Therefore and
We use this for and . By our lemma about lists and the arbitrary nature of and we conclude that .
By similar reasoning we can obtain the following properties.
Theorem 12.
-
1.
If then is extensionally equal to the identity function.
-
2.
If then is extensionally equal to the list reversal function.
-
3.
If then is extensionally equal to the list reversal function.
Proof.
By very similar reasoning to the one in Theorem 11.
But can we deduce properties of higher-order functions using ordered parametricity? We show one primary example; others such as follow directly from it or similarly.
Unlike the usual or even linear parametricity, the type of in ordered natural deduction guarantees that it must be the fold function! (The essential difference being that in, say, linear natural deduction, a function having the same type as may still apply a permutation to its argument before performing the fold.) Note that the combining function and initial element are unrestricted arguments (one is called for every list element, and one is called only for the empty list), but that the combining function’s arguments are ordered.
Theorem 13.
If
then extensionally equal to the fold function, that is,
Proof.
We use the free monoid over constructors . Furthermore, given a type with arbitrary elements we define the relation by
Since the type involves another quantified type , we need to define a second relation where
With these relations and the definition on of the logical predicate we get the following two properties.
-
1.
-
2.
Since
we can use the second and iterate the first property to conclude that
By definition of , this yields
in the sense that both sides evaluate to . Because functions and values were chosen arbitrarily, this expresses the desired extensional equality.
8 Free Theorems Regarding Trees
Consider
Here are a few free theorems regarding such trees. Further variations exist.
Theorem 14.
-
1.
If then lists the elements of following an inorder traversal.
-
2.
If then lists the elements of following a preorder traversal.
-
3.
If then lists the elements of following a postorder traversal.
Proof.
Trees, like lists, are purely positive types. As such, we can prove an analogue of Section 7. We only show one of them, writing for tree values.
9 From Ordered to Linear Types
Exploring parametricity for linear types instead of ordered ones is now a rather straightforward change. We conflate the left and right implication into a single implication, and similarly for conjunction.
We see that in the transition from the linear to the structural case, no further connectives collapse. That’s because we would still distinguish eager pairs () from lazy records that we have elided from our development since they do not introduce any fundamentally new ideas.
From the point of view of typing, the easiest change is to just permit the silent rule of exchange
The more typical change is to replace context concatenation with context merge which allows arbitrary interleavings of the hypotheses.
Our definition of the logical predicates remains that same, except that we assume that the algebraic structure parameterizing our definitions is a commutative monoid. This immediately validates the rules of exchange and the fundamental theorem goes through as before.
The results of exploiting the fundamental theorem to obtain parametricity results are no longer as sharp. For example:
Theorem 15.
If then is extensionally equal to or .
Proof.
By the fundamental theorem, we have
Therefore and
We use a free commutative monoid with two generators, and , arbitrary values and such that and . By the fundamental theorem:
Applying this function to and , we obtain that and
This is true, again by definition, if for some and and and we have
Further applying definitions, we get that for some , , , and , we have
There are 4 ways that could be decomposed into , but the definition of leaves only two possibilities: , , and or , , and . Summarizing: either
or
which expresses that is extensionally equal to or .
Theorem 16.
If then is extensionally equal to a permutation of the list elements.
Proof.
As in the proof of the related ordered theorem, we apply the fundamental theorem and then the definition for arbitrary values with where , and the commutative monoid is freely generated from .
Taking analogous steps to the ordered case, we conclude that modulo commutativity (and associativity, as always) where each is a unique .
In the unrestricted case where various algebraic elements are fixed to be , we can only obtain that every element of the output list must be a member of the input list, because those elements are in . We do not write out the details of this straightforward adaptation of foregoing proofs.
10 Related Work
The most directly related work is Zhao et al.’s [47] open logical relation for parametricity for a dual intuitionistic-linear polymorphic lambda calculus. In this work, they define an open logical relation that includes an analog of typing contexts in the semantic model. While our development follows a similar structure, our resource algebraic account allows us to eliminate spurious typechecking premises in definitions and permits a more flexible range of substructural type systems.
Ahmed, Fluet, and Morrisett [4] introduce a logical relation for substructural state via step-indexing, followed by [5] a linear language with locations (L3) defined by a Kripke-style logical relation to account for a language with mutable storage. However, the underlying languages in these developments do not support parametric polymorphism. Ahmed, Dreyer, and Rossberg later provide a logical relations account of a System F-based language supporting imperative state update, and they demonstrate representation independence results for this system [3]. The languages modeled in this body of work represent a specific point in the design space with respect to imperative state update and references, as opposed to our more general schema for substructural types in a functional setting. However, Kripke-style logical relations that model a store as a partial commutative monoid have some parallels to our development, and drawing out a more precise relationship between these systems represents an interesting path of future work.
There are a few developments that start from different settings but develop semantics with similar properties. Pérez et al. develop logical relations for linear session types [33, 34] to establish normalization results, but there is no account of parametricity. Caires et al. [11], Derakhshan et al. [13], and Balzer et al. [8] account for parametricity in linear session-typed communication with the goal of reasoning abstractly over protocol implementations. Their logical relations do not directly capture resource usage nor obviously admit free theorems similar to ours, but rather form a basis for information flow reasoning as an orthogonal application of parametricity [14, 44].
The Iris system for program reasoning via higher-order separation logic incorporates a semantic model initially based on monoids [21], which is later extended to more general resource algebras [20]. Their parameterization over resource algebras seems to work similarly to ours, but towards the goal of program verification rather than type-based reasoning. Birkedal et al. [10] demonstrate free theorems for separation logic specifications in service of enforcing communication protocols between clients and libraries.
The use of “resource semantics” more generally to account for the semantics of substructural logics extends at least to Kamide [23] and the logic of bunched implications [32], and similar ideas have recently gained traction in the context of graded modal type systems [45]. For instance, Atkey and Wood [6] introduce a notion of “context constrained computation” to generalize parametricity reasoning over linear list operations to arbitrary semiring-graded modalities. They do not directly account for polymorphism in the type system, but can instantiate their calculus with example-specific world definitions to prove e.g. that a linear function on lists of a generic key type must return a permutation. Abel and Bernardy [1] extend this idea to a similar one that includes polymorphic types and presents free theorems. The ringoid structure that generalizes the graded approach does not, however, accommodate ordered logic.
11 Conclusion
We have provided an account of substructural parametricity including ordered, linear, and unrestricted disciplines. The fewer structural properties are supported, the more precise the characterization of a function’s behavior from its type. We have also implemented an ordered type checker using a bidirectional type system with so-called additive contexts [7], but the details are beyond the scope of this paper. Suffice it to say that all the functions such as append, reverse, tree traversals, and fold can actually be implemented in a variety of ways and our “free theorems” are therefore not vacuous.
The most immediate item of future work is to support general inductive and coinductive types instead of purely positive recursive types. This would allow a new class of applications, including (productive) stream processing and object-oriented program patterns.
We also envision an adjoint combination of different substructural type systems [19], extended to include exchange among the explicit structural rules, with the logical predicates given herein properly extended to account for the different modalities present in the adjoint type system.
References
- [1] Andreas Abel and Jean-Philippe Bernardy. A unified view of modalities in type systems. Proceedings of the ACM on Programming Languages, 4(ICFP):1–28, 2020. doi:10.1145/3408972.
- [2] Andreas Abel and Brigitte Pientka. Well-founded recursion with copatterns and sized types. Journal of Functional Programming, 26:e2, 2016. doi:10.1017/S0956796816000022.
- [3] Amal Ahmed, Derek Dreyer, and Andreas Rossberg. State-dependent representation independence. In 36th Symposium on Principles of Programming Languages (POPL 2009), pages 340–353, Savannah, Georgia, USA, January 2009. ACM. doi:10.1145/1480881.1480925.
- [4] Amal Ahmed, Matthew Fluet, and Greg Morrisett. A step-indexed model of substructural state. In 10th International Conference on Functional Programming (ICFP 2005), pages 78–91, 2005. doi:10.1145/1086365.1086376.
- [5] Amal Ahmed, Matthew Fluet, and Greg Morrisett. L3: a linear language with locations. Fundamenta Informaticae, 77(4):397–449, 2007.
- [6] Bob Atkey and James Wood. Context constrained computation. In 3rd Workshop on Type-Driven Development (TyDe’18), 2018.
- [7] Robert Atkey. Syntax and semantics of quantitative type theory. In Anuj Dawar and Erich Grädel, editors, 33rd Conference on Logic in Computer Science (LICS 2018), pages 56–65, Oxford, UK, July 2018. ACM. doi:10.1145/3209108.3209189.
- [8] Stephanie Balzer, Farzaneh Derakhshan, Robert Harper, and Yue Yao. Logical relations for session-typed concurrency. arXiv preprint arXiv:2309.00192, 2023. doi:10.48550/arXiv.2309.00192.
- [9] P. N. Benton. A mixed linear and non-linear logic: Proofs, terms and models. In Leszek Pacholski and Jerzy Tiuryn, editors, Selected Papers from the 8th International Workshop on Computer Science Logic (CSL’94), pages 121–135, Kazimierz, Poland, September 1994. Springer LNCS 933. An extended version appears as Technical Report UCAM-CL-TR-352, University of Cambridge.
- [10] Lars Birkedal, Thomas Dinsdale-Young, Armaël Guéneau, Guilhem Jaber, Kasper Svendsen, and Nikos Tzevelekos. Theorems for free from separation logic specifications. Proceedings of the ACM on Programming Languages, 5(ICFP):1–29, 2021. doi:10.1145/3473586.
- [11] Luís Caires, Jorge A Pérez, Frank Pfenning, and Bernardo Toninho. Behavioral polymorphism and parametricity in session-based communication. In 22nd European Symposium on Programming (ESOP 2013), pages 330–349, Rome, Italy, March 2013. Springer LNCS 7792. doi:10.1007/978-3-642-37036-6_19.
- [12] Luís Caires and Frank Pfenning. Session types as intuitionistic linear propositions. In P.Gastin and F.Laroussinie, editors, 21st International Conference on Concurrency Theory (CONCUR 2010), pages 222–236, Paris, France, August 2010. Springer LNCS 6269. doi:10.1007/978-3-642-15375-4_16.
- [13] Farzaneh Derakhshan, Stephanie Balzer, and Limin Jia. Session logical relations for noninterference. In 36th Annual Symposium on Logic in Computer Science (LICS 2021), pages 1–14. IEEE, 2021. doi:10.1109/LICS52264.2021.9470654.
- [14] Farzaneh Derakhshan, Stephanie Balzer, and Yue Yao. Regrading policies for flexible information flow control in session-typed concurrency (artifact). Dagstuhl Artifacts Series, 10(2):4–1, 2024.
- [15] Peng Fu, Kohei Kishida, and Peter Selinger. Linear dependent type theory for quantum programming languages. In 35th Symposium on Logic in Computer Science (LICS 2020), pages 440–453, Saarbrücken, Germany, July 2020. ACM.
- [16] Simon J. Gay and Vasco T. Vasconcelos. Linear type theory for asynchronous session types. Journal of Functional Programming, 20(1):19–50, January 2010. doi:10.1017/S0956796809990268.
- [17] Aïna Linn Georges, Benjamin Peters, Laila Albeheiry, Leo White, Stephan Dolan, Richard A. Eisenberg, Chris Casinghino, François Pottier, and Derek Dreyer. Data race freedom à la mode. In Principles of Programming Languages (POPL 2025), volume 9 of Proceedings on Programming Languages, pages 656–686. ACM, January 2025. doi:10.1145/3704859.
- [18] Jean-Yves Girard and Yves Lafont. Linear logic and lazy computation. In H. Ehrig, R. Kowalski, G. Levi, and U. Montanari, editors, Proceedings of the International Joint Conference on Theory and Practice of Software Development, volume 2, pages 52–66, Pisa, Italy, March 1987. Springer-Verlag LNCS 250. doi:10.1007/BFB0014972.
- [19] Junyoung Jang, Sophia Roshal, Frank Pfenning, and Brigitte Pientka. Adjoint natural deduction. In Jakob Rehof, editor, 9th International Conference on Formal Structures for Computation and Deduction (FSCD 2024), pages 15:1–15:23, Tallinn, Estonia, July 2024. LIPIcs 299. Extended version available as https://arxiv.org/abs/2402.01428.
- [20] Ralf Jung, Robbert Krebbers, Jacques-Henri Jourdan, Aleš Bizjak, Lars Birkedal, and Derek Dreyer. Iris from the ground up: A modular foundation for higher-order concurrent separation logic. Journal of Functional Programming, 28:e20, 2018. doi:10.1017/S0956796818000151.
- [21] Ralf Jung, David Swasey, Filip Sieczkowski, Kasper Svendsen, Aaron Turon, Lars Birkedal, and Derek Dreyer. Iris: Monoids and invariants as an orthogonal basis for concurrent reasoning. In 42nd Annual Symposium on Principles of Programming Languages (POPL 2015), pages 637–650, Mumbai, India, January 2015. ACM. doi:10.1145/2676726.2676980.
- [22] Gilles Kahn. Natural semantics. In Proceedings of the Symposium on Theoretical Aspects of Computer Science, pages 22–39. Springer-Verlag LNCS 247, 1987. doi:10.1007/BFB0039592.
- [23] Norihiro Kamide. Kripke semantics for modal substructural logics. Journal of Logic, Language and Information, 11:453–470, 2002. doi:10.1023/A:1019915908844.
- [24] Max Kanovich, Stepan Kuznetsov, Vivek Nigam, and Andre Scedrov. A logical framework with commutative and non-commutative subexponentials. In International Joint Conference on Automated Reasoning (IJCAR 2018), pages 228–245. Springer LNAI 10900, 2018. doi:10.1007/978-3-319-94205-6_16.
- [25] Joachim Lambek. The mathematics of sentence structure. The American Mathematical Monthly, 65(3):154–170, 1958.
- [26] Andrea Lattuada, Travis Hance, Chanhee Cho, Matthias Brun, Isitha Subasinghe, Yi Zhou, Jon Howell, Bryan Parno, and Chris Hawblitzel. Verus: Verifying Rust programs using linear ghost types. In Proceedings of the ACM on Programming Languages, volume 7 (OOPSLA 2023), pages 286–315, April 2023. Extended version available as https://arxiv.org/abs/2303.05491.
- [27] Anton Lorenzen, Daan Leijen, and Wouter Swierstra. FP2: Fully in-place functional programming. In International Conference on Functional Programming (ICFP 2023), Proceedings on Programming Languages, pages 275–304. ACM, August 2023. doi:10.1145/3607840.
- [28] Anton Lorenzen, Daan Leijen, Wouter Swierstra, and Sam Lindley. The functional essence of imperative binary search trees. In Programming Language Design and Implementation (PLDI 2024), volume 8 of Proceedings on Programming Languages, pages 518–542. ACM, January 2024. doi:10.1145/3656398.
- [29] Wendy MacCaull. Relational semantics and a relational proof system for full Lambek calculus. Journal of Symbolic Logic, 63(2):623–637, 1998. doi:10.2307/2586855.
- [30] John C Mitchell. Representation independence and data abstraction. In Proceedings of the 13th Symposium on Principles of Programming Languages (POPL 1986), pages 263–276. ACM, 1986. doi:10.1145/512644.512669.
- [31] Aleksandar Nanevski, Frank Pfenning, and Brigitte Pientka. Contextual modal type theory. Transactions on Computational Logic, 9(3), 2008. doi:10.1145/1352582.1352591.
- [32] Peter W O’Hearn and David J Pym. The logic of bunched implications. Bulletin of Symbolic Logic, 5(2):215–244, 1999. doi:10.2307/421090.
- [33] Jorge A. Pérez, Luís Caires, Frank Pfenning, and Bernardo Toninho. Termination in session-based concurrency via linear logical relations. In H. Seidl, editor, 22nd European Symposium on Programming (ESOP 2012), pages 539–558, Tallinn, Estonia, March 2012. Springer LNCS 7211.
- [34] Jorge A. Pérez, Luís Caires, Frank Pfenning, and Bernardo Toninho. Linear logical relations and observational equivalences for session-based concurrency. Information and Computation, 239:254–302, 2014. doi:10.1016/J.IC.2014.08.001.
- [35] Frank Pfenning and Klaas Pruiksma. Relating message passing and shared memory, proof-theoretically. In S. Jongmans and A. Lopes, editors, 25th International Conference on Coordination Models and Languages (COORDINATION 2023), pages 3–27, Lisbon, Portugal, June 2023. Springer LNCS 13908. Notes to an invited talk. doi:10.1007/978-3-031-35361-1_1.
- [36] Jeff Polakow. Ordered Linear Logic and Applications. PhD thesis, Department of Computer Science, Carnegie Mellon University, August 2001.
- [37] Jeff Polakow and Frank Pfenning. Natural deduction for intuitionistic non-commutative linear logic. In J.-Y. Girard, editor, Proceedings of the 4th International Conference on Typed Lambda Calculi and Applications (TLCA’99), pages 295–309, L’Aquila, Italy, April 1999. Springer-Verlag LNCS 1581. doi:10.1007/3-540-48959-2_21.
- [38] Klaas Pruiksma, Willow Chargin, Frank Pfenning, and Jason Reed. Adjoint logic and its concurrent operational interpretation. Unpublished manuscript, January 2018.
- [39] Jason Reed. Hybridizing a logical framework. In Proceedings of the International Workshop on Hybrid Logic (HyLo’06), pages 135–148. Electronic Notes in Theoretical Computer Science, v.174(6), 2007.
- [40] Jason Reed and Frank Pfenning. A constructive approach to the resource semantics of substructural logics. Unpublished Manuscript, May 2010. URL: https://www.cs.cmu.edu/˜jcreed/papers/rp-substruct.pdf.
- [41] Jason C. Reed. A Hybrid Logical Framework. PhD thesis, Carnegie Mellon University, September 2009. Available as Technical Report CMU-CS-09-155.
- [42] John C. Reynolds. Types, abstraction, and parametric polymorphism. In R.E.A. Mason, editor, Information Processing 83, pages 513–523. Elsevier, September 1983.
- [43] Christopher Strachey. Fundamental concepts in programming languages. Higher-Order and Symbolic Computation, 13:11–49, 2000. Notes for lecture course given at the International Summer School in Computer Programming at Copenhagen, Denmark, August 1967. doi:10.1023/A:1010000313106.
- [44] Bas van den Heuvel, Farzaneh Derakhshan, and Stephanie Balzer. Information flow control in cyclic process networks. In 38th European Conference on Object-Oriented Programming (ECOOP 2024), pages 40:1–40:30. LIPIcs 313, 2024. doi:10.4230/LIPICS.ECOOP.2024.40.
- [45] Victoria Vollmer, Danielle Marshall, Harley Eades, III, and Dominic Orchard. A mixed linear and graded logic: Proofs, terms, and models. In 33rd Conference on Computer Science Logic (CSL 2025), pages 32:1–32:21, Amsterdam, The Netherlands, February 2025. LIPIcs 326. doi:10.4230/LIPICS.CSL.2025.32.
- [46] Philip Wadler. Theorems for free! In J. Stoy, editor, Proceedings of the 4th International Conference on Functional Programming Languages and Computer Architecture (FPCA’89), pages 347–359, London, UK, September 1989. ACM. doi:10.1145/99370.99404.
- [47] Jianzhou Zhao, Qi Zhang, and Steve Zdancewic. Relational parametricity for a polymorphic linear lambda calculus. In K. Ueda, editor, 8th Asian Symposium on Programming Languages and Systems (APLAS 2010), pages 344–359. Springer LNCS 6461, 2010. doi:10.1007/978-3-642-17164-2_24.
Appendix A Complete definition of the Type System
Typing rules:
Operational semantics:
