This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

\EventEditors

Serge Haddad and Daniele Varacca \EventNoEds2 \EventLongTitle32nd International Conference on Concurrency Theory (CONCUR 2021) \EventShortTitleCONCUR 2021 \EventAcronymCONCUR \EventYear2021 \EventDateAugust 23–27, 2021 \EventLocationVirtual Conference \EventLogo \SeriesVolume203 \ArticleNo32 stix@largesymbols"0E stix@largesymbols"0F Radboud University, Nijmegen, The Netherlands [email protected]://orcid.org/0000-0001-8993-6486Work forms part of the NWO TOP project 612.001.852 and the DFG-funded project COAX (MI 717/5-2) Friedrich-Alexander-Universität Erlangen-Nürnberg, [email protected]://orcid.org/0000-0002-2021-1644 Work forms part of the DFG-funded project CoMoC (MI 717/7-1) Friedrich-Alexander-Universität Erlangen-Nürnberg, [email protected]://orcid.org/0000-0002-3146-5906Work forms part of the DFG-funded project CoMoC (SCHR 1118/15-1) \CopyrightT. Wißmann, S. Milius, and L. Schröder \relatedversion \relatedversiondetailsFull Version with Appendixhttps://arxiv.org/abs/2105.00669 {CCSXML} <ccs2012> <concept> <concept_id>10003752.10003790</concept_id> <concept_desc>Theory of computation Logic</concept_desc> <concept_significance>500</concept_significance> </concept> </ccs2012> \ccsdesc[500]Theory of computation Logic {CCSXML} <ccs2012> <concept> <concept_id>10003752.10010124.10010138.10010143</concept_id> <concept_desc>Theory of computation Program analysis</concept_desc> <concept_significance>500</concept_significance> </concept> </ccs2012> \ccsdesc[500]Theory of computation Program analysis

Explaining Behavioural Inequivalence Generically
in Quasilinear Time

Thorsten Wißmann    Stefan Milius    Lutz Schröder
Abstract

We provide a generic algorithm for constructing formulae that distinguish behaviourally inequivalent states in systems of various transition types such as nondeterministic, probabilistic or weighted; genericity over the transition type is achieved by working with coalgebras for a set functor in the paradigm of universal coalgebra. For every behavioural equivalence class in a given system, we construct a formula which holds precisely at the states in that class. The algorithm instantiates to deterministic finite automata, transition systems, labelled Markov chains, and systems of many other types. The ambient logic is a modal logic featuring modalities that are generically extracted from the functor; these modalities can be systematically translated into custom sets of modalities in a postprocessing step. The new algorithm builds on an existing coalgebraic partition refinement algorithm. It runs in time 𝒪((m+n)logn)\mathcal{O}((m+n)\log n) on systems with nn states and mm transitions, and the same asymptotic bound applies to the dag size of the formulae it constructs. This improves the bounds on run time and formula size compared to previous algorithms even for previously known specific instances, viz. transition systems and Markov chains; in particular, the best previous bound for transition systems was 𝒪(mn)\mathcal{O}(mn).

keywords:
bisimulation, partition refinement, modal logic, distinguishing formulae, coalgebra

1 Introduction

For finite transition systems, the Hennessy-Milner theorem guarantees that two states are bisimilar if and only if they satisfy the same modal formulae. This implies that whenever two states are not bisimilar, then one can find a modal formula that holds at one of the states but not at the other. Such a formula explains the difference of the two states’ behaviour and is thus usually called a distinguishing formula [13]. For example, in the transition system in Figure 2, the formula \Box\Diamond\top distinguishes the states xx and yy because xx satisfies \Box\Diamond\top whereas yy does not. Given two states in a finite transition system with nn states and mm transitions, the algorithm by Cleaveland [13] computes a distinguishing formula in time 𝒪(mn)\mathcal{O}(mn). The algorithm builds on the Kanellakis-Smolka partition refinement algorithm [28, 29], which computes the bisimilarity relation on a transition system within the same time bound.

\bulletxx\bullet\bulletyy\bullet
Figure 1: Example of a transition system
\bulletyy\bulletxx\bullet\bullet10.510.5
Figure 2: Example of a Markov chain

Similar logical characterizations of bisimulation exist for other system types. For instance, Desharnais et al. [16, 17] characterize probabilistic bisimulation on (labelled) Markov chains, in the sense of Larsen and Skou [33] (for each label, every state has either no successors or a probability distribution on successors). In their logic, a formula pϕ\Diamond_{\geq p}\phi holds at states that have a transition probability of at least pp to states satisfying ϕ\phi. For example, the state xx in Figure 2 satisfies 0.51\Diamond_{\geq 0.5}\Diamond_{\geq 1}\top but yy does not. Desharnais et al. provide an algorithm that computes distinguishing formulae for labelled Markov chains in run time (roughly) 𝒪(n4)\mathcal{O}(n^{4}).

In the present work, we construct such counterexamples generically for a variety of system types. We achieve genericity over the system type by modelling state-based systems as coalgebras for a set functor in the framework of universal coalgebra [40]. Examples of coalgebras for a set functor include transition systems, deterministic automata, or weighted systems (e.g. Markov chains). Universal coalgebra provides a generic notion of behavioural equivalence that instantiates to standard notions for concrete system types, e.g. bisimilarity (transtion systems), language equivalence (deterministic automata), or probabilistic bisimilarity (Markov chains). Moreover, coalgebras come equipped with a generic notion of modal logic that is parametric in a choice of modalities whose semantics is constructed so as to guarantee invariance w.r.t. behavioural equivalence; under easily checked conditions, such a coalgebraic modal logic in fact characterizes behavioural equivalence in the same sense as Hennessy-Milner logic characterizes bisimilarity [39, 42]. Hence, as soon as suitable modal operators are found, coalgebraic modal formulae serve as distinguishing formulae.

In a nutshell, the contribution of the present paper is an algorithm that computes distinguishing formulae for behaviourally inequivalent states in quasilinear time, and in fact certificates that uniquely describe behavioural equivalence classes in a system, in coalgebraic generality. We build on an existing efficient coalgebraic partition refinement algorithm [46], thus achieving run time 𝒪(mlogn)\mathcal{O}(m\log n) on coalgebras with nn states and mm transitions (in a suitable encoding). The dag size of formulae is also 𝒪(mlogn)\mathcal{O}(m\log n) (for tree size, exponential lower bounds are known [22]); even for labelled transition systems, we thus improve the previous best bound 𝒪(mn)\mathcal{O}(mn) [13] for both run time and formula size. We systematically extract the requisite modalities from the functor at hand, requiring binary and nullary modalities in the general case, and then give a systematic method to translate these generic modal operators into more customary ones (such as the standard operators of Hennessy-Milner logic).

We subsequently identify a notion of cancellative functor that allows for additional optimization. E.g. functors modelling weighted systems are cancellative if and only if the weights come from a cancellative monoid, such as (,+)(\mathbb{Z},+), or (,+)(\mathbb{R},+) as used in probabilistic systems. For cancellative functors, much simpler distinguishing formulae can be constructed: the binary modalities can be replaced by unary ones, and only conjunction is needed in the propositional base. On labelled Markov chains, this complements the result that a logic with only conjunction and different unary modalities (mentioned above) suffices for the construction of distinguishing formulae (but not certificates) [17] (see also [19]).

Related Work

Cleaveland’s algorithm [13] for labelled transition systems is is based on Kanellakis and Smolka’s partition refinement algorithm [29]. The coalgebraic partition refinement algorithm we employ [46] is instead related to the more efficient Paige-Tarjan algorithm [36]. König et al. [32] extract formulae from winning strategies in a bisimulation game in coalgebraic generality; their algorithm runs in 𝒪(n4)\mathcal{O}(n^{4}) and does not support negative transition weights. Characteristic formulae for behavioural equivalence classes taken across all models require the use of fixpoint logics [21]. The mentioned algorithm by Desharnais et al. for distinguishing formulae on labelled Markov processes [17, Fig. 4] is based on Cleaveland’s. No complexity analysis is made but the algorithm has four nested loops, so its run time is roughly 𝒪(n4)\mathcal{O}(n^{4}). Bernardo and Miculan [10] provide a similar algorithm for a logic with only disjunction. There are further generalizations along other axes, e.g. to behavioural preorders [12]. The TwoTowers tool set for the analysis of stochastic process algebras [9, 8] computes distinguishing formulae for inequivalent processes, using variants of Cleaveland’s algorithm. Some approaches construct alternative forms of certificates for inequivalence, such as Cranen et al.’s notion of evidence [14] or methods employed on business process models, based on model differences and event structures [18, 6, 5].

2 Preliminaries

We first recall some basic notation. We denote by 0=0=\emptyset, 1={0}1=\{0\}, 2={0,1}2=\{0,1\} and 3={0,1,2}3=\{0,1,2\} the sets representing the natural numbers 0, 11, 22 and 33. For every set XX, there is a unique map !:X1!\colon X\to 1. We write YXY^{X} for the set of functions XYX\to Y, so e.g. X2X×XX^{2}\cong X\times X. In particular, 2X2^{X} is the set of 22-valued predicates on XX, which is in bijection with the powerset 𝒫X\mathcal{P}X of XX, i.e. the set of all subsets of XX; in this bijection, a subset A𝒫XA\in\mathcal{P}X corresponds to its characteristic function χA2X\chi_{A}\in 2^{X}, given by χA(x)=1\chi_{A}(x)=1 if xAx\in A, and χ(x)=0\chi(x)=0 otherwise. We generally indicate injective maps by \rightarrowtail. Given maps f:ZXf\colon Z\to X, g:ZYg\colon Z\to Y, we write f,g\langle f,g\rangle for the map ZX×YZ\to X\times Y given by f,g(z)=(f(z),g(z))\langle f,g\rangle(z)=(f(z),g(z)). We denote the disjoint union of sets XXYY by X+YX+Y, with canonical inclusion maps 𝗂𝗇1:XX+Y\mathsf{in}_{1}\colon X\rightarrowtail X+Y and 𝗂𝗇2:YX+Y\mathsf{in}_{2}\colon Y\rightarrowtail X+Y. More generally, we write iIXi\coprod_{i\in I}X_{i} for the disjoint union of an II-indexed family of sets (Xi)iI(X_{i})_{i\in I}, and 𝗂𝗇i:XiiIXi\mathsf{in}_{i}\colon X_{i}\rightarrowtail\coprod_{i\in I}X_{i} for the ii-th inclusion map. For a map f:XYf\colon X\to Y (not necessarily surjective), we denote by ker(f)X×X\ker(f)\subseteq X\times X the kernel of ff, i.e. the equivalence relation

ker(f):={(x,x)X×Xf(x)=f(x)}.\ker(f):=\{(x,x^{\prime})\in X\times X\mid f(x)=f(x^{\prime})\}. (1)
Notation \thetheorem (Partitions).

Given an equivalence relation RR on XX, we write [x]R[x]_{R} for the equivalence class {xX(x,x)R}\{x^{\prime}\in X\mid(x,x^{\prime})\in R\} of xXx\in X. If RR is the kernel of a map ff, we simply write [x]f[x]_{f} in lieu of [x]ker(f)[x]_{\ker(f)}. The intersection RSR\cap S of equivalence relations is again an equivalence relation. The partition corresponding to RR is denoted by X/R={[x]RxX}X/R=\{[x]_{R}\mid x\in X\}. Note that []R:XX/R[-]_{R}\colon X\to X/R is a surjective map and that R=ker([]R)R=\ker([-]_{R}).

A signature is a set Σ\Sigma, whose elements are called operation symbols, equipped with a function a:Σa\colon\Sigma\to\mathbb{N} assigning to each operation symbol its arity. We write σ/nΣ\mathord{\raisebox{1.0pt}{$\sigma$}\mkern-1.5mu/\mkern-1.5mu{\raisebox{-1.0pt}{$n$}}}\in\Sigma for σΣ\sigma\in\Sigma with a(σ)=na(\sigma)=n. We will apply the same terminology and notation to collections of modal operators.

2.1 Coalgebra

Universal coalgebra [40] provides a generic framework for the modelling and analysis of state-based systems. Its key abstraction is to parametrize notions and results over the transition type of systems, encapsulated as an endofunctor on a given base category. Instances cover, for example, deterministic automata, labelled (weighted) transition systems, and Markov chains.

Definition \thetheorem.

A set functor F:𝖲𝖾𝗍𝖲𝖾𝗍F\colon\mathsf{Set}\to\mathsf{Set} assigns to every set XX a set FXFX and to every map f:XYf\colon X\to Y a map Ff:FXFYFf\colon FX\to FY such that identity maps and composition are preserved: F𝗂𝖽X=𝗂𝖽FXF\mathsf{id}_{X}=\mathsf{id}_{FX} and F(gf)=FgFfF(g\cdot f)=Fg\cdot Ff. An FF-coalgebra is a pair (C,c)(C,c) consisting of a set CC (the carrier) and a map c:CFCc\colon C\to FC (the structure). When FF is clear from the context, we simply speak of a coalgebra.

In a coalgebra c:CFCc\colon C\to FC, we understand the carrier set CC as consisting of states, and the structure cc as assigning to each state xCx\in C a structured collection of successor states, with the structure of collections determined by FF. In this way, the notion of coalgebra subsumes numerous types of state-based systems, as illustrated next.

