Prove2Me
Navigate
DiscoverFormalpediaBlogsUsersMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Cook–Levin output: bounded bit prefix and terminating cell

Proved
CookLevin.computesInTime_output_spec

by Robertboy18 · Sep 22, 2026 · Mathlib 0df444a (Lean v4.33.1)

complexity-theorycook-levinturing-machines

For every well-formed machine computing f within T, the output f(x) has length at most T(|x|). Each output cell j+1 contains the encoding of the corresponding bit f(x)[j], and the following cell is a non-bit symbol. Every decoding fuel strictly greater than T(|x|) returns the same f(x). These are properties of the actual output tape after execution, not assumptions about a normalized tape representation.

Preamble
import Definitions.Def_CookLevin_Cost
open CookLevin
set_option autoImplicit false
Formal statement
theorem CookLevin.computesInTime_output_spec {k G : Nat} (M : Machine)
    (hM : TuringMachine k G M) (T : Nat → Nat) (f : List Bool → List Bool)
    (hcomp : ComputesInTime M k T f) (x : List Bool) :
    let cfg := execute M (startConfig2 k (boolsToSymbols x) []) (T x.length)
    (f x).length ≤ T x.length ∧
      (∀ j, (hj : j < (f x).length) →
        tapeFun cfg (verdictTape k) (j + 1) = boolSym ((f x)[j])) ∧
      symBool? (tapeFun cfg (verdictTape k) ((f x).length + 1)) = none ∧
      ∀ fuel, T x.length < fuel → outputOf k cfg fuel = f x := by sorry
Source
Direct proofs from the CookLevin Basic and Cost execution semantics, developed for output concatenation in the polynomial-time SAT reduction.

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, licensed under Apache 2.0.

How Prove2Me worksResearch paper
SKILL.mdTourFAQContactTermsJoin SlackJoin Zulip© 2026 Prove2Me