Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Turing Machines

Robin Whitty

London South Bank University

Touring Turing, Rewley House, July 2012

Robin Whitty Turing Machines


Turing Machine Architecture
Unlimited tape plus tape reader/writer plus state table

equivalent to:

automaton plus 2 stacks

Robin Whitty Turing Machines


State tables

Rules for read/writehead = state table

Rule format:
<current state>, <symbol read>, <symbol written>, <head movement>, <new state>

Robin Whitty Turing Machines


Example 1
A machine for doubling a number (written in binary) with the tape
head starting and ending at the most significant digit:

State 0: Reading through the binary digits from left to right


State 1: Reading through the binary digits from right to left
State H: Halt
Robin Whitty Turing Machines
Example 2
A machine for checking the remainder of a number (in binary) on
division by 2 and halting with the tape head reading the remainder:

State 0: Reading first digit


State 1: Scanning zeros
State 0: Scanning ones
State H: Halt (∗ means no head movement)

Robin Whitty Turing Machines


Example 3

A machine for checking the remainder of a number (in binary) on


division by 3 and halting with the tape head reading the remainder.
Recall the automaton that checked for divisibility by 3:

This becomes the state table of our Turing machine (with modifications):

This time the states are


not easy to name!
Exercise: see if you can
think of suggestive names.

Robin Whitty Turing Machines


Example 3 continued
Recall the annotation of the finite automaton which found the value
of the number (but was not part of the actual machine):

We incorporate the annotation instructions into our remainder


machine:

Robin Whitty Turing Machines


Turing machine simulators

There are many web-based simulators in which you can try out your
designs:

morphett.info/turing/turing.html

Robin Whitty Turing Machines


The Busy Beaver
Suppose we are given a positive integer n. Let us look for a Turing
machine which
1. has exactly n states plus a Halt state;
2. reads and writes just blanks and 1’s on its tape;
3. starts with a tape in which every cell is blank.
Among the possible machines, chose a machine which halts but which
takes the greatest number of steps before halting. This is called an
n-state busy beaver.

A 4-state busy beaver. It halts in 107 steps


Robin Whitty Turing Machines
The Busy Beaver Function
Define the function S(n) to be the number of steps taken by an
n-state busy beaver.
The function S(n) is noncomputable.
Proof. Suppose we can compute S(n) for every positive integer n.
Let M be any Turing machine with n states. We will test if it halts:
run M for S(n) steps; if M has halted then answer ‘Yes’; if M has
not yet halted then it never can since S(n) is the greatest number
of steps an n-state Turing machine can take. So output ‘No’. So
the halting problem is solved, which is impossible. We conclude
that S(n) is noncomputable.
In fact the sequence S(1), S(2), S(3), . . . grows faster than any
computable sequence! Because if S(n) never exceeds some
computable sequence T (n), say, then we can replace S with T in the
above proof.
So sooner or later S(n), n = 1, 2, 3, . . . overtakes the sequence
10
10, 1010 , 1010 , . . ., or any monster sequence you can construct!
Robin Whitty Turing Machines

You might also like