Abstract 1 Introduction 2 Preliminaries 4 Graded Monads and Graded Algebras 5 Graded Quantitative Theories 7 Expressivity Criteria 8 Case Study: Fuzzy Metric Trace Semantics 9 Conclusions References

Quantitative Graded Semantics and
Spectra of Behavioural Metrics

Jonas Forster ORCID Friedrich-Alexander-Universität Erlangen-Nürnberg, Germany Lutz Schröder ORCID Friedrich-Alexander-Universität Erlangen-Nürnberg, Germany Paul Wild ORCID Friedrich-Alexander-Universität Erlangen-Nürnberg, Germany Harsh Beohar ORCID University of Sheffield, UK Sebastian Gurke ORCID Universität Duisburg-Essen, Germany Barbara König ORCID Universität Duisburg-Essen, Germany Karla Messing ORCID Universität Duisburg-Essen, Germany
Abstract

Behavioural metrics provide a quantitative refinement of classical two-valued behavioural equivalences on systems with quantitative data, such as metric or probabilistic transition systems. In analogy to the linear-time/ branching-time spectrum of two-valued behavioural equivalences on transition systems, behavioural metrics vary in granularity, and are often characterized by fragments of suitable modal logics. In the latter respect, the quantitative case is, however, more involved than the two-valued one; in fact, we show that probabilistic metric trace distance cannot be characterized by any compositionally defined modal logic with unary modalities. We go on to provide a unifying treatment of spectra of behavioural metrics in the emerging framework of graded monads, working in coalgebraic generality, that is, parametrically in the system type. In the ensuing development of quantitative graded semantics, we introduce algebraic presentations of graded monads on the category of metric spaces. Moreover, we provide a general criterion for a given real-valued modal logic to characterize a given behavioural distance. As a case study, we apply this criterion to obtain a new characteristic modal logic for trace distance in fuzzy metric transition systems.

Keywords and phrases:
transition systems, modal logics, coalgebras, behavioural metrics
Copyright and License:
[Uncaptioned image] © Jonas Forster, Lutz Schröder, Paul Wild, Harsh Beohar, Sebastian Gurke, Barbara König, and
Karla Messing; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Modal and temporal logics
Related Version:
Full Version: https://arxiv.org/abs/2306.01487 [23]
Funding:
The fourth author was supported by the EPSRC NIA Grant EP/X019373/1, while the remaining authors were supported by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) – project number 434050016 (SpeQt).
Editors:
Jörg Endrullis and Sylvain Schmitz

1 Introduction

While qualitative models of concurrent systems are traditionally analysed using various notions of two-valued process equivalence, it has long been recognized that for systems involving quantitative data, notions of behavioural distance play a useful role as a more fine-grained measure of process similarity. Well-known examples include behavioural distances on probabilistic transition systems [25, 13, 46], on systems combining nondeterminism and probability [8], and on metric transition systems [11, 16]. Like in the two-valued case, where process equivalences of varying granularity are arranged on the linear-time/branching-time spectrum [47], one has a spectrum of behavioural metrics on a given system type that vary in granularity (with greater distances thought of as having finer granularity) [15].

An important point of interest in this context are characteristic modal logics. In the two-valued setting, a logic is characteristic for a given behavioural equivalence if the latter coincides with the respective induced logical indistinguishability relation, so that behavioural inequivalence can be certified by distinguishing formulae (as in the recent proof of the failure of unlinkability in the ICAO 9303 e-passport standard [17])). For instance, Hennessy-Milner logic is characteristic for bisimilarity [28], and most equivalences on the classical spectrum are characterized by fragments of Hennessy-Milner logic [47] that are compositionally defined, i.e. given by a choice of modalities and propositional operators equipped with a recursively defined semantics (e.g. trace equivalence is characterized by the logic built from diamonds, truth, and – optionally – disjunction). In the quantitative setting, a logic is characteristic if the induced logical distance coincides with the respective behavioural distance, so that high behavioural distance may be certified by means of distinguishing modal formulae [40]. A prototypical example is quantitative probabilistic modal logic, which is characteristic for branching-time behavioural distance on probabilistic transition systems [46]. However, it turns out that in general, the quantitative setting behaves less smoothly in this respect than the two-valued setting. Indeed, we show as our first main result that for probabilistic metric trace distance (on generative probabilistic transition systems in which the set of labels is equipped with a metric, i.e. on the probabilistic variant of metric transition systems), there does not exist any characteristic quantitative modal logic at all. Here, the term modal logic is understood in a fairly broad sense; essentially, we stipulate no more than that, in analogy to the two-valued case as discussed above, the logic should be a compositionally defined fragment of a bisimulation-invariant next-step logic with unary modalities.

We subsequently work towards positive results, using the framework of graded semantics [37, 14] to achieve an appropriate level of generality. Graded semantics is parametric both in the type of systems (e.g. probabilistic, metric, fuzzy) and in the quantitative semantics of systems, i.e. the choice of behavioural distance. The system type is abstracted as an endofunctor on a suitable base category following the paradigm of universal coalgebra [43]. Parametricity in the system semantics, on the other hand, is based on the choice of a graded monad, which handles additional semantic identifications (beyond branching-time equivalence) by algebraic means, using grades to control the depth of look-ahead. Both Kleisli-style coalgebraic trace semantics [27] and the smoother, but less widely applicable Eilenberg-Moore-style coalgebraic trace semantics [29] are subsumed by this framework [37].

Graded semantics has recently been extended to cover behavioural distances in the Eilenberg-Moore-style setting [5, 24], and, generalizing the two-valued case [37, 14], a canonical notion of quantitative graded logic has been identified. Quantitative graded logics are always invariant under the underlying behavioural distance in the sense that formula evaluation is nonexpansive, so that logical distance is below behavioural distance. In some cases, the reverse inequality, i.e. expressivity of quantitative graded logics, can be established by a straightforward generalization of corresponding criteria for the two-valued case. Notably, one can show that in the Eilenberg-Moore setting, one essentially always has a characteristic modal logic [24], in sharp contrast to our present negative result. The flip side of the coin is that Eilenberg-Moore style trace semantics applies to only rather few system types (essentially automata with effects), and in particular does not support a metric on the labels as found, for instance, in standard metric transition systems.

Our second, now positive, contribution in the present work is to extend the framework to unrestricted graded semantics, notably including Kleisli-style coalgebraic trace semantics and, hence, trace semantics on systems with labels taken from a metric space. For the syntactic treatment of spectra of behavioural distances in this sense, we introduce a graded extension of quantitative algebra [36] that allows describing graded monads on the category of metric spaces by operations and approximate equations. As suggested by our negative result, establishing expressivity of graded logics in the general case presents additional challenges compared to the two-valued variant and the Eilenberg-Moore case. In particular, it turns out that the expressivity criterion needs to be parametric in a strengthening of the inductive hypothesis in the induction on depth of look-ahead that it encapsulates; indeed, this happens already in strikingly simple cases such as metric streams. We develop a number of example applications: We recover results on expressivity of quantitative modal logics for (finite-depth) branching-time distances [33, 48, 19, 32], as well as a recent result on expressivity of a quantitative modal logic for trace distance in metric transition systems [4], which in fact we generalize to systems with metric state space and closed branching. In a concluding case study, we moreover identify a new characteristic modal logic for trace distance on fuzzy metric transition systems, which turns out to require next-step modalities incorporating a constant shift on label distances.

Omitted proofs and additional details can be found in the full version [23].

Related Work.

We have mentioned previous work on coalgebraic branching-time behavioural distances [2, 33, 22, 49, 50, 4, 32] and on graded semantics for two-valued behavioural equivalences and preorders [37, 14, 19]. Kupke and Rot [34] study logics for coinductive predicates, which generalize branching-time behavioural distances. Generally, our overall setup differs from the one used in [34] and elsewhere by working with coalgebras that already live on metric spaces (e.g. [42, 53, 46, 22, 26]); this allows covering functors on metric spaces that are not liftings of set functors, such as the full Hausdorff functor (which takes closed subsets). Recent work on Galois connections for logical distances [4, 5] is highly general (and in fact not even tied to state-based systems) but leaves more work to the instantiation than the framework of graded monads. Moreover, it is aimed primarily at fixpoint characterizations of logical distance, and in fact induces behavioural distance from the logic, while we aim to provide logical characterizations of given behavioural distances. Alternative coalgebraic approaches to process equivalences coarser than branching time include coalgebraic trace semantics in Kleisli [27] and Eilenberg-Moore categories [29], which are both subsumed by the paradigm of graded monads [37], as well as an approach in which behavioural equivalences are defined via characteristic logics [31]. The Eilenberg-Moore and Kleisli setups can be unified using corecursive algebras, which also support, under certain assumptions, a logical characterization for these cases [41]. The Eilenberg-Moore approach has been applied to linear-time behavioural distances [2]. Recently, some of the present authors used the graded-semantics approach to Eilenberg-Moore semantics to extract characteristic logics that factor through the determinization of a coalgebra [24]. We make use of their notion of graded logic and complement their work by considering unrestricted graded semantics, in particular covering the more broadly applicable Kleisli-style semantics.

