CompSci 100 17.1 On the Limits of Computing  Reasons for Failure 1. Runs too long o Real time requirements o Predicting yesterday's weather 2. Non-computable.

Slides:



Advertisements
Similar presentations
Lecture 19. Reduction: More Undecidable problems
Advertisements

CS 461 – Nov. 9 Chomsky hierarchy of language classes –Review –Let’s find a language outside the TM world! –Hints: languages and TM are countable, but.
Computability & Complexity. Scenario I can’t write this program because I’m too dumb.
Copyright © Cengage Learning. All rights reserved.
1 The Limits of Computation Intractable and Non-computable functions.
CS420 lecture one Problems, algorithms, decidability, tractability.
Infinite Horizon Problems
1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli.
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.
Lecture 9 Recursive and r.e. language classes
1 Module 9 Recursive and r.e. language classes –representing solvable and half-solvable problems Proofs of closure properties –for the set of recursive.
1 Undecidability Andreas Klappenecker [based on slides by Prof. Welch]
1 Module 7 Halting Problem –Fundamental program behavior problem –A specific unsolvable problem –Diagonalization technique revisited Proof more complex.
1 Uncountable Sets continued Theorem: Let be an infinite countable set. The powerset of is uncountable.
The Theory of NP-Completeness
CHAPTER 4 Decidability Contents Decidable Languages
Analysis of Algorithms CS 477/677
CS10 The Beauty and Joy of Computing Lecture #23 : Limits of Computing Thanks to the success of the Kinect, researchers all over the world believe.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 18 Instructor: Paul Beame.
Halting Problem. Background - Halting Problem Common error: Program goes into an infinite loop. Wouldn’t it be nice to have a tool that would warn us.
Lecture , 3.1 Methods of Proof. Last time in 1.5 To prove theorems we use rules of inference such as: p, p  q, therefore, q NOT q, p  q, therefore.
04/25/13 Halting Problem Discrete Structures (CS 173) Derek Hoiem, University of Illinois 1
CSc /6 Week nine 1 CSc142 Algorithms and efficiency Week 9 Pete Bagnall Elizabeth Phillips
Cs3102: Theory of Computation Class 18: Proving Undecidability Spring 2010 University of Virginia David Evans.
1 Ethics of Computing MONT 113G, Spring 2012 Session 13 Limits of Computer Science.
Analysis of Algorithms
Section 3.1: Proof Strategy Now that we have a fair amount of experience with proofs, we will start to prove more difficult theorems. Our experience so.
Unsolvability and Infeasibility. Computability (Solvable) A problem is computable if it is possible to write a computer program to solve it. Can all problems.
1 Sections 1.5 & 3.1 Methods of Proof / Proof Strategy.
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 15-1 Mälardalen University 2012.
1 Markov Decision Processes Infinite Horizon Problems Alan Fern * * Based in part on slides by Craig Boutilier and Daniel Weld.
Cliff Shaffer Computer Science Computational Complexity.
1 Markov Decision Processes Infinite Horizon Problems Alan Fern * * Based in part on slides by Craig Boutilier and Daniel Weld.
NP-COMPLETE PROBLEMS. Admin  Two more assignments…  No office hours on tomorrow.
Halting Problem and TSP Wednesday, Week 8. Background - Halting Problem Common error: Program goes into an infinite loop. Wouldn’t it be nice to have.
Beauty and Joy of Computing Limits of Computing Ivona Bezáková CS10: UC Berkeley, April 14, 2014 (Slides inspired by Dan Garcia’s slides.)
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.
CS 3813: Introduction to Formal Languages and Automata Chapter 12 Limits of Algorithmic Computation These class notes are based on material from our textbook,
1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)
CS10: The Beauty and Joy of Computing Lecture #22 Limits of Computing Warning sign posted at Stern Hall. Also, Apple releases new operating.
Limits to Computation How do you analyze a new algorithm? –Put it in the form of existing algorithms that you know the analysis. –For example, given 2.
Module #7: Algorithmic Complexity Rosen 5 th ed., §2.3.
Complexity & Computability. Limitations of computer science  Major reasons useful calculations cannot be done:  execution time of program is too long.
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.
The Beauty and Joy of Computing Lecture #23 Limits of Computing Researchers at Facebook and the University of Milan found that the avg # of “friends” separating.
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 223 – Advanced Data Structures Math Review 1.
CSE 311 Foundations of Computing I Lecture 28 Computability: Other Undecidable Problems Autumn 2011 CSE 3111.
Chapter 11 Introduction to Computational Complexity Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
Fundamentals of Informatics Lecture 12 The Halting Problem Bas Luttik.
Recursively Enumerable and Recursive Languages
Chapter 3.5 and 3.6 Heuristic Search Continued. Review:Learning Objectives Heuristic search strategies –Best-first search –A* algorithm Heuristic functions.
Overview of the theory of computation Episode 3 0 Turing machines The traditional concepts of computability, decidability and recursive enumerability.
Lecture. Today Problem set 9 out (due next Thursday) Topics: –Complexity Theory –Optimization versus Decision Problems –P and NP –Efficient Verification.
1 Computability Tractable, Intractable and Non-computable functions.
CompSci Today’s Topics Computer Science Noncomputability Upcoming Special Topic: Enabled by Computer -- Decoding the Human Genome Reading Great.
CPS Today’s Topics Computer Science Program Execution Time: Intractable Algorithms Upcoming Parallel Computing Great Ideas, Chapter 14 Reading.
CS 461 – Nov. 2 Sets Prepare for ATM finite vs. infinite Infinite sets
1.5 Intractable problems.
HIERARCHY THEOREMS Hu Rui Prof. Takahashi laboratory
A Balanced Introduction to Computer Science David Reed, Creighton University ©2005 Pearson Prentice Hall ISBN X Chapter 13 (Reed) - Conditional.
CSCE 411 Design and Analysis of Algorithms
CSE 311 Foundations of Computing I
Halting Problem.
Formal Languages, Automata and Models of Computation
6.1 Counting Principles and Permutations
CSE 311: Foundations of Computing
A Balanced Introduction to Computer Science David Reed, Creighton University ©2005 Pearson Prentice Hall ISBN X Chapter 13 (Reed) - Conditional.
Algorithms CSCI 235, Spring 2019 Lecture 36 P vs
Algorithms CSCI 235, Spring 2019 Lecture 37 The Halting Problem
Presentation transcript:

