Algorithms for Solving Parity Games
3.3 Solving parity games
3.3.1 Divide and conquer
In Figure 3.2 we present a divide-and-conquer algorithm for solving parity games that generalises the algorithm for solving repeated reachability and eventual safety games from Section 3.2. The algorithm takes a parity game G with the priority function p : V → { 1, 2, . . . , d } as input, and it returns the pair (win0(G), win1(G)) of the winning sets of both players. Without loss of generality, we assume that the set p−1(d), of the vertices with highest priority d, is not empty.
Similarly to the algorithm for solving repeated reachability games, a solution of the parity game is obtained from solutions of subgames that are also parity games, and that have strictly smaller size. In contrast to the case of repeated reachability games, the divide-and-conquer procedure parity-win(G) may make two recursive calls, one on the subgame G = G\ reachj(p−1(d)) and the other on the subgame G = G\ reachi(Wi), where the identity of player j is determined by the parity of the highest priority d, player i is the opponent of player j, and Wi is the winning set of player i in subgame G.
algorithm parity-win(G) j ← d mod 2 ; i ← 1 − j if reachj(p−1(d)) = V then (Wi, Wj)← (∅, V ) else
G← G \ reachj(p−1(d)) (W0, W1)← parity-win(G) if Wi=∅
then (Wi, Wj)← (∅, V ) else
G← G \ reachi(Wi) (W0, W1)← parity-win(G) (Wi, Wj)← (V \ Wj, Wj) endif
endif
return (W0, W1)
Figure 3.2 A divide-and-conquer algorithm for parity games
In a series of exercises similar to, and generalising, Exercises 3.4–3.6 we
Algorithms for Solving Parity Games 83 provide the detailed structure of an inductive correctness proof for the algorithm, and we invite the reader to fill in the details.
Exercise 3.7 Assume that reachj(p−1(d)) = V . Argue that if player j follows a positional p−1(d)-reachability strategy from an arbitrary starting vertex v∈ V , then a vertex in p−1(d) occurs infinitely many times. Conclude that in this case winj(G) = V .
Assume that the games G and G are positionally determined, and that there are positional i-dominion and j-dominion strategies μ and χ on the winning sets Wi = wini(G) and Wj = winj(G), respectively, in game G, and positional i-dominion and j-dominion strategies μ and χ on the winning sets Wi= wini(G) and Wj= winj(G), respectively, in game G.
Exercise 3.8 Assume that Wi = ∅. Argue that the positional strategy that is the union of χ and the p−1(d)-reachability strategy is a winning strategy for j from every starting vertex in game G. Conclude that in this case winj(G) = V .
Exercise 3.9 Assume that Wi = ∅. Argue that the positional strategy μ that is the union of μ and the Wi-reachability strategy is a positional i-dominion strategy on reachi(Wi) in game G.
Observe that positional determinacy of game G implies that reachi(Wi)∪ Wi = V \ Wj. Prove that the positional strategy that is the union of μ and μ is a positional i-dominion strategy on V \ Wj in game G. Conclude that V \ Wj⊆ wini(G).
Prove that χ is a j-dominion strategy on Wj in game G. Conclude that Wj⊆ winj(G), that parity games are positionally determined, and that the algorithm parity-win(G) is correct.
Theorem 3.5 (Emerson and Jutla [1991]) Parity games are positionally determined.
Before we carry out a detailed analysis of the worst-case running time of the algorithm parity-win(G), we observe that positional determinacy of parity games implies that the problem of deciding the winner in parity games is in NP and in co-NP.
A one-player parity game is a parity game in which either V0 = ∅ or V1 =∅, i.e., one of the players owns all vertices in the game graph; in the former case we have a player 1 one-player parity game, and in the latter case we have a player 0 one-player parity game. An alternative, and for all purposes equivalent, definition of a one-player game requires that every
84 Marcin Jurdzi´nski
vertex of one of the players has exactly one outgoing edge. A typical example of a one-player parity game of the latter kind is the strategy subgraph of a positional strategy: given a positional strategy μ : V0 → V of player 0, its strategy subgraph is obtained by removing all edges (v, w)∈ V0× V , such that w = μ(v); strategy subgraphs of positional strategies of player 1 are defined analogously. Naturally, a strategy subgraph of a positional strategy of player 0 is a player 1 one-player game, and a strategy subgraph of a positional strategy of player 1 is a player 0 one-player game.
Exercise 3.10 Consider a player 1 one-player parity game with a starting vertex v. We say that a cycle in the game graph of a parity game is odd if the highest priority of a vertex on that cycle is odd; the cycle is even otherwise.
Argue that player 1 is the winner in the game if and only if an odd cycle is reachable from v in the game graph.
Design a polynomial time algorithm for deciding the winner in one-player parity games.
It is now easy to establish that deciding the winner in parity games is in NP: by positional determinacy it suffices to guess a positional strategy χ for player 1, and that can be done in non-deterministic polynomial time, and then to run the polynomial time algorithm from Exercise 3.10 on the strategy subgraph of χ to verify that χ is a winning strategy for player 1. A co-NP procedure for parity games is analogous: it suffices to swap players 1 and 0 in the above argument, mutatis mutandis.
Corollary 3.6 (Emerson et al. [1993]) The problem of deciding the winner in parity games is in NP and in co-NP.
Now we are going to carry out a detailed analysis of the worst-case running time of the algorithm parity-win(G). Note that the algorithm solves two reachability games by computing sets reachj(p−1(d)) and reachi(Wi), and it makes two recursive calls on parity games G = G\ reachj(p−1(d)) and G = G\ reachi(Wi), whose numbers of vertices are strictly smaller than that of parity game G. It follows that its worst-case running time can be characterised by the recurrence
T (n) ≤ 2 · T (n − 1) + O(m), T (1) = O(1),
where n =|V | and m = |E| are the numbers of vertices and edges, respectively, of the game graph, and hence T (n) = O(2n).
In the following exercise we ask the reader to carry out a better analysis of the worst-case running time of the algorithm parity-win(G), that takes
Algorithms for Solving Parity Games 85 into account the maximum priority d = max(p(V )) that occurs in the game graph. Let nd=|p−1(d)| be the number of vertices with priority d.
Exercise 3.11 Observe that the maximum priority in the parity game G = G\ reachj(p−1(d)) is strictly smaller than d.
Assume that the procedure parity-win(G) makes its second recursive call parity-win(G). Prove that if reachi(Wi) does not contain a vertex of priority d then reachi(Wi) = Wi, and that the procedure parity-win(G) does not make any recursive calls (because the condition in the second if-statement obtains).
Argue that the worst-case running time of the procedure parity-win(G) can be characterised by the recurrence:
T (n, d, nd) ≤ T (n, d − 1, nd−1) + T (n, d, nd− 1) + O(m), T (n, d, 1) ≤ 2 · T (n, d − 1, nd−1) + O(m),
T (n, 1, nd) = O(n), and hence also by the recurrence:
T (n, d) ≤ (nd+ 1)· T (n, d − 1) + O(ndm), T (n, 1) = O(n).
Prove that T (n, d) = O(m· ((n + d)/d)d) = O(nd+O(1)).
Theorem 3.7 (Emerson and Lei [1986], Emerson and Jutla [1991], Zielonka [1998]) The winning sets of both players in parity games can be computed in time O(m· ((n + d)/d)d) = O(nd+O(1)).
3.3.2 Divide and conquer with dominion preprocessing