Intro to Theory of Computation LECTURE 15 Last time Countable/uncountable sets. Diagonalization Undecidable/unrecognizable languages (ATM is undecidable) Today ATM is unrecognizable Reductions CS 332 Sofya Raskhodnikova 10/7/2019
Classes of languages recognizable decidable CFL regular ATM {0 𝑛 1 𝑛 0 𝑛 ∣𝑛≥0} {0 𝑛 1 𝑛 ∣𝑛≥0} regular 1* ATM = {〈M,w〉| M is a TM, w is a string, and M accepts w } 10/7/2019
Exercise The fact that ATM is undecidable means that if we are given input <M,w>, then M is not a decider there is no TM S such that L(S)= ATM there is no TM S that accepts on strings in ATM and halts and rejects on strings on strings not in ATM . Both B and C are correct. None of the above. {madam, dad, but, tub, book} 10/7/2019
Classes of languages recognizable decidable CFL regular ATM ATM {0 𝑛 1 𝑛 0 𝑛 ∣𝑛≥0} {0 𝑛 1 𝑛 ∣𝑛≥0} regular 1* ATM = {〈M,w〉| M is a TM, w is a string, and M accepts w } 10/7/2019
Theorem. Language L is decidable iff L and L are Turing-recognizable Proof: 1) L is decidable ⇒ 𝑳 and 𝑳 are Turing-recognizable. 2) 𝑳 and 𝑳 are Turing-recognizable ⇒ L is decidable. 10/7/2019
Prove that the following languages are Turing-recognizable ATM = { 𝑴, 𝒘 ∣ 𝑴 is a TM that accepts string 𝒘} HALTTM = { 𝑴, 𝒘 ∣ 𝑴 is a TM that halts on string 𝒘 } Corollary. is not Turing-recognizable. ATM 10/7/2019
Classes of languages recognizable decidable CFL regular ATM ATM {0 𝑛 1 𝑛 0 𝑛 ∣𝑛≥0} {0 𝑛 1 𝑛 ∣𝑛≥0} regular 1* ATM = {〈M,w〉| M is a TM, w is a string, and M accepts w } 10/7/2019
Problems in language theory ADFA decidable ACFG decidable EDFA decidable ECFG decidable EQDFA decidable ATM undecidable ETM ? EQCFG ? EQTM ? 10/7/2019
Reductions Now that we have an undecidable language, can we get more? 10/7/2019
What is a reduction? A reduction from problem A to problem B is an algorithm for problem A that uses a subroutine for problem B. Many of the deciders we constructed use reductions to one of these problems: ADFA, EDFA, EQDFA, ACFG, ECFG. 10/7/2019
Old Theorem. EQDFA is decidable. EQDFA = { ⟨ 𝑫 𝟏 , 𝑫 𝟐 ⟩| 𝑫 𝟏 , 𝑫 𝟐 are DFAs & 𝑳 𝑫 𝟏 =𝑳( 𝑫 𝟐 )} Proof: The following TM M decides EQDFA. M = `` On input 〈 𝑫 𝟏 , 𝑫 𝟐 〉, where 𝑫 𝟏 , 𝑫 𝟐 are DFAs: Construct a DFA D that recognizes the set difference of 𝑳 𝑫 𝟏 and 𝑳( 𝑫 𝟐 ). Run the decider for EDFA on <D>. If it accepts, accept. O.w. reject.’’ That’s a reduction from EQDFA to EDFA. 10/7/2019
How to tell a difference between a CS student and a CE student? Put an empty kettle in the middle of the kitchen floor and ask your subjects to boil some water. Both subjects will fill the kettle with water, turn on the stove and turn the flame on. Put the kettle full of water on the stove and ask the subjects to boil the water. CE student will turn the flame on. CS student will empty the kettle and put it in the middle of the kitchen floor… thereby reducing the problem to the one that has already been solved! 10/7/2019
Using reductions to prove undecidability We want to prove that language L is undecidable. Idea: Use a proof by contradiction. Suppose to the contrary that L is decidable. Use a decider for L as a subroutine to construct a decider for ATM. But ATM is undecidable. Contradiction! 10/7/2019
Prove that HALTTM is undecidable HALTTM= { 𝑴, 𝒘 ∣ 𝑴 is a TM that halts on string 𝒘 } Proof: Suppose to the contrary that HALTTM is decidable, and let R be a TM that decides it. We construct TM S that decides ATM. S = `` On input 〈𝑴,𝒘〉, where 𝑴 is a TM and w is a string: Run TM R on input <M,w>. If it rejects, reject. If R accepts, simulate M on w. If it accepts, accept. O.w. reject.’’ M must halt on w, since R accepted. That’s a reduction from ATM to HALTTM. 10/7/2019
Prove that ETM is undecidable ETM = { 𝑴 ∣ 𝑴 is a TM and 𝑳 𝑴 =∅} Proof: Suppose to the contrary that ETM is decidable, and let R be a TM that decides it. We construct TM S that decides ATM. S = `` On input 〈𝑴,𝒘〉, where 𝑴 is a TM and w is a string: Run TM R on input ??? 10/7/2019
Prove that ETM is undecidable ETM = { 𝑴 ∣ 𝑴 is a TM and 𝑳 𝑴 =∅} Proof: Suppose to the contrary that ETM is decidable, and let R be a TM that decides it. We construct TM S that decides ATM. S = `` On input 〈𝑴,𝒘〉, where 𝑴 is a TM and w is a string: Construct TM 𝑀′. Run TM R on input <𝑴′>. If , accept. O.w. reject.’’ 𝑀′ = `` On input x, Ignore the input. Run TM M on input w. If it accepts, accept.’’ it rejects 10/7/2019
Prove that CFLTM is undecidable CFLTM = { 𝑴 ∣ 𝑴 is a TM and 𝑳 𝑴 is context-free} Proof: Suppose to the contrary that CFLTM is decidable, and let R be a TM that decides it. We construct TM S that decides ATM. S = `` On input 〈𝑴,𝒘〉, where 𝑴 is a TM and w is a string: Construct TM 𝑀′. Run TM R on input <𝑴′>. If , accept. O.w. reject.’’ 𝑀′ = `` On input x, If x is not of the form 𝟎 𝒏 𝟏 𝒏 𝟐 𝒏 , reject. Run TM M on input w. If it accepts, accept.’’ it rejects 10/7/2019