Download
david evans http www cs virginia edu evans n.
Skip this Video
Loading SlideShow in 5 Seconds..
David Evans http://www.cs.virginia.edu/~evans PowerPoint Presentation
Download Presentation
David Evans http://www.cs.virginia.edu/~evans

David Evans http://www.cs.virginia.edu/~evans

122 Views Download Presentation
Download Presentation

David Evans http://www.cs.virginia.edu/~evans

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Lecture 23: Computability David Evans http://www.cs.virginia.edu/~evans CS200: Computer Science University of Virginia Computer Science

  2. Menu • Review: Gödel’s Theorem, Proof in Axiomatic Systems • Are there some problems that it is impossible to write a program to solve? CS 200 Spring 2002

  3. Review • Axiomatic System • Set of axioms • Set of inference rules • Example: MIU-System from GEB • Axioms: MI • Inference rules: 4 rules for making new strings • An axiomatic system is a formal system where the string we can generate are meant to represent “true theorems” CS 200 Spring 2002

  4. Proof • A proof of S in an axiomatic system is a sequence of strings, T0, T1, …, Tn where: • The first string is the axioms • For all i from 1 to n, Tn is the result of applying one of the inference rules to Tn-1 • Tn is S • What is the proof-checking problem? CS 200 Spring 2002

  5. Proof Checking Problem • Input: an axiomatic system (a set of axioms and inference rules), a statement S, and a proof P of S • Output: true if P is a valid proof of S false otherwise How much work is the proof-checking problem? n= length of the proof (number of steps) Checking a proof is O(n) CS 200 Spring 2002

  6. Finite-Length Proof Finding Problem • Input: an axiomatic system (a set of axioms and inference rules), a statement S, n (the maximum number of proof steps) • Output: A valid proof of S with no more then n steps if there is one. If there is no proof, unprovable. How much work? At worst, we can try all possible proofs: r inference rules 0 - n steps ~ rn possible proofs Checking each proof is O(max-steps) Finite-Length Proof-Finding Problem is NP-Complete. O(rn) and (n) CS 200 Spring 2002

  7. Proof Finding Problem • Input: an axiomatic system, a statement S • Output: A valid proof of S if S is true. If there is no proof, false. How much work? It is impossible! Gödel’s theorem says it cannot be done. CS 200 Spring 2002

  8. Quiz Answers CS 200 Spring 2002

  9. What is Computer Science? • “Correct” answers: • “The most wonderful thing in the world!” • Okay answers: • “a liberal art (the only legitimate one) that incorporates how into figuring things out. It is the only class I have that can hurt my head.” • “Study of systems and their actions through the use of language systems.” CS 200 Spring 2002

  10. What is Computer Science? • More Okay answers: • “A combination of logic, math, and other disciplines to create systems.” • “Study of language, math, logic, and all kinds of good stuff… (music, cognition, etc.)” • Neither “about” computers nor a science, more of a liberal art. • “Complicated, but nothing to with computers or science.” • Actually, it has a lot to do with computers. Like chemistry has a lot to do with beekers. CS 200 Spring 2002

  11. What is Computer Science? • My answer would be: “Study of ways to describe procedures and reason about the processes they produce?” • My alternate answer: “Playing with procedures.” CS 200 Spring 2002

  12. Reading GEB? • Don’t remember: 1 (?) • Through Ch 5 or less: 4 • All of Part I: 1 • All of Part I and some in Part II: 2 • Reading GEB is probably not necessary to get a good grade in this class, but I really hope you will read it and enjoy reading it! • Ch 13 is the last assigned reading in it for this class CS 200 Spring 2002

  13. Exam 2 • Similar to Exam 1 225 • Like Exam 1, but allow DrScheme 111222 • In class, open notes • In class, closed notes 5555 • There shouldn’t be another Exam 1112 Exam 2 will involve: - Questions about axiomatic systems, complexity and computability (some practice questions on Friday) - Questions about evaluation models (environments, evaluation rules) - Writing a program that uses everything up through and including PS7 CS 200 Spring 2002

  14. 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. CS 200 Spring 2002

  15. What does it mean for an axiomatic system to be complete and consistent? It means the axiomatic system is weak. Its is so weak, it cannot express “This statement has no proof.” CS 200 Spring 2002

  16. Computability CS 200 Spring 2002

  17. Computability • Is there a procedure that solves a problem? • Decidable (computable) problems: • There is a procedure that solves the problem • Make a photomosaic, sorting, drug discovery, who will win NCAA tournament (it doesn’t mean we know the procedure, but there is one) • Undecidable problems: • There is no possible procedure that solves the problem CS 200 Spring 2002

  18. Are there any undecidable problems? The Proof-Finding Problem: Input: an axiomatic system, a statement S Output: A valid proof of S if S is true. If there is no proof, false. CS 200 Spring 2002

  19. Any others? CS 200 Spring 2002

  20. Undecidable Problems • We can prove a problem is undecidable by showing it is at least as hard as the proof-finding problem • Here’s a famous one: Halting Problem Input: a procedure P (described by a Scheme program) Output: true if P always halts (finishes execution), false otherwise. CS 200 Spring 2002

  21. Alan Turing (1912-1954) • Published On Computable Numbers … (1936) • Introduced the Halting Problem • Also: formal model of computation and design for computers • WWII: codebreaker at Bletchley Park (broke Enigma Cipher) • Even more important than Lorenz • After the war: convicted of homosexuality (then a crime in Britian), commited suicide eating cyanide apple CS 200 Spring 2002

  22. Halting Problem Can we define a procedure always-halts that takes the code for a procedure and evaluates to #t if the procedure always terminates, and to #f if it may not terminate? (define (always-halts procedure) … ) CS 200 Spring 2002

  23. Examples > (always-halts ‘(lambda (x) (+ x x))) #t > (always-halts ‘(lambda (x) (define (f x) (f x)) (f x))) #f > (always-halts ‘(lambda (x) (define (fact n) (if (= n 1) 1 (* n (fact (- n 1))))) (fact x))) #f CS 200 Spring 2002

  24. Can we define halts?? • We could try for a really long time, get something to work for simple examples, but could we solve the problem? (Make it work for all possible inputs.) • Could we compute find-proof if we had always-halts? CS 200 Spring 2002

  25. I cheated a little here – we only know we can’t do this for “true”. find-proof (define (find-proof S axioms rules) ;; If S is provable, evaluates to a proof of S. ;; Otherwise, evaluates to #f. (if (always-halts? (find-proof-exhaustive S axioms rules)) ((find-proof-exhaustive S axioms rules))) #f)) Where (find-proof-exhaustive S axioms rules) evaluates to a procedure that tries all possible proofs starting from the axioms. CS 200 Spring 2002

  26. Another Informal Proof (define (contradict-halts) (if (always-halts contradict-halts) (loop-forever) #t)) If contradict-halts halts, the if test is true and it evaluates to (loop-forever) - it doesn’t halt! If contradict-halts doesn’t halt, the if test if false, and it evaluates to #t. It halts! CS 200 Spring 2002

  27. This should remind you of… Russell’s Paradox • S: set of all sets that are not members of themselves • Is S a member of itself? • If S is an element of S, then S is a member of itself and should not be in S. • If S is not an element of S, then S is not a member of itself, and should be in S. CS 200 Spring 2002

  28. Undecidable Problems • If solving a problem P would allow us to solve the halting problem, then P is undecidable – there is no solution to P, since we have proved there is no solution to the halting problem! • There are lots of practical problems like this…we’ll practice on them Friday. CS 200 Spring 2002

  29. Charge • Friday • Practice determining if problems are decidable (in P, in NP, not in NP) or undecidable • PS 6 • Even if you take into account Hofstadter’s Law and Byrd’s Law, it may be longer than you think so get cracking! CS 200 Spring 2002