Documentation

LeanPool.MisereGames.GameGraph

Misere combinatorial games.

Combinatorial games from a type of states #

In the literature, games are often described in terms of their game graphs, which can be thought of as (not necessarily properly) 2-edge-coloured rooted arborescences. Or more informally as a set of states with move relations for Left and Right (the two players).

We define a structure GameGraph that facilitates this viewpoint, bundling the Left and Right option set functions along with the type, as well as GameGraph.toForm, which turns the graph into the relevant type of game form.

Design notes #

When working with any "specific" game (Nim, Domineering, Hackenbush, et cetera), one can use GameGraph to set up the basic theorems and definitions, but the intent is that one need not work with GameGraph directly most of the time.

structure MisereGames.GameGraph (α : Type v) :

A game graph is a type of states endowed with option sets for Left and Right.

Use GameGraph.toForm to turn this structure into the appropriate game type.

  • moves : PlayerαSet α

    The sets of options for the players.

Instances For

    Well-founded games #

    A game graph is well-founded if from every position there is no infinite sequence of (not necessarily alternating) Left and Right moves. In the literature, such a game is called loopfree (see [Siegel, Definition 4.1 on p. 34][siegel:CombinatorialGameTheory:2013]).

    Instances
      theorem MisereGames.GameGraph.IsWellFounded.of_subrelation {α : Type v} {g : GameGraph α} (r : ααProp) [IsWellFounded α r] (hr : ∀ (a b : α) (p : Player), a g.moves p br a b) :
      def MisereGames.GameGraph.moveRecOn {α : Type v} {g : GameGraph α} [g.IsWellFounded] {motive : αSort u_1} (x : α) (ind : (x : α) → ((p : Player) → (y : α) → y g.moves p xmotive y)motive x) :
      motive x

      Conway induction: 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
        theorem MisereGames.GameGraph.moveRecOn_eq {α : Type v} {g : GameGraph α} [g.IsWellFounded] {motive : αSort u_1} (x : α) (ind : (x : α) → ((p : Player) → (y : α) → y g.moves p xmotive y)motive x) :
        moveRecOn x ind = ind x fun (x_1 : Player) (y : α) (x : y g.moves x_1 x) => moveRecOn y ind
        def MisereGames.GameGraph.toForm {α : Type v} {g : GameGraph α} [Hl : ∀ (a : α), Small.{u, v} (g.moves Player.left a)] [Hr : ∀ (a : α), Small.{u, v} (g.moves Player.right a)] [g.IsWellFounded] {G : Type (u + 1)} [Form G] (a : α) :
        G

        Turns a state of a GameGraph into a Form.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          theorem MisereGames.GameGraph.toForm_def' {α : Type v} {g : GameGraph α} [Hl : ∀ (a : α), Small.{u, v} (g.moves Player.left a)] [Hr : ∀ (a : α), Small.{u, v} (g.moves Player.right a)] [g.IsWellFounded] {G : Type (u + 1)} [Form G] (a : α) :
          toForm a = !{fun (p : Player) => toForm '' g.moves p a}
          theorem MisereGames.GameGraph.toForm_def {α : Type v} {g : GameGraph α} [Hl : ∀ (a : α), Small.{u, v} (g.moves Player.left a)] [Hr : ∀ (a : α), Small.{u, v} (g.moves Player.right a)] [g.IsWellFounded] {G : Type (u + 1)} [Form G] (a : α) :
          @[simp]
          theorem MisereGames.GameGraph.moves_toForm {α : Type v} {g : GameGraph α} [Hl : ∀ (a : α), Small.{u, v} (g.moves Player.left a)] [Hr : ∀ (a : α), Small.{u, v} (g.moves Player.right a)] [g.IsWellFounded] {G : Type (u + 1)} [Form G] (p : Player) (a : α) :
          theorem MisereGames.GameGraph.mem_moves_toForm_of_mem {α : Type v} {g : GameGraph α} [Hl : ∀ (a : α), Small.{u, v} (g.moves Player.left a)] [Hr : ∀ (a : α), Small.{u, v} (g.moves Player.right a)] [g.IsWellFounded] {G : Type (u + 1)} [Form G] (p : Player) {a b : α} (hab : b g.moves p a) :