Example \thetheorem.
  1. 1.

    The powerset functor 𝒫\mathcal{P} sends a set XX to its powerset 𝒫X\mathcal{P}X and a map f:XYf\colon X\to Y to the map 𝒫f=f[]:𝒫X𝒫Y\mathcal{P}f=f[-]\colon\mathcal{P}X\to\mathcal{P}Y taking direct images. A 𝒫\mathcal{P}-coalgebra c:C𝒫Cc\colon C\to\mathcal{P}C is precisely a transition system: It assigns to every state xCx\in C a set c(x)𝒫Cc(x)\in\mathcal{P}C of successor states, inducing a transition relation \to given by xyx\to y iff yc(x)y\in c(x). Similarly, coalgebras for the finite powerset functor 𝒫f{\mathcal{P}_{\textsf{f}}} (with 𝒫fX{\mathcal{P}_{\textsf{f}}}X being the set of finite subsets of XX) are finitely branching transition systems.

  2. 2.

    Coalgebras for the functor FX=2×XAFX=2\times X^{A}, where AA is a fixed input alphabet, are deterministic automata (without an explicit initial state). Indeed, a coalgebra structure c=f,t:C2×CAc=\langle f,t\rangle\colon C\to 2\times C^{A} consists of a finality predicate f:C2f\colon C\to 2 and a transition map C×ACC\times A\to C in curried form t:CCAt\colon C\to C^{A}.

  3. 3.

    Every signature Σ\Sigma defines a signature functor that maps a set XX to the set

    TΣX=σ/nΣXn,\textstyle T_{\Sigma}X=\coprod_{\mathord{\raisebox{1.0pt}{$\scriptstyle\sigma$}\mkern-1.5mu/\mkern-1.5mu{\raisebox{-1.0pt}{$\scriptstyle n$}}}\in\Sigma}X^{n},

    whose elements we may understand as flat Σ\Sigma-terms σ(x1,,xn)\sigma(x_{1},\ldots,x_{n}) with variables from XX. The action of TΣT_{\Sigma} on maps f:XYf\colon X\to Y is then given by (TΣf)(σ(x1,,xn))=σ(f(x1),,(T_{\Sigma}f)(\sigma(x_{1},\ldots,x_{n}))=\sigma(f(x_{1}),\ldots, f(xn))f(x_{n})). For simplicity, we write σ\sigma (instead of 𝗂𝗇σ\mathsf{in}_{\sigma}) for the coproduct injections, and Σ\Sigma in lieu of TΣT_{\Sigma} for the signature functor. States in Σ\Sigma-coalgebras describe possibly infinite Σ\Sigma-trees.

  4. 4.

    For a commutative monoid (M,+,0)(M,+,0), the monoid-valued functor M()M^{(-)} [25] is given by

    M(X):={μ:XMμ(x)=0 for all but finitely many xX}M^{(X)}:=\{\mu\colon X\to M\mid\text{$\mu(x)=0$ for all but finitely many $x\in X$}\} (2)

    on sets XX; for a map f:XYf\colon X\to Y, the map M(f):M(X)M(Y)M^{(f)}\colon M^{(X)}\to M^{(Y)} is defined by

    (M(f))(μ)(y)=xX,f(x)=yμ(x).(M^{(f)})(\mu)(y)=\textstyle\sum_{x\in X,f(x)=y}\mu(x).

    A coalgebra c:CM(C)c\colon C\to M^{(C)} is a finitely branching weighted transition system, where c(x)(x)Mc(x)(x^{\prime})\in M is the transition weight from xx to xx^{\prime}. For the Boolean monoid 𝔹=(2,,0){\mathbb{B}}=(2,\vee,0), we recover 𝒫f=𝔹(){\mathcal{P}_{\textsf{f}}}={\mathbb{B}}^{(-)}. Coalgebras for ()\mathbb{R}^{(-)}, with \mathbb{R} understood as the additive monoid of the reals, are \mathbb{R}-weighted transition systems. The functor

    𝒟X={μ0(X)xXμ(x)=1},\textstyle{\mathcal{D}}X=\{\mu\in\mathbb{R}_{\geq 0}^{(X)}\mid\sum_{x\in X}\mu(x)=1\},

    which assigns to a set XX the set of all finite probability distributions on XX (represented as finitely supported probability mass functions), is a subfunctor of ()\mathbb{R}^{(-)}.

  5. 5.

    Functors can be composed; for instance, given a set AA of labels, the composite of 𝒫\mathcal{P} and the functor A×()A\times(-) (whose action on sets maps a set XX to the set A×XA\times X) is the functor FX=𝒫(A×X)FX=\mathcal{P}(A\times X), whose coalgebras are AA-labelled transition systems. Coalgebras for (𝒟()+1)A({\mathcal{D}}(-)+1)^{A} have been termed probabilistic transition systems [33] or labelled Markov chains [17], and coalgebras for (𝒟(()+1)+1)A({\mathcal{D}}((-)+1)+1)^{A} are partial labelled Markov chains [17]. Coalgebras for SX=𝒫f(A×𝒟X)SX={\mathcal{P}_{\textsf{f}}}(A\times{\mathcal{D}}X) are variously known as simple Segala systems or Markov decision processes.

We have a canonical notion of behaviour on FF-coalgebras:

Definition \thetheorem.

An FF-coalgebra morphism h:(C,c)(D,d)h\colon(C,c)\to(D,d) is a map h:CDh\colon C\to D such that dh=Fhcd\cdot h=Fh\cdot c. States x,yx,y in an FF-coalgebra (C,c)(C,c) are behaviourally equivalent (xyx\sim y) if there exists a coalgebra morphism hh such that h(x)=h(y)h(x)=h(y).

C{C}FC{FC}D{D}FD{FD}c\scriptstyle{c}h\scriptstyle{h}Fh\scriptstyle{Fh}d\scriptstyle{d}

Thus, we effectively define the behaviour of a state as those of its properties that are preserved by coalgebra morphisms. The notion of behavioural equivalence subsumes standard branching-time equivalences:

Example \thetheorem.
  1. 1.

    For F{𝒫,𝒫f}F\in\{\mathcal{P},{\mathcal{P}_{\textsf{f}}}\}, behavioural equivalence on FF-coalgebras, i.e. on transition systems, is bisimilarity in the usual sense.

  2. 2.

    For deterministic automata as coalgebras for FX=2×XAFX=2\times X^{A}, two states are behaviourally equivalent iff they accept the same formal language.

  3. 3.

    For a signature functor Σ\Sigma, two states of a Σ\Sigma-coalgebra are behaviourally equivalent iff they describe the same Σ\Sigma-tree.

  4. 4.

    For labelled transition systems as coalgebras for FX=𝒫(A×X)FX=\mathcal{P}(A\times X), coalgebraic behavioural equivalence precisely captures Milner’s strong bisimilarity [1].

  5. 5.

    For weighted and probabilistic systems, coalgebraic behavioural equivalence instantiates to weighted and probabilistic bisimilarity, respectively [41, Cor. 4.7], [7, Thm. 4.2].

Remark \thetheorem.
  1. 1.

    The notion of behavioural equivalence extends straightforwardly to states in different coalgebras, as one can canonically define the disjoint union of coalgebras.

  2. 2.

    We may assume without loss of generality that a set functor FF preserves injective maps [43] (see also [2, 8.1.12–17]), that is, FfFf is injective whenever ff is.

2.2 Coalgebraic Logics

We briefly review basic concepts of coalgebraic modal logic [38, 42]. Coalgebraic modal logics are parametric in a functor FF determining the type of systems underlying the semantics, and additionally in a choice of modalities interpreted in terms of predicate liftings. For now, we use F=𝒫F=\mathcal{P} as a basic example, deferring further examples to section 5.

Syntax

The syntax of coalgebraic modal logic is parametrized over the choice of signature Λ\Lambda of modal operators (with assigned arities). Then, formulae ϕ\phi are generated by the grammar
ϕ1,,ϕn::=|¬ϕ1|ϕ1ϕ2|(ϕ1,,ϕn)(/nΛ).{\hskip 14.22636pt}\phi_{1},\ldots,\phi_{n}::=\top\leavevmode\nobreak\ |\leavevmode\nobreak\ \neg\phi_{1}\leavevmode\nobreak\ |\leavevmode\nobreak\ \phi_{1}\wedge\phi_{2}\leavevmode\nobreak\ |\leavevmode\nobreak\ \heartsuit(\phi_{1},\ldots,\phi_{n})\qquad(\mathord{\raisebox{1.0pt}{$\heartsuit$}\mkern-1.5mu/\mkern-1.5mu{\raisebox{-1.0pt}{$n$}}}\in\Lambda).

Example \thetheorem.

For F=𝒫F=\mathcal{P}, one often takes Λ={/1}\Lambda=\{\mathord{\raisebox{1.0pt}{$\Diamond$}\mkern-1.5mu/\mkern-1.5mu{\raisebox{-1.0pt}{$1$}}}\}; the induced syntax is that of (single-action) Hennessy-Milner logic. As usual, we write ϕ:¬¬ϕ\Box\phi:\equiv\neg\Diamond\neg\phi.

Semantics

We interpret formulae as sets of states in FF-coalgebras. This interpretation arises by assigning to each modal operator /nΛ\mathord{\raisebox{1.0pt}{$\heartsuit$}\mkern-1.5mu/\mkern-1.5mu{\raisebox{-1.0pt}{$n$}}}\in\Lambda an nn-ary predicate lifting \llbracket\heartsuit\rrbracket [38, 42], i.e. a family of maps X:(2X)n2FX\llbracket\heartsuit\rrbracket_{X}\colon(2^{X})^{n}\to 2^{FX}, one for every set XX, such that the naturality condition

Ff1[Y(P1,,Pn)]=X(f1[P1],,f1[Pn])Ff^{-1}\big{[}\llbracket\heartsuit\rrbracket_{Y}(P_{1},\ldots,P_{n})\big{]}=\llbracket\heartsuit\rrbracket_{X}(f^{-1}[P_{1}],\ldots,f^{-1}[P_{n}]) (3)

for all f:XYf\colon X\to Y and all P1,,Pn2XP_{1},\ldots,P_{n}\in 2^{X} (for categorically-minded readers, \llbracket\heartsuit\rrbracket is a natural transformation (2())n2F𝗈𝗉(2^{(-)})^{n}\to 2^{F^{\mathsf{op}}}); the idea being to lift given predicates on states to predicates on structured collections of states. Given these data, the extension of a formula ϕ\phi in an FF-coalgebra (C,c)(C,c) is a predicate ϕ(C,c)\llbracket\phi\rrbracket_{(C,c)}, or just ϕ\llbracket\phi\rrbracket, on CC, recursively defined by

(C,c)=Cϕψ(C,c)=ϕ(C,c)ψ(C,c)¬ϕ(C,c)=Cϕ(C,c)\displaystyle\llbracket\top\rrbracket_{(C,c)}=C\qquad\llbracket\phi\wedge\psi\rrbracket_{(C,c)}=\llbracket\phi\rrbracket_{(C,c)}\cap\llbracket\psi\rrbracket_{(C,c)}\qquad\llbracket\neg\phi\rrbracket_{(C,c)}=C\setminus\llbracket\phi\rrbracket_{(C,c)}
(ϕ1,,ϕn)(C,c)=c1[C(ϕ1(C,c),,ϕn(C,c))](/nΛ)\displaystyle\llbracket\heartsuit(\phi_{1},\ldots,\phi_{n})\rrbracket_{(C,c)}=c^{-1}\big{[}\llbracket\heartsuit\rrbracket_{C}\big{(}\llbracket\phi_{1}\rrbracket_{(C,c)},\ldots,\llbracket\phi_{n}\rrbracket_{(C,c)}\big{)}\big{]}\qquad\text{($\mathord{\raisebox{1.0pt}{$\heartsuit$}\mkern-1.5mu/\mkern-1.5mu{\raisebox{-1.0pt}{$n$}}}\in\Lambda$)}

(where we apply set operations to predicates with the evident meaning). We say that a state xCx\in C satisfies ϕ\phi if ϕ(x)=1\llbracket\phi\rrbracket(x)=1. Notice how the clause for modalities says that xx satisfies (ϕ1,,ϕn)\heartsuit(\phi_{1},\ldots,\phi_{n}) iff c(x)c(x) satisfies the predicate obtained by lifting the predicates ϕ1,,ϕn\llbracket\phi_{1}\rrbracket,\ldots,\llbracket\phi_{n}\rrbracket on CC to a predicate on FCFC according to \llbracket\heartsuit\rrbracket.

Example \thetheorem.

Over F=𝒫F=\mathcal{P}, we interpret \Diamond by the predicate lifting

X:2X2𝒫X,P{KXxK:xP}={KXKP},\llbracket\Diamond\rrbracket_{X}\colon 2^{X}\to 2^{\mathcal{P}X},\quad P\mapsto\leavevmode\nobreak\ \{K\subseteq X\mid\exists x\in K\colon x\in P\}=\{K\subseteq X\mid K\cap P\neq\emptyset\},

The arising notion of satisfaction over 𝒫\mathcal{P}-coalgebras (C,c)(C,c) is precisely the standard one: xϕ(C,c)x\in\llbracket\Diamond\phi\rrbracket_{(C,c)} iff yϕ(C,c)y\in\llbracket\phi\rrbracket_{(C,c)} for some transition xyx\to y.

The naturality condition (3) of predicate liftings guarantees invariance of the logic under coalgebra morphisms, and hence under behavioural equivalence:

Proposition 2.1 (Adequacy [38, 42]).

Behaviourally equivalent states satisfy the same formulae: xyx\sim y implies that for all formulae ϕ\phi, we have xϕx\in\llbracket\phi\rrbracket iff yϕy\in\llbracket\phi\rrbracket.

