0% found this document useful (0 votes)
168 views

Turing Machine

A Turing machine is a theoretical model of computation that manipulates symbols on a strip of tape according to a set of rules. It operates by reading and writing symbols on the tape using a tape head, and changing its internal state based on the symbol read and its current state. Turing machines can simulate any computer algorithm and are used to prove fundamental limitations of computation. They are not practical machines but provide a precise definition of an algorithm and capture the intuitive notion of effective methods in logic and mathematics.

Uploaded by

Aditya Jain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
168 views

Turing Machine

A Turing machine is a theoretical model of computation that manipulates symbols on a strip of tape according to a set of rules. It operates by reading and writing symbols on the tape using a tape head, and changing its internal state based on the symbol read and its current state. Turing machines can simulate any computer algorithm and are used to prove fundamental limitations of computation. They are not practical machines but provide a precise definition of an algorithm and capture the intuitive notion of effective methods in logic and mathematics.

Uploaded by

Aditya Jain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Turing machine

From Wikipedia, the free encyclopedia


Jump to navigation Jump to search
For other uses, see Turing machine (disambiguation).
Turing machines
Machine
 Turing machine equivalents
 Turing machine examples
 Turing machine gallery

Variants
 Alternating Turing machine
 Neural Turing machine
 Nondeterministic Turing machine
 Quantum Turing machine
 Post–Turing machine
 Probabilistic Turing machine
 Read-only Turing machine
 Read-only right moving Turing machines
 Multitape Turing machine
 Multi-track Turing machine
 Symmetric Turing machine
 Total Turing machine
 Unambiguous Turing machine
 Universal Turing machine
 Zeno machine

Science
 Alan Turing
 Category:Turing machine

 v
 t
 e

Classes of automata
(Clicking on each layer gets an article on that subject)

A Turing machine is a mathematical model of computation that defines an abstract


machine[1] that manipulates symbols on a strip of tape according to a table of rules.[2] Despite
the model's simplicity, given any computer algorithm, a Turing machine capable of
simulating that algorithm's logic can be constructed.[3]
The machine operates on an infinite[4] memory tape divided into discrete "cells".[5] The
machine positions its "head" over a cell and "reads" or "scans"[6] the symbol there. Then,
based on the symbol and the machine's own present state in a "finite table"[7] of user-specified
instructions, the machine (i) writes a symbol (e.g., a digit or a letter from a finite alphabet) in
the cell (some models allow symbol erasure or no writing),[8] then (ii) either moves the tape
one cell left or right (some models allow no motion, some models move the head),[9] then (iii)
based on the observed symbol and the machine's own state in the table either proceeds to
another instruction or halts the computation.[10]

The Turing machine was invented in 1936 by Alan Turing,[11][12] who called it an "a-machine"
(automatic machine).[13] With this model, Turing was able to answer two questions in the
negative:

1. Does a machine exist that can determine whether any arbitrary machine on its tape is
"circular" (e.g., freezes, or fails to continue its computational task)?
2. Does a machine exist that can determine whether any arbitrary machine on its tape
ever prints a given symbol?[14][15]

Thus by providing a mathematical description of a very simple device capable of arbitrary


computations, he was able to prove properties of computation in general—and in particular,
the uncomputability of the Entscheidungsproblem ('decision problem').[16]

Turing machines proved the existence of fundamental limitations on the power of mechanical
computation.[17] While they can express arbitrary computations, their minimalist design
makes them unsuitable for computation in practice: real-world computers are based on
different designs that, unlike Turing machines, use random-access memory.

Turing completeness is the ability for a system of instructions to simulate a Turing machine.
A programming language that is Turing complete is theoretically capable of expressing all
tasks accomplishable by computers; nearly all programming languages are Turing complete if
the limitations of finite memory are ignored.

Contents
 1 Overview
o 1.1 Physical description
 2 Description
 3 Formal definition
 4 Additional details required to visualize or implement Turing machines
