Computer Science Theory

Lecture 12: October 15, 2012

Turing Machines

- Turing machines
- Algorithms and recursive languages
- Some history
- Models of computation equivalent to Turing machines

- A Turing machine is a generalization of a finite automaton.
At any moment in time, it can be pictured as a finite-state control with
a tape head reading a symbol on a square of its infinite input tape.
Initially, a finite length input string
a
_{1}a_{2}... a_{n}appears on the input tape with the tape head reading a_{1}and the finite control in a designated initial state. The symbols of the input string appear in contiguous squares of the input tape. An infinite number of blank symbols are on the input tape to the left and to the right of the input string. - Before a move, a Turing machine reads the symbol on the
square of the input tape
under the tape head and consults the transition
function (its "program") stored in its finite-state control.
During the move it makes a state transition,
replaces the symbol on the input
tape with another tape symbol, and shifts the tape head one square
to the left or to the right.
If after a finite (but perhaps very long) number of moves the Turing
machine enters a final state, it halts and accepts the original
input string a
_{1}a_{2}... a_{n}. The Turing machine may enter a nonfinal state and halt, or it may make an infinite sequence of moves without entering a final state. In both these cases it does not accept the input string. - More formally, a nondeterministic Turing machine M has seven components:
(Q, Σ, Γ, δ, q
_{0}, B, F) - Q is the finite set of states of the finite control.
- Σ is the finite set of input symbols.
- Γ is the set of tape symbols; Σ is a subset of Γ.
- δ is the transition function. It maps (Q × Γ) to subsets of (Q × Γ × {L,R}). If (p, Y, D) is in δ(q, X) and M is in state q reading the symbol X on the input tape, then M can
- go from state q to state p,
- replace the symbol X on the input tape by the symbol Y, and
- move its input head one square in the direction D where D can be either L (for left) or R (for right).
- M is deterministic if there is at most one element in δ(q, X) for any state q and tape symbol X.
- q
_{0}is the start state. - B is the blank symbol. B is in Γ but not in Σ.
- F, a subset of Q, is the set of final accepting states. We assume there are no transitions from a final state so that when M enters a final state it halts.
- During a sequence of moves
we can represent the configuration of M by an instantaneous description
(ID) of the form
X
_{1}X_{2}... X_{i-1}qX_{i}X_{i+1}... X_{n}. This ID says M is in state q reading the tape symbol X_{i}. To the left of X_{i}is the string of tape symbols X_{1}X_{2}... X_{i-1}. To the right of X_{i}is the string of tape symbols X_{i+1}... X_{n}. We do not show blanks on the input tape unless necessary. - The read head may be one input square past the right end of the input reading a blank in which case M is in the ID
- X
_{1}X_{2}... X_{n}qB. - Moves by M are modeled by the following changes to the ID:
- If (p, Y, L) is in δ(q, X
_{i}), M can move to the ID - X
_{1}X_{2}... X_{i-2}pX_{i-1}Y X_{i+1}... X_{n}. - If
*i*= 1, then M moves to the blank to the left of X_{1}in which case the ID becomes - pBYX
_{2}... X_{n}. - If
*i*= n and Y = B, then M replaces X_{n}by a blank and the ID becomes - X
_{1}X_{2}... X_{n-2}pX_{n-1}. - If (p, Y, R) is in δ(q, X
_{i}), M can move to the ID - X
_{1}X_{2}... X_{i-1}YpX_{i+1}... X_{n}. - If
*i*= n, then M moves to the blank to the right of X_{n}in which case the ID becomes - X
_{1}X_{2}... X_{n-1}YpB. - If
*i*= 1 and Y = B, then M replaces X_{1}by a blank and the ID becomes - pX
_{2}... X_{n}. - L(M), the language accepted by M, is the set of strings w in Σ*
such that q
_{0}w |–* αpβ for some state p in F. - We say that a language
*L*is*recursively enumerable*if*L*= L(M) for some Turing machine M. - See Example 8.2, p. 329, HMU for a TM that accepts
the language {0
^{n}1^{n}|*n*≥ 1 }.

- We say that a language
*L*is*recursive*if*L*= L(M) for some Turing machine M such that: - If w is in
*L*, then M accepts w and therefore halts. - If w is not in
*L*, then M eventually halts but never enters an accepting state. - A Turing machine that halts on all inputs either in an accepting or
nonaccepting state provides a precise definition for the term
*algorithm*. This formalizes our intuitive notion of an algorithm as a collection of simple instructions for carrying out some task. - A language
*L*is said to be*decidable*if it is a recursive language. - A language
*L*is said to be*undecidable*if it is not a recursive language.

- Hilbert's problems
- In 1900, David Hilbert, the eminent mathematician of his day, presented a famous list of twenty-three problems at the International Congress of Mathematicians in Paris.
- Hilbert's tenth problem was to devise a process according to which it can be determined by a finite number of operations whether a polynomial with integer coefficients (Diophantine equation) has an integral root.
- For example, the polynomial Diophantine equation
- 6
over the variables*x*^{3}*y**z*^{2}+ 3*x**y*^{2}-*x*^{3}- 10 = 0*x*,*y*, and*z*has an integral root at*x*= 5,*y*= 3, and*z*= 0. The root is said to be integral because all variables are assigned integer values. - 6
- In 1931 Kurt Gödel published his famous incompleteness theorems which basically said that in any reasonable system of formalizing the notion of provability in number theory, some true statements are unprovable. This shattered Hilbert's dream of finding a complete and consistent set of axioms for all of mathematics (Hilbert's second problem).
- In 1936 Alonzo Church wrote a paper in which he devised a notation called lambda calculus to define algorithms. Lambda calculus is the basis for the programming language Lisp.
- In 1936 Alan Turing wrote a paper ("On computable numbers with an application to the Entscheidungsproblem", Proc. London Math. Society) in which he defined Turing machines and showed that the halting problem for Turing machines is undecidable.
- The machine M in Alan Turing's paper accepted by just halting -- there is no final state. Let H(M) be the set of inputs w on which his machine halts. Turing showed that the set of pairs (M, w) such that w is in H(M) is recursively enumerable but not recursive.
- The Church-Turing thesis hypothesizes that any function that can be computed ("effectively computable function") can be computed on a Turing machine.
- In 1970, Yuri Matiyasevich showed that no algorithm exists for testing whether a Diophantine equation has integral roots.

- Many variants of Turing machines have been defined such as:
- Turing machines with a semi-infinite input tape.
- Multitape Turing machines.
- Turing machines with tapes having multiple tracks.
- Nondeterministic Turing machines.
- All these machines are equivalent to our definition of a Turing machine.
- Other universal models of computation:
- Chomsky type 0 grammars. A type 0 grammar is like a context-free grammar (V, T, P, S) except that productions can be of the form α → β where α is a string of nonterminals and terminals with at least one nonterminal and β is any string of nonterminals and nonterminals.
- Lambda calculus.
- Pushdown automata with two or more stacks.
- Two-counter machines.
- Random access machines.
- Most programming languages.
- Real computers with an arbitrary amount of memory.
- Again, all these models are computationally equivalent to our definition of a Turing machine.

- Design a Turing machine that accepts all strings of
*a*'s and*b*'s with an equal number of*a*'s and*b*'s. Show the sequence of moves your Turing machine makes on the input*aabb*. - HMU, Exercise 8.2.5.

- HMU: Chapter 8

aho@cs.columbia.edu