COMPSCI 102
Download
1 / 67

COMPSCI 102 - PowerPoint PPT Presentation


  • 91 Views
  • Uploaded on

COMPSCI 102. Introduction to Discrete Mathematics. 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 appear easy at first glance are impossible to solve in general.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'COMPSCI 102' - grace


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
Slide1 l.jpg

COMPSCI 102

Introduction to Discrete Mathematics


Turing s legacy the limits of computation l.jpg

Turing’s Legacy: The Limits Of Computation.

Anything

says is false!


This lecture will change the way you think about computer programs l.jpg
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 l.jpg
The HELLO assignment programs…

  • 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 l.jpg
Grading Script programs…

  • 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 does this do l.jpg
What does this do? programs…

  • _(__,___,____){___/__<=1?_(__,___+1,____):!(___%__)?_(__,___+1,0):___%__==___/ __&&!____?(printf("%d\t",___/__),_(__,___+1,0)):___%__>1&&___%__<___/__?_(__,1+ ___,____+!(___/__%(___%__))):___<__*__?_(__,___+1,____):0;}main(){_(100,0,0);}


Slide7 l.jpg

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

Note: This probably

isn’t the best idea

for how to do well on

assignments.


Nasty program l.jpg
Nasty Program programs…

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


Slide9 l.jpg

A TA nightmare: Despite the simplicity of the HELLO assignment, there is no program to correctly grade it!

And we will prove this.


Slide10 l.jpg

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


Slide11 l.jpg

Are all reals describable? computer is called

Are all reals computable?

We saw thatcomputable describable,

but do we also havedescribable  computable?

NO

NO

From the last lecture:

The “grading function” we just described

is not computable! (We’ll see a proof soon.)


Computable function l.jpg
Computable Function computer is called

  • 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 function13 l.jpg
Computable Function computer is called

  • 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!


Slide14 l.jpg

There are only countably many Java programs. computer is called

Hence, there are only countably many computable functions.


Uncountably many functions l.jpg
Uncountably many functions computer is called

  • The 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) = 0


Uncountably many functions16 l.jpg
Uncountably many functions computer is called

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


Slide17 l.jpg

Countably many computer is called computable functions.

Uncountably manyfunctions from * to {0,1}.

Thus, most functions from * to {0,1} are not computable.


Slide18 l.jpg

Can we explicitly computer is called describe an uncomputable function?

Can we describe an interesting uncomputable function?


Notation and conventions l.jpg
Notation And Conventions computer is called

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 l.jpg
The meaning of P(P) computer is called

  • 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 l.jpg
The Halting Set K computer is called

  • Definition:

  • K is the set of all programs P such that P(P) halts.

  • K = { Java P | P(P) halts }


The halting problem l.jpg
The Halting Problem computer is called

  • Is there a program HALT such that:

  • HALT(P) = yes, if P(P) halts

  • HALT(P) = no, if P(P) does not halt


The halting problem k p p p halts l.jpg
The Halting Problem computer is called K = {P | P(P) halts }

  • Is there a program HALT such that:

  • HALT(P) = yes, if PK

  • HALT(P) = 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 l.jpg
THEOREM: There is no program to solve the halting problem computer is called (Alan Turing 1937)

  • Suppose a program HALT existed that solved the halting problem.

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


