2. Announcements
Don’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 Dedication
11am: Dedication
12-3pm: Tours (Visit our lab in Rice 442)
3pm: Dean Kamen talk
5pm: Scavenger Hunt
2
3. Exam 2
Out: Monday, 21 November (one week from today)
Due: Wednesday, 30 November, 11:01am
Covers 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 1
You will be allowed to use Scheme, Python, and
Charme interpreters
3
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.
4
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.”
6
8. What Epimenides “Really” Said
They fashioned a tomb for
thee, O holy and high one
The 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 Minos speaking to Zeus
text survived)
8
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)
9
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.”
10
11. 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.
12. The Information, Chapter 6
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)
13. 1939: flees Vienna
Institute for Advanced
Study, Princeton
Died in 1978 –
convinced everything
was poisoned and
refused to eat
14. 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.
15. 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
16. Gödel’s Statement
G: This statement does not
have any proof in the
system of Principia
Mathematica.
G is unprovable, but true!
17. 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!
19. 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
20. incomplete Pick one: some false
statements
Derives all true
Derives statements, and some
some, but not all true
statements, and no false false statements starting
statements starting from a from a finite number of
finite number of axioms axioms and following
and following mechanical
inference rules.
mechanical
inference rules.
Incomplete Inconsistent Axiomatic
Axiomatic System System
21. 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
Once you can prove one false statement, statements
everything can be proven! false anything
22. 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.”
?
23. 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
24. 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 axioms
TN must include S
Every step must follow from the previous
using an inference rule
25. 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.
26. Gödel’s Proof
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.
PM can express G.
Thus, PM cannot be complete and consistent!
27. Generalization
All logical systems of any
complexity are incomplete:
there are statements that are true
that cannot be proven within the
system.
28. “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.
29. 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.
30. 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.”
31. 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!
32. Computability
A problem is computable if there is an
algorithm that solves it.
What is an algorithm? 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.
What does it mean to have an algorithm that solves
a problem?
We have a procedure that always finished, and always provides
a correct output for any problem instance.
33. 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).
34. 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.
35. Suppose halts solves Halting Problem
Input: a string representing a
def halts(code): Python program.
Output: If evaluating the input
... ? ...
program would ever finish, output
true. Otherwise, output false.
>>> halts('3 + 3')
True
>>> halts("""
i=0
while i < 100:
i = i * 2""")
False
36. Halting Examples
>>> halts(""" >>> halts("""
def fact(n): def fact(n):
if n = 1: return 1 if n = 1: return 1
else: return n * fact(n - 1) else: return n * fact(n - 1)
fact(7) fact(0)
""") """)
True False
halts(''''''
def fibo(n):
if n == 1 or n == 2: return 1
else: return fibo(n 1) + fibo(n 2)
fibo(60)
'''''')
37. Can we define halts?
Attempt #1: Attempt #2:
def halts(code): def halts(code):
eval(code) try:
return True with Timer(100):
eval(code)
return True
except Timer:
return False
These two approaches fail, but not a proof it cannot be done!
38. Impossibility of Halts
Recall how Gödel showed incompleteness of PM:
Find a statement that leads to a contradiction
Gödel’s statement: “This statement has no proof.”
Is there an input to halts that leads to a contradiction?
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)
39