Binary serialization of machine codes #
The normative description format (planning/tm-infrastructure.md, Milestone C):
encodeCode c = encodeNat 0 (version) · workTapeCount · alphabetSize · stateCount · startState · table entries in transitionIndex order
with every natural in the self-delimiting code of MIPRE.TM.Code.Encoding.Nat, and per
entry: the i input moves (stay = 0, right = 10, left = 11), the w work actions
(write keep = 0, blank = 10, symbol s = 11·encodeNat s, then the move), the output
(none = 0, some b = 1·b), and the successor (none = 0, some q = 1·encodeNat q).
The arity i is external, matching the paper's [α]_i.
decodeCodeExact parses, demands full consumption, and gates on the executable
well-formedness checker; the three theorems at the end are Milestone C's exact-codec
package: decodeCodeExact_encodeCode (round trip), encodeCode_injective, and
decodeCodeExact_sound (canonicality: every accepted string is the canonical encoding
of its parse). Every parser is paired with a prefix lemma and a soundness lemma, so
soundness composes field by field (decision D11); everything is structurally recursive
(decision D10).
Field codecs #
Encode a head movement: stay = 0, right = 10, left = 11.
Equations
Instances For
Parse a head movement.
Equations
Instances For
Encode a write action: keep = 0, blank = 10, symbol s = 11·encodeNat s.
Equations
Instances For
Parse a write action.
Equations
Instances For
Encode an optional successor state: none = 0, some q = 1·encodeNat q.
Equations
Instances For
Parse an optional successor state.
Equations
Instances For
Encode one work-tape action: the write, then the move.
Equations
Instances For
Parse one work-tape action.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Fixed-count sequences #
Concatenate elementwise encodings; the element count is protocol context (the parser is told how many to read), not part of the string.
Equations
- Turing.encodeListWith enc l = List.flatMap enc l
Instances For
Prefix property for fixed-count sequences; the elementwise prefix property is only required on the members of the encoded list.
Actions #
Encode one transition-table entry.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Machine codes #
The canonical binary description of a machine code — the paper's α.
Equations
Instances For
Exact decoding: parse, demand full consumption, and check well-formedness.
Equations
Instances For
Prefix property at the raw level (for well-formed codes, whose entries have the arities the parser expects).
Round trip: exact decoding inverts encoding.
Canonicality: every accepted description is exactly the canonical encoding of the code it parses to.
Canonical descriptions are unique.