o 4.1 Alternative definitions
o 4.2 The "state"
o 4.3 Turing machine "state" diagrams
 5 Models equivalent to the Turing machine model
 6 Choice c-machines, oracle o-machines
 7 Universal Turing machines
 8 Comparison with real machines
o 8.1 Limitations of Turing machines
 8.1.1 Computational complexity theory
 8.1.2 Concurrency
 8.1.3 Interaction
 9 History
o 9.1 Historical background: computational machinery
o 9.2 The Entscheidungsproblem (the "decision problem"): Hilbert's tenth
question of 1900
o 9.3 Alan Turing's a-machine
o 9.4 1937–1970: The "digital computer", the birth of "computer science"
o 9.5 1970–present: the Turing machine as a model of computation
 10 See also
 11 Notes
 12 References
o 12.1 Primary literature, reprints, and compilations
o 12.2 Computability theory
o 12.3 Church's thesis
o 12.4 Small Turing machines
o 12.5 Other
 13 External links

Overview
A Turing machine is a general example of a central processing unit (CPU) that controls all
data manipulation done by a computer, with the canonical machine using sequential memory
to store data. More specifically, it is a machine (automaton) capable of enumerating some
arbitrary subset of valid strings of an alphabet; these strings are part of a recursively
enumerable set. A Turing machine has a tape of infinite length on which it can perform read
and write operations.

Assuming a black box, the Turing machine cannot know whether it will eventually enumerate
any one specific string of the subset with a given program. This is due to the fact that the
halting problem is unsolvable, which has major implications for the theoretical limits of
computing.

The Turing machine is capable of processing an unrestricted grammar, which further implies
that it is capable of robustly evaluating first-order logic in an infinite number of ways. This is
famously demonstrated through lambda calculus.

A Turing machine that is able to simulate any other Turing machine is called a universal
Turing machine (UTM, or simply a universal machine). A more mathematically oriented
definition with a similar "universal" nature was introduced by Alonzo Church, whose work
on lambda calculus intertwined with Turing's in a formal theory of computation known as the
Church–Turing thesis. The thesis states that Turing machines indeed capture the informal
notion of effective methods in logic and mathematics, and provide a precise definition of an
algorithm or "mechanical procedure". Studying their abstract properties yields many insights
into computer science and complexity theory.

Physical description
In his 1948 essay, "Intelligent Machinery", Turing wrote that his machine consisted of:

...an unlimited memory capacity obtained in the form of an infinite tape marked out into
squares, on each of which a symbol could be printed. At any moment there is one symbol in
the machine; it is called the scanned symbol. The machine can alter the scanned symbol, and
its behavior is in part determined by that symbol, but the symbols on the tape elsewhere do
not affect the behavior of the machine. However, the tape can be moved back and forth
through the machine, this being one of the elementary operations of the machine. Any symbol
on the tape may therefore eventually have an innings.[18]

— Turing 1948, p. 3[19]

Description
For visualizations of Turing machines, see Turing machine gallery.

The Turing machine mathematically models a machine that mechanically operates on a tape.
On this tape are symbols, which the machine can read and write, one at a time, using a tape
head. Operation is fully determined by a finite set of elementary instructions such as "in state
42, if the symbol seen is 0, write a 1; if the symbol seen is 1, change into state 17; in state 17,
if the symbol seen is 0, write a 1 and change to state 6;" etc. In the original article ("On
Computable Numbers, with an Application to the Entscheidungsproblem", see also references
below), Turing imagines not a mechanism, but a person whom he calls the "computer", who
executes these deterministic mechanical rules slavishly (or as Turing puts it, "in a desultory
manner").

The head is always over a particular square of the tape; only a finite stretch of squares is
shown. The instruction to be performed (q4) is shown over the scanned square. (Drawing after
Kleene (1952) p. 375.)

Here, the internal state (q1) is shown inside the head, and the illustration describes the tape as
being infinite and pre-filled with "0", the symbol serving as blank. The system's full state (its
"complete configuration") consists of the internal state, any non-blank symbols on the tape
(in this illustration "11B"), and the position of the head relative to those symbols including
blanks, i.e. "011B". (Drawing after Minsky (1967) p. 121.)

