39
cs1120 Fall 2011 | David Evans | 14 November 2011 Class 35: Self-Reference

Class 35: Self-Reference

Embed Size (px)

DESCRIPTION

The true story of EpimenidesGoedel's ProofIntroducing Computability

Citation preview

Page 1: Class 35: Self-Reference

cs1120 Fall 2011 | David Evans | 14 November 2011

Class 35:Self-Reference

Page 2: Class 35: Self-Reference

2

AnnouncementsDon’t forget to submit your PS8 choice before 5pm today!

If you don’t submit anything, you are expected to do all three options!

Friday’s Class: Rice Hall Dedication11am: Dedication12-3pm: Tours (Visit our lab in Rice 442)3pm: Dean Kamen talk5pm: Scavenger Hunt

Page 3: Class 35: Self-Reference

3

Exam 2

Out: Monday, 21 November (one week from today)Due: Wednesday, 30 November, 11:01amCovers everything in the course

Classes 1-37 (through Friday’s class – yes there may be a question about Rice Dedication)Course book Chapters 1-12 (Entire book!)Problem Sets 1-7 (and posted comments)

Emphasis on material since Exam 1You will be allowed to use Scheme, Python, and Charme

interpreters

Page 4: Class 35: Self-Reference

4

Recap Last Class

Since Aristotle, humans have been trying to formalize reasoning.

An axiomatic system is a set of axioms and inference rules.

Russell and Whitehead wrote Principia Mathematica (1910-1913) to formalize all number knowledge as an axiomatic system.

Encountered paradoxes…but claimed a complete and consistent system.

Page 5: Class 35: Self-Reference

5

Epimenides “Paradox”

Greece

Crete

Page 6: Class 35: Self-Reference

6

In its absolutely barest form, Gödel’s discovery involves the translation of an ancient paradox in philosophy into mathematical terms. That paradox is the so-called Epimenides paradox, or liar paradox. Epimenides was a Cretan who made one immortal statement: “All Cretans are liars.” A sharper version of the statement is simply “I am lying”; or, “This statement is false.”

Page 7: Class 35: Self-Reference

7

What Epimenides Really Said

Τύμβον ἐτεκτήναντο σέθεν, κύδιστε μέγιστε,Κρῆτες, ἀεὶ ψευδεῖς, κακὰ θηρία,

γαστέρες ἀργαί.Ἀλλὰ σὺ γ᾽ οὐ θνῇσκεις,

ἕστηκας γὰρ ζοὸς αίεί,Ἐν γὰρ σοὶ ζῶμεν καὶ κινύμεθ᾽ ἠδὲ καὶ ἐσμέν.

Rendal Harris (hypothetical) text of Cretica

Page 8: Class 35: Self-Reference

8

What Epimenides “Really” SaidThey fashioned a tomb for thee, O holy and high oneThe Cretans, always liars, evil beasts, idle bellies!But thou art not dead: thou livest and abidest forever,For in thee we live and move and have our being.— Epimenides, Cretica

(as quoted, no actual text survived) Minos speaking to Zeus

Page 9: Class 35: Self-Reference

9

One of Crete’s own prophets has said it: “Cretans are always liars, evil brutes, lazy gluttons”.He has surely told the truth. — First Epistle of Paul to Titus (in the New Testament Bible)

Page 10: Class 35: Self-Reference

10

The Real Paradox

This statement is false.

What Gödel did: Showed the formal system in Principia Mathematica could state a sentence equivalent to: “This statement has no proof.”

Page 11: Class 35: Self-Reference

Gödel’s Stronger Result

All consistent axiomatic formulations of number theory include undecidable propositions.

undecidable: cannot be proven either true or false inside the system.

Page 12: Class 35: Self-Reference

Kurt Gödel• Born 1906 in Brno (now

Czech Republic, then Austria-Hungary)

• 1931: publishes Über formal unentscheidbare Sätze der Principia Mathematica und verwandter Systeme (On Formally Undecidable Propositions of Principia Mathematica and Related Systems)

The Information, Chapter 6

Page 13: Class 35: Self-Reference

1939: flees ViennaInstitute for Advanced

Study, PrincetonDied in 1978 –

convinced everything was poisoned and refused to eat

Page 14: Class 35: Self-Reference

Gödel’s Theorem

All logical systems of any complexity are incomplete: there are statements that are true that cannot be proven within the system.

Page 15: Class 35: Self-Reference

Proof – General Idea

• Theorem: In the Principia Mathematica system, there are statements that cannot be proven either true or false.• Proof: Find such a statement

Page 16: Class 35: Self-Reference

Gödel’s Statement

G: This statement does nothave any proof in thesystem of PrincipiaMathematica.

G is unprovable, but true!

Page 17: Class 35: Self-Reference

Gödel’s Proof Idea

G: This statement does not have any proof in the system of PM.

If G is provable, PM would be inconsistent.If G is unprovable, PM would be incomplete.

Thus, PM cannot be complete and consistent!

Page 18: Class 35: Self-Reference

Gödel’s Statement

G: This statement does not have any proof in the system of PM.

Page 19: Class 35: Self-Reference

Gödel’s Statement

G: This statement does not have any proof in the system of PM.

Possibilities:1. G is true G has no proof

System is incomplete

2. G is false G has a proof System is inconsistent

Page 20: Class 35: Self-Reference

Incomplete Axiomatic System

Derives some, but not all true

statements, and no false statements starting from a

finite number of axioms and following mechanical

inference rules.

incomplete

Inconsistent Axiomatic System

