cs1120 Fall 2011 | David Evans | 14 November 2011
AnnouncementsDon’t forget to submit your PS8 choice before5pm 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
Exam 2Out: 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 3
Recap Last ClassSince 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
In its absolutely barestform, Gödel’s discovery involvesthe translation of an ancientparadox in philosophy intomathematical terms. Thatparadox is the so-calledEpimenides paradox, or liarparadox. Epimenides was aCretan who made one immortalstatement: “All Cretans areliars.” A sharper version of thestatement is simply “I am lying”;or, “This statement is false.” 6
What Epimenides “Really” SaidThey fashioned a tomb forthee, O holy and high oneThe Cretans, alwaysliars, evil beasts, idlebellies!But thou art not dead: thoulivest and abidest forever,For in thee we live andmove and have our being.— Epimenides, Cretica (as quoted, no actual Minos speaking to Zeus text survived) 8
One of Crete’s own prophets has said it:“Cretans are always liars, evil brutes, lazygluttons”.He has surely told the truth.— First Epistle of Paul to Titus (in the New Testament Bible) 9
The Real ParadoxThis 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
Gödel’s Stronger ResultAll consistent axiomatic formulations ofnumber theory include undecidablepropositions. undecidable: cannot be proven either true or false inside the system.
The Information, Chapter 6 Kurt GödelBorn 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)
1939: flees ViennaInstitute for Advanced Study, PrincetonDied in 1978 – convinced everything was poisoned and refused to eat
Gödel’s TheoremAll logical systems of any complexityare incomplete: there are statementsthat are true that cannot be provenwithin the system.
Proof – General IdeaTheorem: In the Principia Mathematica system, there are statements that cannot be proven either true or false.Proof: Find such a statement
Gödel’s StatementG: This statement does not have any proof in the system of Principia Mathematica.G is unprovable, but true!
Gödel’s Proof IdeaG: This statement does not have anyproof 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!
Gödel’s StatementG: This statement does not have any proof in the system of PM.
Gödel’s StatementG: 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
incomplete Pick one: some false statements Derives all true Derives statements, and some some, but not all true statements, and no false false statements startingstatements 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
Inconsistent Axiomatic System Derives all true statements, and some false statements starting from a finite number of axioms and following mechanical inference rules. some falseOnce you can prove one false statement, statementseverything can be proven! false anything
Finishing The ProofTurn G into a statement in the Principia Mathematica systemIs PM powerful enough to express G: “This statement does not have any proof in the PM system.” ?
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 SWhat 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
Can PM express unprovability?There is no sequence of steps that follows the inference rules that starts with the initial axioms and ends with SSequence 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
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.
Gödel’s ProofG: This statement does not have any proofin 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!
GeneralizationAll logical systems of anycomplexity are incomplete:there are statements that are truethat cannot be proven within thesystem.
“Practical” ImplicationsThere 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.
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.
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.”
Impossibility ResultsMathematics (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!
ComputabilityA problem is computable if there is analgorithm 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 solvesa problem? We have a procedure that always finished, and always provides a correct output for any problem instance.
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).
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.
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
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) )
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!
Impossibility of HaltsRecall 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?
ChargeWednesday’s class (and Chapter 12): Are there any noncomputable problems?Problem Set 8 Commitments: Due before 5pm todayProblem Set 7: Due Wednesday (but not until after class) 39