More explicitly, a Turing machine consists of:

 A tape divided into cells, one next to the other. Each cell contains a symbol from
some finite alphabet. The alphabet contains a special blank symbol (here written as
'0') and one or more other symbols. The tape is assumed to be arbitrarily extendable to
the left and to the right, so that the Turing machine is always supplied with as much
tape as it needs for its computation. Cells that have not been written before are
assumed to be filled with the blank symbol. In some models the tape has a left end
marked with a special symbol; the tape extends or is indefinitely extensible to the
right.
 A head that can read and write symbols on the tape and move the tape left and right
one (and only one) cell at a time. In some models the head moves and the tape is
stationary.
 A state register that stores the state of the Turing machine, one of finitely many.
Among these is the special start state with which the state register is initialized. These
states, writes Turing, replace the "state of mind" a person performing computations
would ordinarily be in.
 A finite table[20] of instructions[21] that, given the state(qi) the machine is currently in
and the symbol(aj) it is reading on the tape (symbol currently under the head), tells the
machine to do the following in sequence (for the 5-tuple models):

1. Either erase or write a symbol (replacing aj with aj1).


2. Move the head (which is described by dk and can have values: 'L' for one step left or
'R' for one step right or 'N' for staying in the same place).
3. Assume the same or a new state as prescribed (go to state qi1).

In the 4-tuple models, erasing or writing a symbol (aj1) and moving the head left or right (dk)
are specified as separate instructions. The table tells the machine to (ia) erase or write a
symbol or (ib) move the head left or right, and then (ii) assume the same or a new state as
prescribed, but not both actions (ia) and (ib) in the same instruction. In some models, if there
is no entry in the table for the current combination of symbol and state, then the machine will
halt; other models require all entries to be filled.

Every part of the machine (i.e. its state, symbol-collections, and used tape at any given time)
and its actions (such as printing, erasing and tape motion) is finite, discrete and
distinguishable; it is the unlimited amount of tape and runtime that gives it an unbounded
amount of storage space.

Formal definition
Following Hopcroft & Ullman (1979, p. 148), a (one-tape) Turing machine can be formally
defined as a 7-tuple where

 is a finite, non-empty set of tape alphabet symbols;


 is the blank symbol (the only symbol allowed to occur on the tape infinitely often at
any step during the computation);
 is the set of input symbols, that is, the set of symbols allowed to appear in the initial
tape contents;
 is a finite, non-empty set of states;
 is the initial state;
 is the set of final states or accepting states. The initial tape contents is said to be
accepted by if it eventually halts in a state from .
 is a partial function called the transition function, where L is left shift, R is right shift.
If is not defined on the current state and the current tape symbol, then the machine
halts;[22] intuitively, the transition function specifies the next state transited from the
current state, which symbol to overwrite the current symbol pointed by the head, and
the next head movement.
3-state Busy Beaver. Black icons represent location and state of head; square colors represent
1s (orange) and 0s (white); time progresses vertically from the top until the HALT state at
the bottom.

In addition, the Turing machine can also have a reject state to make rejection more explicit.
In that case there are three possibilities: accepting, rejecting, and running forever. Another
possibility is to regard the final values on the tape as the output. However, if the only output
is the final state the machine ends up in (or never halting), the machine can still effectively
output a longer string by taking in an integer that tells it which bit of the string to output.

A relatively uncommon variant allows "no shift", say N, as a third element of the set of
directions .

The 7-tuple for the 3-state busy beaver looks like this (see more about this busy beaver at
Turing machine examples):

 (states);
 (tape alphabet symbols);
 (blank symbol);
 (input symbols);
 (initial state);
 (final states);
 see state-table below (transition function).

Initially all tape cells are marked with .

State table for 3-state, 2-symbol busy beaver


Tape Current state A Current state B Current state C
Write Move Next Write Move Next Write Move
symbol symbol tape state symbol tape state symbol tape
Next state

0 1 R B 1 L A 1 L B
1 1 L C 1 R B 1 R HALT

Additional details required to visualize or implement


