Classical Linear Logic in Perfect Banach Lattices
Abstract
In recent years, researchers have proposed various models of linear logic with strong connections to measure theory, with probabilistic coherence spaces () being one of the most prominent. One of the main limitations of the model is that it cannot interpret continuous measures. To overcome this obstacle, Ehrhard has extended to a category of positive cones and linear Scott-continuous functions and shown that it is a model of intuitionistic linear logic. In this work we show that the category of perfect Banach lattices and positive linear functions of norm at most can serve the same purpose, with some added benefits. We show that is a model of classical linear logic (without exponential) and that embeds fully and faithfully in while preserving the monoidal and -autonomous structures. Finally, we show how can be used to give semantics to a higher-order probabilistic programming language.
Keywords and phrases:
Probabilistic Semantics, Linear Logic, Categorical SemanticsFunding:
Pedro H. Azevedo de Amorim: Pedro H. Azevedo de Amorim was funded by the National Science Foundation under grant CCF-2008083. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of the National Science Foundation.Copyright and License:
![[Uncaptioned image]](x1.png)
2012 ACM Subject Classification:
Theory of computation Categorical semantics ; Theory of computation Linear logic ; Theory of computation Denotational semantics ; Theory of computation Probabilistic computationAcknowledgements:
The authors would like to thank Raphaëlle Crubillé, Christine Tasson, Thomas Ehrhard and Fredrik Dahlqvist for lively discussions on the subject. We would also like to thank Arthur Azevedo de Amorim and Michael Roberts for reading an earlier draft of this work.Editors:
Jörg Endrullis and Sylvain SchmitzSeries and Publisher:

