Documentation

CslibFrontier.Computability.Machines.Turing.MultiTape.StateCode

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 #

Main results #

noncomputable def Turing.stateCode {State : Type u_1} [Fintype State] (q : Option State) :

The code of a control state: its position in a fixed enumeration of Option State, with a distinct code for the halting tag none.

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.

theorem Turing.stateCode_lt {State : Type u_1} [Fintype State] (q : Option State) :

The code of a control state is below the number of control states.

Distinct control states have distinct codes.

@[simp]
theorem Turing.stateOfCode_stateCode {State : Type u_1} [Fintype State] (q : Option State) :

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.