Documentation

MIPRE.TM.Code.Encoding.Total

Total decoding, description size, and the Milestone C test battery #

Turing.decodeCode interprets every bit string as a machine: malformed descriptions (and non-canonical ones — anything decodeCodeExact rejects) decode to the default reject machine Code.defaultRejectCode i, giving the paper's total notation [α]_i.

Turing.codeSize is the description length |α|; codeSize_le bounds it explicitly in the header data — the arithmetic later consumed by λ-boundedness bookkeeping.

The examples at the end are the Milestone C acceptance battery (planning/tm-infrastructure.md, WP9), all kernel-evaluated by decide: encode/decode round trips for the Milestone B machines, and one malformed description per failure mode — zero states, alphabet of size one, wrong table length, out-of-range successor state, out-of-range work symbol, trailing garbage, and the empty string — each pinned to decodeCodeExact = none and decodeCode = defaultRejectCode.

Total decoding #

def Turing.decodeCode (i : ℕ) (s : List Bool) :

Total decoding: the machine described by an arbitrary bit string — the paper's [α]_i. Strings rejected by decodeCodeExact denote the default reject machine.

Equations
Instances For
    @[simp]

    Description size #

    def Turing.codeSize {i : ℕ} (c : Code i) :

    The description size |α| of a machine code.

    Equations
    Instances For
      theorem Turing.encodeListWith_length_le {α : Type u_1} {enc : α → List Bool} {B : ℕ} {l : List α} :
      (∀ a ∈ l, (enc a).length ≤ B) → (encodeListWith enc l).length ≤ l.length * B

      Elementwise length bound for concatenated encodings.

      Length bound for one well-formed table entry.

      Explicit size bound: header plus table-count times the per-entry bound. This is the |α| arithmetic that λ-boundedness bookkeeping consumes.

      Round trips (Milestone B machines) #

      The malformed battery #

      One raw description per failure mode; each must be rejected by decodeCodeExact and decode totally to the default reject machine.

      A syntactically plausible one-input entry.

      Equations
      Instances For

        Zero states (the empty table has the canonical size 0 · 3¹, so this parses and is rejected by the checker alone).

        Equations
        Instances For

          Alphabet of size one (table of the canonical size 1 · 2¹).

          Equations
          Instances For

            Wrong table length: the header demands 1 · 3¹ = 3 entries, only two are present, so parsing itself fails.

            Equations
            Instances For

              Out-of-range successor state.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For

                Out-of-range work symbol (one work tape, so 1 · 3² = 9 entries).

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For

                  Display demos #