Hostname: page-component-cd9895bd7-fscjk Total loading time: 0 Render date: 2024-12-26T07:50:02.149Z Has data issue: false hasContentIssue false

Up-to techniques for behavioural metrics via fibrations

Published online by Cambridge University Press:  10 July 2023

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

Abstract

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.

Type
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 (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted re-use, distribution and reproduction, provided the original article is properly cited.
Copyright
© 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

(2)

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:

(4)

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

(5)

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

(7)

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:

(8)

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*}

(13)

(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

\begin{equation*}{\mathit{diag}_{X}}={{\iota_{X}}}^{-1}{\Sigma_{{{\delta_{X}}}}}({\kappa_{X}})\,.\end{equation*}

Using this observation, we obtain that

(20)

(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$ .

(27)

(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

\begin{equation*}{{\iota_{Y}}}p={({{\mathsf{sym}_{Y}}})^*}({{\iota_{Y}}}p)\end{equation*}

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.

(37)

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

(39)

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

(40)

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 ( $\mathit{sym}$ ) techniques. Inductively, take $(-)^0 = id\colon {{\mathcal{V}\textrm{-}\mathsf{Rel}_{X}}} \to {{\mathcal{V}\textrm{-}\mathsf{Rel}_{X}}}$ and $(-)^{n+1}= id {\boldsymbol{\ \cdot\ }} ({-})^n$ . Call $diag\colon \mathcal{V}\textrm{-}\mathsf{Rel}_X \to \mathcal{V}\textrm{-}\mathsf{Rel}_X $ the constant function to ${\mathit{diag}_{X}}$ and $inv \colon \mathcal{V}\textrm{-}\mathsf{Rel}_X \to \mathcal{V}\textrm{-}\mathsf{Rel}_X $ be the inversion function mapping d into $d\circ {\mathsf{sym}_{X}}$ . Then ${\mathit{ref}}$ , ${\mathit{trn}}$ and $\mathit{sym}$ are defined as follows.

(41) \begin{equation*} {\mathit{ref}}=id\vee diag \qquad\qquad\qquad {\mathit{trn}}= \bigvee_i ({-})^i \qquad\qquad\qquad \mathit{sym} = id \vee inv \end{equation*}

The last up-to techniques we consider in this paper are quantitative generalizations of the up-to contextual closure. For this, one needs to assume that the coalgebra $\xi\colon X\to FX$ carries a [bialgebra]bialgebras $(X,\alpha\colon TX\to X,\xi\colon X\to FX)$ for some natural transformation ${\zeta}\colon T\circ F\Rightarrow F\circ T$ . For an arbitrary lifting ${\tilde{T}} \colon \mathcal{V}\textrm{-}\mathsf{Rel} \to \mathcal{V}\textrm{-}\mathsf{Rel}$ of $T\colon \mathsf{Set} \to \mathsf{Set}$ , up-to contextual closure is seen as the composite:

(42)

Example 33. The functor $T_\Sigma \colon \mathsf{Set} \to \mathsf{Set}$ from Example 20 carries a monad where the multiplication $\mu_X \colon T_\Sigma T_\Sigma X \to T_\Sigma X$ is just term composition. Given a context C, hereafter we will write $C[t_1, \dots, t_n]$ for an arbitrary element of $T_\Sigma T_\Sigma X$ (a term of terms) and $C(t_1, \dots t_n)$ for the term $\mu_X(C[t_1, \dots, t_n])\in T_\Sigma X$ (term substitution, as before). We will use $T_1$ and $T_2$ for elements of $T_\Sigma T_\Sigma X$ and $t_1,t_2,s_j^1$ and $s_j^2$ for elements of $T_\Sigma X$ .

In this example, we consider the following up-to technique

where $\overline{T_{\Sigma}}_\mathsf{can}$ is defined as in (18) and ${\Sigma_{\mu_X}}$ is the direct image of the multiplication $\mu_X$ . In order to understand why this is a proper generalization of the usual notion of contextual closure of a relation is convenient to spell out the definition. For $d \in \mathcal{V}\textrm{-}\mathsf{Rel}_{T_\Sigma X}$ and $t_1,t_2\in T_\Sigma X$ , we have that

Notice that for ${\mathcal{V}}=2$ , this boils down to the usual notion of contextual closure of a relation.

Example 34. Let ${\mathcal{V}} = [0,1]$ . In Chatzikokolakis et al. (Reference Chatzikokolakis, Palamidessi and Vignudelli2016), the convex closure of $d \in {{\mathcal{V}\textrm{-}\mathsf{Rel}_{{\mathcal{D}}(X)}}}$ is defined for $\Delta,\Theta \in {\mathcal{D}}(X)$ as

\begin{equation*} {\mathit{cvx}}(d)(\Delta,\Theta) = \inf \{\sum_i p_i\cdot d(\Delta_i,\Theta_i) \mid \Delta = \sum_i p_i\cdot \Delta_i, \Theta = \sum_i p_i\cdot \Theta_i\} \end{equation*}

where $\Delta_i,\Theta_i\in{\mathcal{D}}(X)$ , $p_i\in[0,1]$ . This can be obtained as in (42) by taking the Wasserstein lifting $\overline{{\mathcal{D}}}$ of ${\mathcal{D}}$ from Example 23 corresponding to the evaluation map of Example 17, and the free algebra structure on ${\mathcal{D}} X$ given by the monad multiplication $\mu_X\colon {\mathcal{D}} {\mathcal{D}} X \to {\mathcal{D}} X$ . This results in:

Let $\Delta,\Theta\in{\mathcal{D}} X$ and $d\colon {\mathcal{D}} X\times {\mathcal{D}} X\to [0,1]$ . Then, by expanding the definitions of the direct image and of the Wasserstein lifting we obtain:

\begin{eqnarray*} f(d)(\Delta,\Theta) & = & {\Sigma_{\mu_X}}(\overline{{\mathcal{D}}}(d))(\Delta,\theta) \\ & = & \inf\{\overline{{\mathcal{D}}}(d)(\tilde{\Delta},\tilde{\Theta}) \mid \tilde{\Delta},\tilde{\Theta} \in {\mathcal{D}}{\mathcal{D}} X, \mu_X(\tilde{\Delta}) = \Delta, \mu_X(\tilde{\Theta}) = \Theta \} \\ & = & \inf\{\inf\{\widehat{{\mathcal{D}}}(d)(\Gamma) \mid \Gamma\in {\mathcal{D}}({\mathcal{D}} X\times {\mathcal{D}} X), \mathcal{D}\pi_1(\Gamma)=\tilde{\Delta}, \mathcal{D}\pi_2(\Gamma)=\tilde{\Theta}\} \mid \\ && \qquad\qquad \tilde{\Delta},\tilde{\Theta} \in {\mathcal{D}}{\mathcal{D}} X, \mu_X(\tilde{\Delta}) = \Delta, \mu_X(\tilde{\Theta}) = \Theta \} \\ & = & \inf\{\widehat{{\mathcal{D}}}(d)(\Gamma) \mid \Gamma\in {\mathcal{D}}({\mathcal{D}} X\times {\mathcal{D}} X), \mu_X(\mathcal{D}\pi_1(\Gamma))=\Delta, \mu_X(\mathcal{D}\pi_2(\Gamma))=\Theta\} \end{eqnarray*}

Now observe that $\Gamma\in {\mathcal{D}}({\mathcal{D}} X\times {\mathcal{D}} X)$ can be written as a formal sum $\Gamma = \sum_i p_i\cdot (\Delta_i,\Theta_i)$ where $\Delta_i,\Theta_i\in{\mathcal{D}} X$ and $p_i = \Gamma(\Delta_i,\Theta_i)$ . Then,

\begin{eqnarray*} \widehat{\mathcal{D}}(d)(\Gamma) &=& \mathit{ev}(\mathcal{D}(d)(\Gamma)) = \sum_{r\in[0,1]} r\cdot \sum_{\Gamma(\Delta',\Theta')=r} d(\Delta',\Theta') \\ & = & \sum_{\Delta',\Theta'} d(\Delta',\Theta')\cdot \Gamma(\Delta',\Theta') = \sum_i p_i\cdot d(\Delta_i,\Theta_i) \end{eqnarray*}

In addition $\mu_X({\mathcal{D}}\pi_1(\Gamma)) = \Delta$ means $\sum_i p_i\cdot\Delta_i = \Delta$ and similarly $\mu_X({\mathcal{D}}\pi_2(\Gamma)) = \Theta$ means $\sum_i p_i\cdot\Theta_i = \Theta$ . Therefore, $f(d)(\Delta,\Theta) = {\mathit{cvx}}(d)(\Delta,\Theta)$ .

Remark 35. In the following, we will use the convention that b is obtained as in equation (39) and f is as in (42). In addition ${\tilde{F}}$ , ${\tilde{T}}$ are arbitrary liftings of F, T to $\mathcal{V}\textrm{-}\mathsf{Rel}$ . Later, we will restrict to Wasserstein liftings.

6.1 Compatibility for arbitrary liftings

We now study compatibility of the up-to techniques illustrated so far with respect to b as in (39).

With the definitions of ${\mathit{bhv}}$ , ${\mathit{ref}}$ , ${\mathit{trn}}$ , $\mathit{sym}$ and two results in Reference Bonchi, Petrisan, Pous and RotBonchi et al. (2017b ), it is immediate to prove the following.

Proposition 36. Let ${\tilde{F}} \colon \mathcal{V}\textrm{-}\mathsf{Rel} \to \mathcal{V}\textrm{-}\mathsf{Rel}$ be an arbitrary lifting of $F\colon \mathsf{Set} \to \mathsf{Set}$ .

  • If ${\tilde{F}} ({\mathit{diag}_{X}}) \geq {\mathit{diag}_{FX}}$ , then ${\mathit{ref}}$ is b-compatible.

  • If ${\tilde{F}}(p{\boldsymbol{\ \cdot\ }} q) \geq {\tilde{F}}(p) {\boldsymbol{\ \cdot\ }} {\tilde{F}}(q)$ for all $p,q\in \mathcal{V}\textrm{-}\mathsf{Rel}_X$ , then ${\mathit{trn}}$ is b-compatible.

  • If ${\tilde{F}}(d)\circ {\mathsf{sym}_{X}} \leq {\tilde{F}}(d \circ {\mathsf{sym}_{X}})$ , then $\mathit{sym}$ is b-compatible.

  • If ${\tilde{F}}$ is a fibred lifting, then ${\mathit{bhv}}$ is b-compatible.

Proof. Observe that

For up-to context, it is enough to use (Bonchi et al. Reference Bonchi, Petrişan, Pous and Rot2014, Theorem 2) stating the following.

Proposition 37 If there exists a lifting ${\overline{\zeta}}\colon{\tilde{T}}\circ{\tilde{F}}\Rightarrow{\tilde{F}}\circ{\tilde{T}}$ of ${\zeta}$ , then f is b-compatible.

Proof. Follows immediately from Theorem 2 in Bonchi et al. (Reference Bonchi, Petrişan, Pous and Rot2014).

As usual, compatible techniques can be combined either by function composition ( $\circ$ ) or by arbitrary joins ( $\bigvee$ ). For instance, compatibility of up-to metric closure, defined as the composite ${\mathit{mtr}}={\mathit{trn}} \circ \mathit{sym} \circ {\mathit{ref,}}$ follows immediately from compatibility of ${\mathit{trn}}$ , $ \mathit{sym}$ and ${\mathit{ref}}$ . In $\mathcal{V}\textrm{-}\mathsf{Rel}$ there is yet another useful way to combine up-to techniques – called chaining in Chatzikokolakis et al. (Reference Chatzikokolakis, Palamidessi and Vignudelli2016) – and defined as the composition ( ${\boldsymbol{\cdot }}$ ) of relations (for a definition see Section 4)

Proposition 38. Let $g_1,g_2\colon \mathcal{V}\textrm{-}\mathsf{Rel}_X \to \mathcal{V}\textrm{-}\mathsf{Rel}_X$ be arbitrary up-to functions which are compatible with respect to $b\colon \mathcal{V}\textrm{-}\mathsf{Rel}_X \to \mathcal{V}\textrm{-}\mathsf{Rel}_X$ . If ${\tilde{F}}(p{\boldsymbol{\ \cdot\ }} q) \geq {\tilde{F}}(p) {\boldsymbol{\ \cdot\ }} {\tilde{F}}(q)$ for all $p,q\in \mathcal{V}\textrm{-}\mathsf{Rel}_X$ , then $g_1{\boldsymbol{\ \cdot\ }} g_2$ is b-compatible.

Proof. Follows immediately from Proposition 6.3 in Reference Bonchi, Petrisan, Pous and RotBonchi et al. (2017b ).

6.2 Compatibility for Wasserstein lifting

By moving from arbitrary liftings to Wasserstein liftings, it is possible to state more interesting results. First, observe that whenever ${\overline{F}}$ is the Wasserstein lifting corresponding to some $\mathcal{V}\textrm{-}\mathsf{Pred}$ -lifting ${\widehat{F}}$ (i.e. ${\overline{F}} = {W({\widehat{F}})}$ ) which satisfies the conditions of Theorem 27, then the hypotheses of Proposition 36 immediately hold when replacing ${\tilde{F}}$ by ${\overline{F}}$ , so ${\mathit{bhv}}$ , ${\mathit{ref}}$ , ${\mathit{trn}}$ , $\mathit{sym}$ are compatible.

For up-to context, more work is needed. By Proposition 37, to prove compatibility it is enough to find a lifting

\begin{equation*}{\overline{\zeta}}\colon{\overline{T}}\circ{\overline{F}}\Rightarrow{\overline{F}}\circ{\overline{T}}\end{equation*}

of ${\zeta}$ . In order to prove a theorem that establishes sufficient conditions for the existence of such lifting, we first need the following two lemmas.

Remark 39. In the statement of the next results, we use the following notation: let F,T be functors and $\mathit{ev}_F,\mathit{ev}_T$ their evaluation maps, leading to ${\mathcal{V}}$ -predicate liftings ${\widehat{F}}$ , ${\widehat{T}}$ . Notice that ${\widehat{T\circ F}}:={\widehat{T}}\circ{\widehat{F}}$ and ${\widehat{F\circ T}}:={\widehat{F}}\circ{\widehat{T}}$ are liftings of the composite functors $T\circ F$ , respectively $F\circ T$ . As before we are using the convention ${\overline{F}} = {W({\widehat{F}})}$ , ${\overline{T}} = {W({\widehat{T}})}$ . Additionally, we will denote by ${\overline{T\circ F}}$ and ${\overline{F\circ T}}$ the Wasserstein liftings obtained from ${\widehat{T\circ F}}$ , respectively, ${\widehat{F\circ T}}$ as in Section 5. That is, ${\overline{T\circ F}} := {W({\widehat{T\circ F}})}$ , ${\overline{F\circ T}} := {W({\widehat{F\circ T}})}$ .

Lemma 40. Whenever ${\widehat{T}}\circ{\Sigma_{{\lambda^{F}_{X}}}} \le{\Sigma_{T{\lambda^{F}_{X}}}}\circ{\widehat{T}}$ , the identity natural transformation $TF\Rightarrow TF$ lifts to ${\overline{T}}\circ{\overline{F}} \Rightarrow {\overline{T\circ F}}$ .

Proof. We have to show that the (identity) maps underlying the natural transformation are non-expansive, in particular ${\overline{T}}\circ{\overline{F}}(r) \le {\overline{T\circ F}}(r)$ for every r in ${{\mathcal{V}\textrm{-}\mathsf{Rel}_{X}}}$ .

Let ${\lambda^{F}_{X}}\colon F(X\times X)\to FX\times FX$ , ${\lambda^{T}_{FX}}\colon T(FX\times FX)\to TFX\times TFX$ , ${\lambda^{TF}_{X}}\colon TF(X\times X)\to TFX\times TFX$ be the natural transformations on which the three liftings are based. From the uniqueness of the mediating morphism of the product, we obtain ${\lambda^{TF}_{X}} = {\lambda^{T}_{FX}}\circ T{\lambda^{F}_{X}}$ . This yields that ${\Sigma_{\lambda^{TF}_{FX}}}={\Sigma_{\lambda^T_{FX}}}\circ{\Sigma_{T\lambda^F_X}}$ and allows us to prove:

Lemma 41. The identity natural transformation $F\circ T\Rightarrow F\circ T$ lifts to ${\overline{F\circ T}} \Rightarrow {\overline{F}}\circ {\overline{T}}$ .

Proof. It always holds that ${\Sigma_{Ff}}\circ {{\widehat{F}}} \le {{\widehat{F}}}\circ {\Sigma_{f}}$ for all $f\colon X\to Y$ . Indeed, by (3), ${{\widehat{F}}}\circ f^* \le (Ff)^*\circ {{\widehat{F}}}$ holds in $\mathcal{V}\textrm{-}\mathsf{Rel}$ . Then, using the fact that ${\Sigma_{f}}$ , $f^*$ (respectively ${\Sigma_{Ff}}, (Ff)^*$ ) are adjoint, we obtain the desired inequality.

The rest of the proof is analogous to Lemma 40. In particular, the inequality in the computation turns into an equality.

In fact, if we combine Lemmas 40 and 41 (with the roles of T,F switched), we obtain compositionality of the Wasserstein lifting under the additional requirement of Lemma 40. In other words, ${W({\widehat{T}})}\circ {W({\widehat{F}})} = {\overline{T}}\circ{\overline{F}} = {\overline{T\circ F}} ={W({\widehat{T\circ F}})}$ .

Theorem 42. Assume the natural transformation ${\zeta}\colon T\circ F\Rightarrow F\circ T$ lifts to a natural transformation ${\widehat{\zeta}}\colon{\widehat{T}}\circ{\widehat{F}}\Rightarrow{\widehat{F}}\circ{\widehat{T}}$ and that we have ${\widehat{T}}\circ{\Sigma_{{\lambda^{F}_{X}}}} \le{\Sigma_{T{\lambda^{F}_{X}}}}\circ{\widehat{T}}$ . Then, ${\zeta}$ lifts to a distributive law ${\overline{\zeta}}\colon{\overline{T}}\circ{\overline{F}}\Rightarrow{\overline{F}}\circ{\overline{T}}$ .

Proof. We split the proof obligation into three parts:

  1. (1) lifts the identity natural transformation on $T\circ F$ . Its existence is proved using the hypothesis ${\widehat{T}}\circ{\Sigma_{{\lambda^{F}_{X}}}} \le{\Sigma_{T{\lambda^{F}_{X}}}}\circ{\widehat{T}}$ , see Lemma 40.

  2. (2) is obtained by applying Lemma 26 to ${\widehat{\zeta}}$ . Such liftings have already been studied in Baldan et al. (Reference Baldan, Bonchi, Kerstan and König2015).

  3. (3) lifts the identity natural transformation on $F\circ T$ . It exists by Lemma 41.

The first requirement of the previous theorem holds for the canonical $\mathcal{V}\textrm{-}\mathsf{Pred}$ -liftings under mild assumptions on F and T.

Proposition 43. Assume that $\zeta\colon T\circ F\Rightarrow F\circ T$ is a natural transformation and that, furthermore, T preserves weak pullbacks and F preserves intersections. Then, $\zeta$ lifts to a natural transformation $\widehat{\zeta}\colon{\widehat{T}_{\mathsf{can}}}\circ{\widehat{F}_{\mathsf{can}}}\Rightarrow{\widehat{F}_{\mathsf{can}}}\circ{\widehat{T}_{\mathsf{can}}}$ .

Proof. We use the following notations:

\begin{equation*}\mathit{ev}_{TF}:={\mathit{ev}^{T}_{\mathsf{can}}}\circ T({\mathit{ev}^{F}_{\mathsf{can}}})\end{equation*}

and

\begin{equation*}\mathit{ev}_{FT}:={\mathit{ev}^{F}_{\mathsf{can}}}\circ F({\mathit{ev}^{T}_{\mathsf{can}}})\,.\end{equation*}

Notice that $\mathit{ev}_{TF}$ and $\mathit{ev}_{FT}$ are exactly the evaluation maps corresponding to the liftings ${\widehat{T}_{\mathsf{can}}}\circ{\widehat{F}_{\mathsf{can}}}$ , respectively ${\widehat{F}_{\mathsf{can}}}\circ{\widehat{T}_{\mathsf{can}}}$ . Using the second part of Lemma 26, it suffices to show $\mathit{ev}_{TF} \le \mathit{ev}_{FT}\circ \zeta_{\mathcal{V}}$ .

We will consider the inclusion maps ${\mathsf{true}_{r}}\colon {\uparrow r}\to {\mathcal{V}}$ and write $t\in F({\uparrow r})$ for $t\in {\mathsf{true}_{r}}({\uparrow r})$ .

We first consider the diagram below. We will show that the dotted arrow exists and that the resulting square is a weak pullback.

Let $t\in F({\uparrow r})$ . This means that ${\mathit{ev}^{F}_{\mathsf{can}}}(t) = \bigvee \{s\mid t\in F({\uparrow s})\} \ge r$ , since the set contains r itself. Hence, ${\mathit{ev}^{F}_{\mathsf{can}}}$ restricts to ${\mathit{ev}^{F}_{\mathsf{can}}}|_{{\uparrow r}}$ .

In order to show that the square is a weak pullback take $t\in F{\mathcal{V}}$ such that ${\mathit{ev}^{F}_{\mathsf{can}}}(t) = \bigvee\{s\mid t\in F({\uparrow s})\} = \bar{s}\in {\uparrow r}$ , hence $\bar{s} \ge r$ . We have to show that $t\in F({\uparrow r})$ , that is, that r is contained in the set, which we will do by showing that $\{s\mid t\in F({\uparrow s})\}$ is downward-closed and contains its supremum. The set $\{s\mid t\in F({\uparrow s})\}$ is downward-closed since F as a $\mathsf{Set}$ -functor preserves injections with non-empty domains, and hence, $s'\le s$ implies ${\uparrow s}\subseteq \ {\uparrow s}',$ and thus, $F({\uparrow s}) \subseteq F({\uparrow s}')$ . It follows that $t\in F({\uparrow s})$ implies $t\in F({\uparrow s}')$ . If F preserves intersections, the set contains its supremum: $\uparrow\!\bar{s} = \bigcap \{{\uparrow s}\mid t\in F({\uparrow s})\},$ and hence, $F({\uparrow}\bar{s}) = \bigcap \{F({\uparrow s})\mid t\in F({\uparrow s} )\} \ni t$ . This implies $t\in F(\uparrow\!\bar{s}) \subseteq F({\uparrow r})$ , as desired.

Similarly one obtains such a commuting square (not necessarily a weak pullback) for T and ${\mathit{ev}^{T}_{\mathsf{can}}}$ . This results in the following diagram where the right-hand square and the upper ‘square’ commute and the left-hand square is a weak pullback (using pullback preservation of T).

In order to prove that

\begin{equation*}\mathit{ev}_{TF} = {\mathit{ev}^{T}_{\mathsf{can}}}\circ T{\mathit{ev}^{F}_{\mathsf{can}}} \le {\mathit{ev}^{F}_{\mathsf{can}}}\circ F{\mathit{ev}^{T}_{\mathsf{can}}}\circ \zeta_{\mathcal{V}} = \mathit{ev}_{FT}\circ\zeta_{\mathcal{V}}\,,\end{equation*}

let $t\in TF{\mathcal{V}}$ . Since

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

and

\begin{equation*}{\mathit{ev}^{F}_{\mathsf{can}}}(F{\mathit{ev}^{T}_{\mathsf{can}}}(\zeta_{\mathcal{V}}(t))) = \bigvee \{r\mid F{\mathit{ev}^{T}_{\mathsf{can}}}(\zeta_{\mathcal{V}}(t))\in F({\uparrow r})\}\end{equation*}

it suffices to show that

\begin{equation*} T{\mathit{ev}^{F}_{\mathsf{can}}}(t)\in T({\uparrow r})\textrm{ implies } F{\mathit{ev}^{T}_{\mathsf{can}}}(\zeta_{\mathcal{V}}(t))\in F({\uparrow r})\,.\end{equation*}

So let $T{\mathit{ev}^{F}_{\mathsf{can}}}(t)\in T({\uparrow r})$ and the fact that the left-hand square is a weak pullback implies that there exists $t'\in TF({\uparrow r})$ with $TF{\mathsf{true}_{r}}(t') = t$ .

Then, using naturality of $\zeta$ , we obtain

The next proposition establishes sufficient conditions for the second hypothesis of Theorem 42. We require a property on ${\mathcal{V}}$ that holds for the quantales in Example 7 and was also assumed in Hofmann (Reference Hofmann2007). Given $u,v\in{\mathcal{V}}$ we write $u\lll v$ (u is totally below v) if for every $W\subseteq \mathcal{V}$ , $v\le \bigvee W$ implies that there exists $w\in W$ with $u\le w$ . The quantale ${\mathcal{V}}$ is constructively completely distributive iff for all $v\in{\mathcal{V}}$ it holds that $v = \bigvee\{u\in{\mathcal{V}}\mid u\lll v\}$ .

Example 44. In the real interval [0,1], the order $\lll $ coincides with $>_\mathbb{R}$ , whereas in a powerset lattice ${\mathcal{P}} M$ we have that $M_1\lll M_2$ for $M_1,M_2\subseteq M$ whenever $M_1\subseteq M_2$ and $M_1$ contains at most one element. Both lattices are constructively completely distributive.

We now show a result for the canonical predicate lifting. In Appendix B.2, we prove a more general statement (Proposition 56) for arbitrary predicate liftings of T that is useful to guarantee the result for interesting liftings, such as the one in Example 23.

Proposition 45. Assume that T preserves weak pullbacks and that ${\mathcal{V}}$ is constructively completely distributive. Then ${\widehat{T}_{\mathsf{can}}}\circ {\Sigma_{f}} \le {\Sigma_{Tf}}\circ {\widehat{T}_{\mathsf{can}}}$ .

Proof. In Appendix B.2, we prove a more general result (Proposition 56). Proposition 45 follows thus from Proposition 56, whose conditions are shown to be satisfied by the canonical lifting in Lemmas 57 and 58.

Combining Theorem 42 and Propositions 37, 43 and 45, we conclude:

Theorem 46. Let $(X,\alpha\colon TX\to X,\xi\colon X\to FX)$ be a bialgebra for a natural transformation $\zeta\colon T\circ F\Rightarrow F\circ T$ . If ${\mathcal{V}}$ is constructively completely distributive, T preserves weak pullbacks and F preserves intersections, then $f={\overline{T}_{\mathsf{can}}} \circ {\Sigma_{\alpha}}$ is compatible with respect to $b={\overline{F}_{\mathsf{can}}} \circ {{\xi}^*}$ .

When $\alpha$ is the free algebra for a signature $\mu_X\colon T_{\Sigma}T_\Sigma X \to T_{\Sigma}X$ (as in Example 33) and F is a suitable functor, the above theorem guarantees that up-to contextual closure is compatible with respect to b. Then, by (38), it holds that for all terms $t_1,t_2$ and unary contexts C that

\begin{equation*}\nu b (t_1,t_2) \leq \mathit{ctx}(\nu b) (C(t_1),C(t_2)) \leq \nu b(C(t_1),C(t_2))\,,\end{equation*}

where the first inequality follows from the definition of $\mathit{ctx}$ (Example 33) and the second from (38), since $\mathit{ctx}$ is b-compatible.

For ${\mathcal{V}}=2$ , since the canonical quantitative lifting coincides with the relational lifting of the canonical predicate lifting, then $\nu b$ is exactly the standard coalgebraic notion of behavioural equivalence (Hermida and Jacobs Reference Hermida and Jacobs1998). Therefore, the above inequality just means that behavioural equivalence is a congruence.

For ${\mathcal{V}}=[0,\infty]$ instead, this property boils down to non-expansiveness of contexts with respect to the behavioural metric. It is worth to mention that this property often fails in probabilistic process algebras (see e.g. Gebler et al. Reference Gebler, Larsen and Tini2015) when taking the standard Wasserstein lifting which, as shown in Example 23, is not based on the canonical one. We leave as future work to explore the implications of this insight.

7. Example: Distance Between Regular Languages

We will now work out the quantitative version of the up-to congruence technique for non-deterministic automata. We consider the shortest-distinguishing-word-distance ${d_{\mathtt{sdw}}}$ , proposed in Section 2. As explained, we will assume an on-the-fly determinization of the non-deterministic automaton, that is, formally we will work with a coalgebra that corresponds to a deterministic automaton on which we have a join-semilattice structure.

We explain next the various ingredients of the example:

Coalgebra and algebra. As outlined in Section 2 and Example 3, the determinization of an NFA with state space Q is a bialgebra $(X,\alpha,\xi)$ for the distributive law ${\zeta}_X\colon {\mathcal{P}}(2\times X^A)\to 2\times ({\mathcal{P}} X)^A$ , where $X = {\mathcal{P}} Q$ , $\alpha\colon{\mathcal{P}} X\to X$ is given by union and $\xi\colon X\to 2\times X^A$ specifies the DFA structure of the determinization. Hence, we instantiate the generic results in the previous section with $TX={\mathcal{P}} X$ , $FX=2\times X^A$ and ${\zeta}$ as defined in Example 3.

Lifting the functors. We take the quantale ${\mathcal{V}} = [0,1]$ (Example 7) and consider the Wasserstein liftings of the endofunctors F and T to $\mathcal{V}\textrm{-}\mathsf{Rel}$ corresponding to the following evaluation maps:

  • ${\mathit{ev}_{F}}(b,f) := c\cdot \max_{a\in A} f(a)$ , where $b\in \{0,1\}$ , $f\colon A\to [0,1]$ and c is the constant used in ${d_{\mathtt{sdw}}}$ , and,

  • ${\mathit{ev}_{T}}:={\mathit{ev}^{{\mathcal{P}}}_{\mathsf{can}}}=\sup$ , the canonical evaluation map as in Example 18.

These are monotone evaluation maps that satisfy the hypothesis of Theorem 27:

Lemma 47. The evaluation maps ${\mathit{ev}_{F}}$ and ${\mathit{ev}_{T}}$ defined in Section 7 induce liftings which satisfy the requirements of Theorem 27.

Proof. These evaluation maps satisfy the required properties: is the canonical evaluation map (see Section 5), thus the statement follows from Proposition 32. For , notice that this is of the form $g\circ \mathit{ev}$ , where $\mathit{ev}$ satisfies the requirements of Proposition 53 in Appendix A (since it is canonical) and $g\colon {\mathcal{V}}\to {\mathcal{V}}$ with $g(r) = c\cdot r$ is monotone, $g(a\otimes b) \ge g(a)\otimes g(b)$ and $g(1)\ge 1$ . It is thus straightforward to see that fulfils the conditions of Proposition 53 and thus the corresponding lifting, those of Theorem 27.

Hence, the corresponding Wasserstein liftings restrict to $\mathcal{V}\textrm{-}\mathsf{Cat}$ . We computed the Wasserstein lifting of $T={\mathcal{P}}$ in Example 24: applying the lifted functor ${\overline{T}}$ to a map $d\colon X\times X\to [0,1]$ gives us the Hausdorff distance, that is, ${\overline{T}}(d)(X_1,X_2) = d^H(X_1,X_2)$ , where $X_1,X_2\subseteq X$ and $d^H$ denotes the Hausdorff metric based on d. On the other hand, the Wasserstein lifting of F corresponding to ${\mathit{ev}_{F}}$ associates to a metric $d\colon X\times X\to [0,1]$ the metric ${\overline{F}}(d)\colon FX\times FX \to [0,1]$ given by

\begin{equation*} ((b_1,f_1),(b_2,f_2)) \mapsto \left\{ \begin{array}{ll} 1 & \mbox{if $b_1\neq b_2$} \\ \max\limits_{a\in A} c\cdot \{ d(f_1(a),f_2(a)) \} & \mbox{otherwise} \end{array} \right.\end{equation*}

Fixpoint equation. The map b for the fixpoint equation was defined in Section 6 as the composite ${{\xi}^*}\circ{\overline{F}}$ . Using the above lifting ${\overline{F}}$ , this computation yields exactly the map b defined in (2), whose largest fixpoint (smallest with respect to the natural order on the reals) is the shortest-distinguishing-word-distance introduced in Section 2.

Up-to technique. The next step is to determine the map f introduced in Section 6 for the up-to technique and defined as the composite ${\Sigma_{\alpha}}\circ{\overline{T}}$ on $\mathcal{V}\textrm{-}\mathsf{Rel}$ . Combining the definition of the direct image functors on $\mathcal{V}\textrm{-}\mathsf{Rel}$ with the lifting ${\overline{T}}$ , we obtain that

\begin{equation*} f(d)(x_1,x_2) = \inf \{ d^H(X_1,X_2) \mid X_1,X_2 \subseteq X, \alpha(X_i) = x_i\} \end{equation*}

for all maps $d\colon X\times X\to [0,1]$ . To show that $f(d)(Q_1,Q_2) {\le}_{\mathbb{R}} r$ for two sets $Q_1,Q_2\subseteq Q$ (i.e. $Q_1,Q_2\in X$ ) and a constant r, we use the following rules:

$f(d)(\emptyset,\emptyset){\le}_{\mathbb{R}} r$ $\begin{array}{c} d(Q_1,Q_2) {\le}_{\mathbb{R}} r \\ \hline f(d)(Q_1,Q_2) {\le}_{\mathbb{R}} r \end{array}$ $\begin{array}{c} f(d)(Q_1,Q_2) {\le}_{\mathbb{R}} r \quad f(d)(Q'_1,Q'_2) {\le}_{\mathbb{R}} r \\ \hline f(d)(Q_1\cup Q'_1,Q_2\cup Q'_2) {\le}_{\mathbb{R}} r \end{array}$

Lifting of distributive law. In order to prove that the distributive law lifts to $\mathcal{V}\textrm{-}\mathsf{Rel}$ and hence that the up-to technique is sound by virtue of Proposition 37, we can prove that the two conditions of Theorem 42 are met by the $\mathcal{V}\textrm{-}\mathsf{Pred}$ liftings of F and T corresponding to the evaluation maps ${\mathit{ev}_{F}}$ and ${\mathit{ev}_{T}}$ :

Lemma 48. Assume ${\widehat{F}}$ and ${\widehat{T}}$ are the [0,1]- $\mathsf{Pred}$ liftings of $FX=2\times X^A$ and $TX={\mathcal{P}} X$ which correspond to the evaluation maps ${\mathit{ev}_{F}}$ and ${\mathit{ev}_{T}}$ defined in the example in Section 7 . Then, we have:

  1. (1) ${\widehat{T}}\circ{\Sigma_{{\lambda^{F}_{X}}}} \le{\Sigma_{T{\lambda^{F}_{X}}}}\circ{\widehat{T}}$ , and,

  2. (2) ${\zeta}\colon T\circ F\Rightarrow F\circ T$ lifts to a natural transformation ${\widehat{\zeta}}\colon{\widehat{T}}\circ{\widehat{F}}\Rightarrow{\widehat{F}}\circ{\widehat{T}}$

Proof. Recall that on the quantale [0,1] the quantale order is the reversed order on the reals, so in order to avoid confusion we use $\le, \lor,\land$ in the quantale and $\ge_{\mathbb{R}},\inf,\sup$ in the reals.

  1. (1) To prove the first item, we can rely on Proposition 45, since ${\widehat{T}_{\mathsf{can}}}$ is the canonical lifting and we are working in the quantale ${\mathcal{V}}=[0,1]$ , which is constructively completely distributive.

  2. (2) Recall that ${\widehat{T}}\circ{\widehat{F}}$ is a lifting of $T\circ F$ which corresponds to the evaluation map $\mathit{ev}_{TF}={\mathit{ev}_{T}}\circ T({\mathit{ev}_{F}})$ . Similarly, ${\widehat{F}}\circ{\widehat{T}}$ corresponds to the evaluation map $\mathit{ev}_{FT}={\mathit{ev}_{F}}\circ F({\mathit{ev}_{T}})$ . The existence of ${\widehat{\zeta}}$ is then equivalent to the inequality

    (43) \begin{equation*} \mathit{ev}_{TF}\ge_{\mathbb{R}} \mathit{ev}_{FT}\circ \zeta_{\mathcal{V}}\,. \end{equation*}
    Here we are almost in the setting of canonical liftings treated in Proposition 43, apart from the fact that ${\mathit{ev}_{F}}=g\circ{\mathit{ev}^{F}_{\mathsf{can}}}$ , where the function g is given by $g(r) = c\cdot r$ . Recall ${\mathit{ev}_{T}}={\mathit{ev}^{T}_{\mathsf{can}}}$ . Furthermore, T preserves weak pullbacks and F preserves intersections, hence by (the proof of) Proposition 43, we know that
    \begin{equation*} {\mathit{ev}^{T}_{\mathsf{can}}}\circ T({\mathit{ev}^{F}_{\mathsf{can}}})\ge_{\mathbb{R}} {\mathit{ev}^{F}_{\mathsf{can}}}\circ F({\mathit{ev}^{T}_{\mathsf{can}}})\circ \zeta_{\mathcal{V}}\,. \end{equation*}
    In order to obtain the desired lifting of natural transformations, we first notice that ${\mathit{ev}^{T}_{\mathsf{can}}}\circ Tg = g\circ {\mathit{ev}^{T}_{\mathsf{can}}}$ . Indeed, for all $R\subseteq [0,1]$ we have
    \begin{equation*} {\mathit{ev}^{T}_{\mathsf{can}}}(Tg(R)) = \sup c\cdot R = c \cdot \sup R = g({\mathit{ev}^{T}_{\mathsf{can}}}(R))\,.\end{equation*}
    To conclude, we use the above equalities and the monotonicity of g:

Everything combined, we obtain a sound up-to technique, which implies that the reasoning in Section 2 is valid. Furthermore, as the example shows, the up-to technique can significantly simplify behavioural distance arguments and speed up computations.

8. A Detailed Comparison with Chatzikokolakis et al. (Reference Chatzikokolakis, Palamidessi and Vignudelli2016)

In this appendix, we discuss in details the relationship between our work and Chatzikokolakis et al. (Reference Chatzikokolakis, Palamidessi and Vignudelli2016) where a general framework of up-to techniques for behavioural metric is introduced.

The systems of interest in Chatzikokolakis et al. (Reference Chatzikokolakis, Palamidessi and Vignudelli2016) are probabilistic automata which are known (Bartels et al. Reference Bartels, Sokolova and de Vink2004) to be coalgebras for the functor ${\mathcal{P}}(A \times {\mathcal{D}}({-}))$ . The behavioural metrics under consideration are defined as the greatest fixed points of

(44)

where $\xi \colon X \to {\mathcal{P}}(A \times {\mathcal{D}}(X))$ is a probabilistic automaton, $\overline{{\mathcal{P}}(A \times -)}$ is the canonical lifting of ${\mathcal{P}}(A \times -)$ (based on the Hausdorff distance, Example 24) and K is some lifting of ${\mathcal{D}}$ . Please note that the quantale ${\mathcal{V}}$ in Chatzikokolakis et al. (Reference Chatzikokolakis, Palamidessi and Vignudelli2016) is $[0,\infty]$ (Example 7) so the ordering used in this paper and the one in Chatzikokolakis et al. (Reference Chatzikokolakis, Palamidessi and Vignudelli2016) are always inverted.

Observe that the definition of b as in (44) is an instance of (39) by taking ${\tilde{F}} = K \circ \overline{{\mathcal{P}}(A \times -)}$ . It is worth to mention that K in Chatzikokolakis et al. (Reference Chatzikokolakis, Palamidessi and Vignudelli2016) is not arbitrary, but it is supposed to be an instance of a parametric construction called generalized Kantorovic metric. For a certain value of the parameter, this coincides (via the well-known duality) with the Wasserstein metric from transportation theory (Example 23).

The authors of Chatzikokolakis et al. (Reference Chatzikokolakis, Palamidessi and Vignudelli2016) introduced several basic techniques – which can be easily defined in our framework, for example, metric closure (Section 6), convex closure (Example 34) or contextual closure (Example 33) – and combine them via composition ( $\circ$ ), supremum ( $\bigvee$ ) and chaining ( ${\boldsymbol{\cdot }}$ ). In Proposition 38, we have provided sufficient conditions ensuring that ${\boldsymbol{\ \cdot\ }}$ preserves compatibility. The same result for $\circ$ and $\bigvee$ follows immediately from the standard theory of compatible up-to techniques (Pous and Sangiorgi Reference Pous, Sangiorgi, Sangiorgi and Rutten2011). This is not the case for Chatzikokolakis et al. (Reference Chatzikokolakis, Palamidessi and Vignudelli2016), where these results need novel proofs since the basic notions of up-to techniques and compatibility (or respectfulness) do not fit within the standard lattice-theoretic framework.

Indeed in Chatzikokolakis et al. (Reference Chatzikokolakis, Palamidessi and Vignudelli2016), an up-to technique is defined to be some map f of type ${{\mathcal{V}\textrm{-}\mathsf{Rel}_{{\mathcal{D}}(X)}}}\to {{\mathcal{V}\textrm{-}\mathsf{Rel}_{{\mathcal{D}}(X)}}}$ and a bisimulation up-to f to be some $d \in {{\mathcal{V}\textrm{-}\mathsf{Rel}_{X}}}$ such that $d \le ({{\xi}^*} \circ \overline{{\mathcal{P}}}) \circ f \circ K(d)$ . Footnote 3 Soundness is defined in the expected way. The notion to prove soundness (Definition 5 in Chatzikokolakis et al. Reference Chatzikokolakis, Palamidessi and Vignudelli2016) amounts to the following, modulo the usual difference between compatibility and respectfulness (that is well-known and discussed in several papers Reference Bonchi, Petrisan, Pous and RotBonchi et al. 2017b ; Pous Reference Pous2016)

Definition 49. A monotone map $f \colon {{\mathcal{V}\textrm{-}\mathsf{Rel}_{{\mathcal{D}}(X)}}}\to {{\mathcal{V}\textrm{-}\mathsf{Rel}_{{\mathcal{D}}(X)}}}$ is a well-behaved up-to technique iff there exists an $f'\colon {{\mathcal{V}\textrm{-}\mathsf{Rel}_{X}}} \to {{\mathcal{V}\textrm{-}\mathsf{Rel}_{X}}}$ such that

  1. (1) $f \circ K \leq K \circ f'$ and

  2. (2) $f' \circ b \leq b \circ f' $ .

Observe that whenever f is well-behaved, a bisimulation up-to f in the sense of Chatzikokolakis et al. (Reference Chatzikokolakis, Palamidessi and Vignudelli2016) can be transformed into a bisimulation up-to f’ in our sense by means of the first item:

(45) \begin{equation*} d \le ({{\xi}^*} \circ \overline{{\mathcal{P}}(A \times -)}) \circ f \circ K(d) \le ({{\xi}^*} \circ \overline{{\mathcal{P}}(A \times -)}) \circ K \circ f'(d) = b(f'(d))\,.\end{equation*}

Moreover, thanks to the second item, f’ is compatible w.r.t. b.

This observation shows that the techniques in Chatzikokolakis et al. (Reference Chatzikokolakis, Palamidessi and Vignudelli2016) can be reformulated within the standard theory of Pous and Sangiorgi (Reference Pous, Sangiorgi, Sangiorgi and Rutten2011) and thus proved compatible by means of our framework.

Lemma 50. Consider a probabilistic automaton and let K denote a convex (in the sense of Chatzikokolakis et al. Reference Chatzikokolakis, Palamidessi and Vignudelli2016) lifting of the probability distribution functor. Then, a bisimulation metric up-to convex closure in the sense of Chatzikokolakis et al. (Reference Chatzikokolakis, Palamidessi and Vignudelli2016) is exactly a bisimulation metric, that is, a post-fixpoint of b in (44).

Proof. As above, let $\xi\colon X\to {\mathcal{P}}(A \times {\mathcal{D}}(X))$ denote the coalgebra structure corresponding to the probabilistic automaton. The up-to convex closure is defined as in Example 34. Recall that a bisimulation metric up-to convex closure in the sense of Chatzikokolakis et al. (Reference Chatzikokolakis, Palamidessi and Vignudelli2016) is a bisimulation metric d such that d progresses to ${\mathit{cvx}}\circ K(d)$ , written using the notation in Chatzikokolakis et al. (Reference Chatzikokolakis, Palamidessi and Vignudelli2016, Definition 2) as $d\rightarrowtail {\mathit{cvx}}\circ K(d)$ . Spelling out that definition, we obtain that, in the quantale order (i.e. the reversed of the order on the reals used Chatzikokolakis et al. Reference Chatzikokolakis, Palamidessi and Vignudelli2016), we have

(46) \begin{equation*} d\le {{\xi}^*}\circ \overline{{\mathcal{P}}(A \times -)}\circ {\mathit{cvx}}\circ K(d)\,. \end{equation*}

On the other hand, the respectfulness of ${\mathit{cvx}}$ – established via Chatzikokolakis et al. (Reference Chatzikokolakis, Palamidessi and Vignudelli2016, Theorem 11) – uses the fact that for all $d\in\mathcal{V}\textrm{-}\mathsf{Rel}_X$ we have that K(d) is convex; hence, the f’ used above is simply the identity function on $\mathcal{V}\textrm{-}\mathsf{Rel}_{{\mathcal{D}} X}$ . In other words, we have

(47) \begin{equation*} {\mathit{cvx}}\circ K(d)\le K(d) \end{equation*}

Combining (46) and (47), we obtain that

\begin{equation*} d\le {{\xi}^*}\circ \overline{{\mathcal{P}}(A \times -)}\circ K(d)\,, \end{equation*}

or equivalently, that d is simply a bisimulation metric.

9. Related and Future Work

Up-to techniques for behavioural metrics in a probabilistic setting have been considered in Chatzikokolakis et al. (Reference Chatzikokolakis, Palamidessi and Vignudelli2016) using a generalization of the Kantorovich lifting (Chatzikokolakis et al. Reference Chatzikokolakis, Gebler, Palamidessi and Xu2014). In Section 6, we have shown that the basic techniques introduced in Chatzikokolakis et al. (Reference Chatzikokolakis, Palamidessi and Vignudelli2016) (e.g. metric closure, convex closure and contextual closure) as well as the ways to combine them (composition, join and chaining) naturally fit within our framework. The main difference with our approach – beyond the fact that we consider arbitrary coalgebras while the results in Chatzikokolakis et al. (Reference Chatzikokolakis, Palamidessi and Vignudelli2016) just cover coalgebras for a fixed functor – is that the definition of up-to techniques and the criteria to prove their soundness do not fit within the standard framework of Pous and Sangiorgi (Reference Pous, Sangiorgi, Sangiorgi and Rutten2011). Nevertheless, as illustrated by a detailed comparison in Section 8, the techniques of Chatzikokolakis et al. (Reference Chatzikokolakis, Palamidessi and Vignudelli2016) can be reformulated within the standard theory and thus proved sound by means of our framework. An important observation brought to light by compositional methodology inherent to the fibrational approach is that for probabilistic automata,0 a bisimulation metric up-to convexity in the sense of Chatzikokolakis et al. (Reference Chatzikokolakis, Palamidessi and Vignudelli2016) is exactly a bisimulation metric, see Lemma 50. Nevertheless, the up-to convex closure technique can find meaningful applications in linear, trace-based behavioural metrics (see Baldan et al. Reference Baldan, Bonchi, Kerstan and König2015).

The Wasserstein (respectively Kantorovich) lifting of the distribution functor involving couplings was first used for defining behavioural pseudo-metrics using final coalgebras in van Breugel and Worrell (Reference van Breugel and Worrell2001). Our work is based instead on liftings for arbitrary functors, a problem that has been considered in several works (see e.g. Balan et al. Reference Balan, Kurz and Velebil2015; Baldan et al. Reference Baldan, Bonchi, Kerstan and König2018; Hofmann Reference Hofmann2007; Katsumata and Sato Reference Katsumata and Sato2015), despite with different shades. The closest to our approach are Sprunger et al. (Reference Sprunger, ya Katsumata, Dubut and Hasuo2018, 2021), Hofmann (Reference Hofmann2007) and Baldan et al. (Reference Baldan, Bonchi, Kerstan and König2018) that we discuss next.

In Sprunger et al. (Reference Sprunger, ya Katsumata, Dubut and Hasuo2018, 2021), the authors introduce a generalization of the Wasserstein lifting for $\mathit{CLat}_\wedge$ -fibrations, inspired by our original conference publication (Reference Bonchi, König and PetrisanBonchi et al. 2018b ). This construction uses the fact that the functor $\Delta$ has a left adjoint $2\times \_$ , resulting in an adjunction that can be lifted to an adjunction between $\mathcal{V}\textrm{-}\mathsf{Pred}$ and $\mathcal{V}\textrm{-}\mathsf{Rel}$ . Then, ${\overline{F}}$ can be obtained as a pushforward (direct image) along the natural transformation $\theta\colon L F \Delta \Rightarrow F$ and correctness is ensured by Hermida’s adjunction lifting theorem.

In Hofmann (Reference Hofmann2007), Hofmann introduces a generalization of the Barr extension (of $\mathsf{Set}$ -functors to $\mathsf{Rel}$ ), namely he defines extensions of $\mathsf{Set}$ -monads to the bicategory of ${\mathcal{V}}$ -matrices, in which 0-cells are sets and the ${\mathcal{V}}$ -relations are 1-cells. Some of the definitions and techniques do overlap between the developments in Hofmann (Reference Hofmann2007), and the results we presented in Section 5. However, there are also some (subtle) differences which would not allow us to use off the shelf his results.

First, in order to reuse the results in Bonchi et al. (Reference Bonchi, Petrişan, Pous and Rot2014), we need to recast the theory in a fibrational setting, rather than the bicategorical setting of Hofmann (Reference Hofmann2007). The definition of topological theory (Hofmann Reference Hofmann2007, Definition 3.1) comprises what we call an evaluation map, but which additionally has to satisfy various conditions. An important difference with what we do is that the condition $(Q_{\bigvee})$ in the aforementioned definition entails that the predicate lifting one would obtain from such an evaluation map would be an opfibred lifting, rather than a fibred lifting as in our setting. Indeed, the condition $(Q_{\bigvee})$ can be equivalently expressed in terms of a natural transformation involving the covariant functor $P_{\mathcal{V}}$ , as opposed to the contravariant one ${\mathcal{V}}^{-}$ that we used in Section 5.1. Lastly, in our framework we need to work with arbitrary functors, not necessarily carrying a monad structure.

In Baldan et al. (Reference Baldan, Bonchi, Kerstan and König2018), we provided a generic construction for the Wasserstein lifting of a functor to the category of pseudo-metric spaces, rather than on arbitrary quantale-valued relations. The realization that this construction is an instance as a change-of-base situation between $\mathcal{V}\textrm{-}\mathsf{Rel}$ and $\mathcal{V}\textrm{-}\mathsf{Pred}$ allows us to exploit the theory in Bonchi et al. (Reference Bonchi, Petrişan, Pous and Rot2014) for up-to techniques and, as a side result, provides simpler (and cleaner) conditions for the restriction to $\mathcal{V}\textrm{-}\mathsf{Cat}$ (Theorem 27).

We leave for future work several open problems. What is a universal property for the canonical Wasserstein lifting? Secondly, can the Wasserstein liftings presented here be captured in the framework of Balan et al. (Reference Balan, Kurz and Velebil2015) or Katsumata and Sato (Reference Katsumata and Sato2015)? In particular, the relation to codensity liftings (Katsumata and Sato Reference Katsumata and Sato2015; Komorida et al. Reference Komorida, Katsumata, Kupke, Rot and Hasuo2021, Reference Komorida, Katsumata, Hu, Klin and Hasuo2019), a generalized notion of Kantorovich lifting, has to be studied in more detail. A result which shows under which conditions our notion of Wasserstein lifting coincides with the codensity lifting, that is a generalized Kantorovich-Rubinstein result (Villani Reference Villani2009), is non-trivial to obtain and would be of great interest.

We also leave for future work the concrete development of up-to techniques for other quantales than 2 and [0,1]. We are particularly interested in weighted automata (Droste et al. Reference Droste, Kuich and Vogler2009) over quantales and in conditional transition systems, a variant of featured transition systems.

Another interesting question is whether the rule-based reasoning that we employed in Section 8 can be formally seen as an instance of quantitative algebraic reasoning (Mardare et al. Reference Mardare, Panangaden and Plotkin2016; Mio and Vignudelli Reference Mio and Vignudelli2020, Mio et al. Reference Mio, Sarkis and Vignudelli2021).

Finally, we plan to study the setting of Bonchi et al. (Reference Bonchi, Sokolova and Vignudelli2019), which provides an algebraic theory for specifying systems with nondeterminism, probability and termination. We believe that up-to techniques based on such algebraic theories can be defined in a way similar to the contextual closure studied in Example 33. This would enable us to exhibit proof rules to simplify checking behavioural trace distance in such a context.

Acknowledgements

The authors would like to thank the anonymous reviewers for their valuable feedback. Furthermore, we are grateful to Shin-ya Katsumata, Henning Kerstan, Damien Pous and Paolo Baldan for precious suggestions and inspiring discussions and to Thomas Colcombet for the knowledge package used for creating the hyperlinks in this paper.

The first author was supported by the Ministero dell’Universit‘a e della Ricerca of Italy under Grant No. 201784YSZ5, PRIN2017 – ASPRA (Analysis of Program Analyses) and partially supported by Università di Pisa Project PRA-2022-2023 FM4HD. The second author acknowledges support from DFG project SpeQt (project number 434050016).

Competing interests

The author(s) declare none.

Appendix A. Proofs and additional material for Section 5

We now provide several lemmas that are used to prove the results in Section 5. These proofs have been moved to the appendix in order to obtain a more compact structure of the main body of the paper.

Lemma 51 (Corollary 2.7 in Hofmann Reference Hofmann2007). If $F\colon\mathsf{Set}\to\mathsf{Set}$ is weak pullback-preserving, then the naturality squares of the binatural transformation $\langle{F\pi_1d},{,F\pi_2}\rangle\colon F(X\times Y)\to FX\times FY$ are weak pullbacks, where $\pi_1\colon X\times Y\to X$ and $\pi_2\colon X\times Y\to X$ denote the projections. In particular, the naturality squares of the natural transformation ${\lambda}$ are weak pullbacks.

Proof. Consider morphisms $f\colon X\to X'$ and $g\colon Y\to Y'$ . We want to prove that the square

(A1)

is a weak pullback. To this end, we will consider the following diagram:

(A2)

The three squares above are obtained by applying the functor F to weak pullbacks; hence, by the assumption on F, they are also weak pullbacks.

Assume $s'\in F(X')$ and $t'\in F(Y')$ are such that there exist $s\in F(X)$ , $t\in F(Y)$ and $u\in F(X'\times Y')$ satisfying $Ff(s)=s'$ , $Fg(t)=t'$ and $\langle F\pi_1,F\pi_2\rangle(u)=(s',t')$ . Proving that (A1) is a weak pullback amounts to showing the existence of $v\in F(X\times Y)$ so that $F\pi_1(v)=s$ , $F\pi_2(v)=t$ and $F(f\times g)(v)=u$ .

