200 likes | 329 Views
Fall 2009. The Chinese University of Hong Kong. CSC 3130: Automata theory and formal languages. More undecidable languages. Andrej Bogdanov http://www.cse.cuhk.edu.hk/~andrejb/csc3130. Summary of last lecture. U. input x. M on input x. program 〈 M 〉.
E N D
Fall 2009 The Chinese University of Hong Kong CSC 3130: Automata theory and formal languages More undecidable languages Andrej Bogdanov http://www.cse.cuhk.edu.hk/~andrejb/csc3130
Summary of last lecture U input x M on input x program 〈M〉 The universal TMU takes as inputs a program Mand a string x and simulates M on x The program M itself is specified as a TM!
Summary of last lecture ATM = {〈M, w〉: Mis a TM that accepts input w} recognizable: We can simulate M on input w undecidable: by Turing’s Theorem ATM = {〈M, w〉: Mis a TM that does not accept w} not recognizable: by complementation HALTTM = {〈M, w〉: Mis a TM that halts on input w} recognizable: We can simulate M on input x undecidable by reduction from ATM
More undecidable problems AEPSTM = {〈M〉: Mis a TM that accepts input e} SOMETM = {〈M〉: Mis a TM that accepts some input} EQTM = {〈M, M’〉: Mand M’ accept the same inputs} decidable recognizable but undecidable unrecognizable
Example 1 • Step 1: You gotta believe it • To know if M accepts e, it looks like we have to simulate it • But then we might end up in a loop • Step 2: Use what you know AEPSTM = {〈M〉: Mis a TM that accepts input e} ATM is undecidable
Proof by “reduction” • Show that if AEPSTM can be decided,... so can ATM AEPSTM = {〈M〉: Mis a TM that accepts input e} accept ifM accepts e A 〈M〉 reject if not ? accept ifM accepts w 〈M, w〉 reject if not
Proof by “reduction” accept ifM accepts e A 〈M〉 reject if not accept ifM accepts w 〈M, w〉 reject if not A 〈M’〉 M’ is a Turing Machine such that: If M accepts w, then M’ accepts e If M does not accept w, then M’ does not accept e M’ on input e=M on input w
Proof by “reduction” accept ifM accepts w construct M’ 〈M, w〉 reject if not M’ q1 M’: On input z, A 〈M’〉 ☐/☐R ☐/☐L If z = e, then simulate M on w and return its answer Otherwise, reject write w q0 others run M qrej qacc
The argument • We assume AEPSTM is decidable. Let A be a decider. • We describe (in high level) a TM that decides ATM: S: On input 〈M, w〉: Construct the following TM M’: Run A on input 〈M’〉 and return its answer. M’: On input z, If z = e, then simulate M on w and return answer Otherwise, reject R accepts 〈M’〉 S accepts 〈M, w〉 M’ accepts e M accepts w
Recognizable or not? AEPSTM = {〈M〉: Mis a TM that accepts input e} decidable recognizable but undecidable unrecognizable Turing Machine that recognizesAEPSTM: On input 〈M〉: Simulate M on input e and return answer.
Example 2 • Step 1: You gotta believe it • To know if M accepts, it looks like we have to simulate it • But then we might end up in a loop • Step 2: Use what you know SOMETM = {〈M〉: Mis a TM that accepts some input} ATM is undecidable AEPSTM is undecidable
Example 2 accept ifM accepts some input A 〈M〉 reject if not accept ifM accepts e 〈M, w〉 reject if not A 〈M’〉 M’ is a Turing Machine such that: If M accepts w, then M’ accepts some input If M does not accept w, then M’ does not accept anything
Example 2 accept ifM accepts w construct M’ 〈M, w〉 reject if not M’: On any input, M’ accepts some input M accepts w A Simulate M on w Return its answer 〈M’〉 decidable recognizable but undecidable unrecognizable
Is it recognizable? • Attempt to recognize SOMETM: SOMETM = {〈M〉: Mis a TM that accepts some input} Simulate M on input e Simulate M on input 0 Simulate M on input 1 Accept if one of them accepts Simulate M on input 00 ... ... but there are infinitely many!
Is it recognizable? • Attempt to recognize SOMETM: SOMETM = {〈M〉: Mis a TM that accepts some input} For all possible strings x (in lexicographic order): Simulate M on input x what if M loops on ebut M accepts, say, 11? If it accepts, accept. If it rejects, reject. lexicographic order: e, 0, 1, 00, 01, 10, 11, 000, 001, ...
Is it recognizable? • Description of recognizer for SOMETM: SOMETM = {〈M〉: Mis a TM that accepts some input} k := 1 For all possible strings x (in lexicographic order): For all strings y that come before x Simulate M on y for k steps If it accepts, accept. If it rejects or doesn’t finish, continue. k := k + 1
Execution of Turing Machine • Execution: ... inputs e 0 1 00 01 Simulate M on e for 1 step If M accepts some w, execution will see this in some stage of the simulation Simulate M on e for 2 steps Simulate M on 0for 2 steps Simulate M on e for 3 steps Simulate M on 0for 3 steps Simulate M on 1for 3 steps ... decidable recognizable but undecidable unrecognizable
Example 3 • Step 1: You gotta believe it • Step 2: Use what you know EQTM = {〈M1, M2〉: M1and M2 accept the same inputs} decidable recognizable but undecidable unrecognizable AEPSTM is recognizablebut undecidable ATM is recognizablebut undecidable SOMETM is recognizablebut undecidable ATM is unrecognizable
Example 3 EQTM = {〈M1, M2〉: M1and M2 accept the same inputs} accept ifM1, M2 accept same inputs A 〈M1, M2〉 rej/loop if not ATM = {〈M, w〉: Mis a TM that does not accept w} ? accept ifM rej/loops on w 〈M, w〉 rej/loop if M accepts w
Example 3 accept ifM1, M2 accept same inputs A 〈M1, M2〉 rej/loop if not accept ifM rej/loops on w 〈M, w〉 〈M1〉 M1: “On any input: Run M on w” A 〈M2〉 M2: “Reject” rej/loop if M accepts w M1, M2 accept same inputs M rej/loops on w