Documentation

CslibFrontier.Computability.Complexity.Classes.Alternation.GuessVerify

Games of polynomially many moves are in AP #

A polynomial-time game verifier (Cslib.Complexity.IsGameVerifier) decides a problem through a game of 2 * p n alternate single-bit moves, the existential player first. Through the guess-then-verify alternating machine (Turing.MultiTapeATM.guessVerify, in CslibFrontier.Computability.Machines.Turing.MultiTape.Alternating.GuessVerify) Chandra, Kozen and Stockmeyer Arora and Barak, Section 5.3, acceptance in the guessing phase is the game of L alternate moves (Turing.MultiTapeATM.GuessVerify.acceptsWithin_lift_tag), giving the overall time and acceptance specification (Turing.MultiTapeATM.guessVerify_spec).

For a game verifier V, prep writes the frame of 2 * p (enc a).length bits followed by enc a, by a polynomial-time machine with its output redirected to tape B (Turing.MultiTapeTM.outputToWord), and verify runs a polynomial-time machine computing V (a, z) from the word on tape B, which is the encoded pair encPair encBits enc (z, a) of the moves z and the instance (Turing.MultiTapeTM.inputFromWord). The machine therefore runs within polynomial time, and it accepts enc a exactly when the existential player wins the game, proving that every problem with a polynomial-time game verifier is in AP (Cslib.Complexity.IsGameVerifier.mem_AP).

The same machine works at any time bound: a game of L a moves whose number of moves is computable in unary, and whose verifier runs, within time O(t n), with n + L a = O(t n), is in ATIME t (Cslib.Complexity.mem_ATIME_of_alternation). The term n pays for copying the instance next to the moves, since the input head is sequential. Both results come from one private bound on the time of the guess-then-verify machine in terms of the times of its two deterministic phases.

Main results #

References #

theorem Turing.MultiTapeATM.GuessVerify.acceptsWithin_lift_tag {k : ℕ} {S₁ S₂ : Type} {B : Fin k} {prep : MultiTapeTM k Bool S₁} {verify : MultiTapeTM k Bool S₂} {input : List Bool} (r : ℕ) (zd : List Bool) (u : Bool) (n : ℕ) :
(guessVerify B prep verify).AcceptsWithin (2 * r + 1 + n) (lift S₁ B verify (cfg B (some (GuessState.tag u)) (MultiTapeTM.frame (zd ++ List.replicate r true) ++ input) (2 * zd.length))) ↔ Cslib.Complexity.Alternation (!u) (List.replicate r 1) fun (zr : List Bool) => (guessVerify B prep verify).AcceptsWithin n (lift S₁ B verify (cfg B none (MultiTapeTM.frame (zd ++ zr) ++ input) (2 * (zd.length + r))))

The guessing phase. From the tag of the first of r pairs true, true that follow the pairs of the moves zd, with the player u to move (true for universal), acceptance within 2 * r + 1 + n moves is the game of r alternate moves, the first by the player u, after which the configuration ending the guessing phase accepts within n moves.

theorem Turing.MultiTapeATM.guessVerify_spec {k : ℕ} {S₁ S₂ : Type} {B : Fin k} {prep : MultiTapeTM k Bool S₁} {verify : MultiTapeTM k Bool S₂} {input : List Bool} {L t₁ t₂ : ℕ} {V : List Bool → Bool} (hprep : MultiTapeTM.runFrom (Cfg.init prep.q₀ input) t₁ = wordsCfg input none (Function.update (fun (x : Fin k) => []) B (MultiTapeTM.frame (List.replicate L true) ++ input)) []) (hverify : ∀ (z : List Bool), z.length = L → (MultiTapeTM.runFrom (wordsCfg input (some verify.q₀) (Function.update (fun (x : Fin k) => []) B (MultiTapeTM.frame z ++ input)) []) t₂).state = none ∧ (MultiTapeTM.runFrom (wordsCfg input (some verify.q₀) (Function.update (fun (x : Fin k) => []) B (MultiTapeTM.frame z ++ input)) []) t₂).output = [V z]) :
∃ T ≤ t₁ + (4 * L + 3 + t₂), (guessVerify B prep verify).HaltsWithin T ((guessVerify B prep verify).toPTM.toNTM.initCfg input) ∧ ((guessVerify B prep verify).AcceptsWithin T ((guessVerify B prep verify).toPTM.toNTM.initCfg input) ↔ Cslib.Complexity.Alternation true (List.replicate L 1) fun (z : List Bool) => V z = true)

The guess-then-verify machine plays the game of L moves. Suppose that prep, started on the input with blank work tapes, has halted after t₁ steps with the frame of L bits true followed by the input on tape B and every other work tape blank, and that verify, started on the frame of any L moves z followed by the input on tape B and every other work tape blank, has halted after t₂ steps with output [V z]. Then for some T ≤ t₁ + 4 * L + 3 + t₂, every list of T moves reaches a halted configuration, and the machine accepts within T moves exactly when the existential player wins the game of L alternate moves, the existential first, with winning condition V.

Games of polynomially many moves are in AP Chandra, Kozen and Stockmeyer: a problem with a polynomial-time game verifier is decided in polynomial time by the guess-then-verify machine, which writes the moves of the two players, alternately, and then runs the verifier.

theorem Cslib.Complexity.mem_ATIME_of_alternation {α : Type} {enc : α ↪ List Bool} {A : Set α} {L : α → ℕ} {V : α × List Bool → Bool} {t : ℕ → ℕ} {TL SL : α → ℕ} {TV SV : α × List Bool → ℕ} {C : ℕ} (hL : Turing.MultiTapeTM.ComputableInO L enc Turing.MultiTapeTM.encUnary TL SL) (hV : Turing.MultiTapeTM.ComputableInO V (Turing.MultiTapeTM.encPair enc Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encBool TV SV) (hA : ∀ (a : α), a ∈ A ↔ Alternation true (List.replicate (L a) 1) fun (z : List Bool) => V (a, z) = true) (hTL : ∀ (a : α), (enc a).length + L a + TL a ≤ C * t (enc a).length + C) (hTV : ∀ (a : α) (z : List Bool), z.length = L a → TV (a, z) ≤ C * t (enc a).length + C) :
A ∈ ATIME enc t

Games of O(t n) moves with an O(t n)-time verifier are in ATIME t Chandra, Kozen and Stockmeyer Arora and Barak, Section 5.3: let a ∈ A exactly when the existential player wins the game of L a alternate single-bit moves, the existential player first, with winning condition V. If L is computable in unary within time O(TL a), the verifier V is computable within time O(TV (a, z)), and, for a constant C, n + L a + TL a and TV (a, z) (for every z of length L a) are at most C * t n + C, where n is the length of enc a, then the guess-then-verify machine decides A within time O(t n).

This is the time-parametric form of Cslib.Complexity.IsGameVerifier.mem_AP; it is not a Chandra–Kozen–Stockmeyer simulation theorem by itself. The term n in the hypothesis pays for copying the instance next to the moves on a work tape, since the input head is sequential, so the statement only applies to time bounds t n ≥ n up to constants.