CompSci On the Limits of Computing  Reasons for Failure 1. Runs too long o Real time requirements o Predicting yesterday's weather 2. Non-computable ! 3. Don't know the algorithm  Complexity, N  Time  Space  Tractable and Intractable

CompSci On the Limits of Computing  Intractable Algorithms  Computer "crawls" or seems to come to halt for large N  Large problems essentially unsolved  May never be able to compute answer for some obvious questions  Chess  Here N is number of moves looked ahead  We have an Algorithm! o Layers of look-ahead: If I do this, then he does this,.... o Problem Solved (?!)  Can Represent Possibilities by a Tree  Assume 10 Possibilities Each Move  t = A * 10 N  Exponential O(2 N ) ! ! !

CompSci Exponential Algorithms  Recognizing Exponential Growth  Things get BIG very rapidly  Numbers seem to EXPLODE  KEY: at each added step, work multiplies rather than adds  Exponential == Intractable  Traveling Salesperson Example  Visit N Cities in Optimal Order  Optimize for minimum: o Time o Distance o Cost  N factorial (N!) Possibilities  N! is (very) roughly N N  Sterling’s approximation: N! = sqrt(2*Pi*N)*(N/e) N  Typical of some very practical problems

CompSci Traveling Salesperson Examples  3 cities 2! = 2 possible routes (1 of interest)  abc  acb  4 cities 3! = 6 possible routes (3 of interest)  abcd  abdc  acbd  acdb  adbc  adcb  (Only half usually of interest because just reverse of another path)