From the fact that the lower left square in (A2) is a weak pullback, we infer the existence of $u_1\in F(X\times Y')$ such that $F\pi_1(u_1)=s$ and $F(f\times Y')(u_1)=u$ .

Analoguosly, using that the lower right square in (A2) is a weak pullback we obtain the existence of $u_2\in F(X'\times Y)$ such that $F\pi_2(u_2)=t$ and $F(X'\times g)(u_2)=u$ .

Since the upper square is also a weak pullback, we deduce the existence of $v\in F(X\times Y)$ satisfying $F(X\times g)(v)=u_1$ and $F(f\times Y)(v)=u_2$ . Upon noticing that $F\pi_1\circ F(X\times g)=F(\pi_1)$ , $F\pi_2\circ F(f\times Y)=F(\pi_2)$ , and $F(f\times Y')\circ F(X\times g)=F(f\times g)$ , we conclude that v is the element we were looking for in $F(X\times Y)$ .

Lemma 52. Assume the functor F preserves weak pullbacks. The map ${\mathit{ev}_{\mathsf{can}}}\colon F{\mathcal{V}}\to{\mathcal{V}}$ is a monotone evaluation map, that is, it is monotone with respect to the order ${\ll}$ on $F{\mathcal{V}}$ defined in 13 and the order $\le$ on ${\mathcal{V}}$ .

Proof. It is sufficient to show that ${\mathit{ev}_{\mathsf{can}}}\colon (F{\mathcal{V}},{\ll}) \to ({\mathcal{V}},\le)$ is monotone.

Hence, let $u'_1,u'_2\in F{\mathcal{V}}$ such that $u'_1{\ll} u'_2$ , which implies that there exists $u'\in F({\mathcal{V}}\times {\mathcal{V}})$ with $F\pi_i(u') = u'_i$ , where $\pi_i\colon \le\ \to {\mathcal{V}}$ are the projections.