De Alfaro et al. [11] introduce a linear-time logic for (state-labelled) metric transition systems. The semantics of this logic is defined by first computing the set of paths of a system, so that propositional operators and modalities have a different meaning than in corresponding branching-time logics, while our graded logics are fragments of branching-time logics. Fahrenberg et al. [16] present a game-based approach to a spectrum of behavioural distances on metric transition systems. A two-valued logic for probabilistic trace semantics (for a discrete set of labels) has been considered in the context of differential privacy [7]. A notion of logical distance is then obtained via a real-valued semantics defined using a syntactic distance on formulae; this semantics is not compositional (truth values are defined by taking infima over the whole logical syntax), so subsequent results relating this logical distance to notions of weak anonymity do not contradict our impossibility result on (compositional) characteristic logics for probabilistic trace semantics.

2 Preliminaries

Basic familiarity with category theory is assumed (e.g. [1]). We write 𝐒𝐞𝐭 for the category of sets and maps. Below, we recall some background on (bounded) metric spaces and universal coalgebra.

Metric spaces.

The real unit interval [0,1] will serve as the domain of distances and truth values. Under the usual ordering , [0,1] forms a complete lattice; we write , for joins and meets in [0,1] (e.g. ixi=supixi), and , for binary join and meet, respectively. We denote truncated addition and subtraction by and , respectively; that is, xy=min(x+y,1) and xy=max(xy,0). These operations form part of a structure of [0,1] as a (co-)quantale; for readability, we refrain from working with more general quantales [49, 22].

Definition 2.1.

A (bounded) pseudometric space is a pair (X,d) consisting of a set X and a function d:X×X[0,1] satisfying the standard conditions of reflexivity (d(x,x)=0 for all xX), symmetry (d(x,y)=d(y,x) for all x,yX), and the triangle inequality (d(x,z)d(x,y)+d(y,z) for all x,y,zX); if additionally separation holds (for x,yX, if d(x,y)=0 then x=y), then (X,d) is a metric space. A function f:XY between pseudometric spaces (X,dX) and (Y,dY) is nonexpansive if dY(f(x),f(y))dX(x,y) for all x,yX. Metric spaces and nonexpansive maps form a category 𝐌𝐞𝐭.

We often do not distinguish notationally between a (pseudo-)metric space (X,d) and its underlying set X. Occasionally we use subscripts to make explicit the carrier to which a (pseudo-)metric is associated, i.e. dX is the (pseudo-)metric of the space with carrier X. The categorical product (X,dX)×(Y,dY) of (pseudo-)metric spaces equips the Cartesian product X×Y with the supremum (pseudo-)metric dX×Y((a,b),(a,b))=dX(a,a)dY(b,b). Similarly, the Manhattan tensor equips X×Y with the Manhattan (pseudo-)metric dXY((a,b),(a,b))=dX(a,a)dY(b,b). We occasionally write elements of the product Xn+m as vw if vXn and wXm. Given (pseudo-)metric spaces X,Y, the nonexpansive functions XY form a (pseudo-)metric space under the standard supremum distance.

Example 2.2.

We recall some key examples of functors on 𝐒𝐞𝐭 and 𝐌𝐞𝐭.

  1. 1.

    We write 𝒫ω for the finite powerset functor on 𝐒𝐞𝐭, and 𝒫¯ω for the lifting of 𝒫ω to 𝐌𝐞𝐭 given by the Hausdorff metric. Explicitly, for a metric space (X,d) and A,B𝒫ωX,

    d𝒫¯ωX(A,B)=(aAbBd(a,b))(bBaAd(a,b)). (2.1)

    Both 𝒫ω and 𝒫¯ω are monads, with multiplication taking big unions.

  2. 2.

    Related to the above, the closed Hausdorff monad 𝒫c on 𝐌𝐞𝐭 sends a metric space X to the set of closed subsets of X, again equipped with the Hausdorff metric. For a nonexpansive function f:XY, 𝒫cf sends A𝒫cX to the closure of f[A]. Monad multiplication takes the closure of the big union.

  3. 3.

    Similarly, 𝒟ω denotes the functor on 𝐒𝐞𝐭 that maps a set X to the set of finitely supported probability distributions on X, and 𝒟¯ω denotes the lifting of 𝒟ω to 𝐌𝐞𝐭 that equips 𝒟ωX with the Kantorovich metric. Explicitly, for a metric space (X,d) and μ,ν𝒟ωX,

    d𝒟¯ωX(μ,ν)=fxXf(x)(μ(x)ν(x))

    where f ranges over all nonexpansive functions X[0,1]. We often write elements of 𝒟¯ωX as finite formal sums pixi, with xiX and pi=1.

  4. 4.

    The finite fuzzy powerset functor ω is given on sets X by ωX={A:X[0,1]A(x)=0 for almost all xX}, and on maps f:XY by ωf(A)(y)={A(x)f(x)=y} for AωX. That is, ωX consists of the finite fuzzy subsets of X, given by assigning membership degrees in [0,1] to elements of X, and ωf acts by taking fuzzy direct images. We lift ω to a functor ¯ω on metric spaces that equips ωX with the fuzzy Hausdorff distance [49, Example 5.3.1]. Explicitly, d¯ωX(A,B)=d0(A,B)d0(B,A) for a metric space (X,d) and A,BωX, where

    d0(A,B)=xy(A(x)B(y))(A(x)d(x,y)).

    Thus, d0(A,B) is analogous to the left-hand term in the binary join defining the Hausdorff metric (2.1): Both terms can be read intuitively as “B is far from A if there is x such that xA and for all y, if yB then y is far from x”, where d0(A,B) takes into account that the sets A,B are fuzzy (in particular, the “if yB” is reflected in the contribution of B(y) being negative).

Coalgebra.

Universal coalgebra [43] has established itself as a way to reason about state-based systems at an appropriate level of abstraction. It is based on encapsulating the transition type of systems as an endofunctor G:𝒞𝒞 on a base category 𝒞. Then, a G-coalgebra (X,γ) consists of a 𝒞-object X, thought of as an object of states, and a morphism γ:XGX, thought of as assigning to each state a collection of successors, structured according to G. A 𝒞-morphism h:XY is a morphism of G-coalgebras (X,γ)(Y,δ) if Ghγ=δh.

For a functor G:𝐌𝐞𝐭𝐌𝐞𝐭, one has a canonical notion of branching-time behavioural distance dγG on a G-coalgebra (X,γ) [22]. In case G is a lifting of a set functor (which means roughly that the underlying set of GX is independent of the metric on X), the general definition simplifies as follows: dγG is the least fixpoint of the map ddG(X,d)(γ×γ) [2, 22].

Example 2.3.

Throughout the paper, we fix a metric space 𝒜 of labels. Finitely branching metric transition systems with transition labels in 𝒜 are coalgebras for the functor 𝒫¯ω(𝒜×). (More precisely, a metric transition system is usually assumed to have a set as its state space, while 𝒫¯ω(𝒜×)-coalgebras more generally have a metric space of states, subsuming mere sets of states as discrete metric spaces). Similarly, coalgebras for the functor 𝒫c(𝒜×) are closed-branching metric transition systems, where sets of successors can be infinite but are required to be closed. With few exceptions (e.g. [22]), most coalgebraic approaches to behavioural metrics (e.g. [2, 33, 50, 34]) rely on the functor being a lifting of a 𝐒𝐞𝐭-functor. We work with unrestricted functors on 𝐌𝐞𝐭, thus, e.g., covering the above-mentioned functor 𝒫c(𝒜×), which is not a lifting of a set functor. We use trace semantics on metric labelled transition systems (both finitely branching and closed-branching) as a running example of concepts as they appear throughout the text.

Quantitative Coalgebraic Modal Logic.

We proceed to introduce the requisite notion of quantitative coalgebraic modal logic [45, 33, 50, 24], in a formulation geared towards easing the extraction of invariant fragments for various semantics [24], and instantiated to the category of metric spaces. The notion of quantitative coalgebraic modal logic will also serve as the yardstick for our negative result on characteristic modal logics for probabilistic metric trace semantics (Section 3).

Syntactically, a modal logic is a triple =(Θ,𝒪,Λ) where Θ is a set of truth constants, 𝒪 is a set of propositional operators, each with associated finite arity, and Λ is a set of modal operators, also each with an associated finite arity. For readability, we restrict to unary modal operators; extending our positive results to modal operators of higher arity is simply a matter of adding indices. The set of formulae of is then given by the grammar

ϕ::=cp(ϕ1,,ϕn)Lϕ(cΘ,p𝒪 n-ary,LΛ).

Formulae are interpreted in G-coalgebras for a given functor G:𝐌𝐞𝐭𝐌𝐞𝐭, and take values in the truth value object Ω=[0,1], which we equip with the standard metric dΩ(x,y)=|xy|. Moreover, the semantics is parametric in the following components:

  • For every cΘ, a nonexpansive map c^:1Ω.

  • For p𝒪 with arity n, a nonexpansive map p:ΩnΩ

  • For LΛ, a nonexpansive map L:GΩΩ

The evaluation of a formula ϕ on a G-coalgebra (X,γ) is then a nonexpansive map ϕγ:XΩ, inductively defined by

