Combinatorial games from a type of states #
In the literature, mathematicians often describe games as graphs, consisting of a set of states, as
well as move relations for the left and right players. We define a structure ConcreteGame
which
facilitates this construction, bundling the left and right set functions along with the type, as
well as functions ConcreteGame.toLGame
and ConcreteGame.toIGame
which turn them into the
appropriate type of game.
Mathematically, ConcreteGame.toLGame
is nothing but the corecursor on loopy games, while
ConcreteGame.toIGame
is defined inductively.
Design notes #
When working with any "specific" game (nim, domineering, etc.) you can use ConcreteGame
to set up
the basic theorems and definitions, but the intent is that you're not working with ConcreteGame
directly most of the time.
A "concrete" game is a type of states endowed with move sets for the left and right players.
You can use ConcreteGame.toLGame
and ConcreteGame.toIGame
to turn this structure into the
appropriate game type.
- leftMoves : α → Set α
The set of options for the left player.
- rightMoves : α → Set α
The set of options for the right player.
Instances For
IsOption a b
means that a
is either a left or a right move for b
.
Instances For
Loopy games #
Turns a state of a ConcreteLGame
into an LGame
.
Equations
- c.toLGame a = LGame.corec c.leftMoves c.rightMoves a
Instances For
Well-founded games #
Conway recursion: build data for a game by recursively building it on its left and right sets.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Turns a state of a ConcreteIGame
into an IGame
.
Equations
Instances For
Convenience constructors #
Create a ConcreteGame
from a single function used for the left and right moves.
Equations
- ConcreteGame.ofImpartial moves = { leftMoves := moves, rightMoves := moves }