Lecture12 The Halting Problem

Slides:



Advertisements
Similar presentations
By John E. Hopcroft, Rajeev Motwani and Jeffrey D. Ullman
Advertisements

INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
1 COMP 382: Reasoning about algorithms Unit 9: Undecidability [Slides adapted from Amos Israeli’s]
Computability and Complexity 4-1 Existence of Undecidable Problems Computability and Complexity Andrei Bulatov.
Introduction to Computability Theory
The Halting Problem Sipser 4.2 (pages ). CS 311 Mount Holyoke College 2 Taking stock All languages Turing-recognizable Turing-decidable Context-free.
The Halting Problem Sipser 4.2 (pages ).
Courtesy Costas Busch - RPI1 A Universal Turing Machine.
1 Linear Bounded Automata LBAs. 2 Linear Bounded Automata are like Turing Machines with a restriction: The working space of the tape is the space of the.
1 Undecidability Andreas Klappenecker [based on slides by Prof. Welch]
Decidability. Why study un-solvability? When a problem is algorithmically unsolvable, we realize that the problem must be simplified or altered before.
Decidable and undecidable problems deciding regular languages and CFL’s Undecidable problems.
CHAPTER 4 Decidability Contents Decidable Languages
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture 6 Decidability Jan Maluszynski, IDA, 2007
Fall 2005Costas Busch - RPI1 Recursively Enumerable and Recursive Languages.
Fall 2004COMP 3351 A Universal Turing Machine. Fall 2004COMP 3352 Turing Machines are “hardwired” they execute only one program A limitation of Turing.
CS 310 – Fall 2006 Pacific University CS310 The Halting Problem Section 4.2 November 15, 2006.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 18 Instructor: Paul Beame.
January 28, 2015CS21 Lecture 101 CS21 Decidability and Tractability Lecture 10 January 28, 2015.
Lecture 27UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 27.
CS21 Decidability and Tractability
1 Introduction to Computability Theory Lecture11: The Halting Problem Prof. Amos Israeli.
The Halting Problem – Undecidable Languages Lecture 31 Section 4.2 Wed, Oct 31, 2007.
1 Undecidability Reading: Chapter 8 & 9. 2 Decidability vs. Undecidability There are two types of TMs (based on halting): (Recursive) TMs that always.
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 15-1 Mälardalen University 2012.
A Universal Turing Machine
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)
 2005 SDU Lecture13 Reducibility — A methodology for proving un- decidability.
Computability Universal Turing Machine. Countability. Halting Problem. Homework: Show that the integers have the same cardinality (size) as the natural.
CS 461 – Nov. 7 Decidability concepts –Countable = can number the elements  –Uncountable = numbering scheme impossible  –A TM undecidable –Language classes.
Donghyun (David) Kim Department of Mathematics and Computer Science North Carolina Central University 1 Chapter 4 Decidability Some slides are in courtesy.
1 Undecidability Andreas Klappenecker [based on slides by Prof. Welch]
Section 2.5. Cardinality Definition: A set that is either finite or has the same cardinality as the set of positive integers (Z + ) is called countable.
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
A Universal Turing Machine
CS 461 – Nov. 2 Sets Prepare for ATM finite vs. infinite Infinite sets
Theory of Computability
Recursively Enumerable and Recursive Languages
This statement is false.
CSCI 2670 Introduction to Theory of Computing
Undecidable Problems Costas Busch - LSU.
CSCI 2670 Introduction to Theory of Computing
Theory of Computability
BCS 2143 Theory of Computer Science
MCC 2093 Advanced Theoretical Computer Science
Busch Complexity Lectures: Undecidable Problems (unsolvable problems)
CS154, Lecture 8: Undecidability, Mapping Reductions
CS154, Lecture 8: Undecidability, Mapping Reductions
CSE 105 theory of computation
Decidable Languages Costas Busch - LSU.
CS21 Decidability and Tractability
Proposed in Turing’s 1936 paper
Formal Languages, Automata and Models of Computation
Intro to Theory of Computation
Theory of Computability
CS21 Decidability and Tractability
CSE 105 theory of computation
CSCI 2670 Introduction to Theory of Computing
Cpt S 317: Spring 2009 Reading: Chapter 8 & 9
Theory of Computability
Instructor: Aaron Roth
Automata, Grammars and Languages
More Undecidable Problems
Turing Machines Everything is an Integer
Intro to Theory of Computation
CSE 105 theory of computation
Presentation transcript:

Lecture12 The Halting Problem  2005 SDU

Halting problem Language: ATM = {<M, w>| M is a TM, w is a string, M accepts w} ATM is recognized by the following TM: U = “On input <M, w>, where M is a TM and w is a string: Simulate M on w; If M ever enters its accept state, accept; if M ever enters its reject state, reject.” Note: U is universal because it simulates any other TM from its description. Note: U is not a decider, actually, ATM is not decidable.  2005 SDU 2

