140 likes | 170 Views
Learn about the diagonalization principle, its applications, and a detailed proof in the theory of computation. Understand how it shows certain sets are uncountable and undecidable.
E N D
COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 27 UofH - COSC 3340 - Dr. Verma
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)} UofH - COSC 3340 - Dr. Verma
Example (contd.) • R = {(a, a), (b, c), (b, d), (c, a), (c, c), (c, d), (d, a), (d, b)} X X complement of the diagonal UofH - COSC 3340 - Dr. Verma
Applications of Diagonalization. • The principle is very useful to show that enumerations of some sets cannot be exhaustive. • For example, one can show: • 2N is uncountable. • The set of real numbers in the interval [0,1] is uncountable. (Exercise) • The set {<M, w> | M accepts w} is not Turing decidable. UofH - COSC 3340 - Dr. Verma
2N is Uncountable. • Suppose that it is countably infinite. Then there is an enumeration 2N = {S0, S1, S2, ...} using the bijection between N and 2N . • Let D = { iN | iSi}. D is a subset of N so it belongs to 2N . • So, D = Sk for some kN. UofH - COSC 3340 - Dr. Verma
2N is Uncountable (contd.) • We ask whether kSk. • Case 1. kSk. By definition of D, k D, but D = Sk, so contradiction. • Case 2. kSk. By definition of D, k D, but D = Sk, again contradiction. • Hence our hypothesis that 2N is countable is false (q.e.d.). UofH - COSC 3340 - Dr. Verma
Where was Diagonalization used? • Consider N X {S0, S1, ....}. • D is the complement of the diagonal of this infinite relation. UofH - COSC 3340 - Dr. Verma
Proof for ATM = {<M, w> | M accepts w} • Suppose that H is a decider for ATM. • On input <M, w>, H halts and accepts if M accepts w and H halts and rejects if M rejects w. H(<M, w>) = 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 <M>. UofH - COSC 3340 - Dr. Verma
Proof for ATM (contd.) D = “On input <M>, where M is a TM: • Run H on input <M, <M>>. • Output the opposite of what H outputs; that is, if H accepts, reject and if H rejects, accept.” D(<M>) = accept if M does not accept <M> reject if M accepts <M>. What happens when we run D with its own description <D> as input? In that case we get D(<D>) = accept if D does not accept <D> reject if D accepts <D>. UofH - COSC 3340 - Dr. Verma
Proof for ATM (contd.) • Basically, • Assume that a TM H decides ATM. • Then use H to build a TM D that when given input < M > accepts exactly when M does not accept input < M >. • Finally, run D on itself. • The machine take the following actions, with the last line being the contradiction. • H accepts <M, w> exactly when M accepts w. • D rejects < M > exactly when M accepts < M >. • D rejects < D > exactly when D accepts < D >. UofH - COSC 3340 - Dr. Verma
Proof for ATM (contd.) • Examine tables of behavior for TMs H and D. UofH - COSC 3340 - Dr. Verma
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. UofH - COSC 3340 - Dr. Verma
Another Perspective • K0 = {(M) (w) | Turing machine M accepts input string w.} If K0is decidable then every Turing acceptable language is also Turing decidable. K0is Turing acceptable. • Every Turing acceptable language is Turing decidable iff K0is Turing decidable. UofH - COSC 3340 - Dr. Verma
Another Perspective • If K0is decidable, K1= {(M) | TM M accepts input string (M) } would also be Turing decidable. • If K1is decidable then so is complement of K1,K1’, is not even Turing acceptable • K1’ = {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} UofH - COSC 3340 - Dr. Verma