Correspondences Between Codensity and Coupling-Based Liftings, a Practical Approach
Abstract
The Kantorovich distance is a widely used metric between probability distributions. The Kantorovich-Rubinstein duality states that it can be defined in two equivalent ways: as a supremum, based on non-expansive functions into , and as an infimum, based on probabilistic couplings.
Orthogonally, there are categorical generalisations of both presentations proposed in the literature, in the form of codensity liftings and what we refer to as coupling-based liftings. Both lift endofunctors on the category Set of sets and functions to that of pseudometric spaces, and both are parameterised by modalities from coalgebraic modal logic.
A generalisation of the Kantorovich-Rubinstein duality has been more nebulous – it is known not to work in some cases. In this paper we propose a compositional approach for obtaining such generalised dualities for a class of functors, which is closed under coproducts and products. Our approach is based on an explicit construction of modalities and also applies to and extends known cases such as that of the powerset functor.
Keywords and phrases:
Kantorovich distance, behavioural metrics, Kantorovich-Rubinstein duality, functor liftingsCopyright and License:
![[Uncaptioned image]](x1.png)
2012 ACM Subject Classification:
Theory of computation Categorical semanticsAcknowledgements:
The authors would like to thank Pedro Nora for suggestions and discussions.Funding:
This work was supported by the LABEX MILYON (ANR-10-LABX-0070) of Université de Lyon, within the program “Investissements d’Avenir” (ANR-11-IDEX- 0007) operated by the French National Research Agency (ANR), and supported by the NWO grant OCENW.M20.053.Editors:
Jörg Endrullis and Sylvain SchmitzSeries and Publisher:

