 Download Presentation Self-Reference And Undecidability Self-Reference And Undecidability - PowerPoint PPT Presentation

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. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - - 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. 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

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

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

7. 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

8. 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.

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

10. 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

11. 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.

12. 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.

13. 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

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 CONTRADICTION

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

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

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

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

19. Alan Turing (1912-1954)

20. 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

21. 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.

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

23. 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?

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

25. 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?

26. HELLO is not decidable.

27. 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 ?

28. EQUAL is not decidable.

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

30. 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 …

31. 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.

32. 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?

33. PHILOSOPHICAL INTERLUDE

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

35. 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.

36. 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.

37. 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.

38. 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.

39. 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.

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

41. 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.

42. 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)

43. 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

44. 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.

45. 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

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

47. 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

48. 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.