The Halting Problem of Turing Machines. Is there a procedure that takes as input a program and the input to that program, and the procedure determines.

Slides:



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

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.
Kurt Gödel and the origins of computer science John W. Dawson, Jr. Pennsylvania State University York, PA U.S.A.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen Department of Computer Science University of Texas-Pan American.
Prove the Impossible Sep 28 No program can check whether another program will run into infinite loop. x=0.
CSE115/ENGR160 Discrete Mathematics 02/28/12
Nathan Brunelle Department of Computer Science University of Virginia Theory of Computation CS3102 – Spring 2014 A tale.
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 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]
Recursively Enumerable and Recursive Languages
CSE115/ENGR160 Discrete Mathematics 03/03/11 Ming-Hsuan Yang UC Merced 1.
1 Uncountable Sets continued Theorem: Let be an infinite countable set. The powerset of is uncountable.
Fall 2004COMP 3351 The Chomsky Hierarchy. Fall 2004COMP 3352 Non-recursively enumerable Recursively-enumerable Recursive Context-sensitive Context-free.
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.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Set Theory A B C.
Algorithms: Selected Exercises Goals Introduce the concept & basic properties of an algorithm.
CSE 311 Foundations of Computing I Lecture 30 Computability: Other Undecidable Problems Autumn 2012 CSE 3111.
Lambda Calculus History and Syntax. History The lambda calculus is a formal system designed to investigate function definition, function application and.
1 CO Games Development 2 Week 21 Turing Machines & Computability Gareth Bellaby.
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.
Institute for Experimental Physics University of Vienna Institute for Quantum Optics and Quantum Information Austrian Academy of Sciences Undecidability.
MA/CSSE 474 Theory of Computation More Reduction Examples Non-SD Reductions.
1 Sections 1.5 & 3.1 Methods of Proof / Proof Strategy.
1 Proof Strategies CS/APMA 202 Rosen section 3.1 Aaron Bloomfield.
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 15-1 Mälardalen University 2012.
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.
Great Theoretical Ideas in Computer Science.
1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
Module #7: Algorithmic Complexity Rosen 5 th ed., §2.3.
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.
Chapter 4 Computation Chapter 4: Computation.
Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1 Chapter 0 Introduction Some slides are in courtesy of Prof.
CSE 311: Foundations of Computing Fall 2014 Lecture 27: Cardinality.
Recursively Enumerable and Recursive Languages
Donghyun (David) Kim Department of Mathematics and Computer Science North Carolina Central University 1 Chapter 4 Decidability Some slides are in courtesy.
1 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Lecture 09a: PROOF STRATEGIES Section 3.1 Jarek Rossignac CS1050:
CompSci Today’s Topics Computer Science Noncomputability Upcoming Special Topic: Enabled by Computer -- Decoding the Human Genome Reading Great.
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:
Costas Busch - RPI1 Decidability. Costas Busch - RPI2 Another famous undecidable problem: The halting problem.
1 Recursively Enumerable and Recursive Languages.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Undecidable.
Decidability.
Russell’s Paradox Is W in W? In words, W is the set that contains all the sets that don’t contain themselves. If W is in W, then W contains itself. But.
CSE15 Discrete Mathematics 03/06/17
Computational Complexity Theory
Introduction to Computing Science and Programming I
Recursively Enumerable and Recursive Languages
Discrete Mathematics for Computer Science
Undecidable Problems Costas Busch - LSU.
CS154, Lecture 11: Self Reference, Foundation of Mathematics
Great Theoretical Ideas in Computer Science
Busch Complexity Lectures: Undecidable Problems (unsolvable problems)
CSE 311 Foundations of Computing I
Decidable Languages Costas Busch - LSU.
Halting Problem.
Formal Languages, Automata and Models of Computation
CS154, Lecture 11: Self Reference, Foundation of Mathematics
CSE 311: Foundations of Computing
Computability and Undecidability
Algorithms CSCI 235, Spring 2019 Lecture 37 The Halting Problem
CO Games Development 2 Week 21 Turing Machines & Computability
Presentation transcript:

The Halting Problem of Turing Machines

Is there a procedure that takes as input a program and the input to that program, and the procedure determines if that program terminates on that input? The Halting Problem Posed by Alan Turing in 1936, to prove that there are unsolvable problems

