David Evans CS150: Computer Science University of Virginia Computer Science Computability.

Slides:



Advertisements
Similar presentations
David Evans cs302: Theory of Computation University of Virginia Computer Science Lecture 17: ProvingUndecidability.
Advertisements

David Evans CS150: Computer Science University of Virginia Computer Science Lecture 26: Proving Uncomputability Visualization.
Lecture 19. Reduction: More Undecidable problems
Problem: Give as many proofs as you can for the Pythagorean Theorem. i.e., a 2 + b 2 = c 2 holds for any right triangle with sides a & b and hypotenuse.
Class 39: Universality cs1120 Fall 2009 David Evans University of Virginia.
David Evans CS200: Computer Science University of Virginia Computer Science Class 27: Modeling Computation.
Copyright © Cengage Learning. All rights reserved.
Limitations. Limitations of Computation Hardware precision Hardware precision Software - we’re human Software - we’re human Problems Problems –complex.
Week 7 - Wednesday.  What did we talk about last time?  Set proofs and disproofs  Russell’s paradox.
Nathan Brunelle Department of Computer Science University of Virginia Theory of Computation CS3102 – Spring 2014 A tale.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Prof. Busch - LSU1 Decidable Languages. Prof. Busch - LSU2 Recall that: A language is Turing-Acceptable if there is a Turing machine that accepts Also.
CPSC 411, Fall 2008: Set 12 1 CPSC 411 Design and Analysis of Algorithms Set 12: Undecidability Prof. Jennifer Welch Fall 2008.
CS1001 Lecture 22. Overview Mechanizing Reasoning Mechanizing Reasoning G ö del ’ s Incompleteness Theorem G ö del ’ s Incompleteness Theorem.
Lecture 9 Recursive and r.e. language classes
1 Undecidability Andreas Klappenecker [based on slides by Prof. Welch]
David Evans cs302: Theory of Computation University of Virginia Computer Science Lecture 2: Modeling Computers.
Lecture 24: Gödel’s Proof CS150: Computer Science
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Cs3102: Theory of Computation Class 20: Busy Beavers Spring 2010 University of Virginia David Evans Office hours: I am not able to hold my Thursday morning.
Some stupid remarks by smart people If it should turn out that the basic logics of a machine designed for the numerical solution of differential equations.
Lecture 14: Church-Turing Thesis Alonzo Church ( ) Alan Turing ( )
Class 36: Proofs about Unprovability David Evans University of Virginia cs1120.
Cs3102: Theory of Computation Class 17: Undecidable Languages Spring 2010 University of Virginia David Evans.
Cs3102: Theory of Computation Class 18: Proving Undecidability Spring 2010 University of Virginia David Evans.
David Evans CS200: Computer Science University of Virginia Computer Science Class 24: Gödel’s Theorem.
David Evans Turing Machines, Busy Beavers, and Big Questions about Computing.
Class 37: Uncomputability David Evans University of Virginia cs1120 Halting Problems Hockey Team.
Class 37: Computability in Theory and Practice cs1120 Fall 2011 David Evans 21 November 2011 cs1120 Fall 2011 David Evans 21 November 2011.
CSE 311 Foundations of Computing I Lecture 30 Computability: Other Undecidable Problems Autumn 2012 CSE 3111.
Algorithms and their Applications CS2004 ( ) Dr Stephen Swift 1.2 Introduction to Algorithms.
David Evans University of Virginia cs1120 Fall Lecture 38: Modeling Computing.
CS 101E – Exam 2 Review Spring 2007 Michele Co. Announcements Review Session Tonight, 7/7:30 p.m., OLS 009 Will be announced via In-class Exam Wednesday.
1 Sections 1.5 & 3.1 Methods of Proof / Proof Strategy.
Cs3102: Theory of Computation Class 24: NP-Completeness Spring 2010 University of Virginia David Evans.
David Evans CS200: Computer Science University of Virginia Computer Science Class 25: Computability Halting Problems Hockey.
Lecture 18. Unsolvability Before the 1930’s, mathematics was not like today. Then people believed that “everything true must be provable”. (More formally,
Course Overview and Road Map Computability and Logic.
Halting Problem Introduction to Computing Science and Programming I.
Great Theoretical Ideas in Computer Science.
1 Computability CS 101E Spring 2007 Michele Co. 2 So Far In Class We’ve seen the following programming constructs –if, if-else, if-else-if –switch –for.
Great Theoretical Ideas in Computer Science.
1 Give the machine schema of a TM which when started like this: (q 0, #w[#]) for some string w in {a, b}* halts like this: (h, #001[#])
David Evans CS150: Computer Science University of Virginia Computer Science Lecture 25: Gödel and Computability Halting.
1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)
SNU OOPSLA Lab. 1 Great Ideas of CS with Java Part 1 WWW & Computer programming in the language Java Ch 1: The World Wide Web Ch 2: Watch out: Here comes.
Computation Motivating questions: What does “computation” mean? What are the similarities and differences between computation in computers and in natural.
1 Announcements: There is no problem of the day today (handing in your assignment will be used to indicate attendance so please hand in a sheet with your.
CSE 311 Foundations of Computing I Lecture 28 Computability: Other Undecidable Problems Autumn 2011 CSE 3111.
David Evans Class 15: P vs. NP (Smiley Puzzles and Curing Cancer) CS150: Computer Science University of Virginia Computer.
CMPT 308 — Computability and Complexity Fall 2004 Instructor: Andrei Bulatov, TA: Ramsay Dyer, Learning.
Thales’ Legacy: What Is A Proof? Great Theoretical Ideas In Computer Science Steven RudichCS Spring 2004 Lecture 27April 22, 2004Carnegie Mellon.
CS 101 – Oct. 7 Solving simple problems: create algorithm Structure of solution –Sequence of steps (1,2,3….) –Sometimes we need to make a choice –Sometimes.
Spring, 2011 –– Computational Thinking – Dennis Kafura – CS 2984 Lambda Calculus Introduction.
1 Unit – 5 : STATE MACHINES Syllabus: Languages and Grammars – Finite State Machines State machines and languages – Turing Machines – Computational Complexity.
CS 154 Formal Languages and Computability April 5 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak.
David Evans CS200: Computer Science University of Virginia Computer Science Class 26: Halting Problem It is plain at any.
David Evans CS200: Computer Science University of Virginia Computer Science Class 19: Computability Halting Problems Hockey.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Undecidable.
Introduction to Computing Science and Programming I
Turing Machines, Busy Beavers, and Big Questions about Computing
CSE 311 Foundations of Computing I
Lecture 22: Gödel’s Theorem CS200: Computer Science
Lecture 25: Metalinguistics > (meval '((lambda (x) (* x x)) 4)
Class 24: Computability Halting Problems Hockey Team Logo
Half-life of knowledge
CSE 311: Foundations of Computing
CO Games Development 2 Week 21 Turing Machines & Computability
Lecture 23: Computability CS200: Computer Science
Presentation transcript:

David Evans CS150: Computer Science University of Virginia Computer Science Computability

2 Computability Computer Science/Mathematics Mathematics (Declarative Knowledge) –Are there true conjectures that cannot be the shown using any proof? Computer Science (Imperative Knowledge) –Are there (well-defined) problems that cannot be solved by any procedure? Wednesday Today

3 Computability Requests? No requests at all for other topics! Possible explanations: –Everyone is really excited about computability! –No one could find my address –No one has any curiosity about any other computing topics –No one wakes up before noon on Thursdays

4 Computability Is there an algorithm that solves a problem? Computable (decidable) problems: –There is an algorithm that solves the problem. –Make a fractal, sorting, drug discovery, winning chess (it doesn’t mean we know the algorithm, but there is one) Uncomputable (undecidable) problems: –There is no algorithm that solves the problem. There might be a procedure that solves it for some inputs, but not for all inputs.

5 Computability Are there any uncomputable problems?

6 Computability Recall: Gödel’s Proof Idea G: This statement does not have any proof in the system of PM. Choice 1: G is true  G is not provable, so PM is incomplete. Choice 2: G is false  G is provable, so PM is inconsistent. Maybe we can find an uncomputable problem using self-reference?

7 Computability Alan Turing ( ) Published On Computable Numbers, with an Application to the Entscheidungsproblem (1936) –Introduced the Halting Problem –Formal model of computation (now known as “Turing Machine”) Codebreaker at Bletchley Park –Involved in breaking Enigma Cipher After the war: convicted of homosexuality (then a crime in Britain), committed suicide eating cyanide apple 5 years after Gödel’s proof!

8 Computability

9 The Halting Problem Input: a specification of a procedure P Output: If evaluating an application of P halts, output true. Otherwise, output false.

10 Computability Halting Problem for PHP Define a procedure halts that takes a string representing PHP code and evaluates to true if evaluating the code would terminate, and to false if evaluating the code would not terminate. function halts($p) {... }

11 Computability Examples > halts(“function tt() { return 3 + 3; }; tt();”) true > halts(“function f() { return f(); }; f();”) false

12 Computability Halting Examples > halts(“function fact($n) { if ($n == 1) { return 1; } else { return $n * fact($n – 1); } }; fact(7);”) true > halts(“function fact($n) {... }; fact(0);”) false

13 Computability 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?

14 Computability Tougher Example halts(“ function isPerfectNumber($n) { // n is perfect if factors sum to n $divs = findDivisors($n); return $n == sum($divs); } $i = 3; while (not isPerfectNumber ($i)) { $i = $i + 2; } ; print $i ”) Note: it is unknown where an odd perfect number exists. (Numbers up to have been tried without finding one yet.) Unknown

15 Computability If you had halts, you could prove or disprove nearly every open mathematical problem! –Does an odd perfect number exist? –Goldbach conjecture: Every number > 2 is the sum of three primes (including 1). –Poincaré conjecture: Every simply connected closed three-manifold is homeomorphic to the three-sphere. –... This suggests it is unlikely halts exists...but doesn’t prove it (yet).

Interdisciplinary Major in Computer Science for students in the College of Arts & Sciences BA Computer Science

Why Major in Computing? Fun –Creative problem solving, collaborative design –Instant Gratification Important –World’s most important problems need CS solutions Provides Opportunity –Excellent preparation for almost any career, graduate school, professional schools –Best jobs: Money Magazine, Best Jobs in America: #1: Software Engineer, #2: College Professor, #7: Computer/IT AnalystBest Jobs in America Boston Globe, 2016: Fastest Growing Occupations: #1: Network/Data Analyst, #4: Computer Applications Engineer, #23: Computer Systems Analyst, #24: Database Expert, #25: Computer Software/Systems Engineer2016: Fastest Growing Occupations

Major Overview cs150 Next fall: cs205: Engineering Software Core courses: cs202, cs216, cs333, cs432 Computing Electives (4) Integration Electives (4) Applications and Foundations of Computing: many approved courses in Anthropology (6), Architecture (7), Art (6), Biology (14), Biomedical Engineering (4), Civil Engineering (1), Drama (5), Economics (3), Environmental Sciences (5), Linguistics (4), Math (7), Media Studies (4), Music (6), Neuroscience (1), Philosophy (5), Physics (3), Psychology (11), Statistics (3) Distinguished Major Program

Application Process Application forms available from Can submit at any time (but the earlier the better) Questions about your previous courses, short answer questions Turn in to Peggy Reed (Olsson 223) or me (Olsson 236A)

Questions BA Computer Science Information Lunch: Monday, April 28, noon-1:30pm in Newcomb Open Office Hours for students interested in BACS degree: Wednesday 3:30-5, Olsson 236A –No appointment needed, just come by Other times: for appointment

21 Computability Halting Problem Can you d efine a procedure halts that takes a string representing PHP code and evaluates to true if evaluating the code would terminate, and to false if evaluating the code would not terminate?

22 Computability Informal Proof function paradox() { if (halts(“paradox()”) { while (true) ; } else { return true; } } If paradox halts, the if test is true and it enters infinite while loop - it doesn’t halt! If paradox doesn’t halt, the if test if false, and it returns true. It halts!

23 Computability Recall: 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. With paradox, we have the same kind of contradiction!

24 Computability No halts alrogithm can exist! function paradox() { if (halts(“paradox()”) { while (true) ; } else { return true; } } If halts(“paradox()”) returns true: enters infinite while loop - doesn’t halt! If halts(“paradox()”) returns false: returns true. It halts! The only “sensible” thing for halts to do is never return.

25 Computability Robustness of Proof We did this for PHP since you are using that now, but the same proof would work for any programming language (e.g., Haskell, Java, Scheme, etc.) function paradox() { if (halts(“paradox()”) { while (true) ; } else { return true; } }

26 Computability The Halting Problem Input: a specification of a procedure P Output: If evaluating an application of P halts, output true. Otherwise, output false. Thus, no algorithm exists that can solve the halting problem.

27 Computability Charge Now we have one uncomputable problem, how do we decide if a new problem is uncomputable? –In fact, most interesting properties about programs are uncomputable! –e.g., virus scanners will never work perfectly Halting Problems Hockey Team