Documentation

CslibFrontier.Computability.Machines.Turing.MultiTape.Counting.Binary

Fixed-width binary certificates for labelled branches #

Each occurrence index occupies one fixed-width binary block. The width is fixed by the machine, not by its input. Distinct indices remain distinct even when their actions or successors agree.

Main definitions #

Main results #

References #

The binary representation is the existing Cslib.BitString.binaryWord; its module records the original formalization credit. The occurrence and padding semantics are MultiTape.Counting and MultiTape.Counting.Certificate.

Encode each occurrence index as one fixed-width block, in chronological order.

def Turing.MultiTapeCTM.binaryIndices (count width : ℕ) (word : List Bool) :

Decode a specified number of fixed-width blocks using the existing bit-string row view.

@[simp]
theorem Turing.MultiTapeCTM.length_binaryIndices (count width : ℕ) (word : List Bool) :
(binaryIndices count width word).length = count
theorem Turing.MultiTapeCTM.length_binaryCertificate {width : ℕ} {indices : List ℕ} (h : ∀ index ∈ indices, index < 2 ^ width) :
(binaryCertificate width indices).length = indices.length * width

Bounded indices each contribute exactly one full block.

theorem Turing.MultiTapeCTM.binaryIndices_binaryCertificate {width : ℕ} {indices : List ℕ} (h : ∀ index ∈ indices, index < 2 ^ width) :
binaryIndices indices.length width (binaryCertificate width indices) = indices

Encoding followed by block decoding preserves every bounded occurrence index.

theorem Turing.MultiTapeCTM.binaryCertificate_binaryIndices {count width : ℕ} {word : List Bool} (h : word.length = count * width) :
binaryCertificate width (binaryIndices count width word) = word

Decoding and re-encoding a full-width word preserves all bits, including leading zeros.

theorem Turing.MultiTapeCTM.runBranch_indices_lt {k : ℕ} {Symbol : Type u_1} {State : Type u_2} {input : List Symbol} (machine : MultiTapeCTM k Symbol State) {bound : ℕ} (hbound : ∀ (cfg : Cfg k Symbol State input), (machine.actions cfg).length ≤ bound) {cfg final : Cfg k Symbol State input} {choices : List ℕ} (hrun : machine.runBranch cfg choices = some final) (index : ℕ) :
index ∈ choices → index < bound

Every used index is below the occurrence-list bound, without identifying equal successors.

theorem Turing.MultiTapeCTM.decodeCertificate_indices_lt {k : ℕ} {Symbol : Type u_1} {State : Type u_2} {input : List Symbol} (machine : MultiTapeCTM k Symbol State) {bound : ℕ} (hpos : 0 < bound) (hbound : ∀ (cfg : Cfg k Symbol State input), (machine.actions cfg).length ≤ bound) {cfg final : Cfg k Symbol State input} {word choices : List ℕ} (hdecode : machine.decodeCertificate cfg word = some (choices, final)) (index : ℕ) :
index ∈ word → index < bound

The same positive bound covers actual indices and the forced zero padding after halting.

theorem Turing.MultiTapeCTM.card_binaryCertificateAccepts {k : ℕ} {Symbol : Type u_1} {State : Type u_2} {input : List Symbol} (machine : MultiTapeCTM k Symbol State) {width : ℕ} (cfg : Cfg k Symbol State input) (hbound : ∀ (cfg : Cfg k Symbol State input), (machine.actions cfg).length ≤ 2 ^ width) (count : ℕ) (verdict : List Symbol → Bool) :
{word : Cslib.BitString (count * width) | machine.certificateAccepts verdict cfg (binaryIndices count width (List.ofFn word)) = true}.card = machine.branchCount verdict count cfg

Fixed-width binary words count the canonical occurrence certificates exactly, for any terminal verdict. This is the common counting bijection for executable certificate checkers and native binary-choice replay machines. The proof is extracted from Checker.acceptCount_checkBinary by Samuel Schlesinger.

theorem Turing.MultiTapeCTM.exists_branchWidth {k : ℕ} {Symbol : Type u_1} {State : Type u_2} [Finite State] [Finite Symbol] (machine : MultiTapeCTM k Symbol State) :
∃ (width : ℕ), 0 < width ∧ ∀ (input : List Symbol) (cfg : Cfg k Symbol State input), (machine.actions cfg).length ≤ 2 ^ width

A finite-control machine over a finite alphabet has one positive block width whose 2 ^ width codes cover every transition list, as card_binaryCertificateAccepts requires.