1 / 11

Turing Machines

Turing Machines. Memory = an infinitely long tape Persistent storage A read/write tape head that can move around the tape Initially, the tape contains only the input string There is a special accept state There is a special reject state The machine may process forever

pegeen
Télécharger la présentation

Turing Machines

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Turing Machines • Memory = an infinitely long tape • Persistent storage • A read/write tape head that can move around the tape • Initially, the tape contains only the input string • There is a special accept state • There is a special reject state • The machine may process forever • The machine does not have to read the entire input string What can a Turing Machine do? • More than a PDA • As much as any other computational device? • Not everything.

  2. Formal definition of a TM A Turing Machine is a 7-tuple, (Q, , , , q0, qaccept, qreject), where Q, ,  are all finite and 1. Q is the set of states 2.  is input alphabet – does not include ‘blank’ symbol 3.  is the tape alphabet – include ‘blank’ symbol 4. : QQ {L,R} is the transition function 5. q0 Q is the start state 6. qaccept Q is the accept state 7. qreject Q is the reject state

  3. Touring machine that recognizes strings with substring 1011 in them. Touring machine which recognizes strings of the form ww, w = {a,b}* Calculate x*y

  4. Describing TMs • Formal description: Gives the Turing machine’s states, transition functions, etc. • Implementation description: Uses English to describe how the Turing machine stores and interprets data on its tape, moves its head, etc. • High-level description: Uses English to describe an algorithm. It ignores implementation details – it does not describe how the machine manages the tape or stores data on the tape, etc. • Encoding an object: The notation for encoding an object O into a string is . The encoding of several objects 01, 02,…, 0n is denoted . When taking such input, the first step of the Turing machine is to test the encoding to make sure it correctly codes an object, and reject it if it doesn’t.

  5. A configuration of a Turing machine is a triplet: • The current state the machine is in • The current tape head position • The current contents of the tape • An accepting configuration is when the state of a configuration is qaccept. A rejecting configuration is when the state of the configuration is qreject. Accepting and rejecting configurations are also Halting configurations. • A Turing Machine acceptsa string if the Turing Machine enters an accepting configuration at some point during its computation on the given string. • A Turing Machine rejectsa string if the Turing Machine enters a rejecting configuration at some point during its computation on the given string.

  6. The collection of strings that a Turing Machine M accepts is called the languageof M. A language is called Turing-recognizable (or just recognizable) if some Turing Machine accepts all of the strings in the language. Another term for Turing-recognizable is recursively enumerable. A language is called Turing-decidable (or just decidable) if some Turing Machine accepts all of the strings in the language and rejects (or enters a rejecting configuration) on all strings not in the language. This means that the Turing Machine musthalt on all input strings. Another term for Turing decidable is enumerable. There IS a difference between decidable and recognizable.

  7. When do we consider two machines (computational devices) to have the same power (equivalent)? Does speed matter? Our definition: Two machines are equivalent if they can recognize the same set of languages. How do we prove equivalence? Simulate machine A on machine B, and machine B on machine A. Note that making the simulation fast/small is not a priority.

  8. Extending the power of Turing Machines – too bad, so sad • N-tape Turing Machine = single tape Turing Machine – P137 • Let k be the number of tapes • Starts with input on 1st tape and all other tapes blank • Transition function = : QkQk {L,R}k • Store each machine’s tape contents separated by a # sign • Keep track of each machine’s head position with a special “dot” on tape • Here’s how the machine works: • 1. Scan tape contents beginning from leftmost # to determine each tapes contents underneath the “tape heads” (dot symbol) • 2. Make a second pass to update tape contents according to the original machine’s transition function for the current state. • 3. If a virtual head ever moves to the right onto a #, move everything over one space and put a blank symbol (with a dot) there.

  9. Non-deterministic Turing Machine = Turing Machine – P138- • Transition function = : QP(Q  {L,R}) • For each state there is at most |Q  {L,R}| possible paths ( a finite number) • For each state on a given symbol there is at most |Q  {L,R}| possible paths • We’ll create a distinct tape symbol for each possible path • We use a 3 tape Turing Machine • Tape 1 = copy of input string • Tape 2 = simulation tape – where we run the NDTM on one possible path • Tape 3 = A finite length string of our “possible path” symbols • 1. Initially, tape 1 contains the input string and the other two tapes are blank • 2. Copy tape 1 to tape 2 • 3. Use tape 2 to simulate the NDTM on one possible branch of its computation. The ith step of the NDTM is determined from the ith symbol on tape 3. If the ith symbol on tape 3 is either invalid or blank, or if a rejecting configuration occurs, goto step 4. If an accepting configuration occurs then accept the input. • 4. Replace string on tape 3 with the lexicographically next string. Goto step 2.

  10. Church-Turing Thesis • Proved the equivalence of the -calculus and Turing Machines. • Showed that intuitive notion of algorithms = Turing machine algorithms. • Provides the formal definition of algorithm that is needed to prove that certain algorithms DO NOT exist.

More Related