CompSci Traveling Salesperson Examples 5 cities 4! = 24 possible routes  abcde  abced  abdce  abdec  abecd  abedc  acbde  acbed  acdbe  acdeb  acebd  acedb (12 of interest)  adbce  adbec  adcbe  adceb  adebc  adecb  aebcd  aebdc  aecbd  aecdb  aedbc  aedcb

CompSci Towers of Hanoi N t t = * 2 N 5.17 sec (for a very old PC) sec min hour day day year What would a faster computer year do for these numbers? year K year M year M year G year G year

CompSci Intractable Algorithms  Other Games  More hardware not the answer!  Predicting Yesterday's Weather  Actual Examples for Time Complexity

CompSci Existence of Noncomputable Functions  Approach  Matching up Programs and Functions  E.g., assume 3 functions, only 2 programs  Without details, conclude one function has no program  Have: Uncountable Infinity of Functions Mapping int to int  How can we show that is true?  Functions can be seen as columns in tables  Put all functions into a huge (infinite!) table  Show that even that cannot hold them all  Can you identify the functions in the following table?

CompSci Table of All Integer to Integer Functions

CompSci A Function NOT in this (inclusive?) Table

CompSci Existance of Noncomputable Functions  All Programs Can be Ordered (thus Countable )  By size, shortest program first  Just use alphabetical order  Try to Draw Lines Between Functions and Programs  Could draw lines from every program to every function  But, have proved functions uncountable...  Thus, There Must be Functions With NO Programs!  Hard to come up with function that computer can't run  Possible example: true random number generator (No algorithm can produce a truly random number sequence: why? )  Use Table  Program must be of finite size; Requires infinite table

CompSci Noncomputable Programs  Programs that Read Programs  What programs have we used that read in programs?  Express programs as a single string (formatting messed up)  Therefore, could write program to see if there is an if statement in the program: answers YES or NO  How about, Does program halt?  Lack of while (and functions) guarantees a halt  Not very sophisticated  Not Halting for All Possible Inputs is usually considered a Bug  Solving the Halting Problem  Write specific code to check out more complicated cases  Gets more and more involved...

CompSci The Halting Problem: Does it Halt?  Consider Following Program: Does it halt for all input? // input an integer value for k while (k > 1) { if ((k/2) * 2 == k) // is k even? k = k / 2; else k = 3 * k + 1; }  Try It! Successive states of k:  e.g. 17: , ,  For a long time, no one knew whether this terminated for all inputs.

CompSci Does it Halt?  For any one specific program  Could coble together a list of tests that might satisfactorily answer that question  Imagine checking for loops; seeing if they are OK  What about recursion?  As shown by previous example, even specific, simple programs can be hard to check

CompSci Proving Noncomputability  Mathematicians have proven that no one, finite program can check this property for all possible programs  Examples of non-computable problems  Equivalence: Define by same input > same output  Use variation of above program; not sure it ends  Cannot generally prove equivalence  Use Proof by Contradiction (Indirect Proof)  Proving non-computability  Sketch of proof

CompSci Noncomputability Proof  Assume Existence of Function halt: String halt(String p, String x);  Inputs: p = program, x = input data  Returns: "Halts" or "Does not halt"  Can now write: String selfHalt(String p);  Inputs: p = program  Returns: "Halts on self" or "Does not halt on self"  Uses: halt(p, p);  i.e.: asking if halts when program p uses itself as data

CompSci Noncomputability Proof.2  Now write method contrary: void contrary(); { TextField program = new TextField(1000); String p, answer; p = program.getText(); answer = selfHalt(p); if (answer.equals("Halts on self")) { while (true) // infinite loop answer = "x"; } else return; // i.e., halts }  "Feed it" this program.

CompSci Noncomputability Proof.3  Paradox!  If halt program decides it halts, it goes into infinite loop and goes on forever  If halt program decides it doesn't halt, it quits immediately  Therefore halt cannot exist!  Whole classes of programs dealing with program behavior are non-computable  Equivalence  Many other programs that deal with the behavior of a program

CompSci Living with Noncomputability  What Does It All Mean?  Not necessarily a very tough constraint unless you get “too greedy”.  Programs can't do everything. o Beware of people who say they can! o (and now you should know better)