Hostname: page-component-797576ffbb-bqjwj Total loading time: 0 Render date: 2023-12-02T14:16:27.957Z Has data issue: false Feature Flags: { "corePageComponentGetUserInfoFromSharedSession": true, "coreDisableEcommerce": false, "useRatesEcommerce": true } hasContentIssue false

Up-to techniques for behavioural metrics via fibrations

Published online by Cambridge University Press:  10 July 2023

Filippo Bonchi
Università di Pisa, Pisa, Italy
Barbara König*
Universität Duisburg-Essen, Duisburg, Germany
Daniela Petrişan
CNRS, IRIF, Université Paris Diderot, Paris, France
Corresponding author: Barbara König; Email:
Rights & Permissions [Opens in a new window]


Up-to techniques are a well-known method for enhancing coinductive proofs of behavioural equivalences. We introduce up-to techniques for behavioural metrics between systems modelled as coalgebras, and we provide abstract results to prove their soundness in a compositional way.

In order to obtain a general framework, we need a systematic way to lift functors: we show that the Wasserstein lifting of a functor, introduced in a previous work, corresponds to a change of base in a fibrational sense. This observation enables us to reuse existing results about soundness of up-to techniques in a fibrational setting. We focus on the fibrations of predicates and relations valued in a quantale. To illustrate our approach, we provide an example on distances between regular languages.

