russell’s paradox and the halting problem

Post on 22-Feb-2016

66 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

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

Russell’s Paradox and the Halting Problem

Lecture 24Section 5.4Wed, Feb 23, 2005

Trends

Homework Trend

0%

10%

20%

30%

40%

50%

60%

70%

80%

90%

100%

1 2 3 4

Assignment

Aver

age

Gra

de

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?

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.

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.

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?

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.

The Program P with Input I

P

I

P halts on I

P

I

P runs forever on I

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.

The Program CheckHalt

CheckHalt

P, I

P halts on I

CheckHalt

P, I

P runs forever on I

yes no

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.

The Program Test

CheckHaltP P, P

Test

yes

no yes

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.

The Program Test

CheckHaltTest Test, Test

Test

yes

no yes

The Program Test

CheckHaltTest Test, Test

Test

yes

no yes

The Program Test

CheckHaltTest Test, Test

Test

yes

no yes

If CheckHalt says Test halts on Test…

The Program Test

CheckHaltTest Test, Test

Test

yes

no yes

…then Test runs forever on Test.

The Program Test

CheckHaltTest Test, Test

Test

yes

no yes

If CheckHalt says Test runs forever on Test…

The Program Test

CheckHaltTest Test, Test

Test

yes

no yes

…then Test halts on Test.

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.

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.

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.

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?

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”

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.

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.

top related