DOC PREVIEW
Duke CPS 102 - Lecture 25

This preview shows page 1-2-3-4-31-32-33-34-35-64-65-66-67 out of 67 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 67 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 67 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 67 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 67 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 67 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 67 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 67 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 67 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 67 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 67 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 67 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 67 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 67 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 67 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Slide 1Turing’s Legacy: The Limits Of Computation.This lecture will change the way you think about computer programs…The HELLO assignmentGrading ScriptWhat does this do?Slide 7Nasty ProgramSlide 9Slide 10Slide 11Computable FunctionSlide 13Slide 14Uncountably many functionsSlide 16Slide 17Slide 18Notation And ConventionsThe meaning of P(P)The Halting Set KThe Halting ProblemThe Halting Problem K = {P | P(P) halts }THEOREM: There is no program to solve the halting problem (Alan Turing 1937)CONFUSESlide 26Alan Turing (1912-1954)Slide 28Slide 29Slide 30Slide 31Slide 32Slide 33Proof that RK cannot be computedComputability Theory: Vocabulary LessonDecidable and ComputableOracles and ReductionsOracle For Set SExample Oracle S = Odd NaturalsSlide 40Slide 41Slide 42Slide 43Slide 44Slide 45Slide 46Slide 47Diophantine EquationsResolution of Hilbert’s 10th Problem: Dramatis PersonaePolynomials can encode programs.Slide 51Slide 52Slide 53CHURCH-TURING THESISThe Church-Turing Thesis is NOT a theorem. It is a statement of belief concerning the universe we live in.Empirical IntuitionMechanical IntuitionQuantum IntuitionSlide 59Another important notionSlide 61Slide 62Enumerating KSlide 64Slide 65Slide 66Slide 67COMPSCI 102Introduction to Discrete MathematicsTuring’s Legacy: The Limits Of Computation.Anything says is false!This lecture will change the way you think about computer programs…Many questions which appear easy at first glance are impossible to solve in general.We’ll only be taking a brief look at a vast landscape in logic and computer science theory.The HELLO assignmentWrite 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.Grading ScriptThe 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?What does this do?_(__,___,____){___/__<=1?_(__,___+1,____):!(___%__)?_(__,___+1,0):___%__==___/ __&&!____?(printf("%d\t",___/__),_(__,___+1,0)):___%__>1&&___%__<___/__?_(__,1+ ___,____+!(___/__%(___%__))):___<__*__?_(__,___+1,____):0;}main(){_(100,0,0);}What kind of program could a student who hated his/her TA hand in?Note: This probablyisn’t the best ideafor how to do well onassignments.Nasty Programn:=0;while (n is not a counter-example to the Riemann Hypothesis) {n++;}print “Hello”;The nasty program is a PASS if and only if theRiemann Hypothesis is false.A TA nightmare: Despite the simplicity of the HELLO assignment, there is no program to correctly grade it! And we will prove this.The theory of what can and can’t be computed by an ideal computer is called Computability Theory or Recursion Theory.Are all reals describable?Are all reals computable?We saw thatcomputable  describable, but do we also havedescribable  computable?NONOFrom the last lecture:The “grading function” we just describedis not computable! (We’ll see a proof soon.)Computable FunctionFix any finite set of symbols, . Fix any precise programming language, e.g., Java. A program is any finite string of characters that is syntactically valid.A function f : Σ*Σ* is computable if there is a program P that when executed on an ideal computer, computes f. That is, for all strings x in Σ*, f(x) = P(x).Computable FunctionFix any finite set of symbols, . Fix any precise programming language, e.g., Java. A program is any finite string of characters that is syntactically valid.A function f : Σ*Σ* is computable if there is a program P that when executed on an ideal computer, computes f. That is, for all strings x in Σ*, f(x) = P(x).Hence: countably many computable functions!There are only countably many Java programs. Hence, there are only countably many computable functions.Uncountably many functionsThe functions f: *  {0,1} are in 1-1 onto correspondence with the subsets of * (the powerset of * ). Subset S of *  Function fS x in S  fS(x) = 1 x not in S  fS(x) = 0Uncountably many functionsThe functions f: *  {0,1} are in 1-1 onto correspondence with the subsets of * (the powerset of * ).Hence, the set of all f: Σ*  {0,1} has thesame size as the power set of Σ*. And since Σ* is countably infinite, its power set is uncountably infinite.Countably many computable functions.Uncountably manyfunctions from * to {0,1}.Thus, most functions from * to {0,1} are not computable.Can we explicitly describe an uncomputable function? Can we describe an interesting uncomputable function?Notation And ConventionsFix a single programming language (Java)When we write program P we are talking about the text of the source code for PP(x) means the output that arises from running program P on input x, assuming that P eventually halts.P(x) =  means P did not halt on xThe meaning of 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.The Halting Set KDefinition:K is the set of all programs P such that P(P) halts.K = { Java P | P(P) halts }The Halting ProblemIs there a program HALT such that:HALT(P) = yes, if P(P) haltsHALT(P) = no, if P(P) does not haltThe Halting ProblemK = {P | P(P) halts }Is there a program HALT such that:HALT(P) = yes, if PKHALT(P) = no, if PKHALT decides whether or not any given program is in K.THEOREM: There is no program to solve the halting problem(Alan Turing 1937)Suppose a program HALT existed that solved the halting problem.HALT(P) = yes, if P(P) haltsHALT(P) = no, if P(P) does not haltWe will call HALT as a subroutine in a new program called CONFUSE.CONFUSECONFUSE(P){ if (HALT(P)) then loop forever; //i.e., we dont halt else exit; //i.e., we halt // text of HALT goes here}Does CONFUSE(CONFUSE) halt?CONFUSECONFUSE(P){ if (HALT(P)) then loop forever; //i.e., we dont halt else exit; //i.e., we halt // text of HALT goes here }Suppose CONFUSE(CONFUSE) halts then HALT(CONFUSE) = TRUE CONFUSE will loop forever on input CONFUSESuppose CONFUSE(CONFUSE) does not halt then HALT(CONFUSE) = FALSE CONFUSE will halt on input CONFUSECONTRADICTIONAlan Turing (1912-1954)Theorem: [1937]There is no program to solve the halting problemTuring’s argument is essentially the reincarnation of Cantor’s Diagonalization


View Full Document

Duke CPS 102 - Lecture 25

Documents in this Course
Lecture

Lecture

34 pages

Lecture

Lecture

42 pages

Lecture

Lecture

46 pages

Lecture

Lecture

77 pages

Notes

Notes

17 pages

Notes

Notes

52 pages

Lecture 9

Lecture 9

72 pages

Lecture

Lecture

7 pages

Lecture

Lecture

11 pages

Lecture

Lecture

28 pages

Lecture

Lecture

25 pages

Forbes

Forbes

9 pages

Lecture

Lecture

53 pages

Lecture

Lecture

21 pages

Lecture 4

Lecture 4

54 pages

Lecture

Lecture

24 pages

Lecture

Lecture

46 pages

Lecture

Lecture

16 pages

Lecture

Lecture

7 pages

Lecture

Lecture

46 pages

Graphs II

Graphs II

34 pages

Lecture

Lecture

81 pages

Lecture

Lecture

46 pages

Load more
Download Lecture 25
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture 25 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 25 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?