Download presentation
Presentation is loading. Please wait.
Published byTheodore Armstrong Modified over 8 years ago
1
Modeling Arithmetic, Computation, and Languages Mathematical Structures for Computer Science Chapter 8 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesTuring Machines
2
Section 8.3Turing Machines1 A Turing machine is essentially a finite-state machine with the added ability to reread its input and also to erase and write over its input with unlimited auxiliary memory. Unlimited auxiliary memory makes the Turing machine a hypothetical “machine” a model and not a real device. A Turing machine consists of a finite-state machine and an unlimited tape divided into cells, each cell containing at most one symbol from an allowable finite alphabet. At any one instant, only a finite number of cells on the tape are nonblank. The special symbol b is used to denote a blank cell. The finite-state unit, through its read write head, reads one cell of the tape at any given moment as shown in the figure below:
3
Section 8.3Turing Machines2 Turing Machine Depending on the present state of the unit and the symbol read, the unit either does nothing (halts) or completes three actions: Print a symbol from the alphabet on the cell read (it might be the same symbol that’s already there) Go to the next state (it might be the same state as before) Move the read write head one cell left or right The actions of any particular Turing machine can be described by a set of quintuples of the form (s, i, i, s, d), where s and i indicate the present state and the tape symbol being read, i denotes the symbol printed, s denotes the new state, and d denotes the direction in which the read write head moves (R for right, L for left).
4
Section 8.3Turing Machines3 Example: Turning Machine Thus, a machine in the configuration illustrated by Figure (a), if acting according to the instructions contained in the quintuple (2, 1, 0, 1, R), would move to the configuration illustrated in Figure (b). The symbol 1 being read on the tape has been changed to a 0, the state of the unit has been changed from 2 to 1, and the head has moved one cell to the right.
5
Section 8.3Turing Machines4 Formal Definition: Turing machine DEFINITION: TURING MACHINE Let S be a finite set of states and I a finite set of tape symbols (the tape alphabet) including a special symbol b. A Turing machine is a set of quintuples of the form (s, i, i, s, d) where s, s S; i, i I; and d {R, L} and no two quintuples begin with the same s and i symbols. The restriction that no two quintuples begin with the same s and i symbols ensures that the action of the Turing machine is deterministic and completely specified by its present state and symbol read. A Turing machine halts if it gets into a configuration for which its present state and symbol read are not the first two symbols of any quintuple.
6
Section 8.3Turing Machines5 Turing Machine (TM) Example A Turing machine is defined by the set of quintuples (0, 0, 1, 0, R), (0, 1, 0, 0, R), (0, b, 1, 1, L), (1, 0, 0, 1, R), (1, 1, 0, 1, R) The action of this Turing machine when processing a particular initial tape is shown by the sequence of configurations in figure above, which also shows the quintuple that applies at each step.
7
Section 8.3Turing Machines6 TMs as Set Recognizers A final state in a Turing machine is one that is not the first symbol in any quintuple. Thus, on entering a final state, whatever the symbol read, the Turing machine halts. DEFINITION: TURING MACHINE RECOGNITION (ACCEPTANCE) A Turing machine T with tape alphabet I recognizes (accepts) a subset S of I* if T, beginning in standard initial configuration on a tape containing a string of tape symbols, halts in a final state if and only if S. The definition of acceptance leaves open two possible behaviors for T when applied to a string of tape symbols not in S. T may halt in a non final state, or T may fail to halt at all. One can now build a Turing machine to recognize the set S = {0 n 1 n n 0}. The machine is based on the second approach to this recognition problem, sweeping back and forth across the input and crossing out 0 1 pairs.
8
Section 8.3Turing Machines7 TMs as Function Computer Given a particular Turing machine T and a string of tape symbols, we begin T in standard initial configuration on a tape containing . If T eventually halts with a string on the tape, we may consider as the value of a function evaluated at . Using function notation, T( ) = . The domain of the function T consists of all strings for which T eventually halts. We can also think of T as computing number- theoretic functions, functions from a subset of N k into N for any k 1. There is thus an infinite sequence T 1, T 2,..., T k,... of number- theoretic functions computed by T associated with each Turing machine T. For each k, the function T k is a partial function on k, meaning that its domain may be a proper subset of N k. A special case of a partial function on N k is a total function on N k, where the function is defined for all k-tuples of nonnegative integers.
9
Section 8.3Turing Machines8 TMs as Function Computers DEFINITION: TURING-COMPUTABLE FUNCTION A Turing-computable function is a number-theoretic function computed by some Turing machine. A Turing-computable function f can in fact be computed by an infinite number of Turing machines. Once a machine T is found to compute f, we can always include extraneous quintuples in T, producing other machines that also compute f.
10
Section 8.3Turing Machines9 Church-Turing Thesis CHURCH-TURING THESIS A number-theoretic function is computable by an algorithm if and only if it is Turing computable. The Church-Turing thesis equates an intuitive idea with a mathematical idea, it can never be formally proved and must remain a thesis, not a theorem. The Church-Turing thesis is now widely accepted as a working tool by researchers dealing with computational procedures. If, in a research paper, a method is set forth for computing a function and the method intuitively seems to be an algorithm, then the Church-Turing thesis is invoked and the function is declared to be Turing-computable (or one of the names associated with one of the equivalent formulations of Turing computability).
11
Section 8.3Turing Machines10 Church-Turing Thesis The Church-Turing thesis is stated in terms of number-theoretic functions, but it can be interpreted more broadly. Any algorithm in which a finite set of symbols is manipulated can be translated into a number-theoretic function by a suitable encoding of the symbols as nonnegative integers, much as input to a real computer is encoded and stored in binary form. Hence, using the Church-Turing thesis, one can say that if there is an algorithm to do a symbol manipulation task, there is a Turing machine to do it. By accepting the Church-Turing thesis, we have accepted the Turing machine as the ultimate model of a computational procedure. Turing machine capabilities exceed those of any actual computer, which, after all, does not have the unlimited tape storage of a Turing machine
12
Section 8.3Turing Machines11 Decision Problems and Uncomputability DEFINITION: DECISION PROBLEM A decision problem asks if an algorithm exists to decide whether individual statements from some large class of statements are true. The solution to a decision problem answers the question of whether an algorithm exists. A positive solution consists of proving that an algorithm exists, and it is generally given by actually producing an algorithm that works. A negative solution consists of proving that no algorithm exists. It must be shown that it is impossible for anyone ever to come up with an algorithm. When a negative solution to a decision problem is found, the problem is said to be unsolvable, uncomputable, or undecidable. This terminology can be confusing because the decision problem itself the question of whether an algorithm exists to do a task has been solved; what must forever be unsolvable is the task itself.
13
Section 8.3Turing Machines12 Halting Problem DEFINITION: HALTING PROBLEM The halting problem asks: Does an algorithm exist to decide, given any Turing machine T and string , whether T begun on a tape containing will eventually halt? THEOREM ON THE HALTING PROBLEM The halting problem is unsolvable. The proof of the unsolvability of the halting problem depends on two ideas: Encoding a Turing machine into a string description Having a machine look at and act on its own description
14
Section 8.3Turing Machines13 Computational Complexity DEFINITION: P P is the collection of all sets recognizable by Turing machines in polynomial time. Instead of determining the complexity of the Turing machine algorithm (i.e., (n) or (n 2 )), simply note whether it is a polynomial-time algorithm. Only quite trivial algorithms can be better than polynomial time because it takes a Turing machine n steps just to examine its tape. Problems for which no polynomial-time algorithms exist are called intractable. Such problems may be solvable, but only by inefficient algorithms. Ordinary Turing machines act deterministically, due to our restriction that no two quintuples begin with the same present state/present symbol pair. A relaxation of this requirement results in a nondeterministic Turing machine, which may have a choice of actions at any step. A nondeterministic Turing machine recognizes a string on its tape if some sequence of actions leads to halting in a final state.
15
Section 8.3Turing Machines14 NP DEFINITION: NP NP is the collection of all sets recognizable by nondeterministic Turing machines in polynomial time. (NP comes from nondeterministic polynomial time.) While a set in P requires that a deterministic Turing machine be able to make a decision (in polynomial time) about whether some string on its tape does or does not belong to the set, a set in NP requires only that a nondeterministic Turing machine be able to verify (in polynomial time) by a fortuitous choice of actions that an input string is in the set. NP-complete problems: Those that not only are they in NP, but if a polynomial-time decision algorithm were ever found for any one of them, that is, if any of them were ever found to be in P, then indeed we would have P = NP. The Hamiltonian circuit problem belongs to this class of problems.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.