Cook–Levin machines: guarded next-state transition clause
ProvedCookLevin.machine_emit_transition_state_literal_blockcomplexitycook-levinloopsturing-machines
Compile the guarded next-state clause from state and read-base unary counters and fixed machine command data. Five counters are preserved. The output is the exact encoded clause without its final formula terminator.
Preamble
import Definitions.Def_CookLevin_Reduction import Definitions.Def_CookLevin_Complexity open CookLevin set_option autoImplicit false
Formal statement
theorem CookLevin.machine_emit_transition_state_literal_block {k G : Nat} (hk : 7 ≤ k) (hG : 4 ≤ G)
(tapes symbols states q next : Nat) (rs : List Symbol) :
∃ R : Machine, ∃ A B : Nat, TuringMachine k G R ∧
∀ (sh : Shape) (t c d e : Nat) (input : Tape) (bits : List Bool) (saved : List Tape),
sh.k = tapes → sh.G = symbols → sh.Q = states → saved.length + 7 = k →
let a := literalN (.Neg (sh.stateVar t 0))
let b := literalN (.Neg (sh.readVar t 0 0))
let chunk := (encodeFormula
[guardClause sh t q rs ++ [Literal.Pos (sh.stateVar (t + 1) next)]]).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 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 ++ chunk)), 1 + (bits ++ chunk).length) :: saved) := by sorrySource
Input-dependent initialization for the Cook–Levin reduction.