Halting Problem Introduction to Computing Science and Programming I.

Slides:



Advertisements
Similar presentations
Lecture Ref. handout page
Advertisements

Chapter 11: Models of Computation
Lecture 19. Reduction: More Undecidable problems
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.
Programming Languages Wrap-up. Your Toolkit Object-oriented Imperative Functional Logic.
David Evans CS200: Computer Science University of Virginia Computer Science Class 27: Modeling Computation.
Computability & Complexity. Scenario I can’t write this program because I’m too dumb.
CSE115/ENGR160 Discrete Mathematics 02/28/12
Nathan Brunelle Department of Computer Science University of Virginia Theory of Computation CS3102 – Spring 2014 A tale.
1 Section 14.1 Computability Some problems cannot be solved by any machine/algorithm. To prove such statements we need to effectively describe all possible.
Prof. Busch - LSU1 Decidable Languages. Prof. Busch - LSU2 Recall that: A language is Turing-Acceptable if there is a Turing machine that accepts Also.
Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)
Fall 2004COMP 3351 The Chomsky Hierarchy. Fall 2004COMP 3352 Non-recursively enumerable Recursively-enumerable Recursive Context-sensitive Context-free.
Linear Bounded Automata LBAs
November 3, 2009Introduction to Cognitive Science Lecture 15: Theory of Computation II 1 Languages Accepted by Turing Machines Example 2: Language L =
1 Foundations of Software Design Fall 2002 Marti Hearst Lecture 29: Computability, Turing Machines, Can Computers Think?
Turing Machines CS 105: Introduction to Computer Science.
1 Reducibility. 2 Problem is reduced to problem If we can solve problem then we can solve problem.
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.
Theory of Computation. Computation Computation is a general term for any type of information processing that can be represented as an algorithm precisely.
More Theory of Computing
Turing Machines Chapter Plan Turing Machines(TMs) – Alan Turing Church-Turing Thesis – Definitions Computation Configuration Recognizable vs. Decidable.
Cs3102: Theory of Computation Class 18: Proving Undecidability Spring 2010 University of Virginia David Evans.
Computable Problems. Computability What does it mean to be computable?
CSE 311 Foundations of Computing I Lecture 30 Computability: Other Undecidable Problems Autumn 2012 CSE 3111.
1 CO Games Development 2 Week 21 Turing Machines & Computability Gareth Bellaby.
Unsolvability and Infeasibility. Computability (Solvable) A problem is computable if it is possible to write a computer program to solve it. Can all problems.
Great Theoretical Ideas in Computer Science for Some.
Great Theoretical Ideas in Computer Science about AWESOME Some Generating Functions Probability Infinity Computability With Alan! (not Turing) Mind-
CSE 311 Foundations of Computing I Lecture 26 Computability: Turing machines, Undecidability of the Halting Problem Spring
CSE 311 Foundations of Computing I Lecture 29 Computability: Turing machines, Undecidability of the Halting Problem Autumn 2012 CSE 3111.
Computer Science 101 Theory of Computing. Computer Science is... The study of algorithms, with respect to –their formal properties –their linguistic realizations.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
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)
Complexity & Computability. Limitations of computer science  Major reasons useful calculations cannot be done:  execution time of program is too long.
Computation Motivating questions: What does “computation” mean? What are the similarities and differences between computation in computers and in natural.
Powerpoint Templates Page 1 Powerpoint Templates Impossible Math Problems (or should we say, undecidable) Math Club 4/16/2012.
CSE 311 Foundations of Computing I Lecture 28 Computability: Other Undecidable Problems Autumn 2011 CSE 3111.
Fundamentals of Informatics Lecture 12 The Halting Problem Bas Luttik.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Recursively Enumerable and Recursive Languages
Overview of the theory of computation Episode 3 0 Turing machines The traditional concepts of computability, decidability and recursive enumerability.
1 The Chomsky Hierarchy. 2 Unrestricted Grammars: Productions String of variables and terminals String of variables and terminals.
Chapter 12 Theory of Computation Introduction to CS 1 st Semester, 2014 Sanghyun Park.
The Church-Turing Thesis Chapter Are We Done? FSM  PDA  Turing machine Is this the end of the line? There are still problems we cannot solve:
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY * Read chapter 4 of the book for next time * Lecture9x.ppt.
Theory of Computation Automata Theory Dr. Ayman Srour.
Computability. Turing Machines Read input letter & tape letter, write tape letter, move left or right.
Costas Busch - RPI1 Decidability. Costas Busch - RPI2 Another famous undecidable problem: The halting problem.
Recursively Enumerable and Recursive Languages. Definition: A language is recursively enumerable if some Turing machine accepts it.
Decidability.
Fall 2013 Lecture 27: Turing machines and decidability CSE 311: Foundations of Computing.
CS 461 – Nov. 2 Sets Prepare for ATM finite vs. infinite Infinite sets
Introduction to Computing Science and Programming I
CSE 311 Foundations of Computing I
Undecidable Problems Costas Busch - LSU.
Computable Problems.
Chapter 9 TURING MACHINES.
Busch Complexity Lectures: Undecidable Problems (unsolvable problems)
CSE 105 theory of computation
CSE 311 Foundations of Computing I
Theory of Computation Turing Machines.
Decidable Languages Costas Busch - LSU.
Halting Problem.
Class 24: Computability Halting Problems Hockey Team Logo
CSE 311: Foundations of Computing
CSE 105 theory of computation
Algorithms CSCI 235, Spring 2019 Lecture 37 The Halting Problem
CO Games Development 2 Week 21 Turing Machines & Computability
Presentation transcript:

