Documentation

MIPRE.TM.Code.Examples

Executable test machines #

The Milestone B acceptance tests (planning/tm-infrastructure.md): concrete machine codes whose runs are evaluated inside the kernel — every example … := by decide below both pins the expected behaviour as a regression test and certifies that the whole evaluation path (Code.toTM, Code.actionAt, Turing.transitionIndex, MultiInputTM.step/configs/outputString) is genuinely executable, with no Fintype.elems, choice, or noncomputable anywhere in it (decision D5). No native_decide is used.

Machines (all at arity one, alphabet size two):

  1. defaultRejectCode i — output 0 and halt (arity-generic; the total-decoding default of Milestone C);
  2. copyBit — copy the first input bit;
  3. moveLeftTwice — walk onto the left blank boundary and verify clamping;
  4. moveRightTwice — walk past the last symbol and verify clamping;
  5. workTapeRoundTrip — write a symbol, move away, come back, reread it, output it;
  6. loopForever — a two-state machine that never halts.

The probe helpers project decidable data (states, head positions, output bits, tape windows) out of configurations, whose tape fields are functions and therefore not themselves comparable.

The default reject machine #

The action of the default reject machine: touch nothing, output 0, halt.

Equations
Instances For

    The default reject machine: two symbols, one state, no work tapes; on its first transition it outputs 0 (i.e. false) and halts, regardless of the observation. This is the total interpretation of malformed descriptions in Milestone C.

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

      Probe helpers #

      def Turing.Code.stateAt {i : } (c : Code i) (x : Fin iList Bool) (t : ) :

      The state (as a raw number) after t steps on bit inputs x.

      Equations
      Instances For
        def Turing.Code.inputPosAt {i : } (c : Code i) (x : Fin iList Bool) (t : ) (j : Fin i) :

        The position of input head j after t steps on bit inputs x.

        Equations
        Instances For
          def Turing.Code.inputSymbolAt {i : } (c : Code i) (x : Fin iList Bool) (t : ) (j : Fin i) :

          The symbol (as a raw number) under input head j after t steps.

          Equations
          Instances For
            def Turing.Code.workWindow {i : } (c : Code i) (x : Fin iList Bool) (t : ) (d : Fin c.workTapeCount) (lo : ) (len : ) :

            A window of len cells of work tape d, starting at position lo, after t steps.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              def Turing.Code.outBitsAt {i : } (c : Code i) (x : Fin iList Bool) (t : ) :

              The bits output during the first t steps on bit inputs x.

              Equations
              Instances For
                def Turing.Code.spaceAt {i : } (c : Code i) (x : Fin iList Bool) (t : ) :

                The work-tape space used up to step t on bit inputs x.

                Equations
                Instances For

                  1: output 0 and halt #

                  2: copy the first input bit #

                  Copy the first input bit: one state; on reading a symbol output it and halt, on reading the blank boundary output 0 and halt.

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

                    3: move left onto the blank boundary #

                    Move the input head left twice (the second move is clamped at the left boundary), then halt.

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

                      4: move right past the final symbol #

                      Move the input head right twice (the second move is clamped at the right boundary), then halt.

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

                        5: write, move, return, and reread a work-tape symbol #

                        Write symbol 1 on the work tape, move the work head right, move it back left, reread the written symbol, output it as a bit, and halt. Observation digits are inputDigit * 3 + workDigit; in state 2 the entries with work digit 2 (symbol 1 under the work head) output true.

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

                          6: a two-state machine that never halts #

                          Bounce between two states forever, never halting.

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

                            Display demos (#eval doubles as an executability check) #