Basic definitions for Turing Machines (TMs) #
The transition labels used by a single-tape Turing Machine.
- read
{Symbol : Type u_1}
(x : Symbol)
: TrLabel Symbol
Read
xfrom the tape. - write
{Symbol : Type u_1}
(x : Symbol)
: TrLabel Symbol
Write
xon the tape. - move
{Symbol : Type u_1}
(d : Turing.Dir)
: TrLabel Symbol
Move the head of the tape.
- skip
{Symbol : Type u_1}
: TrLabel Symbol
Do nothing.
Instances For
def
Cslib.Computability.Turing.SingleTape.TrLabel.applyToTape
{Symbol : Type u_1}
[DecidableEq Symbol]
(otape : Option (Turing.BiTape Symbol))
(μ : TrLabel Symbol)
:
Option (Turing.BiTape Symbol)
Applies a transition label to a tape, returning none if it is not possible.
The input is taken as an Option to make the function composable.
Equations
- Cslib.Computability.Turing.SingleTape.TrLabel.applyToTape (some tape) (Cslib.Computability.Turing.SingleTape.TrLabel.read x) = if some x = tape.head then some tape else none
- Cslib.Computability.Turing.SingleTape.TrLabel.applyToTape (some tape) (Cslib.Computability.Turing.SingleTape.TrLabel.write x) = some (tape.write (some x))
- Cslib.Computability.Turing.SingleTape.TrLabel.applyToTape (some tape) (Cslib.Computability.Turing.SingleTape.TrLabel.move d) = some (tape.move d)
- Cslib.Computability.Turing.SingleTape.TrLabel.applyToTape (some tape) Cslib.Computability.Turing.SingleTape.TrLabel.skip = some tape
- Cslib.Computability.Turing.SingleTape.TrLabel.applyToTape otape μ = none
Instances For
theorem
Cslib.Computability.Turing.SingleTape.TrLabel.applyToTape_isSome
{Symbol : Type u_1}
[DecidableEq Symbol]
{μ : TrLabel Symbol}
{ot : Option (Turing.BiTape Symbol)}
(h : (applyToTape ot μ).isSome = true)
:
theorem
Cslib.Computability.Turing.SingleTape.TrLabel.applyToTape_foldl_isSome
{Symbol : Type u_1}
[DecidableEq Symbol]
{μs : List (TrLabel Symbol)}
{ot : Option (Turing.BiTape Symbol)}
(h : (List.foldl applyToTape ot μs).isSome = true)
:
structure
Cslib.Computability.Turing.SingleTape.Cfg
(State : Type u_1)
(Symbol : Type u_2)
:
Type (max u_1 u_2)
Configuration of a single-tape Turing machine.
- state : State
The state that the machine is in.
- tape : Turing.BiTape Symbol
Tape of the machine (memory).
Instances For
def
Cslib.Computability.Turing.SingleTape.Cfg.mk₁
{State : Type u_1}
{Symbol : Type u_2}
(s : State)
(xs : List Symbol)
:
Cfg State Symbol
Helper builder for a configuration with a given tape content.
Equations
- Cslib.Computability.Turing.SingleTape.Cfg.mk₁ s xs = { state := s, tape := Cslib.Turing.BiTape.mk₁ xs }