We have to show that ${\mathit{ev}_{\mathsf{can}}}(u'_1) \le {\mathit{ev}_{\mathsf{can}}}(u'_2)$ . It is sufficient to show that $u'_1\in F({\uparrow r})$ implies $u'_2\in F({\uparrow r})$ . Assume $r\in{\mathcal{V}}$ is such that $u'_1\in F({\uparrow r})$ . Then, there exists $u_1\in\, {\uparrow r}$ such that $F{\mathsf{true}_{r}}(u_1) =~u'_1$ .

Now consider the diagram on the left in (A3), where

\begin{equation*} e_r\colon \le_{{\uparrow r}}\ \to\ \le\end{equation*}

embeds $\le$ restricted to ${\uparrow r}$ into the full relation. Furthermore, the functions $\overline{\pi}_i$ are the projections for $\le_{{\uparrow r}}$ . This diagram commutes for $i=1,2$ and is a weak pullback for $i=1$ . Hence, the diagram on the right in (A3) is also a weak pullback.

(A3)

We have $u_1\in F({\uparrow r})$ and $u'\in F({\le})$ with $F{\mathsf{true}_{r}}(u_1) = u'_1 = F\pi_1(u')$ . Hence, there must be an element $u\in F(\le_{{\uparrow r}})$ with $F\overline{\pi}_1(u) = u_1$ and $Fe_r(u) = u'$ .

We set $u_2 = F\overline{\pi}_2(u)\in F({\uparrow r})$ and observe that $F{\mathsf{true}_{r}}(u_2) = F({\mathsf{true}_{r}}\circ \overline{\pi}_2)(u) = F(\pi_2\circ e_r)(u) = F\pi_2(u') = u'_2$ . This means that $u'_2\in F({\uparrow r})$ as required.

Proposition 53 Assume $\mathit{ev}\colon F{\mathcal{V}}\to{\mathcal{V}}$ is monotone evaluation map and let ${\widehat{F}}$ be the corresponding fibred lifting of F. Then we have:

  1. (1) ${\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 a lax F-algebra morphism, in the sense that we have a lax diagram:

  2. (2) holds whenever the map ${\kappa_{\mathbb{1}}}\colon\mathbb{1}\to{\mathcal{V}}$ is a lax algebra morphism, that is, we have the lax diagram

Proof. (1) We start with the observation that the predicate $p\otimes q$ is computed as the composite

Upon recalling that ${\widehat{F}}(p)=\mathit{ev}\circ F(p)$ , we notice that the leftmost path from FX to ${\mathcal{V}}$ in the next diagram evaluates to ${\widehat{F}}(p\otimes q)$ . Similarly, the rightmost path from FX to ${\mathcal{V}}$ evaluates to ${\widehat{F}}(p)\otimes{\widehat{F}}(q)$ . Now, the desired inequality ${\widehat{F}}(p\otimes q)\ge{\widehat{F}}(p)\otimes{\widehat{F}}(q)$ follows using the fact that the upper triangle commutes, the naturality of ${\lambda}$ and the lax diagram from the hypothesis.

(2) We consider the following diagram

Since ${\kappa_{X}}={\kappa_{\mathbb{1}}}\circ !$ the left triangle commutes. Hence, we obtain

\begin{equation*} \mathit{ev}\circ F{\kappa_{X}}\ge {\kappa_{\mathbb{1}}}\circ !\circ F!\,, \end{equation*}

or, equivalently,

\begin{equation*} {\widehat{F}}({\kappa_{X}})\ge{\kappa_{X}}\,. \\[-20pt] \end{equation*}

We show how one of the conditions for well-behavedness that we required for the Wasserstein lifting in Baldan et al. (Reference Baldan, Bonchi, Kerstan and König2018, Definition 5.14) for the quantale ${\mathcal{V}} = [0,\infty]$ is related to the conditions in Proposition 27. Our original condition was $d_e\circ (\mathit{ev}_F\times \mathit{ev}_F)\circ \langle{F\pi_1},{F\pi_2}\rangle \le{\widehat{F}}(d_e)$ where $d_e({-}_1,{-}_2) = [{{-}_1},{{-}_2}] \land[{{-}_2},{{-}_1}]$ (which evaluates to $d_e(r,s) = |r-s|$ on the reals). This clearly implies the non-symmetric variant stated in the lemma below.

Lemma 54 ${\widehat{F}}(p\otimes q)\ge{\widehat{F}}(p)\otimes{\widehat{F}}(q)$ holds for all $p,q\colon X\to {\mathcal{V}}$ if and only if $[{\pi_1},{\pi_2}] (\mathit{ev}_F \times \mathit{ev}_F) \langle{F\pi_1},{F\pi_2}\rangle \geq {\widehat{F}}[{\pi_1},{\pi_2}]$ .

Proof.

(A4)

(A5)

(A6)

(A7)

using

  • For the equivalences (A4) $\iff$ (A5) $\iff$ (A6) just simple rewriting along with ${\widehat{F}} = \mathit{ev}_F~\circ~F$ .

  • For the equivalence (A6) $\iff$ (A7) the tensor property $x\otimes y\le z \iff x\le[{y},{z}]$ .

Using this, we now aim to show that (A7) $\iff$ (26).

  • Showing (26) $\implies$ (A7) is straightforward: from $[{\pi_1},{\pi_2}] \le [{\pi_1},{\pi_2}],$ we can infer $[{\pi_1},{\pi_2}] \otimes \pi_1 \leq \pi_2$ . Using this, the monotonicity of ${\widehat{F}}$ and (26) (by taking $u = [{\pi_1},{\pi_2}] \colon X \to {\mathcal{V}}$ and $v = \pi_1 \colon X \to {\mathcal{V}}$ ) we obtain inequality (A7) as follows:

    \begin{equation*} {\widehat{F}}\pi_2 \geq {\widehat{F}}\left([{\pi_1},{\pi_2}] \otimes \pi_1\right) \geq {\widehat{F}}[{\pi_1},{\pi_2}] \otimes {\widehat{F}}\pi_1 \end{equation*}
  • The implication (A7) $\implies$ (26) can be shown by rewriting $u \otimes v = \pi_2 \circ \langle v, u \otimes v\rangle$ and then using (A7) as follows

    \begin{eqnarray*} &&{\widehat{F}}(u \otimes v) \\[4pt] & = &{\widehat{F}}\left(\pi_2 \circ \langle{v},{u \otimes v}\rangle\right) = {\widehat{F}}\pi_2 \circ F\langle{v},{u \otimes v}\rangle \\[4pt] & \geq& \left({\widehat{F}}[{\pi_1},{\pi_2}] \otimes {\widehat{F}}\pi_1\right) \circ F\langle{v},{u \otimes v}\rangle\\[4pt] & = &{\widehat{F}}\left([{\pi_1},{\pi_2}] \circ\langle{v},{u \otimes v}\rangle \right) \otimes {\widehat{F}}\left(\pi_1 \circ \langle{v},{u \otimes v}\rangle\right)\\[4pt] & = &{\widehat{F}}[{v},{u\otimes v}] \otimes {\widehat{F}} v \geq {\widehat{F}} u \otimes {\widehat{F}} v \end{eqnarray*}
    where the last inequality follows again from monotonicity of ${\widehat{F}}$ and the definitions of $\otimes$ and $[-,-]$ . In particular, $u\otimes v\le u\otimes v,$ and hence, $u \le [{v},{u\otimes v}]$ .

Appendix B. Proofs and additional material for Section 6

B.1 Lifting of the distributive law

We include an alternative proof of Theorem 42 which brings the pieces of proof in one large diagram.

Alternative proof of Theorem 42. The existence of the lifting ${\widehat{\zeta}}$ is equivalent to

\begin{equation*}{\widehat{T}}\circ{\widehat{F}}\le{({{\zeta}_{X}})^*}\circ{\widehat{F}}\circ{\widehat{T}}\,,\end{equation*}

while the existence of the lifting ${\overline{\zeta}}$ is equivalent to

\begin{equation*}{\overline{T}}\circ{\overline{F}}\le{({{\zeta}_{X}})^*}\circ{\overline{F}}\circ{\overline{T}}\,.\end{equation*}

The latter inequality, which we have to prove, is in turn equivalent to the inequality obtained by using the isomorphism ${{\iota}}$ .

The left-hand side of the above inequality rewrites using the definitions of the Wasserstein liftings as the composite of the outermost right-then-down path ${\mathcal{V}\textrm{-}\mathsf{Pred}_{{\Delta} X}}$ to ${\mathcal{V}\textrm{-}\mathsf{Pred}_{{\Delta} TFX}}$ in the next diagram. The right-hand side similarly evaluates to the outermost down-then-right path in the diagram. So it suffices to establish the inequality between these two paths. We do this by decomposing the diagram into smaller pieces (see Fig. B1) and explaining each inequality in turn.

Figure B1. Existence of the lifting ${\widehat{\zeta}}$ .

The two inequalities in the top pentagon and top-right square follow from the hypothesis. The two triangles at the bottom are equalities that follow from the fact that

The inequality in the left-down square holds since ${\widehat{F}}$ is a lifting and is obtained via adjoint transposes from (3). Using the naturality of ${\zeta,}$ one can show that the next square commutes

and hence, the inequality in the bottom rhombus can be derived as an instance of a generic result for bifibrations, see (5).

B.2 Details on constructively completely distributive quantales

In this appendix, we provide a result (Proposition 56 below) for proving ${\widehat{T}}\circ {\Sigma_{f}} \le {\Sigma_{Tf}}\circ {\widehat{T}}$ that is more general than Proposition 45. This is useful, for instance to prove such property for liftings different than the canonical one.

For this more general result, we need some additional properties, in particular the lifting ${\widehat{T}}$ must preserve a special type of supremum of predicates (even stronger than uniform convergence).

Definition 55. Let $(p_i\colon X\to{\mathcal{V}})_{i\in I}$ be a family of predicates. We call its sup constructively convergent if for every predicate $q\colon X\to {\mathcal{V}}$ with $q\lll \bigvee_{i\in I} p_i$ (pointwise), there exists $i\in I$ with $q\le p_i$ .

Proposition 56. Assume ${\mathcal{V}}$ is a constructively completely distributive quantale and assume ${\widehat{T}}$ is a lifting of a $\mathsf{Set}$ -functor T. Then, we have that ${\widehat{T}}\circ {\Sigma_{f}} \le {\Sigma_{Tf}}\circ {\widehat{T}}$ whenever either of the conditions below is met

  • f is surjective and ${\widehat{T}}$ preserves constructively convergent sups.

  • f is injective, T preserves weak pullbacks, ${\widehat{T}}$ is a fibred lifting corresponding to an evaluation map $\mathit{ev}$ such that for every $t\in T{\mathcal{V}}$ , $\mathit{ev}(t)\neq \bot$ implies $t\in T({\mathcal{V}}\backslash\{\bot\})$ . (In other words: $\mathit{ev}^{-1}({\mathcal{V}}\backslash \{\bot\})\subseteq T({\mathcal{V}}\backslash\{\bot\})$ .)

  • f is an arbitrary function and all the above properties are satisfied.

Proof. Let $f = m\circ e$ be the epi-mono factorization of f, that is, $e\colon X\to Z$ is surjective and $m\colon Z\to Y$ is injective. We will show the inequality separately for m, e, from which we can straightforwardly derive the inequality for f.

  • ${\widehat{T}}\circ {\Sigma_{e}} \le {\Sigma_{Te}}\circ {\widehat{T}}$ :

Let $p\colon X\to{\mathcal{V}}$ , $z\in Z$ . Observe that

\begin{equation*} {\Sigma_{e}}(p)(z) = \bigvee \{p(x)\mid e(x) = z\} = \bigvee \{(p\circ g)(z) \mid g\in G\} \end{equation*}

where $G = \{g\colon Z\to X\mid e\circ g = \mathit{id}_Z\}$ is the set of all choice functions. Note that the last equality in the displayed equation above requires surjectivity of e, because otherwise no choice functions exist.

So ${\Sigma_{e}}(p) = \bigvee_{g\in G} p\circ g = \bigvee_{g\in G} {g^*}(p)$ and we show that this sup is constructively convergent. Let $q\colon Z\to {\mathcal{V}}$ with $q\lll {\Sigma_{e}}(p)$ . Now for a $z\in Z,$ we observe that $q(z) \lll \bigvee_{e(x)=z} p(x),$ and hence, since we are working in a cccd-lattice, there exists an $x_z\in X$ with $e(x_z)=z$ and $p(x_z)\ge q(z)$ . On z, we define the choice function g as $g(z) = x_z$ . We have $e\circ g = \mathit{id}_Z,$ and furthermore for all, $z\in Z$ we have $q(z) \le p(x_z) = (p\circ g)(z)$ , hence $q\le p\circ g$ as desired.

According to our assumption ${\widehat{T}}$ preserves such suprema and we get:

\begin{equation*} {\widehat{T}}({\Sigma_{e}}(p)) = {\widehat{T}}(\bigvee_{g\in G} {g^*}(p)) = \bigvee_{g\in G}{\widehat{T}}({g^*}(p))\le \bigvee_{g\in G} {({Tg})^*}({\widehat{T}} p) \end{equation*}

We will now show ${({Tg})^*} \le {\Sigma_{Te}}$ as an intermediate result: Let $p\colon TX\to{\mathcal{V}}$ and $t\in TZ$ . Then,

\begin{eqnarray*} && {({Tg})^*}(p)(t) = (p\circ Tg)(t) = p(Tg(t)) \le \bigvee_{Te(s)=t} p(s) = {\Sigma_{Te}}(p)(t) \end{eqnarray*}

since $s=Tg(t)$ satisfies $Te(s) = Te(Tg(t)) = T\mathit{id}_Z(t) = t$ . This implies

\begin{equation*} \bigvee_{g\in G} {({Tg})^*}({\widehat{T}} p) \le \bigvee_{g\in G} {\Sigma_{Te}}({\widehat{T}} p) = ({\Sigma_{Te}}\circ {\widehat{T}})(p) \end{equation*}

By combining everything, we obtain the desired result.

  • ${\widehat{T}}\circ {\Sigma_{m}} \le {\Sigma_{Tm}}\circ {\widehat{T}}:$ Let $p\colon Z\to{\mathcal{V}}$ , $t\in FY$ , we have to show that ${\widehat{T}}({\Sigma_{m}}(p))(t) \le {\Sigma_{Tm}}({\widehat{T}} p)(t)$ .

We consider the following two cases:

-t is in the image of Tm: in this case, there exists $s\in TX$ with $Tm(s) = t$ .

Since m is injective, we have that for any $y\in Y$ in the image of m ${\Sigma_{m}}(p)(y) = p(z)$ , where $z\in Z$ is the unique preimage of y. Hence, ${\Sigma_{m}}(p)\circ m = p$ .

Using the fact that we have a fibred lifting (Proposition 14), this means that

\begin{eqnarray*} && {\widehat{T}}({\Sigma_{m}}(p))(t) = {\widehat{T}}({\Sigma_{m}}(p))(Tm(s)) = {\widehat{T}}({\Sigma_{m}}(p)\circ m)(s) = {\widehat{T}} p(s) \\ & \le & \bigvee_{Tm(s)=t} {\widehat{T}} p(s) = {\Sigma_{Tm}}({\widehat{T}} p))(t) \end{eqnarray*}

-t is not in the image of Tm: we show that in this case ${\widehat{T}}({\Sigma_{m}}(p))(t) = \bot$ . (The right-hand side of the inequality is also $\bot$ , due to the empty supremum.) Note that ${\Sigma_{m}}(p)(y) = \bot$ for all $y\in Y$ which are not in the image of m.

Now assume that ${\widehat{T}}({\Sigma_{m}}(p))(t) \neq \bot$ . Take the pullback on the left below and observe that $Y' = \{y\in Y\mid {\Sigma_{m}}(p)(y) \neq \bot\} \subseteq m[X]$ .

Since T is weak pullback-preserving, the square on the right above is a weak pullback.

By assumption, we have $\mathit{ev}(T({\Sigma_{m}}(p))(t)) = {\widehat{T}}({\Sigma_{m}}(p))(t) \neq \bot$ . This implies that $T({\Sigma_{m}}(p))(t) \in T({\mathcal{V}}\backslash\{\bot\})$ .

Since the square to the right above is a weak pullback, this means that $t\in T(Y')$ , hence $t\in T(m[X])$ , which is a contradiction, since t is not in the image of Tm.

Lemma 57. Assume that T preserves weak pullbacks and ${\mathcal{V}}$ is a constructively completely distributive quantale. Then, the canonical predicate lifting ${\widehat{T}_{\mathsf{can}}}$ preserve2s constructively convergent sups, that is, ${\widehat{T}_{\mathsf{can}}}(\bigvee_{i\in I} p_i) = \bigvee_{i\in I} {\widehat{T}_{\mathsf{can}}}(p_i)$ .

Proof. First, we obviously have ${\widehat{T}_{\mathsf{can}}}(\bigvee_{i\in I} p_i) \ge \bigvee_{i\in I} {\widehat{T}_{\mathsf{can}}}(p_i)$ due to monotonicity.

We now show ${\widehat{T}_{\mathsf{can}}}(\bigvee_{i\in I} p_i) \le \bigvee_{i\in I} {\widehat{T}_{\mathsf{can}}}(p_i)$ : first denote $\bigvee_{i\in I} p_i$ by p. Let $t\in TX$ , hence the inequality spells out to

\begin{equation*} \bigvee \{r\mid Tp (t) \in T({\uparrow r})\} \le \bigvee_{i\in I}\bigvee\{s\mid Tp_i(t)\in T({\uparrow s})\} \end{equation*}

Now let r be such that $Tp(t)\in T({\uparrow r})$ and take the pullback on the left below. Note that $X_r = \{x\in X\mid p(x)\ge r\}$ .

Due to weak pullback preservation, the square above on the right is a weak pullback. This means that $t\in TX$ , which satisfies $t\in T({\uparrow r})$ , is also contained in $T(X_r)$ .

Now let $u \lll r$ . We define a predicate $p'\colon X\to{\mathcal{V}}$ with

\begin{equation*} p'(x) = \left\{ \begin{array}{ll} u & \mbox{if $x\in X_r$} \\ \bot & \mbox{otherwise} \end{array} \right. \end{equation*}

Note that p’ satisfies $p'\lll p$ . This is also true whenever $p'(x) = \bot$ , since $\bot$ is totally below everything. Then, due to constructively convergence of the sup there exists an index $i\in I$ with $p'\le p_i$ .

Now obtain the set $X_u^i$ with the following pullback on the left, where $X_u^i = \{x\in X\mid p_i(x) \ge u\}$ .

\begin{equation*} \end{equation*}

We can observe that $X_r\subseteq X_u^i$ : let $x\in X_r$ , then $u = p'(x) \le p_i(x)$ , hence $x\in X_u^i$ .

This means that $t\in T(X_u^i)$ and since the square on the right above commutes, this gives us $Tp_i(t)\in T({\uparrow u})$ . From this, we infer

\begin{equation*} \bigvee_{i\in I}\bigvee\{s\mid Tp_i(t)\in T({\uparrow s})\} \ge u \end{equation*}

Since this holds for all $u{\lll} r$ , we have

\begin{equation*} r = \bigvee_{u\lll r} u \le \bigvee_{i\in I}\bigvee\{s\mid Tp_i(t)\in T({\uparrow s})\} \end{equation*}

which entails the required inequality.

Lemma 58. For a constructively completely distributive quantale, it holds for the canonical predicate lifting ${\widehat{T}_{\mathsf{can}}}$ that ${\mathit{ev}_{\mathsf{can}}}(t)\neq \bot$ implies $t\in T({\mathcal{V}}\backslash\{\bot\})$ for $t\in T{\mathcal{V}}$ .

Proof. Assume that

\begin{equation*} {\mathit{ev}_{\mathsf{can}}}(t) = \bigvee \{ r\mid t\in T({\uparrow r})\} \neq \bot \end{equation*}

Hence, there is at least one $r\neq \bot$ with $t\in T({\uparrow r}) \subseteq T({\mathcal{V}}\backslash\{\bot\})$ ; otherwise, the supremum would equal $\bot$ .

Whenever $T = \mathcal{D}$ (the probability distribution functor), we have that $\mathcal{D}$ preserves constructively convergent sups (since it preserves uniform convergence). We now consider the evaluation map as in Example 17, namely the expectation $\mathit{ev}(t) = \sum_{r\in [0,1]} r\cdot t(r)$ with $t\in \mathcal{D}[0,1]$ . Note that in the quantale [0,1] we have $\bot = 1$ .

However, the property $\mathit{ev}(t)\neq 1\ \Rightarrow\ t\in \mathcal{D}[0,1)$ for all $t\in \mathcal{D}[0,1]$ does not hold in this case. If $t(0) = 1$ , $t(r) = 0$ for all $r\neq 0$ , we have $\mathit{ev}(t) = 0 \neq 1$ , but $t\not\in \mathcal{D}[0,1)$ .

Nevertheless, the corresponding $\mathcal{V}\textrm{-}\mathsf{Pred}$ -lifting of ${\mathcal{D}}$ still satisfies the property $\widehat{{\mathcal{D}}}\circ {\Sigma_{{\lambda}}} \le{\Sigma_{{\mathcal{D}} {\lambda}}}\circ \widehat{{\mathcal{D}}}$ , required in Theorem 42. Here we can rely on the fact that for $\mathcal{D}$ the components ${\lambda}_X\colon \mathcal{D}(X\times X)\to \mathcal{D}X\times\mathcal{D}X$ are surjective, so we can apply the second item of Proposition 56.

Footnotes

1 For a context $C(-_1, \dots, -_n)$ we denote by $C(t_1,\dots,t_n)$ the term obtained by substituting the term $t_i$ in the hole $-_i$ .

2 The same observation is present in Hofmann (Reference Hofmann2007, Theorem 3.3(b)) but in a slightly different setting.

3 Note that $d \le {{\xi}^*} \circ \overline{{\mathcal{P}}(A \times -)}(d')$ means, in the language of Chatzikokolakis et al. (Reference Chatzikokolakis, Palamidessi and Vignudelli2016), that d progresses to d’.

References

Bacci, G., Bacci, G., Larsen, K. and Mardare, R. (2013). Computing behavioral distances, compositionally. In: MFCS, LNCS, vol. 8087, Springer, 74–85.CrossRefGoogle Scholar
Bacci, G., Bacci, G., Larsen, K. G., Tribastone, M., Tschaikowski, M. and Vandin, A. (2021). Efficient local computation of differential bisimulations via coupling and up-to methods. In: LICS, IEEE, 1–14.CrossRefGoogle Scholar
Balan, A. and Kurz, A. (2011). Finitary functors: From Set to Preord and Poset. In: CALCO, LNCS, vol. 6859, Springer, 85–99.CrossRefGoogle Scholar
Balan, A., Kurz, A. and Velebil, J. (2015). Extensions of functors from Set to inline1165-cat. In: CALCO, LIPIcs, vol. 35, 17–34.Google Scholar
Baldan, P., Bonchi, F., Kerstan, H. and König, B. (2014). Behavioral metrics via functor lifting. In: FSTTCS, LIPIcs, vol. 29, 403–415.Google Scholar
Baldan, P., Bonchi, F., Kerstan, H. and König, B. (2015). Towards trace metrics via functor lifting. In: CALCO, LIPIcs, vol. 35, 35–49.Google Scholar
Baldan, P., Bonchi, F., Kerstan, H. and König, B. (2018). Coalgebraic behavioral metrics. Logical Methods in Computer Science 14 (3). Selected Papers of the 6th Conference on Algebra and Coalgebra in Computer Science (CALCO 2015).Google Scholar
Baldan, P., König, B. and Padoan, T. (2020). Abstraction, up-to techniques and games for systems of fixpoint equations. In: CONCUR, LIPIcs, vol. 171, Schloss Dagstuhl – Leibniz Center for Informatics, 25:1–25:20.Google Scholar
Barr, M. (1970). Relational algebras. In: Reports of the Midwest Category Seminar IV, Springer, 39–55.CrossRefGoogle Scholar
Bartels, F., Sokolova, A. and de Vink, E. (2004). A hierarchy of probabilistic system types. Theoretical Computer Science 327 (1–2) 322.CrossRefGoogle Scholar
Blanchette, J. C., Bouzy, A., Lochbihler, A., Popescu, A. and Traytel, D. (2017). Friends with benefits – implementing corecursion in foundational proof assistants. In: ESOP, LNCS, vol. 10201, Springer, 111–140.Google Scholar
Bonchi, F., Ganty, P., Giacobazzi, R. and Pavlovic, D. (2018a). Sound up-to techniques and complete abstract domains. In: LICS, ACM, 175–184.CrossRefGoogle Scholar
Bonchi, F., König, B. and Küpper, S. (2017a). Up-to techniques for weighted systems. In: TACAS, LNCS, vol. 10205, Springer, 535–552.Google Scholar
Bonchi, F., König, B. and Petrisan, D. (2018b). Up-to techniques for behavioural metrics via fibrations. arXiv:https://org/10.1017/1806.110641806.11064.Google Scholar
Bonchi, F., Petrişan, D., Pous, D. and Rot, J. (2014). Coinduction up-to in a fibrational setting. In: CSL-LICS, ACM, 1–9. Paper No. 20.CrossRefGoogle Scholar
Bonchi, F., Petrisan, D., Pous, D. and Rot, J. (2017b). A general account of coinduction up-to. Acta Informatica 54 (2) 127190.CrossRefGoogle Scholar
Bonchi, F. and Pous, D. (2013). Checking NFA equivalence with bisimulations up to congruence. In: POPL, ACM, 457–468.CrossRefGoogle Scholar
Bonchi, F., Sokolova, A. and Vignudelli, V. (2019). The theory of traces for systems with nondeterminism and probability. In: LICS, IEEE, 1–14.CrossRefGoogle Scholar
Chatzikokolakis, K., Gebler, D., Palamidessi, C. and Xu, L. (2014). Generalized bisimulation metrics. In: CONCUR, LNCS/ARCoSS, vol. 8704, Springer.Google Scholar
Chatzikokolakis, K., Palamidessi, C. and Vignudelli, V. (2016). Up-to techniques for generalized bisimulation metrics. In: CONCUR, LIPIcs, vol. 59, 35:1–35:14.Google Scholar
Danielsson, N. 2017. Up-to techniques using sized types. In: POPL, vol. 2, ACM, 43:1–43:28.Google Scholar
de Alfaro, L., Faella, M. and Stoelinga, M. (2004). Linear and branching metrics for quantitative transition systems. In: ICALP, LNCS, vol. 3142, Springer, 97–109.CrossRefGoogle Scholar
Desharnais, J., Gupta, V., Jagadeesan, R. and Panangaden, P. (2004). Metrics for labelled Markov processes. Theoretical Computer Science 318 (3) 323354.CrossRefGoogle Scholar
Droste, M., Kuich, W. and Vogler, H. (2009). Handbook of Weighted Automata , Monographs in Theoretical Computer Science, Springer, Berlin, Heidelberg.Google Scholar
Gebler, D., Larsen, K. G. and Tini, S. (2015). Compositional metric reasoning with probabilistic process calculi. In: FOSSACS, LNCS, vol. 9034, Springer, 230–245.CrossRefGoogle Scholar
Hasuo, I. (2015). Generic weakest precondition semantics from monads enriched with order. Theoretical Computer Science 604 229.CrossRefGoogle Scholar
Hermida, C. and Jacobs, B. (1998). Structural induction and coinduction in a fibrational setting. Information and Computation 145 107152.CrossRefGoogle Scholar
Hofmann, D. (2007). Topological theories and closed objects. Advances in Mathematics 215 (2) 789824.CrossRefGoogle Scholar
Hofmann, D. and Nora, P. (2020). Hausdorff coalgebras. Applied Categorical Structures 28 (5) 773806.CrossRefGoogle Scholar
Hur, C.-K., Neis, G., Dreyer, D. and Vafeiadis, V. (2013). The power of parameterization in coinductive proof. In: POPL, ACM, 193–206.CrossRefGoogle Scholar
Jacobs, B. (1999). Categorical Logic and Type Theory, Elsevier, Amsterdam.Google Scholar
Jacobs, B. (2016). Introduction to Coalgebra. Towards Mathematics of States and Observations, Cambridge University Press, Cambridge.CrossRefGoogle Scholar
Jacobs, B., Silva, A. and Sokolova, A. (2015). Trace semantics via determinization. Journal of Computer and System Sciences 81 (5) 859879.CrossRefGoogle Scholar
Katsumata, S. and Sato, T. (2015). Codensity liftings of monads. In: CALCO, LIPIcs, vol. 35, 156–170.Google Scholar
Kelly, M. (1982). Basic Concepts of Enriched Category Theory , Lecture Notes in Mathematics, vol. 64, Cambridge University Press, Cambridge.Google Scholar
Klin, B. (2011). Bialgebras for structural operational semantics: An introduction. Theoretical Computer Science 412 (38) 50435069.CrossRefGoogle Scholar
Komorida, Y., Katsumata, S., Kupke, C., Rot, J. and Hasuo, I. (2021). Expressivity of quantitative modal logics: Categorical foundations via codensity and approximation. In: LICS, IEEE, 1–14.CrossRefGoogle Scholar
Komorida, Y., Katsumata, S.-Y., Hu, N., Klin, B. and Hasuo, I. (2019). Codensity games for bisimilarity. In: LICS, ACM, 1–13.CrossRefGoogle Scholar
Lawvere, F. (2002). Metric spaces, generalized logic, and closed categories. Reprints in Theory and Applications of Categories 1 137.Google Scholar
Mardare, R., Panangaden, P. and Plotkin, G. (2016). Quantitative algebraic reasoning. In: LICS, ACM, 700–709.CrossRefGoogle Scholar
Mémoli, F. (2011). Gromov-Wasserstein distances and the metric approach to object matching. Foundations of Computational Mathematics 11 (4) 417487.CrossRefGoogle Scholar
Milner, R. (1989). Communication and Concurrency. Prentice Hall, Upper Saddle River, NJ, USA.Google Scholar
Milner, R. and Sangiorgi, D. (1992). Techniques of weak bisimulation up-to. In: CONCUR, LNCS, vol. 630, Springer-Verlag.Google Scholar
Mio, M., Sarkis, R. and Vignudelli, V. (2021). Combining nondeterminism, probability, and termination: Equational and metric reasoning. In: LICS, IEEE, 1–14.CrossRefGoogle Scholar
Mio, M. and Vignudelli, V. (2020). Monads and quantitative equational theories for nondeterminism and probability. In: CONCUR, LIPIcs, vol. 171, 28:1–28:18.Google Scholar
Parrow, J. and Weber, T. (2016). The largest respectful function. arXiv:https://org/10.1017/1605.041361605.04136.Google Scholar
Pistone, P. (2021). On generalized metric spaces for the simply typed lambda-calculus. In: LICS, IEEE, 1–14.CrossRefGoogle Scholar
Pous, D. (2007). Complete lattices and up-to techniques. In: APLAS, LNCS, vol. 4807, Springer, 351–366.CrossRefGoogle Scholar
Pous, D. (2016). Coinduction all the way up. In: LICS, ACM, 307–316.CrossRefGoogle Scholar
Pous, D. and Sangiorgi, D. (2011). Enhancements of the coinductive proof method. In: Sangiorgi, D. and Rutten, J. (eds.) Advanced Topics in Bisimulation and Coinduction, Cambridge University Press.Google Scholar
Pous, D. and Sangiorgi, D. (2019). Bisimulation and coinduction enhancements: A historical perspective. Formal Aspects of Computing 31 (6) 733749.CrossRefGoogle Scholar
Rutten, J. (2000). Universal coalgebra: A theory of systems. Theoretical Computer Science 249 (1) 380.CrossRefGoogle Scholar
Sangiorgi, D. (1998). On the bisimulation proof method. Mathematical Structures in Computer Science 8 (5) 447479.CrossRefGoogle Scholar
Schröder, L. (2008). Expressivity of coalgebraic modal logic: The limits and beyond. Theoretical Computer Science 390 230247.CrossRefGoogle Scholar
Silva, A., Bonchi, F., Bonsangue, M. M. and Rutten, J. (2013). Generalizing determinization from automata to coalgebras. Logical Methods in Computer Science 9 (1) 123.Google Scholar
Sprunger, D., Katsumata, S.-y., Dubut, J. and Hasuo, I. (2021). Fibrational bisimulations and quantitative reasoning: Extended version. Journal of Logic and Computation 31 (6) 15261559.CrossRefGoogle Scholar
Sprunger, D., ya Katsumata, S., Dubut, J. and Hasuo, I. (2018). Fibrational bisimulations and quantitative reasoning. In: CMCS, LNCS, vol. 11202, Springer, 190–213.CrossRefGoogle Scholar
Tini, S., Larsen, K. and Gebler, D. (2017). Compositional bisimulation metric reasoning with probabilistic process calculi. Logical Methods in Computer Science 12 (4) 138.Google Scholar
Turi, D. and Plotkin, G. (1997). Towards a mathematical operational semantics. In: LICS, IEEE, 280–291.CrossRefGoogle Scholar
van Breugel, F. and Worrell, J. (2001). Towards quantitative verification of probabilistic transition systems. In: ICALP, LNCS, vol. 2076, Springer, 421–432.CrossRefGoogle Scholar
van Breugel, F. and Worrell, J. (2005). A behavioural pseudometric for probabilistic transition systems. Theoretical Computer Science 331 115142.CrossRefGoogle Scholar
Villani, C. (2009). Optimal Transport – Old and New , A Series of Comprehensive Studies in Mathematics, vol. 338, Springer, Berlin, Heidelberg.Google Scholar
Wild, P. and Schröder, L. (2022). Characteristic logics for behavioural hemimetrics via fuzzy lax extensions. Logical Methods in Computer Science 18 (2) 135.Google Scholar
Figure 0

Figure 1: Example automaton.

Figure 1

Figure B1. Existence of the lifting ${\widehat{\zeta}}$.