CSC 3130: Automata theory and formal languages
description
Transcript of CSC 3130: Automata theory and formal languages
CSC 3130: Automata theory and formal languages
Andrej Bogdanov
http://www.cse.cuhk.edu.hk/~andrejb/csc3130
The Chinese University of Hong Kong
More undecidable languages
Fall 2009
Summary of last lecture
Uinput x
program 〈 M 〉
M on input x
The universal TM U takes as inputs a program Mand a string x and simulates M on x
The program M itself is specified as a TM!
by complementationnot recognizable:
recognizable:
undecidable:
We can simulate M on input w
by Turing’s Theorem
recognizable:
undecidable
We can simulate M on input x
by reduction from ATM
Summary of last lecture
ATM = { 〈 M, w 〉 : M is a TM that accepts input w}
ATM = { 〈 M, w 〉 : M is a TM that does not accept w}
HALTTM = { 〈 M, w 〉 : M is a TM that halts on input w}
More undecidable problems
AEPSTM = { 〈 M 〉 : M is a TM that accepts input }
SOMETM = { 〈 M 〉 : M is a TM that accepts some input}
EQTM = { 〈 M, M’ 〉 : M and M’ accept the same 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
AEPSTM = { 〈 M 〉 : M is a TM that accepts input }
ATM is undecidable
Proof by “reduction”
• Show that if AEPSTM can be decided,
... so can ATM
AEPSTM = { 〈 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 M’ on input = M on input w
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 w and return its answerOtherwise, reject
construct
M’
M’
q0
qaccqrej
☐/☐R
☐/☐L
q1
run M
write w
oth
ers
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 = , then simulate M on w and return answer Otherwise, reject
S accepts 〈 M, w 〉
R accepts 〈 M’ 〉
M’ accepts
M accepts w
Recognizable or not?
AEPSTM = { 〈 M 〉 : M is a TM that accepts input }
decidable recognizable butundecidable
unrecognizable
Turing Machine that recognizes AEPSTM:
On input 〈 M 〉 : Simulate M on input and return answer.
Example 2
SOMETM = { 〈 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 AEPSTM is undecidable
Example 2
〈 M, w 〉
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 w, then M’ accepts some inputIf M does not accept w, then M’ does not accept anything
Example 2
〈 M, w 〉
reject if not
accept if M accepts w
A〈 M’〉
construct
M’
M’: On any input,
Simulate M on wReturn its answer
decidable recognizable butundecidable
unrecognizable
M accepts w
M’ accepts some input
Is it recognizable?
• Attempt to recognize SOMETM:
SOMETM = { 〈 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 SOMETM:
SOMETM = { 〈 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 recognizer for SOMETM:
SOMETM = { 〈 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 or doesn’t finish, continue.
k := 1
k := k + 1
Simulate M on y for k steps
Execution of Turing Machine
• Execution:
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,execution will see thisin some stage of thesimulation
decidable recognizable butundecidable
unrecognizable
Example 3
• Step 1: You gotta believe it
• Step 2: Use what you know
decidable recognizable butundecidable
unrecognizable
ATM is recognizablebut undecidable
AEPSTM is recognizablebut undecidable
SOMETM is recognizablebut undecidable ATM is unrecognizable
EQTM = { 〈 M1, M2 〉 : M1 and M2 accept the same inputs}
Example 3
EQTM = { 〈 M1, M2 〉 : M1 and M2 accept the same inputs}
?〈 M, w 〉
rej/loop if M accepts w
accept if M rej/loops on w
Arej/loop if not
accept if M1, M2 accept same inputs〈 M1, M2 〉
ATM = { 〈 M, w 〉 : M is a TM that does not accept w}
Example 3
Arej/loop if not
accept if M1, M2 accept same inputs〈 M1, M2 〉
〈 M, w 〉
A
〈 M1 〉
〈 M2 〉
rej/loop if M accepts w
accept if M rej/loops on w
M1: “On any input: Run M on w”M2: “Reject”
M1, M2 accept same inputs M rej/loops on w