MELJUN CORTES Automata Theory (Automata18)
-
Upload
meljun-cortes -
Category
Technology
-
view
124 -
download
2
description
Transcript of MELJUN CORTES Automata Theory (Automata18)
CSC 3130: Automata theory and formal languages
More undecidable languages
Fall 2008MELJUN P. CORTES, MBA,MPA,BSCS,ACSMELJUN P. CORTES, MBA,MPA,BSCS,ACS
MELJUN CORTESMELJUN CORTES
More undecidable problems
L1 = { 〈 M 〉 : M is a TM that accepts input }
L2 = { 〈 M 〉 : M is a TM that accepts some input}
L4 = { 〈 M, M’ 〉 : M and M’ accept the same inputs}
L3 = { 〈 M 〉 : M is a TM that accepts all inputs}
decidable recognizable butundecidable
unrecognizable
Example 1
• 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
L1 = { 〈 M 〉 : M is a TM that accepts input }
ATM is undecidable
Proof by “reduction”
• Show that if L1 can be decided,
... so can ATM
L1 = { 〈 M 〉 : M is a TM that accepts input }
Areject if not
accept if M accepts 〈M〉
?〈 M 〉 , w
reject if not
accept if M accepts w
Proof by “reduction”
〈 M 〉 , w
reject if not
accept if M accepts w
Areject if not
accept if M accepts 〈 M〉
A〈 M’ 〉
M’ is a Turing Machine such that:
If M accepts w, then M’ accepts If M does not accept w, then M’ does not accept
Proof by “reduction”
〈 M 〉 , w
reject if not
accept if M accepts w
A〈 M’ 〉
M’: On input z,
If z = , then simulate M on wOtherwise, reject
construct
M’
M’
q0
qaccqrej
☐/☐R
☐/☐
L
q1
M
Recognizable or not?
L1 = { 〈 M 〉 : M is a TM that accepts input }
decidable recognizable butundecidable
unrecognizable
Algorithm for L1
On input 〈 M 〉 : Simulate M on input
Example 2
L2 = { 〈 M 〉 : M is a TM that accepts some input}
• 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
ATM is undecidable L1 is undecidable
Example 2
〈 M 〉
reject if not
accept if M accepts
Areject if not
accept if M accepts some input〈 M〉
A〈 M’ 〉
M’ is a Turing Machine such that:
If M accepts , then M’ accepts some inputIf M does not accept , then M’ does not accept anything
Example 2
〈 M 〉
reject if not
accept if M accepts w
A〈 M’〉
construct
M’
M’: On input w,
If w = , then simulate M on Otherwise, reject
decidable recognizable butundecidable
unrecognizable
Is it recognizable?
• Attempt to recognize L2:
L2 = { 〈 M 〉 : M is a TM that accepts some input}
Simulate M on input Simulate M on input Simulate M on input Simulate M on input ...
Accept if one of them accepts
... but there are infinitely many!
Is it recognizable?
• Attempt to recognize L2:
L2 = { 〈 M 〉 : M is a TM that accepts some input}
For all possible strings x (in lexicographic order):
Simulate M on input x
If it accepts, accept.If it rejects, reject.
lexicographic order: , 0, 1, 00, 01, 10, 11, 000, 001, ...
what if M loops on but M accepts, say, 11?
Is it recognizable?
• Description of Turing Machine that recognizes L2:
L2 = { 〈 M 〉 : M is a TM that accepts some input}
For all possible strings x (in lexicographic order):
For all strings y that come before x
If it accepts, accept.If it rejects, reject.
k := 1
k := k + 1
Simulate M on y for k steps
Explanation of algorithm
• Execution of algorithm
inputs 0 1 00 01 ...
Simulate M on for 1 step
Simulate M on for 2 stepsSimulate M on 0for 2 steps
Simulate M on for 3 stepsSimulate M on 0for 3 stepsSimulate M on 1for 3 steps...
If M accepts some w,algorithm will see thisin some stage of thesimulation
decidable recognizable butundecidable
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 〉 : M is a TM that accepts all inputs}
decidable recognizable butundecidable
unrecognizable
Is it recognizable?
• Let’s try...
L3 = { 〈 M 〉 : M is a TM that accepts all inputs}
Simulate M on for 1 step
Simulate M on for 2 stepsSimulate M on 0for 2 steps
Simulate M on for 3 stepsSimulate M on 0for 3 stepsSimulate M on 1for 3 steps...
and then what?
accept if all of them accept
but there are infinitely many!
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 〉 : M is a TM that accepts all inputs}
decidable recognizable butundecidable
unrecognizable
How to argue unrecognizability
• First attempt: Remember that
... so we can try to argue that L3 is recognizable
L3 = { 〈 M 〉 : M is a TM that accepts all inputs}
If L and L are both recognizable, then L isdecidable.
First attempt
L3 = { 〈 M 〉 : M is a TM that accepts all inputs}
L3 = { 〈 M 〉 : M is a TM that does not accept all inputs}
• Let’s try...Simulate M on for 1 step
Simulate M on for 2 stepsSimulate M on 0for 2 steps
Simulate M on for 3 stepsSimulate M on 0for 3 stepsSimulate M on 1for 3 steps...
accept if M rejects or loops
but how to know if it loops?
How to argue unrecognizability
• Second attempt: Use what you know
• We can try to argue that
L3 = { 〈 M 〉 : M is a TM that accepts all inputs}
ATM is not recognizable
If we can recognize L3 then we can also recognize ATM
Proof by “reduction”
Arej/loop if not
accept if M accepts all inputs〈 M〉
〈 M 〉, w
rej/loop if M accepts w
accept if M does not accept w
A〈 M’ 〉
construct M’
M’ is a Turing Machine such that:
If M does not accept w, then M’ accepts all inputsIf 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 M never 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 inputsIf M accepts w, then M’ rejects or loops on some input
Constructing M’
• 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’ is a Turing Machine such that:
If M does not accept w, then M’ accepts all inputsIf M accepts w, then M’ rejects or loops on some input
length of z
Correctness of construction
M’ is a Turing Machine such that:
If M does not accept w, then M’ accepts all inputsIf M accepts w, then M’ rejects or loops on some input
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.
Description of M’:
Correctness of construction
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’ is a Turing Machine such that:
If M does not accept w, then M’ accepts all inputsIf M accepts w, then M’ rejects or loops on some input
On input z,
Description of M’: In k steps
z = 0k
M’ rejects input 0k
Example 3 recap
L3 = { 〈 M 〉 : M is a TM that accepts all inputs}
• We showed that
... but we know ATM is not recognizable so
If we can recognize L3 then we can also recognize ATM
decidable recognizable butundecidable
unrecognizable
Example 4
• Step 1: You gotta believe it
• Step 2: Use what you know
decidable recognizable butundecidable
unrecognizable
ATM is recognizablebut undecidable
L1 is recognizablebut undecidable
L2 is recognizablebut undecidable
L3 is unrecognizableATM is unrecognizable
L4 = {( 〈 M1 〉 , 〈 M2 〉 ): M1 and M2 accept the same inputs}
Example 4
L4 = {( 〈 M1 〉 , 〈 M2 〉 ): M1 and M2 accept the same inputs}
L3 = { 〈 M 〉 : M is a TM that accepts all inputs}
?〈 M 〉
rej/loop if not
accept if M accepts all inputs
Arej/loop if not
accept if M1, M2 accept same inputs〈 M1 〉 , 〈 M2 〉
Example 4
Arej/loop if not
accept if M1, M2 accept same inputs〈 M1 〉 , 〈 M2 〉
〈M〉
rej/loop if not
accept if M accepts all inputs
A
〈 M1 〉〈 M2 〉
If M accepts all inputs, then M1, M2 accepts same inputsIf M does not, then M1, M2 do not accept same inputs
M1 = M M2 = TM that always accepts
qacc