Cook–Levin machines: halt position body
ProvedCookLevin.machine_emit_halt_position_bodycomplexitycook-levinloopsturing-machines
Emit the halt head-persistence clause followed by every symbol cell-persistence clause at one position, then advance both head counters by eight and both cell counters by eight times the fixed symbol count. Preserve the halted-state counter and work tapes; bound time affinely in the five counters.
Preamble
import Definitions.Def_CookLevin_Tableau import Definitions.Def_CookLevin_Complexity open CookLevin set_option autoImplicit false
Formal statement
theorem CookLevin.machine_emit_halt_position_body {k G : Nat} (hk : 7 ≤ 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 + 7 = k →
let a := literalN (.Neg (sh.stateVar t sh.Q))
let b := literalN (.Neg (sh.headVar t j p))
let c := literalN (.Pos (sh.headVar (t + 1) j p))
let d := literalN (.Neg (sh.cellVar t j p blankSymbol))
let e := literalN (.Pos (sh.cellVar (t + 1) j p blankSymbol))
let chunk := (encodeFormula ([Literal.Neg (sh.stateVar t sh.Q), Literal.Neg (sh.headVar t j p),
Literal.Pos (sh.headVar (t + 1) j p)] :: (List.range sh.G).map fun s =>
[Literal.Neg (sh.stateVar t sh.Q), Literal.Neg (sh.cellVar t j p s),
Literal.Pos (sh.cellVar (t + 1) j p 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 (List.replicate d true)), 1 + d) ::
(contents (boolsToSymbols (List.replicate e true)), 1 + e) ::
(contents (boolsToSymbols bits), 1 + bits.length) :: saved) (A * (a + b + c + d + e) + B)
(input :: (contents (boolsToSymbols (List.replicate a true)), 1 + a) ::
(contents (boolsToSymbols (List.replicate (b + 8) true)), 1 + (b + 8)) ::
(contents (boolsToSymbols (List.replicate (c + 8) true)), 1 + (c + 8)) ::
(contents (boolsToSymbols (List.replicate (d + 8 * symbols) true)), 1 + (d + 8 * symbols)) ::
(contents (boolsToSymbols (List.replicate (e + 8 * symbols) true)), 1 + (e + 8 * symbols)) ::
(contents (boolsToSymbols (bits ++ chunk)), 1 + (bits ++ chunk).length) :: saved) := by sorrySource
Compose the five-counter template compiler, fixed counter strides and reusable unary iteration with the actual halt-clause encoding.