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 #
- The alphabet of a coded machine is
Fin alphabetSizewithalphabetSize ≥ 2(enforced by well-formedness). Symbols0and1are reserved for binary input and output; symbols≥ 2may be used freely on the work tapes. - A transition's
outputfield is anOption Bool, not an optional symbol: coded machines emit bits, so decoding their output is total, while the internal alphabet may be larger. - States are
Fin stateCount;nextState = nonehalts the machine.
Equations
- Turing.instReprMove.repr Turing.Move.left prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "Turing.Move.left")).group prec✝
- Turing.instReprMove.repr Turing.Move.stay prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "Turing.Move.stay")).group prec✝
- Turing.instReprMove.repr Turing.Move.right prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "Turing.Move.right")).group prec✝
Instances For
Equations
- Turing.instReprMove = { reprPrec := Turing.instReprMove.repr }
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).
- keep : RawWrite
Leave the cell unchanged.
- blank : RawWrite
Write the blank symbol.
- symbol
(a : ℕ)
: RawWrite
Write the alphabet symbol
a.
Instances For
Equations
- Turing.instDecidableEqRawWrite.decEq Turing.RawWrite.keep Turing.RawWrite.keep = isTrue ⋯
- Turing.instDecidableEqRawWrite.decEq Turing.RawWrite.keep Turing.RawWrite.blank = isFalse Turing.instDecidableEqRawWrite.decEq._proof_1
- Turing.instDecidableEqRawWrite.decEq Turing.RawWrite.keep (Turing.RawWrite.symbol a) = isFalse ⋯
- Turing.instDecidableEqRawWrite.decEq Turing.RawWrite.blank Turing.RawWrite.keep = isFalse Turing.instDecidableEqRawWrite.decEq._proof_3
- Turing.instDecidableEqRawWrite.decEq Turing.RawWrite.blank Turing.RawWrite.blank = isTrue ⋯
- Turing.instDecidableEqRawWrite.decEq Turing.RawWrite.blank (Turing.RawWrite.symbol a) = isFalse ⋯
- Turing.instDecidableEqRawWrite.decEq (Turing.RawWrite.symbol a) Turing.RawWrite.keep = isFalse ⋯
- Turing.instDecidableEqRawWrite.decEq (Turing.RawWrite.symbol a) Turing.RawWrite.blank = isFalse ⋯
- Turing.instDecidableEqRawWrite.decEq (Turing.RawWrite.symbol a) (Turing.RawWrite.symbol b) = if h : a = b then h ▸ isTrue ⋯ else isFalse ⋯
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Turing.instReprRawWrite.repr Turing.RawWrite.keep prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "Turing.RawWrite.keep")).group prec✝
- Turing.instReprRawWrite.repr Turing.RawWrite.blank prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "Turing.RawWrite.blank")).group prec✝
Instances For
Equations
- Turing.instReprRawWrite = { reprPrec := Turing.instReprRawWrite.repr }
The action of a coded machine on one work tape: what to write, and how to move.
Instances For
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Turing.instReprRawWorkAction = { reprPrec := Turing.instReprRawWorkAction.repr }
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).
The movement of each input head, in ascending tape order.
- workActions : Array RawWorkAction
The action on each work tape, in ascending tape order.
The optionally emitted output bit.
The successor state, or
noneto halt.
Instances For
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
Equations
- Turing.instReprRawAction = { reprPrec := Turing.instReprRawAction.repr }
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; symbols0/1are 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 bsis the action taken on observation(q, as, bs). Well-formedness requires sizestateCount * (alphabetSize + 1) ^ (i + workTapeCount).
Instances For
Equations
- Turing.instReprRawCode = { reprPrec := Turing.instReprRawCode.repr }
Equations
- One or more equations did not get rendered due to their size.