cγ=(X!1c^Ω)p(ϕ1,,ϕn)γ=(Xϕ1γ,,ϕnγΩnpΩ)Lϕγ=(X𝛾GXGϕγGΩLΩ)
Example 2.4.

We briefly exemplify the semantics of modalities: Take the functor G=𝒫¯ω(𝒜×()) modelling metric transition systems (2.3), and define the interpretation a:𝒫¯ω(𝒜×Ω)Ω of modalities a, for a𝒜, by a(U)=(b,v)U(1d(a,b))v. Then, roughly speaking, the degree to which a state in a metric transition system satisfies a formula aϕ is the degree to which it has a b-successor that satisfies ϕ, for some b that is close to a. (The use of 1d(a,b) is owed to the usual discrepancy between 1 representing “true” but also “far apart”.)

In the framework defined so far, truth constants are interchangeable with nullary propositional operators, but in the setting of graded logics (Section 6), the two concepts will play syntactically and semantically distinct roles. In particular, invariance w.r.t. a target semantics (Theorem 6.6) will in general hold only for formulae of uniform depth, that is, formulae in which all occurrences of truth constants are nested under the same number of modal operators. In cases where there are no truth constants, all formulae are uniform. We write 𝗎𝗇𝗂𝖿 for the set of uniform-depth -formulae.

Definition 2.5.

Logical distance under the logic on a G-coalgebra (X,γ) is the pseudometric d given by d(x,y)={dΩ(ϕγ(x),ϕγ(y))ϕ𝗎𝗇𝗂𝖿}.

Logical distance is always a lower bound for branching-time behavioural distance [33, 50, 22]; we discuss details in 7.10.

3 Probabilistic Metric Trace Semantics

Finitely branching probabilistic metric transition systems over a metric space of transition labels 𝒜 are coalgebras for the functor G𝗉𝗋𝗈𝖻=𝒟¯ω(𝒜()) (cf.  2.2 and 2.3). The probabilistic (metric) trace semantics [9] of a probabilistic transition system calculates, at each depth n, a distribution over length-n traces. One then obtains a notion of depth-n probabilistic trace distance dn𝗉𝗍𝗋𝖺𝖼𝖾, which takes Kantorovich distances of depth-n trace distributions under the Manhattan distance on traces. Formal definitions are as follows.

Definition 3.1.

We write 𝒜n for the n-fold Manhattan tensor 𝒜𝒜. Let (X,γ) be a G𝗉𝗋𝗈𝖻-coalgebra. For each xX, the depth-n trace distribution μxn𝒟¯ω(𝒜n) is inductively defined as μxn+1(aw)=yXγ(x)(a,y)μyn(w) for a𝒜 and w𝒜n, with μx0𝒟¯ω(𝒜0)𝒟¯ω(1) being the unique distribution on the singleton set 1. The probabilistic trace distance on X is d𝗉𝗍𝗋𝖺𝖼𝖾=n<ωdn𝗉𝗍𝗋𝖺𝖼𝖾, where dn𝗉𝗍𝗋𝖺𝖼𝖾(x,y)=d𝒟¯ω(𝒜n)(μxn,μyn).

Consider the following concrete example, where we assume that d(b,c)=0.5.

For n2 we then have by the above definition that μxn=12aban2+12acan2 while μyn=14aban2+34acan2. The distance of the two relevant traces is given by d(aban2,acan2)=d(a,a)d(b,c)d(a,a)d(a,a)=0.5. Calculating the Kantorovich distance of trace distributions then gives us that d(μxn,μyn)=14d(aban2,acan2)=0.125, and by extension d𝗉𝗍𝗋𝖺𝖼𝖾(x,y)=0.125.

One would now like to have a logic that characterizes the trace distance d𝗉𝗍𝗋𝖺𝖼𝖾. However, we establish the following impossibility result instead:

Theorem 3.2.

Let =(Θ,𝒪,Λ) be a coalgebraic modal logic with unary modalities for the functor G𝗉𝗋𝗈𝖻, over a non-discrete metric space 𝒜 of labels. Then dd𝗉𝗍𝗋𝖺𝖼𝖾.

In other words, no quantitative coalgebraic modal logic with unary modalities has a compositionally defined fragment that characterizes probabilistic metric trace distance. The restriction to coalgebraic modal logics effectively means only that modal logics should be invariant under the standard branching-time semantics and have only next-step modalities [39, 44]. Theorem 3.2 implies in particular that the logic featuring modalities a for a𝒜, with aϕ being the expected truth value of ϕ restricted to a-successors, fails to characterize probabilistic metric trace distance (even though it characterizes two-valued probabilistic trace equivalence [6, 14]). In fact, it can even be shown that giving up the requirement of interpretations of modalities being nonexpansive does not help.

Proof sketch (Theorem 3.2).

Suppose that is invariant under probabilistic metric trace semantics (dd𝗉𝗍𝗋𝖺𝖼𝖾); we show that fails to be expressive (dd𝗉𝗍𝗋𝖺𝖼𝖾). As an intermediate step, we show that invariance under probabilistic metric trace semantics implies that modal operators are affine maps. Then calculation shows that affine modalities are unable to distinguish the states x and y in the following system, where d(a,b)=v<1, to a degree greater than v2, even though the behavioural distance of x and y under probabilistic trace semantics is v.

We leave the question of whether a characteristic logic with higher-arity modalities exists as an open problem.

While expressive quantitative coalgebraic logics for branching-time semantics exist for a wide variety of systems [33, 50, 22, 26], this is thus apparently not always the case for linear-time semantics. The no-go result above emphasizes the challenges of the quantitative setting and the need for a theory of quantitative coalgebraic logics beyond branching time. In the following, we will address precisely this problem, by adopting techniques from the theory of graded semantics and highlighting issues unique to the metric setting.

4 Graded Monads and Graded Algebras

The framework of graded semantics [14, 37] is based on the central notion of graded monads, which algebraically describe the structure of observable behaviours, in particular identifications beyond branching time, at each finite depth. Here, depth is understood as look-ahead, measured in terms of the number of transition steps.

Definition 4.1.

A graded monad 𝕄=((Mn)n,η,(μn,k)n,k) on a category 𝒞 consists of a family of functors Mn:𝒞𝒞 for n and natural transformations η:𝐼𝑑M0 (the unit) and μn,k:MnMkMn+k for all n,k (the multiplications), subject to essentially the same laws as ordinary monads up to the insertion of grades; specifically, one has unit laws μ0,nηMn=𝑖𝑑Mn=μn,0Mnη and an associative law μn+k,mμn,kMm=μn,k+mMnμk,m.

In particular, (M0,η,μ00) is an ordinary (non-graded) monad.

The understanding of the data constituting a graded monad is similar as for plain monads: Roughly speaking (this will be made more precise in Section 5), MnX may be thought of as a space of terms of depth n, modulo given identities, over variables from X; μnk substitutes depth-k terms into a depth-n term, obtaining a depth-(n+k) term; and η converts variables into terms of depth 0.

Example 4.2.

We discuss graded monads modelling the linear-time end of the spectrum, noting that graded monads cover also branching-time (7.10) and intermediate semantics, involving simulation, readiness, failures etc. [14]. A Kleisli distributive law is a natural transformation λ:FTTF where F is a functor and T a monad, subject to coherence with the monad structure [27]. This yields a graded monad with Mn=TFn [37]; here, T may be understood as defining the branching type of the system, and F as defining a type of accepted structure. We will use the following instance of this construction as a running example: Take F=𝒜×() and T=𝒫¯ω or T=𝒫c (corresponding to nondeterministic branching). Then λ(a,U)={(a,x)xU} defines a distributive law λ:𝒜×T()T(𝒜×()) (in particular, λ is nonexpansive). We obtain the graded metric trace monads Mn=T(𝒜n×()).

Graded monads come with a graded analogue of Eilenberg-Moore algebras, which play a central role in the semantics of graded logics [37, 14].

Definition 4.3 (Graded Algebra).

Let 𝕄 be a graded monad in 𝒞. A graded Mn-algebra ((Ak)kn,(amk)m+kn) consists of a family of 𝒞-objects Ai and morphisms amk:MmAkAm+k satisfying essentially the same laws as a monad algebra, up to insertion of the grades. Specifically, we have a0mηAm=𝑖𝑑Am for mn, and whenever m+r+kn, then am+r,kμAkm,r=am,r+kMmar,k. An Mn-homomorphism of Mn-algebras A and B is a family (fk:AkBk)kn of maps such that whenever m+kn, then fm+kam,k=bm,kMmfk. Graded Mn-Algebras and their homomorphisms form a category Algn(𝕄).

That is, elements of a graded algebra are stratified by depth, and applying an operation of depth m to elements of depth k yields elements of depth m+k, For n=1, this definition instantiates as follows: An M1-algebra is a tuple (A0,A1,a00,a01, a10), such that 1) (A0,a00) and (A1,a01) are M0-algebras. 2) (Homomorphy) a10:M1A0A1 is an M0-homomorphism (M1A0,μ01)(A1,a01). 3) (Coequalization) a10M1a00=a10μ10, i.e. the following diagram commutes (without necessarily being a coequalizer):

(4.1)

It is easy to see that ((MkX)kn,(μm,k)m+kn) is an Mn-algebra for every 𝒞-object X. Again, M0-algebras are just (non-graded) algebras for the monad (M0,η,μ00).
The semantics of modalities will later need the following property:

