Codes of finite control states #
The control of a machine is a state q : Option State, with none once the machine has halted.
Its code Turing.stateCode q is its position in the fixed enumeration
Fintype.equivFin (Option State), so the codes are exactly the numbers below
Fintype.card (Option State), and the halting tag has a code of its own. Turing.stateOfCode
inverts the code on that range; a client decoding arbitrary numbers chooses its own value outside
it.
Main definitions #
Turing.stateCode: the code of a control state.Turing.stateOfCode: the control state with a code in range.
Main results #
Turing.stateCode_lt: codes are belowFintype.card (Option State).Turing.stateOfCode_stateCode,Turing.stateCode_stateOfCode: the two maps are inverse.
noncomputable def Turing.stateOfCode {State : Type u_1} [Fintype State] (m : ℕ) (h : m < Fintype.card (Option State)) :
Option State
The control state with a code in range: the inverse of stateCode.
The code of a control state is below the number of control states.
Distinct control states have distinct codes.
@[simp]
Decoding the code of a control state gives the state.
@[simp]
theorem Turing.stateCode_stateOfCode {State : Type u_1} [Fintype State] (m : ℕ) (h : m < Fintype.card (Option State)) :
The code of the control state with a code in range is that code.