Title: CSC3130 Formal Languages and Automata Theory Tutorial 9 Undecidable Problem
1CSC3130Formal Languages andAutomata
TheoryTutorial 9Undecidable Problem
2Agenda
- Recap
- Decidibility, Undecidibility, Turing-Recognizable
- Reduction
- Undecidable Problem
3Recap
4Recap Recognize
- Given a language L and a machine M
- M recognizes L iff
- For any w ? L, M halts and goes to an accepting
state - M is a recognizer for L
- However, for w ? L, M may
- Reject
- Loop forever
5Recap Decide
- Given a language L and a machine M
- M decides L iff
- For any w ? L, M halts and accepts AND
- Otherwise, M rejects
- M is a decider for L
- Meaning M can determine whether a given string
is in L or not
6Recognize VS Decide
- Recognize Halts for accepting input
- Decide Halts for all inputs
- Decide gt Recognize
- Make sure that you can distinguish these two
concepts!
7Recap able / ability
- L is Turing-recognizable iffthere is a TM that
recognizes L - L is decidable iffthere is a TM that decides L
- L is undecidable iffthere is no TM that
decides L
8Recognizability VS Decidibility
Turing-Recognizable
Decidable
For a language, L, located here,there is no
machine that halts for all input string
9Some Decidable Problems
- The following problems are decidable
- ADFA ltA, wgt A is a DFA that accepts w
- ANFA ltA, wgt A is a NFA that accepts w
- EDFA ltA, wgt A is a DFA and L(A) Ø
- EQDFA ltA, Bgt A, B are DFAs, L(A) L(B)
- ACFG ltG, wgt G is a CFG that generates w
10Some Undecidable Problems
- The following problems are undecidable
- ATM ltM, wgt M is a TM that accepts w
- To prove undecidability of a problem using
reduction, ATM is used very frequently (nearly in
all situations) - Used in Example 1 and 2 (Later slides)
11Reduction
12Reduction
- Occurs in daily life
- Problem A Travel to Japan
- Problem B Buying a air ticket to Japan
- Problem A reduces to Problem B
- Meaning Settling B automatically solves A
- Put in logical statement
- B is solvable ? A is solvable
13Reduction
Buy an air ticket
Reduce to
Travel to Japan
The problem To buy an air ticket
enclosesThe problem To travel to Japan
14Reduction
B
Reduce to
A
Problem B encloses ASo, B is solved gt A is
solvedThus, B is no harder than A!
15Reduction
B
- A reduces to B
- A is reducible to B
- If B is solved, then A is solved
- i.e., Whenever there is a solution to B,then
there is a solution to A - If A cannot be solved, then B cannot be solved
(Contrapositive) - Thus, B is no harder than A
Reduced to
A
16Undecidable Problems
17Example 1
- Show that REGULARTM is undecidable
- REGULARTM ltMgt M is a TM and L(M) is a
regular language
18REGULARTM is undecidable?
- Idea (By Contradiction)
- Assume there is a TM R that decides REGULARTM
- Construct a TM S that decides ATM
- Contradiction!
19Construction of S
- On input ltM, wgt
- where M is a TM and w is a string
- Construct M by M and w
- Run R on ltMgt
- Output the answer
20Idea of M
- Strategy Convert M into another TM M M
recognizes a regular languageiff M accepts w - If M accepts w, let M recognizes 0, 1
- Otherwise, let M recognizes 0n1n
- With the above properties
- When we run R on ltMgt,
- the output is accept iff M accepts w
- Why? See next few slides
21Construction of M
- M On input x
- If x has the form 0n1n, accept
- If x does not have this form, run M on
input w and output answer - 0n1n is recognized by M anyway
- How about the other strings?
22Construction of M
- For strings of form 0n1n, M accepts
- For all the other strings, listing all cases
- If M accepts w
- they are all accepted by M
- If M rejects w
- they are all rejected by M
- If M loops on w
- they all loop on M
- M On input x
- If x has the form 0n1n, accept
- If x does not have this form, run M on input
w and output answer
23L(M) in relation to S
- If M accepts w
- M recognizes 0n1n?0,1
- 0,1 is regular
- R will accept M
- If M does not accept w
- M recognizes 0n1n?Ø
- 0n1n is not regular
- R will reject M
24REGULARTM is undecidable
- Assume R that decides REGULARTM exists
- We construct S to decide ATM
- On input ltM, wgt, where M is a TM and w is a
string - Construct the following TM M
- M On input x
- If x has the form 0n1n, accept
- If x does not have this form, run M on input w
and accept if M accepts w - 2. Run R on input ltMgt
- 3. Output the output of R
- Now, S decides ATM Contradiction!
25Example 2
- L ltM, wgt M accepts all strings shorter than
w - Show that L is undecidable
26L is undecidable?
- L ltM, wgt M accepts all strings shorter than
w - Again, we try to use the undecidability of ATM to
achieve a contradiction - Idea (By Contradiction)
- Assume there is a TM R that decides L
- Construct a TM (by R), S that decides ATM
- Contradiction!
27Construction of S
- On input ltM, wgt
- where M is a TM and w is a string
- Construct M by M and w
- Run R on ltM, ?gt
- This time, we have a TM that takes 2 arguments
a TM, and a string as inputs - Think what string to put as the 2nd input
- Output the answer
28Idea of M
- Strategy Convert M into another TM M M
accepts all strings shorter than ziff M
accepts w - We want to achieve the following
- When we run R on ltM, zgt,
- the output is accept iff M accepts w
29Idea of M
- Strategy Convert M into another TM M M
accepts all strings shorter than 1iff M
accepts w - We want to achieve the following
- When we run R on ltM, 1gt,
- the output is accept iff M accepts w
30Construction of M
- M On input x
- If x e
- Run M on w
- Output the answer
- If x ?e
- Reject
31Construction of M
- For M
- If M accepts w
- the only possibility is input ise AND M
accepts e - If M rejects w,
- Case 1 x e
- M rejects
- Case 2 x ?e
- M rejects
- If M loops on w
- Case 1 x e
- M loops
- Case 2 x ?e
- M rejects
M On input x If x e run M on
w and output answer If x ?e
reject
32Construction of M
- For M
- If M accepts w
- M accepts only e
- Otherwise
- M does not accepts any string
- including e
M On input x If x e run M on
w and output answer If x ?e
reject
33L(M) in relation to S
- If M accepts w
- L(M) e
- e is exactly the language that contains all
string shorter than 1 - S accepts ltM, 1gt
- Otherwise (i.e., M loops on or rejects w)
- L(M) Ø
- S rejects ltM, 1gt
34L is undecidable
- Assume R that decides REGULARTM exists
- We construct S to decide ATM
- On input ltM, wgt, where M is a TM and w is a
string - Construct the following TM MM On input x
- If x e
- Run M on x
- Output the answer
- If x ?e
- Reject
- 2. Run R on input ltM, 1gt
- 3. Output the output of R
- Now, S decides ATM Contradiction!
35Conclusion
36Pf Undecidability by Reduction
- Given an undecidable language, L
- Assume such a decider TM R, exists
R
37Pf Undecidability by Reduction
- Given an undecidable language, L
- Assume such a decider TM R, exists
- Construct a TM, M, by M and w
- M is from input
R
Input
Modify
M
M
w
37
38Pf Undecidability by Reduction
- Given an undecidable language, L
- Assume such a decider TM R, exists
- Construct a TM, M, by M and w
- M is from input
- Feed M to R
R
Input
Modify
M
M
w
38
39Pf Undecidability by Reduction
M acc w then ACC
Otherwise,REJ
- Given an undecidable language, L
- Assume such a decider TM R, exists
- Construct a TM, M, by M and w
- M is from input
- Feed M to R
- If you are right
- R will accept M iff M accepts w
- R will reject M iff M does not accept w
- Thus, you obtain a decider for ATM
- Contradiction!!
R
Input
Modify
M
M
w
40Q A
- Thanks for coming!
- I understand that this topic is confusing
- Should have some questions?