Cook–Levin machines: inertia position loop
ProvedCookLevin.machine_emit_inertia_position_loopcomplexitycook-levinloopsturing-machines
Emit the actual inertia clauses for n positions at fixed time and logical tape. All three unary counters advance to position n and the unary position fuel is restored to head one. Runtime is n*(A*(a n+b n+c n)+B+6)+4. Explicit marker, prefix and terminator assumptions; zero lengths and symbol bounds are allowed.
Preamble
import Definitions.Def_CookLevin_Tableau import Definitions.Def_CookLevin_Complexity open CookLevin set_option autoImplicit false
Formal statement
theorem CookLevin.machine_emit_inertia_position_loop {k G : Nat} (hk : 6 ≤ k)
(hG : 4 ≤ G) (symbols : Nat) :
∃ R : Machine, ∃ A B : Nat, TuringMachine k G R ∧
∀ (sh : Shape) (t j n : Nat) (input : Tape) (bits : List Bool)
(fuel : Nat → Symbol) (saved : List Tape),
sh.G = symbols → saved.length + 6 = k →
fuel 0 ≠ oneSymbol →
(∀ i, i < n → fuel (1 + i) = oneSymbol) →
fuel (1 + n) ≠ oneSymbol →
let a := fun p => literalN (.Pos (sh.headVar t j p))
let b := fun p => literalN (.Neg (sh.cellVar t j p blankSymbol))
let c := fun p => literalN (.Pos (sh.cellVar (t + 1) j p blankSymbol))
let chunk := (List.range n).flatMap fun p =>
(encodeFormula ((List.range sh.G).map fun s =>
[Literal.Pos (sh.headVar t j p), 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 0) true)), 1 + a 0) ::
(contents (boolsToSymbols (List.replicate (b 0) true)), 1 + b 0) ::
(contents (boolsToSymbols (List.replicate (c 0) true)), 1 + c 0) ::
(contents (boolsToSymbols bits), 1 + bits.length) :: (fuel, 1) :: saved)
(n * (A * (a n + b n + c n) + B + 6) + 4)
(input :: (contents (boolsToSymbols (List.replicate (a n) true)), 1 + a n) ::
(contents (boolsToSymbols (List.replicate (b n) true)), 1 + b n) ::
(contents (boolsToSymbols (List.replicate (c n) true)), 1 + c n) ::
(contents (boolsToSymbols (bits ++ chunk)), 1 + (bits ++ chunk).length) ::
(fuel, 1) :: saved) := by sorrySource
Compose the three-counter template compiler, fixed counter strides and reusable unary iteration with the actual inertia-clause encoding.