2 Preliminaries: Communicating Systems and Games
The core background of this thesis is the trinity of characterizations for behavioral equivalences: relational, modal, and game-theoretic.
This chapter takes a tour into the field of formalisms used to model programs and communicating systems, which are accompanied by many notions for behavioral equivalence and refinement to relate or distinguish their models.
The tour is agnostic, building on the basic formalism of labeled transition systems and standard equivalences such as trace equivalence and bisimilarity. Simultaneously, the approach is opinionated, focusing on Robin Milner’s tradition of concurrency theory with a strong pull towards game characterizations.
Figure 2.1 shows the scaffold of this section along the trinity, instantiated to the classic notion of bisimilarity:
- Section 2.2 introduces (among other notions) bisimilarity through its relational characterization in terms of symmetric simulation relations.
- Section 2.3 treats the dual connection of bisimilarity and the distinguishing powers of a modal logic, known as the Hennessy–Milner theorem.
- Section 2.4 shows that both, the relations to validate bisimilarity and the modal formulas to falsify it, appear as certificates of strategies in a reachability game where an attacker tries to tell states apart and a defender tries to prevent this.
Readers familiar with the contents of Figure 2.1 might mostly skim through this chapter of preliminaries (although they are quite exciting!). The two core insights this chapter aims to seed for the upcoming chapters are:
Equivalence games are a most versatile way to handle behavioral equivalences and obtain decision procedures. The Hennessy–Milner theorem appears as a shadow of the determinacy of the bisimulation reachability game.
Modal characterizations allow a uniform handling of the hierarchy of equivalences. Productions in grammars of potential distinguishing formulas translate to game rules for equivalence games.
Both points might seem non-standard to those more accustomed to relational or denotational definitions of behavioral equivalences. To provide them with a bridge, we will start with relational and denotational definitions—but once we have crossed this bridge, we will not go back.
2.1 Behavior of Programs
Every computer scientist has some model in their head of what it is that their algorithms and programs are doing. Usually these models are wrong,1 especially, once concurrency enters the picture. The area of formal methods tries to make models sufficiently precise that one at least can say what went wrong.
1 But some are useful, as the saying goes.
2.1.1 Labeled Transition Systems
Labeled transition systems are the standard formalism to discretely express the state space of programs, algorithms, and more. One can think of them as nondeterministic finite automata where the finiteness constraint has been lifted.
Definition 2.1 (Transition Systems) A labeled transition system (LTS) consists of
- , a set of states,
- , a set of actions, and
- , a transition relation.2
We write for the set of derivative states , and for the set of enabled actions .
There is a canonical example used to discuss equivalences within transition systems, which we want to draw from. We will take the formulation that Henzinger used at CAV’23 as seen in Figure 2.2.
Example 2.1 (A Classic Example) Consider the transition system given by the following graph:
The program described by the transitions from chooses non-deterministically during a -step between two options and then offers only either or . The program on the other hand performs a -step and then offers the choice between options and to the environment.
There are two things one might wonder about Example 2.1:
- Should one care about non-determinism in programs? Subsection 2.1.2 shows how non-determinism arises naturally in concurrent programs.
- Should one consider and equivalent? This heavily depends. Section 2.2 will introduce a notion of equivalence under which the two are equivalent and one under which they differ.
Remark 2.1 (A Note on ). The action (the greek letter “tau”) will in later chapters stand for internal behavior and receive special treatment in Section 6.1.1. For the scope of this and the following three chapters, is an action like every other.
Generally, this thesis aims to be consistent with notation and naming in surrounding literature. Where there are different options, we usually prefer the less-greek one. Also, we write literals and constant names in and variables in . For the internal action, the whole field has converged to in italics, however—so, we will run with this.
2.1.2 Calculus of Communicating Systems
To talk about programs in this thesis, we use Milner’s (1980) Calculus of Communicating Systems (CCS), which—together with other great contributions—earned him the Turing award. It is a tiny concurrent programming language that fits in your pocket, and can be properly described mathematically!
Definition 2.2 (Calculus of Communicating Systems) Let be a set of channel names, and a set of process names. Then, processes, communicating via actions , are given by the following grammar:3 We call pairs of actions and coactions, and work with the aliasing . The intuition is that an action represents receiving and expresses sending in communication. A pair of action and coaction can “react” in a communication situation and only become internal activity in the view of the environment.
3 For the examples of this thesis, a simple CCS variant without value passing and renaming suffices.
Each sub-process tree must end in a -process or recursion. For brevity, we usually drop a final when writing terms, e.g., just writing for .
We place parenthesis, , in terms where the syntax trees are otherwise ambiguous, but understand the choice operator and the parallel operator to be associative.
Example 2.2 (Concurrent Philosophers) Following tradition, we will express our examples in terms of philosophers who need forks to eat spaghetti.4 So, consider two philosophers and who want to grab a resource modeled as an action in order to eat where we express eating with action and eating with . The philosopher processes read:
4 Of course, you can just as well read the examples to be about computer programs that race for resources.
An LTS representation of ’s behavior can be seen in the margin. Process captures the whole scenario where the two philosophers compete for the fork using communication: The restriction expresses that the -channel can only be used for communication within the system.
As the -action can be consumed by just one of the two philosophers, process expresses exactly the program behavior seen in state of Example 2.1.
The formal relationship between process terms and their LTS semantics is given by the following definition.
Definition 2.3 (CCS Semantics) Given an assignment of names to processes, , the operational semantics is defined inductively by the rules:
A process now denotes a position in the transition system defined through Definition 2.2.
So, when we were writing “” above, this was actually to claim that we are talking about a CCS system where the process name and . By the semantics, this also leads to the existence of a state in the CCS transition system, and usually that is the entity we are interested in when defining a process.
Feel free to go ahead and check that the transitions of Example 2.1 indeed match those that Definition 2.3 prescribes for of Example 2.2! (For readability, Example 2.1, has shorter state names, however.) For instance, the transition of Example 2.1 would be justified as follows:
Non-determinism like in of Example 2.1 can be understood as a natural phenomenon in models with concurrency. The model leaves unspecified which of two processes will consume an internal resource and, to the outsider, it is transparent which one took the resource until they communicate. There are other ways how non-determinism plays a crucial role in models, for instance, as consequence of abstraction or parts that are left open in specifications.
The second process of Example 2.1 can be understood as a deterministic sibling of .
Example 2.3 (Deterministic Philosophers) A process matching the transitions from in Example 2.1 would be the following, where the philosophers take the fork as a team and then let the environment choose who of them eats:
But are and equivalent?
2.2 Behavioral Equivalences
A behavioral equivalence formally defines when to consider two processes (or states, or programs) as equivalent. Clearly, there might be different ways of choosing such a notion of equivalence. Also, sometimes we are interested in a behavioral preorder, for instance, as a way of saying that a program does “less than” what some specification allows.
This section will quickly introduce the most common representatives of behavioral equivalences: Trace equivalence (and preorder), simulation equivalence (and preorder), and bisimilarity. We will then observe that the notions themselves can be compared in a hierarchy of equivalences.
2.2.1 Trace Equivalence
Every computer science curriculum features automata and their languages sometime at the beginning. Accordingly, comparing two programs in terms of the sequences of input/ouput events they might expose, referred to as their traces, is a natural starting point to talk about behavioral equivalences.
Definition 2.4 (Traces) The set of traces of a state is recursively defined as
5 We denote the empty word by .
Definition 2.5 (Trace Equivalence) Two states and are considered trace-equivalent, written , if .7
States are trace-preordered, , if .8
Example 2.4 The traces for the processes of Example 2.1 would be . Consequently, and are trace-equivalent, .
As , is trace-preordered to , . This ordering is strict, that is, , due to but . We could say that trace constitutes a difference between and .
Proposition 2.1 The trace preorder is indeed a preorder (i.e., transitive and reflexive)9 and trace equivalence is indeed an equivalence relation (i.e., transitive, reflexive, and moreover symmetric).10
Trace equivalence and preorder assign programs straightforward denotational semantics: The sets of traces they might expose. For many formal languages, these mathematical objects can be constructed directly from the expressions of the language. With the idea that the program text “denotes” its possible executions, the set of traces is called a “denotation” in this context. CCS, as we use it, follows another approach to semantics, namely the one of “operational semantics,” where the meaning of a program is in how it might interact.
There are several reasons why computer scientist did content themselves with trace equivalence when studying interactive systems. The core argument is that, in this context, one usually does not want to consider processes like and to be equivalent: The two might interact differently with an environment. For instance, assume there is a user that wants to communicate . In interactions with , they will always reach ; with , there is a possibility of ending up deadlocked in parallel with , never achieving success.
So let us look into more distinctive equivalences!
2.2.2 Simulation and Bisimulation
The other big approach to behavioral equivalence of programs is the one of relating parts of their state spaces to one-another. The idea here is to identify which states of one program can be used to simulate the behavior of the another.
Definition 2.6 (Simulation) A relation on states, , is called a simulation if, for each and with there is a with and .11
Definition 2.7 ((Bi-)similarity) Simulation preorder, simulation equivalence and bisimilarity are defined as follows:
- is simulated by , , iff there is a simulation with .12
- is similar to , , iff and .13
- is bisimilar to , , iff there is a symmetric simulation (i.e. ) with .14
We also call a symmetric simulation bisimulation for short.15 Canceled symbols of relations refer to their negations, for instance, iff there is no simulation with .
15 Other authors use a weaker definition, namely, that is a bisimulation if and are simulations. Both definitions lead to the characterization of the same notion of bisimilarity.
Example 2.5 The following relations are simulations on the LTS of Example 2.1:
- the empty relation ;
- the identity relation ;
- the universal relation between all final states ,
- more generally, the relation from final states to all other states: ;
- a minimal simulation for and : ;
- and the combination of the above .
The simulation shows that .
However, there is no simulation that preorders to , as there is no way to simulate the transition from for lack of a successor that allows and as does . (In Section 2.3, we will discuss how to capture such differences more formally.)
Thus, , and . Moreover, there cannot be a symmetric simulation, .
Example 2.5 shows that similarity and bisimilarity do not imply trace equivalence. Still, the notions are connected.
2.2.3 Equivalence Hierarchies
Bisimilarity, similarity and trace equivalence form a small hierarchy of equivalences in the sense that they imply one-another in one direction, but not in the other. Let us quickly make this formal:
Lemma 2.1 The relation is itself a symmetric simulation.18
Corollary 2.1 If , then .19
We also have seen with example Example 2.5 that this hierarchy is strict between trace and simulation preorder in the sense that there exist with but not . The hierarchy also is strict between similarity and bisimilarity as the following example shows.
Example 2.6 (Trolled philosophers) Let us extend of Example 2.3 to include a troll process that might consume the and then do nothing: This adds another deadlock state to the transition system, seen in Figure 2.5.
To similarity, this change is invisible, that is . (Reason: The relation is a simulation.)
However, to bisimilarity, constitutes a difference. There cannot be a symmetric simulation handling this transition as has no deadlocked successors. Thus .
The equivalences we have been discussed so far could also be understood as abstractions of an even finer equivalence, namely graph isomorphism:
Definition 2.8 (Graph Isomorphism) A bijective function is called a graph isomorphism on a transition system if, for all , the transition exists if and only if the transition exists.22
Two states and are considered graph-isomorphism-equivalent, , iff there is a graph isomorphism with .23
Example 2.7 Consider the transition system in Figure 2.6. because is a graph isomorphism.
Lemma 2.3 The relation is itself a symmetric simulation and thus implies .24
Once again, the hierarchy is strict because of bisimilarity being less restricted in the matching of equivalent states.
Example 2.8 Consider the processes and . can transition to , while has two options, namely and . All three reachable processes are deadlocks and thus isomorphic. But because no bijection can connect the one successor of and the two of . However, , as bisimilarity is more relaxed.
Graph isomorphism is the strongest equivalence, we have discussed so far. But stronger needs not be better.
2.2.4 Congruences
One of the prime quality criteria for behavioral equivalences is whether they form congruences with respect to fitting semantics or other important transformations. A congruence relates mathematical objects that can stand in for one-another in certain contexts, which, for instance, allows term rewriting. The concept is closely linked to another core notion of mathematics: monotonicity.
Definition 2.9 (Monotonicity and Congruence) An -ary function is called monotonic with respect to a family of partial orders and iff, for all and , it is the case that for all implies that . We will usually encounter settings where all components use the same order
The relation is then referred to as a precongruence for . If moreover is symmetric (and thus an equivalence relation), then is called a congruence for .
Example 2.9 (Parity as Congruence) As a standard example for a congruence, consider the equivalence relation of equally odd numbers For instance, and , but not .
is a congruence for addition and multiplication. For instance, the sum of two odd numbers will always be even; the product of two odd numbers, will always be odd.
But is no congruence for integer division. For instance, , but .
Proposition 2.3 Trace equivalence and bisimilarity on the CCS transition system (Definition 2.3) are congruences for the operators of CCS (Definition 2.2).25
25 For a generic proof of the congruence properties of trace equivalence, bisimiliarity, and most other notions of the equivalence spectrum, see Gazda et al. (2020).
The nice thing about congruences is that we can use them to calculate with terms, as is common in mathematics.
Graph isomorphism fails to be a congruence for CCS operators. For instance, consider , but .
2.2.5 Quotient Systems and Minimizations
One of the prime applications of behavioral equivalences is to battle the state space explosion problem: The transition systems of parallel processes quickly grow in size, usually exponentially with regard to the number of communication participants. But many of the states tend to be equivalent in behavior, and can be treated as one with their equals. This minimization hugely increases the size of models that can be handled in algorithms.
Example 2.10 (Trolled philosophers, minimized) In Example 2.6 of “trolled philosophers,” all terminal states are bisimilar, . We can thus merge them into one state as depicted in Figure 2.7, without affecting the behavioral properties of the other states with respect to bisimilarity, that is, and .
Definition 2.10 Given an equivalence relation on states, and a transition system , each equivalence class for is defined .
The quotient system is defined as , where is the set of equivalence classes , and
Proposition 2.4 On the combined system of and , states and their derived class are bisimilar, .
The same reasoning does not apply to graph isomorphism: In Example 2.10, the terminal states might be graph-isomorphic, but merging them changes the number of states and thus prevents isomorphism between and .
Together with the issue of congruence, we have now seen two reasons why graph isomorphism does not allow the kind of handling we hope for in behavioral equivalences. Thus, the following will focus on equivalences of bisimilarity and below. The next section will revisit a deeper, philosophical reason why bisimilarity is a reasonable limit of the properties one might care about in the comparison of processes.
2.3 Modal Logic
Modal logics are logics in which one can formalize how facts in one possible world relate to other possible worlds. In the computer science interpretation, the possible worlds are program states, and typical statements have the form: “If happens during the execution, then will happen in the next step.”
We care about modal logics as they too can be used to characterize behavioral equivalences. In this section, we will show how this characterization works and argue that, for our purposes of comparative semantics, modal characterizations are a superb medium.
2.3.1 Hennessy–Milner Logic to Express Observations
Hennessy & Milner (1980) introduce the modal logic that is now commonly called Hennessy–Milner logic as a “little language for talking about programs.” The idea is that HML formulas express “experiments” or “tests” that an observer performs interacting with a program.
Definition 2.11 (Hennessy–Milner Logic) Formulas of Hennessy–Milner logic are given by the grammar:26
We also write conjunctions as sets . The empty conjunction is denoted by and serves as the nil-element of HML syntax trees. We also usually omit them when writing down formulas, e.g., shortening to .
We will assume a form of associativity through the convention that conjunctions are flat in the sense that they do not immediately contain other conjunctions. In this sense, we consider and just as different representatives of the flattened formula .
The intuition behind HML is that it describes what sequences of behavior one may or may not observe of a system. Observations are used to build up possible action sequences; conjunctions capture branching points in decision trees; and negations describe impossibilities.
Definition 2.12 (HML semantics) The semantics of HML is defined recursively by:27
Example 2.11 Let us consider some observations on the system of Example 2.1.
- as both, and , expose the trace ,
- , but .
- , but .
2.3.2 Characterizing Bisimilarity via HML
We can now add the middle layer of our overview graphic in Figure 2.1: That two states are bisimilar precisely if they cannot be told apart using HML formulas.
Definition 2.13 (Distinctions and Equivalences) We say that formula distinguishes state from state if but .28
We say a sublogic preorders state to , , if no is distinguishing from .29 If the preordering goes in both directions, we say that and are equivalent with respect to sublogic , written .30
By this account, of Example 2.11 distinguishes from . On the other hand, distinguishes from . (The direction matters!) For instance, the sublogic preorders and in both directions; so the two states are equivalent with respect to this logic.
Proposition 2.5 Consider an arbitrary HML sublogic . Then, is a preorder, and an equivalence relation.31
Lemma 2.4 Hennessy–Milner logic equivalence is a simulation relation.32
Proof. Assume it were not. Then there would need to be with step , and no such that and . So there would need to be a distinguishing formula for each that can reach by an -step. Consider the formula . It must be true for and false for , contradicting .
Lemma 2.5 (HML Bisimulation Invariance) If and then .33
Proof. Induct over the structure of with arbitrary and .
- Case . Thus there is with . Because is a simulation according to Lemma 2.1, this implies with . The induction hypothesis makes entail and thus .
- Case . The induction hypothesis on the directly leads to .
- Case . Symmetry of according to Proposition 2.2, implies . By induction hypothesis, implies . So, using contraposition, the case implies .
Combining the bisimulation invariance for one direction and that is a symmetric simulation (Proposition 2.5 and Lemma 2.4) for the other, we obtain that precisely characterizes bisimilarity:
Theorem 2.1 (Hennessy–Milner Theorem) Bisimilarity and HML equivalence coincide, that is, precisely if .34
Remark 2.2. In the standard presentation of the theorem, image finiteness of the transition system is assumed. This means that is finite for every . The amount of outgoing transitions matters precisely in the construction of in the proof of Lemma 2.4. But as our definition of (Definition 2.11) allows infinite conjunctions , we do not need an assumption here. The implicit assumption is that the cardinality of index sets can match that of . The original proof by Hennessy & Milner (1980) uses binary conjunction () and thus can only express finitary conjunctions.
2.3.3 The Perks of Modal Characterizations
There is merit in also characterizing other equivalences through sublogics . There are four immediate big advantages to modal characterization:
Modal characterizations lead to proper preorders and equivalences by design due to Proposition 2.5. That is, if a behavioral preorder (or equivalence) is defined through modal logics, there is no need of proving transitivity and reflexivity (and symmetry).
Secondly, checking state equivalence for notions of -sublogics can soundly be reduced to checks on bisimulation-minimized systems as the transformation does not affect the sets of observations for minimized states (by combining Theorem 2.1 and Proposition 2.4).
Thirdly, modal characterizations can directly unveil the hierarchy between preorders, if defined cleverly, because of the following property.
Proposition 2.6 If then implies for all .35
Pay attention to the opposing directions of and implication, here!
Fourthly, as a corollary of Proposition 2.6, modal characterizations ensure equivalences to be abstractions of bisimilarity, which is a sensible base notion of equivalence.36
36 Among other things, bisimilarity checking has a better time complexity than other notions as will be discussed in Subsection 3.3.3.
In Chapter 3, we will discuss how the hierarchy of behavioral equivalences can be understood nicely and uniformly if viewed through the modal lens.
2.3.4 Expressiveness and Distinctiveness
Proposition 2.6 actually is a weak version of another proposition about distinctiveness of logics.
Definition 2.14 We say that an -observation language is less or equal in expressiveness to another iff, for any -transition system, for each , there is such that . (The definition can also be read with regards to a fixed transition system .)37 If the inclusion holds in both directions, and are equally expressive.
Definition 2.15 We say that an -observation language is less or equal in distinctiveness to another iff, for any -transition system and states and , for each that distinguishes from , there is that distinguishes from .38 If the inclusion holds in both directions, and are equally distinctive.
Lemma 2.6 Subset relationship entails expressiveness entails distinctiveness.
The other direction does not hold. For instance, , but they are equally expressive as can cover for the removed element. At the same time, is more expressive than , but equally distinctive.
The stronger version of Proposition 2.6 is thus:
Proposition 2.7 If is less or equal in distinctiveness to then implies for all .41
Remark 2.3. Through the lense of expressiveness, we can also justify why our convention to implicitly flatten conjunctions is sound: As this does not change a conjunction’s truth value, subsets with and without flattening-convention are equally expressive and thus distinctive.
Often, an equivalence may be characterized by different sublogics. In particular, one may find smaller characterizations as in the following example for bisimilarity.
Definition 2.16 Consider described by the following grammar.
is a proper subset of . For instance, it lacks the observation . Due to the subset relation, must be less or equal in expressiveness to , but this inclusion too is strict as cannot be covered for. But both logics are equally distinctive!
Lemma 2.7 and are equally distinctive.42
Proof. One direction is immediate from Lemma 2.6 as .
For the other direction, we need to establish that for each distinguishing some from some , there is a distinguishing from . We induct on the structure of with arbitrary and .
- Case distinguishes from . Thus there is with distinguishing from all . By induction hypothesis, there must be distinguishing from for each . Thus distinguishes from .
- Case distinguishes from . Therefore some already distinguishes from . By induction hypothesis, there must be distinguishes from .
- Case distinguishes from . Thus distinguishes from . By induction hypothesis, there is distinguishing from . Accordingly, distinguishes from .
The smaller bisimulation logic will become important again later in the next section (in Subsection 2.4.4).
2.4 Games
So far, we have only seen behavioral equivalences and modal formulas as mathematical objects and not cared about decision procedures. This section introduces game-theoretic characterizations as a way of easily providing decision procedures for equivalences and logics alike. Intuitively, the games can be understood as dialogs between a party that tries to defend a claim and a party that tries to attack it.
2.4.1 Reachability Games
We use Gale–Stewart-style reachability games (in the tradition of Gale & Stewart, 1953) where the defender wins all infinite plays.
Definition 2.17 (Reachability Game) A reachability game is played on a directed graph consisting of
- a set of game positions , partitioned into
- defender positions
- and attacker positions ,
- and a set of game moves .43
We denote by the game played from starting position .
Definition 2.18 (Plays and Wins) We call the paths with plays of . They may be finite or infinite. The defender wins infinite plays. If a finite play is stuck, the stuck player loses: The defender wins if , and the attacker wins if .
Usually, games are non-deterministic, that is, players have choices how a play proceeds at their positions. The player choices are formalized by strategies:
Definition 2.19 (Strategies and Winning Strategies) An attacker strategy is a (partial) function mapping play fragments ending at attacker positions to next positions to move to, , where must hold for all where is defined.
A play is consistent with an attacker strategy if, for all its prefixes ending in , .
Defender strategies are defined analogously, .
If ensures a player to win, is called a winning strategy for this player. The player with a winning strategy for is said to win .
Usually, we will focus on positional strategies, that is, strategies that only depend on the most recent position, which we will type (or , respectively).
We call the positions where a player has a winning strategy their winning region.
Definition 2.20 (Winning Region) The set of all positions where the attacker wins is called the attacker winning region of . The defender winning region is defined analogously.
Example 2.12 (A Simple Choice) Inspect the game in Figure 2.8, where round nodes represent defender positions and rectangular ones attacker positions. Its valid plays starting from are , , , and . The defender can win from with a strategy moving to where the attacker is stuck. Moving to instead would get the defender stuck. So, the defender winning region is and the attacker wins .
The games we consider are positionally determined. This means, for each possible initial position, exactly one of the two players has a positional winning strategy .
Proposition 2.8 (Determinacy) Reachability games are positionally determined, that is, for any game, each game position has exactly one winner: and , and they can win using a positional strategy.44
44 This is just an instantiation of positional determinacy of parity games (Zielonka, 1998). Reachability games are the subclass of parity games only colored by 0.
We care about reachability games because they are versatile in characterizing formal relations. Everyday inductive (and coinductive) definitions can easily be encoded as games as in the following example.
Example 2.13 (The -Game) Consider the following recursive definition of a less-or-equal operator ≤
on natural numbers in some functional programming language. (Consider nat
to be defined as recursive data type nat = 0 | Succ nat
.)
0 ≤ m ) = True
( Succ n ≤ 0 ) = False
(Succ n ≤ Succ m) = (n ≤ m) (
We can think of this recursion as a game where the attacker tries to prove that the left number is bigger than the right by always decrementing the left number and challenging the defender to do the same for the right stack too. Whoever hits zero first, loses.
This means we distribute the roles such that the defender wins for output True
and the attacker for output False
. The two base cases need to be dead ends for one of the players.
Formally, the game consists of attacker positions and defender positions for all , connected by chains of moves: now characterizes on in the sense that: The defender wins from precisely if . (Proof: Induct over with arbitrary .)
The game is boring because the players do not ever have any choices. They just count down their way through the natural numbers till they hit if , or otherwise.
is quite archetypical for the preorder and equivalence games we will use in the following pages. But do not worry, the following games will demand the players to make choices.
2.4.2 The Semantic Game of HML
As first bigger example of how recursive definitions can be turned into games, let us quickly look at a standard way of characterizing the semantics of HML (Definition 2.12) through a game. The defender wins precisely if the game starts from a state and formula such that the state satisfies the formula.
Definition 2.21 (HML Game) For a transition system , the game is played on , where the defender controls observations and negated conjunctions, that is and (for all ), and the attacker controls the rest.
- The defender can perform the moves:
- and the attacker can move:
The intuition is that disjunctive constructs (, ) make it easier for a formula to be true and thus are controlled by the defender who may choose which of the ways to show truth is most convenient. At conjunctive constructs (, ) the attacker chooses the option that is the easiest to disprove.
Example 2.14 The game of Example 2.12 is exactly the HML game for formula and state of Example 2.11 with , , , and .
The defender winning region corresponds to the facts that and .
As the technicalities are tangential to this thesis, we state the characterization result without proof:45
45 A detailed presentation of a more general HML game, also extending to recursive HML, can be found in Wortmann et al. (2015, Chapter 3).
Lemma 2.8 The defender wins precisely if .
2.4.3 The Bisimulation Game
We now can add the bottom layer of Figure 2.1: That bisimilarity can be characterized through a game, where the defender wins if the game starts on a pair of bisimilar states. This approach has been popularized by Stirling (1996).
Definition 2.22 (Bisimulation Game) For a transition system , the bisimulation game is played on attack positions and defense positions with the following moves:46
- The attacker may swap sides
- or challenge simulation
- and the defender answers simulation challenges
A schematic depiction of the game rules can be seen in Figure 2.9. From dashed nodes, the game proceeds analogously to the initial attacker position.
Example 2.15 Consider of Example 2.7. The bisimulation game on this system is given by Figure 2.10:
Clearly, there is no way for the attacker to get the defender stuck. Whatever strategy the attacker chooses, the game will go on forever, leading to a win for the defender. That it is always safe for the defender to answer with moves to and corresponds to being a bisimulation.
Example 2.16 Let us recall Example 2.6 of the “trolled philosophers,” where we determined and to be non-bisimilar. The bisimulation game graph for the system is depicted in Figure 2.11.
The attacker can win by moving . Along this sequence of positions, the defender never has a choice and is stuck in the end. The attacker exploits, that can reach an early deadlock via .
Theorem 2.2 (Stirling’s Game Characterization) The defender wins the bisimulation game starting at attacker position precisely if .47
Proof. Sketch for both directions:
Remark 2.4. One of the big advantages of game characterizations is that they provide a way to discuss equivalence and inequivalence interactively among humans. There also are several computer game implementations of bisimulation games.
For instance, Peacock (2020) implements a game about simulation and bisimulation as well as several weaker notions. The human plays the attacker trying to point out the inequivalence of systems according to the rules of Definition 2.22. Figure 2.12 shows a screenshot of said game. It can be played on https://www.concurrency-theory.org/rvg-game/.
Example 2.17 If one plays the bisimulation game of Definition 2.22 without the swapping moves, it will characterize the simulation preorder.
Consider the family of processes with . Define and . Then, the simulation game played from is isomorphic to the -game from Example 2.13.
In this sense, comparisons of programs and of numbers are … comparable.
2.4.4 How Bisimulation Game and HML Are Connected
Let us pause to think how bisimulation game and Hennessy–Milner logic connect.
You might have wondered why we even need a dedicated bisimulation game. The Hennessy–Milner theorem implies that we could directly use the HML game of Definition 2.21 to decide bisimilarity:
Definition 2.23 (Naive Bisimulation Game) We extend the Definition 2.21 by the following prefix:
- To challenge , the attacker picks a formula (claiming that distinguishes the states) and yields to the defender .
- The defender decides where to start the HML game:
- Either at (claiming to be non-distinguishing because it is untrue for )
- or at (claiming to be non-distinguishing because it is true for ).
- After that the turns proceed as prescribed by Definition 2.21.
This naive game, too, has the property that the defender wins from iff . The downside of the game is that the attacker has infinitely many options to pick from!
The proper bisimulation game of Definition 2.22, on the other hand, is finite for finite transition systems. Therefore, it induces decision procedures.
We will now argue that the bisimulation game actually is a variant of the naive game, where (1) the attacker names their formula gradually, and (2) the formulas stem from of Definition 2.16. To this end, we will show that attacker’s winning strategies imply distinguishing formulas, and that a distinguishing formula from certifies the existence of winning attacker strategies.
Example 2.18 Let us illustrate how to derive distinguishing formulas using the game of Example 2.16.
Recall that the attacker wins by moving . In Figure 2.13, we label the game nodes with the (sub-)formulas this strategy corresponds to. Swap moves become negations, and simulation moves become observations with a conjunction of formulas for each defender option. This attacker strategy can thus be expressed by .
More generally, the following lemma explains the construction of distinguishing formulas from attacker strategies:
Lemma 2.9 Let be a positional winning strategy for the attacker on from . Construct formulas recursively from game positions, , as follows: Then is well-defined and distinguishes from . Also, .
Proof.
The given construction is well-defined as must induce a well-founded order on game positions in order for the attacker to win, and the recursive invocations remain in the attacker winning strategy.
The distinction can be derived by induction on the construction of : Assume for appearing in recursive invocations of the definition of that distinguishes them and that . We have to show that the constructions in still fulfill this property:
- As distinguishes from , its negation must distinguish from by the HML semantics. Moreover, the grammar of Definition 2.21 is closed under negation.
- For to distinguish from , there must be , and for all with it must be that . We choose , because, as is an attacker winning strategy, is a valid move with . Also, all the defender may select in answers remain in the winning domain of the attacker, and we may use the induction hypothesis that . Therefore, for each there is a false conjunct with in that proves .
Lemma 2.10 If distinguishes from , then the attacker wins from .
Proof. By induction on the derivation of according to the definition from Definition 2.16 with arbitrary and .
- Case . As distinguishes from , there must be a such that and that distinguishes from every . That is, for each , at least one must be false. By induction hypothesis, the attacker thus wins each . As these attacker positions encompass all successors of , the attacker also wins this defender position and can win from by moving there with a simulation challenge.
- Case . As distinguishes from , distinguishes from . By induction hypothesis, the attacker wins . So they can also win by performing a swap.
Lemma 2.9 and Lemma 2.10, together with the fact that and are equally distinctive (Lemma 2.7), yield:
Theorem 2.3 The attacker wins from precisely if there is distinguishing from .
Of course, we already knew this! Theorem 2.3 is just another way of gluing together the Hennessy–Milner theorem on bisimulation (Theorem 2.1) and Stirling’s bisimulation game characterization (Theorem 2.2), modulo the determinacy of games. We thus have added the last arrow on the right side of Figure 2.1.
2.4.5 Deciding Reachability Games
All we need to turn a game characterization into a decision procedure, is a way to decide which player wins a position. Algorithm 2.1 describes how to compute who wins a finite reachability game for each position in time linear to the size of the game graph .
Intuitively, first assumes that the defender were to win everywhere and that each outgoing move of every position might be a winning option for the defender. Over time, every position that is determined to be lost by the defender is added to a list.50
At first, the defender loses immediately exactly at the defender’s dead-ends. Each defender-lost position is added to the set. To trigger the recursion, each predecessor is noted as defender-lost, if it is controlled by the attacker, or the amount of outgoing defender options is decremented if the predecessor is defender-controlled. If the count of a predecessor position hits 0, the defender also loses from there.
Once we run out of positions, we know that the attacker has winning strategies exactly for each position we have visited.
The following Table 2.1 lists how Algorithm 2.1 computes the winning region of the game of Definition 2.16.
- | , | |
, | ||
, |
The inner loop of Algorithm 2.1 clearly can run at most -many times. Using sufficiently clever data structures, the algorithm thus shows:
Proposition 2.9 Given a finite reachability game , the attacker’s winning region (and as well) can be computed in time and space.
2.5 Discussion
This chapter has taken a tour of characterizations for standard notions of behavioral preorder and equivalence on transition systems such as trace equivalence and bisimilarity.
In particular, in constructing the relationships of Figure 2.1 for bisimilarity, we have collected the theoretical ingredients for a certifying algorithm to check bisimilarity of states.
Figure 2.14 describes how to not only answer the question whether two states and are bisimilar, but how to also either provide a bisimulation relation or a distinguishing formula for the two as certificates for the answer. (The arrows stand for computations, the boxes for data.)
In this view, the game of possible distinctions and their preventability between attacker and defender serves as the “ground truth” about the bisimilarity of two states. Bisimulation relations and modal formulas only appear as witnesses of defender and attacker strategies, mediating between game and transition system. The Hennessy–Milner theorem emerges on this level as a shadow of the determinacy of the bisimulation game (Idea 2.1). This whole framework draws heavily from Stirling (1996).
We have disregarded the topic of axiomatic characterizations for behavioral equivalences. In these, sets of equations on process algebra terms (such as ) define behavioral congruences. Thus, they tend to be coupled to specific process languages and lack the genericity we pursue in starting out from transition systems.
We have observed that behavioral equivalences can be arranged in hierarchies and that these hierarchies could be handled nicely using modal characterizations to rank distinguishing powers (Subsection 2.3.3). We have also seen how to link game rules to productions in a language of potentially distinguishing formulas (Subsection 2.4.4). This departs from common textbook presentations that motivate the bisimulation game through the relational (coinductive) characterization (e.g. Sangiorgi, 2012). In later chapters, we will rather derive equivalence games from grammars of modal formulas (Idea 2.2), to generalize the framework of Figure 2.14 for whole spectra of equivalences.
But first, we have to make formal what we mean by equivalence spectra.