Turing machines
In the words of van Emde Boas (1990), p. 6: "The set-theoretical object [his formal seven-
tuple description similar to the above] provides only partial information on how the machine
will behave and what its computations will look like."

For instance,

 There will need to be many decisions on what the symbols actually look like, and a
failproof way of reading and writing symbols indefinitely.
 The shift left and shift right operations may shift the tape head across the tape, but
when actually building a Turing machine it is more practical to make the tape slide
back and forth under the head instead.
 The tape can be finite, and automatically extended with blanks as needed (which is
closest to the mathematical definition), but it is more common to think of it as
stretching infinitely at one or both ends and being pre-filled with blanks except on the
explicitly given finite fragment the tape head is on. (This is, of course, not
implementable in practice.) The tape cannot be fixed in length, since that would not
correspond to the given definition and would seriously limit the range of
computations the machine can perform to those of a linear bounded automaton if the
tape was proportional to the input size, or finite-state machine if it was strictly fixed-
length.

Alternative definitions

Definitions in literature sometimes differ slightly, to make arguments or proofs easier or


clearer, but this is always done in such a way that the resulting machine has the same
computational power. For example, the set could be changed from to , where N ("None" or
"No-operation") would allow the machine to stay on the same tape cell instead of moving left
or right. This would not increase the machine's computational power.

The most common convention represents each "Turing instruction" in a "Turing table" by one
of nine 5-tuples, per the convention of Turing/Davis (Turing (1936) in The Undecidable,
p. 126-127 and Davis (2000) p. 152):

(definition 1): (qi, Sj, Sk/E/N, L/R/N, qm)


( current state qi , symbol scanned Sj , print symbol Sk/erase E/none N ,
move_tape_one_square left L/right R/none N , new state qm )

Other authors (Minsky (1967) p. 119, Hopcroft and Ullman (1979) p. 158, Stone (1972) p. 9)
adopt a different convention, with new state qm listed immediately after the scanned symbol
Sj :

(definition 2): (qi, Sj, qm, Sk/E/N, L/R/N)


( current state qi , symbol scanned Sj , new state qm , print symbol Sk/erase E/none N ,
move_tape_one_square left L/right R/none N )

For the remainder of this article "definition 1" (the Turing/Davis convention) will be used.

Example: state table for the 3-state 2-symbol busy beaver reduced to 5-tuples
Scanned Print Move Final (i.e. next)
Current state 5-tuples
symbol symbol tape state
A 0 1 R B (A, 0, 1, R, B)
A 1 1 L C (A, 1, 1, L, C)
B 0 1 L A (B, 0, 1, L, A)
B 1 1 R B (B, 1, 1, R, B)
C 0 1 L B (C, 0, 1, L, B)
(C, 1, 1, N,
C 1 1 N H
H)

In the following table, Turing's original model allowed only the first three lines that he called
N1, N2, N3 (cf. Turing in The Undecidable, p. 126). He allowed for erasure of the "scanned
square" by naming a 0th symbol S0 = "erase" or "blank", etc. However, he did not allow for
non-printing, so every instruction-line includes "print symbol Sk" or "erase" (cf. footnote 12
in Post (1947), The Undecidable, p. 300). The abbreviations are Turing's (The Undecidable,
p. 119). Subsequent to Turing's original paper in 1936–1937, machine-models have allowed
all nine possible types of five-tuples:

Current m- Final m-
Tape Print- Tape- 5- 5-tuple 4-
configuration configuration
symbol operation motion tuple comments tuple
(Turing state) (Turing state)
(qi, Sj, "blank" =
N1 qi Sj Print(Sk) Left L qm Sk, L, S0, 1=S1,
qm) etc.
(qi, Sj, "blank" =
N2 qi Sj Print(Sk) Right R qm Sk, R, S0, 1=S1,
qm) etc.
(qi, Sj, "blank" =
(qi, Sj,
N3 qi Sj Print(Sk) None N qm Sk, N, S0, 1=S1,
Sk, qm)
qm) etc.
(qi, Sj,
(qi, Sj,
4 qi Sj None N Left L qm N, L,
L, qm)
qm)
(qi, Sj,
(qi, Sj,
5 qi Sj None N Right R qm N, R,
R, qm)
qm)
(qi, Sj,
Direct (qi, Sj,
6 qi Sj None N None N qm N, N,
"jump" N, qm)
qm)
(qi, Sj,
7 qi Sj Erase Left L qm E, L,
qm)
(qi, Sj,
8 qi Sj Erase Right R qm E, R,
qm)
(qi, Sj,
(qi, Sj,
9 qi Sj Erase None N qm E, N,
E, qm)
qm)

