=========================================================================== CSC 363 Lecture Summary for Week 6 Winter 2008 =========================================================================== -------------------- Mapping Reducibility -------------------- Definition 5.20: A <=m B (A is "mapping reducible" to B) if there exists computable function f : \Sigma* -> \Sigma* (the "reduction") such that \-/ w (- \Sigma*, w (- A iff f(w) (- B. We've already seen definition of "computable" for functions in exercises. Note implicit assumption: both A and B are languages over the same alphabet \Sigma -- not restrictive because we can always consider common alphabet. Example 5.26: E_TM <=m EQ_TM. Given , construct as follows: M1 = M, M2 = "On input x: reject." Clearly, this is computable (copy string, append constant string) -- careful: we are talking about computing description from description ; we are not claiming that it is computable to decide whether or not L(M) = {} or whether or not L(M_1) = L(M_1)! Moreover, since L(M1) = L(M) and L(M2) = {}, (- E_TM iff L(M) = {} iff L(M1) = L(M2) iff (- EQ_TM. Theorem 5.22: If A <=m B and B is decidable, then A is decidable. Proof: (see textbook -- done in lecture) Theorem 5.28: If A <=m B and B is recognizable, then A is recognizable. Proof: (see textbook -- done in lecture) Corollary 5.23: If A <=m B and A is undecidable, then B is undecidable. Corollary 5.29: If A <=m B and A is unrecognizable, then B is unrecognizable. Properties: - A <=m B iff ~A <=m ~B. (Straight from definition, since statement "w (- A iff f(w) (- B" is equivalent to "w !(- A iff f(w) !(- B" and "w !(- L" = "w (- ~L" for any language L.) - If A <=m B and B <=m C, then A <=m C. (Easy exercise, based on function composition: if f,g computable, then g(f()) computable.) Examples: - A_TM <=m HALT_TM: different from "informal" reduction used to prove HALT_TM undecidable. Given , construct such that M accepts w ( (- A_TM) iff M' halts on w' ( (- HALT_TM), as follows: M' = M except replace all transitions to q_reject with transition to state q_new (not in M), then add transitions from q_new to q_new for each input symbol (q_new is deliberate infinite loop) w' = w Clearly, this is computable (again, the *description* of is computable from the description of , but we make no claim about the computability of deciding (- A_TM or (- HALT_TM). Moreover, if M accepts w, then M' accepts w'; if M rejects w, then M' loops on w'; if M loops on w, then M' loops on w', i.e., M accepts w iff M' halts on w', as desired. - A_TM <=m ~E_TM: ~E_TM = { w | (w is not a valid TM encoding) or (w = for a TM M such that L(M) != {}) } Reduction A_TM <=m ~E_TM (all-or-nothing reduction): on input , output the string where M' is the following: M': "On input x: 1. Erase x from tape; write w instead. 2. Run M and do the same (accept if M accepts; reject if M rejects)." Proof of correctness: => Suppose (- A_TM. Then M accepts w, which means M' accepts every input. Therefore L(M') != {}, so (- ~E_TM. <= Suppose !(- A_TM. Then M does not accept w, which means M' accepts no input. Therefore L(M') = {}, so !(- ~E_TM. - A_TM !<=m E_TM: A_TM <=m L implies L undecidable but also ~L unrecognizable (because A_TM <=m L iff ~A_TM <=m ~L and ~A_TM unrecognizable). However, ~E_TM *is* recognizable, as you know from Exercise. Exercise: Does E_TM <=m A_TM? - A_TM <=m REGULAR_TM = { | M is a TM such that L(M) is regular }: Given , construct such that M accepts w ( (- A_TM) iff L(M') is regular ( (- REGULAR_TM) as follows: M' = "On input x: 1. Accept if x = 0^n1^n for some n >= 0. 2. Else, run M on w and do the same." Clearly, can be computed from . Also, if M accepts w, then M' accepts every input, i.e., L(M') = \Sigma*, which is regular; if M does not accept w, then M' accepts 0^n1^n but no other input, i.e., L(M') = { 0^n1^n : n >= 0 }, which is *not* regular. Consequences: REGULAR_TM undecidable (since A_TM undecidable). Also, ~REGULAR_TM unrecognizable (since ~A_TM unrecognizable and reduction above shows ~A_TM <=m ~REGULAR_TM). However, cannot conclude anything about recognizability of REGULAR_TM. - EQ_TM is neither recognizable nor co-recognizable. (A language is "co-recognizable" if its complement is recognizable. Similar definition for decidability unnecessary -- do you see why?) Show A_TM <=m EQ_TM (equiv. to ~A_TM <=m ~EQ_TM): On input , construct as follows: M1 = "On input x: run M on w (ignore x) and do the same." M2 = "On input x: accept." Then, (- A_TM iff M accepts w iff M1 accepts every string iff L(M1) = L(M2) iff (- EQ_TM. This proves that EQ_TM is not co-recognizable. Show A_TM <=m ~EQ_TM (equiv. to ~A_TM <=m EQ_TM): On input , construct as follows: M1 = "On input x: run M on w (ignore x) and do the same." M2 = "On input x: reject." Then, (- A_TM iff M accepts w iff M1 accepts every string iff L(M1) != L(M2) iff !(- EQ_TM iff (- ~EQ_TM. This proves that EQ_TM is not recognizable. (This can also be concluded from earlier reduction E_TM <=m EQ_TM, since E_TM is unrecognizable.)