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.

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.
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.
Copyright © Cengage Learning. All rights reserved.
1 COMP 382: Reasoning about algorithms Unit 9: Undecidability [Slides adapted from Amos Israeli’s]
Nathan Brunelle Department of Computer Science University of Virginia Theory of Computation CS3102 – Spring 2014 A tale.
1 Introduction to Computability Theory Lecture15: Reductions Prof. Amos Israeli.
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.
Courtesy Costas Busch - RPI1 A Universal Turing Machine.
CPSC 411, Fall 2008: Set 12 1 CPSC 411 Design and Analysis of Algorithms Set 12: Undecidability Prof. Jennifer Welch Fall 2008.
Fall 2004COMP 3351 Recursively Enumerable and Recursive Languages.
Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)
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.
1 Lecture 7 Halting Problem –Fundamental program behavior problem –A specific unsolvable problem –Diagonalization technique revisited Proof more complex.
CHAPTER 4 Decidability Contents Decidable Languages
1 Lecture 7 Halting Problem –Fundamental program behavior problem –A specific unsolvable problem –Diagonalization technique revisited Proof more complex.
Fall 2004COMP 3351 Reducibility. Fall 2004COMP 3352 Problem is reduced to problem If we can solve problem then we can solve problem.
1 Lecture 7 Topics –Problems about program behavior At least problem input is a program/algorithm –Halting Problem Fundamental problem about program behavior.
Fall 2004COMP 3351 A Universal Turing Machine. Fall 2004COMP 3352 Turing Machines are “hardwired” they execute only one program A limitation of Turing.
CS21 Decidability and Tractability
Fall 2006Costas Busch - RPI1 Undecidable Problems (unsolvable problems)
Prof. Busch - LSU1 Undecidable Problems (unsolvable problems)
1 Introduction to Computability Theory Lecture11: The Halting Problem Prof. Amos Israeli.
1 Reducibility. 2 Problem is reduced to problem If we can solve problem then we can solve problem.
Cs3102: Theory of Computation Class 18: Proving Undecidability Spring 2010 University of Virginia David Evans.
MATH 224 – Discrete Mathematics
MA/CSSE 474 Theory of Computation More Reduction Examples Non-SD Reductions.
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 15-1 Mälardalen University 2012.
Halting Problem Introduction to Computing Science and Programming I.
What computers just cannot do. (Part II) COS 116: 3/1/2011 Sanjeev Arora.
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 Linear Bounded Automata LBAs. 2 Linear Bounded Automata (LBAs) are the same as Turing Machines with one difference: The input string tape space is the.
1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)
Complexity & Computability. Limitations of computer science  Major reasons useful calculations cannot be done:  execution time of program is too long.
CSE 311 Foundations of Computing I Lecture 28 Computability: Other Undecidable Problems Autumn 2011 CSE 3111.
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.
Fundamentals of Informatics Lecture 12 The Halting Problem Bas Luttik.
CSE 311: Foundations of Computing Fall 2014 Lecture 27: Cardinality.
Recursively Enumerable and Recursive Languages
Chapter 12 Theory of Computation Introduction to CS 1 st Semester, 2014 Sanghyun Park.
CompSci Today’s Topics Computer Science Noncomputability Upcoming Special Topic: Enabled by Computer -- Decoding the Human Genome Reading Great.
Costas Busch - RPI1 Decidability. Costas Busch - RPI2 Another famous undecidable problem: The halting problem.
1 Recursively Enumerable and Recursive Languages.
Recursively Enumerable and Recursive Languages. Definition: A language is recursively enumerable if some Turing machine accepts it.
Decidability.
1 A Universal Turing Machine. 2 Turing Machines are “hardwired” they execute only one program A limitation of Turing Machines: Real Computers are re-programmable.
The Acceptance Problem for TMs
CS 461 – Nov. 2 Sets Prepare for ATM finite vs. infinite Infinite sets
Introduction to Computing Science and Programming I
CIS Automata and Formal Languages – Pei Wang
This statement is false.
CSE 311 Foundations of Computing I
Undecidable Problems Costas Busch - LSU.
LIMITS OF ALGORITHMIC COMPUTATION
Computable Problems.
Busch Complexity Lectures: Undecidable Problems (unsolvable problems)
CSCE 411 Design and Analysis of Algorithms
CSE 311 Foundations of Computing I
Decidable Languages Costas Busch - LSU.
Discrete Math for CS CMPSC 360 LECTURE 43 Last time: Variance
Formal Languages, Automata and Models of Computation
CS21 Decidability and Tractability
Impossible problems.
CSE 311: Foundations of Computing
Algorithms CSCI 235, Spring 2019 Lecture 37 The Halting Problem
CIS Automata and Formal Languages – Pei Wang
Presentation transcript:

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 Java Ch 3: Numerical computation & Function Ch 4: Subroutines & Databases Ch 5: Graphics Ch 6: Simulation Ch 7: Software engineering Part 2 Understanding what a computer is and how it works Ch 8: Machine architecture Ch 9: Language translation Ch 10: Virtual Environment for Computing Ch 11: Security, Privacy, and Wishful thinking Ch 12: Computer Communication Part 3 Advanced topics Ch 13: Program Execution Time Ch 14: Parallel Computation Ch 15: Noncomputability Ch 16: Artificial intelligence

