1 / 11

Halting Problem

Halting Problem. Introduction to Computing Science and Programming I. Alan Turing. Alan Turing 1912-1954 “Father” of modern computing science 1936 Turing Machine Church-Turing thesis Halting Problem 1950: Turing Test. Turing Machine.

guinevere
Download Presentation

Halting Problem

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. Halting Problem Introduction to Computing Science and Programming I

  2. Alan Turing • Alan Turing 1912-1954 • “Father” of modern computing science • 1936 • Turing Machine • Church-Turing thesis • Halting Problem • 1950: Turing Test

  3. Turing Machine • A Turing machine is a very simple theoretical “computer” with a couple basic elements. • An infinitely long tape broken up into cells that can each store a single symbol from a finite set of symbols • A head that can read or write one symbol at a time from the tape • A state diagram that tells the head what to do, move left/right, print a symbol

  4. Church-Turing Thesis • This thesis proves has to do with comparing what problems can be solved by different types of computer. • It proves that a Turing Machine could theoretically be created that can do anything any digital computer can do.

  5. Halting Problem • An important question of computing science is “Are there problems that cannot be solved?” • There are, and probably the most famous of these is the halting problem described by Turing. • He was thinking in terms of Turing machines (there were no computers), but it is easy to extend the idea.

  6. Halting Problem • Halting problem • Can we write a program that will look at any computer program and its input and decide if the program will halt (not run infinitely)? • A practical solution might be to run the program and if it halts you have your answer. If after a given amount of time it doesn’t halt, guess that it won’t halt. However, you wouldn’t know if the program would eventually halt.

  7. Halting Problem • As it turns out the problem is undecidable. • For a problem to be undecidable you just have to prove that there is one case it can’t produce an answer for. • The case that Turing came up with that can never be solved involves giving a program itself as input.

  8. Halting Problem • Let’s assume we’re given a function halts(prog,input) that is supposed to tell us if the program prog will halt if given the input. The function will return True if it halts, False otherwise.

  9. Halting Problem • Using the halts function the following program can be written that reads in a program, given as a filename) from the user. It then calls the halts function to decide if the program will halt given itself as input. prog = raw_input("Program file name: ") if halts(prog, prog): while True: print "looping“ else: print "done"

  10. Halting Problem • It may not make sense to give a program itself as input, but that isn’t important here. • What could happen? • If halts(prog,prog) returns True, that means the program will halt when given itself as input. However, in this case the program would go into an infinite loop. Therefore the program doesn’t halt. • If halts(prog,prog) returns False, that means that it wouldn’t halt, but in that case the program does halt. • This contradiction is unavoidable thus proving that the halting problem is undecidable. No function can always correctly decide if a program will halt.

  11. Turing Test • The Turing test was formulated as a way to answer the question, “Can machines think?” • The basic idea is that there is a sort of judge who converses with a computer and a person. However, this is indirect. The judge writes down questions and the computer and the person, who are hidden from the judge, return typewritten answers. If the judge couldn’t consistently identify which set of answers were from the person, than the computer could “think”. • Turing predicted that computers could pass this test with 30% of humans as the judge by the year 2000.

More Related