Deciding whether a record is accepting #
⚠️ Unreviewed by Bolton
A record is accepting when its state field is the halting state and its output
tape holds 1 in cell 1. The state field is block 0 truncated to the state
code's width, and the verdict cell is read after the rewind of
Complexitylib.Classes.Containments.Internal.CodeRewind.
Main definitions #
Complexity.verdictSym— the symbol in cell1of a rewound output codeComplexity.acceptFlag— the accepting-record test
Main results #
Complexity.verdictSym_rewound— what the verdict cell readsComplexity.acceptFlag_cfgCode— the test decides acceptanceComplexity.acceptFlagFn_mem_FP— the test is polynomial-time
The verdict cell #
theorem
Complexity.verdictSym_rewound
(W : ℕ)
(t : Tape)
(hW : 1 ≤ W)
:
verdictSym (Cobham.blockRuler W) (Cobham.pairCode W { head := 0, cells := t.cells }) = Cobham.symCode (t.cells 1)
The verdict cell of a rewound output code is cell 1 of the tape.
The test #
theorem
Complexity.acceptFlag_cfgCode
{k : ℕ}
(tm : NTM k)
(W : ℕ)
(c : Cfg k tm.Q)
(hq : Fintype.card tm.Q ≤ Cobham.blockWidth W)
(hinv : CodeInv W c)
(hW : 1 ≤ W)
(ruler : List Bool)
(hruler : W ≤ ruler.length)
:
acceptFlag (Cobham.stateCode tm.qhalt) (Cobham.blockRuler W) ruler (Cobham.cfgCode W c) = [true] ↔ c.state = tm.qhalt ∧ c.output.cells 1 = Γ.one
The test decides acceptance.