Skip to content

12. Turing Machines

Feb 15, 2022

  • Deterministic machine with infinite tape, read-write head, head moves to left or right

  • Behavior at each time step: ab,R

    • reads a symbol (a)
    • writes a symbol (b)
    • moves left or right {L,R}
  • Σ is the input alphabet, Γ is the tape alphabet

    • special blank symbol (e.g. ⎵) where Σ and Γ

Example

Time 0     ...| ⎵ | a | b | a | c | ⎵ | ⎵ | ...     reads a, writes k, moves left
                             H

Time 1     ...| ⎵ | a | b | k | c | ⎵ | ⎵ | ...     reads b, writes f, moves right
                         H

Time 2     ...| ⎵ | a | f | k | c | ⎵ | ⎵ | ...     
                             H
  • head starts at the leftmost position of the input string

  • read and write can operate on the same symbol, to not change the tape

  • no ϵ-transitions => if there is no allowed transition in a state the machine halts

  • accepting states have no outgoing transitions => the machine immediately accepts and halts

    • in order to accept, it is not necessary to process all input
    • accepting necessitates halting
  • rejecting can happen if:

    • machine halts in a non-accepting state
    • machine enters an infinite loop

Example

Σ={a,b} accepts the language a

  • Scans all symbols a, and once it reaches a blank symbol moves to accepting state and halts.
  • If ever b is encountered, the machine halts and rejects.

Special case: Σ={a} accepts the language a

  • it is not necessary to scan any input, machine always accepts


If machine enters an infinite loop:

  • accepting state cannot be reached
  • machine never halts
  • the input is rejected

Formal definition

  • (these definitions may vary slightly and machines are usually not defined in formally and in detail)
  • M=(Q,Σ,Γ,δ,q0,,F) where

    • Q is a set of states
    • Σ is input alphabet
    • δ is transition function :   δ(q1,a)=(q2,b,R)   δ(q1,c)=(q2,d,L)
    • q0 is start state
    • is blank tape symbol
    • F is accept states
  • The accepted language, for any Turing machine M: L(M)={w:q0wx1qfx2}

    • if language L is accepted by Turing machine M then L is Turing-recognizable
    • alternative terms: Turing-acceptable, recursively enumerable

Configuration

  • configuration describes the machine state at time step
 ... | a | a | a | b | b | b | ... 
                   H 
  • we can describe configuration as: aaaqbbb where

    • aaa is the tape content to the left of the head
    • q is the current state (qi) and position of the head wrt the tape
    • bbb is the tape content to the right of the head
  • a move:   q2xaybxq0ayb

  • a computation is a sequence:   q2xaybxq0aybxxq1ybxxyq1b
    • equivalent notation:   q2xaybxxyq1b