Finite two-person games of perfect information #
A two-person game of perfect information (PerfectInfoGame) is given by its legal positions, the
finite sequences of moves played so far, together with the player to move at each position and the
victor of each finished play. The positions form a tree in the sense of descriptive set theory
(Mathlib's Descriptive.tree: a set of finite sequences closed under prefixes) that contains the
empty sequence, the initial position. The game is over at a position that no legal move continues
(PerfectInfoGame.IsOver). Players are true (the first player) and false (the second); the
player to move (turn) is an arbitrary function of the position, so alternating play is the case
turn x = decide (Even x.length). Each position may have any set of legal moves, finite or not.
A strategy for player b (PerfectInfoGame.Strategy) chooses a legal move at every position that
some legal move continues; only its choices at positions where b is to move matter. A play
follows the strategy when every move made at such a position is the strategy's choice, and the
strategy is winning when every finished play that follows it is won by b.
PerfectInfoGame.CanWin is backward induction: G.CanWin b k x says that from position x,
player b can force a win when at most k further moves are played.
Main results #
PerfectInfoGame.not_canWin_iff: at every position and depth, exactly one player can force a win.PerfectInfoGame.exists_isWinning_iff_canWin: if every play ends after at mostnmoves, thenbhas a winning strategy exactly when backward induction to depthnfrom the initial position says so.PerfectInfoGame.exists_isWinning_iff_not_exists_isWinning: in such a game,bhas a winning strategy exactly when the other player has none.PerfectInfoGame.exists_isWinning: Zermelo's theorem Arora and Barak, Chapter 4, Exercise 8: in every such game one of the two players has a winning strategy.
The source's finiteness is "an a priori upperbound n on the number of moves after which the game
is over and one of the two players is declared the victor — there are no draws" (printed p. 89 /
PDF p. 105). It is the hypothesis ∀ x ∈ G.tree, x.length ≤ n, and the absence of draws is the
type Bool of winner.
References #
- S. Arora, B. Barak, Computational Complexity: A Modern Approach, Chapter 4, Exercise 8.
A two-person game of perfect information. Its legal positions are the finite sequences of moves
played so far, starting from the empty sequence; the player to move and, on finished plays, the
victor are functions of the position. Players are true (the first player) and false (the
second).
- tree : ↥(Descriptive.tree M)
The legal positions: the sequences of moves played so far, closed under prefixes.
The initial position, before any move, is legal.
The player to move at a position.
The victor of a finished play; there are no draws.
The game is over at the position x when no legal move continues it.
A strategy for player b: a legal move at every position that some legal move continues. Only
its choices at the positions where b is to move matter.
The move chosen at a position that some legal move continues.
The chosen move is legal.
A sequence of moves follows the strategy σ of player b when every move made at a position
where b is to move is the move σ chooses there.
A strategy of player b is winning when b wins every finished play that follows it.
Backward induction: G.CanWin b k x says that player b can force a win from the position x
when at most k further moves are played. A finished position is won by its victor. At an
unfinished one, b needs one move to a position from which b can force a win when b is to move,
and every move must lead to such a position otherwise. With no move left (k = 0) the position is
judged by its victor.
Under a move bound n, a winning strategy of b lets b force a win by backward induction
from every legal position that follows it, with enough moves left.
Under a move bound n, player b has a winning strategy exactly when backward induction to
depth n from the initial position says that b can force a win.
Under a move bound, player b has a winning strategy exactly when the other player has none.
Zermelo's theorem Arora and Barak, Chapter 4, Exercise 8: in every
two-person game of perfect information with an a priori bound n on the number of moves after which
the game is over and one of the players is declared the victor, one of the two players has a winning
strategy. By exists_isWinning_iff_not_exists_isWinning, exactly one of them has one.