1 / 54

Self-Reference And Undecidability

Great Theoretical Ideas In Computer Science. Self-Reference And Undecidability. Anything says is false!. Lecture 12. CS 15-251. The HELLO assignment. Write a JAVA program to output the word “HELLO” on the screen and halt.

Download Presentation

Self-Reference And Undecidability

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. Great Theoretical Ideas In Computer Science Self-Reference And Undecidability Anything says is false! Lecture 12 CS 15-251

  2. The HELLO assignment • Write a JAVA program to output the word “HELLO” on the screen and halt. • Space and time are not an issue. The program is for an ideal computer. • PASS for any working HELLO program, no partial credit.

  3. Grading Script • The grading script G must be able to take any Java program P and grade it. • Pass, if P prints only the word G(P)= “HELLO” and halts. • Fail, otherwise. How exactly might such a script work?

  4. What kind of program could a student who hated his/her TA hand in?

  5. Nasty Program • While • ( P is not a proof of Riemann Hypothesis) P++ • PRINT “HELLO” • The nasty program is a PASS if and only if there is a proof of the Riemann Hypothesis

  6. Despite the simplicity of the HELLO assignment, there is no program to correctly grade it! This can be proved.

  7. The theory of what can and can’t be computed by an ideal computer is called Computability Theoryor Recursion Theory.

  8. Notation And Conventions • Fix a single programming language • When we write program P we are talking about the text of the source code for P • P(x) means the output that arises from running program P on input x • P(x) =  means P did not halt on x

  9. P(P) • It follows from our conventions that P(P) means the output obtained when we run P on the text of its own source code.

  10. The Famous Halting Set: K • K is the set of all programs P such that P(P) halts.

  11. The Halting Problem • Write a program HALT such that: • HALT(P)= yes, if P(P) halts • HALT(P)= no, if P(P) does not halt

  12. The Halting Problem • Write a program HALT such that: • HALT(P)= yes, if PK • HALT(P)= no, if PK • HALTS decides whether or not any given program is in K.

  13. THEOREM: There is no program to solve the halting problem(Alan Turing 1937) • Suppose a program HALT, solving the halting problem, existed: • HALT(P)= yes, if P(P) halts • HALT(P)= no, if P(P) does not halt • We will call HALT as a subroutine in a new program called CONFUSE.

  14. CONSUSE(P): • If HALT(P) then loop_for_ever • Else return (i.e., halt) • <text of subroutine HALT goes here> • -------------------------------------------- • Does CONFUSE(CONFUSE) halt? • YES implies HALT(CONFUSE) = yes • thus, CONFUSE(CONSFUSE) will not halt • NO implies HALT(CONFUSE) = no • thus, CONFUSE(CONFUSE) halts

  15. CONSUSE(P): • If HALT(P) then loop_for_ever • Else return (i.e., halt) • <text of subroutine HALT goes here> • -------------------------------------------- • Does CONFUSE(CONFUSE) halt? • YES implies HALT(CONFUSE) = yes • thus, CONFUSE(CONSFUSE) will not halt • NO implies HALT(CONFUSE) = no • thus, CONFUSE(CONFUSE) halts CONTRADICTION

  16. Turing’s argument is essentially the reincarnation of the DIAGONALIZATION argument from the theory of infinities.

  17. YES, if Pi(Pj) halts No, otherwise

  18. C O N F U S E di = HALT(Pi) CONFUSE(Pi) halts iff di = noThe CONFUSE row contains the negation of the diagonal.

  19. Is there a real number that can be described, but not computed?

  20. Consider the real number whose binary expansion has a 1 in the ith position iff PiK.

  21. Alan Turing (1912-1954)

  22. Computability Theory:Vocabulary Lesson • We call a set S*decidable or recursive if there is a program P such that: • P(x)=yes, if xS • P(x)=no, if xS • We already know: K is undecidable

  23. Now that we have established that the Halting Set is undecidable, we can use it for a jumping off points for more “natural” undecidability results.

  24. Is xS? YES/NO Oracle for S Oracle For Set S

  25. Does [I:=P;Q] halt? BUILD:Oracle for K GIVEN:Oracle for K0 K0= the set of programs that take no input and halt P = [input I; Q]Does P(P) halt?

  26. Thus, if K0 were decidable then K would be as well. We already K is not decidable, hence K0 is not decidable.

  27. Let P’ be P with all print statements removed. [P’; print HELLO] is a hello program? BUILD:Oracle for K0 GIVEN:HELLO Oracle HELLO = the set of program that print hello and halt Does P halt?

  28. HELLO is not decidable.

  29. Let HI = [print HELLO] Are P and HI equal? BUILD:HELLOOracle GIVEN:EQUALOracle EQUAL = All <P,Q> such that P and Q have identical output behavior on all inputs Does P equal HELLO ?

  30. EQUAL is not decidable.

  31. A subtlety. K is undecidable, but we can write a program to enumerate its elements. Can you see how to do this?

  32. Theorem: K can be enumerated by a computer program • Proof: Timesharing (Dovetailing) • Output the name of any machine that halts: • Run P1(P1) for 1 step • Run P1(P1) for 1 step • Run P2(P2) for 1 step • Run P1(P1) for 1 step • Run P2(P2) for 1 step • Run P3(P3) for 1 step …

  33. Theorem: The complement of K can’t be enumerated • Proof: Enumerate both K and its complement. To decide x in K for any x, just wait until x appears in one of the two lists.

  34. Many “simple” problems are undecidable • Does a given initial configuration in the game of Life go on forever? • Do two given Context Free Grammars generate the same language? • Given a multi-variate polynomial over the integers, does it have an integer root?

  35. PHILOSOPHICAL INTERLUDE

  36. CHURCH-TURING THESIS • Any computational method that can be grasped and performed by the human mind, can be performed on a conventional digital computer.

  37. The Church-Turing Thesis is NOT a theorem. It is a statement of belief concerning the universe we live in. • Your opinion will be influenced by your religious, scientific, and philosophical beliefs.

  38. Empirical Intuition • No one has ever given a counter-example to the Church-Turing thesis. I.e., no one has given a concrete example of something humans compute in a consistent and well defined way, but that can’t be programmed on a computer. The thesis is true.

  39. Mechanical Intuition • The brain is a machine. The components of the machine obey fixed physical laws. In principle, an entire brain can be simulated step by step on a digital computer. Thus, any thoughts of such a brain can be computed by a simulating computer. The thesis is true.

  40. Spiritual Intuition • The mind consists of part matter and part soul. Soul, by its very nature, defies reduction to physical law. Thus, the action and thoughts of the brain are not simulable or reducible to simple components and rules. The thesis is false.

  41. Quantum Intuition • The brain is a machine, but not a classical one. It is inherently quantum mechanical in nature and does not reduce to simple particles in motion. Thus, there are inherent barriers to being simulated on a digital computer. The thesis is false. However, the thesis is true if we allow quantum computers.

  42. There are many other viewpoints you might have concerning the Church-Turing Thesis. But this ain’t philosophy class!

  43. Self-Reference Puzzle • Write a program that prints itself out as output. No calls to the operating system, or to memory external to the program.

  44. Auto_Cannibal_Maker • Write a program Auto_Cannibal_Maker that takes the text of a program EAT as input and outputs a program called SELF. When SELF is executed it should output EAT(SELF)

  45. Foundation F • Let F be any foundation for mathematics: • F is a proof system that only proves true things • The set of valid proofs is computable. There is a program to check any candidate proof in this system

  46. INCOMPLETENESS • Let F be any attempt to give a foundation for mathematics • We will construct a statement that is provably true, but not not provable in F.

  47. CONFUSEF(P) • Loop though all sequences of symbols S • If S is a valid F-proof of “P halts”, • then LOOP_FOR_EVER • If S is a valid F-proof of “P never halts”, then HALT

  48. GODELF • GODELF= • AUTO_CANNIBAL_MAKER(CONFUSEF) • Thus, when we run GODELF it will do the same thing as: • CONFUSEF(GODELF)

  49. GODELF • Can F prove GODELF halts? • Yes -> CONFUSEF(GODELF) does not halt • Contradiction • Can F prove GODELF does not halt? • Yes -> CONFUSEF(GODELF) halts • Contradiction

  50. GODELF • F can’t prove or disprove that GODELF halts. • Thus CONFUSEF(GODELF) = GODELF will not halt. Thus, we have just proved what F can’t. • F can’t prove something that we know is true. It is not a complete foundation for mathematics.

More Related