Alan Turing published a ground-breaking paper in 1936, On computable numbers, with an application to the Entscheidungsproblem (PDF). It was about an esoteric problem in mathematics, for which he needed a theoretical model of how a mathematician computes with pencil & paper. He called this model an automatic machine; we now call it a Turing Machine, which we now recognise as containing the minimal elements of computers. In a sense, he invented computers as a by-product of his mathematical research! That paper is also generally acknowledged to have founded the modern discipline of theoretical computer science.
The Turing Machine is very simple. It consists of:
- an infinite tape divided into cells along its length. Each cell contains a symbol, such as a letter or a number, taken from a specified set such as ‘0’ and ‘1’.
- a head which can read or write symbols on the tape, and move 1 cell one way or the other.
- a register that stores the current state of the machine. This machine can be in one of a finite number of states, each of which determine what happens next when a given symbol is read.
- a table of instructions that specify what the machine does, such as replace the current symbol with a new one, move along the tape, and what will be the next state. This table is a kind of program indexed by the state and current symbol.
Here’s a simple program to add 2 unary numbers (numbers in base 1, e.g. 5 = 11111).
|0||1, +1, 1||1, +1, 0|
|1||0, -1, 2||1, +1, 1|
|2||0, +1, 2||0, +1, 9|
The machine starts in state 0. If it reads a 1 from the tape, it gets the ‘instruction’ 1, +1, 0. The first element is the symbol to write back to the tape (replacing the current symbol). The 2nd is the direction to move the head: -1 = left, +1 = right. The 3rd is the new state. This is effectively a primitive programming language. You wouldn’t want to use this instead of Python! However, it is, in principle, as powerful as Python, in that it can compute anything that Python can!
The point of such a primitive language is that it allows us to reason clearly about the possibilities and limitations of computers. In his 1936 paper On Computable Numbers, Dr. Turing showed that there are programs which no other program can analyse and determine if they will ever halt!
This simple example implements the instruction table as a list of lists of tuples. The outermost list is states, the innermost is symbols ─ and the tuples are (symbol to write, direction to move tape head, next state)
Universal Turing Machines
The example above only solves one problem, namely adding 2 numbers in unary notation. The numbers themselves are provided on the ‘tape’ and so at least we can use the machine to solve an infinite number of additions. But the program is specific to this machine! Suppose I want the machine to compute something other adding unary numbers. All I need to do is change prog – so it must be universal! No. This is a simulation of an (imaginary) mechanical device, changing prog would effectively require repatching cables or whatever, which is a different machine. The Universal Turing Machine however is a fixed machine, which accepts the program of another TM on the tape – followed by any data. Changing prog is tantamount to using the underlying compiler or interpreter (plus hardware) as the UTM.
- Turing Machines, on Tuxar.uk
- Picture of a fanciful mechanical TM from Wikipedia user WVBailey
- The Annotated Turing, by Charles Petzold. Probably my favourite book.
- On computable numbers, with an application to the Entscheidungsproblem (PDF, Journal website)
- ON COMPUTABLE NUMBERS, WITH AN APPLICATION TO THE ENTSCHEIDUNGSPROBLEM By A. M. TURING (text)
- Extract, ‘On computable numbers, with an application to the Entscheidungsproblem’ fromProceedings of the London Mathematical Society, (Ser. 2, Vol. 42, 1937); and extract ‘On Computable Numbers, with an Application to the Entscheidungsproblem. A correction.’ FromProceedings of the London Mathematical Society, (Ser. 2, Vol. 43, 1937). Turing Digital Archive
- Information the measure of all things Part 1: Communication codes and- computation “The problem with a Turing machine is that a new one needs to be built whenever a new computation is to be performed. But Turing proved that a modified version of this deceptively simple theoretical machine — now known as the Universal Turing machine — could perform all possible computations. The way he established this was to show that you could encode the instruction table, the input, and the output of any other Turing machine onto the Universal Turing machine’s tape. Turing proved that the Universal Turing machine could perform all possible computations.