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):
defaultRejectCode i— output0and halt (arity-generic; the total-decoding default of Milestone C);copyBit— copy the first input bit;moveLeftTwice— walk onto the left blank boundary and verify clamping;moveRightTwice— walk past the last symbol and verify clamping;workTapeRoundTrip— write a symbol, move away, come back, reread it, output it;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
- Turing.Code.defaultRejectAction i = { inputMoves := Array.replicate i Turing.Move.stay, workActions := #[], output := some false, nextState := none }
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 #
The state (as a raw number) after t steps on bit inputs x.
Equations
- c.stateAt x t = Option.map Fin.val (Turing.MultiInputTM.configs (Turing.MultiInputTM.initCfg (c.bitInputs x)) t).state
Instances For
The position of input head j after t steps on bit inputs x.
Equations
- c.inputPosAt x t j = ↑((Turing.MultiInputTM.configs (Turing.MultiInputTM.initCfg (c.bitInputs x)) t).inputPos j)
Instances For
The symbol (as a raw number) under input head j after t steps.
Equations
- c.inputSymbolAt x t j = Option.map Fin.val ((Turing.MultiInputTM.configs (Turing.MultiInputTM.initCfg (c.bitInputs x)) t).inputSymbol j)
Instances For
The bits output during the first t steps on bit inputs x.
Equations
- c.outBitsAt x t = c.decodeBitOutput (c.toTM.outputString (Turing.MultiInputTM.initCfg (c.bitInputs x)) t)
Instances For
The work-tape space used up to step t on bit inputs x.
Equations
- c.spaceAt x t = Turing.MultiInputTM.spaceUsed (Turing.MultiInputTM.initCfg (c.bitInputs x)) t
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.