The Halting Problem assume we have procedure H(P,I), where P is a program and I its input H(P,I): if halts(P,I) then “halts” else “loops” Note: a program is a bit string, and may be considered as input hence H can take itself as input P or as input I a call H(H,H) should be allowed Construct a new procedure K(P), where input P is a program K(P): if H(P,P) = “loops” then “halt” else while true do skip; // loops forever K(P) does the opposite of H(P,P) if P halts when given itself as input K loops if P loops when given itself as input K halts Just as above, a call to K(K) should be allowed this makes the call H(K,K) if H(K,K) = “loops” then K(K) produces “halt” if H(K,K) = “halt” then K(K) loops forever and this violates what H(K,K) tells us Thus H cannot exist, as it would be absurd.

Confused? Let’s do it 1 more time

A replay of the proof Assume existence of function halt(p:string,i:string) where p is a program file, given as a string i is the input to p, given as a string  function halt(p:string,i:string) : boolean -> if program p halts with input i then return true else return false Now define a new function trouble(p:string) function trouble(p:string) : boolean -> if halt(p,p) then while true do(); // p applied to p halts, so loop forever else return true; // p applied to p loops, so halt and return true If halt(p,p) returns true then trouble loops forever If halt(p,p) returns false then trouble halts and returns true Part 1

A replay of the proof function trouble(p:string) : boolean -> if halt(p,p) then while true do(); else return true; If halt(p,p) returns true then trouble loops forever If halt(p,p) returns false then trouble halts and returns true Part 2 Assume t is the string that represents the function trouble Does trouble(t) halt? 1. Assume trouble(t) halts From definition of function trouble above trouble(t) does not halt A contradiction 2. Assume trouble(t) loops forever From definition of function trouble above trouble(t) does halt A contradiction

A replay of the proof function trouble(p:string) : boolean -> if halt(p,p) then while true do (); else return true; Part 3 Reality check: what is trouble(t)? trouble(t) We take function trouble and give it trouble (i.e. t) as a parameter We call halt(t,t) - test if function trouble terminates when given as input trouble

Note: arguably this has not been a proof as we have not defined our model of computation. We have assumed that we all know what a function is, a computer, a program,... In 1936 Alan Turing had to invent a “computer” just to give the above proof. That computer, model of computation, is now called a “Turing Machine” His reviewers insisted that he show that a TM was equivalent to Alonzo Church’s Lambda Calculus

ENIAC, arguably the first electronic computer, 1944

Is it weird that a program should take a program as input? Is it weird that a program can take itself as input?

The importance of the halting problem The first problem proved to be undecidable.

Consequences of the halting problem The Entscheidungsproblem is unsolvable

Kurt Gödel (1906–1978) Considered the greatest mathematical logician of the twentieth century, he was one of the founders of recursion theory. A Princeton colleague of Alonzo Church and John von Neumann, his impact on computer science was seminal, but largely indirect.

Philosophical significance of the incompleteness theorems Much later, in his Gibbs Lecture to the American Mathematical Society (1951),Gödel would suggest that the incompleteness theorems are relevant to the questions (1)whether the powers of the human mind exceed those of any machine, and (2)whether there are mathematical problems that are undecidable for the human mind.

The Gibbs Lecture (1951) In his Gibbs Lecture, Gödel attempted to draw implications from the incom- pleteness theorems concerning three problems in the philosophy of mind:

1.Whether there are mathematical ques-tions that are “absolutely unsolvable” by any proof the human mind can conceive 2.Whether the powers of the human mind exceed those of any machine 3.Whether mathematics is our own creation or exists independently of the human mind

Gödel’s conclusions With regard to the first two questions, Gödel argued that “Either … the human mind (even within the realm of pure mathematics) infinitely surpasses the powers of any finite machine, or else there exist absolutely unsolvable diophantine problems”. He believed the first alternative was more likely.

As to the ontological status of mathematics, Gödel claimed that the existence of abso- lutely unsolvable problems would seem “to disprove the view that mathematics is … our own creation; for [a] creator necessarily knows all properties of his creatures”. He admitted that “we build machines and still cannot predict their behavior in every detail”. But that objection, he said, is “very poor”:

Can Humans solve the halting problem? Look at a piece of code and tell me if it halts for a given input [twinPrimes(n:integer) : boolean -> let p := n, found := false in (while not(found) (if prime(p) & prime(p+2) found := true else p := p + 1), found)] The above function searches for twin primes greater than n, such that p > n and p is prime as is p+2 (examples, 17 and 19, 41 and 43, 57 and 59) Will the function halt for all values of n?