Call-By-Push-Value from a Linear Logic Point of View

  • Thomas EhrhardEmail author
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9632)


We present and study a simple Call-By-Push-Value lambda-calculus with fix-points and recursive types. We explain its connection with Linear Logic by presenting a denotational interpretation of the language in any model of Linear Logic equipped with a notion of embedding retraction pairs. We consider the particular case of the Scott model of Linear Logic from which we derive an intersection type system for our calculus and prove an adequacy theorem. Last, we introduce a fully polarized version of this calculus which turns out to be a term language for a large fragment of LLP and refines lambda-mu.

1 Introduction

Linear Logic (LL) has been introduced as a refinement of Intuitionistic Logic: in [14], Girard proposed a very simple and natural translation of intuitionistic logic and of the lambda-calculus in LL. From a categorical point of view, as explained in [28], this translation corresponds to the construction of the Kleisli category of the exponential comonad “\(!\)” of LL. An adequate categorical axiomatization of the denotational models of LL has been then provided in [3], see also [26] for a very complete and detailed picture.

In [14], another possible translation of intuitionistic formulas strangely called “boring” is mentioned. It appeared later that, just as the original Girard’s translation corresponds to the call-by-name (CBN) evaluation strategy of the lambda-calculus, the “boring” translation corresponds to the call-by-value (CBV) reduction strategy, see in particular [24]. Indeed, a first observation is that this latter translation does not preserve all \(\beta \)-reductions, but only those respecting a CBV discipline. More deeply, domain-theoretic denotational models of the lambda-calculus arising through the original Girard translation, that is, arising as Kleisli categories of the exponential comonad, enjoy an adequacy property expressing that a term reduces to a “value” (a head-normal term, say) iff its interpretation is different from \(\bot \). A similar property holds for the CBV translation (now, a closed value is an abstraction) with respect to the CBV reduction strategy.

Both translations give a particularly preeminent role to the Kleisli category of the “\(!\)” comonad. This is obvious for the original CBN translation but it is also true for the CBV translation if we consider that the “\(!\)” functor defines a strong monad on the cartesian closed Kleisli category: then the CBV translation coincides with Moggi’s interpretation of the CBV lambda-calculus in a CCC equipped with a computational monad [27].

So LL provides a common setting where both CBN and CBV can be faithfully interpreted. In spite of its appealing symmetries and its high degree of asynchrony, the syntax of LL proof nets is complex and does not seem to be a convenient starting point for the design of programming languages; it is rather a powerful tool for analyzing the operational and denotational properties of programming languages. It seems therefore natural to look for lambda-calculi admitting a translation in LL and where both CBN and CBV can be embedded, factorizing the two translations mentioned above.

Levy introduced a lambda-calculus subsuming both CBN and CBV: the Call-By-Push-Value lambda-calculus. We propose a similar functional calculus where both CBN and CBV can be encoded and features a simple connection with LL. For reasons which will become clear later, we call it half-polarized lambda-calculus (\(\varLambda _{\mathsf {HP}}\)). Our calculus is actually isomorphic to (a sub-calculus) of SFPL [25]. It bears some similarities with the adjoint calculus of [2], though we do not need linear variables. It is also close to the Enriched Effect Calculus [10].

The LL exponential “\(!\)” allows to turn a term of type A into a term of type \(!{A}\) which is duplicable and discardable, by means of an operation called promotion. This discardability and duplicability is made possible by the structural rules \(!{A}\) is equipped with. It was already observed by Girard in [15] (and probably much earlier) that the property of “being equipped with structural rules” is preserved by the \(\otimes \) and \(\oplus \) connectives of LL. This observation can be made more accurate as follows: a “type equipped with structural rules” is a coalgebra for the “\(!\)” connective, that is, an object of the Eilenberg-Moore category of “\(!\)”, and this category admits \(\oplus \) as coproduct and \(\otimes \) as cartesian product. This category is not a CCC in general but contains the CCC Kleisli category of “\(!\)” as a full sub-category (remember that the Kleisli category is the category of free \(!\)-coalgebras). The Eilenberg-Moore category of “\(!\)” was used crucially by Girard to give a semantics to a classical sequent calculus and by other authors (see for instance [21]) to interpret classical extensions of the lambda-calculus such as Parigot’s \(\lambda \mu \)-calculus.

