Presentation is loading. Please wait.

Presentation is loading. Please wait.

Self-Reference And Undecidability

Similar presentations


Presentation on theme: "Self-Reference And Undecidability"— Presentation transcript:

1 Self-Reference And Undecidability
Great Theoretical Ideas In Computer Science Self-Reference And Undecidability Anything says is false! Lecture 12 CS

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 How exactly might such a script work?
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 Theory or 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 If HALT(P) then loop_for_ever Else return (i.e., halt)
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 P0 P1 P2 Pj Pi YES, if Pi(Pj) halts No, otherwise

18 P0 P1 P2 Pj d0 d1 Pi di C O N F U S E di = HALT(Pi) CONFUSE(Pi) halts iff di = no The 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 ( )

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 Oracle For Set S Oracle for S Is xS? YES/NO

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

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

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

28 HELLO is not decidable.

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

30 EQUAL is not decidable.

31 Can you see how to do this?
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 P2(P2) for 1 step Run P1(P1) 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
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 But this ain’t philosophy class!
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

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.

51 CONCLUSION No fixed set of assumptions F can provide a complete foundation for mathematical proof. In particular, it can’t prove the true statement that GODELF does not halt. No formal system can capture our ability to reason logically and mathematically!

52 GÖDEL’S INCOMPLETENESS THEOREM
In 1931, Gödel stunned the world by proving that for any consistent axioms F there is a true statement of first order number theory that is not provable or disprovable by F. I.e., a true statement that can be made using 0, 1, plus, times, for every, there exists, AND, OR, NOT, parentheses, and variables that refer to natural numbers.

53 ENDNOTE You might think that Gödel’s theorem proves that are mathematically capable in ways that computers are not. This would show that the Church-Turing Thesis is wrong. Gödel’s theorem proves no such thing!

54 BUT this ain’t philosophy class!


Download ppt "Self-Reference And Undecidability"

Similar presentations


Ads by Google