Documentation

CslibFrontier.Computability.Complexity.Problems.GeneralizedGeography

Generalized Geography #

Generalized Geography, in the version of Sipser, Section 8.3, is played on a directed graph (Cslib.Complexity.Graph: declared vertices and arcs) with a token on a start vertex. Two players alternately move the token along an arc to a declared vertex that the token has not visited yet, the start vertex counting as visited; the player who cannot move loses. This is the vertex version of the game, whose PSPACE-completeness is due to Lichtenstein and Sipser [LS80]; in Schaefer's original Generalized Geography the players may not reuse an arc instead [Sch78a].

Every move visits a new declared vertex, so the game is finite, and the winner is determined by backward induction: with the token at v and the vertices vis visited, the player to move wins (Cslib.Complexity.Graph.GeographyWins) exactly when some arc from v leads to an unvisited declared vertex w from which the other player, now to move, does not win. This is the existence of a winning strategy for the player to move. GeneralizedGeography is the set of graphs with a start vertex on which the first player wins.

Boundary cases: arcs to undeclared vertices are never used; the start vertex need not be declared, and it is never revisited; a start vertex without usable arcs is a loss for the first player.

Main definitions #

Main results #

References #

theorem Cslib.Complexity.Graph.card_sdiff_cons_lt {G : Graph} {vis : List ℕ} {w : ℕ} (hw : w ∈ G.vertices) (hvis : w ∉ vis) :

A move to an unvisited declared vertex leaves fewer unvisited declared vertices.

@[irreducible]

Generalized Geography: with the token at v and the vertices vis visited, the player to move wins when some arc from v leads to an unvisited declared vertex w from which the other player, to move with w visited, does not win.

theorem Cslib.Complexity.Graph.geographyWins_iff {G : Graph} {vis : List ℕ} {v : ℕ} :
G.GeographyWins vis v ↔ ∃ (w : ℕ), (v, w) ∈ G.edges ∧ w ∈ G.vertices ∧ w ∉ vis ∧ ¬G.GeographyWins (w :: vis) w

The backward induction of Generalized Geography.

theorem Cslib.Complexity.Graph.not_geographyWins_iff {G : Graph} {vis : List ℕ} {v : ℕ} :
¬G.GeographyWins vis v ↔ ∀ (w : ℕ), (v, w) ∈ G.edges → w ∈ G.vertices → w ∉ vis → G.GeographyWins (w :: vis) w

The player to move loses exactly when every move leads to a position won by the other player.

theorem Cslib.Complexity.Graph.geographyWins_congr {G : Graph} {vis vis' : List ℕ} (h : ∀ (u : ℕ), u ∈ vis ↔ u ∈ vis') (v : ℕ) :

Only the set of visited vertices matters.

An instance (graph, start) of Generalized Geography.

  • graph : Graph

    The directed graph on which the game is played.

  • start : ℕ

    The starting vertex of the token.

Instances For
    theorem Cslib.Complexity.encGeneralizedGeography_graph_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → GeneralizedGeographyInstance} :
    theorem Cslib.Complexity.encGeneralizedGeography_start_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → GeneralizedGeographyInstance} :
    theorem Cslib.Complexity.encGeneralizedGeography_mk_budget {γ : Type} {encIn : γ ↪ List Bool} {budget : γ → ℕ} {x0 : γ → Graph} {x1 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn encGraph budget) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn Turing.MultiTapeTM.encNat budget) :
    Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { graph := x0 x, start := x1 x }) encIn encGeneralizedGeography budget
    theorem Cslib.Complexity.encGeneralizedGeography_mk_inO {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → Graph} {T0 S0 x1 T1 S1 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn encGraph T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn Turing.MultiTapeTM.encNat T1 S1) :
    Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { graph := x0 x, start := x1 x }) encIn encGeneralizedGeography (fun (x : γ) => T0 x + T1 x) fun (x : γ) => S0 x + S1 x

    Generalized Geography, vertex version Sipser, Section 8.3 [LS80]: the graphs with a start vertex on which the first player wins, moving first with the token on the start vertex, when no vertex may be visited twice.

    theorem Cslib.Complexity.notMem_GeneralizedGeography_of_nil {V : List ℕ} {s : ℕ} :
    { graph := { vertices := V, edges := [] }, start := s } ∉ GeneralizedGeography

    On a graph without arcs the first player cannot move and loses.