Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Concrete Cook-machine witnesses compose in polynomial time

Proved
CookPvsNP.tm_compose_poly_witness

by Sneed · Sep 30, 2026 · Mathlib 0df444a (Lean v4.33.1)

complexity-theorycompositionpolynomial-timeturing-machines

Given concrete one-tape Cook machines witnessing polynomial-time computability of f and g, with possibly different finite work alphabets and explicit exponents, there is a single finite-alphabet Cook machine and a single exponent computing g after f. This isolates the machine-simulation and alphabet-merging content from the outer existential packaging of PolyTimeComputable.

Preamble
import Mathlib
import Definitions.Def_CookPvsNP_defs
import Theorems.Thm_CookPvsNP_tm_output_length_le
import Theorems.Thm_CookPvsNP_nat_pow_add_le_pow_add

set_option autoImplicit false
Formal statement
namespace CookPvsNP

theorem tm_compose_poly_witness
    {Sym₁ Sym₂ Sym₃ Γ₁ Γ₂ : Type}
    [Fintype Γ₁] [Fintype Γ₂]
    (ι₁ : Sym₁ ↪ Γ₁) (ι₂₁ : Sym₂ ↪ Γ₁) (M₁ : TM Γ₁) (k₁ : ℕ)
    (ι₂₂ : Sym₂ ↪ Γ₂) (ι₃ : Sym₃ ↪ Γ₂) (M₂ : TM Γ₂) (k₂ : ℕ)
    (f : List Sym₁ → List Sym₂) (g : List Sym₂ → List Sym₃)
    (h₁ : ∀ x : List Sym₁,
      M₁.HaltsWithin (x.length ^ k₁ + k₁) (x.map ι₁) ∧
      M₁.output (M₁.run (x.length ^ k₁ + k₁) (M₁.init (x.map ι₁))) =
        (f x).map (some ∘ ι₂₁))
    (h₂ : ∀ y : List Sym₂,
      M₂.HaltsWithin (y.length ^ k₂ + k₂) (y.map ι₂₂) ∧
      M₂.output (M₂.run (y.length ^ k₂ + k₂) (M₂.init (y.map ι₂₂))) =
        (g y).map (some ∘ ι₃)) :
    ∃ (Γ : Type) (_ : Fintype Γ) (j₁ : Sym₁ ↪ Γ) (j₃ : Sym₃ ↪ Γ)
      (M : TM Γ) (k : ℕ),
      ∀ x : List Sym₁,
        M.HaltsWithin (x.length ^ k + k) (x.map j₁) ∧
        M.output (M.run (x.length ^ k + k) (M.init (x.map j₁))) =
          (g (f x)).map (some ∘ j₃) := by sorry

end CookPvsNP
Source
Cook, The P versus NP problem, Clay Mathematics Institute (2000), Definition 3; standard closure of polynomial-time transducers under sequential composition.

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