In our running example F=𝒫F=\mathcal{P}, this instantiates to the well-known fact that modal formulae are bisimulation-invariant, that is, bisimilar states in transition systems satisfy the same formulae of Hennessy-Milner logic.

3 Constructing Distinguishing Formulae

A proof method certifying behavioural equivalence of states x,yx,y in a coalgebra is immediate by definition: One simply needs to exhibit a coalgebra morphism hh such that h(x)=h(y)h(x)=h(y). In fact, for many system types, it suffices to relate xx and yy by a coalgebraic bisimulation in a suitable sense (e.g. [1, 40, 24, 34]), generalizing the Park-Milner bisimulation principle [35, 37]. It is less obvious how to certify behavioural inequivalence xyx\not\sim y, showing that such a morphism hh does not exist. By 2.1, one option is to exhibit a (coalgebraic) modal formula ϕ\phi that is satisfied by xx but not by yy. In the case of (image-finite) transition systems, such a formula is guaranteed to exist by the Hennessy-Milner theorem, which moreover is known to generalize to coalgebras [39, 42]. More generally, we consider separation of sets of states by formulae, following Cleaveland [13, Def. 2.4]:

Definition 1.

Let (C,c)(C,c) be an FF-coalgebra. A formula ϕ\phi distinguishes a set XCX\subseteq C from a set YCY\subseteq C if XϕX\subseteq\llbracket\phi\rrbracket and Yϕ=Y\cap\llbracket\phi\rrbracket=\emptyset. In case X={x}X=\{x\} and Y={y}Y=\{y\}, we just say that ϕ\phi distinguishes xx from yy. We say that ϕ\phi is a certificate of XX if ϕ\phi distinguishes XX from CXC\setminus X, that is if ϕ=X\llbracket\phi\rrbracket=X.

Note that ϕ\phi distinguishes XX from YY iff ¬ϕ\neg\phi distinguishes YY from XX. Certificates have also been referred to as descriptions [22]. If ϕ\phi is a certificate of a behavioural equivalence class [x][x]_{\sim}, then by definition ϕ\phi distinguishes xx from yy whenever xyx\not\sim y. To obtain distinguishing formulae for behaviourally inequivalent states in a coalgebra, it thus suffices to construct certificates for all behavioural equivalence classes, and our algorithm does just that. Of course, every certificate must be at least as large as a smallest distinguishing formula. However, already on transition systems, distinguishing formulae and certificates have the same asymptotic worst-case size (cf. section 6).

A natural approach to computing certificates for behavioural equivalence classes is to extend algorithms that compute these equivalence classes. In particular, partition refinement algorithms compute a sequence C/R0,C/R1,C/R_{0},C/R_{1},\ldots of consecutively finer partitions (i.e. Ri+1RiR_{i+1}\subseteq R_{i}) on the state space, where every block BC/RiB\in C/R_{i} is a union of behavioural equivalence classes, and the final partition is precisely C/C/\mathord{\sim}. Indeed, Cleaveland’s algorithm for computing certificates on labelled transition systems [13] correspondingly extends Kanellakis and Smolka’s partition refinement algorithm [28, 29], which runs in 𝒪(mn)\mathcal{O}(mn) on systems with n=|C|n=|C| states and mm transitions. Our generic algorithm will be based on a more efficient partition refinement algorithm.

3.1 Paige-Tarjan with Certificates

Before we turn to constructing certificates in coalgebraic generality, we informally recall and extend the Paige-Tarjan algorithm [36], which computes the partition modulo bisimilarity of a given transition system with nn states and mm transitions in time 𝒪((m+n)logn)\mathcal{O}((m+n)\log n). We fix a given finite transition system, viewed as a 𝒫\mathcal{P}-coalgebra c:C𝒫Cc\colon C\to\mathcal{P}C.

The algorithm computes two sequences (C/Pi)i(C/P_{i})_{i\in\mathbb{N}} and (C/Qi)i(C/Q_{i})_{i\in\mathbb{N}} of partitions of CC (with Qi,PiQ_{i},P_{i} equivalence relations), where only the most recent partition is held in memory and ii indexes the iterations of the main loop. Throughout the execution, C/PiC/P_{i} is finer than C/QiC/Q_{i} (that is, PiQiP_{i}\subseteq Q_{i} for all ii), and the algorithm terminates when Pi=QiP_{i}=Q_{i}. Intuitively, PiP_{i} is ‘one transition ahead’ of QiQ_{i}: if QiQ_{i} distinguishes states xx and yy, then PiP_{i} is based on distinguishing transitions to xx from transitions to yy.

Initially, C/Q0:={C}C/Q_{0}:=\{C\} consists of only one block and C/P0C/P_{0} of two blocks: the live states and the deadlocks (i.e. states with no outgoing transitions). If PiQiP_{i}\subsetneqq Q_{i}, then there is a block BC/QiB\in C/Q_{i} that is the union of at least two blocks in C/PiC/P_{i}. In such a situation, the algorithm chooses SBS\subseteq B in C/PiC/P_{i} to have at most half the size of BB and then splits the block BB into SS and BSB\setminus S in the partition C/QiC/Q_{i}:

C/Qi+1=(C/Qi{B}){S,BS}.C/Q_{i+1}=(C/Q_{i}\setminus\{B\})\leavevmode\nobreak\ \cup\leavevmode\nobreak\ \{S,B\setminus S\}.

This is correct because every state in SS is already known to be behaviourally inequivalent to every state in BSB\setminus S. By the definition of bisimilarity, this implies that every block TC/PiT\in C/P_{i} with some transition to BB may contain behaviourally inequivalent states as illustrated in Figure 3; that is, TT may need to be split into smaller blocks, as follows:

  1. (C1)

    states in TT with successors in SS but not in BSB\setminus S (e.g. x1x_{1} in Figure 3),

  2. (C2)

    states in TT with successors in SS and BSB\setminus S (e.g. x2x_{2}), and

  3. (C3)

    states in TT with successors BSB\setminus S but not in SS (e.g. x3x_{3}).

x1x_{1}x2x_{2}x3x_{3}y1y_{1}y2y_{2}y3y_{3}y4y_{4}\ldots\ldotsTTBBSSBSB\setminus S\ldots\ldots\ldots\ldotsC/P:C/P:C/Q:C/Q:CC𝒫C\mathcal{P}Cc\scriptstyle c
Figure 3: The refinement step as illustrated in [46, Figure 6].

The partition C/Pi+1C/P_{i+1} arises from C/PiC/P_{i} by splitting all such predecessor blocks TT of BB accordingly. If no such TT is properly split, then Pi+1=Qi+1P_{i+1}=Q_{i+1}, and the algorithm terminates. It is straightforward to construct certificates for the blocks arising during the execution:

  • The certificate for the only block CC/Q0C\in C/Q_{0} is \top, and the blocks for live states and deadlocks in C/P0C/P_{0} have certificates \Diamond\top and ¬\neg\Diamond\top, respectively.

  • In the refinement step, suppose that δ,β\delta,\beta are certificates of SC/PiS\in C/P_{i} and BC/QiB\in C/Q_{i}, respectively, where SBS\subsetneqq B. For every predecessor block TT of BB, the three blocks obtained by splitting TT are distinguished (see 1) as follows:

    (C1)¬(β¬δ)\neg\Diamond(\beta\wedge\neg\delta),   (C2)(δ)(β¬δ)\Diamond(\delta)\wedge\Diamond(\beta\wedge\neg\delta),   (C3)¬δ\neg\Diamond\delta. (4)

    Of course these formulae only distinguish the states in TT from each other (e.g. there may be states in other blocks with transitions to both SS and BB). Hence, given a certificate ϕ\phi of TT, one obtains certificates of the three resulting blocks in C/Pi+1C/P_{i+1} via conjunction: ϕ¬(β¬δ)\phi\wedge\neg\Diamond(\beta\wedge\neg\delta), etc.

Upon termination, every bisimilarity class [x][x]_{\sim} in the transition system is annotated with a certificate. A key step in the generic development will be to come up with a coalgebraic generalization of the formulae for (C1)(C3).

3.2 Generic Partition Refinement

The Paige-Tarjan algorithm has been adapted to other system types, e.g. weighted systems [44], and it has recently been generalized to coalgebras [46, 20]. A crucial step in this generalization is to rephrase the case distinction (C1)(C3) in terms of the functor 𝒫\mathcal{P}: Given a predecessor block TT in C/PiC/P_{i} for SBC/QiS\subsetneqq B\in C/Q_{i}, the three cases distinguish between the equivalence classes [x]𝒫χSBc[x]_{\mathcal{P}\chi_{S}^{B}\cdot c} for xTx\in T, where the map χSB:C3\chi_{S}^{B}\colon C\to 3 in the composite 𝒫χSBc:C𝒫3\mathcal{P}\chi_{S}^{B}\cdot c\colon C\to\mathcal{P}3 is defined by

