Documentation

MIPRE.TM.Code.Raw

Raw syntax for coded multi-input Turing machines #

First-order, serializable machine descriptions: plain data with no embedded functions, no well-formedness requirements, and derivable decidable equality. A RawCode i describes a multi-input machine (MIPRE.TM.MultiInput.Deterministic) with i input tapes through a dense transition table: one RawAction per observation (state, input symbols, work symbols), stored in the canonical order fixed by Turing.transitionIndex (MIPRE.TM.Code.Observation).

Well-formedness is a separate predicate (MIPRE.TM.Code.WellFormed), and only well-formed codes are interpreted as machines (MIPRE.TM.Code.Semantics). This "machine code first" layering is what later makes descriptions serializable, measurable (|𝒟|) and usable for self-reference; see planning/tm-infrastructure.md (Milestone B).

Input/output conventions #

inductive Turing.Move :

A head movement of a coded machine.

  • left : Move

    Move the head one cell to the left.

  • stay : Move

    Do not move the head.

  • right : Move

    Move the head one cell to the right.

Instances For
    @[instance_reducible]
    Equations
    Equations
    Instances For
      @[instance_reducible]
      Equations

      What a coded machine writes on a work tape in one step: nothing (keep), the blank symbol (blank), or the alphabet symbol a (symbol a; well-formedness bounds a by the alphabet size).

      Instances For
        Equations
        Instances For

          The action of a coded machine on one work tape: what to write, and how to move.

          • write : RawWrite

            What to write on the cell under the head.

          • move : Move

            How to move the head.

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

                One entry of a transition table: the action taken on one observation. The arity and work-tape count are not parameters of this type — well-formedness constrains inputMoves.size and workActions.size (see planning/tm-infrastructure.md, decision D2).

                • inputMoves : Array Move

                  The movement of each input head, in ascending tape order.

                • workActions : Array RawWorkAction

                  The action on each work tape, in ascending tape order.

                • output : Option Bool

                  The optionally emitted output bit.

                • nextState : Option

                  The successor state, or none to halt.

                Instances For
                  def Turing.instDecidableEqRawAction.decEq (x✝ x✝¹ : RawAction) :
                  Decidable (x✝ = x✝¹)
                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      structure Turing.RawCode (i : ) :

                      A raw description of an i-input machine: header data and a dense transition table in the canonical observation order (Turing.transitionIndex). No well-formedness is imposed here; see RawCode.WellFormed.

                      • workTapeCount :

                        The number of work tapes.

                      • alphabetSize :

                        The alphabet size (well-formedness requires ≥ 2; symbols 0/1 are the I/O bits).

                      • stateCount :

                        The number of states.

                      • startState :

                        The initial state (well-formedness requires it to be < stateCount).

                      • The dense transition table: entry transitionIndex q as bs is the action taken on observation (q, as, bs). Well-formedness requires size stateCount * (alphabetSize + 1) ^ (i + workTapeCount).

                      Instances For
                        def Turing.instDecidableEqRawCode.decEq {i✝ : } (x✝ x✝¹ : RawCode i✝) :
                        Decidable (x✝ = x✝¹)
                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          @[instance_reducible]
                          instance Turing.instReprRawCode {i✝ : } :
                          Repr (RawCode i✝)
                          Equations
                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For