Derives all true statements, and some

false statements starting from a finite number of

axioms and following mechanical

inference rules.

some falsestatements Pick one:

Page 21: Class 35: Self-Reference

Inconsistent Axiomatic System

Derives all true

statements, and some false statements starting from a

finite number of axioms and following mechanical

inference rules. some false

statements Once you can prove one false statement,everything can be proven! false anything

Page 22: Class 35: Self-Reference

Finishing The Proof

• Turn G into a statement in the Principia Mathematica system

• Is PM powerful enough to express G:

“This statement does not have any proof in the PM system.”?

Page 23: Class 35: Self-Reference

How to express “does not have any proof in the system of PM”

What does “have a proof of S in PM” mean?There is a sequence of steps that follow the

inference rules that starts with the initial axioms and ends with S

What does it mean to “not have any proof of S in PM”?There is no sequence of steps that follow the

inference rules that starts with the initial axioms and ends with S

Page 24: Class 35: Self-Reference

Can PM express unprovability?

There is no sequence of steps that follows the inference rules that starts with the initial axioms and ends with S

Sequence of steps: T0, T1, T2, ..., TN

T0 must be the axiomsTN must include SEvery step must follow from the previous using an inference rule

Page 25: Class 35: Self-Reference

Can we express “This statement”?

Yes!If you don’t believe me (and you shouldn’t) read Gödel, Escher, Bach over winter break.We can write every statement as a number, so we can turn “This statement does not have any proof in the system” into a number which can be written in PM.

Page 26: Class 35: Self-Reference

Gödel’s ProofG: This statement does not have any proof in the system of PM.

If G is provable, PM would be inconsistent.If G is unprovable, PM would be incomplete.PM can express G.Thus, PM cannot be complete and consistent!

Page 27: Class 35: Self-Reference

Generalization

All logical systems of any complexity are incomplete: there are statements that are true that cannot be proven within the system.

Page 28: Class 35: Self-Reference

“Practical” Implications

There are mathematical truths that cannot be determined mechanically.

We can write a program that automatically proves only true theorems about number theory, but if it cannot prove something we do not know whether or not it is a true theorem.

Mathematicians will never be completely replaced by computers.

Page 29: Class 35: Self-Reference

What does it mean for an axiomatic system to be complete and consistent?

Derives all true statements, and no false

statements starting from a finite number of axioms

and following mechanical inference rules.

Page 30: Class 35: Self-Reference

What does it mean for an axiomatic system to be complete and consistent?

It means the axiomatic system is weak.

Indeed, it is so weak, it cannot express: “This statement has no proof.”

Page 31: Class 35: Self-Reference

Impossibility Results

Mathematics (Declarative Knowledge)Gödel: Any powerful axiomatic system cannot be both complete and consistent

If it is possible to express “This statement has no proof.” in the system, it must be incomplete or inconsistent.

Computer Science (Imperative Knowledge)Are there (well-defined) problems that cannot be solved by any algorithm? Alan Turing (and Alonzo Church): Yes!

Page 32: Class 35: Self-Reference

ComputabilityA problem is computable if there is an algorithm that solves it.

What is an algorithm?

What does it mean to have an algorithm that solves a problem?

A procedure that always finishes.

What is a procedure? A precise description of a series of steps that can be followed mechanically* (without any thought).

*A formal definition of computable requires a more formal definition of a procedure.

We have a procedure that always finished, and always provides a correct output for any problem instance.

Page 33: Class 35: Self-Reference

Computability

Is there an algorithm that solves a problem?

Computable (decidable) problems can be solved by some algorithm.

Make a photomosaic, sorting, drug discovery, winning chess (it doesn’t mean we know the algorithm, but there is one)

Noncomputable (undecidable) problems cannot be solved by any algorithm.

There might be a procedure (but it doesn’t finish for some inputs).

Page 34: Class 35: Self-Reference

The (Pythonized) Halting Problem

Input: a string representing a Python program.

Output: If evaluating the input program would ever finish, output true. Otherwise, output false.

Page 35: Class 35: Self-Reference

Suppose halts solves Halting Problem

>>> halts('3 + 3')True>>> halts(""" i = 0 while i < 100: i = i * 2""")False

def halts(code): ... ? ...

Input: a string representing a Python program.Output: If evaluating the input program would ever finish, output true. Otherwise, output false.

Page 36: Class 35: Self-Reference

Halting Examples>>> halts("""def fact(n): if n = 1: return 1 else: return n * fact(n - 1)fact(7)""") True

>>> halts("""def fact(n): if n = 1: return 1 else: return n * fact(n - 1)fact(0)""") False

halts('''''' def fibo(n): if n == 1 or n == 2: return 1 else: return fibo(n 1) + fibo(n 2) fibo(60)'''''')

Page 37: Class 35: Self-Reference

Can we define halts?

Attempt #1:

def halts(code): eval(code) return True

Attempt #2:

def halts(code): try: with Timer(100): eval(code) return True except Timer: return False

These two approaches fail, but not a proof it cannot be done!

Page 38: Class 35: Self-Reference

Impossibility of Halts

Recall how Gödel showed incompleteness of PM:Find a statement that leads to a contradictionGödel’s statement: “This statement has no proof.”

Is there an input to halts that leads to a contradiction?

Page 39: Class 35: Self-Reference

39

Charge

Wednesday’s class (and Chapter 12):Are there any noncomputable problems?

Problem Set 8 Commitments: Due before 5pm today

Problem Set 7: Due Wednesday (but not until after class)