Definition 4.4 (Canonical algebras).

Let ()0:Alg1(𝕄)Alg0(𝕄) be the functor taking an M1-algebra A=((Ak)k1,(amk)m+k1) to the M0-algebra (A0,a00). An M1-algebra A is canonical if it is free over (A)0, i.e. if for every M1-algebra B and M0-homomorphism f:(A)0(B)0, there is a unique M1-homomorphism g:AB such that (g)0=f.

Lemma 4.5 ([14, Lemma 5.3]).

An M1-algebra A is canonical iff (4.1) is a coequalizer diagram in the category of M0-algebras.

5 Graded Quantitative Theories

Monads on 𝐒𝐞𝐭 are induced by equational theories [35]. By equipping each operation with an assigned depth and requiring each axiom to be of uniform depth, one obtains a notion of graded equational theory which, modulo size issues, can be brought into bijective correspondence with graded monads [37]. On the other hand, Mardare et al. [36] introduce a system of quantitative equational reasoning, with formulae of the form s=ϵt understood as “s differs from t by at most ϵ”. These quantitative equational theories induce monads on the category of metric spaces. We introduce a graded version of this system to present graded monads in 𝐌𝐞𝐭, keeping to finitary operations (and hence finite branching) for ease of presentation.

Definition 5.1 (Graded signatures, uniform terms).

A graded signature consists of an algebraic signature Σ and a function δ:Σ assigning a depth to each algebraic operation. Uniform depth of terms is then defined inductively: Variables have uniform depth 0, and for m-ary fΣ, f(t1,,tm) has uniform depth n+k if δ(f)=n and all ti have uniform depth k. In particular, constants cΣ, as terms, have uniform depth n for all nδ(c). We write 𝕋nΣX, or just 𝕋nX, for the set of terms of uniform depth n over X. A substitution of uniform depth n is a function σ:X𝕋nY. Such a substitution extends to a map σ:𝕋kX𝕋k+nY on terms for all k, where as usual one defines σ(f(t1,,tm))=f(σ(t1),,σ(tm)). A substitution is uniform-depth if it is of uniform depth n for some n.

Definition 5.2 (Graded quantitative theory).

For a set Z, we let (Z) denote the set of quantitative equalities z1=ϵz2 where z1,z2Z and ϵ[0,1]. Given a set X of variables, we then write (𝕋(X))=n(𝕋n(X)); that is, (𝕋(X)) is the set of uniform-depth quantitative equalities among Σ-terms over X. A quantitative theory 𝒯=(Σ,δ,E) consists of a graded signature (Σ,δ) and a set E𝒫((X))×(𝕋X) of axioms. Axioms (Γ,s=ϵt) are written in the form Γs=ϵt; we refer to Γ as the context of the axiom. The depth of Γs=ϵt is that of s=ϵt. We say that 𝒯 is depth-1 if all its operations and axioms have depth at most 1.

The context Γ of an axiom Γs=ϵt forms a constraint on the variables that is required in order for s=ϵt to hold. Correspondingly, derivability of quantitative equalities in (𝕋(X)) over a graded quantitative theory 𝒯=(Σ,δ,E) in a context Γ0𝒫((X)) is defined inductively by the following rules:

(𝐭𝐫𝐢𝐚𝐧𝐠)t=ϵss=ϵut=ϵ+ϵu(𝐫𝐞𝐟𝐥)s=0s(𝐬𝐲𝐦)t=ϵss=ϵt
(𝐰𝐤)t=ϵst=ϵs(ϵϵ)(𝐚𝐫𝐜𝐡){t=ϵsϵ>ϵ}t=ϵs(𝐚𝐬𝐬𝐧)ϕ(ϕΓ0)
(𝐚𝐱){σ(u)uΓ}σ(t)=ϵσ(s)((Γ,t=ϵs)E)(𝐧𝐞𝐱𝐩)t1=ϵs1tn=ϵsnf(t1,,tn)=ϵf(s1,,sn)

where σ is a uniform-depth substitution. Note the difference between rules (𝐚𝐱) and (𝐚𝐬𝐬𝐧): Quantitative equalities from the theory can be substituted into, while this is not sound for quantitative equalities from the context. A graded quantitative equational theory presents a graded monad 𝕄 on 𝐌𝐞𝐭 where MnX is the set of terms of uniform depth n over variables in X, quotiented by the equivalence relation that identifies terms s,t if s=0t is derivable in context X, with the distance dMn([s],[t])=ϵ of equivalence classes [s],[t]MnX being the least ϵ such that s=ϵt is derivable (which exists by (arch)). Multiplication collapses terms-over-terms, and the unit maps an element of xX to [x]M0X.

 Remark 5.3.

The above system for quantitative reasoning follows Ford et al. [20] in slight modifications to the original (ungraded) system [36]. In particular, we make do without a cut rule, and allow substitution only into axioms (substitution into derived equalities is then admissible [20]). We include the rule (nexp) ensuring that all operations are nonexpansive, i.e. the induced graded monad is enriched (acts nonexpansively on functions).

We recall that a graded monad is depth-1 [37, 14] if μnk and M0μ1k are epi-transformations and the diagram below is a coequalizer of M0-algebras for all X and n<ω:

(5.1)

By 4.5 the following is then immediate:

Proposition 5.4 ([14, Corollary 5.4]).

If 𝕄 is a depth-1 graded monad, then for every n and every object X, the M1-algebra with carriers MnX, Mn+1X and multiplications as algebra structure is canonical.

We briefly refer to canonical algebras as per the above proposition as being of the form MnX.
Crucially, we establish a metric variant of a result on depth-1 graded monads on 𝐒𝐞𝐭 [37]:

Theorem 5.5.

Graded monads on 𝐌𝐞𝐭 presented by depth-1 graded quantitative theories are depth-1.

 Remark 5.6.

A depth-1 graded monad 𝕄 can be reconstructed from its constituents of depth at most one, i.e. from M0, M1η, and the μnk for n+k1 [14]. Graded semantics (Section 6) does however make use of the full structure of 𝕄 also at higher depths.

Presentations of graded trace monads.

We proceed to investigate the quantitative-algebraic presentation of graded trace monads that are given by a Kleisli distributive law of the functor 𝒜×() (with 𝒜 being the space of action labels) over a monad (Example 4.2). Given a function k:[0,1]2[0,1] with suitable properties, we write  for the tensor that equips the Cartesian product of two sets with the metric dAB((a,b),(a,b))=k(d(a,a),d(b,b)) generated by k. This induces trace distances on 𝒜n, n0, by viewing 𝒜n as the n-fold tensor of 𝒜. Examples include the Euclidean (k(x,y)=x2+y2), supremum (k(x,y)=max(x,y)), and Manhattan (k(x,y)=xy) distances. The fact that k computes distances of traces recursively “one symbol at a time” translates into uniform depth-1 equations:

Definition 5.7.

Let 𝒯=(Σ,) be a quantitative algebraic presentation of a (plain) monad T on 𝐌𝐞𝐭. We define a graded quantitative theory 𝒯[𝒜] by including the operations and equations of 𝒯 at depth 0, along with unary depth-1 operations a for all labels a𝒜, and as depth-1 axioms the distributive laws a(f(x1,,xn))=0f(a(x1),,a(xn)) for all a𝒜 and fΣ, as well as the distance axioms x=ϵya(x)=k(d(a,b),ϵ)b(y).

The obvious candidate for a Kleisli distributive law inducing the graded monad presented by the theory 𝒯[𝒜] is the family of maps λX:𝒜TXT(𝒜X) given by

λX(a,t)=Ta,𝑖𝑑X(t) (5.2)

where a,𝑖𝑑X takes xX to (a,x)𝒜X. However, these maps λX may fail to be nonexpansive, depending on T and ; for instance, this happens for T=𝒟¯ω and  being Cartesian product × (which carries the supremum distance):

Example 5.8.

Put X={x,y} where d(x,y)=1, and s=0.5x+0.5y, t=1x𝒟¯ωX. Clearly d(s,t)=0.5. Given a,b𝒜 with d(a,b)=0.5, we have d((a,s),(b,t))=0.5 in 𝒜×𝒟¯ωX while d(λX(a,s),λX(b,t))=d(0.5(a,x)+0.5(a,y),1(b,x))=0.75 in 𝒟¯ω(𝒜×X).

Nonexpansiveness is, of course, needed to obtain a graded monad on 𝐌𝐞𝐭, and as we show later (6.3), its failure may cause undesirable effects. In the case of Manhattan distance, nonexpansiveness always holds:

Lemma 5.9.

The maps λX as per (5.2) are nonexpansive as maps 𝒜TXT(𝒜X).

In case the λX as per (5.2) are nonexpansive, we do in fact have that the distributive law λ and the algebraic theory 𝒯[𝒜] induce the same graded monad:

Lemma 5.10.

Let λX be defined by (5.2). If λX:𝒜TT(𝒜()) is nonexpansive for all X, then the λX form a Kleisli distributive law λ:𝒜TT(𝒜()), and the graded monad induced by λ according to Example 4.2 is presented by the quantitative equational theory 𝒯[𝒜] as per 5.7.

