Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 27UofH - COSC 3340 - Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 27.

Similar presentations


Presentation on theme: "Lecture 27UofH - COSC 3340 - Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 27."— Presentation transcript:

1 Lecture 27UofH - COSC 3340 - Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 27

2 UofH - COSC 3340 - Dr. Verma 2 Diagonalization Principle Let S be any nonempty set and R any relation on S. The principle states that: the complement of the diagonal is different from each row. Can be generalized to relations on two sets, etc. Example: Let S = {a, b, c, d}. R = {(a, a), (b, c), (b, d), (c, a), (c, c), (c, d), (d, a), (d, b)}

3 Lecture 27UofH - COSC 3340 - Dr. Verma 3 Example (contd.) R = {(a, a), (b, c), (b, d), (c, a), (c, c), (c, d), (d, a), (d, b)} abcd aX bXX cXXX dXX abcd complement of the diagonal X X a b c d

4 Lecture 27UofH - COSC 3340 - Dr. Verma 4 Applications of Diagonalization. The principle is very useful to show that enumerations of some sets cannot be exhaustive. For example, one can show: 1. 2 N is uncountable. 2. The set of real numbers in the interval [0,1] is uncountable. (Exercise) 3. The set { | M accepts w} is not Turing decidable.

5 Lecture 27UofH - COSC 3340 - Dr. Verma 5 2 N is Uncountable. Suppose that it is countably infinite. Then there is an enumeration 2 N = {S 0, S 1, S 2,...} using the bijection between N and 2 N. Let D = { i  N | i  S i }. D is a subset of N so it belongs to 2 N. So, D = S k for some k  N.

6 Lecture 27UofH - COSC 3340 - Dr. Verma 6 2 N is Uncountable (contd.) We ask whether k  S k. – Case 1. k  S k. By definition of D, k  D, but D = S k, so contradiction. – Case 2. k  S k. By definition of D, k  D, but D = S k, again contradiction. Hence our hypothesis that 2 N is countable is false (q.e.d.).

7 Lecture 27UofH - COSC 3340 - Dr. Verma 7 Where was Diagonalization used? Consider N X {S 0, S 1,....}. D is the complement of the diagonal of this infinite relation. 0123.. s0s0 XX s1s1 XX s2s2 s3s3 XX.X.

8 Lecture 27UofH - COSC 3340 - Dr. Verma 8 Proof for A TM = { | M accepts w} Suppose that H is a decider for A TM. On input, H halts and accepts if M accepts w and H halts and rejects if M rejects w. H( ) = accept if M accepts w reject if M does not accept w. Now we construct a new Turing machine D with H as a subroutine. D calls H to determine what M does when input to M is its own description.

9 Lecture 27UofH - COSC 3340 - Dr. Verma 9 Proof for A TM (contd.) D = “On input, where M is a TM: 1. Run H on input >. 2. Output the opposite of what H outputs; that is, if H accepts, reject and if H rejects, accept.” D( ) = accept if M does not accept reject if M accepts. What happens when we run D with its own description as input? In that case we get D( ) = accept if D does not accept reject if D accepts.

10 Lecture 27UofH - COSC 3340 - Dr. Verma 10 Proof for A TM (contd.) Basically, – Assume that a TM H decides A TM. – Then use H to build a TM D that when given input accepts exactly when M does not accept input. – Finally, run D on itself. The machine take the following actions, with the last line being the contradiction. – H accepts exactly when M accepts w. – D rejects exactly when M accepts. – D rejects exactly when D accepts.

11 Lecture 27UofH - COSC 3340 - Dr. Verma 11 Proof for A TM (contd.) Examine tables of behavior for TMs H and D.... M1M1 accept M2M2 M3M3... M4M4 accept ::

12 Lecture 27UofH - COSC 3340 - Dr. Verma 12 Another Perspective on Halting Problem If L is a Turing-decidable language then L’ (complement of L) is also Turing-decidable. If it were possible to predict for any TM M and any input string whether or not M would halt on that input, then every Turing- acceptable language would also be Turing decidable.

13 Lecture 27UofH - COSC 3340 - Dr. Verma 13 Another Perspective K 0 = {  (M)  (w) | Turing machine M accepts input string w.} If K 0 is decidable then every Turing acceptable language is also Turing decidable. K 0 is Turing acceptable. – Every Turing acceptable language is Turing decidable iff K 0 is Turing decidable.

14 Lecture 27UofH - COSC 3340 - Dr. Verma 14 Another Perspective If K 0 is decidable, K 1 = {  (M) | TM M accepts input string  (M) } would also be Turing decidable. If K 1 is decidable then so is complement of K 1, K 1 ’, is not even Turing acceptable K 1 ’ = {w  {I, c}* | w is not the encoding of any TM M, or w =  (M) for some M that does not accept its own encoding}


Download ppt "Lecture 27UofH - COSC 3340 - Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 27."

Similar presentations


Ads by Google