# Parity game

A parity game. Circular nodes belong to player 0, rectangular nodes belong to player 1. On the left side is the winning region of player 0, on the right side is the winning region of player 1.

A parity game is played on a colored directed graph, where each node has been colored by a priority – one of (usually) finitely many natural numbers. Two players, 0 and 1, move a (single, shared) token along the edges of the graph. The owner of the node that the token falls on, selects the successor node, resulting in a (possibly infinite) path, called the play.

The winner of a finite play is the player whose opponent is unable to move. The winner of an infinite play is determined by the priorities appearing in the play. Typically, player 0 wins an infinite play if the largest priority that occurs infinitely often in the play is even. Player 1 wins otherwise. This explains the word "parity" in the title.

Parity games lie in the third level of the borel hierarchy, and are consequently determined.[1]

Games related to parity games were implicitly used in Rabin's proof of decidability of second order theory of n successors, where determinacy of such games was proven.[2] The Knaster–Tarski theorem leads to a relatively simple proof of determinacy of parity games.[3]

Moreover, parity games are history-free determined.[3][4][5] This means that if a player has a winning strategy then that player has a winning strategy that depends only on the current board position, and not on the history of the play.

## Solving a game

 Can parity games be solved in polynomial time?

Solving a parity game played on a finite graph means deciding, for a given starting position, which of the two players has a winning strategy. It has been shown that this problem is in NP and Co-NP, as well as UP and co-UP.[6] It remains an open question whether this decision problem is solvable in PTime.

Given that parity games are history-free determined, solving a given parity game is equivalent to solving the following simple looking graph-theoretic problem. Given a finite colored directed bipartite graph with n vertices ${\displaystyle V=V_{0}\cup V_{1}}$, and V colored with colors from 1 to m, is there a choice function selecting a single out-going edge from each vertex of ${\displaystyle V_{0}}$, such that the resulting subgraph has the property that in each cycle the largest occurring color is even.

## Recursive algorithm for solving parity games

Zielonka outlined a recursive algorithm that solves parity games. Let ${\displaystyle G=(V,V_{0},V_{1},E,\Omega )}$ be parity game, where ${\displaystyle V_{0}}$ resp. ${\displaystyle V_{1}}$ are the sets of nodes belonging to player 0 resp. 1, ${\displaystyle V=V_{0}\cup V_{1}}$ is the set of all nodes, ${\displaystyle E\subseteq V\times V}$ is the total set of edges, and ${\displaystyle \Omega :V\rightarrow \mathbb {N} }$ is the priority assignment function.

Zielonka's algorithm is based on the notation of attractors. Let ${\displaystyle U\subseteq V}$ be a set of nodes and ${\displaystyle i=0,1}$ be a player. The ${\displaystyle i}$-attractor of ${\displaystyle U}$ is the least set of nodes ${\displaystyle Attr_{i}(U)}$ containing ${\displaystyle U}$ such that ${\displaystyle i}$ can force a visit to ${\displaystyle U}$ from every node in ${\displaystyle Attr_{i}(U)}$. It can be defined by a fix-point computation:

In other words, one starts with the initial set ${\displaystyle U}$ and adds, in every step, all nodes belonging to player 0 that can reach ${\displaystyle U}$ with a single edge and all nodes belonging to player 1 that must reach ${\displaystyle U}$ no matter which edge player 1 takes.

Zielonka's algorithm is based on a recursive descent on the number of priorities. If the maximal priority is 0, it is immediate to see that player 0 wins the whole game (with an arbitrary strategy). Otherwise, let ${\displaystyle p}$ be the largest one and let ${\displaystyle i=p\mod 2}$ be the player associated with the priority. Let ${\displaystyle U=\{v\mid \Omega (v)=p\}}$ be the set of nodes with priority ${\displaystyle p}$ and let ${\displaystyle A=Attr_{i}(U)}$ be the corresponding attractor of player ${\displaystyle i}$. Player ${\displaystyle i}$ can now ensure that every play that visits ${\displaystyle A}$ infinitely often is won by player ${\displaystyle i}$.

