Generalized geography
DefinitionWinning positions in Geography#✓fully proved
Let \(E\) be a list of pairs of natural numbers, read as directed edges, let \(v\) be a natural number (the current vertex) and let \(V\) be a list of natural numbers (the visited vertices). For a natural number \(k\) (the fuel), the predicate \(\mathrm{GeoWins}(k, E, v, V)\) is defined by recursion on \(k\): \(\mathrm{GeoWins}(0, E, v, V)\) is false, and \(\mathrm{GeoWins}(k + 1, E, v, V)\) holds exactly when there is a natural number \(w\) with \((v, w) \in E\) and \(w \notin V\) such that \(\mathrm{GeoWins}(k, E, w, V')\) is false, where \(V'\) is the list \(V\) with \(w\) added at the front.
Read as a game, the player to move wins when they can move the token along an edge of \(E\) to a vertex not in \(V\) from which the opponent does not win; a player with no such move, or with no fuel left, loses.
def GeoWins : ℕ → List (ℕ × ℕ) → ℕ → List ℕ → Prop
| 0, _, _, _ => False
| fuel + 1, edges, pos, visited =>
∃ nxt, (pos, nxt) ∈ edges ∧ nxt ∉ visited ∧ ¬ GeoWins fuel edges nxt (nxt :: visited)
Used by 1
DefinitionGeography as a decision problem#✓fully proved
The Geography decision problem accepts a bitstring \(x\) exactly when \(x\) decodes, under the canonical bitstring encoding of triples \((n, E, s)\) of a natural number, a list of pairs of natural numbers and a natural number, to a triple with \(s < n\), with both entries of every pair in \(E\) less than \(n\), and with \(\mathrm{GeoWins}(n + 1, E, s, [s])\), where \([s]\) is the list whose only entry is \(s\). Bitstrings that do not decode are rejected.
A play never revisits one of the \(n\) vertices, so the fuel \(n + 1\) never runs out: the condition says that the player who moves first wins Geography on the directed graph with vertices \(0, \ldots, n - 1\) and edge list \(E\), with the token starting on \(s\) and \(s\) marked visited.
noncomputable def geographyDec :
MetaMathlibExt.ComplexityTheory.DecisionProblem := fun x =>
match MetaMathlibExt.BitstringEncoding.bitDecode
(α := ℕ × List (ℕ × ℕ) × ℕ) x with
| some i => decide (i.2.2 < i.1 ∧
(∀ e ∈ i.2.1, e.1 < i.1 ∧ e.2 < i.1) ∧
GeoWins (i.1 + 1) i.2.1 i.2.2 [i.2.2])
| none => false
abbrev DecisionProblem := List Bool → Bool
MathlibExt/Computability/Complexity.lean:170
def bitDecode [BitstringEncoding α] (l : List Bool) : Option α := toEncoding.decode l
MathlibExt/Computability/Complexity.lean:58
def GeoWins : ℕ → List (ℕ × ℕ) → ℕ → List ℕ → Prop
| 0, _, _, _ => False
| fuel + 1, edges, pos, visited =>
∃ nxt, (pos, nxt) ∈ edges ∧ nxt ∉ visited ∧ ¬ GeoWins fuel edges nxt (nxt :: visited)
WantedExt/Complexity/KeyTheorems/GeographyPSPACECompleteWanted.lean:45
Uses 10 · Used by 1
TheoremGeography is PSPACE-complete#●ready to prove
The Geography decision problem belongs to PSPACE, and every decision problem in PSPACE has a polynomial-time many-one reduction to it.
public theorem_wanted geography_pspace_complete :
geographyDec ∈ PSPACE ∧ ∀ L : MetaMathlibExt.ComplexityTheory.DecisionProblem,
L ∈ PSPACE → Cslib.CookLevin.PolyManyOneRed L geographyDec
noncomputable def geographyDec :
MetaMathlibExt.ComplexityTheory.DecisionProblem := fun x =>
match MetaMathlibExt.BitstringEncoding.bitDecode
(α := ℕ × List (ℕ × ℕ) × ℕ) x with
| some i => decide (i.2.2 < i.1 ∧
(∀ e ∈ i.2.1, e.1 < i.1 ∧ e.2 < i.1) ∧
GeoWins (i.1 + 1) i.2.1 i.2.2 [i.2.2])
| none => false
WantedExt/Complexity/KeyTheorems/GeographyPSPACECompleteWanted.lean:52
def PSPACE : DecisionComplexityClass :=
{L | langOf L ∈ Cslib.Turing.MultiTapeTM.Classes.PSPACE}
CSLibExt/Computability/Complexity/Classes.lean:117
abbrev DecisionProblem := List Bool → Bool
MathlibExt/Computability/Complexity.lean:170
def PolyManyOneRed (L₁ L₂ : MetaMathlibExt.ComplexityTheory.DecisionProblem) : Prop :=
∃ reduce : List Bool → List Bool,
MetaMathlibExt.ComplexityTheory.IsPolyTime reduce ∧ ∀ x, L₁ x = L₂ (reduce x)
CSLibExt/Computability/CookLevin.lean:396
Sources
- T. J. Schaefer, "On the complexity of some two- person perfect-information games", Journal of Computer and System Sciences 16 (1978), 185-225.
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.