Games described via "the state of the board". #
We provide a simple mechanism for constructing combinatorial (pre-)games, by describing "the state of the board", and providing an upper bound on the number of turns remaining.
Implementation notes #
We're very careful to produce a computable definition, so small games can be evaluated
using decide
. To achieve this, I've had to rely solely on induction on natural numbers:
relying on general well-foundedness seems to be poisonous to computation?
See SetTheory/Game/Domineering
for an example using this construction.
SetTheory.PGame.State S
describes how to interpret s : S
as a state of a combinatorial game.
Use SetTheory.PGame.ofState s
or SetTheory.Game.ofState s
to construct the game.
SetTheory.PGame.State.l : S → Finset S
and SetTheory.PGame.State.r : S → Finset S
describe
the states reachable by a move by Left or Right. SetTheory.PGame.State.turnBound : S → ℕ
gives an upper bound on the number of possible turns remaining from this state.
- turnBound : S → ℕ
- l : S → Finset S
- r : S → Finset S
- left_bound {s t : S} : t ∈ SetTheory.PGame.State.l s → SetTheory.PGame.State.turnBound t < SetTheory.PGame.State.turnBound s
- right_bound {s t : S} : t ∈ SetTheory.PGame.State.r s → SetTheory.PGame.State.turnBound t < SetTheory.PGame.State.turnBound s
Instances
Construct a PGame
from a state and a (not necessarily optimal) bound on the number of
turns remaining.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Two different (valid) turn bounds give equivalent games.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Construct a combinatorial PGame
from a state.
Equations
Instances For
The equivalence between leftMoves
for a PGame
constructed using ofStateAux _ s _
, and
L s
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The equivalence between leftMoves
for a PGame
constructed using ofState s
, and l s
.
Equations
Instances For
The equivalence between rightMoves
for a PGame
constructed using ofStateAux _ s _
, and
R s
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The equivalence between rightMoves
for a PGame
constructed using ofState s
, and
R s
.
Equations
Instances For
The relabelling showing moveLeft
applied to a game constructed using ofStateAux
has itself been constructed using ofStateAux
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The relabelling showing moveLeft
applied to a game constructed using of
has itself been constructed using of
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The relabelling showing moveRight
applied to a game constructed using ofStateAux
has itself been constructed using ofStateAux
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The relabelling showing moveRight
applied to a game constructed using of
has itself been constructed using of
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- SetTheory.PGame.fintypeLeftMovesOfStateAux n s h = Fintype.ofEquiv { t : S // t ∈ SetTheory.PGame.State.l s } (SetTheory.PGame.leftMovesOfStateAux n h).symm
Equations
- SetTheory.PGame.fintypeRightMovesOfStateAux n s h = Fintype.ofEquiv { t : S // t ∈ SetTheory.PGame.State.r s } (SetTheory.PGame.rightMovesOfStateAux n h).symm
Equations
- One or more equations did not get rendered due to their size.
Equations
- SetTheory.PGame.shortOfState s = id inferInstance
Construct a combinatorial Game
from a state.