χSB:C3χSB(x)={2if xS,1if xBS,0if xCB,for sets SBC.\chi_{S}^{B}\colon C\to 3\qquad\chi_{S}^{B}(x)=\begin{cases}2&\text{if $x\in S$},\\ 1&\text{if $x\in B\setminus S$},\\ 0&\text{if $x\in C\setminus B$},\end{cases}\qquad\text{for sets $S\subseteq B\subseteq C$}. (5)

Every case is a possible value of t:=𝒫χSB(c(x))𝒫3t:=\mathcal{P}\chi_{S}^{B}(c(x))\in\mathcal{P}3: (C1) 2t12\in t\not\mkern 1.0mu\ni 1, (C2) 2t12\in t\ni 1, and (C3) 2t12\notin t\ni 1. Since TT is a predecessor block of BB, the ‘fourth case’ 2t12\not\in t\not\mkern 1.0mu\ni 1 is not possible. There is a transition from xx to some state outside of BB iff 0t0\in t. However, because of the previous refinement steps performed by the algorithm, either all or no states states of TT have an edge to CBC\setminus B (a property called stability [36]), hence no distinction on 0t0\in t is necessary.

It is now easy to generalize from transition systems to coalgebras by simply replacing the functor 𝒫\mathcal{P} with FF in the refinement step. We recall the algorithm:

Algorithm 3.1 ([46, Alg. 4.9, (5.1)]).

Given a coalgebra c:CFCc\colon C\to FC, put

C/Q0:={C}andP0:=ker(CcFCF!F1).C/Q_{0}:=\{C\}\qquad\text{and}\qquad P_{0}:=\ker(C\xrightarrow{c}{FC}\xrightarrow{F!}F1).

Starting at iteration i=0i=0, repeat the following while PiQiP_{i}\neq Q_{i}:

  1. (A1)

    Pick SC/PiS\in C/P_{i} and BC/QiB\in C/Q_{i} such that SBS\subsetneqq B and 2|S||B|2\cdot|S|\leq|B|

  2. (A2)

    C/Qi+1:=(C/Qi{B}){S,BS}C/Q_{i+1}:=(C/Q_{i}\setminus\{B\})\cup\{S,B\setminus S\}

  3. (A3)

    Pi+1:=Piker(CFCF3cFχSB)P_{i+1}:=P_{i}\cap\ker(\leavevmode\hbox to130.11pt{\vbox to15.73pt{\pgfpicture\makeatletter\hbox{\hskip 65.057pt\lower-8.65137pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{}{}{}{}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{\offinterlineskip{}{}{{{}}{{}}{{}}}{{{}}}{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-65.057pt}{-7.07637pt}\pgfsys@invoke{ }\hbox{\vbox{\halign{\pgf@matrix@init@row\pgf@matrix@step@column{\pgf@matrix@startcell#\pgf@matrix@endcell}&#\pgf@matrix@padding&&\pgf@matrix@step@column{\pgf@matrix@startcell#\pgf@matrix@endcell}&#\pgf@matrix@padding\cr\hfil\hskip 8.23679pt\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-3.93124pt}{0.0pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{${C}$} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{}}}&\hskip 8.23679pt\hfil&\hfil\hskip 41.83704pt\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-7.84097pt}{0.0pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{${FC}$} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{}}}&\hskip 12.14651pt\hfil&\hfil\hskip 48.94162pt\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} { }{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-6.40973pt}{0.0pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{${F3}$} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}&\hskip 10.71527pt\hfil\cr}}}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}}{{{{}}}{{}}{{}}{{}}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} {}{ {}{}{}}{}{ {}{}{}} {{{{{}}{ {}{}}{}{}{{}{}}}}}{}{{{{{}}{ {}{}}{}{}{{}{}}}}}{{}}{}{}{}{}{}{{{}{}}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@setlinewidth{0.39998pt}\pgfsys@invoke{ }{}{}{}{}{{}}{}{}{{}}\pgfsys@moveto{-48.38344pt}{-4.57637pt}\pgfsys@lineto{-19.49287pt}{-4.57637pt}\pgfsys@stroke\pgfsys@invoke{ }{{}{{}}{}{}{{}}{{{}}}}{{}{{}}{}{}{{}}{{{}}{{{}}{\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-19.2929pt}{-4.57637pt}\pgfsys@invoke{ }\pgfsys@invoke{ \lxSVG@closescope }\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}{{}}}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,1,1}\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} {\pgfsys@beginscope\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,1,1}\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }\pgfsys@rect{-36.2528pt}{-7.08331pt}{5.02927pt}{5.01389pt}\pgfsys@fill\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-35.2528pt}{-6.08331pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{$\scriptstyle{c}$} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{}{ {}{}{}}{}{ {}{}{}} {{{{{}}{ {}{}}{}{}{{}{}}}}}{}{{{{{}}{ {}{}}{}{}{{}{}}}}}{{}}{}{}{}{}{}{{{}{}}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@setlinewidth{0.39998pt}\pgfsys@invoke{ }{}{}{}{}{{}}{}{}{{}}\pgfsys@moveto{5.60011pt}{-4.57637pt}\pgfsys@lineto{43.0265pt}{-4.57637pt}\pgfsys@stroke\pgfsys@invoke{ }{{}{{}}{}{}{{}}{{{}}}}{{}{{}}{}{}{{}}{{{}}{{{}}{\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{43.22649pt}{-4.57637pt}\pgfsys@invoke{ }\pgfsys@invoke{ \lxSVG@closescope }\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}{{}}}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,1,1}\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} {\pgfsys@beginscope\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,1,1}\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }\pgfsys@rect{17.2449pt}{-8.65137pt}{14.53677pt}{8.15pt}\pgfsys@fill\pgfsys@invoke{ } \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}{{{{}}\pgfsys@beginscope\pgfsys@invoke{ }\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{18.2449pt}{-6.2847pt}\pgfsys@invoke{ }\hbox{{\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\hbox{$\scriptstyle{F\chi_{S}^{B}}$} }}\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope}}} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{ {}{}{}}}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}})

This algorithm formalizes the intuitive steps from subsection 3.1. Again, two sequences of partitions P1P_{1}QiQ_{i} are constructed, and Pi=QiP_{i}=Q_{i} upon termination. Initially, Q0Q_{0} identifies all states and P0P_{0} distinguishes states by only their output behaviour; e.g. for F=𝒫F=\mathcal{P} and xCx\in C, the value 𝒫!(c(x))𝒫1\mathcal{P}!(c(x))\in\mathcal{P}1 is \emptyset if xx is a deadlock, and {1}\{1\} if xx is a live state, and for FX=2×XAFX=2\times X^{A}, the value F1(c(x))F1=2×1A2F1(c(x))\in F1=2\times 1^{A}\cong 2 indicates whether xx is a final or non-final state.

In the main loop, blocks SC/PiS\in C/P_{i} and BC/QiB\in C/Q_{i} witnessing PiQiP_{i}\subsetneqq Q_{i} are picked, and BB is split into SS and BSB\setminus S, like in the Paige-Tarjan algorithm. Note that step (A2) is equivalent to directly defining the equivalence relation Qi+1Q_{i+1} as

Qi+1:=QikerχSB.Q_{i+1}:=Q_{i}\cap\ker{\chi_{S}^{B}}.

A similar intersection of equivalence relations is performed in step (A3). The intersection splits every block TC/PiT\in C/P_{i} into smaller blocks such that x,xTx,x^{\prime}\in T end up in the same block iff FχSB(c(x))=FχSB(c(x))F\chi_{S}^{B}(c(x))=F\chi_{S}^{B}(c(x^{\prime})), i.e. TT is replaced by {[x]FχSB(c(x))xT}\{[x]_{F\chi_{S}^{B}(c(x))}\mid x\in T\}. Again, this corresponds to the distinction of the three cases (C1)(C3). For example, for FX=2×XAFX=2\times X^{A}, there are |F3|=23|A||F3|=2\cdot 3^{|A|} cases to be distinguished, and so every TC/PiT\in C/P_{i} is split into at most that many blocks.

The following property of FF is needed for correctness [46, Ex. 5.11].

Definition 2 ([46]).

A functor FF is zippable if map

F(A+!),F(!+B):F(A+B)F(A+1)×F(1+B)\langle F(A+!),F(!+B)\rangle\colon\leavevmode\nobreak\ F(A+B)\longrightarrow F(A+1)\times F(1+B)

is injective for all sets A,BA,B.

Intuitively, tF(A+B)t\in F(A+B) is a term in variables from AA and BB. If FF is zippable, then tt is uniquely determined by the two elements in F(A+1)F(A+1) and F(1+B)F(1+B) obtained by identifying all BB- and all AA-variables with 010\in 1, respectively. E.g. FX=X2FX=X^{2} is zippable: t=(𝗂𝗇1(a),𝗂𝗇2(b))(A+B)2t=(\mathsf{in}_{1}(a),\mathsf{in}_{2}(b))\in(A+B)^{2} is uniquely determined by (𝗂𝗇1(a),𝗂𝗇2(0))(A+1)2(\mathsf{in}_{1}(a),\mathsf{in}_{2}(0))\in(A+1)^{2} and (𝗂𝗇1(0),𝗂𝗇2(b))(1+B)2(\mathsf{in}_{1}(0),\mathsf{in}_{2}(b))\in(1+B)^{2}, and similarly for the three other cases of tt. In fact, all signature functors as well as 𝒫\mathcal{P} and all monoid-valued functors are zippable. Moreover, the class of zippable functors is closed under products, coproducts, and subfunctors but not under composition, e.g. 𝒫𝒫\mathcal{P}\mathcal{P} is not zippable [46].

Remark 3.

To apply the algorithm to coalgebras for composites FGFG of zippable functors, e.g. 𝒫(A×())\mathcal{P}(A\times(-)), there is a reduction [46, Section 8] that embeds every FGFG-coalgebra into a coalgebra for the zippable functor (F+G)(X):=FX+GX(F+G)(X):=FX+GX. This reduction preserves and reflects behavioural equivalence, but introduces an intermediate state for every transition.

Theorem 3.2 ([46, Thm 4.20, 5.20]).

On a finite coalgebra (C,c)(C,c) for a zippable functor, 3.1 terminates after i|C|i\leq|C| loop iterations, and the resulting partition identifies precisely the behaviourally equivalent states (Pi=P_{i}=\mathord{\sim}).

3.3 Generic Modal Operators

The extended Paige-Tarjan algorithm (subsection 3.1) constructs a distinguishing formula according to the three cases (C1)(C3). In the coalgebraic 3.1, these cases correspond to elements of F3F3, which determine in which block an element of a predecessor block TT ends up. Indeed, the elements of F3F3 will also serve as generic modalities in characteristic formulae for blocks of states, essentially by the known equivalence between nn-ary predicate liftings and (in this case, singleton) subsets of F(2n)F(2^{n}) [42] (termed tests by Klin [30]):

Definition 4.

The signature of F3F3-modalities for a functor FF is

Λ={t/2tF3};\Lambda=\{\mathord{\raisebox{1.0pt}{${\ulcorner t\urcorner}$}\mkern-1.5mu/\mkern-1.5mu{\raisebox{-1.0pt}{$2$}}}\mid t\in F3\};

that is, we write t{\ulcorner t\urcorner} for the syntactic representation of a binary modality for every tF3t\in F3. The interpretation of t{\ulcorner t\urcorner} for F3F3 is given by the predicate lifting

t:(2X)22FX,t(S,B)={tFXFχSBB(t)=t}.\llbracket{\ulcorner t\urcorner}\rrbracket\colon(2^{X})^{2}\to 2^{FX},\qquad\llbracket{\ulcorner t\urcorner}\rrbracket(S,B)=\{t^{\prime}\in FX\mid F\chi_{S\cap B}^{B}(t^{\prime})=t\}.

The intended use of t{\ulcorner t\urcorner} is as follows: Suppose a block BB is split into subblocks SBS\subseteq B and BSB\setminus S with certificates δ\delta and β\beta, respectively: δ=S\llbracket\delta\rrbracket=S and β=B\llbracket\beta\rrbracket=B. As in Figure 3, we then split every predecessor block TT of BB into smaller parts, each of which is uniquely characterized by the formula t(δ,β){\ulcorner t\urcorner}(\delta,\beta) for some tF3t\in F3.

Example 3.3.

For F=𝒫F=\mathcal{P}, {0,2}(δ,β){\ulcorner{\{0,2\}}\urcorner}(\delta,\beta) is equivalent to ¬β‘0’¬(β¬δ)‘1’(δβ)‘2’\smash{\overbrace{\Diamond\neg\beta}^{\text{\text{`0'}}}}\wedge\neg\smash{\overbrace{\Diamond(\beta\wedge\neg\delta)}^{\text{\text{`1'}}}}\wedge\smash{\overbrace{\Diamond(\delta\wedge\beta)}^{\text{\text{`2'}}}}.

Lemma 3.4.

Given an FF-coalgebra (C,c)(C,c), xCx\in C, and formulae δ\delta and β\beta such that δβC\llbracket\delta\rrbracket\subseteq\llbracket\beta\rrbracket\subseteq C, we have xt(δ,β)x\in\llbracket{\ulcorner t\urcorner}(\delta,\beta)\rrbracket if and only if Fχδβ(c(x))=tF\chi_{\llbracket\delta\rrbracket}^{\llbracket\beta\rrbracket}(c(x))=t.

In the initial partition C/P0C/P_{0} on a transition system (C,c)(C,c), we used the formulae \Diamond\top and ¬\neg\Diamond\top to distinguish live states and deadlocks. In general, we can similarly describe the initial partition using modalities induced by elements of F1F1:

Notation 3.5.

Define the injective map j1:13j_{1}\colon 1\rightarrowtail 3 by j1(0)=2j_{1}(0)=2. Then the injection Fj1:F1F3Fj_{1}\colon F1\rightarrowtail F3 provides a way to interpret elements tF1t\in F1 as nullary modalities t{\ulcorner t\urcorner}:

t:=Fj1(t)(,)for tF1.{\ulcorner t\urcorner}:={\ulcorner Fj_{1}(t)\urcorner}(\top,\top)\qquad\text{for $t\in F1$.}

(Alternatively, we could introduce t{\ulcorner t\urcorner} directly as a nullary modality.)

Lemma 3.6.

For xCx\in C, c:CFCc\colon C\to FC, and tF1t\in F1, we have xtx\in\llbracket{\ulcorner t\urcorner}\rrbracket if and only if F!(c(x))=tF!(c(x))=t.

3.4 Algorithmic Construction of Certificates

The F3F3-modalities introduced above (4) induce an instance of coalgebraic modal logic (subsection 2.2). We refer to coalgebraic modal formulae employing the F3F3-modalities as F3F3-modal formulae, and write \mathcal{M} for the set of F3F3-modal formulae. As in the extended Paige-Tarjan algorithm (subsection 3.1), we annotate every block arising during the execution of 3.1 with a certificate in the shape of an F3F3-modal formula. Annotating blocks with formulae means that we construct maps

βi:C/Qiandδi:C/Pifor i.\beta_{i}\colon C/Q_{i}\to\mathcal{M}\qquad\text{and}\qquad\delta_{i}\colon C/P_{i}\to\mathcal{M}\qquad\text{for $i\in\mathbb{N}$}.

As in 3.1, ii indexes the loop iterations. For blocks B,SB,S in the respective partition, βi(B)\beta_{i}(B), δi(S)\delta_{i}(S) denote corresponding certificates: we will have

BX/Qi:βi(B)=BandSX/Pi:δi(S)=S.\forall B\in X/Q_{i}\colon\llbracket\beta_{i}(B)\rrbracket=B\qquad\text{and}\qquad\forall S\in X/P_{i}\colon\llbracket\delta_{i}(S)\rrbracket=S. (6)

We construct βi(B)\beta_{i}(B) and δi(S)\delta_{i}(S) iteratively, using certificates for the blocks SBS\subsetneqq B at every iteration:

Algorithm 3.7.

We extend 3.1 by the following. Initially, put

β0({C}):=andδ0([x]P0):=F!(c(x))for every xC.\beta_{0}(\{C\}):=\top\qquad\text{and}\qquad\delta_{0}([x]_{P_{0}}):={\ulcorner F!(c(x))\urcorner}\quad\text{for every $x\in C$.}

In the ii-th iteration, extend steps (A2) and (A3) by the following assignments:

  1. (A’2)

    βi+1(D)={δi(S)if D=Sβi(B)¬δi(S)if D=BSβi(D)if DC/Qi\mathrlap{\beta_{i+1}(D)}\phantom{\delta_{i+1}([x]_{P_{i+1}})}=\begin{cases}\delta_{i}(S)&\text{if }D=S\\ \beta_{i}(B)\wedge\neg\delta_{i}(S)&\text{if }D=B\setminus S\\ \beta_{i}(D)&\text{if }D\in C/Q_{i}\\ \end{cases}

  2. (A’3)

    δi+1([x]Pi+1)={δi([x]Pi)if [x]Pi+1=[x]Piδi([x]Pi)FχSB(c(x))(δi(S),βi(B))otherwise.\delta_{i+1}([x]_{P_{i+1}})=\begin{cases}\delta_{i}([x]_{P_{i}})&\text{if }[x]_{P_{i+1}}=[x]_{P_{i}}\\ \delta_{i}([x]_{P_{i}})\wedge{\ulcorner F\chi_{S}^{B}(c(x))\urcorner}(\delta_{i}(S),\beta_{i}(B))&\text{otherwise.}\\ \end{cases}

Upon termination, return δi\delta_{i}.

Like in subsection 3.1, the only block of C/Q0C/Q_{0} has β0({C})=\beta_{0}(\{C\})=\top as a certificate. Since the partition C/P0C/P_{0} distinguishes by the ‘output’ (e.g. final vs. non-final states), the certificate of [x]P0[x]_{P_{0}} specifies what F!(c(x))F1F!(c(x))\in F1 is (3.6).

In the ii-th iteration of the main loop, we have certificates δi(S)\delta_{i}(S) and βi(B)\beta_{i}(B) for SBS\subsetneqq B in step (A1) satisfying (6) available from the previous iterations. In (A’2), the Boolean connectives describe how BB is split into SS and BSB\setminus S. In (A’3), new certificates are constructed for every predecessor block TC/PiT\in C/P_{i} that is refined. If TT does not change, then neither does its certificate. Otherwise, the block T=[x]PiT=[x]_{P_{i}} is split into the blocks [x]FχSB(c(x))[x]_{F\chi_{S}^{B}(c(x))} for xTx\in T in step (A3), which is reflected by the F3F3 modality FχSB(c(x)){\ulcorner F\chi_{S}^{B}(c(x))\urcorner} as per 3.4.

Remark 5.

In step (A’2), βi+1(D)\beta_{i+1}(D) can be simplified to be no larger than δi(S)\delta_{i}(S). To see this, note that for SBCS\subseteq B\subseteq C, SX/PiS\in X/P_{i}, and BX/QiB\in X/Q_{i}, every conjunct of βi(B)\beta_{i}(B) is also a conjunct of δi(S)\delta_{i}(S). In βi(B)¬δi(S)\beta_{i}(B)\wedge\neg\delta_{i}(S), one can hence remove all conjuncts of βi(B)\beta_{i}(B) from δi(S)\delta_{i}(S), obtaining a formula δ\delta^{\prime}, and then equivalently use βi(B)¬δ\beta_{i}(B)\wedge\neg\delta^{\prime} in the definition of βi+1(D)\beta_{i+1}(D).

Theorem 3.8.

For zippable FF, 3.7 is correct, i.e. (6) holds for all ii. Thus, upon termination δi\delta_{i} assigns certificates to each block of C/=C/PiC/\mathord{\sim}=C/P_{i}.

Corollary 3.9 (Hennessy-Milner).

For zippable FF, states x,yx,y in a finite FF-coalgebra are behaviourally equivalent iff they agree on all F3F3-modal formulae.

Remark 6.

A smaller formula distinguishing a state xx from a state yy can be extracted from the certificates in time 𝒪(|C|)\mathcal{O}(|C|). It is the leftmost conjunct that is different in the respective certificates of xx and yy. This is the subformula starting at the modal operator introduced in δi\delta_{i} for the least ii with (x,y)Pi(x,y)\notin P_{i}; hence, xx satisfies t(δ,β){\ulcorner t\urcorner}(\delta,\beta) but yy satisfies t(δ,β){\ulcorner t^{\prime}\urcorner}(\delta,\beta) for some ttt^{\prime}\neq t in F3F3.

3.5 Complexity Analysis

The operations introduced by 3.7 can be implemented with only constant run time overhead. To this end, one implements β\beta and δ\delta as arrays of formulae of length |C||C| (note that at any point, there are at most |C||C|-many blocks). In the refinable-partition data structure [45], every block has an index (a natural number) and there is an array of length |C||C| mapping every state xCx\in C to the block it is contained in. Hence, for both partitions C/PC/P and C/QC/Q, one can look up a state’s block and a block’s certificate in constant time.

It is very likely that the certificates contain a particular subformula multiple times and that certificates of different blocks share common subformulae. For example, every certificate of a block refined in the ii-th iteration using SBS\subsetneqq B contains the subformulas δi(S)\delta_{i}(S) and βi(B)\beta_{i}(B). Therefore, it is advantageous to represent all certificates constructed as one directed acyclic graph (dag) with nodes labelled by modal operators and conjunction and having precisely two outgoing edges. Moreover, edges have a binary flag indicating whether they represent negation ¬\neg. Initially, there is only one node representing \top, and the operations of 3.7 allocate new nodes and update the arrays for β\beta and δ\delta to point to the right nodes. For example, if the predecessor block TC/PiT\in C/P_{i} is refined in step (A’3), yielding a new block [x]Pi+1[x]_{P_{i+1}}, then a new node labelled \wedge is allocated with edges to the nodes δi(T)\delta_{i}(T) and to another new node labelled FχSB(c(x))F\chi_{S}^{B}(c(x)) with edges to the nodes δi(S)\delta_{i}(S) and δi(B)\delta_{i}(B).

For purposes of estimating the size of formulae generated by the algorithm, we use a notion of transition in coalgebras, inspired by the notion of canonical graph [26].

Definition 3.10.

For states x,yx,y in an FF-coalgebra (C,c)(C,c), we say that there is a transition xyx\to y if c(x)FCc(x)\in FC is not in the image Fi[F(C{y})](FC)Fi[F(C\setminus\{y\})]\leavevmode\nobreak\ (\subseteq FC), where i:C{y}Ci\colon C\setminus\{y\}\rightarrowtail C is the inclusion map.

Theorem 3.11.

For a coalgebra with nn states and mm transitions, the formula dag constructed by 3.7 has size 𝒪(mlogn+n)\mathcal{O}(m\cdot\log n+n) and height at most n+1{n+1}.

Theorem 3.12.

3.7 adds only constant run time overhead, thus it has the same run time as 3.1 (regardless of the optimization from 5).

For a tighter run time analysis of the underlying partition refinement algorithm, one additionally requires that FF is equipped with a refinement interface [46, Def. 6.4], which is based on a given encoding of FF-coalgebras in terms of edges between states (encodings serve only as data structures and have no direct semantic meaning, in particular do not entail a semantic reduction to relational structures). This notion of edge yields the same numbers (in 𝒪\mathcal{O}-notation) as 3.10 for all functors considered. All zippable functors we consider here have refinement interfaces [46, 15]. In presence of a refinement interface, step (A3) can be implemented efficiently, with resulting overall run time 𝒪((m+n)lognp(c))\mathcal{O}((m+n)\cdot\log n\cdot p(c)) where n=|C|n=|C|, mm is the number of edges in the encoding of the input coalgebra (C,c)(C,c), and the run-time factor p(c)p(c) is associated with the refinement interface. In most instances, e.g. for 𝒫\mathcal{P}, ()\mathbb{R}^{(-)}, one has p(c)=1p(c)=1; in particular, the generic algorithm recovers the run time of the Paige-Tarjan algorithm.

Remark 7.

The claimed run time relies on close attention to a number of implementation details. This includes use of an efficient data structure for the partition C/PiC/P_{i} [31, 45]; the other partition C/QiC/Q_{i} is only represented implicitly in terms of a queue of blocks SBS\subsetneqq B witnessing PiQiP_{i}\subsetneqq Q_{i}, requiring additional care when splitting blocks in the queue [44, Fig. 3]. Moreover, grouping the elements of a block by F3F3 involves the consideration of a possible majority candidate [44].

Theorem 3.13.

On a coalgebra with nn states and mm transitions for a zippable set functor with a refinement interface with factor p(c)p(c), 3.7 runs in time 𝒪((m+n)lognp(c))\mathcal{O}((m+n)\cdot\log n\cdot p(c)).

4 Cancellative Functors

Our use of binary modalities relates to the fact that, as observed already by Paige and Tarjan, when splitting a block according to an existing partition of a block BB into SBS\subseteq B and BSB\setminus S, it is not in general sufficient to look only at the successors in SS. However, this does suffice for some transition types; e.g. Hopcroft’s algorithm for deterministic automata [27] and Valmari and Franceschinis’ algorithm for weighted systems (e.g. Markov chains) [44] both split only with respect to SS. In the following, we exhibit a criterion on the level of functors that captures that splitting w.r.t. only SS is sufficient:

Definition 8.

A functor FF is cancellative if the map

Fχ{1,2},Fχ{2}:F3F2×F2\langle F\chi_{{\{1,2\}}},F\chi_{{\{2\}}}\rangle\colon F3\to F2\times F2

is injective.

To understand the role of the above map, recall the function χSB:C3\chi_{S}^{B}\colon C\to 3 from (5) and note that χ{1,2}χSB=χB\chi_{{\{1,2\}}}\cdot\chi_{S}^{B}=\chi_{B} and χ{2}χSB=χS\chi_{{\{2\}}}\cdot\chi_{S}^{B}=\chi_{S}, so the composite Fχ{1,2},Fχ{2}FχSB\langle F\chi_{{\{1,2\}}},F\chi_{{\{2\}}}\rangle\cdot F\chi_{S}^{B} yields information about the accumulated transition weights into BB and SS but not about the one into BSB\setminus S; the injectivity condition means that for cancellative functors, this information suffices in the splitting step for SBCS\subseteq B\subseteq C. The term cancellative stems from the respective property on monoids; recall that a monoid MM is cancellative if s+b1=s+b2s+b_{1}=s+b_{2} implies b1=b2b_{1}=b_{2} for all s,b1,b2Ms,b_{1},b_{2}\in M.

Proposition 4.1.

The monoid-valued functor M()M^{(-)} for a commutative monoid MM is cancellative if and only if MM is a cancellative monoid.

Hence, ()\mathbb{R}^{(-)} is cancellative, but 𝒫f{\mathcal{P}_{\textsf{f}}} is not. Moreover, all signature functors are cancellative:

Proposition 4.2.

The class of cancellative functors contains the all constant functors as well as the identity functor, and it is closed under subfunctors, products, and coproducts.

For example, 𝒟{\mathcal{D}} is cancellative, but 𝒫\mathcal{P} is not because of its subfunctor 𝒫f{\mathcal{P}_{\textsf{f}}}.

Remark 9.

Cancellative functors are neither closed under quotients nor under composition. Zippability and cancellativity are independent properties. Zippability in conjunction with cancellativity implies mm-zippability for all mm\in\mathbb{N}, the mm-ary variant [32] of zippability.

Theorem 4.3.

If FF is a cancellative functor, FχSB(c(x))(δi(S),βi(B)){\ulcorner F\chi_{S}^{B}(c(x))\urcorner}(\delta_{i}(S),\beta_{i}(B)) in 3.7 can be replaced with FχSC(c(x))(δi(S),){\ulcorner F\chi_{S}^{C}(c(x))\urcorner}(\delta_{i}(S),\top). Then, the algorithm still correctly computes certificates in the given FF-coalgebra (C,c)(C,c).

Note that in this optimized algorithm, the computation of β\beta can be omitted because it is not used anymore. Hence, the resulting formulae only involve \wedge, \top, and modalities from the set F3F3 (with the second parameter fixed to \top). These modalities are equivalently unary modalities induced by elements of F2F2, which we term F2F2-modalities; hence, the corresponding Hennessy-Milner Theorem (3.9) adapts to F2F2 for cancellative functors, as follows:

Corollary 4.4.

For zippable and cancellative FF, states in an FF-coalgebra are behaviourally equivalent iff they agree on modal formulae built using \top, \wedge, and unary F2F2-modalities.

5 Domain-Specific Certificates

On a given specific system type, one is typically interested in certificates and distinguishing formulae expressed via modalities whose use is established in the respective domain, e.g. \Box and \Diamond for transition systems. We next describe how the generic F3F3 modalities can be rewritten to domain-specific ones in a postprocessing step. The domain-specific modalities will not in general be equivalent to F3F3-modalities, but still yield certificates.

Definition 10.

The Boolean closure Λ¯\bar{\Lambda} of a modal signature Λ\Lambda has as nn-ary modalities propositional combinations of atoms of the form (i1,,ik)\heartsuit(i_{1},\dots,i_{k}), for /kΛ\mathord{\raisebox{1.0pt}{$\heartsuit$}\mkern-1.5mu/\mkern-1.5mu{\raisebox{-1.0pt}{$k$}}}\in\Lambda, where i1,,iki_{1},\dots,i_{k} are propositional combinations of elements of {1,,n}\{1,\ldots,n\}. Such a modality λ/n\mathord{\raisebox{1.0pt}{$\lambda$}\mkern-1.5mu/\mkern-1.5mu{\raisebox{-1.0pt}{$n$}}} is interpreted by predicate liftings λX:(2X)nFX\llbracket\lambda\rrbracket_{X}\colon(2^{X})^{n}\to FX defined inductively in the obvious way.

For example, the boolean closure of Λ={/1}\Lambda=\{\mathord{\raisebox{1.0pt}{$\Diamond$}\mkern-1.5mu/\mkern-1.5mu{\raisebox{-1.0pt}{$1$}}}\} contains the unary modality =¬¬\Box=\neg\Diamond\neg.

Definition 11.

Given a modal signature Λ\Lambda for a functor FF, a domain-specific interpretation consists of functions τ:F1Λ¯\tau\colon F1\to\bar{\Lambda} and λ:F3Λ¯\lambda\colon F3\to\bar{\Lambda} assigning to each oF1o\in F1 a nullary modality τo\tau_{o} and to each tF3t\in F3 a binary modality λt\lambda_{t} such that the predicate liftings τoX2FX\llbracket\tau_{o}\rrbracket_{X}\in 2^{FX} and λtX:(2X)22FX\llbracket\lambda_{t}\rrbracket_{X}\colon(2^{X})^{2}\to 2^{FX} satisfy

τo1={o}(in 2F1) and [t]Fχ{1,2}λt3({2},{1})={t}(in 2F3).\llbracket\tau_{o}\rrbracket_{1}=\{o\}\quad\text{(in $2^{F1}$)}\quad\text{ and }\quad[t]_{F\chi_{\{1,2\}}}\cap\llbracket\lambda_{t}\rrbracket_{3}(\{2\},\{1\})=\{t\}\quad\text{(in $2^{F3}$)}.

(Recall that χ{1,2}:32\chi_{\{1,2\}}\colon 3\to 2 is the characteristic function of {1,2}3\{1,2\}\subseteq 3, and [t]Fχ{1,2}F3[t]_{F\chi_{\{1,2\}}}\subseteq F3 denotes the equivalence class of tt w.r.t. Fχ{1,2}:F3F2F\chi_{\{1,2\}}\colon F3\to F2.)

Thus, τo\tau_{o} holds precisely at states with output behaviour oF1o\in F1. Intuitively, λt(δ,ρ)\lambda_{t}(\delta,\rho) describes the refinement step of a predecessor block TT when splitting B:=δρB:=\llbracket\delta\rrbracket\cup\llbracket\rho\rrbracket into S:=δS:=\llbracket\delta\rrbracket and BS:=ρB\setminus S:=\llbracket\rho\rrbracket (Figure 3), which translates into the arguments {2}\{2\} and {1}\{1\} of λt3\llbracket\lambda_{t}\rrbracket_{3}. In the refinement step, we know from previous iterations that all elements have the same behaviour w.r.t. BB. This is reflected in the intersection with [t]Fχ{1,2}[t]_{F\chi_{{\{1,2\}}}}. The axiom guarantees that λt\lambda_{t} characterizes tF3t\in F3 uniquely, but only within the equivalence class representing a predecessor block. Thus, λt\lambda_{t} can be much smaller than equivalents of t{\ulcorner t\urcorner} (cf. 3.3):

Example 5.1.
  1. 1.

    For F=𝒫F=\mathcal{P}, we have a domain-specific interpretation over the modal signature Λ={/1}\Lambda={\{\Diamond/1\}}. For ,{0}𝒫1\emptyset,\{0\}\in\mathcal{P}1, take τ{0}=\tau_{{\{0\}}}=\Diamond\top and τ=¬\tau_{\emptyset}=\neg\Diamond\top. For t𝒫3t\in\mathcal{P}3, we put

    λt(δ,ρ)=¬ρif 2t1λt(δ,ρ)=δρif 2t1λt(δ,ρ)=¬δif 2t1λt(δ,ρ)=if 2t1.\begin{array}[]{rl@{~~~}l@{\qquad}rl@{~~~}l}\lambda_{t}(\delta,\rho)&=\neg\Diamond\rho\hfil\leavevmode\nobreak\ \leavevmode\nobreak\ \leavevmode\nobreak\ &\text{if }2\in t\not\mkern 1.0mu\ni 1&\lambda_{t}(\delta,\rho)&=\Diamond\delta\wedge\Diamond\rho\hfil\leavevmode\nobreak\ \leavevmode\nobreak\ \leavevmode\nobreak\ &\text{if }2\in t\ni 1\\ \lambda_{t}(\delta,\rho)&=\neg\Diamond\delta\hfil\leavevmode\nobreak\ \leavevmode\nobreak\ \leavevmode\nobreak\ &\text{if }2\notin t\ni 1&\lambda_{t}(\delta,\rho)&=\top\hfil\leavevmode\nobreak\ \leavevmode\nobreak\ \leavevmode\nobreak\ &\text{if }2\not\in t\not\mkern 1.0mu\ni 1.\end{array}

    The certificates obtained via this translation are precisely the ones generated in the example using the Paige-Tarjan algorithm, cf. (4), with ρ\rho in lieu of β¬δ\beta\wedge\neg\delta.

  2. 2.

    For a signature (functor) Σ\Sigma, take Λ={σ/0σ/nΣ}{=I/1I𝒫f()}\Lambda=\{\mathord{\raisebox{1.0pt}{$\sigma$}\mkern-1.5mu/\mkern-1.5mu{\raisebox{-1.0pt}{$0$}}}\mid\mathord{\raisebox{1.0pt}{$\sigma$}\mkern-1.5mu/\mkern-1.5mu{\raisebox{-1.0pt}{$n$}}}\in\Sigma\}\cup\{\mathord{\raisebox{1.0pt}{${\langle{\raisebox{1.0pt}{$\scriptstyle\mathord{=}\raisebox{-1.0pt}{$\scriptstyle I$}$}}\rangle}$}\mkern-1.5mu/\mkern-1.5mu{\raisebox{-1.0pt}{$1$}}}\mid I\in{\mathcal{P}_{\textsf{f}}}(\mathbb{N})\}. We interpret Λ\Lambda by the predicate liftings

    σX\displaystyle\llbracket\sigma\rrbracket_{X} ={σ(x1,,xn)x1,,xnX}ΣX,\displaystyle=\{\sigma(x_{1},\ldots,x_{n})\mid x_{1},\ldots,x_{n}\in X\}\subseteq\Sigma X,
    =I(S)\displaystyle\llbracket{\langle{\raisebox{1.0pt}{$\scriptstyle\mathord{=}\raisebox{-1.0pt}{$\scriptstyle I$}$}}\rangle}\rrbracket(S) ={σ(x1,,xn)ΣXi:iI(1inxiS)}.\displaystyle=\{\sigma(x_{1},\ldots,x_{n})\in\Sigma X\mid\forall i\in\mathbb{N}\colon i\in I\leftrightarrow(1\leq i\leq n\leavevmode\nobreak\ \wedge\leavevmode\nobreak\ x_{i}\in S)\}.

    Intuitively, =Iϕ{\langle{\raisebox{1.0pt}{$\scriptstyle\mathord{=}\raisebox{-1.0pt}{$\scriptstyle I$}$}}\rangle}\,\phi states that the iith successor satisfies ϕ\phi iff iIi\in I. We then have a domain-specific interpretation (τ,λ)(\tau,\lambda) given by τo:=σ\tau_{o}:=\sigma for o=σ(0,,0)Σ1o=\sigma(0,\ldots,0)\in\Sigma 1 and λt(δ,ρ):==Iδ\lambda_{t}(\delta,\rho):={\langle{\raisebox{1.0pt}{$\scriptstyle\mathord{=}I$}}\rangle}\delta for t=σ(x1,,xn)Σ3t=\sigma(x_{1},\ldots,x_{n})\in\Sigma 3 and I={i{1,,n}xi=2}I=\{i\in\{1,\ldots,n\}\mid x_{i}=2\}.

  3. 3.

    For a monoid-valued functor M()M^{(-)}, take Λ={=m/1mM}\Lambda=\{\mathord{\raisebox{1.0pt}{${\langle{\raisebox{1.0pt}{$\scriptstyle\mathord{=}m$}}\rangle}$}\mkern-1.5mu/\mkern-1.5mu{\raisebox{-1.0pt}{$1$}}}\mid m\in M\}, interpreted by the predicate liftings =mX:2X2M(X)\llbracket{{\langle{\raisebox{1.0pt}{$\scriptstyle\mathord{=}m$}}\rangle}}\rrbracket_{X}\colon 2^{X}\to 2^{M^{(X)}} given by

    =mX(S)={μM(X)m=xSμ(x)}.\llbracket{{\langle{\raisebox{1.0pt}{$\scriptstyle\mathord{=}m$}}\rangle}}\rrbracket_{X}(S)=\{\mu\in M^{(X)}\mid m=\textstyle\sum_{x\in S}\mu(x)\}.

    A formula =mδ{\langle{\raisebox{1.0pt}{$\scriptstyle\mathord{=}m$}}\rangle}\,\delta thus states that the accumulated weight of the successors satisfying δ\delta is exactly mm. A domain-specific interpretation (τ,λ)(\tau,\lambda) is then given by τo==o(0)\tau_{o}={\langle{\raisebox{1.0pt}{$\scriptstyle\mathord{=}o(0)$}}\rangle}\,\top for oM(1)o\in M^{(1)} and λt(δ,ρ)==t(2)δ=t(1)ρ\lambda_{t}(\delta,\rho)={\langle{\raisebox{1.0pt}{$\scriptstyle\mathord{=}t(2)$}}\rangle}\,\delta\wedge{\langle{\raisebox{1.0pt}{$\scriptstyle\mathord{=}t(1)$}}\rangle}\,\rho for tM(3)t\in M^{(3)}. In case MM is cancellative, we can also simply put λt(δ,ρ)==t(2)δ\lambda_{t}(\delta,\rho)={\langle{\raisebox{1.0pt}{$\scriptstyle\mathord{=}t(2)$}}\rangle}\,\delta.

  4. 4.

    For labelled Markov chains, i.e. FX=(𝒟X+1)AFX=({\mathcal{D}}X+1)^{A}, let Λ={ap/1aA,p[0,1]}\Lambda=\{\mathord{\raisebox{1.0pt}{$\langle a\rangle_{p}$}\mkern-1.5mu/\mkern-1.5mu{\raisebox{-1.0pt}{$1$}}}\mid a\in A,p\in[0,1]\}, where apϕ\langle a\rangle_{p}\phi denotes that on input aa, the next state will satisfy ϕ\phi with probability at least pp, as in cited work by Desharnais et al. [17]. This gives rise to the interpretation:

    τo=aAo(a)𝒟1a1aAo(a)1¬a1λt(δ,ρ)=aAt(a)𝒟3(at(a)(2)δat(a)(1)ρ)\tau_{o}=\bigwedge_{\begin{subarray}{c}a\in A\\ o(a)\in{\mathcal{D}}1\end{subarray}}\langle a\rangle_{1}\top\wedge\bigwedge_{\begin{subarray}{c}a\in A\\ o(a)\in 1\end{subarray}}\neg\langle a\rangle_{1}\top\qquad\lambda_{t}(\delta,\rho)=\bigwedge_{\begin{subarray}{c}a\in A\\ t(a)\in{\mathcal{D}}3\end{subarray}}(\langle a\rangle_{t(a)(2)}\,\delta\wedge\langle a\rangle_{t(a)(1)}\,\rho)

Given a domain-specific interpretation (τ,λ)(\tau,\lambda) for a modal signature Λ\Lambda for the functor FF, we can postprocess certificates ϕ\phi produced by 3.7 by replacing the modalities t{\ulcorner t\urcorner} for tF3t\in F3 according to the translation TT recursively defined by the following clauses for modalities and by commutation with propositional operators:

T(t(,))=τF!(t)T(t(δ,β))=λt(T(δ),T(β)¬T(δ)).T\big{(}{\ulcorner t\urcorner}(\top,\top)\big{)}=\tau_{F!(t)}\qquad T\big{(}{\ulcorner t\urcorner}(\delta,\beta))=\lambda_{t}\big{(}T(\delta),T(\beta)\wedge\neg T(\delta)\big{)}.

Note that one can replace T(β)¬T(δ)T(\beta)\wedge\neg T(\delta) with T(β)¬T(δ)T(\beta)\wedge\neg T(\delta^{\prime}) for the optimized δ\delta^{\prime} from 5; the latter conjunction has essentially the same size as T(δ)T(\delta).

Proposition 5.2.

For every certificate ϕ\phi of a behavioural equivalence class of a given coalgebra produced by either 3.7 or its optimization (Theorem 4.3), T(ϕ)T(\phi) is also a certificate for that class.

Thus, the domain-specific modal signatures also inherit a Hennessy-Milner Theorem.

Example 5.3.

For labelled Markov chains (FX=(𝒟X+1)AFX=({\mathcal{D}}X+1)^{A}) and the interpretation via the modalities ap\langle a\rangle_{p} (5.1.4), this yields certificates (thus in particular distinguishing formulae) in run time 𝒪(|A|mlogn)\mathcal{O}(|A|\cdot m\cdot\log n), with the same bound on formula size. Desharnais et al. describe an algorithm [17, Fig. 4] that computes distinguishing formulae in the negation-free fragment of the same logic (they note also that this fragment does not suffice for certificates). They do not provide a run-time analysis, but the nested loop structure indicates that the asymptotic complexity is roughly |A|n4|A|\cdot n^{4}.

6 Worst Case Tree Size of Certificates

In the complexity analysis (subsection 3.5), we have seen that certificates – and thus also distinguishing formulae – have dag size 𝒪(mlogn+n)\mathcal{O}(m\cdot\log n+n) on input coalgebras with nn states and mm transitions. However, when formulae are written in the usual linear way, multiple occurrences of the same subformula lead to an exponential blow up of the formula size in this sense, which for emphasis we refer to as the tree size.

Figueira and Gorín [22] show that exponential tree size is inevitable even for distinguishing formulae. The proof is based on winning strategies in bisimulation games, a technique that is also applied in other results on lower bounds on formula size [23, 3, 4].

Open Problem 6.1.

Do states in ()\mathbb{R}^{(-)}-coalgebras generally have certificates of subexponential tree size in the number of states? If yes, can small certificates be computed efficiently?

We note that for another cancellative functor, the answer is well-known: On deterministic automata, i.e. coalgebras for FX=2×XAFX=2\times X^{A}, the standard minimization algorithm constructs distinguishing words of linear length.

Remark 12.

Cleaveland [13, p. 368] also mentions that minimal distinguishing formulae may be exponential in size, however for a slightly different notion of minimality: a formula ϕ\phi distinguishing xx from yy is minimal if no ϕ\phi obtained by replacing a non-trivial subformula of ϕ\phi with the formula \top distinguishes xx from yy. This is weaker than demanding that the formula size of ϕ\phi is as small as possible. For example, in the transition system

\bulletxx\bullet\bulletyy\bullet\bullet\cdotsnn

for nn\in\mathbb{N},

the formula ϕ=n+2\phi=\Diamond^{n+2}\top distinguishes xx from yy and is minimal in the above sense. However, xx can in fact be distinguished from yy in size 𝒪(1)\mathcal{O}(1), by the formula ¬\Diamond\neg\Diamond\top.

7 Conclusions and Further Work

We have presented a generic algorithm that computes distinguishing formulae for behaviourally inequivalent states in state-based systems of various types, cast as coalgebras for a functor capturing the system type. Our algorithm is based on coalgebraic partition refinement [46], and like that algorithm runs in time 𝒪((m+n)lognp(c))\mathcal{O}((m+n)\cdot\log n\cdot p(c)), with a functor-specific factor p(c)p(c) that is 11 in many cases of interest. Independently of this factor, the distinguishing formulae constructed by the algorithm have dag size 𝒪(mlogn+n)\mathcal{O}(m\cdot\log n+n); they live in a dedicated instance of coalgebraic modal logic [39, 42], with binary modalities extracted from the type functor in a systematic way. We have shown that for cancellative functors, the construction of formulae and, more importantly, the logic can be simplified, requiring only unary modalities and conjunction. We have also discussed how distinguishing formulae can be translated into a more familiar domain-specific syntax (e.g. Hennessy-Milner logic for transition systems).

There is an open source implementation of the underlying partition refinement algorithm [15], which may serve as a basis for a future implementation.

In partition refinement, blocks are successively refined in a top-down manner, and this is reflected by the use of conjunction in distinguishing formulae. Alternatively, bisimilarity may be computed bottom-up, as in a recent partition aggregation algorithm [11]. It is an interesting point for future investigation whether this algorithm can be extended to compute distinguishing formulae, which would likely be of a rather different shape than those computed via partition refinement.

References

  • [1] Peter Aczel and Nax Mendler. A final coalgebra theorem. In Proc. Category Theory and Computer Science (CTCS), volume 389 of LNCS, pages 357–365. Springer, 1989.
  • [2] Jiří Adámek, Stefan Milius, and Lawrence S. Moss. Initial algebras, terminal coalgebras, and the theory of fixed points of functors. draft book, available online at https://www8.cs.fau.de/ext/milius/publications/files/CoalgebraBook.pdf, 2021.
  • [3] Micah Adler and Neil Immerman. An n! lower bound on formula size. In LICS 2001, pages 197–206. IEEE Computer Society, 2001.
  • [4] Micah Adler and Neil Immerman. An n! lower bound on formula size. ACM Trans. Comput. Log., 4(3):296–314, 2003.
  • [5] Abel Armas-Cervantes, Paolo Baldan, Marlon Dumas, and Luciano García-Bañuelos. Behavioral comparison of process models based on canonically reduced event structures. In Business Process Management, pages 267–282. Springer, 2014.
  • [6] Abel Armas-Cervantes, Luciano García-Bañuelos, and Marlon Dumas. Event structures as a foundation for process model differencing, part 1: Acyclic processes. In Web Services and Formal Methods, pages 69–86. Springer, 2013.
  • [7] Falk Bartels, Ana Sokolova, and Erik de Vink. A hierarchy of probabilistic system types. Theoret. Comput. Sci., 327:3–22, 2004.
  • [8] Marco Bernardo. TwoTowers 5.1 user manual, 2004.
  • [9] Marco Bernardo, Rance Cleaveland, Steve Sims, and W. Stewart. TwoTowers: A tool integrating functional and performance analysis of concurrent systems. In Formal Description Techniques and Protocol Specification, Testing and Verification, FORTE / PSTV 1998, volume 135 of IFIP Conference Proceedings, pages 457–467. Kluwer, 1998.
  • [10] Marco Bernardo and Marino Miculan. Constructive logical characterizations of bisimilarity for reactive probabilistic systems. Theoretical Computer Science, 764:80 – 99, 2019. Selected papers of ICTCS 2016.
  • [11] Johanna Björklund and Loek Cleophas. Aggregation-based minimization of finite state automata. Acta Informatica, 2020.
  • [12] Ufuk Celikkan and Rance Cleaveland. Generating diagnostic information for behavioral preorders. Distributed Computing, 9(2):61–75, 1995.
  • [13] Rance Cleaveland. On automatically explaining bisimulation inequivalence. In Computer-Aided Verification, pages 364–372. Springer, 1991.
  • [14] Sjoerd Cranen, Bas Luttik, and Tim A. C. Willemse. Evidence for Fixpoint Logic. In 24th EACSL Annual Conference on Computer Science Logic (CSL 2015), volume 41 of LIPIcs, pages 78–93. Schloss Dagstuhl–Leibniz-Zentrum für Informatik, 2015.
  • [15] Hans-Peter Deifel, Stefan Milius, Lutz Schröder, and Thorsten Wißmann. Generic partition refinement and weighted tree automata. In Formal Methods – The Next 30 Years, Proc. 3rd World Congress on Formal Methods (FM 2019), volume 11800 of LNCS, pages 280–297. Springer, 10 2019.
  • [16] J. Desharnais, A. Edalat, and P. Panangaden. A logical characterization of bisimulation for labeled markov processes. In Proceedings. Thirteenth Annual IEEE Symposium on Logic in Computer Science (Cat. No.98CB36226), pages 478–487, 1998.
  • [17] Josée Desharnais, Abbas Edalat, and Prakash Panangaden. Bisimulation for labelled markov processes. Information and Computation, 179(2):163–193, 2002.
  • [18] Remco Dijkman. Diagnosing differences between business process models. In Business Process Management, pages 261–277, Berlin, Heidelberg, 2008. Springer Berlin Heidelberg.
  • [19] Ernst-Erich Doberkat. Stochastic Coalgebraic Logic. Springer, 2009.
  • [20] Ulrich Dorsch, Stefan Milius, Lutz Schröder, and Thorsten Wißmann. Efficient coalgebraic partition refinement. In Proc. 28th International Conference on Concurrency Theory (CONCUR 2017), LIPIcs. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2017.
  • [21] Ulrich Dorsch, Stefan Milius, Lutz Schröder, and Thorsten Wißmann. Predicate liftings and functor presentations in coalgebraic expression languages. In Coalgebraic Methods in Computer Science, CMCS 2018, volume 11202 of LNCS, pages 56–77. Springer, 2018.
  • [22] Santiago Figueira and Daniel Gorín. On the size of shortest modal descriptions. In Advances in Modal Logic 8, papers from the eighth conference on "Advances in Modal Logic," held in Moscow, Russia, 24-27 August 2010, pages 120–139. College Publications, 2010.
  • [23] Tim French, Wiebe van der Hoek, Petar Iliev, and Barteld Kooi. On the succinctness of some modal logics. Artificial Intelligence, 197:56 – 85, 2013.
  • [24] Daniel Gorín and Lutz Schröder. Simulations and bisimulations for coalgebraic modal logics. In Algebra and Coalgebra in Computer Science - 5th International Conference, CALCO 2013, volume 8089 of LNCS, pages 253–266. Springer, 2013.
  • [25] H. Peter Gumm and Tobias Schröder. Monoid-labeled transition systems. In Coalgebraic Methods in Computer Science, CMCS 2001, volume 44(1) of ENTCS, pages 185–204. Elsevier, 2001.
  • [26] H.Peter Gumm. From TT-coalgebras to filter structures and transition systems. In Algebra and Coalgebra in Computer Science, volume 3629 of LNCS, pages 194–212. Springer, 2005.
  • [27] John Hopcroft. An nlognn\log n algorithm for minimizing states in a finite automaton. In Theory of Machines and Computations, pages 189–196. Academic Press, 1971.
  • [28] Paris C. Kanellakis and Scott A. Smolka. Ccs expressions, finite state processes, and three problems of equivalence. In Proceedings of the Second Annual ACM Symposium on Principles of Distributed Computing, PODC ’83, pages 228–240. ACM, 1983.
  • [29] Paris C. Kanellakis and Scott A. Smolka. CCS expressions, finite state processes, and three problems of equivalence. Inf. Comput., 86(1):43–68, 1990.
  • [30] Bartek Klin. The least fibred lifting and the expressivity of coalgebraic modal logic. In Algebra and Coalgebra in Computer Science, CALCO 2005, volume 3629 of LNCS, pages 247–262. Springer, 2005.
  • [31] Timo Knuutila. Re-describing an algorithm by Hopcroft. Theor. Comput. Sci., 250:333 – 363, 2001.
  • [32] Barbara König, Christina Mika-Michalski, and Lutz Schröder. Explaining non-bisimilarity in a coalgebraic approach: Games and distinguishing formulas. In Coalgebraic Methods in Computer Science, pages 133–154. Springer, 2020.
  • [33] Kim Guldstrand Larsen and Arne Arne Skou. Bisimulation through probabilistic testing. Inform. Comput., 94(1):1–28, 1991.
  • [34] Johannes Marti and Yde Venema. Lax extensions of coalgebra functors and their logic. J. Comput. Syst. Sci., 81(5):880–900, 2015.
  • [35] R. Milner. Communication and Concurrency. International series in computer science. Prentice-Hall, 1989.
  • [36] Robert Paige and Robert E. Tarjan. Three partition refinement algorithms. SIAM J. Comput., 16(6):973–989, 1987.
  • [37] D. Park. Concurrency and automata on infinite sequences. In Proceedings of 5th GI-Conference on Theoretical Computer Science, volume 104 of LNCS, pages 167–183, 1981.
  • [38] Dirk Pattinson. Coalgebraic modal logic: soundness, completeness and decidability of local consequence. Theoretical Computer Science, 309(1):177 – 193, 2003.
  • [39] Dirk Pattinson. Expressive logics for coalgebras via terminal sequence induction. Notre Dame J. Formal Log., 45(1):19–33, 2004.
  • [40] Jan Rutten. Universal coalgebra: a theory of systems. Theor. Comput. Sci., 249:3–80, 2000.
  • [41] Jan Rutten and Erik de Vink. Bisimulation for probabilistic transition systems: a coalgebraic approach. Theoret. Comput. Sci., 221:271–293, 1999.
  • [42] Lutz Schröder. Expressivity of coalgebraic modal logic: The limits and beyond. Theor. Comput. Sci., 390(2-3):230–247, 2008.
  • [43] Věra Trnková. On a descriptive classification of set functors I. Commentationes Mathematicae Universitatis Carolinae, 12(1):143–174, 1971.
  • [44] Antti Valmari and Giuliana Franceschinis. Simple 𝒪(mlogn)\mathcal{O}(m\log n) time Markov chain lumping. In Tools and Algorithms for the Construction and Analysis of Systems, TACAS 2010, volume 6015 of LNCS, pages 38–52. Springer, 2010.
  • [45] Antti Valmari and Petri Lehtinen. Efficient minimization of dfas with partial transition. In Theoretical Aspects of Computer Science, STACS 2008, volume 1 of LIPIcs, pages 645–656. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, Germany, 2008.
  • [46] Thorsten Wißmann, Ulrich Dorsch, Stefan Milius, and Lutz Schröder. Efficient and Modular Coalgebraic Partition Refinement. Logical Methods in Computer Science, Volume 16, Issue 1, January 2020.

Appendix A Appendix: Omitted Proofs

Details for section 2 (Preliminaries)

Details for subsection 2.1.

Given a pair of FF-coalgebra (C,c)(C,c) and (D,d)(D,d), we have a canonical FF-coalgebra structure on the the disjoint union C+DC+D of their carriers:

C+Dc+dFC+FD[F𝗂𝗇1,F𝗂𝗇2]F(C+D).C+D\xrightarrow{c+d}FC+FD\xrightarrow{[F\mathsf{in}_{1},F\mathsf{in}_{2}]}F(C+D).

The canonical inclusion maps 𝗂𝗇1:CC+D\mathsf{in}_{1}\colon C\to C+D and 𝗂𝗇2:DC+D\mathsf{in}_{2}\colon D\to C+D are FF-coalgebra morphisms. We say that states xCx\in C and yDy\in D are behavioural equivalent if 𝗂𝗇1(x)𝗂𝗇2(y)\mathsf{in}_{1}(x)\sim\mathsf{in}_{2}(y).

Note that this definition extends the original definition of \sim, in the sense that x,yx,y in the same coalgebra (C,c)(C,c) are behaviourally equivalent (xyx\sim y) iff 𝗂𝗇1(x)𝗂𝗇2(y)\mathsf{in}_{1}(x)\sim\mathsf{in}_{2}(y) in the canonical coalgebra on C+CC+C.

Details on Predicate Liftings in subsection 2.2.

The naturality of X:(2X)n2FX\llbracket\heartsuit\rrbracket_{X}\colon(2^{X})^{n}\to 2^{FX} in XX for /n\mathord{\raisebox{1.0pt}{$\heartsuit$}\mkern-1.5mu/\mkern-1.5mu{\raisebox{-1.0pt}{$n$}}} means that for every map f:XYf\colon X\to Y, the diagram

(2Y)n{(2^{Y})^{n}}2FY{2^{FY}}(2X)n{(2^{X})^{n}}2FX{2^{FX}}Y\scriptstyle{\llbracket\heartsuit\rrbracket_{Y}}(2f)n\scriptstyle{(2^{f})^{n}}2Ff\scriptstyle{2^{Ff}}Y\scriptstyle{\llbracket\heartsuit\rrbracket_{Y}}

commutes. Since 2()2^{(-)} is contravariant, the map f:XYf\colon X\to Y is sent to 2f:2Y2X2^{f}\colon 2^{Y}\to 2^{X} which takes inverse images; writing down the commutativity element-wise yields (3). By the Yoneda lemma, one can define predicate liftings

Lemma A.1.

A predicate lifting X:(2X)n2FX\llbracket\heartsuit\rrbracket_{X}\colon(2^{X})^{n}\to 2^{FX} for /n\mathord{\raisebox{1.0pt}{$\heartsuit$}\mkern-1.5mu/\mkern-1.5mu{\raisebox{-1.0pt}{$n$}}} is uniquely defined by a map f:F(2n)2f\colon F(2^{n})\to 2. Then X\llbracket\heartsuit\rrbracket_{X} is given by

X(P1,,Pn)(tFX)=f(F(x(P1(x),,Pn(x))X2n)(t))\llbracket\heartsuit\rrbracket_{X}(P_{1},\ldots,P_{n})(\underbrace{t}_{\in\,FX})=f(F(\underbrace{x\mapsto(P_{1}(x),\ldots,P_{n}(x))}_{X\to 2^{n}})(t))

or written as sets (considering fF(2n),PiXf\subseteq F(2^{n}),P_{i}\subseteq X):

X(P1,,Pn)={tFXFχP1,,χPn(t)f}\llbracket\heartsuit\rrbracket_{X}(P_{1},\ldots,P_{n})=\{t\in FX\mid F\langle\chi_{P_{1}},\ldots,\chi_{P_{n}}\rangle(t)\in f\}
Proof A.2.

The following mathematical objects are in one-to-one correspondence

F(2n)2(2n)X2FX natural in X(2X)n2FX natural in Xfptf(Fp(t))(P1,,Pn)tf(FP1,,Pn(t))\dfrac{F(2^{n})\to 2}{\dfrac{(2^{n})^{X}\to 2^{FX}\text{ natural in $X$}}{(2^{X})^{n}\to 2^{FX}\text{ natural in $X$}}}\qquad\qquad\dfrac{f}{\dfrac{p\mapsto t\mapsto f(Fp(t))}{(P_{1},\ldots,P_{n})\mapsto t\mapsto f(F\langle P_{1},\ldots,P_{n}\rangle(t))}}

The first correspondence is the Yoneda lemma and the second correspondence is a power law. On the right, the inhabitants of the sets are listed when starting with f:F(2n)2f\colon F(2^{n})\to 2. By the definition of ,\langle-,-\rangle we have:

P1,,Pn:X2nx(P1(x),,Pn(x))\langle P_{1},\ldots,P_{n}\rangle\colon X\to 2^{n}\qquad x\mapsto(P_{1}(x),\ldots,P_{n}(x))

Details for section 3 (Constructing Distinguishing Formulae)

Verification of 4.

We verify that for every tF3t\in F3

tX:(2X)22FX,tX(S,B)={tFXFχSBB(t)=t}\llbracket{\ulcorner t\urcorner}\rrbracket_{X}\colon(2^{X})^{2}\to 2^{FX},\qquad\llbracket{\ulcorner t\urcorner}\rrbracket_{X}(S,B)=\{t^{\prime}\in FX\mid F\chi_{S\cap B}^{B}(t^{\prime})=t\}

defines a predicate lifting (3). For f:XYf\colon X\to Y and S,B2XS,B\in 2^{X}, note that we have

χSBBf=χf1[SB]f1[B]\chi_{S\cap B}^{B}\cdot f=\chi_{f^{-1}[S\cap B]}^{f^{-1}[B]}

because f(x)Xf(x)\in X^{\prime} iff xf1[X]x\in f^{-1}[X^{\prime}] for all xXx\in X and XXX^{\prime}\subseteq X. We verify:

Ff1[tY(S,B)]\displaystyle Ff^{-1}\big{[}\llbracket{\ulcorner t\urcorner}\rrbracket_{Y}(S,B)\big{]} =Ff1[{tFYFχSBB(t)=t}]\displaystyle=Ff^{-1}\big{[}{\{t^{\prime}\in FY\mid F\chi_{S\cap B}^{B}(t^{\prime})=t\}}\big{]} (4)
={tFXFχSBB(Ff(t))=t}]\displaystyle={\{t^{\prime\prime}\in FX\mid F\chi_{S\cap B}^{B}(Ff(t^{\prime\prime}))=t\}}\big{]} (def. inv. Image)
={tFXF(χSBBf)(t))=t}]\displaystyle={\{t^{\prime\prime}\in FX\mid F(\chi_{S\cap B}^{B}\cdot f)(t^{\prime\prime}))=t\}}\big{]} (Functoriality)
={tFXFχf1[SB]f1[B](t)=t}]\displaystyle={\{t^{\prime\prime}\in FX\mid F\chi_{f^{-1}[S\cap B]}^{f^{-1}[B]}(t^{\prime\prime})=t\}}\big{]} ()(*)
={tFXFχf1[S]f1[B]f1[B](t)=t}]\displaystyle={\{t^{\prime\prime}\in FX\mid F\chi_{f^{-1}[S]\cap f^{-1}[B]}^{f^{-1}[B]}(t^{\prime\prime})=t\}}\big{]}
=tX(f1[S],f1[B])\displaystyle=\llbracket{\ulcorner t\urcorner}\rrbracket_{X}(f^{-1}[S],f^{-1}[B]) (4)

Hence, t\llbracket{\ulcorner t\urcorner}\rrbracket is a predicate lifting.

Proof of 3.4.

This follows directly from 4 for S:=ϕSS:=\llbracket\phi_{S}\rrbracket and B:=ϕBB:=\llbracket\phi_{B}\rrbracket, using that SB=SS\cap B=S:

t(ϕS,ϕB)\displaystyle\llbracket{\ulcorner t\urcorner}(\phi_{S},\phi_{B})\rrbracket =c1[tC(ϕS,ϕB)]\displaystyle=c^{-1}[\llbracket{\ulcorner t\urcorner}\rrbracket_{C}(\llbracket\phi_{S}\rrbracket,\llbracket\phi_{B}\rrbracket)]
=c1[tC(S,B)]\displaystyle=c^{-1}[\llbracket{\ulcorner t\urcorner}\rrbracket_{C}(S,B)]
=c1[{tFCFχSBB(t)=t}]\displaystyle=c^{-1}[\{t^{\prime}\in FC\mid F\chi_{S\cap B}^{B}(t^{\prime})=t\}]
={xCFχSB(c(x))=t}.\displaystyle=\{x\in C\mid F\chi_{S}^{B}(c(x))=t\}.

Proof of 3.6.

Note that for χCC:C3\chi_{C}^{C}\colon C\to 3, we have χCC=(C!1j13)\chi_{C}^{C}=(C\xrightarrow{\leavevmode\nobreak\ !\leavevmode\nobreak\ }1\xrightarrow{\leavevmode\nobreak\ j_{1}\leavevmode\nobreak\ }3) where j1(0)=2j_{1}(0)=2.

t\displaystyle\llbracket{\ulcorner t\urcorner}\rrbracket =Fj1(t)(,)\displaystyle=\llbracket{\ulcorner Fj_{1}(t)\urcorner}(\top,\top)\rrbracket (3.5)
={xCFχCC(c(x))=Fj1(t)}\displaystyle=\{x\in C\mid F\chi_{C}^{C}(c(x))=Fj_{1}(t)\} (3.4, =C\llbracket\top\rrbracket=C)
={xCFj1(F!(c(x)))=Fj1(t)}\displaystyle=\{x\in C\mid Fj_{1}(F!(c(x)))=Fj_{1}(t)\} (χCC=j1!\chi_{C}^{C}=j_{1}\cdot!)
={xCF!(c(x))=t}\displaystyle=\{x\in C\mid F!(c(x))=t\} (Fj1Fj_{1} injective)

In the last step use that, w.l.o.g., FF preserves injective maps (subsection 2.1). ∎

Proof of Theorem 3.8.

  1. 1.

    We first observe that given xCx\in C, SBCS\subseteq B\subseteq C, and formulae ϕS\phi_{S} and ϕB\phi_{B} which characterize SS and BB, respectively, we have:

    FχSB(c(x))(ϕS,ϕB)\displaystyle\llbracket{\ulcorner F\chi_{S}^{B}(c(x))\urcorner}(\phi_{S},\phi_{B})\rrbracket ={xCFχϕSϕB(c(x))=FχSB(c(x))}\displaystyle=\{x^{\prime}\in C\mid F\chi_{\llbracket\phi_{S}\rrbracket}^{\llbracket\phi_{B}\rrbracket}(c(x^{\prime}))=F\chi_{S}^{B}(c(x))\} (7)
    =[x]FχSB(c(x)),\displaystyle=[x]_{F\chi_{S}^{B}(c(x))}, (8)

    where (7) uses 3.4 and (8), holds since ϕB=B\llbracket\phi_{B}\rrbracket=B and ϕS=S\llbracket\phi_{S}\rrbracket=S.

  2. 2.

    We proceed to the verification of (6) by induction on ii.

    • In the base case i=0i=0, we have β0({C})=={C}\llbracket\beta_{0}(\{C\})\rrbracket=\llbracket\top\rrbracket=\{C\} for the only block in X/Q0X/Q_{0}. Since P0=ker(F!c)P_{0}=\ker(F!\cdot c), δ0\delta_{0} is well-defined, and by 3.6 we have

      δ0([x]P0)=F!(c(x))={yCF!(c(x))=F!(c(y))}=[x]P0.\llbracket\delta_{0}([x]_{P_{0}})\rrbracket=\llbracket{\ulcorner F!(c(x))\urcorner}\rrbracket=\{y\in C\mid F!(c(x))=F!(c(y))\}=[x]_{P_{0}}.
    • The inductive hypothesis states that

      δi(S)=Sandβi(B)=B.\llbracket\delta_{i}(S)\rrbracket=S\qquad\text{and}\qquad\llbracket\beta_{i}(B)\rrbracket=B.

      We prove that βi+1\beta_{i+1} is correct:

      βi+1([x]Qi+1)\displaystyle\llbracket\beta_{i+1}([x]_{Q_{i+1}})\rrbracket
      ={δi(S)if [x]Qi+1=S, hence S=[x]Piβi(B)Cδi(S)if [x]Qi+1=BS, hence B=[x]Qiβi([x]Qi)if [x]Qi+1C/Qi\displaystyle=\begin{cases}\llbracket\delta_{i}(S)\rrbracket&\text{if }[x]_{Q_{i+1}}=S\text{, hence }S=[x]_{P_{i}}\\ \llbracket\beta_{i}(B)\rrbracket\leavevmode\nobreak\ \cap\leavevmode\nobreak\ C\setminus\llbracket\delta_{i}(S)\rrbracket&\text{if }[x]_{Q_{i+1}}=B\setminus S\text{, hence }B=[x]_{Q_{i}}\\ \llbracket\beta_{i}([x]_{Q_{i}})\rrbracket&\text{if }[x]_{Q_{i+1}}\in C/Q_{i}\\ \end{cases}
      =(IH){Sif [x]Qi+1=SBCSif [x]Qi+1=BS[x]Qiif [x]Qi+1C/Qi\displaystyle\overset{\mathclap{\text{(IH)}}}{=}\begin{cases}S&\text{if }[x]_{Q_{i+1}}=S\\ B\leavevmode\nobreak\ \cap\leavevmode\nobreak\ C\setminus S&\text{if }[x]_{Q_{i+1}}=B\setminus S\\ [x]_{Q_{i}}&\text{if }[x]_{Q_{i+1}}\in C/Q_{i}\\ \end{cases}
      ={[x]Qi+1if [x]Qi+1=S=[x]Pi[x]Qi+1if [x]Qi+1=BS(since BCS=BS)[x]Qi+1if [x]Qi+1C/Qi(since [x]Qi is not split)\displaystyle=\begin{cases}[x]_{Q_{i+1}}&\text{if }[x]_{Q_{i+1}}=S=[x]_{P_{i}}\\ [x]_{Q_{i+1}}&\text{if }[x]_{Q_{i+1}}=B\setminus S\qquad\text{(since $B\cap C\setminus S=B\setminus S$)}\\ [x]_{Q_{i+1}}&\text{if }[x]_{Q_{i+1}}\in C/Q_{i}\qquad\text{(since $[x]_{Q_{i}}$ is not split)}\\ \end{cases}
      =[x]Qi+1.\displaystyle=[x]_{Q_{i+1}}.

      For δi+1\delta_{i+1}, we compute as follows:

      δi+1([x]Pi+1)\displaystyle\llbracket\delta_{i+1}([x]_{P_{i+1}})\rrbracket
      ={δi([x]Pi)if [x]Pi+1=[x]Piδi([x]Pi)FχSB(c(x))(δi(S),βi(B))otherwise\displaystyle=\qquad\begin{cases}\llbracket\delta_{i}([x]_{P_{i}})\rrbracket&\text{if }[x]_{P_{i+1}}=[x]_{P_{i}}\\ \llbracket\delta_{i}([x]_{P_{i}})\rrbracket\cap\llbracket{\ulcorner F\chi_{S}^{B}(c(x))\urcorner}(\delta_{i}(S),\beta_{i}(B))\rrbracket&\text{otherwise}\end{cases}
      =(IH) & (8){[x]Piif [x]Pi+1=[x]Pi[x]Pi[x]FχSB(c(x))otherwise\displaystyle\overset{\mathclap{\text{(IH) \& \eqref{eqF3ModBS}}}}{=}\qquad\begin{cases}[x]_{P_{i}}&\text{if }[x]_{P_{i+1}}=[x]_{P_{i}}\\ [x]_{P_{i}}\cap[x]_{F\chi_{S}^{B}(c(x))}&\text{otherwise}\end{cases}
      =def. Pi+1{[x]Pi+1if [x]Pi+1=[x]Pi[x]Pi+1otherwise\displaystyle\overset{\mathclap{\text{def. }P_{i+1}}}{=}\qquad\begin{cases}[x]_{P_{i+1}}&\text{if }[x]_{P_{i+1}}=[x]_{P_{i}}\\ [x]_{P_{i+1}}&\text{otherwise}\end{cases}
      =[x]Pi+1\displaystyle=\quad[x]_{P_{i+1}}

Details for 6.

In order to verify t