Replacing the Kleisli category with this larger Eilenberg-Moore category when interpreting the lambda-calculus has other major benefits. Consider for instance the interpretation of ordinary PCF in an LL-induced categorical model, that is, in the Kleisli category of the “\(!\)” comonad of a categorical model \(\mathcal {L}\) of LL. The simplest and most natural interpretation for the type of natural numbers is \(\mathsf N=1\oplus 1\oplus \cdots \) (\(\omega \) copies of the unit \(1\) of the tensor product). But \(1\) has a canonical structure of \(!\)-coalgebra (because \(1=!{\top }\) where \(\top \) is the terminal object of \(\mathcal {L}\)) and this is therefore also true of \(\mathsf N\), as a coproduct of coalgebras. This means that we have a well behaved morphism \(\mathrm h_{\mathsf N}\in \mathcal {L}(\mathsf N,!{\mathsf N})\) which allows to turn any morphism \(f\in {\mathcal {L}}_!(\mathsf N,X)\) of the Kleisli CCC \({\mathcal {L}}_!\) where we interpret PCF into a linear morphism \(f\,\mathrm h_{\mathsf N}\in \mathcal {L}(\mathsf N,X)\). Operationally, this means that, in spite of the fact that PCF is a CBN language and that its interpretation in \({\mathcal {L}}_!\) is a CBN interpretation, we can deal with the terms of ground type in a CBV fashion. For instance we can replace the ordinary PCF “if zero” conditional with the following more sensible one:with the reduction rules
$$\begin{aligned}&\mathsf {if}(\underline{0},N,x\cdot N')\mathrel {\mathord \rightarrow }N\quad \quad \mathsf {if}(\underline{n+1},N,x\cdot N')\mathrel {\mathord \rightarrow }{N'}\left[ {\underline{n}}/{x}\right] \\&M\mathrel {\mathord \rightarrow }M'\Rightarrow \mathsf {if}(M,N,x\cdot N')\mathrel {\mathord \rightarrow }\mathsf {if}(M',N,x\cdot N') \end{aligned}$$
The denotational interpretation of \(\mathsf {if}(M,N,x\cdot N')\) uses crucially the coalgebra structure \(\mathrm h_{\mathsf N}\) of \(\mathsf N\). This idea is also reminiscent of Krivine’s storage operators [20] which allow a CBV discipline for data types in a globally CBN calculus.

Call-By-Push-Value and \(\varLambda _{\mathsf {HP}}\) generalize this idea. We consider two classes of types: the positive types\(\varphi ,\psi \dots \) and the larger class of general types\(\sigma ,\tau ,\dots \) Just as in [15], positive types correspond to objects of \({\mathcal {L}}^!\) whereas general types are just objects of \(\mathcal {L}\). Of course there is an obvious way of considering a positive type as a general one by simply forgetting its coalgebra structure. There is also a way of turning a general type into a positive one using “\(!\)”, and positive types are stable under sums \(\oplus \) and product \(\otimes \). In Girard’s CBN translation, \({\sigma }\Rightarrow {\tau }\) (where \({}\Rightarrow {}\) is intuitionistic implication) becomes \({!{\sigma }}\multimap {\tau }\): the main idea of\(\varLambda _{\mathsf {HP}}\)is to generalize this idea by allowing to replace\(!{\sigma }\)with an arbitrary positive type\(\varphi \). Therefore, the implication of \(\varLambda _{\mathsf {HP}}\) is linear: all the required non-linearity is provided by the positivity of the premise. Accordingly all variables have positive types. This is also why we use a new notation \(\langle M\rangle N\) for the application of M to N, to stress the fact that this application is linear.

There is however a subtlety which does not occur in CBN: consider a term M of type \(\sigma \) with one free variable x of positive type \(\varphi \). Consider also a closed term N of type \(\varphi \). The interpretation of M is a morphism \(f\in \mathcal {L}(\varphi ,\sigma )\) (identifying types with their interpretation) and the interpretation of N is a morphism \(g\in \mathcal {L}(1,\varphi )\). There is no reason however for g to belong to \({\mathcal {L}}^!(1,\varphi )\) and so we cannot be sure that \(f\,g\) (we use simple juxtaposition to denote composition of morphisms in \(\mathcal {L}\)) will coincide with the interpretation of \({M}\left[ {N}/{x}\right] \). Indeed, for that substitutivity property to hold, we would need g to be duplicable and discardable which is the case if we can make sure that \(g\in {\mathcal {L}}^!(1,\varphi )\), but does not hold in general. It is here that the syntactic notion of value comes in: if \(\varphi =!{\sigma }\) then N is a value if \(N=R^!\) (a promotion of a term R of type \(\sigma \)), if \(\varphi ={\varphi _1}\otimes {\varphi _2}\) then N is a value if \(N=\langle {V_1,V_2}\rangle \) where \(V_i\) is a value of type \(\varphi _i\), and similarly for sums. The main property of values is that their interpretations are coalgebra morphisms: if N is a value then \(g\in {\mathcal {L}}^!(1,\varphi )\). This is why, in \(\varLambda _{\mathsf {HP}}\), \(\beta \) reduction is restricted to the case where the argument is a value. This also means that in \(\langle \lambda x^{\varphi }\, M\rangle N\) we need to reduce N to a value before reducing the \(\beta \)-redex. If, for instance, the reduction of N diverges without reaching a value then the reduction of \(\langle \lambda x^{\varphi }\, M\rangle N\) diverges even if M does not use x, just as in CBV.

Positive types are also stable under fix-points if we assume that the objects of \(\mathcal {L}\) can be equipped with a notion of embedding-retraction pairs, which is usually the case in categories of domains. Under the assumption that this new category has all countable filtered colimits and that the functors interpreting types are continuous, it is easy to prove that all “positive types with parameters” have fix-points which are themselves positive types. The presence of “\(!\)” as an explicit type constructor in \(\varLambda _{\mathsf {HP}}\) allows to define lazy recursive types such as \(\rho =\varphi \otimes !{\rho }\) where \(\varphi \) is a given type: \(\rho \) is the type of streams of elements of type \(\varphi \). At the level of terms, the construction which introduces an “\(!\)” is the aforementioned construction \(R^!\) which corresponds to the well known (generalized) promotion of LL aka exponential box; this construction corresponds here to thunks or suspensions. In this stream type \(\rho \) the box construction is crucially used to postpone the evaluation of the tail of the stream. The box can be opened (that is, the thunk can be forced) by means of an explicit dereliction syntactic construct \(\mathsf {der}(M)\) which can be applied to any term M of type \(!{\sigma }\) for some \(\sigma \) and which corresponds exactly to the usual dereliction rule of LL.

Contents. We define a version of \(\varLambda _{\mathsf {HP}}\) featuring positive and ordinary types, recursive positive types and a fix-point operator for terms. Since many data types can be defined easily in this language (ordinary integers, lazy integers, lists, streams, various kinds of finite and infinite trees...), it widely encompasses PCF and is closer to FPC [13], with the additional feature of allowing to freely combine CBV and CBN. We define the syntax of the language, provide a typing system and a simple operational semantics which is “weak” in the sense that reduction is forbidden under \(\lambda \)s and within boxes (more general reductions can of course be defined but, just as in CBV, a let construction or new reduction rules as in [4] should be added).

We do not describe the embeddings of the CBN and CBV lambda-calculi into \(\varLambda _{\mathsf {HP}}\) because they are very similar to the corresponding embeddings into CBPV, described in [22]. It will be fully described in a longer version of this paper.

Then we recall the general definition of a categorical model of LL (with fix-point operators), of its Eilenberg-Moore category and we describe the additional categorical structure which will allow to interpret recursive positive types. To illustrate the connection of \(\varLambda _{\mathsf {HP}}\) with LL without introducing a syntax for LL proofs1, we describe the interpretation of \(\varLambda _{\mathsf {HP}}\) in such a categorical model of LL and state a Soundness Theorem.

This categorical semantics is a special case of Levy’s adjunction semantics of [22] for CBPV. One of the interests of this LL-based semantics is that it admits extensions in various exciting directions (Ludics, Differential LL, Light LL etc.) on which we think that \(\varLambda _{\mathsf {HP}}\) will shed a new light. There is another good reason for considering this semantics: it gives a standard way of building the “category of values” as \(\mathcal {L}^{\mathord !}\), starting from a “linear” category \(\mathcal {L}\) which is usually much simpler. This is typically the case when \(\mathcal {L}\) is the category of coherence spaces and linear maps; in this case it is not easy to give a direct, domain-theoretic description of \(\mathcal {L}^{\mathord !}\). The Scott semantics described in Sect. 4 is a remarkable exception where \(\mathcal {L}^{\mathord !}\) can be seen as a category of predomains and Scott continuous functions.

We also provide a description of this Scott semantical interpretation as a very simple “intersection” typing system and prove an adequacy theorem (which can be understood as a normalization theorem for this typing system). This result is important as it shows that our weak reduction semantics for \(\varLambda _{\mathsf {HP}}\) is complete in the sense that if a closed term is equivalent to a value in any equivalence relation compatible with the denotational semantics, then it weakly reduces to a value. Next we introduce a fully polarized version \(\varLambda _{\mathsf {LLP}}\) of our calculus, a system which is closer to Levy’s original CBPV although it generalizes it by allowing “classical” constructions borrowed from Parigot’s \(\lambda \mu \)-calculus and is deeply related with Laurent’s Polarized Linear Logic LLP. Last we define an encoding of \(\varLambda _{\mathsf {HP}}\) into \(\varLambda _{\mathsf {LLP}}\) and outline its basic features.

Our initial motivation for introducing \(\varLambda _{\mathsf {LLP}}\) was to combine our representation of data as \(!\)-coalgebra morphisms in \(\varLambda _{\mathsf {HP}}\) with the representation of stacks (continuations) as \(!\)-coalgebra morphisms in the semantics of classical calculi such as the CBN \(\lambda \mu \)-calculus. \(\varLambda _{\mathsf {LLP}}\) is presented in the \(\lambda \mu \tilde{\mu }\) style [7] and further developed in [8]. We think that it provides a satisfactory answer to our quest and deserves further study. Independently, Pierre-Louis Curien introduced recently in the unpublished note [5] a similar formalism for representing Levy’s original CBPV (Curien’s calculus however is intuitionistic whereas ours is classical).

2 Syntax

Types are given by the following BNF syntax. We define by mutual induction two kinds of types: positive types and general types, given type variables \(\zeta \), \(\xi \)...:
$$\begin{aligned} \text {positive types}\quad \varphi ,\psi ,\dots {}&\mathrel {\mathord :\mathord =}\, !\sigma \,\,\mathord |\,\,{\varphi }\otimes {\psi }\,\,\mathord |\,\,{\varphi }\oplus {\psi }\,\,\mathord |\,\,\zeta \,\,\mathord |\,\,\textsf {Fix}\,\zeta \cdot \varphi \end{aligned}$$
$$\begin{aligned} \text {general types types}\quad \sigma ,\tau \dots {}&\mathrel {\mathord :\mathord =}\varphi \,\,\mathord |\,\,{\varphi }\multimap {\sigma }\,\,\mathord |\,\,\top \end{aligned}$$
More constructions could be added for general types, as in CBPV (such as products or recursive types), we do not so here by lack of space. We consider the types up to the equation \(\textsf {Fix}\,\zeta \cdot \varphi ={\varphi }\left[ {(\textsf {Fix}\,\zeta \cdot \varphi )}/{\zeta }\right] \).
Terms are given by the following BNF syntax, given variables \(x,y,\dots \):
$$\begin{aligned} M,N\dots {} \mathrel {\mathord :\mathord =}x&\,\,\mathord |\,\,M^{\mathord !} \,\,\mathord |\,\,\langle M,N\rangle \,\,\mathord |\,\,\mathsf {in}_{1}M \,\,\mathord |\,\,\mathsf {in}_{2}M \\&\,\,\mathord |\,\,\lambda x^{\varphi }\, M \,\,\mathord |\,\,\langle M\rangle N \,\,\mathord |\,\,\mathsf {case}(M,x_1\cdot N_1,x_2\cdot N_2)\\&\,\,\mathord |\,\,\mathsf {pr}_{1}M \,\,\mathord |\,\,\mathsf {pr}_{2}M \,\,\mathord |\,\,\mathsf {der}(M) \,\,\mathord |\,\,\mathsf {fix}\,x^{!\sigma }\,M \end{aligned}$$
This calculus can be seen as a special case of Levy’s CBPV [22] in which the type constructor F is kept implicit (and U is “\(!\)”). Section 5 proposes a version of CBPV where F is “\(?\)”, taking benefit of this for introducing constructs related to classical logic.
The notion of substitution is defined as usual. Figure 1 provides the typing rules for these terms. A typing context is an expression \(\mathcal {P}=(x_1:\varphi _1,\dots ,x_k:\varphi _k)\) where all types are positive and the \(x_i\)s are pairwise distinct variables.
Fig. 1.

Typing system for \(\varLambda _{\mathsf {HP}}\)

Remark 1

It might seem strange to the reader acquainted with LL that the rules introducing the \(\otimes \) connective and eliminating the \(\mathord \multimap \) connective have an “additive” handling of typing contexts (the same typing context \(\mathcal {P}\) occurs in both premises): our contexts are not linear. The reason for this becomes clear in Sect. 3 where positive types are interpreted as \(!\)-coalgebras, which are equipped with morphisms allowing to interpret the structural rules of weakening and contraction. This is why typing contexts involve positive types only.

We define now a weak reduction relation on terms, meaning that we never reduce within a “box” \(M^{\mathord !}\) or under a \(\lambda \). Values are particular \(\varLambda _{\mathsf {HP}}\) terms (they are not a new syntactic category) defined by the following BNF syntax:
$$\begin{aligned} V,W\dots {} \mathrel {\mathord :\mathord =}x \,\,\mathord |\,\,M^{\mathord !} \,\,\mathord |\,\,\langle V,W\rangle \,\,\mathord |\,\,\mathsf {in}_{1}V \,\,\mathord |\,\,\mathsf {in}_{2}V\,. \end{aligned}$$

Remark 2

A closed value is simply a tree whose leaves are “boxes” or “thunks” \(M^{\mathord !}\) (where the M’s are arbitrary well typed closed terms) and whose internal nodes are either unary nodes bearing an index 1 or 2, or ordered binary nodes.

Figure 2 defines weak reduction \(\mathord \rightarrow _{\mathsf w}\).
Fig. 2.

Weak reduction axioms and rules for \(\varLambda _{\mathsf {HP}}\)

Proposition 1

The reduction \(\mathord \rightarrow _{\mathsf w}\) enjoys subject reduction and Church-Rosser.

The first statement is a straightforward verification using a Substitution Lemma that we do not state. The second one is easy: \(\mathord \rightarrow _{\mathsf w}\) has the diamond property.

Proposition 2

Any value is \(\mathord \rightarrow _{\mathsf w}\)-normal. If \(\varphi \) is a positive type, \(\vdash M:\varphi \) and M is \(\mathord \rightarrow _{\mathsf w}\)-normal, then M is a value.

This is easy. In the second statement M has to be closed (the term \(\langle \mathsf {der}(x)\rangle V\) is normal, is not a value and can be given a positive type).

2.1 Examples

Given any type \(\sigma \), we define \(\varOmega ^{\sigma }=\mathsf {fix}\,x^{!\sigma }\,\mathsf {der}(x)\) which satisfies \(\vdash \varOmega ^{\sigma }:\sigma \). It is clear that \(\varOmega ^{\sigma }\mathrel {\mathord \rightarrow _{\mathsf w}}\mathsf {der}((\varOmega ^{\sigma })^{\mathord !})\mathrel {\mathord \rightarrow _{\mathsf w}}\varOmega ^{\sigma }\) so that we can consider \(\varOmega ^{\sigma }\) as the ever-looping program of type \(\sigma \).

Unit type and natural numbers. We define a unit type \(1\) by \(1=!\top \), and we set \(*=(\varOmega ^{\top })^{\mathord !}\). We define the type \(\iota \) of unary natural numbers by \(\iota ={1}\oplus {\iota }\) (by this we mean that \(\iota =\textsf {Fix}\,\zeta \cdot ({1}\oplus {\zeta })\)). We define \(\underline{0}=\mathsf {in}_{1}*\) and \(\underline{n+1}=\mathsf {in}_{2}\underline{n}\) so that we have \(\mathcal {P}\vdash \underline{n}:\iota \) for each \(n\in {\mathbb {N}}\).

Then, given a term M, we define the term \(\mathsf {suc}(M)=\mathsf {in}_{2}M\), so that we haveLast, given terms M, \(N_1\) and \(N_2\) and a variable x, we define an “ifz” conditional by \(\mathsf {if}(M,N_1,x\cdot N_2)=\mathsf {case}(M,z\cdot N_1,x\cdot N_2)\) where z is not free in \(N_1\), so thatStreams. Let \(\varphi \) be a positive type and \(\mathsf S_{\varphi }\) be the positive type defined by \(\mathsf S_{\varphi }={\varphi }\otimes {!\mathsf S_{\varphi }}\), that is \(\mathsf S_{\varphi }=\textsf {Fix}\,\zeta \cdot ({\varphi }\otimes {!\zeta })\). We can define a term M such that \(\vdash M:{\mathsf S_{\varphi }}\multimap {{\iota }\multimap {\varphi }}\) which computes the nth element of a stream:
$$\begin{aligned} M=\mathsf {fix}\,f^{!({\mathsf S_{\varphi }}\multimap {{\iota }\multimap {\varphi }})}\,\lambda x^{\mathsf S_{\varphi }}\, \lambda y^{\iota }\, {}\mathsf {if}(y,\mathsf {pr}_{1}x,z\cdot \langle \mathsf {der}(f)\rangle \mathsf {der}(\mathsf {pr}_{2}x){\,z}) \end{aligned}$$
Conversely, we can define a term N such that \(\vdash N:{!({\iota }\multimap {\varphi })}\multimap {\mathsf S_{\varphi }}\) which turns a function into a stream.
$$\begin{aligned} N=\mathsf {fix}\,F^{!({!({\iota }\multimap {\varphi })}\multimap {\mathsf S_{\varphi }})}\,\lambda f^{!({\iota }\multimap {\varphi })}\, \langle \langle \mathsf {der}(f)\rangle \underline{0},(\langle \mathsf {der}(F)\rangle (\lambda x^{\iota }\, \langle \mathsf {der}(f)\rangle \mathsf {suc}(x))^{\mathord !} ) ^{\mathord !} \rangle \end{aligned}$$
Observe that the recursive call of F is encapsulated into a box, which makes the construction lazy.

Lists. There are various possibilities for defining a type of lists of elements of a positive type \(\varphi \). The simplest definition is \(\lambda _0={1}\oplus {({\varphi }\otimes {\lambda _0})}\). This corresponds to the ordinary ML type of lists. But we can also define \(\lambda _1={1}\oplus {({\varphi }\otimes {!\lambda _1})}\) and then we have a type of lazy lists (or terminable streams) where the tail of the list is computed only when required.

We could also consider \(\lambda _2={1}\oplus {({!\sigma }\otimes {\lambda _2})}\) which allows to manipulate lists of objects of type \(\sigma \) (which can be a general type) without accessing their elements.

3 Denotational Semantics

The kind of denotational models we are interested in in this paper are those induced by a model of LL, in the spirit of Girard’s seminal work [15] on the semantics of the classical system LC where positive formulas are interpreted as \(\otimes \)-comonoids; this interpretation is further developed e.g. in [21]. We use here exactly the same idea for interpreting positive types.

We first recall the general categorical definition of a model of LL implicit in [14], our main reference here is [26] to which we also refer for the rich bibliography on this general topic.

3.1 Models of Linear Logic

A model of LL consists of the following data.

  • A category \(\mathcal {L}\).

  • A symmetric monoidal structure \((\otimes ,1,\lambda ,\rho ,\alpha ,\sigma )\) which is assumed to be closed: \(\otimes \) is a functor \(\mathcal {L}^2\rightarrow \mathcal {L}\), \(1\) an object of \(\mathcal {L}\), \(\lambda _X\in \mathcal {L}({1}\otimes {X},X)\), \(\rho _X\in \mathcal {L}({X}\otimes {1},X)\), \(\alpha _{X,Y,Z}\in \mathcal {L}({({X}\otimes {Y})}\otimes {Z},{X}\otimes {({Y}\otimes {Z})})\) and \(\sigma _{X,Y}\in \mathcal {L}({X}\otimes {Y},{Y}\otimes {X})\) are natural isomorphisms satisfying coherence diagrams that we do not record here. We use \({X}\multimap {Y}\) for the object of linear morphisms from X to Y, \({\mathrm {ev}}\) for the evaluation morphism which belongs to \(\mathcal {L}({({X}\multimap {Y})}\otimes {X},Y)\) and \({\mathrm {cur}}\) for the linear curryfication map \(\mathcal {L}({Z}\otimes {X},Y)\rightarrow \mathcal {L}(Z,{X}\multimap {Y})\).

  • An object \({{\perp }}\) of \(\mathcal {L}\) such that the natural morphism \(\eta _X={\mathrm {cur}}({\mathrm {ev}}\,\sigma _{{X}\multimap {{{\perp }}},X})\in \mathcal {L}(X,{({X}\multimap {{{\perp }}})}\multimap {{{\perp }}})\) is an iso for each object X (one says that \(\mathcal {L}\) is a \(*\)-autonomous category2). We use \(X^{{{\perp }}_{}}\) for the object \({X}\multimap {{{\perp }}}\) of \(\mathcal {L}\).

  • The category \(\mathcal {L}\) is assumed to be cartesian. We use \(\top \) for the terminal object, \( \mathrel { \& }\) for the cartesian product and \({\mathrm {pr}}_{i}\) for the projections. It follows by \(*\)-autonomy that \(\mathcal {L}\) has also all finite coproducts. We use \(0\) for the initial object, \(\oplus \) for the coproduct and \({\mathrm {in}}_{i}\) for the injections. Given an object X of \(\mathcal {L}\), we use \(\textsf {in}^{X}\) for the unique element of \(\mathcal {L}(0,X)\).

  • We are also given a comonad \(!{\_}:\mathcal {L}\rightarrow \mathcal {L}\) with counit \({{\mathrm {der}}}_{X}\in \mathcal {L}(!{X},X)\) (called dereliction) and comultiplication \({{\mathrm {dig}}}_{X}\in \mathcal {L}(!{X},!{!{X}})\) (called digging).

  • And a strong symmetric monoidal structure for the functor \(!{\_}\), from the symmetric monoidal category \( (\mathcal {L},\mathrel { \& })\) to the symmetric monoidal category \((\mathcal {L},\otimes )\). This means that we are given an iso \(\mathrm m^0\in \mathcal {L}(1,!{\top })\) and a natural iso \( \mathrm m^2_{X,Y}\in \mathcal {L}({!{X}}\otimes {!{Y}},!{({X}\mathrel { \& }{Y})})\) which satisfy commutations that we do not record here. We also require a coherence condition relating \(\mathrm m^2\) and \({{\mathrm {dig}}}_{}\).

We use \(?{\_}\) for the “De Morgan dual” of \(!{\_}\): \(?{X}=(!({X^{{{\perp }}_{}}}))^{{{\perp }}_{}}\) and similarly for morphisms. It is a monad on \(\mathcal {L}\) with unit \({\mathrm {der}}'_{X}\) and multiplication \({{\mathrm {dig}}}_{X}'\) defined straightforwardly, using \({{\mathrm {der}}}_{Y}\) and \({{\mathrm {dig}}}_{Y}\).

Lax monoidality. It follows that we can define a lax symmetric monoidal structure for the functor \(!{\_}\) from the symmetric monoidal category \((\mathcal {L},\otimes )\) to itself. This means that we can define a morphism \(\mu ^0\in \mathcal {L}(1,!{1})\) and a natural transformation \(\mu ^2_{X,Y}\in \mathcal {L}({!{X}}\otimes {!{Y}},!{({X}\otimes {Y})})\) which satisfy some coherence diagrams whose main consequence is that we can canonically extend this natural transformation to the case of n-ary tensors:
$$\begin{aligned} \mu ^{(n)}_{X_{1},\dots ,X_{N}}\in \mathcal {L}(!{X_1}\otimes \cdots \otimes !{X_n}, !{(X_1\otimes \cdots \otimes X_n)}) \end{aligned}$$
in a way which is compatible with the symmetric monoidal structure of \(\mathcal {L}\) (and allows us to write things just as if \(\otimes \) were strictly associative).

The Eilenberg-Moore category. It is then standard to define the category \(\mathcal {L}^{\mathord !}\) of \({\mathord {!}}\)-coalgebras. An object of this category is a pair \(P=(\underline{P},\mathrm h_{P})\) where \(\underline{P}\in \mathsf {Obj}(\mathcal {L})\) and \(\mathrm h_{P}\in \mathcal {L}(\underline{P},!{\underline{P}})\) is such that \({{\mathrm {der}}}_{\underline{P}}\,\mathrm h_{P}={\mathrm {Id}}\) and \({{\mathrm {dig}}}_{\underline{P}}\,\mathrm h_{P}=!{\mathrm h_{P}}\,\mathrm h_{P}\).

Given two such coalgebras P and Q, an element of \(\mathcal {L}^{\mathord !}(P,Q)\) is an \(f\in \mathcal {L}(\underline{P},\underline{Q})\) such that \(\mathrm h_{Q}\,f=!{f}\,\mathrm h_{P}\). Identities and composition are defined in the obvious way. The functor \(!{\_}\) can then be seen as a functor from \(\mathcal {L}\) to \(\mathcal {L}^{\mathord !}\): this functor maps X to the coalgebra \((!{X},{{\mathrm {dig}}}_{X})\) and a morphism \(f\in \mathcal {L}(X,Y)\) to the coalgebra morphism \(!{f}\in \mathcal {L}^{\mathord !}((!{X},{{\mathrm {dig}}}_{X}),(!{Y},{{\mathrm {dig}}}_{Y}))\). This functor is right adjoint to the forgetful functor \(\mathsf U:\mathcal {L}^{\mathord !}\rightarrow \mathcal {L}\) which maps a \(!\)-coalgebra P to \(\underline{P}\) and a morphism f to itself. Given \(f\in \mathcal {L}(\underline{P},X)\), we use \(f^!\in \mathcal {L}^{\mathord !}(P,!{X})\) for the morphism associated with f by this adjunction, one has \(f^!=!{f}\,\mathrm h_{P}\). If \(g\in \mathcal {L}^{\mathord !}(Q,P)\), we have
$$\begin{aligned} f^!\,g=(f\,g)^! \end{aligned}$$
The object \(1\) of \(\mathcal {L}\) induces an object of \(\mathcal {L}^{\mathord !}\), still denoted as \(1\), namely \((1,\mu ^0)\).

Given two objects P and Q of \(\mathcal {L}^{\mathord !}\), one defines an object \({P}\otimes {Q}\) of \(\mathcal {L}^{\mathord !}\) by setting \(\underline{{P}\otimes {Q}}={\underline{P}}\otimes {\underline{Q}}\) and by defining \(\mathrm h_{{P}\otimes {Q}}\) as a composition of morphisms:

Any object P of \(\mathcal {L}^{\mathord !}\) can be equipped with a canonical structure of commutative comonoid. This means that we can define a morphism \({\mathrm {w}}_{P}\in \mathcal {L}^{\mathord !}(P,1)\) and a morphism \({\mathrm {c}}_{P}\in \mathcal {L}^{\mathord !}(P,{P}\otimes {P})\) which satisfy the commutations of Fig. 3.
Fig. 3.

Commutative \(\otimes \)-comonoid

One can check a stronger property, namely that \(1\) is the terminal object of \(\mathcal {L}^{\mathord !}\) and that \({P}\otimes {Q}\) (equipped with projections defined in the obvious way using \({\mathrm {w}}_{Q}\) and \({\mathrm {w}}_{P}\)) is the cartesian product of P and Q in \(\mathcal {L}^{\mathord !}\); the proof consists of surprisingly long computations for which we refer again to [26].

It is also important to notice that, if the family \((P_i)_{i\in I}\) of objects of \(\mathcal {L}^{\mathord !}\) is such that the family \((\underline{P_i})_{i\in I}\) admits a coproduct \((\bigoplus _{i\in I}\underline{P_i},({\mathrm {in}}_{i})_{i\in I})\) in \(\mathcal {L}\), then it admits a coproduct in \(\mathcal {L}^{\mathord !}\). This coproduct \(P=\bigoplus _{i\in I}P_i\) is defined by \(\underline{P}=\bigoplus _{i\in I}\underline{P_i}\), with a structure map \(\mathrm h_{P}\) defined by the fact that, for each \(i\in I\), \(\mathrm h_{P}\,{\mathrm {in}}_{i}\) is the following composition of morphisms:

Fix-point operators. For any object X, we assume to be given a morphism \({\mathrm {fix}}_X\in \mathcal {L}(!({{!{X}}\multimap {X}}),X)\) such that the following diagram commutes

Remark 3

It might seem natural to require stronger uniformity conditions inspired by the notion of Conway operator [30]. This does not seem to be necessary as far as soundness of our semantics is concerned even if the fix-point operators arising in concrete models satisfy these further properties.

3.2 Embedding-Retraction Pairs

We introduce the categorical assumptions used to interpret fix-points of types.

We assume that \(0\) and \(\top \) are isomorphic; these isos being unique, we assume that \(0\) and \(\top \) are the same objects3.

We assume to be given a category \(\mathcal {L}_{\mathord \subseteq }\) such that \(\mathsf {Obj}(\mathcal {L}_{\mathord \subseteq })=\mathsf {Obj}(\mathcal {L})\) together with a functor \(\mathsf {F}:\mathcal {L}_{\mathord \subseteq }\rightarrow {\mathcal {L}}^{\mathsf {op}}\times \mathcal {L}\) such that \(\mathsf {F}(X)=(X,X)\) and for which we use the notation \((\varphi ^-,\varphi ^+)=\mathsf {F}(\varphi )\). We assume that \(\varphi ^-\,\varphi ^+={\mathrm {Id}}_X\). We define \(\mathsf E\) (for embedding) as the functor \({\mathrm {pr}}_{2}\,\mathsf {F}:\mathcal {L}_{\mathord \subseteq }\rightarrow \mathcal {L}\). We assume moreover that the following properties hold.

  • The category \(\mathcal {L}_{\mathord \subseteq }\) has all countable filtered colimits and these colimits are preserved by \(\mathsf E\).

  • \(0\) is initial in \(\mathcal {L}_{\mathord \subseteq }\) with \(\mathsf E{\theta ^X}=\textsf {in}^{X}\) if \(\theta ^X\) is the unique element of \(\mathcal {L}_{\mathord \subseteq }(0,X)\).

  • There is a continuous functor4\(\otimes _{\mathord \subseteq }:\mathcal {L}_{\mathord \subseteq }^2\rightarrow \mathcal {L}_{\mathord \subseteq }\) which behaves as \(\otimes \) on objects and satisfies \((\varphi \otimes _{\mathord \subseteq }\psi )^+={\varphi ^+}\otimes {\psi ^+}\) and \((\varphi \otimes _{\mathord \subseteq }\psi )^-={\varphi ^-}\otimes {\psi ^-}\). We use the same notation \(\otimes \) for the functor \(\otimes _{\mathord \subseteq }\). We make similar assumptions for \(\oplus \) and \(!{\_}\).

  • There is a continuous functor \(\mathcal {N}:\mathcal {L}_{\mathord \subseteq }\rightarrow \mathcal {L}_{\mathord \subseteq }\) such that \(\mathcal {N}(X)=X^{{{\perp }}_{}}\), \(\mathcal {N}(\varphi )^+=(\varphi ^-)^{{{\perp }}_{}}\) and \(\mathcal {N}(\varphi )^-=(\varphi ^+)^{{{\perp }}_{}}\). We simply denote \(\mathcal {N}(\varphi )\) as \(\varphi ^{{{\perp }}_{}}\); remember that this operation is covariant.

So we can define a continuous covariant functor \(\mathord \multimap :\mathcal {L}_{\mathord \subseteq }^2\rightarrow \mathcal {L}_{\mathord \subseteq }\) by \({X}\multimap {Y}=({X}\otimes {Y^{{{\perp }}_{}}})^{{{\perp }}_{}}\) and \({\varphi }\multimap {\psi }=({\varphi }\otimes {\psi ^{{{\perp }}_{}}})^{{{\perp }}_{}}\), so that \(({\varphi }\multimap {\psi })^+={\varphi ^-}\multimap {\psi ^+}\) and \(({\varphi }\multimap {\psi })^-={\varphi ^+}\multimap {\psi ^-}\) in \(\mathcal {L}\).

We need to extend this notion of embedding-retraction pair to \(!\)-coalgebras because we want to define fix-points of positive types. Let \(\mathcal {L}^{\mathord !}_{\mathord \subseteq }\) be the category whose objects are those of \(\mathcal {L}^{\mathord !}\) and where
$$\begin{aligned} \mathcal {L}^{\mathord !}_{\mathord \subseteq }(P,Q)=\{\varphi \in \mathcal {L}_{\mathord \subseteq }(\underline{P},\underline{Q})\mid \varphi ^+\in \mathcal {L}^{\mathord !}(P,Q)\}\,. \end{aligned}$$
In this definition, it is important not to require\(\varphi ^-\) to be a coalgebra morphism. We still use \(\mathsf U\) for the obvious forgetful functor \(\mathcal {L}^{\mathord !}_{\mathord \subseteq }\rightarrow \mathcal {L}_{\mathord \subseteq }\). Observe that \(\otimes \) and \(\oplus \) define functors \((\mathcal {L}^{\mathord !}_{\mathord \subseteq })^2\rightarrow \mathcal {L}^{\mathord !}_{\mathord \subseteq }\) and that \(!{\_}\) defines a functor \(\mathcal {L}_{\mathord \subseteq }\rightarrow \mathcal {L}^{\mathord !}_{\mathord \subseteq }\).

Let J be a countable filtered category and let \(\mathcal {E}:J\rightarrow \mathcal {L}^{\mathord !}_{\mathord \subseteq }\) be a functor. Let X be the colimit of the functor \(\mathsf U\,\mathcal {E}\) in \(\mathcal {L}_{\mathord \subseteq }\) and let \((\varphi _i\in \mathcal {L}_{\mathord \subseteq }(\mathsf U\mathcal {E}(i),X))_{i\in J}\) be the corresponding colimit cocone. We know that \((\varphi _i^+\in \mathcal {L}(\mathsf U\mathcal {E}(i),X))_{i\in J}\) is a colimit cocone in \(\mathcal {L}\). In particular, to prove that two morphisms \(g,g'\in \mathcal {L}(X,Y)\) are equal, it suffices to prove that \(g\,\varphi _i^+=g'\,\varphi _i^+\) for each \(i\in J\).

We want to equip X with a coalgebra structure \(h\in \mathcal {L}(X,!{X})\). For this, due to this universal property, it suffices to define a cocone \((f_i\in \mathcal {L}(\mathsf U\mathcal {E}(i),!{X}))_{i\in J}\). We set \(f_i=!{\varphi _i^+}\,\mathrm h_{\mathcal {E}(i)}\) and h is completely characterized by the fact that \(h\,\varphi _i^+=f_i\) for each \(i\in J\).

Let us prove that \({{\mathrm {der}}}_{X}\,h={\mathrm {Id}}_X\). We have \({{\mathrm {der}}}_{X}\,h\,\varphi _i^+={{\mathrm {der}}}_{X}\,!{\varphi _i^+}\,\mathrm h_{\mathcal {E}(i)} =\varphi _i^+\,{{\mathrm {der}}}_{\underline{\mathcal {E}(i)}}\,h_{\mathcal {E}(i)}=\varphi _i^+\) and the result follows from the universal property. The equation \({{\mathrm {dig}}}_{X}\,h=!{h}\,h\) is proven similarly: we have \({{\mathrm {dig}}}_{X}\,h\,\varphi _i^+={{\mathrm {dig}}}_{X}\,!{\varphi _i^+}\,\mathrm h_{\mathcal {E}(i)} =!{!{\varphi ^+_i}}\,{{\mathrm {dig}}}_{\underline{\mathcal {E}(i)}}\,\mathrm h_{\mathcal {E}(i)} =!{!{\varphi ^+_i}}\,!{\mathrm h_{\mathcal {E}(i)}}\,\mathrm h_{\mathcal {E}(i)} =!{f_i}\,\mathrm h_{\mathcal {E}(i)}\) and \(!{h}\,h\,\varphi _i^+=!{h}\,!{\varphi _i^+}\,\mathrm h_{\mathcal {E}(i)} =!{f_i}\,\mathrm h_{\mathcal {E}(i)}\).

So we have proven that \(\mathcal {E}\) has a colimit in the category \(\mathcal {L}^{\mathord !}\) of coalgebras. A functor \(\varPhi :\mathcal {M}_1\times \cdots \times \mathcal {M}_n\rightarrow \mathcal {M}\) (where \(\mathcal {M}\) and the \(\mathcal {M}_i\)s belong to \(\{\mathcal {L}_{\mathord \subseteq },\mathcal {L}^{\mathord !}_{\mathord \subseteq }\}\)) is continuous if it commutes with countable filtered colimits.

Proposition 3

The functors \(\otimes \) and \(\oplus \) from \((\mathcal {L}^{\mathord !}_{\mathord \subseteq })^2\) to \(\mathcal {L}^{\mathord !}_{\mathord \subseteq }\) are continuous. The functor \(!{\_}:\mathcal {L}_{\mathord \subseteq }\rightarrow \mathcal {L}^{\mathord !}_{\mathord \subseteq }\) is continuous. The functor \(\mathord {\multimap }:(\mathcal {L}_{\mathord \subseteq })^2\rightarrow \mathcal {L}_{\mathord \subseteq }\) is continuous.

Immediate consequence of our hypotheses and of the above considerations.

Theorem 1

Let \(\varPhi :(\mathcal {L}^{\mathord !}_{\mathord \subseteq })^{n+1}\rightarrow \mathcal {L}^{\mathord !}_{\mathord \subseteq }\) be continuous. There is a continuous \({\text {Fix}}(\varPhi ):(\mathcal {L}^{\mathord !}_{\mathord \subseteq })^{n}\rightarrow \mathcal {L}^{\mathord !}_{\mathord \subseteq }\) which is naturally isomorphic to \(\varPhi \mathrel \circ \langle {{\mathrm {Id}}^n,{\text {Fix}}(\varPhi )}\rangle \).


Let \(\mathbf {P}=(P_{1},\dots ,P_{n})\) be a tuple of objects of \(\mathcal {L}^{\mathord !}\). Consider the functor \(\varPhi _{\mathbf {P}}:\mathcal {L}^{\mathord !}_{\mathord \subseteq }\rightarrow \mathcal {L}^{\mathord !}_{\mathord \subseteq }\) defined by \(\varPhi _{\mathbf {P}}(P)=\varPhi (\mathbf {P},P)\) and similarly for morphisms. Consider the set of natural numbers equipped with the usual order relation as a filtered category (\({\mathbb {N}}(n,m)\) has one element \(l_{n,m}\) if \(n\le m\) and is empty otherwise). We define a functor \(\mathcal {E}:{\mathbb {N}}\rightarrow \mathcal {L}^{\mathord !}_{\mathord \subseteq }\) as follows. First, we set \(\mathcal {E}(i)=\varPhi _{\mathbf {P}}^i(0)\). For each i, we define \(\varphi _0=\theta ^{\underline{\mathcal {E}(1)}}\) and then we set \(\varphi _{i+1}=\varPhi _{\mathbf {P}}(\varphi _i)\). Then, given \(i,j\in {\mathbb {N}}\) such that \(i\le j\), we set \(\mathcal {E}(l_{i,j})=\varphi _{j-1}\,\cdots \,\varphi _i\). We define \({\text {Fix}}(\varPhi )(\mathbf {P})\) as the colimit of this functor \(\mathcal {E}\) in \(\mathcal {L}^{\mathord !}_{\mathord \subseteq }\). By standard categorical methods using the universal property of colimits, we extend this operation to a continuous functor \({\text {Fix}}(\varPhi ):(\mathcal {L}^{\mathord !}_{\mathord \subseteq })^{n}\rightarrow \mathcal {L}^{\mathord !}_{\mathord \subseteq }\) which satisfies the required condition by continuity of \(\varPhi \).    \(\square \)

3.3 Interpreting Types and Terms

With any positive type \(\varphi \) and any repetition-free list \(\mathbf {\zeta }=(\zeta _{1},\dots ,\zeta _{n})\) of type variables containing all free variables of \(\varphi \) we associate a continuous functor \([{\varphi }]^!_{\mathbf {\zeta }}:(\mathcal {L}^{\mathord !}_{\mathord \subseteq })^n\rightarrow \mathcal {L}^{\mathord !}_{\mathord \subseteq }\) and with any general type \(\sigma \) and any list \(\mathbf {\zeta }=(\zeta _{1},\dots ,\zeta _{n})\) of pairwise distinct type variables containing all free variables of \(\sigma \) we associate a continuous functor \([{\sigma }]_{\mathbf {\zeta }}:(\mathcal {L}^{\mathord !}_{\mathord \subseteq })^n\rightarrow \mathcal {L}_{\mathord \subseteq }\). We give the definition on objects, the definition on morphisms being similar.
$$\begin{aligned}{}[{\zeta _i}]^!_{\mathbf {\zeta }}(\mathbf {P}) = P_i\quad&\quad \quad [{!\sigma }]^!_{\mathbf {\zeta }}(\mathbf {P}) = !({[{\sigma }]_{\mathbf {\zeta }}(\mathbf {P})})\\ [{{\varphi }\otimes {\psi }}]^!_{\mathbf {\zeta }}(\mathbf {P})&= {[{\varphi }]^!_{\mathbf {\zeta }}(\mathbf {P})}\otimes {[{\psi }]^!_{\mathbf {\zeta }}(\mathbf {P})}\\ [{{\varphi }\oplus {\psi }}]^!_{\mathbf {\zeta }}(\mathbf {P})&= {[{\varphi }]^!_{\mathbf {\zeta }}(\mathbf {P})}\oplus {[{\psi }]^!_{\mathbf {\zeta }}(\mathbf {P})}\\ [{\textsf {Fix}\,\zeta \cdot \varphi }]^!_{\mathbf {\zeta }} = {\text {Fix}}([{\varphi }]^!_{\mathbf {\zeta },\zeta })\quad&\quad \quad [{\top }]_{\mathbf {\zeta }}(\mathbf {P})=\top \quad \text {(the terminal object of }\mathcal {L}\text {)}\\ [{\varphi }]_{\mathbf {\zeta }} = \mathsf U\,[{\varphi }]^!_{\mathbf {\zeta }}\quad&\quad \quad [{{\varphi }\multimap {\sigma }}]_{\mathbf {\zeta }}(\mathbf {P})={(\underline{{[{\varphi }]^!}_{\mathbf {\zeta }}(\mathbf {P})})}\multimap {([{\sigma }]_{\mathbf {\zeta }}(\mathbf {P}))} \end{aligned}$$
When we write \([{\sigma }]\) or \([{\varphi }]^!\) (without subscript), we assume implicitly that the types \(\sigma \) and \(\varphi \) have no free type variables. Then \([{\sigma }]\) is an object of \(\mathcal {L}\) and \([{\varphi }]^!\) is an object of \(\mathcal {L}^{\mathord !}\).

From now on, we assume that the only isos of \(\mathcal {L}_{\mathord \subseteq }\) are the identity maps. This means in particular that the isos resulting from Theorem 1 are identities. This assumption is necessary because we have no roll/unroll syntactic constructs of terms associated with fixpoints of types. It holds in many concrete models, and in particular in the Scott model of Sect. 4.

Interpreting terms. Given a typing context \(\mathcal {P}=(x_1:\varphi _1,\dots ,x_n:\varphi _n)\), we define \([{\mathcal {P}}]^!\) as the object \([{\varphi _1}]^!\otimes \cdots \otimes [{\varphi _n}]^!\) of \(\mathcal {L}^{\mathord !}\). Notice that \(\underline{[{\mathcal {P}}]^!}=[{\varphi _1}]\otimes \cdots \otimes [{\varphi _n}]\). We denote this object of \(\mathcal {L}\) as \([{\mathcal {P}}]\).

Given a term M, a typing context \(\mathcal {P}=(x_1:\varphi _1,\dots ,x_n:\varphi _n)\) and a type \(\sigma \) such that \(\mathcal {P}\vdash M:\sigma \), we define \([{M}]_\mathcal {P}\in \mathcal {L}([{\mathcal {P}}],[{\sigma }])\) by induction on the typing derivation of M, that is, on M. Indeed, given a term M and a typing context \(\mathcal {P}\), there is at most one type \(\sigma \) and one derivation of \(\mathcal {P}\vdash M:\sigma \) (and this derivation is isomorphic to M).

Remark 4

A crucial observation is that \(\mathcal {L}^{\mathord !}([{\mathcal {P}}]^!,[{\varphi }]^!)\subseteq \mathcal {L}([{\mathcal {P}}],[{\varphi }])\) for any positive type \(\varphi \). Hence, for a term M such that \(\mathcal {P}\vdash M:\varphi \), it may happen, but it is not necessarily the case, that \([{M}]_\mathcal {P}\in \mathcal {L}^{\mathord !}([{\mathcal {P}}]^!,[{\varphi }]^!)\). The terms M which have this property are duplicable and discardable, and the main property of values is that they belong to this semantically defined class of terms. Let us call such terms \(\mathcal {L}\)-regular.

We define \([{M}]_\mathcal {P}\) by induction on the typing derivation, that is, on M.

If \(M=x_i\) for \(1\le i\le n\), then \([{M}]_\mathcal {P}={\mathrm {pr}}_{i}\in \mathcal {L}^{\mathord !}([{\mathcal {P}}]^!,[{P_i}]^!)\). Remember indeed that \([{\mathcal {P}}]^!\) is the cartesian product of \([{P_1}]^!\),...,\([{P_n}]^!\) in \(\mathcal {L}^{\mathord !}\). Observe that M is \(\mathcal {L}\)-regular.

Assume that \(M=N^{\mathord !}\) and \(\sigma =!\tau \) with \(\mathcal {P}\vdash N:\tau \). By inductive hypothesis we have \([{N}]_\mathcal {P}\in \mathcal {L}(\underline{[{\mathcal {P}}]^!},[{\tau }])\) and hence we can set \([{M}]_\mathcal {P}=[{N}]_\mathcal {P}^!\in \mathcal {L}^{\mathord !}([{\mathcal {P}}]^!,!{[{\tau }]})\) so that M is \(\mathcal {L}\)-regular.

Assume that \(M=\langle M_1,M_2\rangle \) and \(\sigma ={\varphi _1}\otimes {\varphi _2}\) with \(\mathcal {P}\vdash M_i:\varphi _i\) for \(i=1,2\). By inductive hypothesis we have defined \([{M_i}]_\mathcal {P}\in \mathcal {L}([{\mathcal {P}}],[{\varphi _i}])\) for \(i=1,2\). Since \([{\mathcal {P}}]=\underline{[{\mathcal {P}}]^!}\) we have a contraction morphism \({\mathrm {c}}_{[{\mathcal {P}}]^!} \in \mathcal {L}^{\mathord !}([{\mathcal {P}}]^!,{[{\mathcal {P}}]^!}\otimes {[{\mathcal {P}}]^!})\) so that we can set \([{M}]=({[{M_1}]_\mathcal {P}}\otimes {[{M_2}]_\mathcal {P}})\,{\mathrm {c}}_{[{\mathcal {P}}]^!} \in \mathcal {L}([{\mathcal {P}}],[{\sigma }])\). Hence if \(M_1\) and \(M_2\) are \(\mathcal {L}\)-regular, then M is \(\mathcal {L}\)-regular.

Assume that \(M=\mathsf {in}_{i}N\) (for \(i=1\) or \(i=2\))) and \(\sigma ={\varphi _1}\oplus {\varphi _2}\). By inductive hypothesis we have \([{N}]_\mathcal {P}\in \mathcal {L}([{\mathcal {P}}],[{\varphi _i}])\) and since we have \({\mathrm {in}}_{i}\in \mathcal {L}^{\mathord !}([{\varphi _i}]^!,{[{\varphi _1}]^!}\oplus {[{\varphi _2}]^!})\) it makes sense to set \([{M}]_\mathcal {P}={\mathrm {in}}_{i}\,[{N}]_\mathcal {P}\in \mathcal {L}([{\mathcal {P}}],[{\sigma }])\). Observe that if N is \(\mathcal {L}\)-regular then so is M.

Assume that \(M=\lambda x^{\varphi }\, N\) and \(\sigma ={\varphi }\multimap {\tau }\) with \(\mathcal {P},x:\varphi \vdash N:\tau \). By inductive hypothesis we have \([{N}]_{\mathcal {P},x:\varphi }\in \mathcal {L}([{\mathcal {P}}]\otimes [{\varphi }],[{\tau }])\) and we set \([{M}]_\mathcal {P}={\mathrm {cur}}{([{N}]_{\mathcal {P},x:\varphi })}\in \mathcal {L}([{\mathcal {P}}],{[{\varphi }]}\multimap {[{\tau }]})\). Of course, even if \(\tau \) is positive and N is \(\mathcal {L}\)-regular, M is not \(\mathcal {L}\)-regular, simply because its type is not positive.

Assume that \(M=\langle N\rangle R\) with \(\mathcal {P}\vdash N:{\varphi }\multimap {\sigma }\) and \(\mathcal {P}\vdash R:\varphi \) for some positive type \(\varphi \). By inductive hypothesis we have \([{N}]_\mathcal {P}\in \mathcal {L}([{\mathcal {P}}],{[{\varphi }]}\multimap {[{\sigma }]})\) and \([{R}]_\mathcal {P}\in \mathcal {L}([{\mathcal {P}}],[{\varphi }])\). Since \([{\mathcal {P}}]=\underline{[{\mathcal {P}}]^!}\) we have a contraction morphism \({\mathrm {c}}_{[{\mathcal {P}}]^!} \in \mathcal {L}^{\mathord !}([{\mathcal {P}}]^!,{[{\mathcal {P}}]^!}\otimes {[{\mathcal {P}}]^!})\) so that we can set \([{M}]_\mathcal {P}={\mathrm {ev}}\,({[{N}]_\mathcal {P}}\otimes {[{R}]_\mathcal {P}})\,{\mathrm {c}}_{[{\mathcal {P}}]^!}\in \mathcal {L}([{\mathcal {P}}],[{\sigma }])\).

Assume that \(M=\mathsf {case}(N,x_1\cdot R_1,x_2\cdot R_2)\) with \(\mathcal {P}\vdash N:{\varphi _1}\oplus {\varphi _2}\) and \(\mathcal {P},x_i:\varphi _i\vdash R_i:\sigma \) for \(i=1,2\). By inductive hypothesis we have \([{M}]_\mathcal {P}\in \mathcal {L}([{\mathcal {P}}],{[{\varphi _1}]}\oplus {[{\varphi _2}]})\) and \([{R_i}]_{\mathcal {P},x_i:\varphi _i}\in \mathcal {L}([{\mathcal {P}}]\otimes [{\varphi _i}],[{\sigma }])\) for \(i=1,2\). By the universal property of the coproduct \(\oplus \) in \(\mathcal {L}\) and by the fact that the functor \({[{\mathcal {P}}]}\otimes {\_}\) is a left adjoint, there is exactly one morphism \(f\in \mathcal {L}([{\mathcal {P}}]\otimes ({[{\varphi _1}]}\oplus {[{\varphi _2}]}),[{\sigma }])\) such that \(f\,({[{\mathcal {P}}]}\otimes {{\mathrm {in}}_{i}})=[{R_i}]_{\mathcal {P},x_i:\varphi _i}\) for \(i=1,2\). Then we set \([{M}]_\mathcal {P}=f\,({[{\mathcal {P}}]}\otimes {[{N}]_\mathcal {P}})\,{\mathrm {c}}_{[{\mathcal {P}}]^!}\).

Assume that \(M=\mathsf {pr}_{i}N\) and \(\sigma =\varphi _i\) for \(i=1\) or \(i=2\), with \(\mathcal {P}\vdash N:{\varphi _1}\otimes {\varphi _2}\). By inductive hypothesis we have \([{N}]_\mathcal {P}\in \mathcal {L}([{\mathcal {P}}],{[{\varphi _1}]}\otimes {[{\varphi _2}]})\). Then remember that we have the projection \({\mathrm {pr}}_{i}\in \mathcal {L}^{\mathord !}({[{\varphi _1}]^!}\otimes {[{\varphi _2}]^!},[{\varphi _i}]^!)\) so that we can set \([{M}]_\mathcal {P}={\mathrm {pr}}_{i}\,[{N}]_\mathcal {P}\in \mathcal {L}([{\mathcal {P}}],[{\varphi _i}])\).

Assume that \(M=\mathsf {der}(N)\) with \(\mathcal {P}\vdash N:!{\sigma }\). Then we have \({{\mathrm {der}}}_{[{\sigma }]}\in \mathcal {L}(!{[{\sigma }]},[{\sigma }])\) so that we can set \([{M}]_\mathcal {P}={{\mathrm {der}}}_{[{\sigma }]}\,[{N}]_\mathcal {P}\in \mathcal {L}([{\mathcal {P}}],[{\sigma }])\).

Assume that \(M=\mathsf {fix}\,x^{!\sigma }\,N\) so that \(\mathcal {P},x:!\sigma \vdash N:\sigma \). By inductive hypothesis we have \({\mathrm {cur}}([{N}]_{\mathcal {P},x:!\sigma })\in \mathcal {L}(\underline{[{\mathcal {P}}]^!},{!{[{\sigma }]}}\multimap {[{\sigma }]})\) and hence \(({\mathrm {cur}}([{N}]_{\mathcal {P},x:!\sigma }))^!\in \mathcal {L}^{\mathord !}([{\mathcal {P}}],!({{!{[{\sigma }]}}\multimap {[{\sigma }]}}))\) so that we can set \([{M}]_\mathcal {P}={\mathrm {fix}}\,({\mathrm {cur}}([{N}]_{\mathcal {P},x:!\sigma }))^!\in \mathcal {L}([{\mathcal {P}}],[{\sigma }])\).

Proposition 4

If \(\mathcal {P}\vdash V:\varphi \) and V is a value, then V is \(\mathcal {L}\)-regular, that is \([{V}]_\mathcal {P}\in \mathcal {L}^{\mathord !}([{\mathcal {P}}]^!,[{\varphi }]^!)\).

The proof is a straightforward verification (in the definition of the interpretation of terms we have singled out the constructions which preserve \(\mathcal {L}\)-regularity). The main operational feature of \(\mathcal {L}\)-regular terms is that they enjoy the following substitutivity property.

Proposition 5

(Substitution Lemma). Assume that \(\mathcal {P},x:\varphi \vdash M:\sigma \) and \(\mathcal {P}\vdash N:\varphi \), and assume that N is \(\mathcal {L}\)-regular. Then we have
$$\begin{aligned}{}[{{M}\left[ {N}/{x}\right] }]_\mathcal {P}=[{M}]_{\mathcal {P},x:\varphi }\,({[{\mathcal {P}}]}\otimes {[{N}]_\mathcal {P}})\,{\mathrm {c}}_{[{\mathcal {P}}]^!} \end{aligned}$$


Induction on M using in an essential way the \(\mathcal {L}\)-regularity of N. Let us consider two cases to illustrate this point. Assume first that \(M=R^{\mathord !}\) and \(\sigma =!\tau \), with \(\mathcal {P},x:\varphi \vdash R:\tau \) so that \([{R}]_{\mathcal {P},x:\varphi }\in \mathcal {L}([{\mathcal {P}}]\otimes [{\varphi }],[{\sigma }])\). Then we have \([{{M}\left[ {N}/{x}\right] }]_\mathcal {P}=[{{R}\left[ {N}/{x}\right] ^{\mathord !}}]_\mathcal {P}=([{{R}\left[ {N}/{x}\right] }]_\mathcal {P})^!=([{R}]_{\mathcal {P},x:\varphi }\,({[{\mathcal {P}}]}\otimes {[{N}]_\mathcal {P}})\,{\mathrm {c}}_{[{\mathcal {P}}]})^!\) by inductive hypothesis. We obtain the contended equation by applying Eq. (3) and the fact that \({[{\mathcal {P}}]}\otimes {[{N}]_\mathcal {P}}\) is a coalgebra morphism since N is \(\mathcal {L}\)-regular, and the fact that \({\mathrm {c}}_{[{\mathcal {P}}]}\) is also a coalgebra morphism.

Let us also consider the case \(M=\langle M_1,M_2\rangle \) and \(\sigma ={\varphi _1}\otimes {\varphi _2}\) with \(\mathcal {P},x:\varphi \vdash M_i:\varphi _i\) for \(i=1,2\) so that \([{M_i}]_{\mathcal {P},x:\varphi }\in \mathcal {L}({[{\mathcal {P}}]}\otimes {[{\varphi }]},[{\varphi _i}])\) for \(i=1,2\). We have
$$\begin{aligned}{}[{{M}\left[ {N}/{x}\right] }]_\mathcal {P}&=[{\langle {M_1}\left[ {N}/{x}\right] ,{M_2}\left[ {N}/{x}\right] \rangle }]_\mathcal {P}\\ &=({[{{M_1}\left[ {N}/{x}\right] }]_\mathcal {P}}\otimes {[{{M_2}\left[ {N}/{x}\right] }]_\mathcal {P}}) \,{\mathrm {c}}_{{[{\mathcal {P}}]^!}\otimes {[{\varphi }]^!}}\\ &=({([{M_1}]_{\mathcal {P},x:\varphi } \,({[{\mathcal {P}}]}\otimes {[{N}]_\mathcal {P}}))}\otimes {([{M_2}]_{\mathcal {P},x:\varphi }\,({[{\mathcal {P}}]}\otimes {[{N}]_\mathcal {P}}))})\\&\quad \,{\mathrm {c}}_{{[{\mathcal {P}}]^!}\otimes {[{\varphi }]^!}}\\ &=({[{M_1}]_\mathcal {P}}\otimes {[{M_2}]_\mathcal {P}}) \,{\mathrm {c}}_{[{\mathcal {P}}]^!}\,({[{\mathcal {P}}]}\otimes {[{N}]_\mathcal {P}}) \end{aligned}$$
using the inductive hypothesis, naturality of contraction in \(\mathcal {L}^{\mathord !}\) and the fact that \(({[{\mathcal {P}}]}\otimes {[{N}]_\mathcal {P}})\) is a coalgebra morphism since N is \(\mathcal {L}\)-regular. The other cases are handled similarly.    \(\square \)

Theorem 2

(Soundness). If \(\mathcal {P}\vdash M:\sigma \) and \(M\mathrel {\mathord \rightarrow _{\mathsf w}}M'\) then \([{M}]_\mathcal {P}=[{M'}]_\mathcal {P}\).


By induction on the derivation that \(M\mathrel {\mathord \rightarrow _{\mathsf w}}M'\), using the Substitution Lemma and the \(\mathcal {L}\)-regularity of values.

4 Scott Semantics

Usually, in a model \(\mathcal {L}\) of LL, an object X of \(\mathcal {L}\) can be endowed with several different structures of \(!\)-coalgebras which makes the category \(\mathcal {L}^{\mathord !}\) difficult to describe simply (in contrast with the Kleisli category used for interpreting PCF; its objects are those of \(\mathcal {L}\)). In the Scott model of LL however, every object of the linear category has exactly one structure of \(!\)-coalgebra as we shall see now. This is certainly a distinctive feature of this model. Such a property does not hold for instance in coherence spaces. A nice outcome of these observations will be a very simple intersection typing system for \(\varLambda _{\mathsf {HP}}\).

Remark 5

As explained in [11], this semantics of LL has been independently discovered by several authors, see for instance [18, 31]. The same model is also considered in [23] Sect. 5.5.4 to interpret may non-determinism in CBPV. Our model allows therefore to interpret the corresponding non-deterministic extension of \(\varLambda _{\mathsf {HP}}\) and the proof of adequacy of Sect. 4.45 can easily be extended to this language. This will be explained thoroughly in a forthcoming paper.

4.1 The Scott Semantics of LL

We introduce a “linear” category \(\mathbf {Polr}\) of preorders and relations. A preorder is a pair \(S=(|{S}|,\mathord \le _S)\) where \(|{S}|\) is an at most countable set and \(\le _S\) (written \(\le \) when no confusion is possible) is a preorder relation on \(|{S}|\). Given two preorders S and T, a morphism from S to T is a \(f\subseteq |{S}|\times |{T}|\) such that, if \((a,b)\in f\) and \((a',b')\in |{S}|\times |{T}|\) satisfy \(a\le _S a'\) and \(b'\le _S b\), then \((a',b')\in f\). The relational composition of two morphisms is still a morphism and the identity morphism at S is \({\mathrm {Id}}_S=\{(a,a')\mid a'\le _S a\}\).

Given an object S in \(\mathbf {Polr}\), the set \(\mathsf {Ini}(S)\) of downwards closed subsets of \(|{S}|\), ordered by inclusion, is a complete lattice which is \(\omega \)-prime-algebraic (and all such lattices are of that shape up to iso). \(\mathbf {Polr}\) is equivalent to the category of \(\omega \)-prime algebraic complete lattices and linear maps (functions preserving all lubs).

Monoidal structure and cartesian product. The object \(1\) is \((\{*\},\mathord =)\) and given preorders S and T we set \({S}\otimes {T}=(|{S}|\times |{T}|,\mathord \le _S\times \mathord \le _T)\). The tensor product of morphisms is defined in the obvious way. The isos defining the monoidal structure are easy to define. Then one defines \({S}\multimap {T}\) by \(|{{S}\multimap {T}}|=|{S}|\times |{T}|\) and \((a',b')\le _{{S}\multimap {T}}(a,b))\) if \(a\le a'\) and \(b'\le b\). The linear evaluation morphism \({\mathrm {ev}}\in \mathbf {Polr}({({S}\multimap {T})}\otimes {S},T)\) is given by \({\mathrm {ev}}=\{(((a',b),a),b')\mid b'\le b\text { and }a'\le a\}\). If \(f\in \mathbf {Polr}({U}\otimes {S},T)\) then \({\mathrm {cur}}(f)\in \mathbf {Polr}(U,{S}\multimap {T})\) is defined by moving parentheses. This shows that \(\mathbf {Polr}\) is closed. It is *-autonomous, with \({{\perp }}=1\) as dualizing object. Observe that \(S^{{{\perp }}_{}}\) is simply \(|{S}|\) equipped with \(\ge _S\) as preorder relation \(\le _{S^{{{\perp }}_{}}}\).

Given a countable family of objects \((S_i)_{i\in I}\), the cartesian product S is defined by \(|{S}|=\bigcup _{i\in I}\{i\}\times |{S_i}|\) with \((i,a)\le (j,b)\) if \(i=j\) and \(a\le b\). Projections are defined by \({\mathrm {pr}}_{i}=\{((i,a),a')\mid a'\le a\}\). Tupling of morphisms is defined as in \({\mathbf {Rel}}\). Coproducts are defined similarly.

Exponential. One sets \(!{S}=({\mathcal {P}_{\mathrm {fin}}}({|{S}|}),\le )\) with \(u\le u'\) if \(\forall a\in u\,\exists a'\in u'\ a\le _S a'\) (where \({\mathcal {P}_{\mathrm {fin}}}({E})\) is the set of all finite subsets of E). Given \(f\in \mathbf {Polr}(S,T)\), one defines \(!{f}\) as \(\{(u,v)\in |{!{S}}|\times |{!{T}}|\mid \forall b\in v\,\exists a\in u\ (a,b)\in f\}\). It is easy to prove that this defines a functor \(\mathbf {Polr}\rightarrow \mathbf {Polr}\). Then one sets \({{\mathrm {der}}}_{S}=\{(u,a)\mid \exists a'\in u\ a\le a'\}\in \mathbf {Polr}(!{S},S)\) and \({{\mathrm {dig}}}_{S}=\{(u,\{u_{1},\dots ,u_{n}\})\mid u_1\cup \cdots \cup u_n\le _{!{S}}u\}\in \mathbf {Polr}(!{S},!{!{S}})\). This defines a comonad \(\mathbf {Polr}\rightarrow \mathbf {Polr}\). The Seely isos are given by \(\mathrm m^0=\{(*,\emptyset )\}\in \mathbf {Polr}(1,!{\top })\) and \( \mathrm m^2_{S,T}=\{((u,v),w)\mid w\le _{!({{S}\mathrel { \& }{T}})}\{1\}\times u\cup \{2\}\times v\}\in \mathbf {Polr}({!{S}}\otimes {!{T}},!({{S}\mathrel { \& }{T}}))\).

Each object S has a fix-point operator \({\mathrm {fix}}_S\in \mathbf {Polr}(!({{!{S}}\multimap {S}}),S)\) which is defined as a least fix-point: \({\mathrm {fix}}_S=\{(w,a)\mid \exists (u',a')\in w\ a\le a'\text { and }\forall a''\in u'\ (w,a'')\in {\mathrm {fix}}_S\}\).

4.2 The Category of \(!\)-coalgebras

The first main observation is that each object of \(\mathbf {Polr}\) has exactly one structure of \(!\)-coalgebra. The proofs will be given in a longer version of this paper.

Theorem 3

Let S be an object of \(\mathbf {Polr}\). Then \((S,\mathrm {p}_{S})\) is a \(!\)-coalgebra, where \(\mathrm {p}_{S}=\{(a,u)\in |{S}|\times |{!{S}}|\mid \forall a'\in u\ a'\le a\}\). Moreover, if P is a \(!\)-coalgebra, then \(\mathrm h_{P}=\mathrm {p}_{\underline{P}}\).

Morphisms of\(!\)-coalgebras. Now that we know that the objects of \(\mathbf {Polr}^{\mathord !}\) are those of \(\mathbf {Polr}\), we turn our attention to morphisms. When we consider a preorder S as an object of \(\mathbf {Polr}^{\mathord !}\), we always mean the object \((S,\mathrm {p}_{S})\) described above.

With any preorder S, we have associated an \(\omega \)-prime algebraic complete lattice \(\mathsf {Ini}(S)\). We associate now with such a preorder an \(\omega \)-algebraic cpo \(\mathsf {Idl}(S)\) which is the ideal completion of S: an element of \(\mathsf {Idl}(S)\) is a subset \(\xi \) of \(|{S}|\) such that \(\xi \) is non-empty, downwards closed and directed (meaning that if \(a,a'\in \xi \) then there is \(a''\in \xi \) such that \(a,a'\le _S a''\)). We equip \(\mathsf {Idl}(S)\) with the inclusion partial order relation.

Lemma 1

For any preorder S, the partially ordered set \(\mathsf {Idl}(S)\) is a cpo which has countably many compact elements. Moreover, for any \(\xi \in \mathsf {Idl}(S)\), the set of compact elements \(\xi _0\in \mathsf {Idl}(S)\) such that \(\xi _0\subseteq \xi \) is directed and \(\xi \) is the lub of that set. In general, \(\mathsf {Idl}(S)\) has no minimum element.

Theorem 4

Given preorders S and T, there is a bijective and functorial correspondence between \(\mathbf {Polr}^{\mathord !}(S,T)\) and the set of Scott continuous functions from \(\mathsf {Idl}(S)\) to \(\mathsf {Idl}(T)\). Moreover, this correspondence is an order isomorphism when Scott-continuous functions are equipped with the usual pointwise ordering relation and \(\mathbf {Polr}^{\mathord !}(S,T)\) is equipped with the inclusion order on relations.

Let \(\mathbf {Predom}\) be the category whose objects are the preorders and where a morphism from S to T is a Scott continuous function from \(\mathsf {Idl}(S)\) to \(\mathsf {Idl}(T)\). We have seen that \(\mathbf {Polr}^{\mathord !}\) and \(\mathbf {Predom}\) are equivalent categories (isomorphic indeed). It is easy to retrieve directly the fact that \(\mathbf {Predom}\) has products and sums: the product of S and T is \({S}\otimes {T}\) (and indeed, it is easy to check that \(\mathsf {Idl}({S}\otimes {T})\simeq \mathsf {Idl}(S)\times \mathsf {Idl}(T)\)) and their sum is \({S}\oplus {T}\) and indeed \(\mathsf {Idl}({S}\oplus {T})\simeq \mathsf {Idl}(S)+\mathsf {Idl}(T)\), the disjoint union of the predomains \(\mathsf {Idl}(S)\) and \(\mathsf {Idl}(T)\). This predomain has no minimum element as soon as \(|{S}|\) and \(|{T}|\) are non-empty. Observe also that \(\mathsf {Idl}(!{S})=\mathsf {Ini}(S)\): one retrieves the fact that the Kleisli category of the \(!\) comonad is the category of preorders and Scott continuous functions between the associated lattices.

Inclusions and embedding-retraction pairs. We define a category \(\mathbf {Polr}_{\mathord \subseteq }\) as follows: the objects are those of \(\mathbf {Polr}\) and \(\mathbf {Polr}_{\mathord \subseteq }(S,T)\) is a singleton \(\{\varphi _{S,T}\}\) if \(|{S}|\subseteq |{T}|\) and \(\forall a,a'\in |{S}|\ a\le _Sa'\Leftrightarrow a\le _Ta'\) (and then we write \(S\subseteq T\)) and is empty otherwise. So \((\mathbf {Polr}_{\mathord \subseteq },\mathord \subseteq )\) is a partially ordered class. The functor \(\mathsf {F}\) is defined as follows: if \(S\subseteq T\) then \(\varphi _{S,T}^+=\{(a,b)\in |{S}|\times |{T}|\mid b\le _T a\}\) and \(\varphi _{S,T}^-=\{(b,a)\in |{T}|\times |{S}|\mid a\le _T b\}\); this definition is functorial and \(\varphi _{S,T}^-\,\varphi _{S,T}^+={\mathrm {Id}}_S\). The partially ordered class \(\mathbf {Polr}_{\mathord \subseteq }\) is complete in the sense that any directed family of objects6\((S_i)_{i\in J}\) has a lub S given by \(|{S}|=\cup _{i\in J}|{S_i}|\) and \(a\le _S a'\) if \(a\le _{S_i} a'\) for some i; we denote this preorder as \(\cup _{i\in J}S_i\). The operations \(\otimes \), \(\oplus \) and \(!{\_}\) are monotone and Scott-continuous operations on this partially ordered class.

Lemma 2

Assume that \(S_1\subseteq S_2\) and let \(f_i\in \mathbf {Polr}(S_i,T)\) for \(i=1,2\). Then \(f_1=f_2\,\varphi _{S_1,S_2}^+\) iff \(f_1=f_2\cap |{{S_1}\multimap {T}}|\).

Given a directed family \((S_i)_{i\in J}\) in \(\mathbf {Polr}_{\mathord \subseteq }\) and setting \(S=\cup _{i\in J}S_i\), one proves easily using Lemma 2 that the cone \((\varphi _{S_i,S}^+\in \mathbf {Polr}(S_i,S))_{i\in J}\) is a colimit cone in \(\mathbf {Polr}\). Consider indeed a family of morphisms \((f_i\in \mathbf {Polr}(S_i,T))_{i\in J}\) such that \(i\le j\Rightarrow f_i=f_j\,\varphi _{S_i,S_j}^+\), that is \(f_i=f_j\cap |{{S_i}\multimap {T}}|\). Then \(f=\cup _{i\in J}f_i\) is the unique element of \(\mathbf {Polr}(S,T)\) such that \(f\,\varphi _{S_i,S}^+=f_i\) for each \(i\in J\). So the category \(\mathbf {Polr}_{\mathord \subseteq }\) satisfies all the axioms of Sect. 3.2.

As explained in that section, this allows to define fixpoints of positive types. As a first example consider the type of flat natural numbers \(\iota =\textsf {Fix}\,\zeta \cdot ({1}\oplus {\zeta })\) where \(1=!\top \), so that \(|{1}|=\{\emptyset \}\). Up to renaming we have \(|{[{\iota }]}|={\mathbb {N}}\) and \(n\le _{[{\iota }]} n'\) iff \(n=n'\). The coalgebraic structure of this positive type is given by \(\mathrm h_{[{\iota }]}=\{(n,\emptyset )\mid n\in {\mathbb {N}}\}\cup \{(n,\{n\})\mid n\in {\mathbb {N}}\}\). Consider now the type \(\rho =\textsf {Fix}\,\zeta \cdot ({1}\oplus {({\iota }\otimes {!\zeta })})\) of lazy lists of flat natural numbers. The interpretation S of this type is the least fix-point of the continuous functor (that is, the Scott continuous functional) \([{{1}\oplus {({\iota }\otimes {!\zeta })}}]_\zeta : \mathbf {Polr}_{\mathord \subseteq }\rightarrow \mathbf {Polr}_{\mathord \subseteq }\). So \(|{S}|=\cup _{n=0}^\infty U_n\) where \((U_n)_{n\in {\mathbb {N}}}\) is the monotone sequence of sets defined by \(U_0=\emptyset \) and \(U_{n+1}=\{\emptyset \}\cup ({\mathbb {N}}\times {\mathcal {P}_{\mathrm {fin}}}({U_n}))\) (this is a disjoint union). The preorder relation on \(|{S}|\) is given by: \(\emptyset \le _S a\) iff \(a=\emptyset \) and \((n,u)\le _S a\) iff \(a=(n,u')\) and \(\forall b\in u\exists b'\in u'\ b\le _Sb'\). This preorder relation defines the coalgebraic structure of this positive type.

4.3 Scott Semantics as a Typing System

It is interesting to present the Scott semantics of terms as a typing system, in the spirit of Coppo-Dezani Intersection Types, see [19]. A semantic context is a sequence \(\varPhi =(x_1:a_1:\varphi _1,\dots ,x_n:a_n:\varphi _n)\) where \(a_i\in [{\varphi _i}]\) for each i, its underlying typing context is \(\underline{\varPhi }=(x_1:\varphi _1,\dots ,x_n:\varphi _n)\) and its underlying tuple is \(\langle \varPhi \rangle =(a_{1},\dots ,a_{k})\in [{\underline{\varPhi }}]\). The typing rules are given in Fig. 4, the intended meaning of these rules is made clear in Proposition 7.
Fig. 4.

Scott semantics as a typing system

A simple induction on typing derivation trees shows that this typing system is “monotone” as usually for intersection type systems. We write \(\varPhi \le \varPhi '\) if \(\varPhi =(x_1:a_1:\varphi _1,\dots ,x_n:a_n:\varphi _n)\), \(\varPhi '=(x_1:a'_1:\varphi _1,\dots ,x_n:a'_n:\varphi _n)\) and \(a_i\le _{[{\varphi _i}]}a'_i\) for \(i=1,\dots ,n\).

Proposition 6

If \(\varPhi \vdash M:a:\sigma \), \(a'\le _{[{\sigma }]} a\) and \(\varPhi \le \varPhi '\) then \(\varPhi '\vdash M:a':\sigma \).

Using this property, one can prove that this deduction system describes exactly the Scott denotational semantics of \(\varLambda _{\mathsf {HP}}\).

Proposition 7

Given \(a_1\in [{\varphi _1}]\),...,\(a_n\in [{\varphi _n}]\) and \(a\in [{\sigma }]\), one has \((a_{1},\dots ,a_{n},a)\in [{M}]_{x_1:\sigma _n,\dots ,x_1:\sigma _n}\) iff \(x_1:a_1:\varphi _1,\dots ,x_n:a_n:\varphi _n\vdash M:a:\sigma \).

The proof also uses crucially the fact that all structural operations (weakening, contraction, dereliction, promotion) admit a very simple description in terms of the preorder relation on objects thanks to Theorem 3; for instance the contraction morphism of an object S (seen as an object of \(\mathbf {Polr}^{\mathord !}\)) is \({\mathrm {c}}_{S}=\{(a,(a_1,a_2))\mid a_i\le a\text { for }i=1,2\}\).

4.4 Adequacy

Our goal now is to prove that, if a closed term M of positive type \(\varphi \) has a non-empty interpretation, that is, if there is \(a\in |{[{\varphi }]}|\) such that \(\vdash M:a:\varphi \), then the reduction \(\mathord \rightarrow _{\mathsf w}\) starting from M terminates. We use a semantic method adapted e.g. from the presentation of the reducibility method in [19].

Given a type \(\sigma \) and an \(a\in [{\sigma }]\), we define a set \(|a|^{\sigma }\) of terms M such that \(\vdash M:\sigma \) (so these terms are all closed). The definition is by induction on the structure of the point a (and not on the type \(\sigma \), whose definition involves fix-points and is therefore not well-founded in general).

Given a positive type \(\varphi \) and \(a\in [{\varphi }]\), we define \(|a|_{\mathsf v}^{\varphi }\) as a set of closed valuesV such that \(\vdash V:\varphi \) and given a general type \(\sigma \) and \(a\in [{\sigma }]\), we define \(|a|^{\sigma }\) as a set of closed terms M such that \(\vdash M:\sigma \). The definitions are by mutual induction and are given in Fig. 5. Observe that for a value V such that \(\vdash V:\varphi \) and for \(a\in [{\varphi }]\), the statements \(V\in |a|^{\varphi }\) and \(V\in |a|_{\mathsf v}^{\varphi }\) are equivalent because V is normal for the \(\mathord \rightarrow _{\mathsf w}\) reduction.
Fig. 5.

Interpretation of points as sets of terms in \(\varLambda _{\mathsf {HP}}\)

Lemma 3

If \(M\mathrel {\mathord \rightarrow _{\mathsf w}}M'\in |a|^{\sigma }\) then \(M\in |a|^{\sigma }\).


By induction on the structure of a. If \(\sigma =\varphi \), the property follows readily from the definition. Assume that \(\sigma ={\varphi }\multimap {\tau }\) and \(a=(b,c)\). Assume that \(M\mathrel {\mathord \rightarrow _{\mathsf w}}M'\in |a|^{\sigma }\). Let \(V\in |b|_{\mathsf v}^{\varphi }\), we have \(\langle M\rangle V\mathrel {\mathord \rightarrow _{\mathsf w}}\langle M'\rangle V\) and \(\langle M'\rangle V\in |c|^{\tau }\) by definition of \(|{\varphi }\multimap {\tau }|^{(b,c)}\). The announced property follows by inductive hypothesis.    \(\square \)

Lemma 4

Let \(\sigma \) be a type and let \(a,a'\in |{[{\sigma }]}|\) be such that \(a\le _{[{\sigma }]}a'\). Then \(|a|^{\sigma }\supseteq |a'|^{\sigma }\). If \(\sigma \) is positive, we have \(|a|_{\mathsf v}^{\sigma }\supseteq |a'|_{\mathsf v}^{\sigma }\).

Theorem 5

Let \(\varPhi =(x_1:a_1:\varphi _1,\dots ,x_k:a_k:\varphi _k)\) and assume that \(\varPhi \vdash M:a:\sigma \). Then for any family of closed values \((V_i)_{i=1}^k\) such that \(V_i\in |a_i|^{\varphi _i}\) one has \({M}\left[ {V_1/x_1,\dots ,V_k/x_k}\right] \in |a|^{\sigma }\).

So if \(\vdash M:\varphi \) and \([{M}]\not =\emptyset \) we have \(M\mathrel {\mathord \rightarrow _{\mathsf w}^*}V\) for a value V. Let us say that two closed terms \(M_1\), \(M_2\) such that \(\vdash M_i:\sigma \) for \(i=1,2\) are observationally equivalent if for all closed term C of type \({!\sigma }\multimap {1}\), \(\langle C\rangle M_1^{\mathord !}\mathord \rightarrow _{\mathsf w}^**\) iff \(\langle C\rangle M_2^{\mathord !}\mathord \rightarrow _{\mathsf w}^**\). As usual, Theorem 5 allows to prove that if \([{M_1}]=[{M_2}]\) then \(M_1\) and \(M_2\) are observationally equivalent.

Another important consequence of Theorem 5 is a “completeness” property of the weak reduction of Fig. 2 which can be stated as follows. Let \(\simeq \) be an equivalence relation on terms which contains \(\mathord \rightarrow _{\mathsf w}^*\) and is compatible with the semantics of Sect. 3.3 in the sense that, if \(\mathcal {P}\vdash M_i:\sigma \) for \(i=1,2\) and \(M_1\simeq M_2\), then \([{M_1}]_\mathcal {P}=[{M_2}]_\mathcal {P}\) in any model \(\mathcal {L}\). Assume that \(\vdash M:\varphi \) and \(\vdash V:\varphi \) for a closed term M and a closed value V, and assume that \(M\simeq V\). Then \(M\mathrel {\mathord \rightarrow _{\mathsf w}^*} V'\) where \(V'\) is a value such that \(V\simeq V'\). Indeed \([{V}]\) is non-empty in the Scott model of Sect. 4, let \(a\in [{V}]\). By our hypothesis we have \(a\in [{M}]\) and hence \(M\in |a|^{\varphi }\), meaning that \(M{\mathord \rightarrow _{\mathsf w}^*} V'\) for some \(V'\in |\varphi |_{\mathsf v}^{a}\). By our assumptions we have \(M\simeq V'\) and hence \(V'\simeq V\).

5 A Fully Polarized Calculus

In \(\varLambda _{\mathsf {HP}}\) positive types are interpreted as \(!\)-coalgebras, and general types are simply interpreted as objects of the underlying linear category: in some sense, this system is half-polarized and is intuitionistic for that reason. In a fully polarized system we would expect non-positive types to be negative, that is, linear duals of \(!\)-coalgebras. This system would feature syntactic constructions related to classical logic such as \(\mathsf {call/cc}\), the price to pay being a more complicated encoding of data-types.

It is quite easy to turn our hierarchy of types (1) and (2) into a polarized one:
$$\begin{aligned} \varphi ,\psi ,\dots {}&\mathrel {\mathord :\mathord =}!\sigma \,\,\mathord |\,\,{\varphi }\otimes {\psi }\,\,\mathord |\,\,{\varphi }\oplus {\psi }\,\,\mathord |\,\,\zeta \,\,\mathord |\,\,\textsf {Fix}\,\zeta \cdot \varphi \quad \text {(positive)} \end{aligned}$$
$$\begin{aligned} \sigma ,\tau \dots {}&\mathrel {\mathord :\mathord =}?\varphi \,\,\mathord |\,\,{\varphi }\multimap {\sigma }\,\,\mathord |\,\,\top \quad \text {(negative)} \end{aligned}$$
Accordingly we introduce a polarized syntax for expressions featuring five mutually recursive syntactic categories.
$$\begin{aligned} P,Q\dots {}&\mathrel {\mathord :\mathord =}x \,\,\mathord |\,\,N^{\mathord !} \,\,\mathord |\,\,\langle P_1,P_2\rangle \,\,\mathord |\,\,\mathsf {in}_{i}P \quad \text {(positive terms)}\\ M,N,\dots {}&\mathrel {\mathord :\mathord =}\mathsf {der}\,P \,\,\mathord |\,\,\lambda x^{\varphi }\, M \,\,\mathord |\,\,\mu \alpha ^{\sigma }\,c \,\,\mathord |\,\,\mathsf {fix}\,x^{!\sigma }\,M\quad \text {(negative terms)}\\ \pi ,\rho \dots {}&\mathrel {\mathord :\mathord =}\alpha \,\,\mathord |\,\,{\eta }^{\mathord !}\,\,\mathord |\,\,P\cdot \pi \quad \text {(positive contexts)}\\ \eta ,\theta \dots {}&\mathrel {\mathord :\mathord =}\mathsf {der}\,\pi \,\,\mathord |\,\,\mathsf {pr}_{i}\,\eta \,\,\mathord |\,\,\left[ \eta _1,\eta _2\right] \,\,\mathord |\,\,\tilde{\mu }x^{\varphi }\,c \quad \text {(negative contexts)}\\ c,d\dots {}&\mathrel {\mathord :\mathord =}P * \eta \,\,\mathord |\,\,M * \pi \quad \text {(commands, cuts)} \end{aligned}$$
Intuitively, positive terms correspond to data, negative terms to programs, negative contexts to patterns (apart from the negative context \(\tilde{\mu }x^{\varphi }\,c\) which generalizes the concept of “closure”) and positive contexts to evaluation environments.

The typing rules correspond to a large fragment of \(\mathsf {LLP}\), see [21]7, and are given in Fig. 6.

Let us say that an expression e is well typed in typing contexts \(\mathcal {P}=(x_1:\varphi _1,\dots ,x_n:\varphi _n)\), \(\mathcal {N}=(\alpha _1:\sigma _1,\dots ,\alpha _k:\sigma _k)\) if e is a positive term P and \(\mathcal {P}\vdash P:\varphi \,\vert \, \mathcal {N}\) for some type \(\varphi \), if e is a negative term M and \(\mathcal {P}\vdash M:\sigma \,\vert \, \mathcal {N}\) for some type \(\sigma \), if e is a positive context \(\pi \) and \(\mathcal {P}\,\vert \, \pi :\sigma \vdash \mathcal {N}\) for some type \(\sigma \), if e is a negative context \(\eta \) and \(\mathcal {P}\,\vert \, \eta :\varphi \vdash \mathcal {N}\) for some type \(\varphi \) and if e is a command c and \(\mathcal {P}\vdash c\,\vert \, \mathcal {N}\). In the four first cases, \(\varphi \) (resp. \(\sigma \)) is the type ofe. Observe that, when it exists, this type is completely determined by e, \(\mathcal {P}\) and \(\mathcal {N}\) (the typing rules are syntax-directed).

5.1 Operational Semantics

The weak reduction rules are given in Fig. 7. All redexes are commands and it is crucial to observe that there are no critical pairs. Specifically, there is no command which is simultaneously of shape \(M * \pi \) and \(P * \tilde{\mu }x^{\varphi }\,c\) because in the former the term is negative whereas it is positive in the latter. In particular the “Lafont critical pair” \(\mu \alpha ^{\theta }\,c * \tilde{\mu }x^{\theta }\,d\) cannot occur since \(\theta \) cannot be positive and negative!.
Fig. 6.

Typing rules for \(\varLambda _{\mathsf {LLP}}\): positive terms, negative terms, positive contexts, negative contexts and commands

Remark 6

In this weak reduction paradigm, we only reduce commands. A sequence of reduction alternates therefore sequences of positive commands of shape \(P * \eta \) where a piece of data P is explored by a pattern \(\eta \) with sequences of negative commands\(M * \pi \) where a program M is executed in an evaluation context \(\pi \). The transition from the execution phase to the pattern-matching phase is realized by the reduction rule (6) and the converse by (10). We retrieve the basic idea of focusing of [1] and of Ludics, [16], that “positive” means passive and “negative”, active (many other authors should be mentioned here of course).

We also consider a general reduction relation \(\mathord \rightarrow \) on expressions which is defined by allowing the application of the rules of Fig. 7anywhere in an expression as well as the two following \(\mu \eta \) reduction rules: \(\mu \alpha ^{\sigma }\,(M * \alpha )\mathrel {\mathord \rightarrow }M\) if \(\alpha \) does not occur free in M and \(\tilde{\mu }x^{\varphi }\,(x * \eta )\mathrel {\mathord \rightarrow }\eta \) if x does not occur free in \(\eta \).
Fig. 7.

Reduction rules for \(\varLambda _{\mathsf {LLP}}\)

Proposition 8

If e is typable in contexts \(\mathcal {P}\), \(\mathcal {N}\) and \(e\mathrel {\mathord \rightarrow }e'\) then \(e'\) is typable in contexts \(\mathcal {P}\), \(\mathcal {N}\), belongs to the same syntactic category as e and has the same type as e (when it applies).

The proof is a straightforward verification. As usual one has first to state and prove a Substitution Lemma.

The reduction \(\mathord \rightarrow \) on \(\varLambda _{\mathsf {LLP}}\) enjoys Church-Rosser as we shall see in a longer paper. The denotational semantics that we outline now gives us another proof that this calculus is sound.

5.2 Denotational Semantics

Assume to be given a model of LL \(\mathcal {L}\) as specified in Sect. 3. With any positive type \(\varphi \), negative type \(\sigma \) and sequence of pairwise distinct type variables \(\mathbf {\zeta }=(\zeta _{1},\dots ,\zeta _{n})\) containing all free variables of \(\varphi \) and \(\sigma \), we associate the continuous functors \([\varphi ]_{\mathbf {\zeta }},\llbracket \sigma \rrbracket _{\mathbf {\zeta }}: (\mathcal {L}^{\mathord !}_{\mathord \subseteq })^n\rightarrow \mathcal {L}^{\mathord !}_{\mathord \subseteq }\) defined in Fig. 8 on objects, the definition on morphisms being similar8. With any positive terms and contexts P and \(\pi \) with \(\mathcal {P}\vdash P:\varphi \,\vert \, \mathcal {N}\) and \(\mathcal {P}\,\vert \, \pi :\sigma \vdash \mathcal {N}\) we associate coalgebra morphisms \([P]_{\mathcal {P},\mathcal {N}}\in \mathcal {L}^{\mathord !}({[\mathcal {P}]}\otimes {\llbracket \mathcal {N}\rrbracket },[\varphi ])\) and \([\pi ]_{\mathcal {P},\mathcal {N}} \in \mathcal {L}^{\mathord !}({[\mathcal {P}]}\otimes {\llbracket \mathcal {N}\rrbracket },\llbracket \sigma \rrbracket )\) and with any negative terms and contexts M and \(\eta \) with \(\mathcal {P}\vdash M:\sigma \,\vert \, \mathcal {N}\) and \(\mathcal {P}\,\vert \, \eta :\varphi \vdash \mathcal {N}\) we associate morphisms \([M]_{\mathcal {P},\mathcal {N}} \in \mathcal {L}({\underline{[\mathcal {P}]}}\otimes {\underline{\llbracket \mathcal {N}\rrbracket }}, \underline{\llbracket \sigma \rrbracket }^{{{\perp }}_{}})\) and \([\eta ]_{\mathcal {P},\mathcal {N}} \in \mathcal {L}({\underline{[\mathcal {P}]}}\otimes {\underline{\llbracket \mathcal {N}\rrbracket }}, \underline{[\varphi ]}^{{{\perp }}_{}})\). Last, with any command c such that \(\mathcal {P}\vdash c\,\vert \, \mathcal {N}\) we associate a morphism \([{c}]_{\mathcal {P},\mathcal {N}}\in \mathcal {L}({\underline{[\mathcal {P}]}}\otimes {\underline{\llbracket \mathcal {N}\rrbracket }},{{\perp }})\).
Fig. 8.

Semantics of types in \(\varLambda _{\mathsf {LLP}}\)

The interpretation of positive terms is defined as for \(\varLambda _{\mathsf {HP}}\) (see Sect. 3.3). Negative terms: the interpretation of \(\mathsf {der}\,P\) uses the dereliction morphism in \(\mathcal {L}(\underline{[\varphi ]},?{\underline{[\varphi ]}})\), the interpretation of \(\lambda x^{\varphi }\, M\) and of \(\mathsf {fix}\,x^{!\sigma }\,M\) is defined as in \(\varLambda _{\mathsf {HP}}\) (replacing \([{\sigma }]\) with \(\underline{\llbracket \sigma \rrbracket }^{{{\perp }}_{}}\)) and we provide the interpretation of \(\mu \alpha ^{\sigma }\,c\): assume that \(\mathcal {P}\vdash c\,\vert \, \mathcal {N},\alpha :\sigma \) so that \([{c}]_{\mathcal {P},\mathcal {N},\alpha :\sigma } \in \mathcal {L}({\underline{[\mathcal {P}]}}\otimes {{\underline{\llbracket \mathcal {N}\rrbracket }}\otimes {\underline{\llbracket \sigma \rrbracket }}},{{\perp }})\) and we set \([{\mu \alpha ^{\sigma }\,c}]_{\mathcal {P},\mathcal {N}}={\mathrm {cur}}{[{c}]_{\mathcal {P},\mathcal {N},\alpha :\sigma }}\). Positive contexts: we deal only with one case. Assume that \(\mathcal {P}\vdash P:\varphi \,\vert \, \mathcal {N}\) and \(\mathcal {P}\,\vert \, \pi :\sigma \vdash \mathcal {N}\). We have \([{P}]_{\mathcal {P},\mathcal {N}} \in \mathcal {L}^{\mathord !}({[\mathcal {P}]}\otimes {\llbracket \mathcal {N}\rrbracket },[\varphi ])\) and \([{\pi }]_{\mathcal {P},\mathcal {N}} \in \mathcal {L}^{\mathord !}({[\mathcal {P}]}\otimes {\llbracket \mathcal {N}\rrbracket },\llbracket \sigma \rrbracket )\) so that we can set \([{P\cdot \pi }]_{\mathcal {P},\mathcal {N}} =({[{P}]_{\mathcal {P},\mathcal {N}}}\otimes {[{\pi }]_{\mathcal {P},\mathcal {N}}}) \,{\mathrm {c}}_{{[\mathcal {P}]}\otimes {\llbracket \mathcal {N}\rrbracket }}\) whose codomain is \({[\varphi ]}\otimes {\llbracket \sigma \rrbracket }=\llbracket {\varphi }\multimap {\sigma }\rrbracket \) as required. The interpretation of \(\alpha \) uses a projection and the interpretation of \({\eta }^{\mathord !}\) uses a promotion. Negative contexts: assume that \(\mathcal {P}\,\vert \, \pi :\sigma \vdash \mathcal {N}\), then \([{\pi }]_{\mathcal {P},\mathcal {N}} \in \mathcal {L}^{\mathord !}({[\mathcal {P}]}\otimes {\llbracket \mathcal {N}\rrbracket },\llbracket \sigma \rrbracket )\) so we set \([{\mathsf {der}\,\pi }]_{\mathcal {P},\mathcal {N}} ={\mathrm {der}}'_{\underline{\llbracket \sigma \rrbracket }}\,[{\pi }]_{\mathcal {P},\mathcal {N}} \in \mathcal {L}({{\underline{[\mathcal {P}]}}\otimes {\underline{\llbracket \mathcal {N}\rrbracket }}}, ?{\underline{\llbracket \sigma \rrbracket }})\) which makes sense since \(?{\underline{\llbracket \sigma \rrbracket }}=\underline{[!\sigma ]}^{{{\perp }}_{}}\) (see Fig. 8). The interpretation of \(\mathsf {pr}_{i}\,\eta \) uses \({\mathrm {pr}}_{i}^{{{\perp }}_{}}\in \mathcal {L}(\underline{[\varphi _i]}^{{{\perp }}_{}},({\underline{[\varphi _1]}}\otimes {\underline{[\varphi _2]}})^{{{\perp }}_{}})\). To define \([{\left[ \eta _1,\eta _2\right] }]_{\mathcal {P},\mathcal {N}}\) we simply use the pairing operation associated with the cartesian product \( \mathrel { \& }\) of \(\mathcal {L}\) (warning: not of \(\mathcal {L}^{\mathord !}\)!) which is the linear “De Morgan” dual of the coproduct \(\oplus \) of \(\mathcal {L}\). The interpretation of \(\tilde{\mu }x^{\varphi }\,c\) uses a linear curryfication. Commands: assume that \(\mathcal {P}\vdash P:\varphi \,\vert \, \mathcal {N}\) and \(\mathcal {P}\,\vert \, \eta :\varphi \vdash \mathcal {N}\) so that \([{P}]_{\mathcal {P},\mathcal {N}}\in \mathcal {L}^{\mathord !}({[\mathcal {P}]}\otimes {\llbracket \mathcal {N}\rrbracket },[\varphi ]) \subseteq \mathcal {L}({\underline{[\mathcal {P}]}}\otimes {\underline{\llbracket \mathcal {N}\rrbracket }}, \underline{[\varphi ]})\) and \([{\eta }]_{\mathcal {P},\mathcal {N}} \in \mathcal {L}({{\underline{[\mathcal {P}]}}\otimes {\underline{\llbracket \mathcal {N}\rrbracket }}}, \underline{[\varphi ]}^{{{\perp }}_{}})\) and we set \([{P * \eta }]_{\mathcal {P},\mathcal {N}} ={\mathrm {ev}}\,({[{\eta }]_{\mathcal {P},\mathcal {N}}}\otimes {[{P}]_{\mathcal {P},\mathcal {N}}})\,{\mathrm {c}}_{{[\mathcal {P}]}\otimes {\llbracket \mathcal {N}\rrbracket }}\). The interpretation of \(M * \pi \) is similar.

Proposition 9

Assume that \(\mathcal {P}\vdash P:\varphi \,\vert \, \mathcal {N}\) and that e is a well-typed expression in typing contexts \(x:\varphi ,\mathcal {P}\), \(\mathcal {N}\). Then we have \([{{e}\left[ {P}/{x}\right] }]_{\mathcal {P},\mathcal {N}}=[{e}]_{x:\varphi ,\mathcal {P},\mathcal {N}}\,({[{P}]_{\mathcal {P},\mathcal {N}}}\otimes {{\mathrm {Id}}})\,{\mathrm {c}}_{{[\mathcal {P}]}\otimes {\llbracket \mathcal {N}\rrbracket }}\). Assume that \(\mathcal {P}\,\vert \, \pi :\sigma \vdash \mathcal {N}\) and that e is a well-typed expression in typing contexts \(\mathcal {P}\), \(\mathcal {N},\alpha :\sigma \). Then we have \([{{e}\left[ {\pi }/{\alpha }\right] }]_{\mathcal {P},\mathcal {N}} =[{e}]_{\mathcal {P},\mathcal {N},\alpha :\sigma } \,({{\mathrm {Id}}}\otimes {[{\pi }]_{\mathcal {P},\mathcal {N}}}) \,{\mathrm {c}}_{{[\mathcal {P}]}\otimes {\llbracket \mathcal {N}\rrbracket }}\).

Theorem 6

If e is a well-typed expression in typing contexts \(\mathcal {P}\), \(\mathcal {N}\) and if \(e\mathrel {\mathord \rightarrow }e'\) then \([{e}]_{\mathcal {P},\mathcal {N}}=[{e'}]_{\mathcal {P},\mathcal {N}}\).

The proof is routine, using Proposition 9.

Given a negative type \(\sigma \), observe that \(\varOmega ^{\sigma }=\mathsf {fix}\,x^{!\sigma }\,(\mu \alpha ^{\sigma }\,(x * \mathsf {der}\,\alpha ))\) is a closed negative term of type \(\sigma \). A consequence of Theorem 6 is that \(\varLambda _{\mathsf {LLP}}\) is sound in the sense that the reflexive and transitive closure of \(\mathord \rightarrow \) does not equate e.g. the two booleans \(\mathsf {in}_{1}(\varOmega ^{\top })^{\mathord !}\) and \(\mathsf {in}_{2}(\varOmega ^{\top })^{\mathord !}\) (closed positive terms of type \({!\top }\oplus {!\top }\)). Indeed it is easy to build models where these constants have distinct interpretations (for instance the Scott model \(\mathbf {Polr}\) of Sect. 4).
Fig. 9.

Translation of types

5.3 Translating \(\varLambda _{\mathsf {HP}}\) into \(\varLambda _{\mathsf {LLP}}\)

With any positive type \(\varphi \) of \(\varLambda _{\mathsf {HP}}\) we associate a positive type \(\varphi ^+\) of \(\varLambda _{\mathsf {LLP}}\) and with any general type \(\sigma \) we associate a negative type of \(\varLambda _{\mathsf {LLP}}\). The translation does almost nothing apart adding a few “\(?\)” to make sure that \(\sigma ^-\) is negative, see Fig. 9. Given a \(\varLambda _{\mathsf {HP}}\) typing context \(\mathcal {P}=(x_1:\varphi _1,\dots ,x_n:\varphi _n)\), we set \(\mathcal {P}^+=(x_1:\varphi _1^+,\dots ,x_n:\varphi _n^+)\). With any term M of \(\varLambda _{\mathsf {HP}}\) such that \(\mathcal {P}\vdash M:\sigma \) one associates a term \(M^-\) of \(\varLambda _{\mathsf {LLP}}\) such that \(\mathcal {P}^+\vdash M^-:\sigma ^-\,\vert \, \). We give two cases of this translation, the complete translation will be given in a longer paper.

If \(M=\langle N\rangle R\) with \(\mathcal {P}\vdash N:{\varphi }\multimap {\sigma }\) and \(\mathcal {P}\vdash R:\varphi \) then by inductive hypothesis, \(\mathcal {P}^+\vdash N^-:{\varphi ^+}\multimap {\sigma ^-}\,\vert \, \) and \(\mathcal {P}^+\vdash R^-:?\varphi ^+\,\vert \, \). We have \(\mathcal {P}^+,x:\varphi ^+\,\vert \, x\cdot \alpha :{\varphi ^+}\multimap {\sigma ^-}\vdash \alpha :\sigma ^-\), hence \(\mathcal {P}^+,x:\varphi ^+\vdash N^- * (x\cdot \alpha )\,\vert \, \alpha :\sigma ^-\). Therefore we have \(\mathcal {P}^+\,\vert \, \mu x^{\varphi ^+}\, N^- * (x\cdot \alpha ):\varphi ^+\vdash \alpha :\sigma ^-\) so that \(\mathcal {P}^+\,\vert \, {(\mu x^{\varphi ^+}\, N^- * (x\cdot \alpha ))}^{\mathord !}:?\varphi ^+\vdash \alpha :\sigma ^-\) and we set \( \langle N\rangle R^-= \mu \alpha ^{\sigma ^-}\,(R^- * {(\mu x^{\varphi ^+}\, N^- * (x\cdot \alpha ))}^{\mathord !}) \).

If \(M=\langle M_1,M_2\rangle \) there are two possible translations (similar phenomena occur in CPS translation, see for instance [29]), a left first translation and a right first translation. We give the first one, the other one being obtained by swapping the roles of \(M_1\) and \(M_2\). We assume that \(\mathcal {P}\vdash M_i:\varphi _i\) and hence \(\mathcal {P}^+\vdash M_i^-:?\varphi _i^+\,\vert \, \) for \(i=1,2\). We have \(\mathcal {P}^+,x_2:\varphi _2^+\,\vert \, \tilde{\mu }x_1^{\varphi _1^+}\,\mathsf {der}\,\langle x_1,x_2\rangle * \alpha :\varphi _1^+\vdash \alpha :?({\varphi _1^+}\otimes {\varphi _2^+})\), hence \(\mathcal {P}^+,x_2:\varphi _2^+\vdash M_1^- * {(\tilde{\mu }x_1^{\varphi _1^+}\,\mathsf {der}\,\langle x_1,x_2\rangle * \alpha )}^{\mathord !} \,\vert \, \alpha :?({\varphi _1^+}\otimes {\varphi _2^+})\) and hence we set \( \langle M_1,M_2\rangle ^-= \mu \alpha ^{?({\varphi _1^+}\otimes {\varphi _2^+})}\, {M_2^- * {\left( \tilde{\mu }x_2^{\varphi _2^+}\,M_1^- * {(\tilde{\mu }x_1^{\varphi _1^+}\,\mathsf {der}\,\langle x_1,x_2\rangle * \alpha )}^{\mathord !}\right) }^{\mathord !}}\,. \)

Given a \(\varLambda _{\mathsf {HP}}\) value V such that \(\mathcal {P}\vdash V:\varphi \), one defines straightforwardly a positive term \(V^+\) of \(\varLambda _{\mathsf {LLP}}\) such that \(\mathcal {P}^+\vdash V^+:\varphi ^+\,\vert \, \): one sets \((M^{\mathord !})^+=(M^-)^{\mathord !}\), \(\langle V_1,V_2\rangle ^+=\langle V_1^+,V_1^+\rangle \) and similarly for the other cases.

Lemma 5

If \(\mathcal {P}\vdash V:\varphi \) in \(\varLambda _{\mathsf {HP}}\) and if V is a value then \(V^-\mathrel {\mathord \rightarrow _{\mathsf w}^*}\mathsf {der}\,(V^+)\).

Lemma 6

If \(\mathcal {P},x:\varphi \vdash M:\sigma \) and \(\mathcal {P}\vdash V:\varphi \) in \(\varLambda _{\mathsf {HP}}\) (with V being a value) then \({M}\left[ {V}/{x}\right] ^-\mathrel {\mathord \rightarrow _{\mathsf w}^*}{M^-}\left[ {V^+}/{x}\right] \).


Induction on M, using Lemma 5 when \(M=x\).    \(\square \)

Theorem 7

If \(\mathcal {P}\vdash M:\sigma \) in \(\varLambda _{\mathsf {HP}}\) then \(\mathcal {P}^+\vdash M^-:\sigma ^-\,\vert \, \). Moreover, if \(M\mathrel {\mathord \rightarrow _{\mathsf w}}M'\) then there is a negative term R of \(\varLambda _{\mathsf {LLP}}\) such that \(M^-\mathrel {\mathord \rightarrow ^*}R\) and \(M'^-\mathrel {\mathord \rightarrow ^*}R\).

As a consequence, using confluence of \(\mathord \rightarrow ^*\) in \(\varLambda _{\mathsf {LLP}}\), one proves that, if \(M\mathrel {\mathord \rightarrow ^*}M'\) in \(\varLambda _{\mathsf {HP}}\) there is a negative term R of \(\varLambda _{\mathsf {LLP}}\) such that \(M^-\mathrel {\mathord \rightarrow ^*}R\) and \(M'^-\mathrel {\mathord \rightarrow ^*}R\) (induction on the length of the reduction \(M\mathrel {\mathord \rightarrow ^*}M'\)). This shows that \(\varLambda _{\mathsf {HP}}\) embeds in \(\varLambda _{\mathsf {LLP}}\) by a translation \(M\mapsto M^-\) which is compatible with the operational semantics. In the long version of this paper, we will also describe a simple relation between the semantics of M and of \(M^-\).

Conclusion. The half-polarized and fully polarized calculi proposed in this paper admit LL-based models featuring non-trivial computational effects such as non-deterministic or probabilistic computations [9] (with full abstraction properties [12]). One can accommodate other effects by extending the language with monad type constructions interpreted as monads acting on \(\mathcal {L}\) and featuring a strength, in the spirit of [17], as we will explain in a forthcoming paper.

I would like to thank the referees for their insightful suggestions and comments. I also would like to mention the work [6] which shares some features with ours (in particular an emphasis on the resource modality “!”); these papers have been written independently and simultaneously.

This work has been partly funded by the French-Chinese project ANR-11-IS02-0002 and NSFC 61161130530 Locali.


  1. 1.

    This would be very interesting but would require more space.

  2. 2.

    Though not essential for interpreting \(\varLambda _{\mathsf {HP}}\), this assumption is natural as it holds in the concrete models we have in mind and it simplifies the interpretation of \(\varLambda _{\mathsf {LLP}}\), the calculus of Sect. 5.

  3. 3.

    This is true in many concrete models. It implies that any hom-set \(\mathcal {L}(X,Y)\) has a distinguished element which coincides with the least element \({{\perp }}\) in denotational models based on domains or games. So this identification is typical of models featuring partial morphisms, which is required here because of the availability of fix-point operators for types and for programs.

  4. 4.

    That is, a directed colimits preserving functor.

  5. 5.

    This adequacy result can probably be seen as a special case of the general adequacy results of [23].

  6. 6.

    Because we are dealing with a partially ordered class, we can replace general filtered categories with directed posets.

  7. 7.

    In a Sequent Calculus presentation, with double-sided sequents contrarily to most presentations of \(\mathsf {LLP}\) in the literature. Our syntax is based on the \(\lambda \mu \tilde{\mu }\) presentation of sequent calculus-oriented classical lambda-calculi due to [7].

  8. 8.

    Notice that the interpretation of a negative type is actually the semantics of its linear negation; we adopt this convention in order to avoid the explicit introduction of negative objects in the model. This is possible because we have assumed that \(\mathcal {L}\) is \(*\)-autonomous.


  1. 1.
    Andreoli, J.-M.: Logic programming with focusing proofs in linear logic. J. Logic Comput. 2(3), 297–347 (1992)MathSciNetCrossRefzbMATHGoogle Scholar
  2. 2.
    Benton, P.N., Wadler, P.: Linear logic, monads and the lambda calculus. In: Proceedings of 11th Annual IEEE Symposium on Logic in Computer Science, New Brunswick, New Jersey, USA, July 27–30, pp. 420–431. IEEE Computer Society (1996)Google Scholar
  3. 3.
    Bierman, G.M.: What is a categorical model of intuitionistic linear logic? In: Dezani-Ciancaglini, M., Plotkin, G. (eds.) TLCA 1995. LNCS, vol. 902, pp. 78–93. Springer, Heidelberg (1995)CrossRefGoogle Scholar
  4. 4.
    Carraro, A., Guerrieri, G.: A semantical and operational account of call-by-value solvability. In: Muscholl, A. (ed.) FOSSACS 2014 (ETAPS). LNCS, vol. 8412, pp. 103–118. Springer, Heidelberg (2014)CrossRefGoogle Scholar
  5. 5.
    Curien, P.-L.: Call-By-Push-Value in system L style. Unpublished note (2015)Google Scholar
  6. 6.
    Curien, P.-L., Fiore, M., Munch-Maccagnoni, G.: A theory of effects and resources: adjunction models and polarised calculi. In: Proceedings of POpPL (2015, To appear) (2016)Google Scholar
  7. 7.
    Curien, P.-L., Herbelin, H.: The duality of computation. In: Odersky, M., Wadler, P. (eds.) Proceedings of the Fifth ACM SIGPLAN International Conference on Functional Programming (ICFP 2000), Montreal, Canada, September 18–21, pp. 233–243. ACM (2000)Google Scholar
  8. 8.
    Curien, P.-L., Munch-Maccagnoni, G.: The duality of computation under focus. In: Calude, C.S., Sassone, V. (eds.) TCS 2010. IFIP AICT, vol. 323, pp. 165–181. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  9. 9.
    Danos, V., Ehrhard, T.: Probabilistic coherence spaces as a model of higher-order probabilistic computation. Inf. Comput. 152(1), 111–137 (2011)MathSciNetzbMATHGoogle Scholar
  10. 10.
    Egger, J., Møgelberg, R.E., Simpson, A.: The enriched effect calculus: syntax and semantics. J. Logic Comput. 24(3), 615–654 (2014)MathSciNetCrossRefzbMATHGoogle Scholar
  11. 11.
    Ehrhard, T.: The scott model of linear logic is the extensional collapse of its relational model. Theor. Comput. Sci. 424, 20–45 (2012)MathSciNetCrossRefzbMATHGoogle Scholar
  12. 12.
    Ehrhard, T., Tasson, C., Pagani, M.: Probabilistic coherence spaces are fully abstract for probabilistic PCF. In: Jagannathan, S., Sewell, P. (eds.) POPL, pp. 309–320. ACM (2014)Google Scholar
  13. 13.
    Fiore, M.P., Plotkin, G.D.: An axiomatization of computationally adequate domain theoretic models of FPC. In: Proceedings of the Ninth Annual Symposium on Logic in Computer Science (LICS 1994), Paris, France, July 4–7, pp. 92–102. IEEE Computer Society (1994)Google Scholar
  14. 14.
    Girard, J.-Y.: Linear logic. Theor. Comput. Sci. 50, 1–102 (1987)MathSciNetCrossRefzbMATHGoogle Scholar
  15. 15.
    Girard, J.-Y.: A new constructive logic: classical logic. Math. Struct. Comput. Sci. 1(3), 225–296 (1991)MathSciNetCrossRefzbMATHGoogle Scholar
  16. 16.
    Girard, J.-Y.: Locus solum. Math. Struct. Comput. Sci. 11(3), 301–506 (2001)MathSciNetCrossRefzbMATHGoogle Scholar
  17. 17.
    Hasegawa, M.: Linearly used effects: monadic and CPS transformations into the linear lambda calculus. In: Hu, Z., Rodríguez-Artalejo, M. (eds.) FLOPS 2002. LNCS, vol. 2441, pp. 167–182. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  18. 18.
    Huth, M.: Linear domains and linear maps. In: Main, M.G., Melton, A.C., Mislove, M.W., Schmidt, D., Brookes, S.D. (eds.) MFPS 1993. LNCS, vol. 802, pp. 438–453. Springer, Heidelberg (1994)CrossRefGoogle Scholar
  19. 19.
    Krivine, J.-L.: Lambda-Calculus, Types and Models. Ellis Horwood Series in Computers and Their Applications. Ellis Horwood, Translation by René Cori from French 1990 (edn.) (Masson) (1993)Google Scholar
  20. 20.
    Krivine, J.-L.: A general storage theorem for integers in call-by-name \(\lambda \)-calculus. Theor. Comput. Sci. 129, 79–94 (1994)MathSciNetCrossRefzbMATHGoogle Scholar
  21. 21.
    Laurent, O., Regnier, L.: About translations of classical logic into polarized linear logic. In: Proceedings of 18th IEEE Symposium on Logic in Computer Science (LICS 2003), pp. 22–25, Ottawa, Canada, pp. 11–20. IEEE Computer Society, June 2003Google Scholar
  22. 22.
    Levy, P.B.: Adjunction models for call-by-push-value with stacks. Electron. Notes Theor. Comput. Sci. 69, 248–271 (2002)CrossRefzbMATHGoogle Scholar
  23. 23.
    Levy, P.B.: Call-By-Push-Value: A Functional/Imperative Synthesis. Semantics Structures in Computation, vol. 2. Springer, Heidelberg (2004)zbMATHGoogle Scholar
  24. 24.
    Maraist, J., Odersky, M., Turner, D.N., Wadler, P.: Call-by-name, call-by-value, call-by-need and the linear lambda calculus. Theor. Comput. Sci. 228(1–2), 175–210 (1999)MathSciNetCrossRefzbMATHGoogle Scholar
  25. 25.
    Marz, M., Rohr, A., Streicher, T.: Full Abstraction and Universality via Realisability. In: 14th Annual IEEE Symposium on Logic in Computer Science, Trento, Italy, July 2–5, pp. 174–182. IEEE Computer Society, (1999)Google Scholar
  26. 26.
    Melliès, P.-A.: Categorical semantics of linear logic. In: Curien, P.-L., Herbelin, H., Krivine, J.-L., Melliès, P.-A. (eds.) Interactive Models of Computation and Program Behaviour, vol. 27. Panoramas et Synthèses, Sociètè Mathèmatique de France, Marseille (2009)Google Scholar
  27. 27.
    Moggi, E.: Computational lambda-calculus and monads. In: Proceedings of the 4th Annual IEEE Symposium on Logic in Computer Science. IEEE Computer Society (1989)Google Scholar
  28. 28.
    Seely, R.A.G.: Linear logic, *-autonomous categories and cofree coalgebras. Contem. Math. 92 (1989). American Mathematical SocietyGoogle Scholar
  29. 29.
    Selinger, P.: Control categories and duality: on the categorical semantics of the lambda-mu calculus. Math. Struct. Comput. Sci. 11(2), 207–260 (2001)MathSciNetCrossRefzbMATHGoogle Scholar
  30. 30.
    Simpson, A.K., Plotkin, G.D.: Complete axioms for categorical fixed-point operators. In: 15th Annual IEEE Symposium on Logic in Computer Science, Santa Barbara, California, USA, 26–29 June, pp. 30–41. IEEE Computer Society (2000)Google Scholar
  31. 31.
    Winskel, G.: A linear metalanguage for concurrency. In: Haeberer, A.M. (ed.) AMAST 1998. LNCS, vol. 1548, pp. 42–58. Springer, Heidelberg (1998)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2016

Authors and Affiliations

  1. 1.CNRS, IRIF, UMR 8243Univ Paris Diderot, Sorbonne Paris CitéParisFrance

Personalised recommendations