Theory Lecture 12: Turing Machines
In this video
Turing Machines
Universal Machines
Entscheidungsproblem
Is there a definite method or process by which all mathematical questions can be decided? - David
Hilbert
The Turing Machine is Turing’s (negative) answer to the Entscheidungsproblem.
• A conceptual idea.
• A theoretical machine that can carry out any algorithm.
• A model of what is computable.
Turing Machines
A Turing Machine consists of:
• A tape, split up into an infinite number of cells
• An alphabet of symbols
• A read/write head that moves along the tape
• A state register, to store the state
• A start state, where the program starts
• A halting state, where the program stops
• A transition function – instructions for the TM
Suppose we have an alphabet of 0, 1 and □ (blank).
• The transition function is given in the instruction table:
There is an alternative notation:
δ(State,Input) = (Next, Output, Movement)
For the previous example, we have:
- δ (S0,□) = (SH, 1, R)
- δ (S0,0) = (S0, 0, R)
- δ (S0,1) = (S1, 1, R)
- δ (S1,□) = (SH, 0, R)
- δ (S1,0) = (S1, 0, R)
- δ (S1,1) = (S0, 1, R)
Example of how to solve a Turing Machine Question
- δ (S0,A) = (SH, C, L)
- δ (S0,B) = (S0, A, L)
- δ (S0,C) = (S1, B, L)
- δ (S1,A) = (S0, C, R)
- δ (S1,B) = (S1, B, R)
- δ (S1,C) = (S0, C, R)
Given the initial configuration shown and starting at S0, what is the configuration after ten steps?
Drawing a table method
It is easy to get mixed up when trying to find the output of a Turing Machine
Easiest way to approach it – draw a table:
Your turn to try
- δ (S0,0) = (S0, □, R)
- δ (S0,1) = (S1, □, L)
- δ (S0, □) = (SH, 1, R)
- δ (S1,0) = (S1, □, L)
- δ (S1,1) = (S1, □, R)
- δ (S1, □) = (S0, 0, L)
Given the initial configuration below and starting at S0, what is the configuration after ten steps?
https://sway.office.com/ZRP7Xm429vw3KTei#content=rNJpQSrOHweZTQ
Universal Machine
A Turing Machine can be used for any computable problem
Every process needs its own Turing Machine
You need a different Turing Machine model for every single function
Simplify the Turing Machine as a ‘black box’:
The more operations you want to perform, the more you need!
The Universal Machine is Turing’s solution to this problem.
A universal machine takes in inputs, and a description of all of the Turing Machines (transitions) required
for the operation.
Like several Turing Machines all linked together – can do anything described by those machines.
Think of the descriptions as computer programs working on the input.
These are all stored on one tape, rather than many.
One block of cells for inputs, one for descriptions.
Why do we do this?
• Earliest stored program concept
• Define what is computable – if a Turing Machine can do it, so can an algorithm.
• Break down larger processes to smaller steps.
Extra Resources
Tutorials on Turing Machines
Just for fun: A LEGO Turing Machine