1 / 16

Combining Turing Machines

Combining Turing Machines. Reading: 9.2-10.4. Combining TMs. We can string together Turing Machine computations in order to compute more complicated functions. f(x) = x+y if x >= y 0 if x < y Answer: Use Comparer calculation to end up in qx or qy. qx begins the adder computation

kanan
Download Presentation

Combining 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. Combining Turing Machines Reading: 9.2-10.4

  2. Combining TMs • We can string together Turing Machine computations in order to compute more complicated functions. • f(x) = x+y if x >= y 0 if x < y • Answer: Use Comparer calculation to end up in qx or qy. • qx begins the adder computation • qy erases all other ones and puts a zero at the end.

  3. If - else • We now can do some if-else constructions • If a then qj else qk • Read an a, then go to qj without writing or moving the head (that is, move right, then left) • If the symbol was not an a, go to qk without changing anything.

  4. Subroutines • Call a subroutine in a Turing Machine. • Want to stop computation A, go to a separate part of the tape, and do computation B. Then return to computation A in the same place on the tape. • How it works: • Before calling B, A copies inputs into a shared tape space (indicated by a separator) • A transitions into the initial state of B • B uses its tape space to compute • B writes relevant output to the shared space • B’s final state now points back into a state in A.

  5. Example: x times y • Initially, the tape should have leading zeroes, ones denoting x, a zero, then ones denoting y. • At the end, it should have ones denoting xy at the beginning of the input. • 1. Repeat until there are no more 1’s in x: • Find a 1 in x and replace it with another symbol, a • Replace the leftmost 0 by 0y. • 2. Replace all a’s with 1’s.

  6. Turing’s Thesis • Can Turing Machines do anything computers can do? • Hmm - depends on the definition of “computer”! • Turing’s thesis(mid-30’s): Any computation carried out by mechanical means can be carried out by a Turing Machine.

  7. Turing’s thesis: true or false? • Can’t prove it, because we can’t foresee what “mechanical means” people might come up with in the future. • Could disprove it with one counterexample...

  8. Evidence Supporting Turing’s thesis • Anything that can be done on an existing digital computer can be done on a Turing Machine • We can prove this - just write a TM for each machine instruction. • No one has been able to suggest a problem solvable by an algorithm but not a TM • Many alternative models of digital computers have been proposed - but none are more powerful than TMs

  9. Algorithm definition • An algorithm for a function is a Turing Machine that halts with the correct answer on the tape for any input in the domain.

  10. Other types of automata • Given another type of automata, how do you know which is more powerful? • Simulation - show how anything done with one type of automata can be done with the other • Example: I can simulate with a PDA any FSA. Therefore PDAs as powerful (maybe more) than FSAs.

  11. Example: • Any FSA can be written as a PDA: • So PDAs are at least as powerful.

  12. Variations on TMs • Add a stay-option • Tape is only unbounded in one direction • Separate read-only tape for input (off-line TM) • Multiple storage tapes • Multi-dimensional tape (extends infinitely in 2 dimensions) • Non-deterministic TMs (not presently possible with today’s computers) All these are equivalent automata to Turing Machines!

  13. Non-deterministic TMs • An interesting class of TMs... • Equivalent in power to TMs (so everything computable by a ND-TM is computable by a TM) • BUT, it takes more steps on a TM than a ND-TM. We think it takes exponentially more steps... • This is where the classes P and NP come from... • P: set of all problems computable by a TM in polynomial time • NP: set of all problems computable by a ND-TM in polynomial time • P = NP? Unknown...

  14. Detour into 331... • NP-Complete: set of all problems in NP that are polynomial-time reducible to ALL problems in NP. • Meaning, if you can solve 1 NPC problem in polynomial time, you can solve ALL NP problems in polynomial time, and P = NP • Cook’s Theorem: SAT is NP-Complete • How did this work? He showed that every ND-TM has an equivalent SAT expression!! • From that it is easy to reduce other NP-problems to SAT to prove that they too are NPC: • Hamiltonian paths (Traveling salesman) • Cliques

  15. Universal Turing Machines • Are computers more powerful because they are programmable? • Universal Turing Machine: takes its own specification as input. • Are Universal Turing Machines more powerful?

  16. Universal TMs • Universal TMs have been constructed from multi-tape TMs. One tape gives the input, one gives the internal storage, one tape is the “program” telling the machine what to do next. • Since multi-tape TMs are equivalent to TMs, Universal TMs are equivalent to TMs!

More Related