Example 5.11.

In our running example of finitely branching metric trace semantics, it is easy to check that the distributive law claimed in Example 4.2 is indeed nonexpansive, so the induced graded monad is, by 5.10, presented by the corresponding theory as per 5.7, and in particular is depth-1. Explicitly, recall [36, Corollary 9.4] that 𝒫¯ω is a monad, presented in quantitative algebra by the usual axioms of join semilattices for a binary join operation + and a constant 0 (nonexpansiveness of + is enforced by the deduction rules). The quantitative graded theory presenting the graded metric trace monad 𝒫¯ω(𝒜n×) according to 5.10 has depth-0 operators + and 0 as above and adds unary depth-1 operations a for all a𝒜, subject to axioms (for a,b𝒜, ϵ[0,1])

a(0)=00a(x+y)=0a(x)+a(y)x=ϵya(x)=ϵd𝒜(a,b)b(y).

The distribution of the operations a over the join semilattice structure effectively implements trace equivalence, and the last axiom determines the metric on traces, which in this case is taken to be the supremum metric.

6 Graded Quantitative Semantics and Graded Logics

We proceed to introduce the framework of graded quantitative semantics, to study spectra of behavioural metrics for various system types. By “spectra” we informally refer to collections of process comparisons of varying granularity that arise by observing a specific system type in different ways, as exemplified by the classical linear-time/branching-time spectrum on labelled transition systems [47]. Generally, a graded semantics [37] (𝕄,α) of a functor G:𝒞𝒞 consists of a graded monad 𝕄 and a natural transformation α:GM1. Intuitively, Mn1 (where 1 is a terminal object of 𝒞) is a domain of behaviours observable after n transition steps, with α determining behaviours after one step. For a G-coalgebra (X,γ), we inductively define behaviour maps γ(n):XMn1 assigning to a state in X its behaviour after n steps:

γ(0):XM0!ηM01γ(n+1):XαγM1XM1γ(n)M1Mn1μ1nMn+11

For 𝒞=𝐌𝐞𝐭, these maps induce a notion of graded behavioural distance (for readability, we refrain from working with more general 𝒞, such as categories of relational structures [20]):

Definition 6.1 (Graded behavioural distance).

Given a graded semantics α:GM1 of a functor G on 𝐌𝐞𝐭, (graded) behavioural distance is the pseudometric on states in G-coalgebras (X,γ) given by dα(x,y)=ndMn1(γ(n)(x),γ(n)(y)) for x,yX.

Example 6.2.

The metric trace semantics of finitely branching metric transition systems [11, 15] and closed-branching metric transition systems is captured by the graded metric trace monads Mn=𝒫¯ω(𝒜n×) and Mn=𝒫c(𝒜n×) (Example 4.2), respectively (with α being identity). The behaviour maps calculate, at each depth n, sets of length-n traces, whose distance is given by the Hausdorff distance induced by the supremum metric on traces.

 Remark 6.3.

In cases where nonexpansiveness of α or the natural transformations of 𝕄 does not hold (e.g. if one attempts to construct 𝕄 using a family of maps (5.2) that fails to be nonexpansive, cf. Example 5.8), other expected properties can fail. For instance, it can happen that trace distance exceeds branching time distance (while for trace semantics induced by nonexpansive graded semantics, general properties of graded semantics imply that trace distance is below branching-time distance, in tune with the two-valued setting where trace equivalence is coarser than bisimilarity). Example 5.8 manifests in the 𝒟¯ω(𝒜×)-coalgebra (i.e. generative probabilistic metric transition system) shown below, where 𝒜={a,b,c,d} with relevant distances d(a,b)=0.5 and d(c,d)=1:

Here, we have length-n trace distributions μxn=12(acan2)+12(adan2) and μyn=1(bcan2) for n2. When the metric on traces is defined via supremum distance, instead of Manhattan distance as in Section 3, the trace distance of the states x and y is nd(μxn,μyn)=0.75, while their branching-time distance (cf. Section 2) is 0.5.

We have the following criterion for invariance of a logic under a graded semantics (α,𝕄), with 𝕄 depth-1, for a functor G:𝐌𝐞𝐭𝐌𝐞𝐭 that we fix from now on; recall from Section 2 that we use Ω to denote the unit interval [0,1] equipped with Euclidean distance.

Definition 6.4 (Graded logic).

Let o:M0ΩΩ be an M0-algebra structure on Ω. A logic  is a graded logic (for (α,𝕄)) if the following hold:

  1. 1.

    For n-ary p𝒪, the semantics p is an M0-algebra homomorphism (Ω,o)n(Ω,o).

  2. 2.

    For each LΛ, there is an associated nonexpansive map L:M1ΩΩ such that the semantics L:GΩΩ factors as L=(GΩαΩM1ΩLΩ), and such that the tuple (Ω,Ω,o,o,L) constitutes an M1-algebra (that is, L satisfies homomorphy and coequalization, cf. Section 2). We abuse notation and write L to denote the M1-algebra (Ω,Ω,o,o,L).

Notice the different treatment of nullary propositional operators and truth constants: The former are required to be interpreted as homomorphisms 1(Ω,o) in a graded logic, while no such condition is imposed on truth constants. In many examples, α=id, in which case condition 2 just states that (Ω,Ω,o,o,L) is an M1-algebra (non-identity α are associated, for instance, with readiness and failure semantics [14]).

Definition 6.5.

We say that is invariant with respect to a graded semantics (α,𝕄) if ddα holds in all G-coalgebras; expressive if ddα; and characteristic if d=dα.

Theorem 6.6 ([24, Proposition 21]).

Let be a graded logic for (α,𝕄). Then the evaluation maps ϕγ of uniform-depth -formulae ϕ on G-coalgebras (X,γ) are nonexpansive w.r.t. behavioural distance dα, and hence is invariant.

The assumption of uniform depth cannot be removed in general [24].

Example 6.7.

We have a graded logic 𝗆𝗍𝗋𝖺𝖼𝖾 for metric trace semantics (Example 6.2) featuring modalities a for all a𝒜 as in 2.4, a single truth constant 1, and no propositional operators. We equip the set Ω=[0,1] of truth values with the usual 𝒫¯ω-algebra (i.e. join semilattice) structure ([0,1],,0), and let 1^:1[0,1] take the value 1. The logic 𝗆𝗍𝗋𝖺𝖼𝖾 remains invariant under metric trace semantics when extended with propositional operators that are nonexpansive join-semilattice morphisms, such as . Analogously we define the logic 𝖼𝗆𝗍𝗋𝖺𝖼𝖾 for trace semantics of closed-branching metric transition systems. Notice that the interpretation of 1 fails to be homomorphic, so 1 needs to be a truth constant.

7 Expressivity Criteria

We proceed to adapt expressivity criteria appearing in previous work on two-valued behavioural equivalences [14, 19] to the quantitative setting, which poses quite specific challenges. A key role in the treatment of expressivity of logics will be played by the notion of initiality [1].

Definition 7.1.

A family of maps (fi:AB)iI between metric spaces A and B is initial if A carries the smallest (pseudo-)metric making all maps fi nonexpansive, explicitly: d(x,y)=id(fi(x),fi(y)).

Using this notion, the definition of expressivity can be rephrased as follows: An invariant logic  is expressive if for every G-coalgebra (X,γ), the family of all evaluation maps ϕγ of uniform-depth formulae ϕ is initial on (X,dα).

 Remark 7.2.

In the branching-time case, a stronger notion of expressivity, roughly phrased as density of the set of depth-n formulae in the set of nonexpansive properties at depth n, follows from expressivity under certain additional conditions [22, 48, 49, 51, 33], using lattice-theoretic variants of the Stone-Weierstraß theorem. The analogue of the Stone-Weierstraß theorem in general fails for coarser semantics. Also, for semantics coarser than branching time, expressivity in the sense of 6.5 can often be established using more economic sets of propositional operators (e.g. no propositional operators at all), for which density will clearly fail.

Our expressivity result is based on propagating initiality through an induction on depth. Unlike in the Eilenberg-Moore case [24], this requires, in many examples, to strengthen the inductive invariant; we treat this systematically as follows:

Definition 7.3.

An initiality invariant is a property Φ of sets 𝔄𝐌𝐞𝐭(X,Ω) of nonexpansive functions such that (i) every family of maps satisfying Φ is initial, and (ii) Φ is upwards closed w.r.t. subset inclusion.

Example 7.4.
  1. 1.

    Initiality itself is an initiality invariant. If Φ is initiality, then we say “initial-type” for “Φ-type”.

  2. 2.

    We say that 𝔄𝐌𝐞𝐭(X,Ω) is normed isometric if whenever d(x,y)>ϵ for x,yX and ϵ>0, then there is some f𝔄 such that |f(x)f(y)|>ϵ and f(x)f(y)=1. Normed isometry is an initiality invariant.

Our expressivity criterion then takes the following shape:

Definition 7.5.

Let Φ be an initiality invariant. A graded logic =(Θ,𝒪,Λ) with truth value object (Ω,o) is Φ-type depth-0 separating if the family of maps {oM0c^:M01ΩcΘ} has property Φ. Moreover,  is Φ-type depth-1 separating if whenever A is a canonical M1-algebra of the form Mn1 (5.4) and 𝔄 is a set of M0-homomorphisms A0Ω that has property Φ and is closed under the propositional operators in 𝒪, then the set

