What is a Turing Machine?
A Turing machine is a simple but powerful computer. It is useful in thinking about the nature
and limits of computability because its method of computation is about as simple as can be
imagined. Turing machines were conceived by Alan Turing (1912-1954). Turing machines
are one of the earliest and most intuitive ways to make precise the naive notion of effective
computability. All Turing-computable functions are effectively computable.
Structure:
Imagine a tape divided into cells. Each cell can contain the symbol "1" or it may be blank.
For convenience, let us say that it contains "0" if it is blank. For the time being we should
think of the "1" symbol as an un-interpreted vertical scratch and the "0" simply as the absence
of a scratch.
Now imagine a device that can move over the tape or draw the tape through itself. The device
scans one cell of the tape at a time. It can do three things to the tape:
1. Read whether the cell being scanned contains "1" or "0",
2. Change "1" to "0" and vice versa, and
3. Advance to the next cell to the right or left along the tape.
A program for a Turing machine tells it what to do (#2 and #3 above) depending upon what it
finds on the tape (#1).
It does not matter whether we think of the tape as finite or infinite in length. Since all
computable functions take only a finite number of steps to compute, by definition, no
operation in which we are interested will require an infinite tape. In short, the remarkable
power of the Turing machine does not require an infinite tape.
Programming a Turing Machine:
Let us write a simple programming language for Turing machines, called "Turgid" or "T"
for short.
If we disregard the physical tape and the physical device for reading the tape, a Turing
Machine is the abstract set of operations to perform on the abstract sequence of symbols on
the tape.
Here we will develop the language required to write such programs.
Rule1. Each command will have a name. The name could be alphabetic or numeric, or some
combination,
Rule2. A command in T has four elements. The elements must be in some order; let it be this
order:
the name of the command; what the current scanned cell must contain for the command to
continue; this will be either a "1" or a "0";the action to be performed if the condition in #2 is
satisfied; there are only four such actions:
1: write a "1" in the current cell (overwriting what is there)
0: write a "0" in the current cell (overwriting what is there)
R: move one cell to the right along the tape
L: move one cell to the left along the tape;
The name of the command to be carried out next, such as "Command24"
Rule3. Separate the four elements by commas. For example, "Command1, 1, L, Command2"
is a single command that tells the device to scan the current cell; if it contains a "1", the
device should move one cell to the left and then perform Command2.
Rule4. Unless we note otherwise, we suppose that when a program begins, the tape is always
blank (all "0's").
Rule5. If a command is called that does not exist, then the machine halts.
Rule6. There may be two commands of the same name:
Commandk, 0, L, Commandk+1
Commandk, 1, R, Commandk+1
Rule7. An important rule of T syntax is that programs must be consistent. The best way to
insure consistency is never to use more than two commands of the same name.
Rule8. It will skip the inapplicable command and look for the next numbered command; if
there is none, then it will halt
Rule9. Because the commands are named or numbered, they need not be written in any
particular order. Each command names or points to its own successor
EXAMPLE:
T programs may be represented in tables. For example, the program
C1,0,1,C2
C1,1,1,C3
C2,1,1,C4
C3,0,1,C4
C3,1,1,C4
may be expressed as the following table, in which each row represents one command name,
and the two columns represent what is to be done if the scanned cell is "0" or "1":
0 1
C1 1,C2 1,C3
C2 1,C4
C3 1,C4 1,C4
C4
The table is blank where no action is specified by the program. Tables are helpful for two
reasons. First, they tell us that the program would halt if it ever came to a juncture
represented by a blank on the table.