Documentation

CslibFrontier.Computability.Machines.Turing.MultiTape.BlockComputation.Encoding.NativeDecode

Native decoding of runtime-width Boolean block labels #

The decoder checks the positive width and exact word length before reading the existing explicit layout. It reads only fixed control tags by a finite table. Every runtime residue is binary, and work windows are decoded by streaming pairs of actual input bits. A malformed short word never allocates cells according to an untrusted binary width.

Read a little-endian numeric field from an explicitly stored bit word.

Canonical replay codes distinguish blank, written zero and written one.

Decode adjacent bit pairs, discarding an unmatched final bit.

Decode the fixed finite control rank, treating unused ranks as halted.

First output-track bit in the full word, including the outer FAIL bit.

Decode fields without a width-dependent runtime type. Window slices are bounded by actual input storage, even when their declared binary width is malformed.

Reject zero width, malformed word length and the existing outer FAIL tag.

theorem Turing.MultiTapePTM.BlockComputation.Encoding.NativeDecode.parse_eq_some_iff {k s : ℕ} {Q : Type} (e : Q ≃ Fin s) (b : ℕ) (word : List Bool) (raw : QueryReplay.RawResult k Q) :
parse e (b, word) = some raw ↔ b ≠ 0 ∧ word.length = width k s b ∧ word.headD false = true ∧ raw = payload e b word

Successful parsing exposes the exact input shape and the decoded payload.

Decode actual pairs of input bits in linear space, with at most one cell per two bits.

Streaming bit pairs creates exactly one cell for every two input bits.

Every streamed cell is one of the three canonical replay codes.

theorem Turing.MultiTapePTM.BlockComputation.Encoding.NativeDecode.length_payload_cells_of_length {k s : ℕ} {Q : Type} (e : Q ≃ Fin s) (b : ℕ) (word : List Bool) (hlen : word.length = width k s b) (h : Fin k) :
((payload e b word).2.2.2 h).length = 3 * b

A correctly sized full label yields exactly three blocks of cells on every work tape, including unused bit words and labels whose outer tag is FAIL.

theorem Turing.MultiTapePTM.BlockComputation.Encoding.NativeDecode.length_payload_cells {k s : ℕ} {Q : Type} (e : Q ≃ Fin s) (b : ℕ) (bits : Cslib.BitString (width k s b)) (h : Fin k) :
((payload e b (List.ofFn bits)).2.2.2 h).length = 3 * b

The explicit fixed-width Boolean representation supplies canonical-sized replay windows.

Decode a finite control rank natively, including unused halted ranks for root classification.

@[reducible, inline]

Runtime width and an actual stored Boolean label.

Compute the output-summary offset without allocating the skipped head or window fields.

Uniform native parser. Zero width, malformed length and FAIL all return none.

theorem Turing.MultiTapePTM.BlockComputation.Encoding.NativeDecode.readNat_ofFn {n : ℕ} (bits : Cslib.BitString n) (offset count : ℕ) (h : offset + count ≤ n) :
readNat (List.ofFn bits) offset count = ↑((Cslib.BitString.equivFin count) fun (i : Fin count) => bits ⟨offset + ↑i, ⋯⟩)

Reading an in-range numeric field agrees with the existing finite bit-string numbering.

The untyped payload agrees field by field with the explicit semantic codec.

Native parsing realizes the existing explicit label decoder, including FAIL and unused control/cell/track words. Only the finite machine control is enumerated.