Λ(𝔄):={L(g):A1ΩLΛ,g𝔄}

has property Φ, where L(g):A1Ω is the (by canonicity, unique) morphism extending the M0-algebra morphism g to an M1-algebra morphism AL (6.4).

Theorem 7.6 (Expressivity).

Let Φ be an initiality invariant, and suppose that a graded logic is both Φ-type depth-0 separating and Φ-type depth-1 separating. Then is expressive.

 Remark 7.7.

Our definition of separation differs from notions used for two-valued logics [14, 19] and for quantitative graded semantics induced by Eilenberg-Moore distributive laws [24], which overall have turned out to be much more well-behaved than the more general setting of the present work. The most obvious novelty is the use of an initiality invariant Φ strengthening the induction hypothesis in the inductive proof of Theorem 7.6. We will see that this is needed even in very simple examples in our more general setting. Moreover, we have phrased separation in terms of the specific canonical algebras Mn1 on which it is needed, rather than on unrestricted canonical algebras. This allows exploiting additional properties of Mn1, e.g. that for graded monads Mn=TFn arising from Kleisli distributive laws (Example 4.2), Mn1 is free as an M0-algebra.

Example 7.8.
  1. 1.

    Metric Streams: A simple example for failure of initial-type separation (Example 7.4) are metric streams, i.e. streams over a metric space of labels (𝒜,d𝒜); these are coalgebras for the functor G=𝒜×. Behavioural distance on streams is captured by the graded monad Gn=𝒜n×{}. The logic  consisting of the truth constant 1 and modalities a for all a𝒜, with interpretation a:𝒜×[0,1][0,1] given by (b,v)(1d𝒜(a,b))v, is Φ-type depth-0 separating and Φ-type depth-1 separating for Φ being normed isometry, and hence expressive by Theorem 7.6. (The modality a restricts the corresponding modality for metric transition systems as per 2.4 and 6.7 to metric streams: a state satisfies aϕ to the degree that its output is close to a and its successor satisfies ϕ). On the other hand,  fails to be initial-type depth-1 separating, illustrating the necessity of the general form of Theorem 7.6.

  2. 2.

    Metric transition systems: The graded logics 𝗆𝗍𝗋𝖺𝖼𝖾 and 𝖼𝗆𝗍𝗋𝖺𝖼𝖾 for metric trace semantics (Example 6.7), in the version with no propositional operators, are Φ-type depth-0 separating and Φ-type depth-1 separating for Φ being normed isometry, and hence are expressive by Theorem 7.6. We thus improve on an example from recent work based on Galois connections [4], where application of the general framework required the inclusion of propositional shift operators (which were subsequently eliminated in an ad-hoc manner), and we generalize to systems with closed branching on a metric state space.

  3. 3.

    Probabilistic metric trace semantics is modelled straightforwardly as a graded semantics using a graded trace monad (Example 4.2). By Theorem 3.2, however, there is no graded logic for probabilistic metric trace semantics that satisfies the conditions of Theorem 7.6.

 Remark 7.9.

In a recent approach based on Galois connections [4, 5], logics are related to fixpoints of behaviour functions induced by the logic itself (similar to approaches that define trace semantics via intended characteristic logics [31]), while our present interest is in providing logical characterizations of given behavioural distances. The Galois framework is highly general, and in fact not even tied to coalgebraic modelling, or in fact to state-based systems of any kind [4], but correspondingly offers less concrete recipes. Instantiated to our current setup, the key condition of compatibility appearing in op. cit. roughly speaking amounts to initial-type depth-1 separation of the logic w.r.t. its own Kantorovich lifting [2, 5].

 Remark 7.10 (Branching-time semantics).

Any functor G yields a graded monad given by iterated application of G, that is Mn=Gn, and by unit and multiplication being identity [37]. In general, the finite-depth branching-time semantics of a G-coalgebra (X,γ) is defined via its canonical cone (pi:XGi1)i<ω into the final sequence 1!G1G!G21 of G. The pi are defined inductively by p0=!:X1 and pi+1=Gpiγ. This semantics is captured by the graded monad Mn=Gn and α=𝑖𝑑 [37]. More specifically, the finite-depth branching-time behavioural distance of states x,yX is i<ωd(pi(x),pi(y)), and thus agrees with the graded behavioural distance obtained via the graded semantics in the graded monad Mn=Gn. This monad has M0=𝑖𝑑, so that the corresponding graded logics are just branching-time logics without further restriction [37, 14]. Coalgebraic quantitative logics of this kind have received some recent attention [22, 48, 49, 51, 11, 30, 33]. Suppose Λ is a finite separating set of modalities, i.e. the maps LGf:GXΩ, with L ranging over modalities and f over nonexpansive maps XΩ, form an initial family. Moreover, let 𝒪 contain truth 1, meet , fuzzy negation ¬ (i.e. ¬x=1x), and truncated addition of constants ()c. Then one shows using a variant of the Stone-Weierstraß theorem [51] that the graded logic  given by Λ, 𝒪, and Θ= is initial-type depth-0 separating and initial-type depth-1 separating. By Theorem 7.6, we obtain that  is expressive. Previous work on quantitative branching-time logics [51, 33, 48, 49, 22] discusses, amongst other things, conditions on G that allow concluding expressivity even for infinite-depth behavioural distance.

8 Case Study: Fuzzy Metric Trace Semantics

We apply the recipe outlined above to obtain a characteristic logic for trace distance on fuzzy metric transition systems. That is, we proceed as follows: We cast fuzzy metric trace distance as a graded semantics using a suitable depth-1 graded monad 𝕄, and check that 𝕄 is depth-1 using the techniques outlined in Section 5. We then identify a corresponding graded logic , verifying the requirements of 6.4. Invariance of then follows automatically (Theorem 6.6). Finally, we show expressivity using Theorem 7.6.

A fuzzy 𝒜-labelled metric transition system (fuzzy metric LTS) [12, 54, 55, 30]) consists of a set (or metric space) X of states and a fuzzy transition relation R:X×𝒜×X[0,1], with 𝒜 a metric space. A fuzzy LTS (X,R) is finitely branching if {(a,y)R(x,a,y)>0} is finite for every xX. Equivalently, a finitely branching fuzzy LTS is a coalgebra for the functor ¯ω(𝒜×()) (cf. 2.2.4).

A natural fuzzy trace semantics of fuzzy transition systems assigns to each state x of a fuzzy LTS (X,R) a fuzzy trace set 𝑇𝑟(x)ω(𝒜) where

𝑇𝑟(x)(a1an)={i=1nR(xi1,ai,xi)x=x0,x1,,xnX}.

This notion of trace relates, for instance, to a notion of fuzzy path that is implicit in the semantics of fuzzy computation tree logic [38] and to notions of fuzzy language accepted by fuzzy automata (e.g. [3]). We obtain a notion of fuzzy trace distance dT of states x,y, given by the distance of 𝑇𝑟(x), 𝑇𝑟(y) in ¯ω(𝒜), i.e. under fuzzy Hausdorff distance (2.2.4) w.r.t. the metric on 𝒜 that is the supremum metric on each 𝒜n, and assigns distance 1 to traces of different lengths. To capture this distance in a graded semantics, consider the distributive law λ:𝒜ׯω()¯ω(𝒜×) given by λ(a,U)(a,x)=U(x) and λ(a,U)(b,x)=0 for ba. By Example 4.2 we thus obtain the graded fuzzy metric trace monad Mn=¯ω(𝒜n×()). The monad ¯ω can be presented by the following quantitative equational theory: Take a binary operation +, a constant 0, and unary operations r for every r[0,1]. Impose strict equations (=0) saying that +0 form a join semilattice structure and that the operations r define an action of the monoid ([0,1],) (i.e. 1(x)=x, r(s(x))=0(rs)(x)). Finally, impose axioms x=ϵyr(x)=ϵs(y) for r,s[0,1] such that |rs|ϵ. By 5.10, the graded fuzzy trace monad Mn=¯ω(𝒜n×X) is presented by the above algebraic description of ¯ω at depth 0, with additional depth-1 unary operations a for a𝒜 and depth-1 equations a(x+y)=0a(x)+a(y), a(0)=00, a(r(x))=0r(a(x)), and x=ϵya(x)=ϵd(a,b)b(y).

Fuzzy metric trace logic interprets the additional operations r[0,1] on the truth value object [0,1] by r(x)=rx, and otherwise uses the same quantitative join semilattice structure as for metric trace semantics (Example 6.7). We include the truth constant 1 and modal operators ac for a𝒜 and c[0,1], with interpretation ac:M1[0,1][0,1] given by ac(A)=b𝒜,v[0,1]A(b,v)v(cd(a,b)). (When 𝒜 is discrete, then a1 is the usual fuzzy diamond modality, e.g. [18]). Thus, a state x in a fuzzy metric transition system satisfies acϕ to the degree that x has a b-successor y with b close to a and y satisfying ϕ; crucially, “closeness” of b to a needs to be shifted down as governed by the parameter c. This logic is initial-type depth-0 separating and initial-type depth-1 separating, and hence expressive for fuzzy trace distance by Theorem 7.6; both this result and the logic itself appear to be new (the case with 𝒜 discrete is partially covered in work on Galois connections [5]). Indeed for non-discrete 𝒜, the logic with only a1 instead of all ac fails to be expressive. The logic remains invariant when extended with additional nonexpansive propositional operators that are ¯ω-homomorphic, such as .

