MELJUN P. CORTES,
MBA,MPA,BSCS,ACS

CSC 3130: Automata theory and formal languages

Undecidable Languages

MELJUN CORTES
Are Turing Machines computers?
input data
instructions
(program)

computer

output data

A Turing Machine does not take th...
The Universal Turing Machine
input x
program 〈
M〉

U

M on input x

The universal TM U takes as inputs a program M
and a s...
Turing Machines as strings
☐/☐R
q0

0/0R
1/1R

qacc

M

qrej

• This Turing Machine can be described by the string
〈 M 〉 =...
The universal Turing Machine

001

U

input x

((q0, qacc, qrej), ((q0, q0, ☐/☐R), program 〈

M〉

q0

state

U on input ( ...
Languages about automata
• A TM can take another TM (or DFA, CFG) as input
ADFA = {( 〈 D 〉 , w): decidDFA that accepts inp...
Languages about automata
ATM = {( 〈 M 〉 , w): M is a TM that accepts w}
• Idea: Simulate M on input w
• Simulation is corr...
Recognizing versus deciding
The language recognized by a TM is the set of
all inputs that make it reach qacc
A TM decides ...
Undecidability
• Turing’s Theorem:
The language ATM is undecidable.

• Before we prove this, let’s observe one thing:
A Tu...
Proof of undecidability
• Proof by contradiction:
Suppose ATM is decidable.
Then there is a TM H that decides ATM:
accept ...
Proof of undecidability
〈M〉,
〈M〉

accept if M accepts
〈M〉
reject if M rejects 〈 M 〉
or M loops on
〈M〉

H

Let H’ be a TM t...
Proof of undecidability
〈M〉,
〈M〉

〈M〉,
〈M〉

H

H’

accept if M accepts
〈M〉
reject if M rejects 〈 M 〉
or M loops on
〈M〉
if ...
Proof of undecidability
〈M〉,
〈M〉

H’

if M rejects 〈 M 〉
or M loops on
reject 〈M accepts 〈 M 〉
if M 〉

accept

Let D be th...
Proof of undecidability
〈
M
〉

D

if M rejects
〈M〉
reject or M accepts 〈
if M loops on 〈
M〉
M〉

accept

What happens when ...
Proof of undecidability: conclusion
• Proof by contradiction
– We assumed ATM was decidable
– Then we had Turing Machines ...
What happened?
input w
Turing Machine
…

ε

0

1

00

acc

rej

rej

acc

rej

acc

loop

rej

M3

rej

loop

rej

rej

…
...
What happened?
〈
〈 M1 〉 M2 〉 M3 〉 M4 〉 …
〈
〈
acc

loop

rej

acc

rej

acc

rej

acc

rej

loop

rej

…

M3 loop

…

…

M1...
What happened?
〈
〈 M1 〉 M2 〉 M3 〉 M4 〉 …
〈
〈
acc

loop

rej

acc

rej

acc

rej

acc

rej

rej

acc

rej

…

…

D

…

…

…...
What happened?
〈
〈 M1 〉 M2 〉 M3 〉 M4 〉 …
〈
〈
acc

loop

rej

acc

rej

acc

rej

acc

rej

rej

acc

rej

D

…

…

…

M1
M...
What happened?
…
〈
〈 M1 〉 M2 〉 M3 〉 M4 〉 〈 D 〉
〈
〈
acc

loop

rej

acc

rej

acc

rej

acc

…

acc

rej

rej

acc

rej

…
...
Unrecognizable languages
The language ATM is recognizable but not
decidable.
• How about languages that are not recognizab...
Unrecognizable languages
• General Theorem
If L and L are both recognizable, then L is
decidable.
• We know ATM is recogni...
Unrecognizable languages
If L and L are both recognizable, then L is
decidable.
• Proof idea
w

M

accept if w ∈ L
rej/loo...
Unrecognizable languages
If L and L are both recognizable, then L is
decidable.
• Proof attempt
Problem: If M loops on w, ...
Bounded simulation
If L and L are both recognizable, then L is
decidable.
• Proof
Let M = TM for L, M’ = TM for L
On input...
Another undecidable language
HALTTM = {( 〈 M 〉 , w): M is a TM that halts on input w}

HALTTM is an undecidable language
•...
Undecidability of halting
If HALTTM can be decided, so can ATM.
• Suppose H decides HALTTM
〈M〉,w

H

accept if M halts on ...
Undecidability of halting
〈M〉,w

〈M〉,w

acc

H
rej

H

accept if M halts on w
reject if M loops on w

acc

simulate
M on w...
More undecidable problems
L1 = { 〈 M 〉 : M is a TM that accepts input ε}
L2 = { 〈 M 〉 : M is a TM that accepts some input}...
Gödel’s incompleteness theorem
Some mathematical statements
are true but not provable.

• Proof due to Turing:
If every tr...
Proof sketch of Gödel’s theorem
• Suppose every true statement has a proof
• For every TM M and input w, one of the statem...
Proof sketch of Gödel’s theorem
• Consider this algorithm for ATM:
On input 〈 M 〉 , w:
For k = 0 to infinity
For all possi...
Proof sketch of Godel’s theorem
• Consider this algorithm for ATM:
On input 〈 M 〉 , w:
For k = 0 to infinity
For all possi...
Upcoming SlideShare
Loading in...5
×

MELJUN CORTES Automata Theory (Automata17)

73

Published on

MELJUN CORTES Automata Theory (Automata17)

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
73
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

MELJUN CORTES Automata Theory (Automata17)

  1. 1. MELJUN P. CORTES, MBA,MPA,BSCS,ACS CSC 3130: Automata theory and formal languages Undecidable Languages MELJUN CORTES
  2. 2. Are Turing Machines computers? input data instructions (program) computer output data A Turing Machine does not take the program as part of its input. ... but it can!
  3. 3. The Universal Turing Machine input x program 〈 M〉 U M on input x The universal TM U takes as inputs a program M and a string x and simulates M on x The program M itself is specified as a TM!
  4. 4. Turing Machines as strings ☐/☐R q0 0/0R 1/1R qacc M qrej • This Turing Machine can be described by the string 〈 M 〉 = ((q0, qacc, qrej), ((q0, q0, ☐/☐R), (q0, qacc, 0/0R), (q0, qrej, 1/1R)))
  5. 5. The universal Turing Machine 001 U input x ((q0, qacc, qrej), ((q0, q0, ☐/☐R), program 〈 M〉 q0 state U on input ( 〈 M 〉 , x) will simulate M on input x
  6. 6. Languages about automata • A TM can take another TM (or DFA, CFG) as input ADFA = {( 〈 D 〉 , w): decidDFA that accepts input w} D is a ab le APDA = {( 〈 P 〉 , w): Pdea PDA that accepts w} is cida b le ATM = {( 〈 M 〉 , w): M is a TM that accepts w} Which of these is decidable?
  7. 7. Languages about automata ATM = {( 〈 M 〉 , w): M is a TM that accepts w} • Idea: Simulate M on input w • Simulation is correct: – If M accepts w, we accept – If M rejects w, we reject – If M loops on w, we loop • This TM recognizes but does not decide ATM
  8. 8. Recognizing versus deciding The language recognized by a TM is the set of all inputs that make it reach qacc A TM decides language L if it recognizes L and does not loop on any input – This kind of TM is called a decider • The textbook uses different terminology: recognizable = recursively enumerable (r. e.) decidable = recursive
  9. 9. Undecidability • Turing’s Theorem: The language ATM is undecidable. • Before we prove this, let’s observe one thing: A Turing Machine M can be given its own description 〈 M 〉 as an input!
  10. 10. Proof of undecidability • Proof by contradiction: Suppose ATM is decidable. Then there is a TM H that decides ATM: accept if M accepts w 〈M〉 H reject if M rejects w 〈 M 〉 or M loops on w or M loops on 〈 M〉 What happens when w = 〈 M 〉 ? 〈M〉 ,w 〈M〉
  11. 11. Proof of undecidability 〈M〉, 〈M〉 accept if M accepts 〈M〉 reject if M rejects 〈 M 〉 or M loops on 〈M〉 H Let H’ be a TM that does the opposite of H acc H H’ acc rej rej
  12. 12. Proof of undecidability 〈M〉, 〈M〉 〈M〉, 〈M〉 H H’ accept if M accepts 〈M〉 reject if M rejects 〈 M 〉 or M loops on 〈M〉 if M rejects 〈 M 〉 or M loops on reject 〈M accepts if M 〉 accept 〈M〉
  13. 13. Proof of undecidability 〈M〉, 〈M〉 H’ if M rejects 〈 M 〉 or M loops on reject 〈M accepts 〈 M 〉 if M 〉 accept Let D be the following TM: 〈M〉 copy 〈M〉, 〈M〉 H’
  14. 14. Proof of undecidability 〈 M 〉 D if M rejects 〈M〉 reject or M accepts 〈 if M loops on 〈 M〉 M〉 accept What happens when M = D? If D accepts 〈 D 〉 D rejects 〈 D 〉 then so D does not exist! If D rejects 〈 D 〉 D accepts 〈 D 〉 then
  15. 15. Proof of undecidability: conclusion • Proof by contradiction – We assumed ATM was decidable – Then we had Turing Machines H, H’, D – But D does not exist! • Conclusion The language ATM is undecidable.
  16. 16. What happened? input w Turing Machine … ε 0 1 00 acc rej rej acc rej acc loop rej M3 rej loop rej rej … … M1 M2 … We can write an infinite table for every pair (M, w)
  17. 17. What happened? 〈 〈 M1 〉 M2 〉 M3 〉 M4 〉 … 〈 〈 acc loop rej acc rej acc rej acc rej loop rej … M3 loop … … M1 M2 Now let’s look only at those w that describe a TM M
  18. 18. What happened? 〈 〈 M1 〉 M2 〉 M3 〉 M4 〉 … 〈 〈 acc loop rej acc rej acc rej acc rej rej acc rej … … D … … … M1 M2 If ATM is decidable, then TM D is in the table
  19. 19. What happened? 〈 〈 M1 〉 M2 〉 M3 〉 M4 〉 … 〈 〈 acc loop rej acc rej acc rej acc rej rej acc rej D … … … M1 M2 D does the opposite of the diagonal entries 〈 M 〉 D accept if M rejects or loops on 〈 M 〉 reject if M accepts 〈M〉
  20. 20. What happened? … 〈 〈 M1 〉 M2 〉 M3 〉 M4 〉 〈 D 〉 〈 〈 acc loop rej acc rej acc rej acc … acc rej rej acc rej … ? D loop … … M1 M2 We run into trouble when we look at (D, 〈 D 〉 )!
  21. 21. Unrecognizable languages The language ATM is recognizable but not decidable. • How about languages that are not recognizable? ATM = {( 〈 M 〉 , w): M is a TM that does not accept w} = {( 〈 M 〉 , w): M rejects or loops on input w} The language ATM is not recognizable.
  22. 22. Unrecognizable languages • General Theorem If L and L are both recognizable, then L is decidable. • We know ATM is recognizable, so if ATM were also, then ATM would be decidable • Impossible by Turing’s Theorem
  23. 23. Unrecognizable languages If L and L are both recognizable, then L is decidable. • Proof idea w M accept if w ∈ L rej/loop if w ∉ L accept M’ accept if w ∉ L rej/loop if w ∈ L reject w w
  24. 24. Unrecognizable languages If L and L are both recognizable, then L is decidable. • Proof attempt Problem: If M loops on w, we Let M = TM for L, M’ = TM for L will never get to step 2! On input w, ① Simulate M on input w. If it accepts, accept. ② Simulate M’ on input w. If it accepts, reject.
  25. 25. Bounded simulation If L and L are both recognizable, then L is decidable. • Proof Let M = TM for L, M’ = TM for L On input w, For k = 0 to infinity Simulate M on input w for k steps. If it accepts, accept. Simulate M’ on input w for k steps. If it accepts, reject.
  26. 26. Another undecidable language HALTTM = {( 〈 M 〉 , w): M is a TM that halts on input w} HALTTM is an undecidable language • To prove this, we will show that If HALTTM can be decided, so can ATM. … so by Turing’s Theorem it is undecidable.
  27. 27. Undecidability of halting If HALTTM can be decided, so can ATM. • Suppose H decides HALTTM 〈M〉,w H accept if M halts on w reject if M loops on w • We want to use H to design D for ATM 〈M〉,w ? accept if M accepts w reject if M rejects or loops on w
  28. 28. Undecidability of halting 〈M〉,w 〈M〉,w acc H rej H accept if M halts on w reject if M loops on w acc simulate M on w rej D accept if M accepts w reject if M rejects or loops on w
  29. 29. More undecidable problems L1 = { 〈 M 〉 : M is a TM that accepts input ε} L2 = { 〈 M 〉 : M is a TM that accepts some input} L3 = { 〈 M 〉 : M is a TM that accepts all inputs} L4 = { 〈 M, M’ 〉 : M and M’ accept the same inputs} Which of these are recognizable?
  30. 30. Gödel’s incompleteness theorem Some mathematical statements are true but not provable. • Proof due to Turing: If every true statement is provable, then ATM can be decided.
  31. 31. Proof sketch of Gödel’s theorem • Suppose every true statement has a proof • For every TM M and input w, one of the statements M accepts w or M does not accept w is true, so it must have a proof
  32. 32. Proof sketch of Gödel’s theorem • Consider this algorithm for ATM: On input 〈 M 〉 , w: For k = 0 to infinity For all possible proofs p of length k If p is a proof of “M accepts w”, accept. If p is a proof of “M does not accept w”, reject. One of them is true, so it has a proof p Eventually, the algorithm will find this proof
  33. 33. Proof sketch of Godel’s theorem • Consider this algorithm for ATM: On input 〈 M 〉 , w: For k = 0 to infinity For all possible proofs p of length k If p is a proof of “M accepts w”, accept. If p is a proof of “M does not accept w”, reject. Recall that TMs can check if a proof p is correct
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×