COMPSCI 102 Introduction to Discrete Mathematics Turings Legacy

  • Slides: 67
Download presentation
COMPSCI 102 Introduction to Discrete Mathematics

COMPSCI 102 Introduction to Discrete Mathematics

Turing’s Legacy: The Limits Of Computation. Anything says is false!

Turing’s Legacy: The Limits Of Computation. Anything says is false!

This lecture will change the way you think about computer programs… Many questions which

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 assignment Write a JAVA program to output the word “HELLO” on the

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.

Grading Script The grading script G must be able to take any Java program

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?

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

What kind of program could a student who hated his/her TA hand in? Note: This probably isn’t the best idea for how to do well on assignments.

Nasty Program n: =0; while (n is not a counter-example to the Riemann Hypothesis)

Nasty Program n: =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 the Riemann Hypothesis is false.

A TA nightmare: Despite the simplicity of the HELLO assignment, there is no program

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

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

From the last lecture: Are all reals describable? Are all reals computable? NO NO

From the last lecture: Are all reals describable? Are all reals computable? NO NO We saw that computable describable, but do we also have describable computable? The “grading function” we just described is not computable! (We’ll see a proof soon. )

Computable Function Fix any finite set of symbols, . Fix any precise programming language,

Computable Function Fix 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 Function Fix any finite set of symbols, . Fix any precise programming language,

Computable Function Fix 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

There are only countably many Java programs. Hence, there are only countably many computable functions.

Uncountably many functions The functions f: * {0, 1} are in 1 -1 onto

Uncountably many functions The functions f: * {0, 1} are in 1 -1 onto correspondence with the subsets of * (the powerset of * ). Subset S of * Function f. S x in S x not in S f. S(x) = 1 f. S(x) = 0

Uncountably many functions The functions f: * {0, 1} are in 1 -1 onto

Uncountably many functions The 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 the same size as the power set of Σ*. And since Σ* is countably infinite, its power set is uncountably infinite.

Countably many computable functions. Uncountably many functions from * to {0, 1}. Thus, most

Countably many computable functions. Uncountably many functions 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?

Can we explicitly describe an uncomputable function? Can we describe an interesting uncomputable function?

Notation And Conventions Fix a single programming language (Java) When we write program P

Notation And Conventions Fix a single programming language (Java) 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, assuming that P eventually halts. P(x) = means P did not halt on x

The meaning of P(P) It follows from our conventions that P(P) means the output

The 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 K Definition: K is the set of all programs P such

The Halting Set K Definition: K is the set of all programs P such that P(P) halts. K = { Java P | P(P) halts }

The Halting Problem Is there a program HALT such that: HALT(P) = yes, if

The Halting Problem Is there a program HALT such that: HALT(P) = yes, if P(P) halts no, if P(P) does not halt

The Halting Problem K = {P | P(P) halts } Is there a program

The Halting Problem K = {P | P(P) halts } Is there a program HALT such that: HALT(P) = yes, if P K no, if P K HALT decides whether or not any given program is in K.

THEOREM: There is no program to solve the halting problem (Alan Turing 1937) Suppose

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) halts no, if P(P) does not halt We will call HALT as a subroutine in a new program called CONFUSE.

