The stock single-tape translation preserves polynomial time
ProvedPvsNP.StockSingleTapeTime.polytime_stock_TM1complexity-theoryformal-verification
Given a bundled polynomial-time Mathlib TM2 algorithm, there is a polynomial in the encoded input length that bounds its translated TM1 run. This one-tape run reaches a halting configuration that represents the exact stock output stacks.
Preamble
import Mathlib.Computability.TuringMachine.Computable import Mathlib.Tactic set_option autoImplicit false set_option maxHeartbeats 2000000 open Turing Turing.TM2to1
Formal statement
theorem PvsNP.StockSingleTapeTime.polytime_stock_TM1 {α β αΓ βΓ : Type} {ea : α → List αΓ} {eb : β → List βΓ}
{f : α → β} (alg : TM2ComputableInPolyTime ea eb f) :
let tm := alg.tm
letI : Inhabited tm.Λ := ⟨tm.main⟩
∃ p : Polynomial ℕ, ∀ a, ∃ target',
TrCfg (haltList tm ((eb (f a)).map alg.outputAlphabet.invFun)) target' ∧
TM1.step (tr tm.m) target' = none ∧
Nonempty (StateTransition.EvalsToInTime (TM1.step (tr tm.m))
(TM1.init (trInit tm.k₀ ((ea a).map alg.inputAlphabet.invFun))) (some target')
(p.eval (ea a).length)) := by sorrySource
Counted simulation for the Mathlib TM2to1 translation. The classical single-tape simulation bound goes back to Hartmanis and Stearns (1965), doi:10.1090/S0002-9947-1965-0170805-7.