Any Turing table (list of instructions) can be constructed from the above nine 5-tuples. For
technical reasons, the three non-printing or "N" instructions (4, 5, 6) can usually be dispensed
with. For examples see Turing machine examples.

Less frequently the use of 4-tuples are encountered: these represent a further atomization of
the Turing instructions (cf. Post (1947), Boolos & Jeffrey (1974, 1999), Davis-Sigal-
Weyuker (1994)); also see more at Post–Turing machine.

The "state"

The word "state" used in context of Turing machines can be a source of confusion, as it can
mean two things. Most commentators after Turing have used "state" to mean the
name/designator of the current instruction to be performed—i.e. the contents of the state
register. But Turing (1936) made a strong distinction between a record of what he called the
machine's "m-configuration", and the machine's (or person's) "state of progress" through the
computation - the current state of the total system. What Turing called "the state formula"
includes both the current instruction and all the symbols on the tape:

Thus the state of progress of the computation at any stage is completely determined by the
note of instructions and the symbols on the tape. That is, the state of the system may be
described by a single expression (sequence of symbols) consisting of the symbols on the tape
followed by Δ (which we suppose not to appear elsewhere) and then by the note of
instructions. This expression is called the 'state formula'.

— The Undecidable, pp. 139–140, emphasis added

Earlier in his paper Turing carried this even further: he gives an example where he placed a
symbol of the current "m-configuration"—the instruction's label—beneath the scanned
square, together with all the symbols on the tape (The Undecidable, p. 121); this he calls "the
complete configuration" (The Undecidable, p. 118). To print the "complete configuration" on
one line, he places the state-label/m-configuration to the left of the scanned symbol.

A variant of this is seen in Kleene (1952) where Kleene shows how to write the Gödel
number of a machine's "situation": he places the "m-configuration" symbol q4 over the
scanned square in roughly the center of the 6 non-blank squares on the tape (see the Turing-
tape figure in this article) and puts it to the right of the scanned square. But Kleene refers to
"q4" itself as "the machine state" (Kleene, p. 374-375). Hopcroft and Ullman call this
composite the "instantaneous description" and follow the Turing convention of putting the
"current state" (instruction-label, m-configuration) to the left of the scanned symbol (p. 149),
that is, the instantaneous description is the composite of non-blank symbols to the left, state
of the machine, the current symbol scanned by the head, and the non-blank symbols to the
right.

Example: total state of 3-state 2-symbol busy beaver after 3 "moves" (taken from
example "run" in the figure below):

1A1

This means: after three moves the tape has ... 000110000 ... on it, the head is scanning the
right-most 1, and the state is A. Blanks (in this case represented by "0"s) can be part of the
total state as shown here: B01; the tape has a single 1 on it, but the head is scanning the 0
("blank") to its left and the state is B.

"State" in the context of Turing machines should be clarified as to which is being described:
(i) the current instruction, or (ii) the list of symbols on the tape together with the current
instruction, or (iii) the list of symbols on the tape together with the current instruction placed
to the left of the scanned symbol or to the right of the scanned symbol.

Turing's biographer Andrew Hodges (1983: 107) has noted and discussed this confusion.

Turing machine "state" diagrams


The table for the 3-state busy beaver ("P" = print/write a "1")
Tape
Current state A Current state B Current state C
symbol
Write Move Next Write Move Next Write Move Next
symbol tape state symbol tape state symbol tape state
0 P R B P L A P L B
1 P L C P R B P R HALT

You might also like