Cook–Levin machines: bounded input scan and initialization clauses
ProvedCookLevin.machine_emit_input_cells_from_countercomplexitycook-levinloopsturing-machines
Consume unary width fuel to emit all unit clauses for a bounded input prefix in the original order. Preserve input contents and append the exact encoded literals; bound runtime by n times an affine function of the final cell counter.
Preamble
import Definitions.Def_CookLevin_Tableau import Definitions.Def_CookLevin_Complexity open CookLevin set_option autoImplicit false
Formal statement
theorem CookLevin.machine_emit_input_cells_from_counter {k G : Nat} (hk : 4 ≤ k) (hG : 4 ≤ G)
(alphabet : Nat) :
∃ R : Machine, ∃ A B : Nat, TuringMachine k G R ∧
∀ (sh : Shape) (j n : Nat) (input fuel : Nat → Symbol)
(bits : List Bool) (saved : List Tape),
sh.G = alphabet → saved.length + 4 = k →
(∀ p, p < n → input p < 4) →
(∀ p, p < n → fuel (1 + p) = oneSymbol) → fuel (1 + n) ≠ oneSymbol →
let a₀ := literalN (.Pos (sh.cellVar 0 j 0 0))
let aₙ := literalN (.Pos (sh.cellVar 0 j n 0))
let chunk := (List.range n).flatMap fun p =>
true :: encodeListNat [literalN (.Pos (sh.cellVar 0 j p (input p)))]
Transforms R
((input, 0) :: (contents (boolsToSymbols (List.replicate a₀ true)), 1 + a₀) ::
(contents (boolsToSymbols bits), 1 + bits.length) :: (fuel, 1) :: saved)
(n * (A * aₙ + B + 3) + 1)
((input, n) :: (contents (boolsToSymbols (List.replicate aₙ true)), 1 + aₙ) ::
(contents (boolsToSymbols (bits ++ chunk)), 1 + (bits ++ chunk).length) ::
(fuel, 1 + n) :: saved) := by sorrySource
Input-dependent initialization for the Cook–Levin reduction.