Diagonalization The proof of un-decidability of the halting problem uses Georg Cantor (1873)’ technique called diagonalization. Cantor’s problem was to measure the size of infinite sets. The size of finite set is measured by counting the number of its elements. How to measure the size of infinite set? Consider two sets A and B and f: AB a function f is one-to-one if it never maps two different elements of A into the same element of B, f is onto if it hits every element of B. f is called a correspondence if it is both one-to-one and onto. Two sets A and B have the same size if there is a correspondence f: AB  2005 SDU 3

Size of Natural numbers=size of Even natural numbers 1 2 3 … 2 4 6 … Figure 1: size of (N) = size of ()  2005 SDU 4

Countable set  2005 SDU 5

A complex correspondence Let Q be the set of positive rational numbers, Q = { | m, n N} 1 2 3 4 5 … 1/1 3/1 2/1 2/2 3/2 3/3 3/4 3/5 … 2/3 2/4 2/5 1/2 1/3 1/4 1/5 4/2 4/3 4/1 5/1 5/2 5/3 5/4 5/5 4/4 4/5 1 2 3 4 5 … A correspondence between N and Q  2005 SDU 6

Uncountable sets A set for which no correspondence with N can be established is called uncountable. Example of uncountable set: The set R of real numbers is uncountable. Proof. Cantor proved that R is uncountable using the diagonalization method.  2005 SDU 7

Uncountable set R is uncountable. Proof: We will show that no correspondence exist between N and R. Suppose that such a correspondence f : NR exists and deduce a contradiction showing that f fails to work properly. We construct an x R that cannot be the image of any n N. Construct x(0, 1) by the following procedure: x = 0.d1d2d3d4…has an infinite number of decimals constructed by the rule: i  N, choose di a digit different from the i-th digit of f(i) Consequence: i  N, x  f(i). Hence, x does not belong to the list R and thus f is not a correspondence.  2005 SDU 8

Application Theorem 4.17 shows that some language are not decidable or even not Turing recognizable. Reason: There are uncountable many languages yet only countable many Turing machines. Because each Turing machine can recognize a single language and there are more languages than Turing machines, some languages are not recognized by any Turing machine. Such languages are not Turing recognizable.  2005 SDU 9

Application Proof: First we show that the set of Turing machines is countable The set of all strings * is countable, for any alphabet . We may form a list * by writing down all strings of length 0, 1, 2, and so on. Each Turing machine M has an encoding into a string <M> If we omit those strings that are not Turing machines we can obtain a list of all Turing machines.  2005 SDU 10

Application Let L be the set of all languages over . Let B be the set of all infinite binary sequences. B is uncountable. Assuming that B is countable we can set it into a list fb:NB By the method of diagonalization we can construct an infinite binary string y, such that y fb(i) for any iN.  2005 SDU 11

Application There is a correspondence from L to B Since  is an alphabet, * is countable, * ={s1, s2, …, } Each language A  L has a unique infinite binary sequence xAB constructed by: the i-th bit of xA, xA(i)=1 if siA and xA(i)=0 if siA. xA is the characteristic function of A in * The function f: LB where f(A) = xA is one-to-one and onto and hence it is a correspondence.  2005 SDU 12

Halting problem ATM = {<M, w>| M is a TM and M accepts w} is un-decidable. Proceeds by contradiction, assuming that ATM is decidable. Suppose that H is a decider of ATM. On input <M, w>, H halts and accepts it M accepts w. Furthermore, H halts and reject if M fails to accept w.  2005 SDU 13

Proof (continued) Construct a new TM D that uses H as a subroutine. D = “On input <M>, where M is a TM: Run H on input <M,<M>> Output the opposite of what H outputs: accepts if H rejects and reject if H accepts.” What happens when we run D on <D>? A contradiction and consequently neither TM D nor TM H do exist.  2005 SDU 14

Running D on <D> <M1> <M2> <M3> <M4> … <D> … M1 M2 M3 M4 … D accept reject accept reject …accept … accept accept accept accept … accept … reject reject reject reject … reject … accept accept reject reject … accept… reject reject accept accept … ??? … The result of running H on the machines and their description. A contradiction occurs at <D, <D>>.  2005 SDU 15

Unrecognizable language Complement of a language A is the language consisting of all strings on the considered alphabet that does not belong to A. A language is co-Turing-recognizable if it is the complement of a Turing-recognizable language. A language is decidable iff it is both Turing-recognizable and co-Turing-Recognizable. M = “On input w: Run both M1 and M2 on w in parallel; If M1 accepts w, accept; if M2 accepts w, reject.”  2005 SDU 16

Unrecognizable language C(ATM) is not Turing-recognizable. Proof. We know that ATM is Turing-recognizable. If C(ATM) also were Turing-recognizable, then ATM would be decidable. But we have shown that ATM is not decidable. Hence, C(ATM) must not be Turing-recognizable, i.e., ATM is not co-Turing-recognizable.  2005 SDU 17