Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Cook–Levin machines: emit the head-cell-read link block

Proved
CookLevin.machine_emit_link_literal_block

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

complexitycook-levinloopsturing-machines

For every fixed symbol bound there is a well-formed machine emitting the actual head/cell/read link clauses for every symbol at one tableau position. Three canonical unary counters supply the negative head literal, negative blank-cell literal and positive blank-read literal. All counters, input and saved work are preserved. The encoded block excludes the formula terminator; runtime is A*(a+b+c)+B. Zero symbol bounds are included.

Preamble
import Definitions.Def_CookLevin_Tableau
import Definitions.Def_CookLevin_Complexity
open CookLevin
set_option autoImplicit false
Formal statement
theorem CookLevin.machine_emit_link_literal_block {k G : Nat} (hk : 5 ≤ k) (hG : 4 ≤ G)
    (symbols : Nat) :
    ∃ R : Machine, ∃ A B : Nat, TuringMachine k G R ∧
      ∀ (sh : Shape) (t j p : Nat) (input : Tape) (bits : List Bool) (saved : List Tape),
        sh.G = symbols → saved.length + 5 = k →
        let a := literalN (.Neg (sh.headVar t j p))
        let b := literalN (.Neg (sh.cellVar t j p blankSymbol))
        let c := literalN (.Pos (sh.readVar t j blankSymbol))
        let chunk := (encodeFormula ((List.range sh.G).map fun s =>
          [Literal.Neg (sh.headVar t j p), Literal.Neg (sh.cellVar t j p s),
           Literal.Pos (sh.readVar t j s)])).dropLast
        Transforms R
          (input :: (contents (boolsToSymbols (List.replicate a true)), 1 + a) ::
            (contents (boolsToSymbols (List.replicate b true)), 1 + b) ::
            (contents (boolsToSymbols (List.replicate c true)), 1 + c) ::
            (contents (boolsToSymbols bits), 1 + bits.length) :: saved) (A * (a + b + c) + B)
          (input :: (contents (boolsToSymbols (List.replicate a true)), 1 + a) ::
            (contents (boolsToSymbols (List.replicate b true)), 1 + b) ::
            (contents (boolsToSymbols (List.replicate c true)), 1 + c) ::
            (contents (boolsToSymbols (bits ++ chunk)), 1 + (bits ++ chunk).length) :: saved) := by sorry
Source
Specialize the accepted three-counter template compiler and prove the exact arithmetic identities for the tableau literal encodings.

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, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me