SNU OOPSLA Lab. Ch 15. Noncomputability Copyright © SNU OOPSLA Lab.

SNU OOPSLA Lab. 3 Table of Contents Noncomputable Functions Programs that Read Programs Solving the Halting Problem Examples of non-computable problems Proof of noncomputability Summary

SNU OOPSLA Lab. 4 Noncomputable Functions Certain Problems Not Amenable to Computer Solution Examples given here may seem strained and artificial However, computers have very real limitation Intuitively speaking A class of problems that are unsolvable by any computer within the current paradigm of modern programming A function is computable if a Java program exists that can compute it We want to prove the existence of noncomputable functions

SNU OOPSLA Lab. 5 Existence of Noncomputable Functions (1/5) Approach: Matching up Java Programs and Functions E.g., assume 4 functions (f1, f2, f3, f4) and only 3 java programs (p1, p2, p3) Without details, conclude that one function has no program Figure 15.1

SNU OOPSLA Lab. 6 Existence of Noncomputable Functions (4/5) Try to Draw Lines Between Functions and Programs Could draw lines from every program to every function (problem) Figure 15.2

SNU OOPSLA Lab. 7 Existence of Noncomputable Functions (2/5) Consider all the Java programs that input an integer and return an integer The set of such Java programs is a countable set See page 426 of textbook But as shown in chapter 3, the set of functions that accept integers as input and yield positive numbers as output is uncountable See page 125 of textbook Therefore Some functions (problems) cannot have the corresponding Java programs!

SNU OOPSLA Lab. 8 Table of Contents Noncomputable Functions Programs that Read Programs Solving the Halting Problem Examples of non-computable problems Proof of noncomputability Summary

SNU OOPSLA Lab. 9 Programs that Read Programs (1/3) Program that input other programs Figure 15.3 Express programs as a single string We can easily write program to see if there is an IF statement in the program. How about, does the program halt?

SNU OOPSLA Lab. 10 Programs that Read Programs (2/3) “no while statement in its input program”  halt, otherwise  “Not known whether it halts” String E (String P) { if (p.indexOf( “ while ” ) >= 0) {return “ Not known whether it halts. ” ;} else {return “ Halts on all inputs. ” ;} } Figure 15.4

SNU OOPSLA Lab. 11 Programs that Read Programs (3/3) However, what we want is the following function! We want F such that can halt after a finite time with the correct answer Figure 15.5

SNU OOPSLA Lab. 12 Table of Contents Noncomputable Functions Programs that Read Programs Solving the Halting Problem Examples of non-computable problems Proof of noncomputability Summary