1 Introduction
Recent work has shown that linear logic has deep connections to the semantics of probabilistic programming languages [8, 13, 10, 12, 11, 25, 9, 19, 7]. By using monoidal closed categories instead of cartesian closed categories, linear logic provides an alternative categorical framework for higher-order functions. This was foreshadowed in early work on probabilistic semantics [20] in which bounded linear operators on Banach lattices were used to interpret a first-order imperative probabilistic programming language. This can be seen as evidence that a linear approach might be a natural alternative to cartesian closed categories.
Since then, many probabilistically-flavored models of linear logic have appeared. For instance, the connection between the early work of Kozen [20] and linear logic has been recently made precise by Dahlqvist and Kozen [7], where the category of regular ordered Banach spaces and regular maps () was used to extend the semantics of Kozen [20] with higher-order functions. They also showed that is a model of intuitionistic linear logic.
An appealing aspect of the model is that ordered Banach spaces are mathematically well-understood objects with a well-developed classical theory, thus providing a plethora of useful theorems to reason about programs. This is illustrated by Dahlqvist and Kozen [7] by using results from ergodic theory to prove the correctness of a Gibbs sampling algorithm implemented in a higher-order language. However, the programming model supported by the semantics is somewhat brittle, in that the soundness of the system depends on a tricky interaction between three different type grammars with several syntactic restrictions.
A different approach was taken by Ehrhard and Danos [8], in which a category was defined and shown to be a model of classical linear logic. The model was used to interpret a version of PCF extended with discrete probabilities [13]. Although this category handles discrete probabilities very nicely, it cannot interpret continuous distributions such as the normal distribution over , a severe limitation for real-world applications. To remedy this, a category of positive cones with measurability paths and linear Scott-continuous functions has recently been introduced and shown to be a conservative extension of the intuitionistic fragment of [6].
From a programming point of view, the language of Ehrhard et al. [12] is an extension of the simply typed -calculus with recursion, making it a simple and expressive programming model. However, the definition of positive cone with measurability paths deviates from standard objects from the probability literature and thus would require a large amount of mathematical effort to rephrase useful theorems that could be used to reason about programs.
Although these previous approaches are valuable contributions to our understanding of higher-order probabilistic programming through linear logic, missing up to now is a comprehensive model that embodies the following desirable aspects:
-
extends to admit continuous measures;
-
is a model of classical (not just intuitionistic) linear logic, thus allowing it to handle other computational interpretations of linear logic such as session types;
-
has a simple and expressive programming model that can handle higher-order computation;
-
is based on well-understood classical structures from measure theory and functional analysis.
In this paper we propose such a model. Our model extends with continuous probabilities and satisfies all of the properties above. Our model is based on complete normed vector lattices, called Banach lattices. To accommodate the second point, we work with spaces with an involutive linear negation, the so-called perfect spaces.
Compared to previous models, our model has simpler tensor product, which we believe lead to a more perspicuous and theoretically satisfying generalization of . For example, we invite a comparison with , where the construction rely on categorical machinery which, though elegant, are indirect.
Most importantly, Banach lattices can be seen as an abstraction of ordinary measure spaces and are well-studied in functional analysis, with many results from measure theory holding for certain classes of Banach lattices. There is a vast literature on the subject; see Fremlin [14] for a thorough introduction.
In order to justify the viability of our model, we show that it can be used to interpret a recently introduced higher-order probabilistic calculus [2], and we extend the core calculus with recursion.
Summary of contributions
Our work contributes both to the study of quantitative models of linear logic as well as to a deeper understanding of higher-order probability theory, shedding light on the importance of linear logic as a vehicle to interpret higher-order programs without cartesian closure.
2 Riesz spaces
Our model depends on technical definitions and constructions from the vector lattice literature. This section contains a brief self-contained presentation of the subject. We point the interested reader to introductory texts [1, 26] for good presentations of much of the material presented in this section.
Although we are primarily interested in Banach lattices – normed vector lattices with a completeness property – we start by defining the objects in the general unnormed case.
Definition 1.
Let . A Riesz space is a partially-ordered vector space over such that
-
if , then ;
-
if , then for ; and
-
it is an upper semilattice with respect to with join operation .
It follows that the space is also a lattice with meet operation .
Many standard vector spaces are Riesz spaces.
Example 2.
The following are Riesz spaces:
-
with the pointwise ordering;
-
the set of bounded sequences of real numbers with pointwise ordering;
-
the set of signed measures on a measurable space;
-
the set of bounded measurable functions on a measurable space.
Unlike the real numbers, there are elements that are neither negative nor positive, but a notable characteristic of Riesz spaces is that every element decomposes uniquely into its positive and negative parts.
Definition 3.
For an element of a Riesz space, define , and .
Then and are the unique positive elements such that and . Thus Riesz spaces are completely characterized by their positive elements. This often simplifies constructions, as one can often prove a property for the positive elements, then extend to the entire space using this decomposition.
Given a Riesz space , let denote the set of positive elements of . Using the decomposition property mentioned above, it follows that , where applied to sets denotes elementwise subtraction.
2.1 Order convergence
Every topology gives rise to a notion of convergence. For normed spaces, one usually studies convergence in the norm topology. However, ordered spaces also carry an order topology.
Definition 4.
Let be a directed set and a Riesz space. A net is a function . We say that the net is increasing (respectively, decreasing) and write (respectively, ) if implies (respectively, ).
Definition 5.
Given a decreasing net , we write if .
Definition 6 (Order convergence).
We say that a net converges in order to and write if there is a decreasing net such that for all , .
In general, this notion of convergence is neither weaker nor stronger than convergence in the norm topology. However, when a net converges in both order and norm, it converges to the same value in both. When it is clear from the context, we will denote order convergence as .
2.2 Riesz subspaces, solids, ideals and bands
In the theory of Riesz spaces, there are classes of subspaces that have many interesting properties that will be used in our constructions.
Definition 7.
A subset of a Riesz space is
-
solid if and implies ,
-
an ideal if it is a solid linear subspace,
-
a band if it is an ideal and closed under existing suprema.
Definition 8.
We say that a Riesz space is Archimedean if for every , . Furthermore, if every bounded subset of admits a supremum, then we say that is Dedekind complete.
Proposition 9.
Every band in a Dedekind complete Riesz space is Dedekind complete.
Definition 10.
A Riesz subspace is said to be order dense if for every element there is an element such that .
Theorem 11 ([1, Theorem 1.34]).
A Riesz subspace is order dense in an Archimedean Riesz space iff for every ,
2.3 Order-continuous functions
As usual when studying vector spaces with extra structure, we care only about linear maps that interact nicely with the extra structure. In our case, the linear functions will have to respect the partial order.
We call a linear function positive if it maps positive elements of to positive elements of ; that is, it restricts to a function . A linear function is regular if it can be written as the difference of two positive functions.
Definition 12.
A linear function between Riesz spaces and if whenever is an increasing net with supremum .
We can also characterize the positive order-continuous functions as those that preserve existing suprema and infima.
Order continuity interacts well with order density. Indeed, it is possible to show using Theorem 11 the following lemma
Lemma 13.
If is an Archimedian Riesz space and are two linear order-continuous functions that agree on an order-dense subset of , then .
This lemma will come in handy when constructing our model. Furthermore, the space of order-continuous linear functions on certain Riesz spaces are well-behaved subsets of the regular linear functions.
Theorem 14 ([1, Theorem 1.57]).
If is Dedekind complete, then the set of order-continuous linear functions is a band in the space of regular functions, thus forms a Dedekind-complete Riesz space.
Proof.
The Riesz space structure is given by Theorem 1.18 of Aliprantis and Burkinshaw [1].
Definition 15.
A Riesz space is separated if for every distinct pair , there exists an order-continuous linear functional such that .
2.4 Normed Riesz spaces
Now we will introduce normed Riesz spaces. In the context of probabilistic semantics, the norm plays an important role, as it can be used to distinguish between arbitrary measures and (sub)-probability distributions, the measures with norm at most .
Definition 16.
Let be a real vector space. A norm is a function such that:
-
iff
-
-
.
For Riesz spaces, we require the norm to satisfy the additional property
If the Riesz space is also complete with respect to the norm, we call it a Banach lattice. In vector space models of linear logic, the norm is typically used to distinguish between the product and the coproduct , as they both have the same underlying set, but distinct norms. However, in the context of program semantics, the norm also has the extra role of allowing the interpretation of recursive programs.
Example 17.
The set of signed measures over the Borel -algebra on is a Riesz space (cf. Section 2.6). We can equip it with the total variation norm .
Theorem 14 shows that by assuming the right amount of structure on the Riesz space, the set of order-continuous linear functions between Riesz spaces also has a lattice structure. It is not immediately clear whether this result generalizes to the normed case. Luckily, Dedekind completeness is once again enough.
Example 18.
Let and be normed Riesz spaces with Dedekind complete. The set of order-continuous linear functions can be equipped with the regular norm
where is given by Theorem 14 and Definition 3.
Definition 19.
Let be a normed Riesz space. The closed unit ball of is the set .
Banach lattices
Banach lattices are normed Riesz spaces that are also Banach spaces. In the usual categorical study of Banach spaces, the relevant morphisms are the norm-continuous linear functions.
Definition 20.
A linear function between normed Riesz spaces and is said to be norm-continuous (or norm-bounded) if is finite.
Since we are interested in spaces with two distinct structures, a partial order and a norm, it is not immediately clear which class of morphisms one should care about. In general, the space of all norm-continuous linear functions between Banach lattices is not a Banach lattice, making them unable to give semantics to linear implication.
Normed Riesz spaces are also problematic, as not every order-continuous function is norm-continuous, making it unclear how one would equip the space of order-continuous functions with a norm. However, if the codomain is a Banach lattice, then every order-continuous linear function is also norm-continuous [1]. This suggests that one should work with Banach lattices but only use order-continuous linear functions.
Definition 21.
The category has separated Banach lattices as objects and order-continuous positive linear functions of norm at most one as morphisms.
These objects have been widely studied in functional analysis, being influential in the linear operator approach to measure theory [14]. A subtlety when working with a norm and a partial order is that there are two distinct notions of convergence in play that on the surface appear only tenuously related. However, a useful property has been identified in the literature that brings some harmony between the two.
Definition 22.
A normed Riesz space is said to satisfy the (sequential) weak Fatou property if every norm-bounded monotone (sequence) net has a supremum.
In the context of program semantics, the sequential version of this property has been used before to interpret recursive programs [8, 12].
Lemma 23.
Let be a positive order-continuous function (not necessarily linear) such that . If satisfies the weak Fatou property, then admits a fixpoint.
Proof.
It can be directly shown that the limit of the -chain is a fixpoint of . Note that when is linear, the theorem is trivially true, since .
Lemma 24 ([14, Lemma 354B(d)]).
Every band in a Banach lattice is a Banach lattice.
Theorem 25.
If and are Banach lattices, then the set of order-continuous linear functions between and is a Banach lattice.
Proof.
The proof is a direct consequence of Banach lattices being Dedekind complete – e.g. Fremlin [14, Proposition 354E(e)] – and the space of order-continuous being a band in the space of regular linear functions.
2.5 Dualities
The category seems to be a good candidate in which to interpret intuitionistic linear logic. However, since the linear negation connective is usually interpreted as the linear dual in models of linear logic based on vector spaces over , would not be able to model classical linear logic, since there are examples of Banach lattices that are not isomorphic to their bidual, e.g. summable real sequences.
A recurring challenge in models of linear logic is to make an involutive linear negation – typical of finite-dimensional spaces – coexist with , which requires infinite-dimensional spaces. Since we are interested in defining a model of classical linear logic, we should only work with Riesz spaces that are isomorphic to their bidual.
Definition 26.
Let denote the space of order-continuous functionals . A Riesz space is said to be perfect if the map is an isomorphism.
We will write for when is clear from context.
Definition 27.
The category has perfect Banach lattices as objects and positive order-continuous linear functions of norm at most one as morphisms.
Although the definition of perfect spaces is simple, it is difficult to manipulate in practice. The following theorems provide some alternative characterisations, both in the normed and unnormed cases:
Theorem 28 ([21, Theorem 41.4, Volume XIII]).
Let be a separated normed Riesz space. Then is perfect and Banach iff has the weak Fatou property.
Theorem 29 ([1, Theorem 1.71]).
A Riesz space V is perfect iff
-
it is separated;
-
whenever and for all positive and directed set , there exists such that .
Corollary 30.
Bands of perfect Riesz spaces are also perfect.
Lemma 31.
Every perfect Riesz space is Dedekind complete.
Proof.
The proof follows from the second condition of Theorem 29.
Lemma 32.
Every Riesz space of the form is perfect.
Proof.
To show the first point of Theorem 29, assume that . Then there is such that . Using the fact that is an element of , we can conclude that is separated. For the second point, let us assume that and that for all , if , then . From this hypothesis, it follows that for all , if , then . This means that the function is well-defined, linear, and order-continuous. By Lemma 1.18 in Aliprantis and Burkinshaw [1], is Dedekind complete and bounds .
An interesting fact that is not obvious from the definitions is that the bidual of Riesz spaces can be seen as a sort of completion procedure. We formalize this claim using adjunctions, but first we need a lemma.
Lemma 33 ([1, Theorem 1.70]).
Let be an Archimedean Riesz space. The set is an order-dense Riesz subspace of .
Theorem 34.
The functor is left adjoint to the forgetful functor .
Proof.
We observe that if , then . In the other direction, if we have a function , we can consider its restriction . To show that these operations are inverses, we use Theorem 11 and Lemma 33, which allow us to show that if two order-continuous functions agree on , then they agree everywhere.
Note that this implies that is a reflective subcategory of , which means that it is closed under the same (co)limits that exists in , c.f. Borceux [3, Section 3.5].
2.6 Signed measures as Riesz spaces
Measures are usually defined as countably additive, nonnegative real-valued functions on a -algebra. Signed measures provide a slight generalization by dropping the requirement of nonnegativity.
Definition 35.
Let be a measurable space. A signed measure is a function such that and for disjoint sets . The infinite series on the right hand side must converge absolutely.
An important difference between ordinary measures and signed measures is that signed measures come equipped with a natural vector space structure. Indeed, it can be shown that signed measures are perfect Riesz spaces.
Lemma 36.
Let be a measurable space. The space of signed measures is a normed Riesz space.
Proof.
The vector space structure is defined pointwise with lattice structure defined by using the Hahn-Jordan decomposition and the norm is the total-variation norm.
When a measure is positive, its total variation norm is its total mass .
Theorem 37.
Let be a measurable space. The space of signed measures with the total variation norm is a perfect Banach lattice.
Proof.
The proof follows by applying Theorem 28, the lemma above and observing that since the order of measures is given pointwise, you can define their suprema pointwise as well.
3 Models of linear logic
The categorical semantics of linear logic is very well understood; see Mellies [22] for an overview. In this section, we show that is a model of classical linear logic.
3.1 Symmetric Monoidal Closed Structure
In order for to interpret the multiplicative fragment of linear logic, i.e. give semantics to a linear -calculus with tensors, it must be a symmetric monoidal closed category. Concretely, it needs a monoidal product such that for every object , the functor has a right adjoint , known as linear implication.
For models based on vector spaces, the monoidal product is typically given by the tensor product. For such models, linear implication has a natural interpretation in terms of linear functions. Furthermore, since our spaces are perfect, we have an involutive linear negation defined as the space , and, in models of classical linear logic, the equation holds. Thus the tensor product can be defined in terms of linear implication and negation ⟂ in such models.
Note that this circumvents one of the main complications with the model of Ehrhard [11], where the existence of a suitable monoidal product is established non-constructively using a categorical density argument.
3.1.1 Internal Homs
Since the category has order-continuous linear functions with norm at most as morphisms, it makes sense to define the internal hom object as the space of order-continuous linear functions between perfect Banach lattices and . This definition is justified by the following theorem.
Lemma 38 (c.f. Appendix B).
If and are perfect Riesz spaces, then the set of order continuous linear functions is a perfect Riesz space.
From Theorem 25 and the theorem above, it follows that if and are perfect Banach lattices, then so is . By using standard techniques from the literature on vector models of linear logic, we have
Theorem 39.
The operation is functorial.
3.1.2 Monoidal structure
As mentioned above, the monoidal structure on vector space models of linear logic is usually defined as a tensor product, and monoidal closure is obtained from the universal property of tensor products. The usual recipe for defining tensor products is to use a free construction modulo the tensor product equations. When working with infinite-dimensional spaces, a completion procedure may be required as well.
Indeed, this is the approach taken by Fremlin [15], in which a tensor product is defined for perfect Riesz spaces via a more traditional construction using the completion of the algebraic tensor product. It is also shown by Fremlin [15] that , meaning that their construction is isomorphic to ours.
In contrast, our construction starts with the definition , as required by the laws of linear logic. We then show that it satisfies the expected universal property of tensor products: for every biliear function , there is a unique linear function such that , where is the bilinear inclusion function.
We show this using the fact that the internal hom can be used to classify bilinear functions using , then showing that this space is isomorphic to .
Lemma 40.
.
Proof.
If and are perfect Riesz spaces, then . Then
Theorem 41.
, defined as , satisfies the universal property of tensor products.
Proof.
Observe that the set of (norm bounded) bilinear order-continuous functions is (isometrically, in the normed case) isomorphic to . We must now show . This is exactly Lemma 40.
Using the universal property of tensor products and the (easy to prove) facts that and , we can conclude:
Theorem 42.
is a symmetric monoidal closed category.
It is difficult in general to give an intuitive characterization of the elements of a tensor product. This is also the case with our construction. Nevertheless, in the context of measures, we can give some intuition for the elements of . Let and be probability distributions on measurable spaces and , respectively. The product distribution is the joint probability distribution on with marginals and obtained by sampling and independently. This is an element of , but there are also other joint distributions in that do not represent independent samples. For example, let and consider the joint distribution . Sampling this distribution returns or , each with probability , so the two components are clearly not independent.
In general, not every joint distribution is an element of the tensor product, as explained by Dahlqvist and Kozen [7]. From a programming point of view, the universal property of tensor products says that the behavior of a program taking inputs of type is fully characterized by independent distributions over and .
3.2 -autonomous categories
Classical linear logic differs from its intuitionistic variant by requiring that linear negation be involutive, that is, for every formula . Categorically, this is modeled by -autonomous categories, symmetric monoidal closed categories with a functor such that every object is naturally isomorphic to and for every three objects , , , there is a natural bijection . Equivalently, a -autonomous category is a symmetric monoidal closed category equipped with a dualizing object such that for every object , the unit is an isomorphism.
In our case, the dualizing object is , the unit is the linear function , and the isomorphism holds by assumption.
Theorem 43.
is a -autonomous category.
3.3 Cartesian and co-Cartesian structure
Cartesian and co-Cartesian structure are useful in the formation of product and sum types. In models of linear logic, these are represented by linear conjunction and disjunction , respectively. In , both operations have as their underlying set with lattice operations defined componentwise. In the normed case, we can distinguish them by choosing different norms.
Definition 44.
Let and be normed Riesz spaces. We define
-
the product , where .
-
the coproduct , where .
Since convergence for both is defined componentwise, by using Theorem 28 we can show that if and are perfect and Banach, then and are as well. The unit for the product and for the coproduct are both the trivial Riesz space .
Theorem 45.
is (co-)Cartesian.
4 Probabilistic coherence spaces and Banach lattices
Probabilistic coherence spaces (PCS) [8] are a model of linear logic with a vector space flavor. It has been shown by Ehrhard [11] that its intuitionistic fragment can be fully and faithfully embedded in a category of positive cones. In this section, we show that Banach lattices, contrary to previous work [11], extends the -autonomous structure of the category of probabilistic coherence spaces as well as its symmetric monoidal closed structure. We make use of the vector space construction presented in the original paper [8].
Definition 46.
A Probabilistic Coherence Space (PCS) is a pair , where is a countable set and called the web such that:
-
, where iff and otherwise;
-
;
-
, where .
Definition 47.
Let be a PCS. Its linear negation is the PCS .
Definition 48.
Let and be PCSs. The PCS is the pair , where , where .
The intuition behind Definition 46 is that the web of every PCS corresponds to the positive unit ball of a partially-ordered vector space. This idea is used by Ehrhard and Danos [8] to define a functor that maps every PCS to a Banach space. It is possible to show that this vector space can be equipped with a Riesz space structure, where the order is defined pointwise.
Definition 49.
Given a PCS , we define and . The pair is the normed Riesz space associated with the PCS .
It is shown by Ehrhard and Danos [8] that is a Banach space. Furthermore, the lattice structure can be defined pointwise, making a Banach lattice. Later in this section we will show that can be made into a functor.
and duality
In this section we show that the functor preserves the -autonomous structure of .
Theorem 50 (c.f. Appendix C).
For every probabilistic coherence space , there is a natural isomorphism .
Corollary 51.
For every PCS the vector space is a perfect Banach lattice.
Since convergence for PCS is defined componentwise, it is possible to use a similar proof technique to show
Theorem 52.
The operation is monoidal closed and functorial.
Proof.
The functoriality of has been proven in Section 5.1 of Ehrhard and Danos [8]. The proof of preservation of monoidal closure is similar to the proof of Theorem 50. Another important theorem which is direct to show is.
Theorem 53.
The functor is full and faithful.
5 Categories of Cones and
Even though is a mathematically natural model of linear logic, it relies on tools from functional analysis not usually familiar to computer scientists. On the other hand, in recent years, cones have found numerous applications in semantics of programming languages and logics [12, 6, 23, 18]. In this section we show that is isomorphic to a category cones, meaning that computer scientists can translate their intuitions about cones to this novel setting without having to learn functional analysis.
As it was frequently mentioned throughout this paper, every Banach lattice gives rise to a positive cone. Furthermore, since every morphism is positive and has norm at most , it restricts to a linear function . With this observations we state a few definitions from previous work [6, 11], which assume that the cones are separated.
Definition 54 (cf. [12, Definition 4.1]).
A cone is a -semimodule with a norm such that it satisfies the cancellation property implies , for every points , and .
Every cone can be equipped with the partial order if and only if there is a such that , meaning that it is possible to define a partial subtraction operation whenever , calling the element such that .
A function between cones is linear if it commutes with addition and scalar multiplication, it is monotonic if it preserves the order relation, and it is Scott-continuous if for every directed set with supremum , . As is the case with partially-ordered vector spaces, there are different classes of cones where the order and the norm have particular properties:
Definition 55.
A cone is said to be:
-
Sequentially complete if every norm-bounded sequence has a least upper bound.
-
Directed complete if every norm-bounded directed set has a least upper bound.
-
A lattice cone if the poset structure is a lattice.
Using this notation, it seems appropriate to imagine that there should be a functor , where is the category of directed complete cone lattices. It is unclear, however, if there is a mapping on morphisms. Luckily, the lemma below guarantees that the mapping is well-defined. Its proof follows from the weak Fatou property.
Lemma 56.
Let and be two perfect Banach lattices and a linear, positive function of norm at most . The function is order-continuous if and only if whenever is a non-empty upwards-directed set with supremum .
Since the mapping on morphisms is basically the identity, the functorial laws hold, which allows us to conclude that there is a functor .
Next, we would like to map every positive cone to a vector space. Let be a positive cone and define , where is the binary relation iff . Intuitively, corresponds to the vector space of formal differences of elements in . The equivalence relation is used to capture the fact that, for instance, and should represent the same real number, since .
Theorem 57 (c.f. Appendix D).
Let be a directed complete cone lattice. Then is a perfect Banach lattice.
By linearity, Scott-continuous functions with norm at most extend to order-continuous functions with norm at most and we can prove that there is a functor . With this functor and the positive cone restriction functor defined, it is a direct calculation to show:
Theorem 58.
The categories and are isomorphic.
6 A Probabilistic Calculus
Though it is theoretically interesting understanding how relates to existing models of linear logic, we are also interested in using it as a semantic basis for a language with probabilistic primitives. Being symmetric monoidal closed, it can give semantics to the linear -calculus. This, however, is insufficient from a programming point of view. The linearity restrictions are severely limiting in terms of which programs one can define in this language. A frequently used solution to this lack of expressivity is to use the exponential modality, where the coKleisli category is Cartesian closed, meaning that it can interpret the -calculus.
However, even though we have not defined a linear logic exponential in , we can still get non-linear programming by using recent work [2] that proposes a new syntax for programming with linear operators and Markov kernels. The proposed two-level calculus allows for non-linear programs to be defined by using a lax-monoidal modality.
The metalanguage
The semantic structure used to interpret the calculus of Azevedo de Amorim [2] is given by a triple , where is roughly a category of Markov kernels111a CD category, to be more precise, is a symmetric monoidal closed category and is a lax monoidal functor.
This two-level structure manisfests itself at the syntactic level by having a two-level syntax: the first level is used to program kernels while the second one serves as a kind of metalanguage that has access to higher-order functions, both of which are depicted in Figure 1, The linear language has linear function types, which allows for higher-order programming and, unlike most languages based on linear logic, it has a modality , which corresponds to the types that may be sampled from. The variables bound by the linear context are, roughly speaking, computations. In the language for kernels there are no linearity restrictions and, therefore, variables, i.e. samples from distributions, can be freely duplicated and discarded. Under this perspective, the variables in MK programs should be thought of as values. The intuition behind this language is that linearity forbids distributions to be sampled more than once, but once you have the sample in hands, it can be used as many times as you want.
Each layer has its own typing judgement relations and , which we go over in more detail in Appendix A. We highlight one of the most interesting rules; it is the rule that allows programs to be transported between layers:
Operationally, it samples from LL programs , each sample is bound to the corresponding variable in and finally the continuation is executed.
We want to model with . For that we still need a CD category and a lax monoidal functor. For the CD category we will use the category of measurable spaces and sub-Markov kernels.
Definition 59.
The category has measurable spaces as objects and sub-Markov kernels as morphisms, i.e. measurable functions between a measurable space and the space of subprobability distributions over a measurable space.
is a CD category, which means that it is symmetric monoidal, with the monoidal product being the product measurable space.
Theorem 60 (c.f. Appendix E).
There is a lax monoidal functor .
This means that the triple is a model.
7 Related work
There have been a number of semantics of linear logic based on vector space-like objects. Two important families of such semantics are the ones based on probabilistic coherence spaces and the ones based on Banach spaces. As we will explain below, we see our model as a nice synthesis of these two approaches.
Positive Cone Semantics of Linear Logic
To overcome the limitation that cannot represent continuous distributions, Ehrhard et al. define a cartesian closed category [12], which uses normed -semimodule – which are in correspondence with positive cones of partially ordered vector spaces – to interpret a probabilistic variant of PCF with continuous distributions. In a follow-up paper, Ehrhard [11] has defined a category of sequentially complete positive cones with measurability paths and linear Scott continuous maps in which embeds fully and faithfully.
A similar approach was taken by Slavnov [24], who defined a category of so-called coherent cones and linear contractive functions and showed that it is a model of classical linear logic. These cones come equipped with a different notion of completeness that is stronger than sequential completeness but weaker than ours.
From a mathematical point of view, the objects of both and are not as well understood as Banach lattices, making them not ideal semantic frameworks to reason about probabilistic programs, since many useful lemmas for reasoning about programs would have to be reproved. Besides, our model provides a clear mathematical justification for having Fatou-like properties in the semantics: it is forced upon it by Theorem 28 instead of being there for denotational reasons, as is the case of , or in enabling the exponential construction, as is the case of , showing a kind of canonicity of our model.
Vector Space Semantics of Linear Logic
Dahlqvist and Kozen [7] have defined a category of partially ordered Banach spaces , shown that it is a model of intuitionistic linear logic, and used it to interpret a higher-order imperative probabilistic language with while loops and soft-conditioning.
Their model also uses a mathematically well-understood class of vector spaces. That being said, by using a more general class of vector spaces than we do, their model has less structure than ours. A practical consequence of this lack of structure is that in order to guarantee the soundness of their semantics, they define type grammars that are used for different program constructs. As an example, in order to interpret conditionals and while loops the context may only have Dedekind complete types.
Another relevant vector space model is the one based on complex coherent Banach spaces [17]. However, since they are complex vector spaces, it is unclear if it would be possible to embed into them.
Neither nor are models of classical linear logic.
8 Conclusion
In this paper we have shown that is a model of classical linear logic that conservatively extends and can be used to give semantics to a recursive probabilistic calculus. Our model differs from existing extensions of that only extends ’s intuitionistic fragment, meaning that they do not have an involutive negation. We believe that our model is a good fit for formal verification purposes because Riesz spaces have decades of research and have been extensively used in the formalization of stochastic processes.
For future work, we are interested in showing that can accommodate exponentials and use this category for reasoning about correctness properties of probabilistic programs such as inference algorithms.
References
- [1] Charalambos D Aliprantis and Owen Burkinshaw. Positive operators. Springer, 2006. doi:10.1007/978-1-4020-5008-4.
- [2] Pedro H. Azevedo de Amorim. A higher-order language for markov kernels and linear operators. In Foundations of Software Science and Computation Structures (FoSSaCS), 2023. doi:10.1007/978-3-031-30829-1_5.
- [3] Francis Borceux. Handbook of categorical algebra: volume 1, Basic category theory, volume 1. Cambridge University Press, 1994.
- [4] Francis Borceux. Handbook of categorical algebra: volume 2, Categories and Structures, volume 2. Cambridge University Press, 1994.
- [5] Kenta Cho and Bart Jacobs. Disintegration and bayesian inversion via string diagrams. Mathematical Structures in Computer Science, 2019.
- [6] Raphaëlle Crubillé. Probabilistic stable functions on discrete cones are power series. In Logic in Computer Science (LICS), 2018.
- [7] Fredrik Dahlqvist and Dexter Kozen. Semantics of higher-order probabilistic programs with conditioning. In Principles of Programming Languages (POPL), 2019.
- [8] Vincent Danos and Thomas Ehrhard. Probabilistic coherence spaces as a model of higher-order probabilistic computation. Information and Computation, 209(6):966–991, 2011. doi:10.1016/J.IC.2011.02.001.
- [9] Thomas Ehrhard. On Köthe sequence spaces and linear logic. Mathematical Structures in Computer Science, 12(5):579–623, 2002. doi:10.1017/S0960129502003729.
- [10] Thomas Ehrhard. Differentials and distances in probabilistic coherence spaces. arXiv preprint, 2019. arXiv:1902.04836.
- [11] Thomas Ehrhard. On the linear structure of cones. In Logic in Computer Science (LICS), 2020.
- [12] Thomas Ehrhard, Michele Pagani, and Christine Tasson. Measurable cones and stable, measurable functions: a model for probabilistic higher-order programming. In Principles of Programming Languages (POPL), 2017.
- [13] Thomas Ehrhard, Christine Tasson, and Michele Pagani. Probabilistic coherence spaces are fully abstract for probabilistic PCF. In Principles of Programming Languages (POPL), 2014.
- [14] David H Fremlin. Measure theory. Torres Fremlin, 2000.
- [15] DH Fremlin. Abstract Köthe spaces IV. In Mathematical Proceedings of the Cambridge Philosophical Society, pages 45–52. Cambridge University Press, 1968.
- [16] Tobias Fritz. A synthetic approach to markov kernels, conditional independence and theorems on sufficient statistics. Advances in Mathematics, 370:107239, 2020.
- [17] Jean-Yves Girard. Coherent banach spaces: a continuous denotational semantics. Theoretical Computer Science, 227(1-2):275–297, 1999. doi:10.1016/S0304-3975(99)00056-0.
- [18] Klaus Keimel and Gordon D Plotkin. Mixed powerdomains for probability and nondeterminism. Logical Methods in Computer Science, 2017.
- [19] Marie Kerjean and Christine Tasson. Mackey-complete spaces and power series–a topological model of differential linear logic. Mathematical Structures in Computer Science, 28(4):472–507, 2018. doi:10.1017/S0960129516000281.
- [20] Dexter Kozen. Semantics of probabilistic programs. In Symposium on Foundations of Computer Science (SFCS), 1979.
- [21] WAJ Luxemberg and AC Zaanen. Notes on Banach function spaces VI-XIII. Proceedings of the Koninklijke Nederlandse Akademie van Wetenschappen, Series A, 66:251–263, 1963.
- [22] Paul-André Mellies. Categorical semantics of linear logic. Panoramas et syntheses, 27:15–215, 2009.
- [23] Peter Selinger. Towards a semantics for higher-order quantum computation. In Quantum Programming Languages (QPL), 2004.
- [24] Sergey Slavnov. Linear logic in normed cones: probabilistic coherence spaces and beyond. Mathematical Structures in Computer Science, 31(5):495–534, 2021. doi:10.1017/S0960129521000177.
- [25] Christine Tasson and Thomas Ehrhard. Probabilistic call by push value. Logical Methods in Computer Science, 15, 2019. doi:10.23638/LMCS-15(1:3)2019.
- [26] Adriaan C Zaanen. Introduction to operator theory in Riesz spaces. Springer, 2012.
Appendix A A Metalanguage for Linear Operators and Markov Kernels
In this section we further explain the two-level language and its semantics. The language MK corresponds to an effectful language with probabilistic primitives and where free variables are assumed to be values, as opposed to computations. For instance, the program is interpreted as a deterministic program. This language is interpreted in a CD category, which can be seen as an abstraction for programming with commutative effects [16].
Definition 61 ([5, Definition 2.2]).
CD categories are symmetric monoidal categories such that every object has a commutative comonoid structure and satisfying certain structural properties.
In the context of probabilistic programming, there are many CD categories to choose from. In particular, for any subprobability monad, its Kleisli category is a CD category. This is the case for the category, since it can be characterized as the category of measurable sets and measurable functions , where is the subprobability monad over .
The language LL is basically a linear -calculus. By itself, linearity limits the expressivity of the language quite a bit. In the original paper, the author argues that for probabilistic programming, the linear usage of variables is, semantically, too restrictive, since many linear probabilistic calculi, in the algebraic sense, may use variables more than once [2]. This observation led to the introduction of the modality in the LL language which allows MK programs to be called from an LL program. Semantically, this is interpreted as a lax monoidal functor.
Definition 62 ([4, Definition 6.4.1]).
Let and be monoidal categories. A (lax) monoidal functor is a functor equipped with a natural transformation and a morphism making certain coherence diagrams commute.
From a programming point of view, types should be thought of as types that can be sampled from. Supposing that the language has a primitive for the uniform distribution over the unit interval the Sample construct can be used to write the program
The program above samples from a uniform distribution and adds the result to itself. This program illustrates why this syntax increases the expressivity of the linear -calculus. By allowing the continuation to be an MK program, variables may be freely reused or discarded without worrying about syntactic restriction imposed by linearity.
However, once inside the MK language, there is no way of going back to the higher-order language, meaning that the program is not well-typed. This is mitigated by lax monoidality, which makes it possible to simultaneously sample from distributions: .
Definition 63.
A model of is a triple , where , a symmetric monoidal closed category and is a lax monoidal functor.
The typing rules are depicted in Figure 2. They are basically the amalgamation of the rules for programming with CD categories, i.e. a first-order expression language with pairs, with symmetric monoidal closed categories, i.e. the linear -calculus with tensor types. The main novelty is the introduction of the lax monoidal modality and its accompanying typing rule Sample which connects the MK and LL languages.
Much like the typing rules, the categorical semantics of is the combination of the categorical semantics of the internal languages of CD categories and the linear -calculus with the exception of the Sample rule that makes use of the functor . The full semantics is depicted in Appendix A.
Appendix B Proof of Lemma 38
By Theorem 14, is a Riesz space. Applying Theorem 29, we can also show that it is perfect. To show separability, let be distinct functions. Then there is a point such that . Since is perfect, it is separated, therefore there exists such that . Then the order-continuous function separates the points and , therefore is separated.
Now let be an increasing net such that for all positive . We can define an such that pointwise. Let and let be a positive functional. Consider the functional . By hypothesis, , and since is perfect and is a positive net in , there exists such that . This defines on elements of , and for arbitrary we take . Then .
Appendix C Proof of Theorem 50
If , consider the element . It is possible to show that the function is positive and Scott-continuous, therefore order-continuous for every . Using this result, it is not hard to show that .
Conversely, consider an element . Without loss of generality, we can assume that is positive. We want to associate to an element in . As is shown by Ehrhard and Danos [8], we can alternatively characterize the space as
Consider the function . Let us show that . To do this, we show that for every , is uniformly bounded. Let be the ascending net if and 0 otherwise. By expanding the definition, we get the equality
We get the last equality from being a positive function. Since every has finite support, the expression above is well defined.
Since is order-continuous and monotone and is an increasing net, we can conclude that , therefore for every , and . If is not positive, we decompose it as the difference of two positive maps and define .
A direct calculation shows that this is indeed an isomorphism.
Appendix D Proof of Theorem 57
Let be a directed complete lattice cone. In order to define functions over it we use the universal property of quotients: it suffices to define it over every pair while guaranteeing that the function acts the same over every equivalence class.
For instance, the vector space structure can be simply defined componentwise. Let then we define
The lattice operations require a bit more ingenuity, and we first observe the equation which holds in every Riesz space, reducing the lowest upper bound operation to addition and the positive part. By doing some algebraic manipulations we get that if then we define . The lattice equations such as commutativity and idempotency follow by unfolding the definitions and from being a lattice.
Before defining a norm over we first need the following lemma
Lemma 64.
.
Proof.
The mapping is the injection through the equivalence class function and the mapping in the other direction can be constructed by observing that whenever it can be shown that and, therefore, and this decomposition is unique, since implies, by definition of that . The second isomorphism is trivial.
Given a norm over it is possible to extend it to a norm over . This follows from the property of normed Riesz spaces, where which forces us to define . Note that since is a positive element of , by the lemma above it can be mapped back to an element of which, in turn, has a norm.
Therefore, we have shown that is a normed Riesz space. Since has the directed completeness property it follows that has the weak Fatou property and, therefore, it is Banach and perfect.
Appendix E Proof of Theorem 60
There is a standard functor that maps measurable sets to the vector space of signed measures and sub-Markov kernels to the linear function . The proof of linearity is standard, but order-continuity requires a few words. Let be a descending arrow, which, as goes to zero, so does , making order-continuous. The functorial laws also follows from standard proofs from the literature.
To show that is lax monoidal, we need to define a natural transformation which is easily defined by the universal property of the tensor product and a morphism which maps a real number to the measure , where is the only member of the singleton set . Showing that the necessary diagrams commute follows from the universal property of the tensor product.