Download presentation
Presentation is loading. Please wait.
1
Lecture12 The Halting Problem
2005 SDU
2
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
3
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: AB 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: AB 2005 SDU
4
Size of Natural numbers=size of Even natural numbers
1 2 3 … 2 4 6 … Figure 1: size of (N) = size of () 2005 SDU
5
Countable set 2005 SDU
6
A complex correspondence
Let Q be the set of positive rational numbers, Q = { | m, n N} … 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
7
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
8
Uncountable set R is uncountable.
Proof: We will show that no correspondence exist between N and R. Suppose that such a correspondence f : NR 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
9
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
10
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
11
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:NB By the method of diagonalization we can construct an infinite binary string y, such that y fb(i) for any iN. 2005 SDU
12
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 xAB constructed by: the i-th bit of xA, xA(i)=1 if siA and xA(i)=0 if siA. xA is the characteristic function of A in * The function f: LB where f(A) = xA is one-to-one and onto and hence it is a correspondence. 2005 SDU
13
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
14
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
15
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
16
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
17
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
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.