Halting Problem Introduction to Computing Science and Programming I

Alan Turing Alan Turing Alan Turing “Father” of modern computing science “Father” of modern computing science Turing Machine Turing Machine Church-Turing thesis Church-Turing thesis Halting Problem Halting Problem 1950: Turing Test 1950: Turing Test

Turing Machine A Turing machine is a very simple theoretical “computer” with a couple basic elements. A Turing machine is a very simple theoretical “computer” with a couple basic elements. An infinitely long tape broken up into cells that can each store a single symbol from a finite set of symbols An infinitely long tape broken up into cells that can each store a single symbol from a finite set of symbols A head that can read or write one symbol at a time from the tape A head that can read or write one symbol at a time from the tape A state diagram that tells the head what to do, move left/right, print a symbol A state diagram that tells the head what to do, move left/right, print a symbol

Church-Turing Thesis This thesis proves has to do with comparing what problems can be solved by different types of computer. This thesis proves has to do with comparing what problems can be solved by different types of computer. It proves that a Turing Machine could theoretically be created that can do anything any digital computer can do. It proves that a Turing Machine could theoretically be created that can do anything any digital computer can do.

Halting Problem An important question of computing science is “Are there problems that cannot be solved?” An important question of computing science is “Are there problems that cannot be solved?” There are, and probably the most famous of these is the halting problem described by Turing. There are, and probably the most famous of these is the halting problem described by Turing. He was thinking in terms of Turing machines (there were no computers), but it is easy to extend the idea. He was thinking in terms of Turing machines (there were no computers), but it is easy to extend the idea.

Halting Problem Halting problem Halting problem Can we write a program that will look at any computer program and its input and decide if the program will halt (not run infinitely)? Can we write a program that will look at any computer program and its input and decide if the program will halt (not run infinitely)? A practical solution might be to run the program and if it halts you have your answer. If after a given amount of time it doesn’t halt, guess that it won’t halt. However, you wouldn’t know if the program would eventually halt. A practical solution might be to run the program and if it halts you have your answer. If after a given amount of time it doesn’t halt, guess that it won’t halt. However, you wouldn’t know if the program would eventually halt.

Halting Problem As it turns out the problem is undecidable. As it turns out the problem is undecidable. For a problem to be undecidable you just have to prove that there is one case it can’t produce an answer for. For a problem to be undecidable you just have to prove that there is one case it can’t produce an answer for. The case that Turing came up with that can never be solved involves giving a program itself as input. The case that Turing came up with that can never be solved involves giving a program itself as input.

Halting Problem Let’s assume we’re given a function halts(prog,input) that is supposed to tell us if the program prog will halt if given the input. The function will return True if it halts, False otherwise. Let’s assume we’re given a function halts(prog,input) that is supposed to tell us if the program prog will halt if given the input. The function will return True if it halts, False otherwise.

Halting Problem Using the halts function the following program can be written that reads in a program, given as a filename) from the user. It then calls the halts function to decide if the program will halt given itself as input. Using the halts function the following program can be written that reads in a program, given as a filename) from the user. It then calls the halts function to decide if the program will halt given itself as input. prog = raw_input("Program file name: ") if halts(prog, prog): while True: print "looping“ else: print "done"

Halting Problem It may not make sense to give a program itself as input, but that isn’t important here. It may not make sense to give a program itself as input, but that isn’t important here. What could happen? What could happen? If halts(prog,prog) returns True, that means the program will halt when given itself as input. However, in this case the program would go into an infinite loop. Therefore the program doesn’t halt. If halts(prog,prog) returns True, that means the program will halt when given itself as input. However, in this case the program would go into an infinite loop. Therefore the program doesn’t halt. If halts(prog,prog) returns False, that means that it wouldn’t halt, but in that case the program does halt. If halts(prog,prog) returns False, that means that it wouldn’t halt, but in that case the program does halt. This contradiction is unavoidable thus proving that the halting problem is undecidable. No function can always correctly decide if a program will halt. This contradiction is unavoidable thus proving that the halting problem is undecidable. No function can always correctly decide if a program will halt.

Turing Test The Turing test was formulated as a way to answer the question, “Can machines think?” The Turing test was formulated as a way to answer the question, “Can machines think?” The basic idea is that there is a sort of judge who converses with a computer and a person. However, this is indirect. The judge writes down questions and the computer and the person, who are hidden from the judge, return typewritten answers. If the judge couldn’t consistently identify which set of answers were from the person, than the computer could “think”. The basic idea is that there is a sort of judge who converses with a computer and a person. However, this is indirect. The judge writes down questions and the computer and the person, who are hidden from the judge, return typewritten answers. If the judge couldn’t consistently identify which set of answers were from the person, than the computer could “think”. Turing predicted that computers could pass this test with 30% of humans as the judge by the year Turing predicted that computers could pass this test with 30% of humans as the judge by the year 2000.