Confuse l.jpg
CONFUSE computer is called

  • CONFUSE(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?


Confuse26 l.jpg
CONFUSE computer is called

  • CONFUSE(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 CONFUSE

  • Suppose CONFUSE(CONFUSE) does not halt

  • then HALT(CONFUSE) = FALSE

  •  CONFUSE will halt on input CONFUSE

CONTRADICTION


Alan turing 1912 1954 l.jpg
Alan Turing (1912-1954) computer is called

Theorem: [1937]

There is no program to solve the halting problem


Slide28 l.jpg

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


Slide29 l.jpg

All Programs (the input) Cantor’s

All Programs

Programs (computable functions) are countable,

so we can put them in a (countably long) list


Slide30 l.jpg

All Programs (the input) Cantor’s

All Programs

YES, if Pi(Pj) halts

No, otherwise


Slide31 l.jpg

All Programs (the input) Cantor’s

All Programs

Let

di = HALT(Pi)

CONFUSE(Pi) halts iff di = no(The CONFUSE function is the negation of the diagonal.)

Hence CONFUSE cannot be on this list.


Slide32 l.jpg

From last lecture: Cantor’s

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


Slide33 l.jpg

Consider the real number Cantor’s RK whose binary expansion has a 1 in the jth position iff PjK

(i.e., if the jth program halts).


Proof that r k cannot be computed l.jpg
Proof that R Cantor’s K 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 l.jpg
Computability Theory: Cantor’s 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 l.jpg
Decidable and Computable Cantor’s

  • Subset S of * Function fS

  • x in S  fS(x) = 1

  • x not in S  fS(x) = 0

  • Set S is decidable  function fS is computable

  • Sets are “decidable” (or undecidable), whereas

  • functions are “computable” (or not)



Oracle for set s l.jpg

Is x Cantor’s S?

YES/NO

Oracle for S

Oracle For Set S


Example oracle s odd naturals l.jpg

81? Cantor’s

4?

No

Yes

Oracle for S

Example OracleS = Odd Naturals


Slide40 l.jpg

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

GIVEN:Oracle for K0

K0= the set of programs that take no input and halt

But you can use this oracle for K0

to build an oracle for K.


Slide41 l.jpg

Does [I:=P;Q] halt? when I opened the package it was an oracle for the different set K

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?


Slide42 l.jpg

We’ve when I opened the package it was an oracle for the different set Kreduced the problem of deciding membership in K to the problem of deciding membership in K0.

Hence, deciding membership for K0 must be at least as hard as deciding membership for K.


Slide43 l.jpg

Thus if K when I opened the package it was an oracle for the different set K0 were decidable then K would be as well.

We already know K is not decidable, hence K0 is not decidable.


Slide44 l.jpg

BUILD: when I opened the package it was an oracle for the different set KOracle for K0

GIVEN:HELLO Oracle

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?


Slide45 l.jpg

Hence, the set HELLO is not decidable. when I opened the package it was an oracle for the different set K


Slide46 l.jpg

Let HI = [print HELLO] when I opened the package it was an oracle for the different set K

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

Is P in set HELLO?


Slide47 l.jpg

Halting with input, Halting without input, when I opened the package it was an oracle for the different set K

HELLO, and

EQUAL are all undecidable.


Diophantine equations l.jpg
Diophantine Equations when I opened the package it was an oracle for the different set K

  • Does polynomial 4X2Y + XY2 + 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 10th problem]

Hilbert


Resolution of hilbert s 10 th problem dramatis personae l.jpg
Resolution of Hilbert’s 10 when I opened the package it was an oracle for the different set Kth Problem: Dramatis Personae

  • Martin Davis, Julia Robinson, Yuri Matiyasevich (1982)

  • http://www.goldenmuseum.com/1612Hilbert_engl.html

and…


Polynomials can encode programs l.jpg
Polynomials can encode programs. when I opened the package it was an oracle for the different set K

  • 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


Slide51 l.jpg

F(P) has when I opened the package it was an oracle for the different set K

integer root?

BUILD:HALTINGOracle

GIVEN:

Oracle for D

D = the set of all integer polynomials with integer roots

Does program P halt?


Slide52 l.jpg

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


Slide53 l.jpg

PHILOSOPHICAL to computation can encode the Halting Problem is non-obvious ways.

INTERLUDE


Church turing thesis l.jpg
CHURCH-TURING THESIS to computation can encode the Halting Problem is non-obvious ways.

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


Slide55 l.jpg
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 l.jpg
Empirical Intuition of belief concerning the universe we live in.

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


Mechanical intuition l.jpg
Mechanical Intuition of belief concerning the universe we live in.

  • 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 l.jpg
Quantum Intuition of belief concerning the universe we live in.

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


Slide59 l.jpg

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

But this ain’t philosophy class!


Another important notion l.jpg

Another important notion the Church-Turing Thesis.


Computability theory vocabulary lesson61 l.jpg
Computability Theory: the Church-Turing Thesis.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.


Slide62 l.jpg

Is the Church-Turing Thesis.the halting set K enumerable?


Enumerating k l.jpg
Enumerating K the Church-Turing Thesis.

  • EnumerateK {

  • for n = 0 to forever {

  • for W = all strings of length < n do {

  • if W(W) halts in n steps then output W;

  • }

  • }

  • }


Slide64 l.jpg

K is the Church-Turing Thesis.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?)


Slide65 l.jpg

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.


Slide66 l.jpg

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


Slide67 l.jpg