9 Conclusions

We have shown that there is no unary quantitative coalgebraic modal logic characterizing a natural notion of quantitative trace distance on probabilistic metric transition systems. Moving onwards from this observation, we have developed a generic framework for linear-time/branching-time spectra of behavioural distances on state-based systems in coalgebraic generality, covering, for instance, metric, probabilistic, and fuzzy transition systems. Unlike previous work on Eilenberg-Moore-style coalgebraic trace distances [5, 24], the framework covers also systems with labels from a metric space. The key abstractions in the framework are based on the notion of a graded monad on the category of metric spaces and an arising notion of quantitative graded semantics. We have provided a graded quantitative algebraic system for the description of such graded monads (extending and modifying the existing non-graded system [36]). Moreover, we have established sufficient conditions for canonical invariant quantitative graded logics [24] to be expressive for given quantitative graded semantics, and we have exploited this result to obtain expressive logics for some instances of Kleisli-type trace semantics [27], notably including a new result for fuzzy metric trace semantics.

One important next step in the development will be to identify a generic game-based characterization of behavioural distances in the framework of graded semantics, generalizing work specific to metric transition systems [15] and building on game-based concepts for two-valued graded semantics [21]. Also, there is interest in computing distinguishing quantitative formulae (cf. [10, 52] for the two-valued branching-time setting), generalizing recent results for the branching-time case [40] to spectra of coarser semantics.