SNU OOPSLA Lab. 13 Solving the Halting Problem (1) Does it halt for all input? DoesItHalt.java, DoesItHalt.html DoesItHalt.javaDoesItHalt.html // 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;

SNU OOPSLA Lab. 14 import awb.*; import java.awt.*; public class DoesItHalt extends java.applet.Applet { TextField mInstruct; IntField gStart; TextArea mResults; int j, k; public void init() { mInstruct = new TextField(60); mInstruct.setText("Enter starting integer:"); gStart = new IntField(10); mResults = new TextArea(10, 50); add(mInstruct); add(gStart); add(mResults); } public boolean action(Event e, Object arg) { int yea; String mak, sty, col, own; if (e.target == gStart) { j = 0; mResults.setText("Trace of the integer value: \n"); k = gStart.getInt(); while (k > 1) { j = j + 1; if ((k/2) * 2 == k) // is k even? { k = k / 2; } else { k = 3 * k + 1; } mResults.appendText("k = " + k + "\n"); } mResults.appendText(j + " steps before halting.\n"); return true; } return false; } DoesItHalt.java

SNU OOPSLA Lab. 15 Solving the Halting Problem (2) Try It! e.g. 17: , , No one knows whether this quits for all inputs. Mathematicians have proven that no one, finite program can check this property for all possible programs

SNU OOPSLA Lab. 16 Table of Contents Noncomputable Functions Programs that Read Programs Solving the Halting Problem Examples of non-computable problems Proof of noncompuatbility Summary

SNU OOPSLA Lab. 17 Examples of non-computable problems (1/2) Equivalence: Define by same input > same output Use variation of above program; not sure it ends Cannot generally prove equivalence Figure 15.6

SNU OOPSLA Lab. 18 Examples of non-computable problems (2/2) To check for property X in the behavior of all other programs is impossible Figure 15.7

SNU OOPSLA Lab. 19 Table of Contents Noncomputable Functions Existence of Noncomputable Functions Programs that Read Programs Solving the Halting Problem Examples of non-computable problems Proof of noncompuatbility Summary

SNU OOPSLA Lab. 20 Proof (1/4) Proofs by Contradiction (Indirect Proof) Proving non-computability Sketch of proof Find more details in book

SNU OOPSLA Lab. 21 Proof (2/4) Assume existence of function halt: String halt(string p, string x); Inputs: p = program, x = input data Returns: If halt  "Halts“ or Unless halt  "Does not halt" Now write: String selfhalt(string p) { String answer; answer = halt (p, p); if (answer.equals(“Halts.”)) {return (“Halts on self.”);} else {return (“Does not halt on self.”);} }

SNU OOPSLA Lab. 22 Proof (3/4) String contrary (String p) { String answer; answer = selfhalt(p); if (answer.equals(“Halts on self.”)) {while (true) // go into an infinite loop {answer = “x”} } return “Halt.” // program halts; } Now run contrary on itself

SNU OOPSLA Lab. 23 Proof (4/4) We are running contrary on itself. Paradox! If the halt program decides that it halts, it goes into infinite loop and goes on forever. If the halt program decides that it doesn't halt, it quits immediately. Therefore the halt program cannot exist! If the halting problem is computable, then the halt program exist. Since the halt program cannot exist, the halting problem is not computable In general, whole classes of problems on deciding program behavior are non-computable.

SNU OOPSLA Lab. 24 What Does It All Mean? Programs cannot do everything

SNU OOPSLA Lab. 25 Table of Contents Noncomputable Functions Solving the Halting Problem Examples of non-computable problems Proof of noncomputability Summary

SNU OOPSLA Lab. 26 Summary Limit of contemporary programming languages based on the Von Neumann Computer Architecture There are uncomputable problems We proved that the halting problem is uncompuatble Also the cousins of the halting problem (regarding the behavioral property of programs) are all uncomputable

SNU OOPSLA Lab. 27 Ch15: Noncomputability Text Review Time