Consider the game ${\displaystyle G'=G\setminus A}$ in which all nodes and affected edges of ${\displaystyle A}$ are removed. We can now solve the smaller game ${\displaystyle G'}$ by recursion and obtain a pair of winning sets ${\displaystyle W'_{i},W'_{1-i}}$. If ${\displaystyle W'_{1-i}}$ is empty, then so is ${\displaystyle W_{1-i}}$ for the game ${\displaystyle G}$, because player ${\displaystyle 1-i}$ can only decide to escape from ${\displaystyle W_{i}}$ to ${\displaystyle A}$ which also results in a win for player ${\displaystyle i}$.

Otherwise, if ${\displaystyle W'_{1-i}}$ is not empty, we only know for sure that player ${\displaystyle 1-i}$ can win on ${\displaystyle W'_{1-i}}$ as there is no player ${\displaystyle i}$ escape from ${\displaystyle W'_{1-i}}$ to ${\displaystyle A}$ (because ${\displaystyle A}$ is an attractor already). We therefore compute to ${\displaystyle 1-i}$ attractor ${\displaystyle B=Attr_{1-i}(W'_{1-i})}$ of ${\displaystyle W'_{1-i}}$ and remove it from ${\displaystyle G}$ to obtain the smaller game ${\displaystyle G''=G\setminus B}$. We again solve it by recursion and obtain a pair of winning sets ${\displaystyle W''_{i},W''_{1-i}}$. It follows that ${\displaystyle W_{i}=W''_{i}}$ and ${\displaystyle W_{1-i}=W''_{1-i}\cup B}$.

In simple pseudocode, the algorithm might be expressed as this:

 

 function solve(${\displaystyle G}$) ${\displaystyle p}$ = maximal priority in ${\displaystyle G}$ if ${\displaystyle p=0}$ return ${\displaystyle W_{0}=V,W_{1}=\{\}}$ else ${\displaystyle U=}$ nodes in ${\displaystyle G}$ with priority ${\displaystyle p}$ ${\displaystyle i=p\mod 2}$ ${\displaystyle A=Attr_{i}(U)}$ ${\displaystyle W_{0}',W_{1}'=solve(G\setminus A)}$ if ${\displaystyle W_{i}'=V}$ return ${\displaystyle W_{i}=V,W_{1-i}=\{\}}$ ${\displaystyle B=Attr_{1-i}(W_{1-i}')}$ ${\displaystyle W_{0}'',W_{1}''=solve(G\setminus B)}$ return ${\displaystyle W_{i}=W_{i}'',W_{1-i}=W_{1-i}''\cup B}$ 

## Related games and their decision problems

A slight modification of the above game, and the related graph-theoretic problem, makes solving the game NP-hard. The modified game has the Rabin acceptance condition. Specifically, in the above bipartite graph scenario, the problem now is to determine if there is a choice function selecting a single out-going edge from each vertex of V0, such that the resulting subgraph has the property that in each cycle (and hence each strongly connected component) it is the case that there exists an i and a node with color 2i, and no node with color 2i + 1...

Note that as opposed to parity games, this game is no longer symmetric with respect to players 0 and 1.

## Relation with logic and automata theory

Most common applications of parity game solving.

Despite its interesting complexity theoretic status, parity game solving can be seen as the algorithmic backend to problems in automated verification and controller synthesis. The model-checking problem for the modal μ-calculus for instance is known to be equivalent to parity game solving. Also, decision problems like validity or satisfiability for modal logics can be reduced to parity game solving.

## References

1. D. A. Martin: Borel determinacy, The Annals of Mathematics, Vol 102 No. 2 pp. 363–371 (1975)
2. {{#invoke:Citation/CS1|citation |CitationClass=journal }}
3. E. A. Emerson and C. S. Jutla: Tree Automata, Mu-Calculus and Determinacy, IEEE Proc. Foundations of Computer Science, pp 368–377 (1991), ISBN 0-8186-2445-0
4. A. Mostowski: Games with forbidden positions, University of Gdansk, Tech. Report 78 (1991)
5. {{#invoke:Citation/CS1|citation |CitationClass=journal }}
6. Grädel 2007, p. 163
• {{#invoke:citation/CS1|citation

|CitationClass=book }}