Domineering as a combinatorial game. #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
We define the game of Domineering, played on a chessboard of arbitrary shape (possibly even disconnected). Left moves by placing a domino vertically, while Right moves by placing a domino horizontally.
This is only a fragment of a full development; in order to successfully analyse positions we would need some more theorems. Most importantly, we need a general statement that allows us to discard irrelevant moves. Specifically to domineering, we need the fact that disjoint parts of the chessboard give sums of games.
The equivalence (x, y) ↦ (x, y+1)
.
Equations
The equivalence (x, y) ↦ (x+1, y)
.
Equations
A Domineering board is an arbitrary finite subset of ℤ × ℤ
.
Instances for pgame.domineering.board
Left can play anywhere that a square and the square below it are open.
Equations
Right can play anywhere that a square and the square to the left are open.
Equations
After Left moves, two vertically adjacent squares are removed from the board.
Equations
- pgame.domineering.move_left b m = (finset.erase b m).erase (m.fst, m.snd - 1)
After Left moves, two horizontally adjacent squares are removed from the board.
Equations
- pgame.domineering.move_right b m = (finset.erase b m).erase (m.fst - 1, m.snd)
The instance describing allowed moves on a Domineering board.
Equations
- pgame.domineering.state = {turn_bound := λ (s : pgame.domineering.board), finset.card s / 2, L := λ (s : pgame.domineering.board), finset.image (pgame.domineering.move_left s) (pgame.domineering.left s), R := λ (s : pgame.domineering.board), finset.image (pgame.domineering.move_right s) (pgame.domineering.right s), left_bound := pgame.domineering.state._proof_1, right_bound := pgame.domineering.state._proof_2}
Construct a pre-game from a Domineering board.
Equations
Instances for pgame.domineering
All games of Domineering are short, because each move removes two squares.
Equations
The Domineering board with two squares arranged vertically, in which Left has the only move.
Equations
- pgame.domineering.one = pgame.domineering [(0, 0), (0, 1)].to_finset
Instances for pgame.domineering.one
The L
shaped Domineering board, in which Left is exactly half a move ahead.
Equations
- pgame.domineering.L = pgame.domineering [(0, 2), (0, 1), (0, 0), (1, 0)].to_finset
Instances for pgame.domineering.L
Equations
- pgame.short_one = id (pgame.short_domineering [(0, 0), (0, 1)].to_finset)
Equations
- pgame.short_L = id (pgame.short_domineering [(0, 2), (0, 1), (0, 0), (1, 0)].to_finset)