References

  • [1] Jiří Adámek, Horst Herrlich, and George E. Strecker. Abstract and Concrete Categories. John Wiley and Sons, 1990. Reprint: http://www.tac.mta.ca/tac/reprints/articles/17/tr17abs.html.
  • [2] Paolo Baldan, Filippo Bonchi, Henning Kerstan, and Barbara König. Coalgebraic behavioral metrics. Log. Methods Comput. Sci., 14(3), 2018. doi:10.23638/LMCS-14(3:20)2018.
  • [3] Radim Belohlávek. Determinism and fuzzy automata. Inf. Sci., 143(1-4):205–209, 2002. doi:10.1016/S0020-0255(02)00192-5.
  • [4] Harsh Beohar, Sebastian Gurke, Barbara König, and Karla Messing. Hennessy-Milner theorems via Galois connections. In Bartek Klin and Elaine Pimentel, editors, Computer Science Logic, CSL 2023, volume 252 of LIPIcs, pages 12:1–12:18. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2023. doi:10.4230/LIPIcs.CSL.2023.12.
  • [5] Harsh Beohar, Sebastian Gurke, Barbara König, Karla Messing, Jonas Forster, Lutz Schröder, and Paul Wild. Expressive quantale-valued logics for coalgebras: An adjunction-based approach. In Olaf Beyersdorff, Mamadou Moustapha Kanté, Orna Kupferman, and Daniel Lokshtanov, editors, Theoretical Aspects of Computer Science, STACS 2024, volume 289 of LIPIcs, pages 10:1–10:19. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2024. doi:10.4230/LIPICS.STACS.2024.10.
  • [6] Marco Bernardo and Stefania Botta. A survey of modal logics characterising behavioural equivalences for non-deterministic and stochastic systems. Math. Struct. Comput. Sci., 18(1):29–55, 2008. doi:10.1017/S0960129507006408.
  • [7] Valentina Castiglioni, Konstantinos Chatzikokolakis, and Catuscia Palamidessi. A logical characterization of differential privacy via behavioral metrics. In Kyungmin Bae and Peter Ölveczky, editors, Formal Aspects of Component Software, FACS 2018, volume 11222 of LNCS, pages 75–96. Springer, 2018. doi:10.1007/978-3-030-02146-7.
  • [8] Valentina Castiglioni, Daniel Gebler, and Simone Tini. Logical characterization of bisimulation metrics. In Mirco Tribastone and Herbert Wiklicky, editors, Quantitative Aspects of Programming Languages and Systems, QAPL 2016, volume 227 of EPTCS, pages 44–62, 2016. doi:10.4204/EPTCS.227.
  • [9] Ivan Christoff. Testing equivalences and fully abstract models for probabilistic processes. In Jos C. M. Baeten and Jan Willem Klop, editors, Theories of Concurrency: Unification and Extension, CONCUR 1990, volume 458 of LNCS, pages 126–140. Springer, 1990. doi:10.1007/BFb0039056.
  • [10] Rance Cleaveland. On automatically explaining bisimulation inequivalence. In Edmund M. Clarke and Robert P. Kurshan, editors, Computer Aided Verification, CAV 1990, volume 531 of LNCS, pages 364–372. Springer, 1990. doi:10.1007/BFB0023750.
  • [11] Luca de Alfaro, Marco Faella, and Mariëlle Stoelinga. Linear and branching system metrics. IEEE Trans. Software Eng., 35(2):258–273, 2009. doi:10.1109/TSE.2008.106.
  • [12] Liliana D’Errico and Michele Loreti. Modeling fuzzy behaviours in concurrent systems. In Giuseppe F. Italiano, Eugenio Moggi, and Luigi Laura, editors, Theoretical Computer Science, 10th Italian Conference, ICTCS 2007, pages 94–105. World Scientific, 2007. doi:10.1142/9789812770998_0012.
  • [13] Josée Desharnais, Vineet Gupta, Radha Jagadeesan, and Prakash Panangaden. Metrics for labelled Markov processes. Theor. Comput. Sci., 318(3):323–354, 2004. doi:10.1016/j.tcs.2003.09.013.
  • [14] Ulrich Dorsch, Stefan Milius, and Lutz Schröder. Graded monads and graded logics for the linear time - branching time spectrum. In Wan J. Fokkink and Rob van Glabbeek, editors, Concurrency Theory, CONCUR 2019, volume 140 of LIPIcs, pages 36:1–36:16. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2019. doi:10.4230/LIPIcs.CONCUR.2019.36.
  • [15] Uli Fahrenberg and Axel Legay. The quantitative linear-time-branching-time spectrum. Theor. Comput. Sci., 538:54–69, 2014. doi:10.1016/j.tcs.2013.07.030.
  • [16] Uli Fahrenberg, Axel Legay, and Claus Thrane. The quantitative linear-time–branching-time spectrum. In Supratik Chakraborty and Amit Kumar, editors, Foundations of Software Technology and Theoretical Computer Science, FSTTCS 2011, volume 13 of LIPIcs, pages 103–114. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2011. doi:10.4230/LIPIcs.FSTTCS.2011.103.
  • [17] Ihor Filimonov, Ross Horne, Sjouke Mauw, and Zach Smith. Breaking unlinkability of the ICAO 9303 standard for e-passports using bisimilarity. In Kazue Sako, Steve A. Schneider, and Peter Y. A. Ryan, editors, Computer Security, ESORICS 2019, volume 11735 of LNCS, pages 577–594. Springer, 2019. doi:10.1007/978-3-030-29959-0_28.
  • [18] Melvin Fitting. Many-valued modal logics. Fund. Inform., 15:235–254, 1991. doi:10.3233/FI-1991-153-404.
  • [19] Chase Ford, Stefan Milius, and Lutz Schröder. Behavioural preorders via graded monads. In Logic in Computer Science, LICS 2021, pages 1–13. IEEE, 2021. doi:10.1109/LICS52264.2021.9470517.
  • [20] Chase Ford, Stefan Milius, and Lutz Schröder. Monads on categories of relational structures. In Fabio Gadducci and Alexandra Silva, editors, Algebra and Coalgebra in Computer Science, CALCO 2021, volume 211 of LIPIcs, pages 14:1–14:17. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2021. doi:10.4230/LIPIcs.CALCO.2021.14.
  • [21] Chase Ford, Stefan Milius, Lutz Schröder, Harsh Beohar, and Barbara König. Graded monads and behavioural equivalence games. In Christel Baier and Dana Fisman, editors, Logic in Computer Science, LICS 2022, pages 61:1–61:13. ACM, 2022. doi:10.1145/3531130.3533374.
  • [22] Jonas Forster, Sergey Goncharov, Dirk Hofmann, Pedro Nora, Lutz Schröder, and Paul Wild. Quantitative Hennessy-Milner theorems via notions of density. In Bartek Klin and Elaine Pimentel, editors, Computer Science Logic, CSL 2023, volume 252 of LIPIcs, pages 22:1–22:20. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2023. doi:10.4230/LIPIcs.CSL.2023.22.
  • [23] Jonas Forster, Lutz Schröder, and Paul Wild. Quantitative graded semantics and spectra of behavioural metrics. CoRR, abs/2306.01487, 2023. doi:10.48550/arXiv.2306.01487.
  • [24] Jonas Forster, Lutz Schröder, Paul Wild, Harsh Beohar, Sebastian Gurke, and Karla Messing. Graded semantics and graded logics for Eilenberg-Moore coalgebras. In Barbara König and Henning Urbat, editors, Coalgebraic Methods in Computer Science, CMCS 2024, volume 14617 of LNCS, pages 114–134. Springer, 2024. doi:10.1007/978-3-031-66438-0_6.
  • [25] Alessandro Giacalone, Chi-Chang Jou, and Scott Smolka. Algebraic reasoning for probabilistic concurrent systems. In Manfred Broy, editor, Programming concepts and methods, PCM 1990, pages 443–458. North-Holland, 1990.
  • [26] Sergey Goncharov, Dirk Hofmann, Pedro Nora, Lutz Schröder, and Paul Wild. Kantorovich functors and characteristic logics for behavioural distances. In Orna Kupferman and Pawel Sobocinski, editors, Foundations of Software Science and Computation Structures, FoSSaCS 2023, volume 13992 of LNCS, pages 46–67. Springer, 2023. doi:10.1007/978-3-031-30829-1_3.
  • [27] Ichiro Hasuo, Bart Jacobs, and Ana Sokolova. Generic trace semantics via coinduction. Log. Methods Comput. Sci., 3(4), 2007. doi:10.2168/LMCS-3(4:11)2007.
  • [28] Matthew Hennessy and Robin Milner. Algebraic laws for nondeterminism and concurrency. J. ACM, 32(1):137–161, 1985. doi:10.1145/2455.2460.
  • [29] Bart Jacobs, Alexandra Silva, and Ana Sokolova. Trace semantics via determinization. J. Comput. Syst. Sci., 81(5):859–879, 2015. doi:10.1016/j.jcss.2014.12.005.
  • [30] Manisha Jain, Alexandre Madeira, and Manuel A. Martins. A fuzzy modal logic for fuzzy transition systems. In Amy P. Felty and João Marcos, editors, Logical and Semantic Frameworks with Applications, LSFA 2019, volume 348 of ENTCS, pages 85–103. Elsevier, 2019. doi:10.1016/j.entcs.2020.02.006.
  • [31] Bartek Klin and Jurriaan Rot. Coalgebraic trace semantics via forgetful logics. Log. Methods Comput. Sci., 12(4), 2016. doi:10.2168/LMCS-12(4:10)2016.
  • [32] Yuichi Komorida, Shin-ya Katsumata, Clemens Kupke, Jurriaan Rot, and Ichiro Hasuo. Expressivity of quantitative modal logics : Categorical foundations via codensity and approximation. In Logic in Computer Science, LICS 2021, pages 1–14. IEEE, 2021. doi:10.1109/LICS52264.2021.9470656.
  • [33] Barbara König and Christina Mika-Michalski. (metric) bisimulation games and real-valued modal logics for coalgebras. In Sven Schewe and Lijun Zhang, editors, Concurrency Theory, CONCUR 2018, volume 118 of LIPIcs, pages 37:1–37:17. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2018. doi:10.4230/LIPIcs.CONCUR.2018.37.
  • [34] Clemens Kupke and Jurriaan Rot. Expressive logics for coinductive predicates. Log. Methods Comput. Sci., 17(4), 2021. doi:10.46298/lmcs-17(4:19)2021.
  • [35] F. E. J. Linton. Some aspects of equational categories. In S. Eilenberg, D. K. Harrison, S. MacLane, and H. Röhrl, editors, Proceedings of the Conference on Categorical Algebra, pages 84–94. Springer, 1966. doi:10.1007/978-3-642-99902-4_3.
  • [36] Radu Mardare, Prakash Panangaden, and Gordon D. Plotkin. Quantitative algebraic reasoning. In Martin Grohe, Eric Koskinen, and Natarajan Shankar, editors, Logic in Computer Science, LICS 2016, pages 700–709. ACM, 2016. doi:10.1145/2933575.2934518.
  • [37] Stefan Milius, Dirk Pattinson, and Lutz Schröder. Generic trace semantics and graded monads. In Lawrence S. Moss and Pawel Sobocinski, editors, Algebra and Coalgebra in Computer Science, CALCO 2015, volume 35 of LIPIcs, pages 253–269. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2015. doi:10.4230/LIPIcs.CALCO.2015.253.
  • [38] Haiyu Pan, Yongming Li, Yongzhi Cao, and Zhanyou Ma. Model checking computation tree logic over finite lattices. Theor. Comput. Sci., 612:45–62, 2016. doi:10.1016/j.tcs.2015.10.014.
  • [39] Dirk Pattinson. Expressive logics for coalgebras via terminal sequence induction. Notre Dame J. Formal Log., 45(1):19–33, 2004. doi:10.1305/NDJFL/1094155277.
  • [40] Amgad Rady and Franck van Breugel. Explainability of probabilistic bisimilarity distances for labelled Markov chains. In Orna Kupferman and Pawel Sobocinski, editors, Foundations of Software Science and Computation Structures, FoSSaCS 2023, volume 13992 of LNCS, pages 285–307. Springer, 2023. doi:10.1007/978-3-031-30829-1_14.
  • [41] Jurriaan Rot, Bart Jacobs, and Paul Blain Levy. Steps and traces. J. Log. Comput., 31(6):1482–1525, 2021. doi:10.1093/logcom/exab050.
  • [42] Jan J. M. M. Rutten. Relators and metric bisimulations. In Bart Jacobs, Larry Moss, Horst Reichel, and Jan J. M. M. Rutten, editors, Coalgebraic Methods in Computer Science, CMCS 1998, volume 11 of ENTCS, pages 252–258. Elsevier, 1998. doi:10.1016/S1571-0661(04)00063-5.
  • [43] Jan J. M. M. Rutten. Universal coalgebra: a theory of systems. Theor. Comput. Sci., 249(1):3–80, 2000. doi:10.1016/S0304-3975(00)00056-6.
  • [44] Lutz Schröder. Expressivity of coalgebraic modal logic: The limits and beyond. Theor. Comput. Sci., 390(2-3):230–247, 2008. doi:10.1016/j.tcs.2007.09.023.
  • [45] Lutz Schröder and Dirk Pattinson. Description logics and fuzzy probability. In Toby Walsh, editor, International Joint Conference on Artificial Intelligence, IJCAI 2011, pages 1075–1081. IJCAI/AAAI, 2011. doi:10.5591/978-1-57735-516-8/IJCAI11-184.
  • [46] Franck van Breugel and James Worrell. A behavioural pseudometric for probabilistic transition systems. Theor. Comput. Sci., 331(1):115–142, 2005. doi:10.1016/j.tcs.2004.09.035.
  • [47] Rob J. van Glabbeek. The linear time - branching time spectrum I. In Jan A. Bergstra, Alban Ponse, and Scott A. Smolka, editors, Handbook of Process Algebra, pages 3–99. North-Holland/Elsevier, 2001. doi:10.1016/b978-044482830-9/50019-9.
  • [48] Paul Wild and Lutz Schröder. Characteristic logics for behavioural metrics via fuzzy lax extensions. In Igor Konnov and Laura Kovács, editors, Concurrency Theory, CONCUR 2020, volume 171 of LIPIcs, pages 27:1–27:23. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2020. doi:10.4230/LIPIcs.CONCUR.2020.27.
  • [49] Paul Wild and Lutz Schröder. A quantified coalgebraic van Benthem theorem. In Stefan Kiefer and Christine Tasson, editors, Foundations of Software Science and Computation Structures, FOSSACS 2021, volume 12650 of LNCS, pages 551–571. Springer, 2021. doi:10.1007/978-3-030-71995-1_28.
  • [50] Paul Wild and Lutz Schröder. Characteristic logics for behavioural hemimetrics via fuzzy lax extensions. Log. Methods Comput. Sci., 18(2), 2022. doi:10.46298/lmcs-18(2:19)2022.
  • [51] Paul Wild, Lutz Schröder, Dirk Pattinson, and Barbara König. A van Benthem theorem for fuzzy modal logic. In Anuj Dawar and Erich Grädel, editors, Logic in Computer Science, LICS 2018, pages 909–918. ACM, 2018. doi:10.1145/3209108.3209180.
  • [52] Thorsten Wißmann, Stefan Milius, and Lutz Schröder. Explaining behavioural inequivalence generically in quasilinear time. In Serge Haddad and Daniele Varacca, editors, Concurrency Theory, CONCUR 2021, volume 203 of LIPIcs, pages 32:1–32:18. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2021. doi:10.4230/LIPICS.CONCUR.2021.32.
  • [53] James Worrell. Coinduction for recursive data types: partial orders, metric spaces and omega-categories. In Horst Reichel, editor, Coalgebraic Methods in Computer Science, CMCS 2000, volume 33 of ENTCS, pages 337–356. Elsevier, 2000. doi:10.1016/S1571-0661(05)80356-1.
  • [54] Hengyang Wu, Taolue Chen, Tingting Han, and Yixiang Chen. Bisimulations for fuzzy transition systems revisited. Int. J. Approx. Reason., 99:1–11, 2018. doi:10.1016/j.ijar.2018.04.010.
  • [55] Hengyang Wu, Yixiang Chen, Tian-Ming Bu, and Yuxin Deng. Algorithmic and logical characterizations of bisimulations for non-deterministic fuzzy transition systems. Fuzzy Sets Syst., 333:106–123, 2018. doi:10.1016/j.fss.2017.02.008.