1 Introduction
The Kantorovich (or Wasserstein, or Monge-Kantorovich) distance [17] is a standard and widely used metric between probability distributions, studied amongst others in transportation theory [27]. In concurrency theory, the Kantorovich distance forms the basis of so-called behavioural metrics, which are quantitative generalisations of bisimilarity. They allow a more fine-grained and robust comparison of system behaviours than classical Boolean-valued behavioural equivalences [8, 9, 26].
In its discrete version the Kantorovich distance takes as argument a (pseudo-)metric on a set , and lifts it to a (pseudo-)metric on the set of (finitely supported) distributions . The celebrated Kantorovich-Rubinstein duality [18] states that this distance can be computed in two ways, yielding the same result: as an infimum indexed by probabilistic couplings, and as a supremum indexed by non-expansive functions into the interval with the Euclidean distance. This fundamental result is useful for analysis and computation of these distances (e.g., [1, 7, 15, 25, 27]). A detailed proof in a broader context than just finitely supported distributions can be found in [27].
Orthogonally to this duality, in the last years there have been several proposals to generalise the Kantorovich distance from distributions to general endofunctors on the category Set of sets and functions. The problem then becomes to lift such functors to the category of (pseudo-)metric spaces. This is particularly useful in the context of a coalgebraic presentation of systems, where the type of the system at hand is parametric in the given Set endofunctor. In particular, this allows a uniform presentation of various types of probabilistic systems, but also, for instance, metrics on deterministic automata [6].
There are categorical generalisations of both presentations of the Kantorovich distance: the coupling-based approach and the one based on non-expansive maps [2, 5, 6, 11]. The latter has recently been established as an instance of the so-called codensity liftings111Kantorovich metric is used interchangeably in the literature to refer to both presentations. We therefore avoid this terminology by consistently referring to the two presentations as coupling-based and codensity liftings respectively. [24]. Both approaches are parametric in (sets of) modalities or evaluation maps, that allow a degree of freedom in the choice of liftings.
We aim to relate the two approaches, by studying generalisations of the Kantorovich-Rubinstein duality to a wide class of functors beyond . This problem was first proposed and studied in [2], where it is shown to hold in some concrete cases but also to fail in other basic instances, even for very elementary functors such as the diagonal functor mapping a set to . In the latter article the authors restrict the study to liftings parametric in exactly one modality they call an evaluation map, which is assumed to be the same for both codensity and coupling-based liftings. We depart from this by allowing modalities to differ on both sides. This approach can already be found in [10]. There, it is shown that every coupling-based lifting can be presented as a codensity lifting; but the proof is non-constructive and yields a large collection of modalities.
In the current paper, we approach the problem of generalised Kantorovich-Rubinstein dualities from a concrete perspective, with an emphasis on compositionality aspects. Given a modality as parameter for a coupling-based lifting, we aim to explicitly translate it to modalities for a codensity lifting, in such a way that the two correspond. More explicitly, we show that the class of such correspondences between coupling-based and codensity liftings is closed under coproducts and products (and conversely, that every correspondence for a coproduct of functors can be recovered from correspondences on its constituents). We also investigate correspondences for the identity functor, where there is flexibility in the choice of modalities; and for the powerset functor, extending earlier correspondence results [2, 12].
These correspondence results then allow us to define a concrete grammar of functors for which we obtain a correspondence between coupling-based and codensity liftings. In fact, we obtain several grammars based on different assumptions on the underlying poset of truth values (assumed to be a quantale). Base cases include the constant functors, distribution functor, powerset functor and the identity functor; recursive constructions the product and coproduct. These results allow us to obtain or recover induced codensity and coupling-based presentations for a range of examples of behavioural metrics, including metrics on streams, labelled Markov chains, deterministic automata, and non-deterministic automata.
In the last part of the paper, we investigate the limitations of our approach through the concrete example of conditional transition systems [4, 3]. In contrast to the earlier examples, here, our grammar does give us a metric (and a correspondence result), but it is not the one considered earlier in the literature. We prove that, in fact, the metric from the literature can be expressed with a codensity lifting but not with a coupling-based lifting.
2 Codensity and coupling-based liftings: correspondences by example
In this section we motivate and describe the problem of correspondences between codensity and coupling-based liftings at the general level of functors, and our approach in this paper, by means of two examples: the Kantorovich-Rubinstein duality for distributions, and a similar correspondence for the shortest-distinguishing-word-distance on deterministic automata [6].
Distributions.
We start by recalling the classical Kantorovich distance, in the discrete case. In this paper we focus on pseudometrics (defined like metrics except that different elements can have distance ) as is common in the use of these types of distances in concurrency theory. For a pseudometric , the Kantorovich distance is a pseudometric on the set of distributions on , defined, for by:
(1) |
where is the set of couplings between and , i.e., probability distributions on whose marginals are and respectively. It can equivalently be computed as:
(2) |
where the supremum ranges over non-expansive functions into equipped with the Euclidean distance, i.e., such that for all . The equality is an instance (see [27, Particular case 5.16]) of a general result known as the Kantorovich-Rubinstein duality (see [27, Theorem 5.10]).
A different example.
The Kantorovich distance can be seen as a lifting of the distribution functor on the category Set of sets and functions to the category PMet of pseudometric spaces and non-expansive functions between them. We proceed with a quite different example of a similar phenomenon: a lifting of a functor from Set to the category of pseudometric spaces bounded by presented in two ways, as an infimum over a variant of couplings and a supremum over non-expansive functions. This example describes a distance between deterministic finite automata (DFA). Empty infima and suprema are defined w.r.t. the interval where the pseudometrics take their values: and .222The knowledge package is used throughout the paper. Most of the introduced vocabulary and notations are clickable and the associated links brings the reader to their definitions.
We view DFA over an alphabet as coalgebras for the functor , where . Coalgebras for this functor are of the form , where is the set of states, the output function describes which states are accepting (), and is the transition function. As usual, a word is accepted in a state when, after reading starting on we end up with an accepting state.
Given , the shortest-distinguishing-word-distance between states is if they recognise the same language and for a shortest word that belongs exactly to one of the two languages recognised by and . As shown in [6], this distance can be computed recursively as a fixpoint of the map on pseudometrics given by
The shortest-distinguishing-word-distance can be obtained via a lifting of the Set functor , mapping a pseudometric space to a pseudometric space , that we will recall below. The operator above factors through the pseudometric . Explicitly, it decomposes as .
In fact, just as in the Kantorovich-Rubinstein duality, the lifting can be obtained in two different ways. Given a pseudometric and , it arises as a coupling-based lifting by:
(3) |
Here elements of are viewed as a variant of couplings.
Secondly we obtain as a so-called codensity lifting by:
(4) |
where, as above, the supremum again ranges over non-expansive functions . Just as for the Kantorovich distance, we again obtain an equality of functors on PMet: .
Modalities as parameters.
The abstract coupling-based and codensity liftings take as input a single modality (coupling-based), or a set of modalities (codensity), known from the semantics of coalgebraic modal logic. For the Kantorovich lifting, this modality is the expected value function , which appears implicitly in both presentations.
In the case of deterministic automata, while a single modality suffices for the coupling-based lifting, for the codensity lifting we actually use a set of modalities (one for each letter, plus a modality for acceptance of states). This observation is important for the investigation in this paper. Instead of aiming for a one-to-one matching of modalities, which we refer to as a duality, we allow a coupling-based lifting specified by a single modality to be matched by a codensity lifting specified by a set of modalities; we refer to this as a correspondence. This allows us to cover examples such as DFA and way more, and circumvent the problem already observed in [2]: even for the product functor with the modality there is no duality. However, there is a correspondence, that is, multiple modalities are needed for the codensity lifting to match the coupling-based one.
The idea of allowing multiple modalities for codensity liftings is not new and can be found already at the origins of codensity liftings [19, 24, 21]. Here we show how it can be used to generalise Kantorovich-Rubinstein dualities in a very concrete manner; the aim is to define classes of functors and modalities for which we can explicitly describe correspondences between associated coupling-based and codensity liftings.
Outline.
We work at the general level of pseudometrics valued in a quantale; we recall the definitions in Section 3. We then recall the abstract notions of coupling-based and codensity liftings of functors along modalities, and formulate the problem of correspondences (Section 4). In Section 5 we prove our main results on correspondences: we show that the class of functors for which we have correspondences is closed under products and coproducts, and includes constant and identity functors, yielding a family of correspondences for simple polynomial functors including DFA. In Section 6 we revisit the duality results for the finite powerset and finite probability distribution functors. As a consequence we are able to study in Section 7 a class of functors for which we have correspondences, generated by a grammar. The case of conditional transition systems, for which we prove that there are no correspondences possible, is treated in Section 8.
3 Preliminaries: quantales and pseudometrics
We use quantales to model a general notion of truth object, including both Booleans and real number intervals. In this section we recall the necessary preliminaries on quantales, and the associated general notion of pseudometrics valued in a quantale; instances include the standard notion of pseudometrics on real numbers as well as equivalence relations.
Definition 1.
A quantale is a complete lattice with an associative “and” operation which is distributive over arbitrary joins. We only consider quantales that are commutative, i.e., the operation is commutative, unital, meaning admits a unit element, and affine, which means that the top element is the unit of : for all .
Given a quantale , there is an operation that is characterised by . It is simply defined by .
Example 2.
-
Any complete Boolean algebra is a quantale with ; in particular, the usual Boolean algebra with . In this case, iff .
-
Any interval with , given with reversed order and the truncated sum is a quantale. Here the top element is given by , and the bottom element by . For this quantale, we have . We write for the case that , i.e., the non-negative real numbers extended with a top element.
We use quantales as an abstract notion of truth object; accordingly, we define a -predicate on a set to be a map . Of particular interest are -pseudometrics. These are predicates on that are reflexive, symmetric and transitive in a suitable sense that can be expressed at the general level of quantales.
Definition 3.
A -pseudometric on a set is a map which is:
-
reflexive: for all ,
-
symmetric: for all ,
-
transitive: for all .
Example 4.
-
-pseudometrics are equivalence relations.
-
-pseudometrics are the “usual” pseudometrics, that is, maps such that , and for all . To see why we obtain the triangle inequality from transitivity, recall that the order on the quantale is reversed w.r.t. the usual order on real numbers, and that .
The order on a quantale is extended pointwise to functions:
Given two -pseudometrics and on sets and respectively, a map is a (-pseudometric) morphism from to if . We write for the category whose objects are -pseudometrics and arrows morphisms between them.
Remark 5.
Because of the reversal of the order on , morphisms of -pseudometrics are non-expansive maps. To avoid confusion with the quantale definition, we refrain from using the word non-expansive altogether, and replace it by (-pseudometric) morphism instead.
The following canonical -pseudometric is essential for the notion of codensity lifting.
Definition 6.
The Euclidean pseudometric is defined as follows:
Example 7.
-
For the quantale , the Euclidean pseudometric sends equal elements to and different ones to .
-
For the quantale , the Euclidean pseudometric instantiates to the usual Euclidean distance, i.e., .
4 Liftings, dualities, and correspondences
In this section we recall the definitions of coupling-based and codensity liftings from the literature (Section 4.2) and define the problem of their correspondence. This is followed by a few technical tools that we use in the proofs of correspondence (Section 4.3). We start with the notion of (well-behaved) modality (Section 4.1), used in these liftings.
4.1 Well-behaved modalities
Given a Set endofunctor , a modality for is a function . Modalities are standard in the semantics of coalgebraic modal logic [23]. Note that here we assume to be a quantale, to have a suitable notion of pseudometrics.
In order for coupling-based liftings to be well-defined some particular conditions on the functor and the associated modalities are needed. The underlying functor is assumed to preserve weak pullbacks. In this context, we say is well-behaved [2] when:
-
it is monotone, meaning that for all -predicates we have ,
-
for all -predicates and , ,
-
with the inclusion map, .
Example 8.
-
On the identity functor, with the quantale , a modality is just a map . It is well-behaved if and only if it is monotone, subadditive (i.e., ), and satisfies .
-
For the finite powerset functor mapping a set to the set of its finite subsets , with the same quantale , the maximum function is well-behaved.
-
For the finite distribution functor mapping a set to the set of its finitely supported probability distributions , with the quantale , the map giving the expected value of a probability distribution is well-behaved.
In the rest of this paper we consider constant, identity, finite powerset, finite probability distribution functors, and combine them using products and coproducts. All these functors preserve weak pullbacks (see [14, Propositions 4.2.6 and 4.2.10] for example), ensuring we can consider well-behaved modalities for them.
Well-behaved modalities can be constructed from existing ones. The case of composition is a generalisation to quantales of a particular case of [2, Theorem 7.2].
Proposition 9.
Given three arbitrary well-behaved modalities and , the following modalities are again well-behaved: , and .
4.2 Liftings and correspondences
Given a functor , a lifting of a D-functor from D to C is a functor such that . Here we only consider the case when and , with the forgetful functor sending a -pseudometric of type to its underlying set and acting as the identity on arrows. We define coupling-based liftings, codensity liftings, and the associated notion of correspondence that we study here.
Given , a coupling of and is an element such that . The set of couplings of and is denoted by . In particular, if is the distribution functor on Set, these are precisely probabilistic couplings: joint distributions on whose marginals coincide with given distributions . The following lifting arises from [11]. See also [6]. It is not referred to in the literature as “coupling-based”; we use this terminology to distinguish it from the codensity lifting.
Definition 10.
Let be a functor which preserves weak pullbacks, and let be a well-behaved modality for . The coupling-based lifting of to is given by, with and :
Example 11.
In Section 2, we studied a coupling-based lifting for DFA, which yields the shortest-distinguishing-word-distance. To see this as an instance of Definition 10, the quantale is as introduced in Section 3, the functor is the one mapping a set to . The well-behaved modality takes as argument an element and returns for some . The resulting lifting is precisely the one given in Equation (3).
The codensity lifting is defined in a very general setting for monads in [19]. Here, we use an instance, which appears in [24, 21] and, for a single modality, in [2].
Definition 12.
Let , and let be a family of modalities for . The codensity lifting of along to is defined by, with and :
Note that the maps in the definition of the codensity lifting are -pseudometric morphisms, so that, for instance, in , they correspond to non-expansive maps (cf. Remark 5).
Example 13.
Note that the coupling-based liftings are only allowed to have one modality, whereas the codensity ones may have multiple modalities. Informally, one of the reasons coupling-based liftings do not require multiple modalities can be seen by looking again at the functor for DFA. Recall that it maps a set to for and an alphabet. Considering couplings forces comparisons using to be done separately on each letter. Codensity liftings instead use one modality per letter to ensure a similar condition. On a higher level of abstraction, the multiple modalities of codensity liftings relate to the expressivity of some modal logics (see, e.g., [20]). On the other hand, the unique modality for coupling-based liftings has often been called an evaluation function (see [2]). Having only one way of evaluating something seems natural in a given evaluation context.
In the rest of this paper we study possible equalities between the coupling-based and codensity liftings. In general, we allow a well-behaved modality for the coupling-based liftings to be matched by a set of (different) modalities for the codensity lifting. In case the modalities are the same, we call this Kantorovich-Rubinstein duality.
Definition 14.
Let be a weak-pullback preserving functor, a well-behaved modality, and a set of modalities for . A correspondence is a triple of the form such that the associated coupling-based and codensity liftings coincide, as in:
If then we refer to this as Kantorovich-Rubinstein duality, or simply duality.
Two correspondences and for the same functor are called equivalent when they yield the same liftings:
This is denoted by .
When the associated liftings are not equal but one inequality holds nonetheless such as
we write .
4.3 Kantorovich-Rubinstein dualities and tools to get them
The focus of this paper is on general correspondences between coupling-based and codensity liftings, but in some cases there is the stronger property of Kantorovich-Rubinstein duality, meaning correspondences like . In the remainder of this section we consider a few technical definitions and results that are useful in obtaining such duality results.
First, coupling-based liftings are always smaller than codensity liftings. This is a known result; it is a direct consequence of codensity liftings being initial in a well-chosen category as shown in [10]. It can also be found in [2, Theorem 5.27] in the particular case of the quantale as presented in Section 3.
Proposition 15.
Given a Set endofunctor and an associated well-behaved modality, we have .
Hence to get a Kantorovich-Rubinstein duality, we only need the other inequality. Two tools are introduced for that: optimal couplings to know the value of coupling-based liftings and optimal functions to know that of codensity liftings.
Given a functor , an associated modality , a -pseudometric , and , an optimal coupling is a coupling of and such that
When for all , , and either an optimal coupling exists or no couplings of and exist we say that has all optimal couplings. Optimal couplings are well-known in the context of transport theory [27] and in existing proofs of duality for the finite powerset functor [12, 2]. We note that, whenever all elements in a class of functors have all optimal couplings, then functors in the closure of by coproducts and products do too.
An optimal function for a functor , an associated modality , a -pseudometric , and is a morphism in such that:
In the context of the general continuous Kantorovich-Rubinstein duality from optimal transport theory such optimal functions do exist (see [27, proof of Theorem 5.10]) but are not explicitly defined. As we will see they exist for all the functors we consider.
The following lemma is useful to design optimal functions. It is well-known in the context of quantale-enriched categories. Instead of defining some pseudometric morphism on as a whole, it can be defined on only, first as some morphism and then extended using the lemma. This is useful when only parts of are of interest, say some subset of it for the powerset functor, or the support of some probability distribution for the distribution functor. The extension of to from to is done by giving the greatest values to on while ensuring it is a -pseudometric morphism.
Lemma 16.
Let be a -pseudometric, and . For all -pseudometric morphisms there exists s.t. and is the least such morphism.
5 Correspondences through coproducts and products
In this section we obtain new correspondences between coupling-based and codensity liftings, for polynomial functors. More specifically, given a set of functors and associated correspondences , these are extended to correspondences for the coproduct (Section 5.1) and product (Section 5.2) of the underlying functors. In Section 5.3 we study correspondences for constant and identity functors. Finally in Section 5.4 we combine these results to describe several collections of functors for which we have correspondences. Throughout this section we fix a quantale .
5.1 Coproduct functors
We start by showing that correspondences are closed under coproducts. Given sets we write for the th coprojection .
Proposition 17.
Given correspondences there is a correspondence
the map is the cotupling of the individual modalities; for ,
and finally, .
When there are no couplings for two given elements, as it happens for instance for elements in different components of a coproduct, the coupling-based lifting always gives the value . The modalities are there to ensure that the codensity lifting also gives the value in this case. The other modalities are just the extensions of the modalities from the components of the coproduct to the coproduct itself.
Remark 18.
Proposition 17 gives a correspondence but not a duality, in the sense of Definition 14, that is, the correspondence relates a single modality for the coupling-based lifting to a set of modalities for the codensity lifting. This is the case even if the correspondences of the component functors are dualities.
As it turns out, the inverse process of going from a correspondence at the level of the coproduct to correspondences for its components is also possible:
Proposition 19.
If there is a correspondence , then there are correspondences for each .
Going back and forth between the components of a coproduct and the coproduct itself using the results above gives back the same correspondences:
Proposition 20.
Whenever one of the correspondences on the left exists we also have the corresponding equivalence:
This shows that all correspondences on the coproduct arises as in Proposition 17.
5.2 Product functors
We turn to the construction of correspondences for products from ones on their components. For this, we ask for some kind of distributivity condition on the quantale. In fact, the case of products is more involved than that of coproducts. Each of the three propositions for coproducts above has a version for products, but each gets their own specific restrictions in the form of conditions on the quantale and modalities or even on the statement itself.
There are several possibilities depending on the number of couplings and on whether we want finite or arbitrary products. Below, we say that a functor has finite couplings if, for any , the set of couplings is finite.
Proposition 21.
Let and be correspondences. If one of the following conditions holds:
-
1.
and have finite couplings and is distributive, meaning for all , we have that ; or,
-
2.
is join-infinite distributive: for all and , ;
then we have a correspondence .
Under stronger distributivity conditions, this can be extended to infinite products.
Proposition 22.
Let be correspondences. If one of the following holds:
-
1.
has finite couplings and is meet-infinite distributive, meaning that for all and , ; or,
-
2.
is completely distributive, meaning that for all sets such that projects onto , and any subset , where ;
then we have a correspondence .
Example 23.
The quantales and from Example 2 are both completely distributive.
Replacing the infinite distributivity conditions on the quantale by countably infinite versions directly gives similar statements for countable products.
In order for the inverse process from products to components to be uniquely defined we first need to ensure that the functor has been decomposed as much as possible using coproducts following Propositions 17, 19, and 20. The following well-known lemma is useful for this (see [22, Proposition 1.3.12]):
Lemma 24.
Let be a functor. There is a family of functors indexed by such that , and if then all but one are the empty functor sending any set to the empty set.
Having characterised how functors decompose along coproducts and how correspondences work with regard to such decompositions, we can now assume functors not to be writable as non-trivial coproducts meaning that if a functor can be written as a coproduct, all but one of the components must be the empty functor. Furthermore we assume for convenience that functors are not empty functors. Those two hypotheses can be formalised as follows: by the previous lemma, functors send and by extension any singleton to a singleton. Hence, given well-behaved, with , must be a singleton.
Proposition 25.
Given a correspondence , we again have correspondences where , with and similarly for modalities in .
In a similar fashion as for the coproduct, we would like that going back and forth between products and their components, following Proposition 21 or 22 and Proposition 25, preserves correspondences. We can only do that partially:
Proposition 26.
The inequality comes from the following aspect of the proof. When using the correspondences on the components of a product of functors to retrieve a correspondence on the product itself, a choice is made to build modalities for the product. The natural choice of using a meet ensures the inequality while there is no obvious way to get an equivalence of correspondences.
5.3 Constant and identity functors
In this subsection we give correspondence results for constant functors, and for the identity functor. For constant functors, the essence is given by the constant-to-1 functor.
Proposition 27.
The triple with the functor 1 sending any set to a fixed singleton is a correspondence if and only if and is the constant to modality.
Proof.
We write .
: as modalities are assumed well-behaved, given the inclusion we must have which translates to .
: both liftings lift all pseudometrics to the one constant to . Next, we extend this result to arbitrary constant functors. There is only one correspondence result in this case.
Corollary 28.
For a set, denoting by the associated constant functor mapping all sets to , there is a correspondence with the constant to modality and
Furthermore, any other correspondence is equivalent to .
Proof.
This is a direct consequence of Propositions 17, 19, 20 and 27 viewing the functor constant and equal to as a coproduct:
We give a general duality result for the identity functor acting as the identity on both sets and functions, generalising [2, Example 5.29]. An instance of well-behaved modalities for the identity functor was discussed in Example 8.
Proposition 29.
For any well-behaved modality for the identity functor, there is a correspondence .
Proof.
By Proposition 15 we need only prove
Let be a set, a -pseudometric, and . There is exactly one coupling of with given by . In particular it is optimal:
Furthermore,
Using Lemma 16, we define by and extend it to a morphism . This gives so that . Hence
ending the proof. Note that is a fortiori an optimal function.
5.4 Putting it together: correspondences for polynomial functors
Having seen correspondences for products, coproducts, the identity functor, and constant functors, we combine these results to obtain a “grammar” of functors with correspondences.
We start without products. Using Propositions 17 and 29 as well as Corollary 28 gives correspondences for functors in the following grammar of Set endofunctors:
where indicates choices of well-behaved modalities in the case of the identity functor. Furthermore by Propositions 20 and 29 and Corollary 28, any coupling-based lifting of a functor in this grammar is equivalent to a correspondence given by our construction.
Observing that for a set , , the grammar can equivalently be defined as
where is a well-behaved modality for the identity functor. We can also note that these functors are exactly those isomorphic to for some sets and .
Example 30 (Discounting on streams).
Consider the stream functor for some alphabet . The associated final coalgebra is the set of streams . The results above tell us that to get a correspondence we need one well-behaved modality per letter for the codensity lifting, through the isomorphism : we have a way of computing distance between streams in a specific way for each letter in . When for some real number , choosing , the constant is then a discount factor allowing one to give more value to the first letters of a stream. We can choose a different constant for each letter giving different values to different letters. We can also go further: if we do not want a linear discount we can use arbitrary well-behaved modalities for the identity functor. On the quantale , those are exactly sub-additive monotone maps mapping to .
We also get correspondences for the following grammar of simple polynomial functors:
These functors all have finite couplings. Following Propositions 21 and 22 we can either get finite or arbitrary products in the grammar above by assuming to be distributive or meet-infinite distributive respectively.
Example 31.
We retrieve the correspondence of Section 2 as the particular case of the quantale , the functor , and indexed modalities for the identity functors always mapping to for some . Replacing by the usual Boolean quantale and indexed modalities by the identity functions gives a correspondence equivalent to the usual relation lifting [14] associated to behavioural equivalence of DFA.
6 Dualities for the powerset and probability distribution functors
We give duality results for the powerset functor mapping a set to the set of its subsets , recovering a result from the literature [2, 12] reproduced here as Corollary 35, and complementing it with a duality result where is a total order (Corollary 34).
Remark 32.
Given , , and a -pseudometric , we write for the set of maximal elements of , and similarly for elements . Expressing a coupling-based lifting as a codensity one in a correspondence implies turning a join in a meet. The following proposition gives a condition allowing one to do that in the case of the powerset functor by making a modality absorb a meet.
Proposition 33.
Let be a well-behaved modality. If for every -pseudometric and sets the following equality holds
then there is a duality .
Corollary 34.
Let be a well-behaved modality. If the order on is total then there is a duality .
Corollary 35.
We assume to be completely distributive. We have duality for the coupling-based and codensity liftings of the powerset functor, both along the meet modality which maps a subset of to the meet of its elements.
For the probability distribution functor we fix a constant and use the quantale . The following (Kantorovich-Rubinstein) duality result is well-known (see, e.g., [27, Theorem 5.10] for a general proof in the continuous case and [16, Appendix A] for the discrete finite case):
Proposition 36.
There is a duality with the finite probability distribution functor and giving the expectation of probability distributions.
We extend this result slightly to allow post-composition by well-behaved modalities:
Proposition 37.
Let be a well-behaved modality. If is additive, meaning that for all , , then there is a duality .
7 Correspondences for grammars of functors
In this section we combine the results from the previous two sections, allowing the construction of correspondences for certain classes of functors including powerset, distribution, identity and constant functors, as well as products and coproducts thereof.
Whenever is totally ordered and completely distributive, using results from Sections 5 and 6 we can construct correspondences for the following grammar of functors:
where the indices are well-behaved modalities for either the identity or powerset functors.
Noting that , this grammar can be reformulated as follows:
where the indices of the form indicate a choice of possible well-behaved modalities for the identity functor when appearing in and for the powerset functor when appearing in .
Example 38.
In a similar fashion as in Example 31, considering the completely distributive quantale , the functor which is associated to non-deterministic automata, and indexed modalities for the powerset functors to be all mapping finite subsets to for a fixed , we get a lifting associated to a shortest-distinguishing-word-distance for non-deterministic systems as is detailed in Section 2 for DFA.
Remark 39.
This grammar with finite products only defines a fragment of finitary Kripke polynomial functors as defined in [14] which correspond to replacing by , and having only finite products but including arbitrary exponents.
Remark 40.
Using the identity modality for the identity functors and the meet modality for the powerset functors, the modalities given by this construction for the coupling-based liftings are exactly the canonical evaluation maps as defined in [6].
In the particular case of we can extend the above grammar with the finite probability distribution functor and get correspondence results for the following:
where the indices indicate choices of well-behaved modalities for either the identity, powerset, or distribution functors, furthermore of a modality of the form for the latter as described in Proposition 37.
Observe that so that the grammar above can be expressed as follows:
where the indices indicate choices of possible well-behaved modalities for the identity functor in and for the powerset or distribution functors when appearing in for and respectively.
Example 41.
We fix so that . Consider the functor for a set of labels and 1 a singleton as in Proposition 27. It is associated to labelled Markov processes. To get a correspondence we need one modality per label . By Proposition 37 we can take them all to be with a fixed constant. The resulting correspondence is associated to the usual metrics for labelled Markov processes as introduced in [8]. This is a direct consequence of [26, Proposition 29] which expresses the associated lifting for one label in a “codensity-like” manner.
8 A counter-example: conditional transition systems
We now highlight an example where a correspondence can not be provided by our construction: some codensity lifting may not be obtained as a coupling-based lifting.
A conditional transition system (CTS) over an alphabet and a partially ordered set of conditions is a tuple where is a set of states and the transition map associates to each pair a monotone function from the poset of conditions to . For the associated functor to live in Set we restrict to the CTSs for which is trivially ordered by . Hence any map is monotone, and CTSs are exactly coalgebras for the functor (see [4]).
The associated bisimulations, not detailed here, are related to a lifting of defined by
on objects and on maps.
Proposition 42.
For consider a modality , defined by:
The codensity lifting defined by the family of modalities is equal to .
Proposition 43.
If is non-empty and then there is no well-behaved modality such that the resulting coupling-based lifting is equal to .
Proof.
Let be some letter and be two distinct conditions. Consider constant to , that is, . It is obviously a -pseudometric. Finally we consider such that and , and . Directly, because but there are no couplings of and , and for all well-behaved modalities, . On the other hand,
Hence .
Hence, conditional transition systems give a limitation to the correspondence results provided above. Note however that the associated functor has a correspondence induced by a grammar above. The reason it is not equivalent to the lifting is that it considers the set as being a set of actions, while we want conditions in to be independent of one another and compared separately. Indeed, conditions are fixed throughout the execution of a CTS whereas actions may change at each step.
9 Conclusions and future work
We have studied correspondences between coupling-based and codensity liftings, moving from the classical Kantorovich-Rubinstein duality for distributions to different types of endofunctors on Set. In particular, we have shown that such types of correspondences are closed under coproducts and products and used that to provide explicit correspondences for several grammars of functors, including polynomial functors with the possibility of extending them using the powerset and the probability distribution functors. This instantiates to usual liftings of functors associated to (non)deterministic finite automata, or labelled Markov processes, both with discount.
In [10] the authors have shown that on an abstract level all coupling-based liftings are in fact codensity liftings, implying that all coupling-based liftings have some associated correspondences. Section 8 shows that the converse does not hold by providing an example of lifting that arises as a codensity lifting but not as a coupling-based one. Our work proves that correspondences for coproducts of functors are characterised by ones for the components of the coproducts, but gives no such result for products of functors. For example we could consider the coupling-based lifting of the diagonal functor along the well-behaved modality . The question of whether it arises from coupling-based liftings of the identity functors, and the problem of relating it to a codensity lifting in a correspondence remain open. Note however that if coupling-based liftings require their modalities to be well-behaved, codensity liftings, as defined in [10] need no such assumption and can be defined along sets of any modalities. Hence it is possible that to see the coupling-based lifting of along as a codensity lifting it is needed to consider general modalities for the latter.
In Section 8 we have seen that a certain lifting for conditional transition systems can not be obtained as a coupling-based lifting. This leads to the question of whether the definition of coupling-based liftings could be extended somehow to encompass this example and obtain a correspondence with the existing codensity lifting.
References
- [1] Giorgio Bacci, Giovanni Bacci, Kim G. Larsen, and Radu Mardare. On-the-fly computation of bisimilarity distances. Log. Methods Comput. Sci., 13(2), 2017. doi:10.23638/LMCS-13(2:13)2017.
- [2] Paolo Baldan, Filippo Bonchi, Henning Kerstan, and Barbara König. Coalgebraic behavioral metrics. Log. Methods Comput. Sci., 14(3), 2018. doi:10.23638/LMCS-14(3:20)2018.
- [3] Harsh Beohar, Barbara König, Sebastian Küpper, and Alexandra Silva. Conditional transition systems with upgrades. Sci. Comput. Program., 186, 2020. doi:10.1016/J.SCICO.2019.102320.
- [4] Harsh Beohar, Barbara König, Sebastian Küpper, Alexandra Silva, and Thorsten Wißmann. A coalgebraic treatment of conditional transition systems with upgrades. Log. Methods Comput. Sci., 14(1), 2018. doi:10.23638/LMCS-14(1:19)2018.
- [5] Filippo Bonchi, Barbara König, and Daniela Petrisan. Up-to techniques for behavioural metrics via fibrations. In Sven Schewe and Lijun Zhang, editors, 29th International Conference on Concurrency Theory, CONCUR 2018, September 4-7, 2018, Beijing, China, volume 118 of LIPIcs, pages 17:1–17:17. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2018. doi:10.4230/LIPICS.CONCUR.2018.17.
- [6] Filippo Bonchi, Barbara König, and Daniela Petrisan. Up-to techniques for behavioural metrics via fibrations. Math. Struct. Comput. Sci., 33(4-5):182–221, 2023. doi:10.1017/S0960129523000166.
- [7] Y. Brenier, U. Frisch, M. Hénon, G. Loeper, S. Matarrese, R. Mohayaee, and A. Sobolevskiĭ. Reconstruction of the early Universe as a convex optimization problem. Monthly Notices of the Royal Astronomical Society, 346(2):501–524, December 2003. doi:10.1046/j.1365-2966.2003.07106.x.
- [8] Josée Desharnais, Vineet Gupta, Radha Jagadeesan, and Prakash Panangaden. Metrics for labelled markov processes. Theor. Comput. Sci., 318(3):323–354, 2004. doi:10.1016/J.TCS.2003.09.013.
- [9] Alessandro Giacalone, Chi-Chang Jou, and Scott A. Smolka. Algebraic reasoning for probabilistic concurrent systems. In Manfred Broy and Cliff B. Jones, editors, Programming concepts and methods: Proceedings of the IFIP Working Group 2.2, 2.3 Working Conference on Programming Concepts and Methods, Sea of Galilee, Israel, 2-5 April, 1990, pages 443–458. North-Holland, 1990.
- [10] Sergey Goncharov, Dirk Hofmann, Pedro Nora, Lutz Schröder, and Paul Wild. Kantorovich functors and characteristic logics for behavioural distances. In Orna Kupferman and Pawel Sobocinski, editors, Foundations of Software Science and Computation Structures - 26th International Conference, FoSSaCS 2023, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2023, Paris, France, April 22-27, 2023, Proceedings, volume 13992 of Lecture Notes in Computer Science, pages 46–67. Springer, 2023. doi:10.1007/978-3-031-30829-1_3.
- [11] Dirk Hofmann. Topological theories and closed objects. Advances in Mathematics, 215(2):789–824, 2007. doi:10.1016/j.aim.2007.04.013.
- [12] Dirk Hofmann and Pedro Nora. Hausdorff coalgebras. Appl. Categorical Struct., 28(5):773–806, 2020. doi:10.1007/S10485-020-09597-8.
- [13] Samuel Humeau, Daniela Petrisan, and Jurriaan Rot. Correspondences between codensity and coupling-based liftings, a practical approach, 2024. Version of this paper with the appendix. URL: https://hal.science/hal-04789352.
- [14] Bart Jacobs. Introduction to Coalgebra: Towards Mathematics of States and Observation, volume 59 of Cambridge Tracts in Theoretical Computer Science. Cambridge University Press, 2016. doi:10.1017/CBO9781316823187.
- [15] Bart Jacobs. Drawing from an urn is isometric. In Naoki Kobayashi and James Worrell, editors, Foundations of Software Science and Computation Structures - 27th International Conference, FoSSaCS 2024, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2024, Luxembourg City, Luxembourg, April 6-11, 2024, Proceedings, Part I, volume 14574 of Lecture Notes in Computer Science, pages 101–120. Springer, 2024. doi:10.1007/978-3-031-57228-9_6.
- [16] Bart Jacobs. Drawing with distance, 2024. arXiv:2405.18182, doi:10.48550/arXiv.2405.18182.
- [17] Leonid Kantorovich. On the translocation of masses (in Russian). Doklady Akademii Nauk, 37(7–8):227–229, 1942. Translated to English in Management Science, 5, 1 (1958).
- [18] Leonid Kantorovich and Gennady S. Rubinstein. On a space of totally additive functions (in Russian). Vestnik Leningrad. Univ, 13(7):52–59, 1958.
- [19] Shin-ya Katsumata, Tetsuya Sato, and Tarmo Uustalu. Codensity lifting of monads and its dual. Log. Methods Comput. Sci., 14(4), 2018. doi:10.23638/LMCS-14(4:6)2018.
- [20] Yuichi Komorida, Shin-ya Katsumata, Clemens Kupke, Jurriaan Rot, and Ichiro Hasuo. Expressivity of quantitative modal logics : Categorical foundations via codensity and approximation. In 36th Annual ACM/IEEE Symposium on Logic in Computer Science, LICS 2021, Rome, Italy, June 29 - July 2, 2021, pages 1–14. IEEE, 2021. doi:10.1109/LICS52264.2021.9470656.
- [21] Barbara König and Christina Mika-Michalski. (metric) bisimulation games and real-valued modal logics for coalgebras. In Sven Schewe and Lijun Zhang, editors, 29th International Conference on Concurrency Theory, CONCUR 2018, September 4-7, 2018, Beijing, China, volume 118 of LIPIcs, pages 37:1–37:17. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2018. doi:10.4230/LIPICS.CONCUR.2018.37.
- [22] Robert Paré. Taut functors and the difference operator, 2024. arXiv:2407.21129.
- [23] Lutz Schröder. Expressivity of coalgebraic modal logic: The limits and beyond. In Vladimiro Sassone, editor, Foundations of Software Science and Computational Structures, 8th International Conference, FOSSACS 2005, Held as Part of the Joint European Conferences on Theory and Practice of Software, ETAPS 2005, Edinburgh, UK, April 4-8, 2005, Proceedings, volume 3441 of Lecture Notes in Computer Science, pages 440–454. Springer, 2005. doi:10.1007/978-3-540-31982-5_28.
- [24] David Sprunger, Shin-ya Katsumata, Jérémy Dubut, and Ichiro Hasuo. Fibrational bisimulations and quantitative reasoning: Extended version. J. Log. Comput., 31(6):1526–1559, 2021. doi:10.1093/LOGCOM/EXAB051.
- [25] Franck van Breugel. Probabilistic bisimilarity distances. ACM SIGLOG News, 4(4):33–51, 2017. doi:10.1145/3157831.3157837.
- [26] Franck van Breugel and James Worrell. A behavioural pseudometric for probabilistic transition systems. Theor. Comput. Sci., 331(1):115–142, 2005. doi:10.1016/J.TCS.2004.09.035.
- [27] Cédric Villani et al. Optimal transport: old and new, volume 338. Springer, 2009. doi:10.1007/978-3-540-71050-9.