Special Issue: Differences and Metrics in Programs Semantics: Advances in Quantitative Relational Reasoning
Creative Commons
Creative Common License - CCCreative Common License - BY
This is an Open Access article, distributed under the terms of the Creative Commons Attribution licence (, which permits unrestricted re-use, distribution and reproduction, provided the original article is properly cited.
© The Author(s), 2023. Published by Cambridge University Press

1. Introduction

Checking whether two systems have an equivalent (or similar) behaviour is a crucial problem in computer science. In concurrency theory, one standard methodology for establishing behavioural equivalence of two systems is constructing a bisimulation relation between them. When the systems display a quantitative behaviour, the notion of behavioural equivalence is replaced with the more robust notion of behavioural metric (de Alfaro et al. Reference de Alfaro, Faella and Stoelinga2004;Desharnais et al. Reference Desharnais, Gupta, Jagadeesan and Panangaden2004; van Breugel and Worrell Reference van Breugel and Worrell2005).

Due to the sheer complexity of state-based systems, computing their behavioural equivalences and metrics can be very costly; therefore, optimization techniques – the so-called up-to techniques (Pous and Sangiorgi Reference Pous and Sangiorgi2019) – have been developed to render these computations more efficient. These techniques are related to Galois connections (Baldan et al. Reference Baldan, König and Padoan2020; Reference Bonchi, Ganty, Giacobazzi and PavlovicBonchi et al. 2018a ) and can be found applications in various domains such as checking algorithms (Reference Bonchi, König and KüpperBonchi et al. 2017a ; Bonchi and Pous Reference Bonchi and Pous2013), abstract interpretation (Reference Bonchi, Ganty, Giacobazzi and PavlovicBonchi et al. 2018a ) and proof assistants (Blanchette et al. Reference Blanchette, Bouzy, Lochbihler, Popescu and Traytel2017; Danielsson Reference Danielsson2017). In the qualitative setting and in particular in concurrency, the theory of up-to techniques for bisimulations and various other coinductive predicates has been thoroughly studied (Bacci et al. Reference Bacci, Bacci, Larsen, Tribastone, Tschaikowski and Vandin2021; Hur et al. Reference Hur, Neis, Dreyer and Vafeiadis2013; Milner and Sangiorgi Reference Milner and Sangiorgi1992; Pous and Sangiorgi Reference Pous, Sangiorgi, Sangiorgi and Rutten2011). On the other hand, in the quantitative setting, so far, there are only few papers that investigate up-to techniques for behavioural metrics, in particular (Chatzikokolakis et al. Reference Chatzikokolakis, Palamidessi and Vignudelli2016). There, the notion of up-to techniques and the accompanying theory of soundness are specific for probabilistic automata and are not derived as instances of the standard lattice-theoretic framework, which we will briefly recall next.

Suppose we want to verify whether two states in a system behave in the same way (e.g. whether two states of an NFA accept the same language). The starting observation is that the relation of interest (e.g. behavioural equivalence or language equivalence) can be expressed as the greatest fixed point $\nu b$ of a monotone function $b\colon\mathsf{Rel}_Q\to\mathsf{Rel}_Q$ on the complete lattice $\mathsf{Rel}_Q$ of relations on the state space Q of the system. Hence, in order to prove that two states x and y are behaviourally equivalent, that is, $(x,y)\in\nu b$ , it suffices to find a witness relation r which on one hand is a post-fixpoint of b, that is, $r\subseteq b(r)$ and on the other hand contains the pair (x,y). This is simply the coinduction proof principle. However, exhibiting such a witness relation r can be sometimes computationally expensive. In many situations, this computation can be significantly optimized, if instead of computing a post-fixpoint of b one exhibits a relaxed invariant, that is a relation r such that $r\subseteq b(f(r))$ for a suitable function f. The function f is called a sound up-to technique when the proof principle

\begin{equation*} \frac{(x,y)\in r \quad r\subseteq b(f(r))}{(x,y)\in \nu b}\end{equation*}

is valid. Establishing the soundness of up-to techniques on a case-by-case basis can be a tedious and sometimes delicate problem, see for example Milner (Reference Milner1989). For this reason, several works (Hur et al. Reference Hur, Neis, Dreyer and Vafeiadis2013; Parrow and Weber Reference Parrow and Weber2016; Pous Reference Pous2007, Reference Pous2016; Pous and Sangiorgi Reference Pous, Sangiorgi, Sangiorgi and Rutten2011; Sangiorgi Reference Sangiorgi1998) have established a lattice-theoretic framework for proving soundness results in a modular fashion. The key notion is compatibility: for arbitrary monotone maps b and f on a complete lattice $(C,\leq)$ , the up-to technique f is b-compatible iff $f\circ b\leq b\circ f$ . Compatible techniques are sound and, most importantly, can be combined in several useful ways.

In this paper, we develop a generic theory of up-to techniques for behavioural metrics applicable to different kinds of systems and metrics, which reuses established methodology. To achieve this, we exploit the theory developed in Bonchi et al. (Reference Bonchi, Petrişan, Pous and Rot2014) by modelling systems as coalgebras (Jacobs Reference Jacobs2016; Rutten Reference Rutten2000) and behavioural metrics as coinductive predicates in a fibration (Hermida and Jacobs Reference Hermida and Jacobs1998). In order to provide general soundness results, we need a principled way to lift functors from $\mathsf{Set}$ to metric spaces, a problem that has been studied inHofmann (Reference Hofmann2007), Hofmann and Nora (Reference Hofmann and Nora2020), Baldan et al. (Reference Baldan, Bonchi, Kerstan and König2014) andWild and Schröder (2022). Our key observation is that these liftings arise from a change-of-base situation between $\mathcal{V}\textrm{-}\mathsf{Rel}$ and $\mathcal{V}\textrm{-}\mathsf{Pred}$ , namely the fibrations of relations, respectively predicates, valued over a quantale ${\mathcal{V}}$ (see Sections 4 and 5).

In Section 6, we provide sufficient conditions ensuring the compatibility of basic quantitative up-to techniques, as well as proper ways to compose them. Interestingly enough, the conditions ensuring compatibility of the quantitative analogue of up-to reflexivity and up-to transitivity are subsumed by those used in Hofmann (Reference Hofmann2007) to extend monads to a bicategory of many-valued relations and generalize those in Baldan et al. (Reference Baldan, Bonchi, Kerstan and König2014) (see the discussion after Theorem 27).

When the state space of a system is equipped with an algebraic structure, for example in process algebras, one can usually exploit this structure by reasoning up-to context. Assuming that the system forms a bialgebra (Klin Reference Klin2011; Turi and Plotkin Reference Turi and Plotkin1997), that is, that the algebraic structure distributes over the coalgebraic behaviour as in GSOS specifications, we give sufficient conditions ensuring the compatibility of the quantitative version of contextual closure (Theorem 42).

In the qualitative setting, the sufficient conditions for compatibility are automatically met when taking as lifting the canonical relational one, see Bonchi et al. (Reference Bonchi, Petrişan, Pous and Rot2014). We show that the situation is similar in the quantitative setting for a certain notion of quantitative canonical lifting. In particular, up-to context is compatible for the canonical lifting under mild assumptions (Theorem 46). As an immediate corollary, we have that, in a bialgebra, syntactic contexts are non-expansive with respect to the behavioural metric induced by the canonical lifting. This property and weaker variants of it (such as non-extensiveness or uniform continuity), considered to be the quantitative analogue of behavioural equivalence being a congruence, have recently received considerable attention, see for example Desharnais et al. (Reference Desharnais, Gupta, Jagadeesan and Panangaden2004), Bacci et al. (Reference Bacci, Bacci, Larsen and Mardare2013), Tini et al. (Reference Tini, Larsen and Gebler2017).

To fix the intuition, Section 2 provides a motivating example (formally treated in Section 7). Section 3 contains the preliminaries, while quantale-valued predicates and relations are introduced and studied in Section 4. In the following, Section 5 discusses the lifting of functors to such generalized predicates and relations, which paves the way for quantitative up-to techniques, see Section 6. As mentioned above, Section 7 formally works out the example and Section 8 provides a detailed comparison with Chatzikokolakis et al. (Reference Chatzikokolakis, Palamidessi and Vignudelli2016). We conclude with a comparison to related work and a discussion of open problems in Section 9.

Additional proofs are provided in the appendix.

2. Motivating Example: Distances Between Regular Languages

Computing various distances (such as the edit-distance or Cantor metric) between strings, and more generally between regular languages or string distributions, has found various practical applications in various areas such as speech and handwriting recognition or computational biology. In this section, we focus on a simple distance between regular languages, which we will call shortest-distinguishing-word-distance and is defined as ${d_{\mathtt{sdw}}}(L,K)=c^{|w|}$ – where w is the shortest word which belongs to exactly one of the languages L,K and c is a constant such that $0<c<1$ .

As a running example, which will be formally explained in Section 7, we consider the non-deterministic finite automaton in Fig. 1 and the languages accepted by the states $x_0$ , respectively $y_0$ . We can similarly define a distance on the states of an automaton as the aforementioned distance between the languages accepted by the two states. The inequality

(1) \begin{equation*} {d_{\mathtt{sdw}}}(x_0,y_0)\le c^n \qquad \mbox{(even ${d_{\mathtt{sdw}}}(x_0,y_0) = c^n$)}\end{equation*}

holds in this example since no word of length smaller than n is accepted by either state. Note that computing this distance is $\textsf{PSPACE}$ -hard since the language equivalence problem for non-deterministic automata can be reduced to it.

Figure 1: Example automaton.

One way to show the bound is to determinize the automaton in Fig. 1 and to use the fact that for deterministic automata the shortest-distinguishing-word-distance can be expressed as the greatest fixpoint for a monotone function. Indeed, for a finite deterministic automaton $(Q,(\delta_a\colon Q\to Q)_{a\in A}, F\subseteq Q)$ over a finite alphabet A, we have that ${d_{\mathtt{sdw}}}\colon Q\times Q\to[0,1]$ is the greatest fixpoint of a function b defined on the complete lattice $[0,1]^{Q\times Q}$ of functions ordered with the reversed pointwise order $\mathrel{\preceq}$ and given by


Notice that we use the reversed order on [0,1], for technical reasons (see Section 4).

In order to prove (1) we can define a witness distance ${\overline{d}}$ on the states of the determinized automaton such that ${\overline{d}}(\{x_0\},\{y_0\})\le c^n$ and which is a post-fixpoint for b, that is, ${\overline{d}}\mathrel{\preceq} b({\overline{d}})$ . Notice that this would entail ${\overline{d}}\mathrel{\preceq} {d_{\mathtt{sdw}}}$ and hence ${d_{\mathtt{sdw}}}(\{x_0\},\{y_0\})\le {\overline{d}}(\{x_0\},\{y_0\})\le c^n$ .

This approach is problematic since the determinization of the automaton is of exponential size, so we have to define ${\overline{d}}$ for exponentially many pairs of sets of states. In order to mitigate the state space explosion, we will use an up-to technique, which, just as up-to congruence in Bonchi and Pous (Reference Bonchi and Pous2013), exploits the join-semilattice structure of the state set ${\mathcal{P}} Q$ of the determinization of an NFA with state set Q. The crucial observation is the fact that given the states $Q_1,Q_2,Q'_1,Q'_2\in{\mathcal{P}} Q$ in the determinization of an NFA, the following inference rule holds

\begin{equation*} \frac{{d_{\mathtt{sdw}}}(Q_1,Q_2)\le r\qquad {d_{\mathtt{sdw}}}(Q'_1,Q'_2)\le r}{{d_{\mathtt{sdw}}}(Q_1\cup Q'_1,Q_2\cup Q'_2)\le r}\end{equation*}

Based on this, we can define a monotone function f on $[0,1]^{{\mathcal{P}} Q\times{\mathcal{P}} Q}$ that closes a function d according to such proof rules (the formal definition of f is given in Section 7). The general theory developed in this paper allows us to show in Section 7 that f is a sound up-to technique, that is, it is sufficient to prove ${\overline{d}}\mathrel{\preceq} b(f({\overline{d}}))$ (which is easier than ${\overline{d}}\mathrel{\preceq} b({\overline{d}})$ , since f is extensive) in order to establish ${\overline{d}} \mathrel{\preceq} {d_{\mathtt{sdw}}}$ .

Using this technique, it suffices to consider a quadratic number of pairs of sets of states in the example. In particular we define a function ${\overline{d}}\colon {\mathcal{P}} Q \times {\mathcal{P}} Q \to [0,1]$ as follows:

\begin{equation*}{\overline{d}}(\{x_i\},\{y_j\}) = c^{n-\max\{i,j\}} \end{equation*}

and ${\overline{d}}(X_1,X_2) = 1$ for all other values. Note that this function is not a metric but rather, what we will call in Section 4, a relation valued in [0,1].

It holds that ${\overline{d}}(\{x_0\},\{y_0\}) = c^n$ . It remains to show that $ {\overline{d}} \mathrel{\preceq} b(f({\overline{d}}))$ . For this, it suffices to prove that

\begin{equation*} b(f({\overline{d}}))(\{x_i\},\{y_j\}) \le {\overline{d}}(\{x_i\},\{y_j\})\,.\end{equation*}

For instance, when $i=j=0$ we compute the sets of a-successors, which are $\{x_0,x_1\}$ , $\{y_0\}$ . We have that ${\overline{d}}(\{x_0\},\{y_0\}) = c^n \le c^{n-1}$ , ${\overline{d}}(\{x_0\},\{y_1\}) = c^{n-1,}$ and using the up-to proof rule introduced above, we obtain that $f({\overline{d}})(\{x_0,x_1\},\{y_0\}) \le c^{n-1}$ . The same holds for the sets of b-successors, and since $x_0$ and $y_0$ are both non-final, we infer $b(f({\overline{d}}))(\{x_0\},\{y_0\}) \le c\cdot c^{n-1} = c^n ={\overline{d}}(\{x_0\},\{y_0\})$ . The remaining cases (when $i\neq 0$ or $j\neq 0$ ) are analogous.

Our aim is to introduce such proof techniques for behavioural metrics, to make this kind of reasoning precise, not only for this specific example but also for coalgebras in general. Furthermore, we will not limit ourselves to metrics and distances, but we will consider more general relations valued in arbitrary quantales, of which the interval [0,1] is an example.

3. Preliminaries

We recall here formal definitions for notions such as coalgebras, bialgebras or fibrations.

Definition 1. A coalgebra for a functor $F\colon{\mathcal{C}}\to{\mathcal{C}}$ or an F-coalgebra is a morphism $\gamma\colon X\to FX$ for some object X of ${\mathcal{C}}$ , referred to as the carrier of the coalgebra $\gamma$ . A morphism between two coalgebras $\gamma\colon X\to FX$ and $\xi\colon Y\to FY$ is a morphism $f\colon X\to Y$ such that $\xi\circ f=Ff\circ\gamma$ . Algebras for the functor F, or F-algebras, are defined dually as morphisms of the form $\alpha\colon FX\to X$ .

Definition 2. Consider two functors F,T and a natural transformation ${\zeta}\colon TF\Rightarrow FT$ . A bialgebra for ${\zeta}$ is a tuple $(X,\alpha,\gamma)$ such that $\alpha\colon TX\to X$ is a T-algebra, $\gamma\colon X\to FX$ is an F-coalgebra so that the diagram on the left commutes. We call ${\zeta}$ the distributive law of the bialgebra $(X,\alpha,\gamma)$ , even when T is not a monad.

Example 3. The determinization of an NFA can be seen as a bialgebra with $X={\mathcal{P}} Q$ , the algebra $\mu_Q\colon {\mathcal{P}}{\mathcal{P}} Q\to {\mathcal{P}} Q$ given by the multiplication of the powerset monad, a coalgebra for the functor $F(X)=2\times X^A$ , and a distributive law ${\zeta}\colon {\mathcal{P}} F\to F{\mathcal{P}}$ defined for $M \subseteq 2\times X^A$ by ${\zeta}_X(M) = (\bigvee_{(b,f)\in M} b, [a\mapsto \{f(a)\mid (b,f)\in M\}])$ . See Silva et al. (Reference Silva, Bonchi, Bonsangue and Rutten2013), Jacobs et al. (Reference Jacobs, Silva and Sokolova2015) for more details.

We now introduce the notions of fibration and bifibration.

Definition 4. A functor $p\colon{{\mathcal{E}}}\to{\mathcal{B}}$ is called a fibration when for every morphism $f\colon X\to Y$ in ${\mathcal{B}}$ and every R in ${{\mathcal{E}}}$ with $p(R)=Y$ there exists a map ${\widetilde{f_R}}\colon {f^*}(R)\to R$ such that $p({\widetilde{f_R}})=f$ , satisfying the following universal property: For all maps $g:Z\to X$ in ${\mathcal{B}}$ and $u\colon Q\to R$ in ${{\mathcal{E}}}$ sitting above fg (i.e. $p(u)=fg$ ), there is a unique map $v\colon Q\to {f^*}(R)$ such that $u={\widetilde{f_R}} v$ and $p(v)=g$ .

For X in ${\mathcal{B,}}$ we denote by ${{{\mathcal{E}}}_{X}}$ the fibre above X, that is, the subcategory of ${{\mathcal{E}}}$ with objects mapped by p to X and arrows sitting above the identity on X.

A map ${\widetilde{f_R}}$ as above is called a Cartesian lifting of f and is unique up to isomorphism. If we make a choice of Cartesian liftings, the association $R\mapsto {f^*}(R)$ gives rise to the so-called reindexing functor ${f^*}\colon {{{\mathcal{E}}}_{Y}}\to{{{\mathcal{E}}}_{X}}$ . In what follows we will only consider split fibrations, that is, the Cartesian liftings are chosen such that we have ${(fg)^*}={g^*}{f^*}$ and ${{\mathit{id}}^*} = \mathit{id}$ .

A functor $p\colon {{\mathcal{E}}}\to{\mathcal{B}}$ is called a bifibration if both $p\colon {{\mathcal{E}}}\to{\mathcal{B}}$ and $p^\mathit{op}\colon {{\mathcal{E}}}^\mathit{op}\to{\mathcal{B}}^\mathit{op}$ are fibrations. Interestingly, a fibration is a bifibration if and only if each reindexing functor ${f^*}\colon {{{\mathcal{E}}}_{Y}}\to{{{\mathcal{E}}}_{X}}$ has a left adjoint ${\Sigma_{f}}\dashv {f^*}$ , see Jacobs (Reference Jacobs1999, Lemma 9.1.2). We will call the functors ${\Sigma_{f}}$ direct images along f.

Two important examples of bifibrations are those of relations over sets, $p\colon \mathsf{Rel}\to\mathsf{Set}$ , and of predicates over sets, $p\colon \mathsf{Pred}\to\mathsf{Set}$ , which played a crucial role in Bonchi et al. (Reference Bonchi, Petrişan, Pous and Rot2014). We do not recall their exact definitions here, as they arise as instances of the more general bifibrations of quantale-valued relations and predicates described in detail in the next section.

Given fibrations $p\colon {{\mathcal{E}}}\to{\mathcal{B}}$ and $p'\colon {{\mathcal{E}}}'\to{\mathcal{B}}'$ and a functor on the base categories $F\colon {\mathcal{B}}\to{\mathcal{B}}'$ , we call ${\widehat{F}}\colon {{\mathcal{E}}}\to{{\mathcal{E}}}'$ a lifting of F when $p'{\widehat{F}}=Fp$ . Notice that a lifting ${\widehat{F}}$ restricts to a functor between the fibres ${\widehat{F}_{X}}\colon {{{\mathcal{E}}}_{X}}\to{{{\mathcal{E}}}'_{FX}}$ . We omit the subscript X when it is clear from the context.

Consider an arbitrary lifting ${\widehat{F}}$ of F and a morphism $f\colon X\to Y$ in ${\mathcal{B}}$ . For any $R\in{{{\mathcal{E}}}_{Y,}}$ the maps ${\widetilde{Ff}_{{\widehat{F}}{R}}}\colon{({Ff})^*}({\widehat{F}} R)\to{\widehat{F}} R$ and ${\widehat{F}}({\widetilde{f_R}})\colon{\widehat{F}}({f^*} R)\to{\widehat{F}} R$ sit above Ff. Using the universal property in Definition 4, we obtain a canonical morphism

(3) \begin{equation*} {\widehat{F}}\circ {f^*}(R)\to{({Ff})^*}\circ{\widehat{F}} (R)\,.\end{equation*}

A lifting ${\widehat{F}}$ is called a fibred lifting when the natural transformation in (3) is an isomorphism.

We will use the Beck-Chevalley condition for fibrations $p:{{\mathcal{E}}}\to{\mathcal{B}}$ , which will be needed in some of the proofs. Assume we have a commuting square:


Since the fibration is split, we have a commuting diagram

Using the adjunctions ${\Sigma_{f}}\dashv {f^*}$ and ${\Sigma_{g}}\dashv {g^*,}$ we obtain the so-called mate of the above square


obtained using the unit and the counit of the above adjunctions, as the composite

Definition 5. We say that the square (4) has the Beck-Chevalley condition if the mate (5) is an isomorphism.

4. Moving Towards a Quantitative Setting

We start by introducing two fibrations which are the foundations for our quantitative reasoning: predicates and relations valued in a quantale.

Definition 6. A quantale ${\mathcal{V}}$ is a complete lattice equipped with an associative operation $\otimes:{\mathcal{V}}\times{\mathcal{V}}\to{\mathcal{V}}$ which is distributive on both sides over arbitrary joins $\bigvee$ .

This implies that for every $y\in{\mathcal{V,}}$ the functor $-\otimes y$ has a right adjoint $[y,-]$ . Similarly, for every $x\in {\mathcal{V}}$ , the functor $x\otimes -$ has a right adjoint, denoted by . Thus, for every $x,y,z\in{\mathcal{V}}$ , we have: .

If $\otimes$ has an identity element or unit 1 for $\otimes,$ the quantale is called unital. If $x\otimes y=y\otimes x$ for every $x,y\in{\mathcal{V}}$ the quantale is called commutative and we have . Hereafter, we only work with unital, commutative quantales.

Example 7. The Boolean algebra 2 with $\otimes=\wedge$ is a unital and commutative quantale: the unit is 1 and $[{y},{z}]=y\to z$ . The complete lattice $[0,\infty]$ ordered by the reversed order of the reals, that is, $\le=\ge_{\mathbb{R}}$ and with $\otimes = +$ is a unital commutative quantale: the unit is 0 and for every $y,z\in[0,\infty]$ we have $[{y},{z}]=z\stackrel{\cdot}{-} y$ (truncated subtraction). Also [0,1] is a unital quantale where $r\otimes s=\min(r+s,1)$ (truncated addition). To avoid confusion, we use $\lor,\land$ in the quantale and $\inf,\sup$ in the reals.

Definition 8. Given a set X and a quantale ${\mathcal{V}}$ , a ${\mathcal{V}}$ - valued predicate on X is a map $p:X\to{\mathcal{V}}$ . A ${\mathcal{V}}$ - valued relation on X is a map $r:X\times X\to{\mathcal{V}}$ .

Given two ${\mathcal{V}}$ -valued predicates $p,q:X\to{\mathcal{V}}$ , we say that $p\le q \iff \forall x\in X.\ p(x)\le q(x)$ .

Definition 9. A morphism between ${\mathcal{V}}$ - valued predicates $p:X\to {\mathcal{V}}$ and $q:Y\to{\mathcal{V}}$ is a map $f:X\to Y$ such that $p\le q\circ f$ . We consider the category $\mathcal{V}\textrm{-}\mathsf{Pred}$ whose objects are ${\mathcal{V}}$ -valued predicates and arrows are as above.

Definition 10. A morphism between ${\mathcal{V}}$ -valued relations $r:X\times X\to {\mathcal{V}}$ and $q:Y\times Y\to{\mathcal{V}}$ is a map $f:X\to Y$ such that $p\le q\circ (f\times f)$ . We consider the category $\mathcal{V}\textrm{-}\mathsf{Rel}$ whose objects are ${\mathcal{V}}$ -valued relations and arrows are as above.

The bifibration of ${\mathcal{V}}$ -valued predicates. The forgetful functor $\mathcal{V}\textrm{-}\mathsf{Pred}\to\mathsf{Set}$ mapping a predicate $p:X\to{\mathcal{V}}$ to X is a bifibration. The fibre ${\mathcal{V}\textrm{-}\mathsf{Pred}_{X}}$ is the lattice of ${\mathcal{V}}$ -valued predicates on X. For $f:X\to Y$ in $\mathsf{Set}$ the reindexing and direct image functors on a predicate $p\in{\mathcal{V}\textrm{-}\mathsf{Pred}_{Y}}$ are given by

The bifibration $\mathcal{V}\textrm{-}\mathsf{Pred}\to\mathsf{Set}$ has the Beck-Chevalley condition for weak pullback squares in $\mathsf{Set}$ . Essentially, we have to show that if (4) is a weak pullback, then for every $p\in\mathcal{V}\textrm{-}\mathsf{Pred}_C$ and $b\in B$ we have

(6) \begin{equation*} \bigvee\limits_{a\in f^{-1}(b)} p(u(a))= \bigvee\limits_{c\in g^{-1}(v(b))}p(c)\end{equation*}

Proving $\le$ is easy (we just use that the square commutes), but for $\ge$ we need that (4) is a weak pullback.

The bifibration of ${\mathcal{V}}$ -valued relations. Notice that we have the following pullback in $\mathsf{Cat}$ , where ${\Delta} X=X\times X$ . This is a change-of-base situation and thus the functor $\mathcal{V}\textrm{-}\mathsf{Rel}\to\mathsf{Set}$ mapping each ${\mathcal{V}}$ -valued relation to its underlying set is also a bifibration.

We denote by ${{\mathcal{V}\textrm{-}\mathsf{Rel}_{X}}}$ the fibre above a set X. For each set X, the functor ${{\iota}}$ restricts to an isomorphism $ {{\iota_{X}}}:{{\mathcal{V}\textrm{-}\mathsf{Rel}_{X}}}\to{\mathcal{V}\textrm{-}\mathsf{Pred}_{X\times X}}\,.$

For $f:X\to Y$ in $\mathsf{Set}$ the reindexing and direct image on $p\in{{\mathcal{V}\textrm{-}\mathsf{Rel}_{Y}}}$ are given by

\begin{equation*}{f^*}(p)=p\circ (f\times f) \qquad \text{ and } \qquad{\Sigma_{f}}(p)(y)=\bigvee\{p(x,x')\mid (x,x')\in (f\times f)^{-1}(y,y')\}\,.\end{equation*}

For two relations $p,q\in \mathcal{V}\textrm{-}\mathsf{Rel}_X$ , we define their composition $p{\boldsymbol{\ \cdot\ }} q\colon X\times X \to {\mathcal{V}}$ by $p{\boldsymbol{\ \cdot\ }} q (x,y) =\bigvee \{p(x,z) \otimes q(z,y)\mid z\in X\}$ . We define the diagonal relation ${\mathit{diag}_{X}}\in {{\mathcal{V}\textrm{-}\mathsf{Rel}_{X}}} $ by ${\mathit{diag}_{X}}(x,y)=1$ if $x=y$ and $\bot$ otherwise.

Definition 11. We say that a ${\mathcal{V}}$ -valued relation $r:X\times X\to{\mathcal{V}}$ is

  • reflexive if for all $x\in X$ we have $r(x,x)\ge 1$ , (i.e. $r\ge {\mathit{diag}_{X}}$ );

  • transitive if $r{\boldsymbol{\ \cdot\ }} r\le r$ ;

  • symmetric if $r=r\circ {\mathsf{sym}_{X}}$ , where ${\mathsf{sym}_{X}}\colon X\times X\to X\times X$ is the symmetry isomorphism.

We denote by $\mathcal{V}\textrm{-}\mathsf{Cat}$ the full subcategory of $\mathcal{V}\textrm{-}\mathsf{Rel}$ consisting of reflexive, transitive relations and by $\mathcal{V}\textrm{-}\mathsf{Cat}_\mathsf{sym}$ the full subcategory of $\mathcal{V}\textrm{-}\mathsf{Rel}$ that are additionally symmetric.

Note that $\mathcal{V}\textrm{-}\mathsf{Cat}$ is the category of small categories enriched over the ${\mathcal{V}}$ in the sense of Kelly (Reference Kelly1982).

Example 12. For ${\mathcal{V}}=2$ , ${\mathcal{V}}$ -valued relations are just relations. Reflexivity, transitivity and symmetry coincide with the standard notions, so $\mathcal{V}\textrm{-}\mathsf{Cat}$ is the category of preorders, while $\mathcal{V}\textrm{-}\mathsf{Cat}_\mathsf{sym}$ is the category of equivalence relations.

For ${\mathcal{V}}=[0,\infty]$ , $\mathcal{V}\textrm{-}\mathsf{Cat}$ is the category of generalized metric spaces à la Lawvere (Reference Lawvere Lawvere 2002 ) (i.e. directed pseudo-metrics and non-expansive maps), while $\mathcal{V}\textrm{-}\mathsf{Cat}_\mathsf{sym}$ is the one of pseudo-metrics.

Similar categories of quantale-valued relations have been used in the context of lambda calculus and thus higher-order languages (Pistone Reference Pistone2021).

5. Lifting Functors to ${\mathcal{V}}$ - $\mathsf{Pred}$ and ${\mathcal{V}}$ - $\mathsf{Rel}$

In the previous section, we have introduced the fibrations of interest for quantitative reasoning. In order to deal with coinductive predicates in this setting, it is convenient to have a structured way to lift $\mathsf{Set}$ -functors to ${\mathcal{V}}$ -valued predicates and relations and eventually to ${\mathcal{V}}$ -enriched categories. Our strategy is to first lift functors to $\mathcal{V}\textrm{-}\mathsf{Pred}$ and then, by exploiting the change of base, move these liftings to $\mathcal{V}\textrm{-}\mathsf{Rel}$ . A comparison with the extensions of $\mathsf{Set}$ -monads to the bicategory of ${\mathcal{V}}$ -matrices (Hofmann Reference Hofmann2007) is provided in Section 9.

5.1 ${\mathcal{V}}$ -predicate liftings

Liftings of $\mathsf{Set}$ -functors to the category $\mathsf{Pred}$ (for ${\mathcal{V}} = 2$ ) of predicates have been widely studied in the context of coalgebraic modal logic, as they correspond to modal operators (see e.g. Schröder Reference Schröder2008). For $\mathcal{V}\textrm{-}\mathsf{Pred}$ , we proceed in a similar way. Let us analyse what it means to have a fibred lifting ${\widehat{F}}$ to $\mathcal{V}\textrm{-}\mathsf{Pred}$ of an endofunctor F on $\mathsf{Set}$ . First, recall that the fibre ${\mathcal{V}\textrm{-}\mathsf{Pred}_{X}}$ is just the poset ${\mathcal{V}}^X$ . So the restriction ${\widehat{F}_{X}}$ to such a fibre corresponds to a monotone map ${\mathcal{V}}^X\to{\mathcal{V}}^{FX}$ . The fact that ${\widehat{F}}$ is a fibred lifting essentially means that the maps $({\mathcal{V}}^X\to{\mathcal{V}}^{FX})_{X}$ form a natural transformation between the contravariant functors ${\mathcal{V}}^{-}$ and ${\mathcal{V}}^{F-}$ . Furthermore, by Yoneda lemma we know that natural transformations ${\mathcal{V}}^-\Rightarrow{\mathcal{V}}^{F-}$ are in one-to-one correspondence with maps $\mathit{ev}:F{\mathcal{V}}\to{\mathcal{V}}$ , which we will call hereafter evaluation maps.

One can characterize the evaluation maps which correspond to the monotone natural transformations. In Proposition 14, we show that these are the monotone evaluation maps $\mathit{ev}:(F{\mathcal{V}},{\ll})\to({\mathcal{V}},\le)$ with respect to the usual order $\le$ on ${\mathcal{V}}$ and an order ${\ll}$ on $F{\mathcal{V}}$ defined below and obtained by applying the standard canonical relation lifting of F – in the sense of Barr (Reference Barr1970) – to the relation $\le$ . Explicitly, we apply the functor F to the relation $\le$ seen as the span below in order to obtain a relation on $F{\mathcal{V}}$ . Note that $[{\le}] = \{(v_1,v_2)\in {\mathcal{V}}\times{\mathcal{V}}\mid v_1 \le v_2)\}$ and o is the embedding of $[\le]$ in ${\mathcal{V}}\times{\mathcal{V}}$ .

Definition 13 (Relation ${\ll}$ on $F{\mathcal{V}}$ ). We define a relation ${{\ll}}$ on $F{\mathcal{V}}$ : let $v_1,v_2\in F{\mathcal{V}}$ . We define $v_1{\ll} v_2$ whenever

\begin{equation*} \exists r\in F[\le] \mbox{ s.t. } F(\pi_1\circ o)(r) = v_1\mbox{ and } F(\pi_2\circ o)(r) = v_2 \end{equation*}

The relation ${\ll}$ will also be denoted by $\le^F$ (i.e. the order $\le$ lifted under F via the standard relation lifting Barr Reference Barr1970).

According to Balan and Kurz (Reference Balan and Kurz2011) relation lifting transforms preorders into preorders whenever F preserves weak pullbacks (but not necessarily orders into orders).

Proposition 14. There is a bijective correspondence between

  • fibred liftings ${\widehat{F}}$ of F to $\mathcal{V}\textrm{-}\mathsf{Pred}$ ,

  • monotone natural transformations ${\mathcal{V}}^-\Rightarrow{\mathcal{V}}^{F-}$ ,

  • monotone evaluation maps $\mathit{ev}:F{\mathcal{V}}\to{\mathcal{V}}$ .

Proof. The equivalence of the first two bullets is well-known in coalgebraic modal logic for ${\mathcal{V}}=2$ . For the sake of completeness, we include here full details.

${\widehat{F}}$ is a lifting of F to $\mathcal{V}\textrm{-}\mathsf{Pred}$ if and only if the following two conditions are met for all sets X and functions $f\colon X\to Y$ :

  1. (1) ${\widehat{F}_{X}}\colon{\mathcal{V}\textrm{-}\mathsf{Pred}_{X}}\to{\mathcal{V}\textrm{-}\mathsf{Pred}_{FX}}$ is monotone, and,

  2. (2) the inequality ${\widehat{F}_{X}}\circ {f^*}(R)\le{({Ff})^*}\circ{\widehat{F}_{Y}}$ holds.

These two conditions alone are equivalent to the laxness of the following square

However, ${\widehat{F}}$ is a fibred lifting of F if and only if item 1 holds and the inequality in item 2 above is in fact an equality. Hence, ${\widehat{F}}$ is a fibred lifting if and only if the above square is actually commutative, which amounts to the existence of a natural transformation $\gamma\colon{\mathcal{V}}^{-}\to{\mathcal{V}}^{F-}$ with each component $\gamma_X$ being monotone.

We have thus proved the equivalence of the first two conditions. Now, let us turn to the equivalence between the first and third one. By Yoneda lemma, we know that natural transformations ${\mathcal{V}}^{-}\to{\mathcal{V}}^{F-}$ are in one-to-one correspondence with evaluation maps $\mathit{ev}\colon F({\mathcal{V}})\to{\mathcal{V}}$ . It remains to characterize the monotonicity condition. We show that this is equivalent to requiring that $\mathit{ev}_F\colon F{\mathcal{V}}\to {\mathcal{V}}$ is monotone for the order ${\ll}$ on $F{\mathcal{V}}$ and $\le$ on ${\mathcal{V}}$ .

$\Leftarrow$ ’ Assume that $\mathit{ev}_F$ is monotone and take $f_1,f_2\colon X\to {\mathcal{V}}$ such that $f_1\le f_2$ . This means that $\langle{f_1},{f_2}\rangle$ factors through o as depicted below, where $u\colon X\to [\le]$ is defined as $u(x) = (f_1(x),f_2(x))$ .

If we apply F to the diagram above and post-compose with $F\pi_1,F\pi_2,\mathit{ev}_F$ , we obtain the following diagram.

Let $t\in FX$ . Our aim is to show ${\widehat{F}} f_1(t) \le {\widehat{F}} f_2(t)$ , which implies ${\widehat{F}} f_1 \le {\widehat{F}} f_2$ .

First, define $r = Fu(t) \in F[\le]$ . Now observe that $F(\pi_1\circ o)(r) = F(\pi_1\circ o\circ u)(t) = F(\pi_1\circ \langle{f_1},{f_2}\rangle)(t) = Ff_1(t)$ . Analogously, $F(\pi_2\circ o)(r) = Ff_2(t)$ . Hence $Ff_1(t) {\ll} Ff_2(t)$ .

Using the monotonicity of $\mathit{ev}_F,$ we can conclude that

\begin{equation*}{\widehat{F}} f_1(t) = \mathit{ev}_F(Ff_1(t)) \le \mathit{ev}_F(Ff_2(t)) = {\widehat{F}} f_2(t)\,.\end{equation*}

$\Rightarrow$ ’ Assume that ${\widehat{F}}$ is monotone. In order to show monotonicity of $\mathit{ev}_F,$ take $v_1,v_2\in F{\mathcal{V}}$ such that $v_1{\ll} v_2$ . This means that there exists $r\in F[\le]$ such that $F(\pi_1\circ o)(r) = v_1$ , $F(\pi_2\circ o)(r) = v_2$ .

Now consider $\pi_1\circ o$ , $\pi_2\circ o\colon [\le]\to {\mathcal{V}}$ . It holds that $\pi_1\circ o\le \pi_2\circ o$ and with monotonicity of ${\widehat{F}}$ we can conclude ${\widehat{F}}(\pi_1\circ o) \le {\widehat{F}}(\pi_2\circ o)$ . Hence,

that is, we have shown that $\mathit{ev}_F$ is monotone.

Notice that the correspondence between fibred liftings and monotone evaluation maps is given in one direction by $\mathit{ev}={\widehat{F}}(\mathit{id}_{\mathcal{V}})$ , and conversely, by ${\widehat{F}}(p\colon X\to{\mathcal{V}})=\mathit{ev}\circ F(p)$ .

Evaluation maps as Eilenberg-Moore algebras. Evaluation maps have also been extensively considered in the coalgebraic approach to modal logics (Schröder Reference Schröder2008). A special kind of evaluation map arises when the truth values ${\mathcal{V}}$ have an algebraic structure for a given monad $(T,\mu,\eta)$ , that is, we have ${\mathcal{V}}=T{\Omega}$ for some object ${\Omega}$ and the evaluation map $T{\mathcal{V}}\to{\mathcal{V}}$ is an Eilenberg-Moore algebra for T. This notion of monadic modality has been studied in Hasuo (Reference Hasuo2015) where the category of free algebras for T was assumed to be order enriched. In Lemma 15 below we show that under reasonable assumptions, the evaluation map obtained as the free Eilenberg-Moore algebra on ${\Omega}$ (i.e. $\mathit{ev}\colon T{\mathcal{V}}\to{\mathcal{V}}$ is just $\mu_{{\Omega}}\colon T^2{\Omega}\to T{\Omega}$ ) is a monotone evaluation map, and hence gives rise to a fibred lifting of T.

Lemma 15. Assume that T is a monad and ${\mathcal{V}} = T{\Omega}$ a quantale as detailed above. Assume that there is a partial order $\sqsubseteq$ on ${\Omega}$ such that the lattice order $\le$ of the quantale is obtained by lifting $\sqsubseteq$ under T, that is, $\le\ =\ \sqsubseteq^T$ (as in Definition 13). Then $\mathit{ev}=\mu_{{\Omega}}\colon (T{\mathcal{V}},\le^T) \to ({\mathcal{V}},\le)$ is monotone, and consequently corresponds to a fibred lifting ${\widehat{T}}$ of T.

Proof. Let $t'_1,t'_2\in T{\mathcal{V}}$ such that $t'_1{\ll} t'_2$ , that is, $t'_1\le^T t'_2$ . We have to show that $\mu_{{\Omega}}(t'_1) \le \mu_{{\Omega}}(t'_2)$ .

Since $\le$ is obtained by lifting $\sqsubseteq$ under T we can infer that there exists a witness function $w\colon \le\ \to T(\sqsubseteq)$ that assigns to every pair of elements $t_1,t_2\in {\mathcal{V}}$ with $t_1\le t_2$ a witness $w(t_1,t_2)\in T(\sqsubseteq)$ with $T\pi_i(w(t_1,t_2)) = t_i$ . Hence $T\pi_i\circ w = \pi'_i$ , where $\pi_i\colon \sqsubseteq\ \to {{\Omega}}$ and $\pi'_i\colon \le\ \to {\mathcal{V}}$ are the usual projections.

Since $t'_1\le^T t'_2$ , there exists a witness $t'\in T(\le)$ with $T\pi'_i(t') = t'_i$ .

We show that $t = \mu_\sqsubseteq(Tw(t'))$ is a witness for $\mu_{{\Omega}}(t'_1) \le \mu_{{\Omega}}(t'_2)$ . It holds that $T\pi_i\circ \mu_\sqsubseteq \circ Tw = \mu_{{\Omega}}\circ TT\pi_i \circ Tw = \mu_{{\Omega}}\circ T(T\pi_i\circ w) = \mu_{{\Omega}}\circ T\pi'_i$ , where the first equality holds since $\mu$ is a natural transformation. This implies $T\pi_i(t) = (T\pi_i\circ \mu_\sqsubseteq \circ Tw)(t') = (\mu_{{\Omega}}\circ T\pi'_i)(t') = \mu_{{\Omega}}(t'_i)$ .

We provide next several examples of monotone evaluation maps which arise in this fashion.

Example 16. When T is the powerset monad ${\mathcal{P}}$ and ${\Omega}=1,$ we obtain ${\mathcal{V}}=2$ and $\mu_1\colon{\mathcal{P}} 2\to 2$ corresponds to the $\Diamond$ modality, that is, to an existential predicate transformer, see Hasuo (Reference Hasuo2015).

Example 17. When T is the probability distribution functor ${\mathcal{D}}$ on $\mathsf{Set}$ and ${\Omega}=2=\{0,1\}$ equipped with the order $1\sqsubseteq 0,$ we obtain ${\mathcal{V}}=\mathcal{D}\{0,1\}\cong[0,1]$ with the reversed order of the reals, that is, $\le\ = \ \ge_{\mathbb{R}}$ . In this case $\mathit{ev}_\mathcal{D}(f) = \sum_{r\in [0,1]} r\cdot f(r)$ for $f\colon [0,1]\to [0,1]$ a probability distribution (expectation of the identity random variable).

The canonical evaluation map. In the case ${\mathcal{V}}=2$ , there exists a simple way of lifting a functor $F \colon \mathsf{Set}\to\mathsf{Set}$ : given a predicate $p\colon U \rightarrowtail X$ , one defines the canonical predicate lifting ${\widehat{F}_{\mathsf{can}}}(U)$ of F as the epi-mono factorization of $Fp\colon FU \to FX$ . This lifting corresponds to a canonical evaluation map ${\mathsf{true}} \colon 1 \to 2$ which maps the unique element of 1 into the element 1 of the quantale 2. For ${\mathcal{V}}$ -relations, a generalized notion of canonical evaluation map was introduced in Hofmann (Reference Hofmann2007). For $r\in{\mathcal{V,}}$ consider the subset ${\uparrow r}=\{v\in{\mathcal{V}}\mid v\ge r\}$ and write ${\mathsf{true}_{r}}\colon{\uparrow r}\hookrightarrow{\mathcal{V}}$ for the inclusion. Given $u\in F{\mathcal{V,}}$ we write $u\in F({\uparrow r})$ when u is in the image of the injective function $F({\mathsf{true}_{r}})$ . Following Hofmann (Reference Hofmann2007), we define ${\mathit{ev}_{\mathsf{can}}}:F{\mathcal{V}}\to{\mathcal{V}}$ as follows:

\begin{equation*} {\mathit{ev}_{\mathsf{can}}}(u)=\bigvee\{ r\mid u\in F({\uparrow r})\}.\end{equation*}

Example 18. Assume F is the powerset functor ${\mathcal{P}}$ and let $u\in{\mathcal{P}}({\mathcal{V}})$ . We obtain that

\begin{equation*} {\mathit{ev}_{\mathsf{can}}}(u)=\bigvee\{ r\mid u\subseteq\,{\uparrow r}\} \text{, or equivalently, } {\mathit{ev}_{\mathsf{can}}}(u)=\bigwedge u\,. \end{equation*}

When ${\mathcal{V}}=2,$ we obtain ${\mathit{ev}_{\mathsf{can}}}\colon{\mathcal{P}}2\to 2$ given by ${\mathit{ev}_{\mathsf{can}}}(u)= 1$ iff $u=\emptyset$ or $u=\{1\}$ . This corresponds to the $\Box$ operator from modal logic. If ${\mathcal{V}} = [0,\infty]$ we have ${\mathit{ev}_{\mathsf{can}}}(u)=\sup u$ .

Example 19. The canonical evaluation map for the distribution monad ${\mathcal{D}}$ and ${\mathcal{V}}=[0,1]$ is ${\mathit{ev}_{\mathsf{can}}}(f) = \sup_{r\in [0,1]} f(r)$ , which is not the monad multiplication.

The canonical evaluation map ${\mathit{ev}_{\mathsf{can}}}$ is monotone whenever the functor F preserves weak pullbacks (see Lemma 52 in Appendix A). For such functors, by Proposition 14, the map ${\mathit{ev}_{\mathsf{can}}}$ induces a fibred lifting ${\widehat{F}_{\mathsf{can}}}$ of F, called the canonical $\mathcal{V}\textrm{-}\mathsf{Pred}$ -lifting of F and defined by

\begin{equation*} {\widehat{F}_{\mathsf{can}}}(p)(u) = \bigvee\{r\mid F(p)(u)\in F({\uparrow r})\}\ \text{ for } p\in\mathcal{V}\textrm{-}\mathsf{Pred}_X\text{ and } u\in FX\,.\end{equation*}

Example 20. Consider a signature $\Sigma$ and the usual notion of $\Sigma$ -term. We write Var(t) for the set of variables occurring in a $\Sigma$ -term t and $T_\Sigma X$ for the set of $\Sigma$ -terms t such that $Var(t)\subseteq X$ . The assignment $X\mapsto T_\Sigma X$ extends to a functor $T_\Sigma \colon \mathsf{Set} \to \mathsf{Set}$ , which is also known as term monad.

The canonical $\mathcal{V}\textrm{-}\mathsf{Pred}$ -lifting of $T_\Sigma$ is defined for all $p \in \mathcal{V}\textrm{-}\mathsf{Pred}$ and $t\in T_\Sigma X$ by

\begin{equation*} {\widehat{T}_{\Sigma \mathsf{can}}}(p)(t) = \bigwedge_{x\in Var(t)} p(x)\,.\end{equation*}

5.2 From predicates to relations via Wasserstein

We describe next how functor liftings to $\mathcal{V}\textrm{-}\mathsf{Rel}$ can be systematically obtained using the change-of-base situation described above. In particular, we will show how the Wasserstein metric between probability distributions (defined in terms of couplings of distributions) can be naturally modelled in the fibrational setting.

Consider a ${\mathcal{V}}$ -predicate lifting ${\widehat{F}}$ of a $\mathsf{Set}$ -functor F. A natural way to lift F to ${\mathcal{V}}$ -relations using ${\widehat{F}}$ is to regard a ${\mathcal{V}}$ -relation $r\colon X\times X\to{\mathcal{V}}$ as a ${\mathcal{V}}$ -predicate on the product $X\times X$ . Formally, we will use the isomorphism ${{\iota_{X}}}$ described in Section 4. We can apply the functor ${\widehat{F}}$ to the predicate ${{\iota_{X}}}(r)$ in order to obtain the predicate ${\widehat{F}}\circ {{\iota_{X}}}(r)$ on the set $F(X\times X)$ . Ideally, we would want to transform this predicate into a relation on FX. So first, we have to transform it into a predicate on $FX\times FX$ . To this end, we use the natural transformation


We drop the superscript and simply write ${\lambda}$ when the functor F is clear from the context. Additionally, the bifibrational structure of $\mathcal{V}\textrm{-}\mathsf{Rel}$ plays a crucial role, as we can use the direct image functor ${\Sigma_{{\lambda}_{X}}}$ to transform ${\widehat{F}}\circ {{\iota_{X}}}(r)$ into a predicate on $FX\times FX$ . Putting all the pieces together, we define a lifting of F on the fibre ${{\mathcal{V}\textrm{-}\mathsf{Rel}_{X}}}$ as the composite ${W({\widehat{F}})}_X$ given by:


Remark 21. The notation ${W({\widehat{F}})}$ emphasizes the dependence on the given ${\mathcal{V}}$ -predicate lifting ${\widehat{F}}$ . However, for ease of notation and if no confusion can arise, we will in the following often abbreviate ${W({\widehat{F}})}$ by ${\overline{F}}$ , leaving the underlying predicate lifting implicit. In particular, ${\overline{F}_{\mathsf{can}}}$ is based on the canonical evaluation map, that is ${\overline{F}_{\mathsf{can}}} = {W({\widehat{F}_{\mathsf{can}}})}$ .

We still have to verify that ${W({\widehat{F}})}$ , as explained in Remark 21 hereafter denoted by ${\overline{F}}$ , is indeed a lifting of F to $\mathcal{V}\textrm{-}\mathsf{Rel}$ . The above construction provides the definition of ${\overline{F}}$ on the fibres and, in particular, on the objects of $\mathcal{V}\textrm{-}\mathsf{Rel}$ . For a morphism between ${\mathcal{V}}$ -relations $p\in{{\mathcal{V}\textrm{-}\mathsf{Rel}_{X}}}$ and $q\in{{\mathcal{V}\textrm{-}\mathsf{Rel}_{Y}}}$ , that is, a map $f\colon X\to Y$ such that $p\le {f^*}(q)$ , we define ${\overline{F}}(f)$ as the map $Ff\colon FX\to FY$ . To see that this is well defined, it remains to show that ${\overline{F}} p\le {({Ff})^*}({\overline{F}} q)$ . This is the first part of the next proposition.

Proposition 22. The functor ${\overline{F}} = {W({\widehat{F}})}$ defined above is a well-defined lifting of F to $\mathcal{V}\textrm{-}\mathsf{Rel}$ . Furthermore, when F preserves weak pullbacks and ${\widehat{F}}$ is a fibred lifting of F to $\mathcal{V}\textrm{-}\mathsf{Pred}$ , then ${\overline{F}}$ is a fibred lifting of F to $\mathcal{V}\textrm{-}\mathsf{Rel}$ .

Proof. To prove that ${\overline{F}}$ is a well-defined functor on $\mathcal{V}\textrm{-}\mathsf{Rel,}$ it remains to show that ${\overline{F}} p\le {({Ff})^*}({\overline{F}} q)$ whenever $p\le {f^*} q$ (for $f\colon X\to Y$ ). From the definition of ${\overline{F}}$ as given in (8), we know that on each fibre ${\overline{F}}$ is monotone; hence, ${\overline{F}} p\le{\overline{F}} ({f^*}(q))$ . Hence, it suffices to show that ${\overline{F}} ({f^*}(q))\le {({F f})^*}\circ{\overline{F}}(q)$ .

This follows from the sequence of (in)equalities (9)–(14), where on each line we underlined the sub-expression that was rewritten and which we will explain in turn.

(9) \begin{equation*} {\overline{F}}\circ {f^*}(q) = {{\iota_{FX}}}^{-1} \circ {\Sigma_{{\lambda}_{X}}}\circ{\widehat{F}_{{\Delta} X}}\circ \underline{ {{\iota_{X}}}\circ{f^*}} (q)\end{equation*}

(10) \begin{equation*} ={{\iota_{FX}}}^{-1} \circ {\Sigma_{{\lambda}_{X}}}\circ\underline{{\widehat{F}_{{\Delta} X}}\circ{({{\Delta} f})^*}}\circ {{\iota_{Y}}}(q)\end{equation*}

(11) \begin{equation*}\le {{\iota_{FX}}}^{-1} \circ \underline{{\Sigma_{{\lambda}_{X}}}\circ{({F{\Delta} f})^*}}\circ {\widehat{F}_{{\Delta} Y}}\circ {{\iota_{Y}}}(q)\end{equation*}

(12) \begin{equation*}\le \underline{{{\iota_{FX}}}^{-1} \circ{({{\Delta} F f})^*}}\circ {\Sigma_{{\lambda}_{Y}}}\circ {\widehat{F}_{{\Delta} Y}}\circ {{\iota_{Y}}}(q)\end{equation*}


(14) \begin{equation*}= {({F f})^*}\circ{\overline{F}}(q) \end{equation*}

We obtained (9) and (14) using the definition of ${\overline{F}}$ . To derive the equalities in (10) and (13), we used the fact that ${{\iota}}$ is a fibred lifting of ${\Delta}$ . The inequality (11) follows from the fact that ${\widehat{F}}$ is a lifting of F, and hence, we have the inequality

(15) \begin{equation*} {\widehat{F}_{{\Delta} X}}\circ{({{\Delta} f})^*}\le {({F{\Delta} f})^*}\circ {\widehat{F}_{{\Delta} Y}}\,. \end{equation*}

Finally, the inequality (12) follows from the commutativity of the naturality squares of ${\lambda}$ as an instance of (5).

(16) \begin{equation*} {\Sigma_{{\lambda}_{X}}}\circ{({F{\Delta} f})^*}\le {({{\Delta} Ff})^*}\circ {\Sigma_{{\lambda}_{Y}}}\,. \end{equation*}

Now let us focus on the second part of the proof. Since ${\widehat{F}}$ is a fibred lifting by assumption, then the inequality (15) becomes an equality. When the functor F preserves weak pullbacks, then by Lemma 51 in Appendix A we know that the naturality squares of ${\lambda}$ are weak pullbacks. Hence, since the fibration $\mathcal{V}\textrm{-}\mathsf{Rel}$ has the Beck-Chevalley property for weak pullback squares, it follows that (16) is also an equality. We obtain that all the inequalities (9)–(14) are in fact equalities. This amounts to the fact that ${\overline{F}}$ is a fibred lifting.

Spelling out the concrete description of the direct image functor and of ${\lambda}_X$ , we obtain for a relation $p\in\mathcal{V}\textrm{-}\mathsf{Rel}_{X}$ and $t_1,t_2\in FX$ , that

(17) \begin{equation*} {\overline{F}}(p)(t_1,t_2)=\bigvee\{{\widehat{F}}(p)(t)\mid t\in F(X\times X), F\pi_i(t)=t_i\}\end{equation*}

Unravelling the definition of ${\widehat{F}}(p)(t)=\mathit{ev}\circ F(p)$ , we obtain for ${\overline{F}}(p)$ the same formula as for the extension of F on ${\mathcal{V}}$ -matrices, as given in Hofmann (Reference Hofmann2007, Definition 3.4). This definition in Hofmann (Reference Hofmann2007) is obtained by a direct generalization of the Barr extensions of $\mathsf{Set}$ -functors to the bicategory of relations. In contrast, we obtained (17) by exploiting the fibrational change-of-base situation and by first considering a $\mathcal{V}\textrm{-}\mathsf{Pred}$ -lifting.

We call a lifting of the form ${\overline{F}}$ the Wasserstein lifting of F corresponding to ${\widehat{F}}$ . This terminology is motivated by the next example.

Example 23. When $F = {\mathcal{D}}$ (the distribution functor), ${\mathcal{V}} = [0,1]$ and $ev_F$ is as in Example 17, then ${\overline{F}}$ is the original Wasserstein metric from transportation theory (Villani Reference Villani2009), which – by the Kantorovich-Rubinstein duality – is the same as the Kantorovich metric. Here we compare two probability distributions $t_1,t_2\in {\mathcal{D}} X$ and obtain as a result the coupling $t\in {\mathcal{D}}(X\times X)$ with marginal distributions $t_1,t_2$ , giving us the optimal plan to transport the ‘supply’ $t_1$ to the ‘demand’ $t_2$ . More concretely, given a metric $d\colon X\times X\to {\mathcal{V}}$ , the (discrete) Wasserstein metric is defined as

\begin{equation*} d^W(t_1,t_2) = \inf \{ \sum_{x,y\in X} d(x,y)\cdot t(x,y) \mid \sum_y t(x,y) = t_1(x), \sum_x t(x,y) = t_2(y) \}. \end{equation*}

On the other hand, when $\mathit{ev}_F$ is the canonical evaluation map of Example 19 the corresponding $\mathcal{V}\textrm{-}\mathsf{Rel}$ -lifting ${\overline{F}_{\mathsf{can}}}$ minimizes the longest distance (and hence the required time) rather than the total cost of transport.

Example 24. Let us spell out the definition when $F = {\mathcal{P}}$ (powerset functor), ${\mathcal{V}} = [0,1]$ and $\mathit{ev}_F\colon {\mathcal{P}}[0,1]\to [0,1]$ corresponds to $\sup$ , which is clearly monotone and is the canonical evaluation map as in Example 18.

Then, given a metric $d\colon X\times X\to [0,1]$ and $X_1,X_2\subseteq X$ , the lifted metric is defined as follows (remember that the order is reversed on [0,1]):

\begin{equation*} {\overline{F}}(d)(X_1,X_2) = \inf \{ \sup d[Y] \mid Y \subseteq X\times X, \pi_i[Y] = X_i \} \end{equation*}

As explained in Reference Baldan, Bonchi, Kerstan and König Baldan et al. (2018) , Reference Mémoli Mémoli (2011) , this is the same as the Hausdorff metric $d^H$ defined by:

\begin{equation*} d^H(X_1,X_2) = \sup \{\sup_{x_1\in X_1} \inf_{x_2\in X_2} d(x_1,x_2), \sup_{x_2\in X_2} \inf_{x_1\in X_1} d(x_1,x_2)\} \end{equation*}

Example 25. Recall the ${\widehat{T}_{\Sigma \mathsf{can}}}$ , the canonical $\mathcal{V}\textrm{-}\mathsf{Pred}$ -lifting of the term monad $T_\Sigma$ , from Example 20. We now illustrate $\overline{T_{\Sigma}}_\mathsf{can}$ , the Wasserstein lifting corresponding to ${\widehat{T}_{\Sigma \mathsf{can}}}$ . By (17) we have that for all $d\in \mathcal{V}\textrm{-}\mathsf{Rel}$ and $t_1,t_2\in T_\Sigma X$ , it holds that

\begin{equation*}\overline{T_{\Sigma}}_\mathsf{can}(d)(t_1,t_2) = \bigvee\{{\widehat{T}_{\Sigma \mathsf{can}}}(d)(t)\mid t\in T_\Sigma(X\times X), T_\Sigma\pi_i(t)=t_i\}\end{equation*}

Assume that for $t_1,t_2\in T_\Sigma X,$ there exists a $\Sigma$ -context $C(-_1, \dots, -_n)$ such that $t_1 =C(x_1, \dots, x_n)$ and $t_2=C(y_1,\dots,y_j)$ for $j\in \{1,\dots,n\}$ and variables $x_j,y_j \in X$ . Footnote 1 Then, such a context C is unique and the above set contains exactly one $t \in T_\Sigma (X \times X)$ that is $t = C((x_1,y_1),\dots,(x_n,y_n))$ . Thus, $\overline{T_{\Sigma}}_\mathsf{can}(d)(t_1,t_2) = {\widehat{T}_{\Sigma \mathsf{can}}}(d)( C((x_1,y_1),\dots,(x_n,y_n)))$ that, by definition of ${\widehat{T}_{\Sigma \mathsf{can}}}$ , is $\bigwedge_{j\in \{1,\dots, n\}} d(x_j,y_j)$ . Instead, if such a context C does not exist, then the above set is empty and $\overline{T_{\Sigma}}_\mathsf{can}(d)(t_1,t_2)=\bot$ . In a nutshell,

(18) \begin{equation*} \overline{T_{\Sigma}}_\mathsf{can}(d)(t_1,t_2)= \begin{cases} \bigwedge_{j\in\{1,\dots,n\}} d(x_j,y_j) & \exists C(-_1, \dots, -_n) \text{ such that } \\ & \qquad t_1= C(x_1,\dots,x_n) \text{ and } t_2=C(y_1,\dots,y_n)\\ \bot & \text{otherwise}\\ \end{cases} \end{equation*}

As an example take as terms $t_1=f(g(x),h(y))$ and $t_2=f(g(z),h(x))$ , then the context is $C(-_1, -_2)= f(g(-_1), h(-_2))$ and the term $t\in T_{\Sigma}(X\times X)$ is $t=f(g( (x,z)), h((y,x)))$ . Thus, $\overline{T_{\Sigma}}_\mathsf{can}(d)(t_1,t_2)= d(x,z) \wedge d(y,x)$ . Instead, if one takes $t_1=f(g(x),h(y))$ and $t_2=f(g(z),y)$ , then $\overline{T_{\Sigma}}_\mathsf{can}(d)(t_1,t_2)=\bot$ .

The next lemma establishes that this construction is functorial: liftings of natural transformations to $\mathcal{V}\textrm{-}\mathsf{Pred}$ can be converted into liftings of natural transformations between the corresponding Wasserstein liftings on $\mathcal{V}\textrm{-}\mathsf{Rel}$ .

We now prove the following lemma:

Lemma 26. If there exists a lifting ${\widehat{\zeta}}\colon{\widehat{F}}\Rightarrow{\widehat{G}}$ of a natural transformation ${\zeta}\colon F\Rightarrow G$ , then there exists a lifting ${\overline{\zeta}}\colon{\overline{F}}\Rightarrow{\overline{G}}$ between the corresponding Wasserstein liftings (where ${\overline{F}} = {W({\widehat{F}})}$ , ${\overline{G}} = {W({\widehat{G}})}$ ). Furthermore, when ${\widehat{F}}$ and ${\widehat{G}}$ correspond to monotone evaluation maps $\mathit{ev}_F$ and $\mathit{ev}_G$ , then the lifting ${\widehat{\zeta}}$ exists and is unique if and only if $\mathit{ev}_F\le\mathit{ev}_G\circ{\zeta}_{\mathcal{V}}$ .

Proof. The existence (and in this case uniqueness) of the lifting ${\widehat{\zeta}}$ is equivalent to the fact that ${\widehat{F}_{X}}\le{({{\zeta}_X})^*}\circ{\widehat{G}_{X}}$ for all X. This is fairly standard, but we include here an explanation for the sake of completeness. If ${\widehat{\zeta}}$ exists, then for all $p\in{\mathcal{V}\textrm{-}\mathsf{Pred}_{X}}$ we have the next diagram, where the dashed arrow exists and is unique by the universal property in Definition 4.

Since the fibres in $\mathcal{V}\textrm{-}\mathsf{Pred}$ are posets, this means that ${\widehat{F}}(p)\le{({{\zeta}_X})^*}\circ{\widehat{G}}(p)$ , since there is a unique morphism in the fibre from ${\widehat{F}}(p)$ to ${\widehat{G}}(p)$ . For the same reason, any two liftings of ${\zeta}$ must coincide. Conversely, if the inequality ${\widehat{F}}(p)\le{({{\zeta}_X})^*}\circ{\widehat{G}}(p)$ holds, we compose with ${\widetilde{{\zeta}_X}_{{\widehat{G}}(p)}}$ in order to obtain ${\widehat{\zeta}}_{p}$ .

We have to show that ${\overline{F}_{X}}\le{({{\zeta}_X})^*}\circ{\overline{G}_{X}}$ . We obtain:

To show the inequality on the third line, we notice that ${\Sigma_{{\lambda}_X^F}}\circ{({{\zeta}_{X\times X}})^*} \le {({{\zeta}_X\times {\zeta}_X})^*}\circ {\Sigma_{{\lambda}_X^G}}$ is the mate, as in (5), of the following commutative square, which in turn commutes by the naturality of ${\zeta}$ and the uniqueness of mediating morphisms into the product.

To summarize, the proof of the first part of the lemma follows from the next lax diagram, by composing with the isomorphisms ${{\iota_{X}}}$ and ${{\iota_{FX}}}^{-1}$ .

It remains to prove that ${{\widehat{F}}} \le {\zeta}^*_X\circ {{\widehat{G}}}$ is equivalent to $\mathit{ev}_F\le \mathit{ev}_G\circ {\zeta}_{\mathcal{V}}$ . The implication from left to right is obtained by setting $X = {\mathcal{V}}$ and applying the functors on both sides to $\mathit{id}_{\mathcal{V}}$ . We get the other direction by taking $p\colon X\to {\mathcal{V}}$ and computing $({({{\zeta}_X})^*}\circ {{\widehat{G}}})(p) = \mathit{ev}_G\circ Gp\circ {\zeta}_X = \mathit{ev}_G \circ {\zeta}_V\circ Fp \ge \mathit{ev}_F\circ Fp = {{\widehat{F}}}(p)$ . Note that this uses the naturality of ${\zeta}$ .

5.3 Preservation of reflexivity, symmetry and transitivity

For ${\mathcal{V}}=[0,\infty]$ , one is also interested in lifting functors to the category of (generalized) pseudo-metric spaces, not just of $[0,\infty]$ -valued relations. This motivates the next question: when does the lifting ${\overline{F}}$ restrict to a functor on $\mathcal{V}\textrm{-}\mathsf{Cat}$ and $\mathcal{V}\textrm{-}\mathsf{Cat}_\mathsf{sym}$ ? We have the following characterization theorem, where ${\kappa_{X}}\colon X\to {\mathcal{V}}$ is the constant function $x\mapsto 1$ and $u\otimes v\colon X\to {\mathcal{V}}$ denotes the pointwise tensor of two predicates $u,v\colon X\to {\mathcal{V}}$ , that is, $(u\otimes v)(x)=u(x)\otimes v(x)$ .

Furthermore, let ${{\delta_{X}}}:X\to X\times X$ be the diagonal function on a set X. A relation $r:X\times X\to{\mathcal{V}}$ is reflexive if and only if

(19) \begin{equation*} {{{{\delta_{X}}}}^*}\circ {{\iota_{X}}}(r)\ge {\kappa_{X}}\,.\end{equation*}

Theorem 27. Assume ${\widehat{F}}$ is a lifting of F to $\mathcal{V}\textrm{-}\mathsf{Pred}$ and ${\overline{F}}$ is the corresponding $\mathcal{V}\textrm{-}\mathsf{Rel}$ Wasserstein lifting, that is, ${\overline{F}} = {W({\widehat{F}})}$ . Then

  • If ${\widehat{F}}({\kappa_{X}}) \ge {\kappa_{FX,}}$ then ${\overline{F}}({\mathit{diag}_{X}}) \ge {\mathit{diag}_{FX}}$ ; hence, ${\overline{F}}$ preserves reflexive relations;

  • If ${\widehat{F}}$ is a fibred lifting, F preserves weak pullbacks and ${\widehat{F}}(p\otimes q) \ge {\widehat{F}}(p)\otimes {\widehat{F}}(q);$ then, ${\overline{F}}(p{\boldsymbol{\ \cdot\ }} q) \ge {\overline{F}}(p){\boldsymbol{\ \cdot\ }} {\overline{F}}(q);$ hence, ${\overline{F}}$ preserves transitive relations;

  • ${\overline{F}}$ preserves symmetric relations.

Consequently, when all the above hypotheses are satisfied, then the corresponding $\mathcal{V}\textrm{-}\mathsf{Rel}$ Wasserstein lifting ${\overline{F}}$ restricts to a lifting of F to both $\mathcal{V}\textrm{-}\mathsf{Cat}$ and $\mathcal{V}\textrm{-}\mathsf{Cat}_\mathsf{sym}$ .

For ${\mathcal{V}}=[0,\infty]$ , the first condition of Theorem 27 is a relaxed version of a condition in Baldan et al. (Reference Baldan, Bonchi, Kerstan and König2018, Definition 5.14) used to guarantee reflexivity. The second condition (for transitivity) is equivalent to a non-symmetric variant of a condition in Baldan et al. (Reference Baldan, Bonchi, Kerstan and König2018) (see Lemma 54 in Appendix A).

The proof is immediate from Lemmas 28, 30 and 31 which we prove next.

Lemma 28. Assume ${{\widehat{F}}}$ is a lifting of F such that

\begin{equation*} {{\widehat{F}}}({\kappa_{X}})\ge{\kappa_{FX}}\,. \end{equation*}

Then, ${\overline{F}}({\mathit{diag}_{X}}) \ge {\mathit{diag}_{FX}}$ ; hence, ${\overline{F}}$ preserves reflexive relations.

Proof. Notice that


Using this observation, we obtain that


(21) \begin{equation*} \ge {{\iota_{FX}}}^{-1}\circ{\Sigma_{{\lambda}_{X}}}\circ{\Sigma_{F{{\delta_{X}}}}}\circ {\widehat{F}} ({\kappa_{X}})\end{equation*}

(22) \begin{equation*} \ge {{\iota_{FX}}}^{-1}\circ{\Sigma_{{\lambda}_{X}}}\circ{\Sigma_{F{{\delta_{X}}}}} ({\kappa_{FX}})\end{equation*}

(23) \begin{equation*} = {{\iota_{FX}}}^{-1}\circ{\Sigma_{{{\delta_{FX}}}}} ({\kappa_{FX}})\end{equation*}

(24) \begin{equation*} = {\mathit{diag}_{FX}}\end{equation*}

In (20), we used the definition of ${\overline{F}}$ . For the inequality (21), we used that ${\widehat{F}}$ is a lifting of F and the mate of (3), that is, ${\widehat{F}}\circ {\Sigma_{{{\delta_{X}}}}}\ge {\Sigma_{F{{\delta_{X}}}}}\circ {\widehat{F}}$ . The inequality (22) is the hypothesis, while in (23) we used that ${\lambda}_{X}\circ F{{\delta_{X}}}={{\delta_{FX}}}$ .

Preservation of reflexive relations is now immediate. For $r\in\mathcal{V}\textrm{-}\mathsf{Rel}_{X}$ is reflexive when $r\ge{\mathit{diag}_{X}}$ . Hence, ${\overline{F}}(r)\ge{\overline{F}}({\mathit{diag}_{X}})\ge{\mathit{diag}_{FX}}$ , which entails that ${\overline{F}}$ is reflexive.

We now turn our attention to the preservation of composition of relations and of the transitivity property.

We will use the notations $\pi_i:X\times X\times X\to X$ to denote the $i\textrm{th}$ projection on $X^3$ and $\tau_i:FX\times FX\times FX\to FX$ to denote the $i\textrm{th}$ projection on $(FX)^3$ .

We will use the fact that the composition $p{\boldsymbol{\ \cdot\ }} q$ of two relations $p,q\colon X\times X\to {\mathcal{V}}$ can be written as the composite

(25) \begin{equation*} p{\boldsymbol{\ \cdot\ }} q={{\iota_{X}}}^{-1}{\Sigma_{\langle{\pi_1},{\pi_3}\rangle}}({{\langle{\pi_2},{\pi_3}\rangle}^*}({{\iota_{X}}}q) \otimes {{\langle{\pi_1},{\pi_2}\rangle}^*}({{\iota_{X}}}p))\end{equation*}

Lemma 29. Assume F preserves weak pullbacks and $u,w\colon F(X\times X)\to {\mathcal{V}}$ are in ${\mathcal{V}\textrm{-}\mathsf{Pred}_{F(X\times X)}}$ . We denote by $\nu_X\colon F(X^3)\to (FX)^3$ the map defined as $\nu_X = \langle F\pi_1,F\pi_2,F\pi_3\rangle$ . Then we have: ${\Sigma_{\nu_X}}({({F\langle{\pi_2},{\pi_3}\rangle})^*}(u)\otimes{({F\langle{\pi_1},{\pi_2}\rangle})^*}(w))={{\langle{\tau_2},{\tau_3}\rangle}^*}{\Sigma_{{\lambda}_X}}(u)\otimes{{\langle{\tau_1},{\tau_2}\rangle}^*}{\Sigma_{{\lambda}_X}}(w)$ .

Proof. It is easy to verify that the square below is a pullback.

By applying F to the diagram, we obtain the diagram below where the square is a weak pullback (since F preserves weak pullbacks).

Using this diagram, we can show that the square below is a weak pullback as well.

Assume that $t_1,t_2\in F(X^2)$ , $(s_1,s_2,s_3)\in (FX)^3$ are given such that ${\lambda}_X(t_1) = (s_2,s_3)$ (which means $F\pi_1(t_1) = s_2$ , $F\pi_2(t_1) = s_3$ ) and ${\lambda}_X(t_2) = (s_1,s_2)$ (which means $F\pi_1(t_2) = s_1$ , $F\pi_2(t_2) = s_2$ ). That is, $t_1,t_2$ live on the middle level and $s_3,s_2,s_1$ on the lower level (in that order) in the diagram above. Since the square is a weak pullback, there exists $t\in F(X^3)$ such that $F\langle{\pi_2},{\pi_3}\rangle(t) = t_1$ and $F\langle{\pi_1},{\pi_2}\rangle(t) = t_2$ . It remains to verify that $\nu_X(t) = (s_1,s_2,s_3)$ : for instance $F\pi_1(t) = (F\pi_1\circ F\langle{\pi_1},{\pi_2}\rangle)(t) = F\pi_1(t_2) = s_1$ . (Analogously for $s_2,s_3$ .)

Since the Beck-Chevalley condition holds, we obtain

\begin{equation*} {\Sigma_{\nu_X}}{{\langle{F\langle{\pi_2},{\pi_3}\rangle},{}\rangle {F\langle{\pi_1},{\pi_2}\rangle}}^*} = {{\langle{\langle{\tau_2},{\tau_3}\rangle},{\langle{\tau_1},{\tau_2}\rangle}\rangle}^*}{\Sigma_{{\lambda}_X\times {\lambda}_X}}. \end{equation*}

Then, we will apply this to a predicate of the form $\otimes \circ (u\times w)$ and using the facts

  • ${{\langle{h_1},{h_2}\rangle}^*}(\otimes\circ(u\times w))={{h_1}^*}(u) \otimes {{h_2}^*}(w)$ .

  • ${\Sigma_{f\times f}}(\otimes\circ (u\times w)) = \otimes \circ({\Sigma_{f}}(u)\times {\Sigma_{f}}(w))$ .

we derive the desired equality.

While the first item above is straightforward, the second has to be further explained. Whenever $f\colon X\to Y$ , $p,p'\colon X\to {\mathcal{V}}$ , $y,y'\in Y$ , we have (using distributivity):

Lemma 30. Assume F preserves weak pullbacks and ${{\widehat{F}}}$ is a fibred lifting of F such that

(26) \begin{equation*} {{\widehat{F}}}(u\otimes v)\ge{{\widehat{F}}}(u)\otimes{{\widehat{F}}}(v) \end{equation*}

Then, ${\overline{F}}(p{\boldsymbol{\ \cdot\ }} q) \ge {\overline{F}}(p){\boldsymbol{\ \cdot\ }} {\overline{F}}(q);$ hence, ${\overline{F}}$ preserves transitive relations.

Proof. We denote by $\nu_X\colon F(X^3)\to (FX)^3$ the map defined as $\nu_X = \langle F\pi_1,F\pi_2,F\pi_3\rangle$ .


(28) \begin{equation*} \ge {{\iota_{X}}}^{-1}{\Sigma_{{\lambda}_X}}{\Sigma_{F\langle{\pi_1},{\pi_3}\rangle}}{\widehat{F}} ({{\langle{\pi_2},{\pi_3}\rangle}^*}({{\iota_{X}}}q)\otimes{{\langle{\pi_1},{\pi_2}\rangle}^*}({{\iota_{X}}}p))\end{equation*}

(29) \begin{equation*} \ge {{\iota_{X}}}^{-1}{\Sigma_{{\lambda}_X}}{\Sigma_{F\langle{\pi_1},{\pi_3}\rangle}}{\widehat{F}}({{\langle{\pi_2},{\pi_3}\rangle}^*}({{\iota_{X}}}q))\otimes{\widehat{F}}({{\langle{\pi_1},{\pi_2}\rangle}^*}({{\iota_{X}}}p)) \end{equation*}

(30) \begin{equation*} = {{\iota_{X}}}^{-1}{\Sigma_{{\lambda}_X}}{\Sigma_{F\langle{\pi_1},{\pi_3}\rangle}}({{F\langle{\pi_2},{\pi_3}\rangle}^*}{\widehat{F}}({{\iota_{X}}}q)\otimes{{F\langle{\pi_1},{\pi_2}\rangle}^*}{\widehat{F}}({{\iota_{X}}}p)) \end{equation*}

(31) \begin{equation*} = {{\iota_{X}}}^{-1}{\Sigma_{\langle{\tau_1},{\tau_3}\rangle}}{\Sigma_{\nu_X}}({{F\langle{\pi_2},{\pi_3}\rangle}^*}{\widehat{F}}({{\iota_{X}}}q)\otimes{{F\langle{\pi_1},{\pi_2}\rangle}^*}{\widehat{F}}({{\iota_{X}}}p))\end{equation*}

(32) \begin{equation*} ={{\iota_{X}}}^{-1}{\Sigma_{\langle{\tau_1},{\tau_3}\rangle}}({{\langle{\tau_2},{\tau_3}\rangle}^*}{\Sigma_{{\lambda}_X}}({\widehat{F}}({{\iota_{X}}}q))\otimes{{\langle{\tau_1},{\tau_2}\rangle}^*}{\Sigma_{{\lambda}_X}}({\widehat{F}}({{\iota_{X}}}p)))\end{equation*}

(33) \begin{equation*} ={{\iota_{X}}}^{-1}{\Sigma_{\langle{\tau_1},{\tau_3}\rangle}}({{\langle{\tau_2},{\tau_3}\rangle}^*}({{\iota_{X}}}{\overline{F}} q)\otimes{{\langle{\tau_1},{\tau_2}\rangle}^*}({{\iota_{X}}}{\overline{F}} p))\end{equation*}

(34) \begin{equation*} ={\overline{F}} p{\boldsymbol{\ \cdot\ }}{\overline{F}} q \end{equation*}

The equalities (27), (33) and (34) follow by unravelling the definition of ${\overline{F}}$ and from (25). The inequality (28) follows using by the mate of (3). The inequality (29) follows from the hypothesis on ${\widehat{F}}$ . The equality (30) is obtained using the ${\overline{F}}$ is a fibred lifting. To prove the equality in (31), we use that ${\lambda}_X\circ F\langle{\pi_1},{\pi_3}\rangle=\langle{\tau_1},{\tau_3}\rangle\circ\nu_X$ . Finally, (32) follows from Lemma 29.

Assume $r\in\mathcal{V}\textrm{-}\mathsf{Rel}_X$ is transitive, that is, $r{\boldsymbol{\ \cdot\ }} r\le r$ . Then, we have ${\overline{F}} r{\boldsymbol{\ \cdot\ }} {\overline{F}} r\le{\overline{F}}(r{\boldsymbol{\ \cdot\ }} r)\le {\overline{F}} r$ , hence ${\overline{F}} r$ is transitive.

Lemma 31. The Wasserstein lifting preserves symmetric ${\mathcal{V}}$ -valued relations.

Proof. We first observe that the square below commutes.

Knowing that ${\lambda}_X = \langle{F\pi_1^X},{F\pi_2^X}\rangle$ and that ${\mathsf{sym}_{X}} = \langle{\pi_2},{\pi_1^X}\rangle$ , where $\pi_i^X\colon X\times X\to X$ , we can easily show that the square commutes:

Recall that $p\in{{\mathcal{V}\textrm{-}\mathsf{Rel}_{Y}}}$ is symmetric when $p=p\circ {\mathsf{sym}_{Y}}$ . We cannot perform a reindexing along ${\mathsf{sym}_{Y}}$ in the fibration $\mathcal{V}\textrm{-}\mathsf{Rel}$ , since ${\mathsf{sym}_{Y}}$ is not a morphism on Y, but on $Y\times Y$ . Instead, we have that p is symmetric if and only if


in $\mathcal{V}\textrm{-}\mathsf{Pred}$ . Hence, we want to show that for any $r\in{{\mathcal{V}\textrm{-}\mathsf{Rel}_{X}}}$ the implication holds

\begin{equation*}{{\iota_{X}}}r={({{\mathsf{sym}_{X}}})^*}({{\iota_{X}}}r)\Rightarrow {{\iota_{FX}}}{\overline{F}} r={({{\mathsf{sym}_{FX}}})^*}({{\iota_{FX}}}{\overline{F}} r)\end{equation*}

We have the following inequalities:

However, using the idempotency of ${\mathsf{sym}_{FX}}$ and the monotonicity of ${({{\mathsf{sym}_{FX}}})^*}$ from the inequality

\begin{equation*}{{\iota_{FX}}}{\overline{F}} r\le {({{\mathsf{sym}_{FX}}})^*} ({{\iota_{FX}}}{\overline{F}} r)\end{equation*}

that we have just proved above we can infer that the equality also holds.

We can establish generic sufficient conditions on a monotone evaluation map $\mathit{ev}$ so that the corresponding $\mathcal{V}\textrm{-}\mathsf{Pred}$ -lifting ${\widehat{F}}$ satisfies the conditions of Theorem 27. In Proposition 53 in Appendix A, we show that ${\widehat{F}}(p\otimes q)\ge{\widehat{F}}(p)\otimes{\widehat{F}}(q)$ holds whenever the map $\otimes\colon{\mathcal{V}}\times{\mathcal{V}}\to{\mathcal{V}}$ is the carrier of a lax morphism in the category of F-algebras between $({\mathcal{V}},\mathit{ev})^2\to({\mathcal{V}},\mathit{ev})$ , that is, $\otimes \circ(\mathit{ev}\times\mathit{ev}) \circ{\lambda}_{\mathcal{V}} \le \mathit{ev} \circ F(\otimes)$ . Furthermore, ${\widehat{F}}({\kappa_{X}})\ge{\kappa_{X}}$ holds whenever the map ${\kappa_{\mathbb{1}}}\colon\mathbb{1}\to{\mathcal{V}}$ is the carrier of a lax morphism from the one-element F-algebra $!\colon F\mathbb{1}\to\mathbb{1}$ to $({\mathcal{V}},\mathit{ev})$ , that is, ${\kappa_{\mathbb{1}}}\circ !\le\mathit{ev}\circ F{\kappa_{\mathbb{1}}}$ . These two requirements correspond to the conditions $(Q_\otimes)$ , respectively $(Q_{k})$ satisfied by a topological theory in the sense of Hofmann (Reference Hofmann2007, Definition 3.1). Since these two are satisfied by the canonical evaluation map ${\mathit{ev}_{\mathsf{can}}}$ , Footnote 2 we immediately obtain

Proposition 32. Whenever F preserves weak pullbacks the canonical lifting ${\widehat{F}_{\mathsf{can}}}$ satisfies the conditions in Theorem 27:

  1. (1) ${\widehat{F}_{\mathsf{can}}}(p\otimes q) \ge {\widehat{F}_{\mathsf{can}}}(p)\otimes {\widehat{F}_{\mathsf{can}}}(q)$ , for all $p,q\in{\mathcal{V}\textrm{-}\mathsf{Pred}_{X}}$ ,

  2. (2) ${\widehat{F}_{\mathsf{can}}}({\kappa_{X}})\ge {\kappa_{X}}$ .

Proof. (1) Given $t\in FX$ , we have on one hand that

and on the other, that

Hence, in order to show the desired inequality it is sufficient to show that

\begin{equation*} Fp(t)\in F({\uparrow r}),\ Fq(t)\in F({\uparrow s})\textrm{ imply } F(p\otimes q)(t) \in F({\uparrow (r\otimes s)})\,. \end{equation*}

Let $r,s\in{\mathcal{V}}$ so that $Fp(t)\in F({\uparrow r})$ and $Fq(t)\in F({\uparrow s})$ . Note that $p\otimes q\colon X\to {\mathcal{V}}$ is the composite:

Hence, $F(p\otimes q)$ is the composite of the arrows on the top line of the diagram below:

Note that the triangle and the square above are commutative. Using the abbreviation $\theta = F((p\times q)\circ {{\delta_{X}}})(t),$ we have that:

(35) \begin{eqnarray*} F(p\otimes q)(t) & = & F(\otimes)(\theta) \end{eqnarray*}

(36) \begin{eqnarray*} ((Fp)(t),(Fq)(t)) & = & {\lambda}_{\mathcal{V}}(\theta)\end{eqnarray*}

From Lemma 51 in Appendix A, we know that the square in the diagram below is a weak pullback.


By hypothesis, we know that there exists $u\in F({\uparrow r})$ and $v\in F({\uparrow s})$ such that $Fp(t) = F{\mathsf{true}_{r}}(u)$ and $Fq(t) = F{\mathsf{true}_{s}}(v)$ . Hence,

\begin{equation*} (F{\mathsf{true}_{r}}\times F{\mathsf{true}_{s}})(u,v)={\lambda}_{\mathcal{V}}(\theta)\,. \end{equation*}

Using the fact that the square (37) is a weak pullback, there exists $w\in F(({\uparrow r})\times ({\uparrow s}))$ such that $F({\mathsf{true}_{r}}\times {\mathsf{true}_{s}})(w) = \theta$ , $F\pi_1(w) = u$ and $F\pi_2(w) = v$ .

Thus far, we have shown that

\begin{equation*} F(p\otimes q)(t)=F(\otimes)(\theta) =F(\otimes)\circ F({\mathsf{true}_{r}}\times {\mathsf{true}_{s}})(w) \end{equation*}

for some $w\in F(({\uparrow r})\times ({\uparrow s}))$ . To finish the proof of the first item, we will prove that $F(\otimes)\circ F({\mathsf{true}_{r}}\times {\mathsf{true}_{s}})$ factors through $F{\mathsf{true}_{r\otimes s}}\colon F({\uparrow (r\otimes s)})\to F{\mathcal{V}}$ .

To this end, notice that due to monotonicity of the tensor product, we know that $({\uparrow r})\otimes ({\uparrow s}) \subseteq \,{\uparrow (r\otimes s)}$ . Hence, $\otimes\colon{\mathcal{V}}\times{\mathcal{V}}\to{\mathcal{V}}$ restricts to a function ${\otimes_{|{\uparrow r},{\uparrow s}}}$ on ${\uparrow r}\times{\uparrow s}$ so that the square below commutes.

Now we put $z:=F(\otimes_{|{\uparrow r},{\uparrow s}})(w)$ and observe that

We conclude that $F(p\otimes q)(t)\in F({\uparrow (r\otimes s)})$ .

(2) Now let us prove the second item. Given $t\in FX$ , we know that

In order to show that ${\widehat{F}_{\mathsf{can}}}{\kappa_{X}}(t) \ge 1$ it is sufficient to prove that $F{\kappa_{X}}(t) \in F({\uparrow {1}})$ .

Let $e\colon X\to {\uparrow {1}}$ a constant mapping with $e(x) = 1$ . Then, the diagram to the left below commutes and by applying the functor F we obtain the diagram below.

Now $F~{\kappa_{X}}(t)=F{\mathsf{true}_{1}}(Fe(t))$ , hence $F~{\kappa_{X}}(t)\in F({\uparrow {1}})$ .

An immediate consequence of Proposition 32 and of Theorem 27 is that the Wasserstein lifting ${\overline{F}_{\mathsf{can}}}$ that corresponds to ${\widehat{F}_{\mathsf{can}}}$ restricts to a lifting of F to both $\mathcal{V}\textrm{-}\mathsf{Cat}$ and $\mathcal{V}\textrm{-}\mathsf{Cat}_\mathsf{sym}$ .

6. Quantitative up-to Techniques

The fibrational constructions of the previous section provide a convenient setting to develop an abstract theory of quantitative up-to techniques. We rely on Bonchi et al. (Reference Bonchi, Petrişan, Pous and Rot2014) and use the generic results for showing compatibility of the various up-to functions.

The coinductive object of interest is the greatest fixpoint of a monotone map b on $\mathcal{V}\textrm{-}\mathsf{Rel}$ , hereafter denoted by $\nu b$ . Recall that an up-to technique, namely a monotone map f on $\mathcal{V}\textrm{-}\mathsf{Rel}$ , is sound whenever $d \le b(f(d))$ implies $d\le \nu b$ , for all $d\in\mathcal{V}\textrm{-}\mathsf{Rel}_X$ ; it is compatible if $f\circ b \le b\circ f$ in the pointwise order. It is well-known that compatibility entails soundness. Another useful property is:

(38) \begin{equation*} \text{if }f \text{ is compatible, then }f(\nu b)\leq \nu b\,.\end{equation*}

Following Bonchi et al. (Reference Bonchi, Petrişan, Pous and Rot2014), we assume hereafter that b can be seen as the composite


where $\xi\colon X\to FX$ is some coalgebra for $F\colon \mathsf{Set} \to \mathsf{Set}$ and ${\tilde{F}}\colon \mathcal{V}\textrm{-}\mathsf{Rel} \to \mathcal{V}\textrm{-}\mathsf{Rel}$ is an arbitrary lifting of F.

We now consider several up-to functions f that can be combined with such a monotone map b.

When F admits a final coalgebra $\omega\colon \Omega\to F\Omega$ , the unique morphism $! \colon X \to \Omega$ induces the behavioural closure up-to technique


where ${\mathit{bhv}}(p)(x,y)=\bigvee\{p(x',y') \mid \ !(x)=\ !(x') \text{ and }!(y)=\ !(y')\}$ . For ${\mathcal{V}}=2$ , behavioural closure corresponds to the usual up-to behavioural equivalence (bisimilarity).

Other immediate generalizations are the up-to reflexivity ( ${\mathit{ref}}$ ), up-to transitivity ( ${\mathit{trn}}$ ) and up-to symmetry