russell’s paradox and the halting problem

26
Russell’s Paradox and the Halting Problem Lecture 24 Section 5.4 Wed, Feb 23, 2005

Upload: yered

Post on 22-Feb-2016

63 views

Category:

Documents


0 download

DESCRIPTION

Russell’s Paradox and the Halting Problem. Lecture 24 Section 5.4 Wed, Feb 23, 2005. Trends. Homework Trend. 100%. 90%. 80%. 70%. 60%. Average Grade. 50%. 40%. 30%. 20%. 10%. 0%. 1. 2. 3. 4. Assignment. Russell’s Paradox. Let A be any set that you have ever seen. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Russell’s Paradox and the Halting Problem

Russell’s Paradox and the Halting Problem

Lecture 24Section 5.4Wed, Feb 23, 2005

Page 2: Russell’s Paradox and the Halting Problem

Trends

Homework Trend

0%

10%

20%

30%

40%

50%

60%

70%

80%

90%

100%

1 2 3 4

Assignment

Aver

age

Gra

de

Page 3: Russell’s Paradox and the Halting Problem

Russell’s Paradox

Let A be any set that you have ever seen. Then, most likely, A A. For example

A set of integers is not itself an integer.A set of rectangles is not itself a rectangle.A set of points in the plane is not itself a

point in the plane. Is it possible that A A for some set A?

Page 4: Russell’s Paradox and the Halting Problem

Russell’s Paradox

Let S = {A | A A}. Let P(x) be the predicate “x x.” Is S S?

If S S, then • S satisfies the predicate.• So P(S) is true.• But P(S) says that S S.

Page 5: Russell’s Paradox and the Halting Problem

Russell’s Paradox

If S S, then• S does not satisfy the predicate.• So P(S) is false• But that means that S S.

Therefore, “S S” is neither true nor false. This is a paradox.

Page 6: Russell’s Paradox and the Halting Problem

The Barber Paradox

In a certain town, there is a barber who cuts the hair of every person (them and only them) in the town who does not cut his own hair.

Question: who cuts the barber’s hair?

Page 7: Russell’s Paradox and the Halting Problem

The Halting Problem

Let P be a computer program, encoded in binary.

Let I be input to the program, encoded in binary.

We can “run P on I.” There are two possibilities

P halts on I.P runs forever on I.

Page 8: Russell’s Paradox and the Halting Problem

The Program P with Input I

P

I

P halts on I

P

I

P runs forever on I

Page 9: Russell’s Paradox and the Halting Problem

The Halting Problem

Does there exist a computer program that can read any computer program P and any input I, both in binary, and determine whether P will halt on I?

Suppose there is such a program. Call it CheckHalt.

When we run CheckHalt(P, I), it determines whether P halts on I.

Page 10: Russell’s Paradox and the Halting Problem

The Program CheckHalt

CheckHalt

P, I

P halts on I

CheckHalt

P, I

P runs forever on I

yes no

Page 11: Russell’s Paradox and the Halting Problem

The Halting Problem

Write a program called Test that will Read a program P in binary.Run CheckHalt(P, P).If CheckHalt reports that

• P halts on P, then Test goes into an infinite loop.• P runs forever on P, then Test halts.

Page 12: Russell’s Paradox and the Halting Problem

The Program Test

CheckHaltP P, P

Test

yes

no yes

Page 13: Russell’s Paradox and the Halting Problem

The Halting Problem

What happens when we run Test(Test)? If CheckHalt reports that

Test halts on Test, then Test runs forever.Test runs forever on Test, then Test halts.

Page 14: Russell’s Paradox and the Halting Problem

The Program Test

CheckHaltTest Test, Test

Test

yes

no yes

Page 15: Russell’s Paradox and the Halting Problem

The Program Test

CheckHaltTest Test, Test

Test

yes

no yes

Page 16: Russell’s Paradox and the Halting Problem

The Program Test

CheckHaltTest Test, Test

Test

yes

no yes

If CheckHalt says Test halts on Test…

Page 17: Russell’s Paradox and the Halting Problem

The Program Test

CheckHaltTest Test, Test

Test

yes

no yes

…then Test runs forever on Test.

Page 18: Russell’s Paradox and the Halting Problem

The Program Test

CheckHaltTest Test, Test

Test

yes

no yes

If CheckHalt says Test runs forever on Test…

Page 19: Russell’s Paradox and the Halting Problem

The Program Test

CheckHaltTest Test, Test

Test

yes

no yes

…then Test halts on Test.

Page 20: Russell’s Paradox and the Halting Problem

The Halting Problem

Both possibilities are contradictions. Therefore, no such program CheckHalt

exists. That is, it is impossible to write a program

that has the ability to inspect any program and any input and determine whether the program will halt on that input.

Page 21: Russell’s Paradox and the Halting Problem

The Halting Problem

This does not mean that we can never tell whether a given program halts on a given input.

It just says that we cannot always tell.

Page 22: Russell’s Paradox and the Halting Problem

Other Undecidable Problems

It is also impossible to write a program that has the ability to inspect any other program and determine whether itHalts on all inputs.Halts on input 0.Outputs 2x on input x (computes f(x) = 2x).Outputs 1 on input 0.

These problems are called undecidable.

Page 23: Russell’s Paradox and the Halting Problem

An Interesting “Theorem”

Theorem: This theorem has no proof. Can you prove this theorem? Is this theorem true?

If this theorem were false, then it would have a proof.

But you can’t prove a false theorem.Therefore, it must be true.

Doesn’t that constitute a proof?

Page 24: Russell’s Paradox and the Halting Problem

The Berry Paradox

Consider the set A of all positive integers that can be described using fifty English words or less.“one”“the square of eleven”“the millionth prime”“the millionth prime times the billionth

prime, plus ten”

Page 25: Russell’s Paradox and the Halting Problem

The Berry Paradox

Let B = N – A. That is, B is the set of all positive integers

that cannot be described using fifty English words or less.

B is not empty. (Why?) What is the smallest number in B? It is called the Berry number, after G. G.

Berry, an Oxford University librarian.

Page 26: Russell’s Paradox and the Halting Problem

The Berry Paradox

Whatever it is, it is “the smallest positive integer that cannot be described using fifty English words or less.”

But that description uses less than 50 English words and it describes that number.

See The Berry Paradox.