290 likes | 305 Views
This article discusses the existence and properties of undecidable languages in automata theory and formal languages, using examples and proof techniques.
E N D
Fall 2008 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
More undecidable problems L1 = {〈M〉: Mis a TM that accepts input e} L2 = {〈M〉: Mis a TM that accepts some input} L3 = {〈M〉: Mis a TM that accepts all inputs} L4 = {〈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 L1 = {〈M〉: Mis a TM that accepts input e} ATM is undecidable
Proof by “reduction” • Show that if L1 can be decided,... so can ATM L1 = {〈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
Proof by “reduction” accept ifM accepts w construct M’ 〈M〉, w reject if not M’ M’: On input z, q1 A 〈M’〉 ☐/☐R If z = e, then simulate M on w Otherwise, reject ☐/☐L q0 M qrej qacc
Recognizable or not? L1 = {〈M〉: Mis a TM that accepts input e} decidable recognizable but undecidable unrecognizable Algorithm for L1 On input 〈M〉: Simulate M on input e
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 L2 = {〈M〉: Mis a TM that accepts some input} ATM is undecidable L1 is undecidable
Example 2 accept ifM accepts some input A 〈M〉 reject if not accept ifM accepts e 〈M〉 reject if not A 〈M’〉 M’ is a Turing Machine such that: If M accepts e, then M’ accepts some input If M does not accept e, then M’ does not accept anything
Example 2 accept ifM accepts w construct M’ 〈M〉 reject if not M’: On input w, A If w = e, then simulate M on e Otherwise, reject 〈M’〉 decidable recognizable but undecidable unrecognizable
Is it recognizable? • Attempt to recognize L2: L2 = {〈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 L2: L2 = {〈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 Turing Machine that recognizes L2: L2 = {〈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, reject. k := k + 1
Explanation of algorithm • Execution of algorithm ... inputs e 0 1 00 01 Simulate M on e for 1 step If M accepts some w, algorithm 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 • 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 ... by yourself this time! L3 = {〈M〉: Mis a TM that accepts all inputs} decidable recognizable but undecidable unrecognizable
Is it recognizable? • Let’s try... L3 = {〈M〉: Mis a TM that accepts all inputs} Simulate M on e for 1 step and then what? Simulate M on e for 2 steps Simulate M on 0for 2 steps accept if all of them accept Simulate M on e for 3 steps Simulate M on 0for 3 steps but there are infinitely many! Simulate M on 1for 3 steps ...
Is it recognizable? • To check that 〈M〉 is in L3, it looks like we have to wait for an infinite number of simulations to finish • But we don’t have that much time! • Step 1: You gotta believe it ... but I don’t! L3 = {〈M〉: Mis a TM that accepts all inputs} decidable recognizable but undecidable unrecognizable
How to argue unrecognizability • First attempt: Remember that... so we can try to argue that L3is recognizable L3 = {〈M〉: Mis a TM that accepts all inputs} If L and L are both recognizable, then L isdecidable.
First attempt • Let’s try... L3 = {〈M〉: Mis a TM that accepts all inputs} L3 = {〈M〉: Mis a TM that does not accept all inputs} Simulate M on e for 1 step Simulate M on e for 2 steps Simulate M on 0for 2 steps accept if M rejects or loops Simulate M on e for 3 steps but how to know if it loops? Simulate M on 0for 3 steps Simulate M on 1for 3 steps ...
How to argue unrecognizability • Second attempt: Use what you know • We can try to argue that L3 = {〈M〉: Mis a TM that accepts all inputs} ATM is not recognizable If we can recognize L3then we can also recognize ATM
Proof by “reduction” accept ifM accepts all inputs A 〈M〉 rej/loop if not accept ifM does not accept w construct M’ 〈M〉, w rej/loop if M accepts w A 〈M’〉 M’ is a Turing Machine such that: If M does not accept w, then M’ accepts all inputs If M accepts w, then M’ rejects or loops on some input
Constructing M’ • To do this, we want to simulate M on w ... but what if simulation loops? • Idea:M’ keeps accepting more and more of its inputs as long as M has not halted on w • If Mnever halts on w, M’ will accept all inputs M’ is a Turing Machine such that: If M does not accept w, then M’ accepts all inputs If M accepts w, then M’ rejects or loops on some input
Constructing M’ M’ is a Turing Machine such that: • Description of M’: If M does not accept w, then M’ accepts all inputs If M accepts w, then M’ rejects or loops on some input length of z On input z, Simulate M on input w for |z| steps If simulation of M reaches state qacc, reject. If simulation of M reaches state qrej, accept. If neither state is reached, accept.
Correctness of construction M’ is a Turing Machine such that: If M does not accept w, then M’ accepts all inputs If M accepts w, thenM’ rejects or loops on some input Description of M’: On input z, Simulate M on input w for |z| steps If simulation of M reaches state qacc, reject. If simulation of M reaches state qrej, accept. If neither state is reached, accept.
Correctness of construction M’ is a Turing Machine such that: If M does not accept w, then M’ accepts all inputs If M accepts w, then M’ rejects or loops on some input In k steps z = 0k Description of M’: On input z, Simulate M on input w for |z| steps If simulation of M reaches state qacc, reject. If simulation of M reaches state qrej, accept. If neither state is reached, accept. M’ rejects input 0k
Example 3 recap • We showed that ... but we know ATM is not recognizable so L3 = {〈M〉: Mis a TM that accepts all inputs} If we can recognize L3then we can also recognize ATM decidable recognizable but undecidable unrecognizable
Example 4 • Step 1: You gotta believe it • Step 2: Use what you know L4 = {(〈M1〉, 〈M2〉): M1and M2 accept the same inputs} decidable recognizable but undecidable unrecognizable ATM is recognizablebut undecidable L1 is recognizablebut undecidable L2 is recognizablebut undecidable L3 is unrecognizable ATM is unrecognizable
Example 4 L4 = {(〈M1〉, 〈M2〉): M1and M2 accept the same inputs} accept ifM1, M2 accept same inputs A 〈M1〉, 〈M2〉 rej/loop if not L3 = {〈M〉: Mis a TM that accepts all inputs} ? accept ifM accepts all inputs 〈M〉 rej/loop if not
Example 4 accept ifM1, M2 accept same inputs A 〈M1〉, 〈M2〉 rej/loop if not accept ifMaccepts all inputs 〈M〉 〈M1〉 A 〈M2〉 rej/loop if not qacc If M accepts all inputs, thenM1, M2accepts same inputs If M does not, thenM1, M2 do not accept same inputs M1 = M M2 = TM that always accepts