CSCE 551: Theory of Computation Chin-Tser Huang huangct@cse.sc.edu University of South Carolina
Computation History A computation history of a TM M is a sequence of its configurations C 1, C 2,, C l such hthat tc i+1 legally ll follows from C i according to the rules of M. A computation history is accepting/rejecting if C l is accepting or rejecting configuration respectively. In general, for a TM there may exist an infinite number of configurations i (because of an infinite i tape). However, for TMs that use only limited amount of the tape, the number of configurations is finite. A linear bounded automaton (LBA) is a TM that is permitted to use only the portion of the tape containing the input (i.e., cannot move the head beyond the input). 03/22/2010 2
A LBA is Decidable Lemma Let M be an LBA with q states and g symbols in the tape alphabet. Then there are exactly qng n distinct configurations of M for the tape of length n. Lemma Let M be an LBA with q states and g symbols in the tape alphabet. If M on input of length n does not produce an output within first qng n steps, it loops. Theorem A LBA = { M, w M is an LBA and M accepts w} is decidable. 03/22/2010 3
E LBA is Undecidable E LBA = { M M is an LBA and L(M) = } We will prove that E LBA is undecidable by reduction from A TM. Namely, we show that if E LBA were decidable, A TM would also be. A TM = { M, w M is a TM and M accepts w} Note that Given a TM M and a string w, w simulating M on input w cannot be done on an LBA (since M may use arbitrarily large portion of its tape, while LBA is limited in tape usage). However, given a sequence of configurations of a fixed TM M, M it can be verified on an LBA whether this sequence represents a valid computation history of M on a fixed input w (since the tape content of M, even if arbitrarily large, is embedded in the given configurations and does not require any additional storage from the LBA verifier). 03/22/2010 4
E LBA is Undecidable For a TM M and a string w, M accepts w if and only if the following language is non-empty: L M,w = {#C 1 #C 2 #...#C l # C 1, C 2,, C l is accepting computation history of M on w} Q: How does this help us? 03/22/2010 5
ALL CFG is Undecidable ALL CFG = { G G is a CFG and L(G) = Σ * } Again, we will prove that ALL CFG is undecidable by reduction from A TM. We show that, if ALL CFG were decidable, A TM would also be. Idea is for given TM M and string w, construct a PDA (which we know how to convert to a CFG) that generates the following language: Z M,w = {#C 1 #C 2R #C 3 #C 4R #...#C l # C 1, C 2,, C l is NOT accepting computation history of M on w} Note that M accepts w if and only if Z M,w Σ *. Q: How does this help us? 03/22/2010 6
ALL CFG is Undecidable For given TM M and string w, we need construct a PDA that generates the following language: Z M,w = {#C 1 #C 2R #C 3 #C 4R #...#C l # C 1, C 2,, C l is NOT accepting computation history of M on w} This PDA verifies a number of conditions (each in its own nondeterministic branch): input string starts and ends with #; each C i is a valid configuration of M ; C 1 is a starting configuration for M on w ; C l is an accepting configuration for M ; C i+1 properly follows from C i. If any of these conditions fails, the PDA accepts. Q: Why do we need to reverse every other configuration in the computation history? 03/22/2010 7
Computable Functions A function f : Σ * Σ * is called a computable function if some Turing machine on every input w halts with just f (w) on its tape. Arithmetic functions are computable: m, n m + n; m, n m n; m, n m n; m, n m/n, n 0; m, n m mod n, n 0. 03/22/2010 8
Computable Transformations Computable functions may be transformations of TM descriptions: a computable function f may take as an input M and return M where M and M are TMs. Example: M is a TM that recognizes the same language M but never attempts to move its head off the left-hand end of its tape. If input to f is not a legal encoding of a TM, it reutrns ε. 03/22/2010 9
Mapping Reducibility Definition Language A is mapping reducible to language B, written A m B, if there is a computable function f : Σ * Σ * such that for every w w A f (w) B The function f is called the reduction of A to B. 03/22/2010 10
Mapping Reducibility Mapping reduction provides a way to convert questions about membership testing in A to membership testing in B. Instead of testing whether w A, one can compute f (w) and test whether f (w) B. If one problem is mapping reducible to another, previously solved problem, one can thereby obtain a solution to the original problem. 03/22/2010 11
Theorems Theorem A m B if and only if A m B. Theorem If A m B and B is decidable, then A is decidable. Theorem If A m B and B is Turing-recognizable, then A is Turingrecognizable. Q: How to prove these theorems? 03/22/2010 12
Corollaries Corollary If A m B and A is undecidable, then B is undecidable. Corollary If A m B and A is not Turing-recognizable, i then B is not Turing-recognizable. 03/22/2010 13
A TM m HALT TM Corollary If A m B and A is undecidable, then B is undecidable. Let's apply this Corollary to prove that HALT TM is undecidable by showing that A TM m HALT TM. Since A TM is undecidable, so would be HALT TM. We design a TM F that computes a reduction from A TM to HALT TM : F = On input M, w does the following: 1. Construct a TM M that for a given input x : 1.1 Run M on x; 1.2 If M accepts, then accept; otherwise enter a loop. 2. Output M, w. It is easy to see that M, w A TM iff M, w HALT TM. Therefore, F indeed computes a reduction from A TM to HALT TM. 03/22/2010 14
E TM m EQ TM E TM = { M M is a TM and L(M) = } EQ TM = { M 1, M 2 M 1, M 2 are TMs and L(M 1 ) = L(M 2 )} Q: How to prove that E TM m EQ TM? Let for a given TM M return a pair M, M where M rejects any input. If input is not encoding of a TM, f returns ε. Then M E TM M, M EQ TM So, f is a reduction of E TM to EQ TM. 03/22/2010 15
E TM is Undecidable Previously we proved that E TM is undecidable by reducing A TM to it. Let s review: A TM = { M, w M is a TM and M accepts w} E TM ={ M M is a TM and L(M) = } We assume that we have a decider D E for E TM, and we need to construct a decider D A for A TM. Note that D A gets as an input a pair M, w that needs to be somehow transformed into an input M 1 for D E such that the output of D E on M 1 would help us produce the required output D A on M, w. 03/22/2010 16
E TM is Undecidable Basically, we want to have L(M 1 ) if and only if M accepts w. w Then the output of D A on M, w can simply output the opposite of the output of D E on M 1. Let M 1 rejects everything but w on which it runs M and accepts iff M accepts w. Then L(M 1 ) = if M does not accept w; and L(M 1 ) = {w} if M accepts w. D A can be defined as follows: D A = On input M, w, where M is a TM and w is a string: 1. Construct the following M 1. M 1 = On input x: 1. If x w, reject. 2. If x = w, run M on input w and accept if M does. 2. Run D E on input M 1. 3. If D E accepts, reject; if D E rejects, accept. 03/22/2010 17
A TM m E TM A TM = { M, w M is a TM and M accepts w} E TM = { M M is a TM and L(M) = } Let a TM M rejects everything but w on which it runs M and accepts iff M accepts w. w Then L(M )= if M does not accept w; and L(M ) = {w} if M accepts w. In other words, M, w A TM M E TM. So, computing a TM M for a given pair M, w simply means a reduction of A TM to E TM. Since A TM is undecidable, so is E TM and thus E TM (since decidability is not affected by complementation). 03/22/2010 18
Not Turing-recognizable recognizable Languages Corollary If A m B and A is not Turing-recognizable, then B is not Turing-recognizable. Q: How to make use of this corollary? In a typical application of this corollary, we let A = A TM which is not Turing-recognizable. To prove that B is not Turing-recognizable we will show that A TM m B Alternatively, ti l we can show that t A TM m B 03/22/2010 19
EQ TM EQ TM = { M 1, M 2 M 1, M 2 are TMs and L(M 1 ) = L(M 2 )} Theorem EQ TM is neither Turing-recognizable nor co-turing- recognizable. Q: What would be a high-level outline of the proof? To prove that EQ TM is not Turing-recognizable, recognizable, we will show that A TM m EQ TM (alternative of A TM m EQ TM ). To prove that EQ TM is not Turing-recognizable, we will show that t A TM m EQ TM (alternative ti of A TM m EQ TM ). 03/22/2010 20
A TM m EQ TM To show that A TM m EQ TM we need to construct a computable mapping of M, M w to MM 1, M 2 such hthatt Define a TM F as follows: M, w A TM M 1, M 2 EQ TM. F = On input M, w does the following: 1. Construct the following TMs M 1 and M 2 : M 1 rejects any input. M 2 ignores its input and run M on w. If it accepts, accept. 2. Output M 1, M 2. 03/22/2010 21
A TM m EQ TM To show that A TM m EQ TM we need to construct a computable mapping of M, M w to MM 1, M 2 such hthatt Define a TM F as follows: M, w A TM M 1, M 2 EQ TM. F = On input M, w does the following: 1. Construct the following TMs M 1 and M 2 : M 1 accepts any input. M 2 ignores its input and run M on w. If it accepts, accept. 2. Output M 1, M 2. 03/22/2010 22
Announcement Homework 3 is due TODAY in class Do the following problems for your practice: 5.1, 5.9, 5.22, 5.34 We will not cover Chapter 6 Reading assignment: Ch. 7.1 03/22/2010 23