CONFUSE(P) { if (HALT(P)) then loop forever; else exit; // text of HALT goes

CONFUSE(P) { if (HALT(P)) then loop forever; else exit; // text of HALT goes here } //i. e. , we dont halt //i. e. , we halt Does CONFUSE(CONFUSE) halt?

CONFUSE(P) { if (HALT(P)) then loop forever; else exit; // text of HALT goes

CONFUSE(P) { if (HALT(P)) then loop forever; else exit; // text of HALT goes here } //i. e. , we dont halt //i. e. , we halt Suppose CONFUSE(CONFUSE) halts then HALT(CONFUSE) = TRUE CONFUSE will loop forever on input CONFUSE Suppose CONFUSE(CONFUSE) does not halt CONTRADICTIO then HALT(CONFUSE) N = FALSE CONFUSE will halt on input CONFUSE

Alan Turing (1912 -1954) Theorem: [1937] There is no program to solve the halting

Alan Turing (1912 -1954) Theorem: [1937] There is no program to solve the halting problem

Turing’s argument is essentially the reincarnation of Cantor’s Diagonalization argument that we saw in

Turing’s argument is essentially the reincarnation of Cantor’s Diagonalization argument that we saw in the previous lecture.

All Programs (the input) All Programs P 0 P 1 P 2 … Pj

All Programs (the input) All Programs P 0 P 1 P 2 … Pj … P 0 P 1 … Pi … Programs (computable functions) are countable, so we can put them in a (countably long) list

All Programs (the input) All Programs P 0 P 1 P 2 … Pj

All Programs (the input) All Programs P 0 P 1 P 2 … Pj … P 0 P 1 … Pi … YES, if Pi(Pj) halts No, otherwise

All Programs (the input) All Programs P 0 P 1 … Pi … P

All Programs (the input) All Programs P 0 P 1 … Pi … P 1 P 2 … Pj … … Let di = HALT(Pi) d 0 d 1 … di CONFUSE(Pi) halts iff di = no (The CONFUSE function is the negation of the diagonal. ) Hence CONFUSE cannot be on this list.

From last lecture: Is there a real number that can be described, but not

From last lecture: Is there a real number that can be described, but not computed?

Consider the real number RK whose binary expansion has a 1 in the jth

Consider the real number RK whose binary expansion has a 1 in the jth position iff Pj K (i. e. , if the jth program halts).

Proof that RK cannot be computed Suppose it is, and program FRED computes it.

Proof that RK cannot be computed Suppose it is, and program FRED computes it. then consider the following program: MYSTERY(program text P) for j = 0 to forever do { if (P == Pj) then use FRED to compute jth bit of RK return YES if (bit == 1), NO if (bit == 0) } MYSTERY solves the halting problem!

Computability Theory: Vocabulary Lesson We call a set S * decidable or recursive if

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: the halting set K is undecidable

Decidable and Computable Subset S of * Function f. S x in S x

Decidable and Computable Subset S of * Function f. S x in S x not in S f. S(x) = 1 f. S(x) = 0 Set S is decidable function f. S is computable Sets are “decidable” (or undecidable), whereas functions are “computable” (or not)

Oracles and Reductions

Oracles and Reductions

Oracle For Set S Is x S? YES/NO Oracle for S

Oracle For Set S Is x S? YES/NO Oracle for S

Example Oracle S = Odd Naturals 4? No 81? Yes Oracle for S

Example Oracle S = Odd Naturals 4? No 81? Yes Oracle for S

K 0= the set of programs that take no input and halt Hey, I

K 0= the set of programs that take no input and halt Hey, I ordered an oracle for the famous halting set K, but when I opened the package it was an oracle for the different set K 0. GIVEN: Oracle for K 0 But you can use this oracle for K 0 to build an oracle for K.

K 0= the set of programs that take no input and halt P =

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

We’ve reduced the problem of deciding membership in K to the problem of deciding

We’ve reduced the problem of deciding membership in K to the problem of deciding membership in K 0. Hence, deciding membership for K 0 must be at least as hard as deciding membership for K.

Thus if K 0 were decidable then K would be as well. We already

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

HELLO = the set of programs that print hello and halt Does P halt?

HELLO = the set of programs that print hello and halt Does P halt? Let P’ be P with all print statements removed. (assume there are no side effects) Is [P’; print HELLO] a hello program? BUILD: Oracle for K 0 GIVEN: HELLO Oracle

Hence, the set HELLO is not decidable.

Hence, the set HELLO is not decidable.

EQUAL = All <P, Q> such that P and Q have identical output behavior

EQUAL = All <P, Q> such that P and Q have identical output behavior on all inputs Is P in set HELLO? Let HI = [print HELLO] Are P and HI equal? BUILD: HELLO Oracle GIVEN: EQUAL Oracle

Halting with input, Halting without input, HELLO, and EQUAL are all undecidable.

Halting with input, Halting without input, HELLO, and EQUAL are all undecidable.

Diophantine Equations Does polynomial 4 X 2 Y + XY 2 + 1 =

Diophantine Equations Does polynomial 4 X 2 Y + XY 2 + 1 = 0 have an integer root? I. e. , does it have a zero at a point where all variables are integers? D = {multivariate integer polynomials P | P has a root where all variables are integers} Famous Theorem: D is undecidable! [This is the solution to Hilbert’s 10 th problem] Hilbert

http: //www. goldenmuseum. com/1612 Hilbert_engl. html Resolution of Hilbert’s 10 th Problem: Dramatis Personae

http: //www. goldenmuseum. com/1612 Hilbert_engl. html Resolution of Hilbert’s 10 th Problem: Dramatis Personae Martin Davis, Julia Robinson, Yuri Matiyasevich (1982) and…

Polynomials can encode programs. There is a computable function F: Java programs that take

Polynomials can encode programs. There is a computable function F: Java programs that take no input Polynomials over the integers Such that program P halts F(P) has an integer root

D = the set of all integer polynomials with integer roots Does program P

D = the set of all integer polynomials with integer roots Does program P halt? F(P) has integer root? BUILD: HALTING Oracle GIVEN: Oracle for D

Problems that have no obvious relation to halting, or even to computation can encode

Problems that have no obvious relation to halting, or even to computation can encode the Halting Problem is non-obvious ways.

PHILOSOPHICAL INTERLUDE

PHILOSOPHICAL INTERLUDE

CHURCH-TURING THESIS Any well-defined procedure that can be grasped and performed by the human

CHURCH-TURING THESIS Any well-defined procedure that can be grasped and performed by the human mind and pencil/paper, can be performed on a conventional digital computer with no bound on memory.

The Church-Turing Thesis is NOT a theorem. It is a statement of belief concerning

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… …mileage may vary

Empirical Intuition No one has ever given a counterexample to the Church-Turing thesis. I.

Empirical Intuition No one has ever given a counterexample 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.

Mechanical Intuition The brain is a machine. The components of the machine obey fixed

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.

Quantum Intuition The brain is a machine, but not a classical one. It is

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, thesis is true if we allow quantum computers.

There are many other viewpoints you might have concerning the Church-Turing Thesis. But this

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

Another important notion

Another important notion

Computability Theory: Vocabulary Lesson We call a set S * enumerable or recursively enumerable

Computability Theory: Vocabulary Lesson We call a set S * enumerable or recursively enumerable (r. e. ) if there is a program P such that: P prints an (infinite) list of strings. • Any element on the list should be in S. • Each element in S appears after a finite amount of time.

Is the halting set K enumerable?

Is the halting set K enumerable?

Enumerating K Enumerate. K { for n = 0 to forever { for W

Enumerating K Enumerate. K { for n = 0 to forever { for W = all strings of length < n do { if W(W) halts in n steps then output W; } } }

K is not decidable, but it is enumerable! Let K’ = { Java P

K is not decidable, but it is enumerable! Let K’ = { Java P | P(P) does not halt} Is K’ enumerable? If both K and K’ are enumerable, then K is decidable. (why? )

Now that we have established that the Halting Set is undecidable, we can use

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.

Do these theorems about the limitations of computation tell us something about the limitations

Do these theorems about the limitations of computation tell us something about the limitations of human thought?

Thanks to John Lafferty for his slides from the Fall 2006 incarnation of 15251.

Thanks to John Lafferty for his slides from the Fall 2006 incarnation of 15251. They served as the basis for this lecture.