You are on page 1of 42

Undecidable Problems

(unsolvable problems)

Fall 2006 Costas Busch - RPI 1


Decidable Languages
Recall that:
A language A is decidable,
if there is a Turing machine M (decider)
that accepts the language A and
halts on every input string
Decision
Turing Machine M On Halt:
YES
Accept
Input
Decider for A
string NO
Reject
Fall 2006 Costas Busch - RPI 2
A computational problem is decidable
if the corresponding language is decidable

We also say that the problem is solvable

Fall 2006 Costas Busch - RPI 3


Problem: Does DFA M accept
the empty language L(M )  ?

Corresponding Language: X
(Decidable)
EMPTYDFA 
{ M : M is a DFA that accepts empty language  }

Description of DFA M as a string


(For example, we can represent M as a
binary string, as we did for Turing machines)
Fall 2006 Costas Busch - RPI 4
Decider for EMPTYDFA :

On input M :
Determine whether there is a path from
the initial state to any accepting state
DFA M DFA M

L (M )   L (M )  

Decision: Reject M Accept M


Fall 2006 Costas Busch - RPI 5
Problem: Does DFA M accept
a finite language?

Corresponding Language: X (Decidable)


FINITE DFA 
{ M : M is a DFA that accepts a finite language}

Fall 2006 Costas Busch - RPI 6


Decider for FINITE DFA :
On input M :
Check if there is a walk with a cycle
from the initial state to an accepting state

DFA M DFA M

infinite finite
Decision: Reject M Accept M
(NO) (YES)
Fall 2006 Costas Busch - RPI 7
Problem: Does DFA M accept string w ?

Corresponding Language: X (Decidable)


ADFA 
{ M ,w : M is a DFA that accepts string w }

Fall 2006 Costas Busch - RPI 8


Decider for ADFA :

On input string M ,w :

Run DFA M on input string w

If M accepts w
Then accept M ,w (and halt)
Else reject M ,w (and halt)

Fall 2006 Costas Busch - RPI 9


Problem: Do DFAs M1 and M2
accept the same language?

Corresponding Language: X (Decidable)


EQUALDFA 
{ M1 , M2 : M1 and M2 are DFAs that accept
the same languages }

Fall 2006 Costas Busch - RPI 10


Decider for EQUALDFA :

On input M1 , M2 :
Let L1 be the language of DFA M1
Let L2 be the language of DFA M2

Construct DFA M such that:

L(M )  (L1  L2 )  (L1  L2 )

(combination of DFAs)
Fall 2006 Costas Busch - RPI 11
( L1  L2 )  ( L1  L2 )  

L1  L2   and L1  L2  

L1 L2 L L2 L1 L1
2
L1  L2 L2  L1

L1  L2
Fall 2006 Costas Busch - RPI 12
( L1  L2 )  ( L1  L2 )  

L1  L2   or L1  L2  

L1 L2 L2 L1

L1  L2 L2  L1

L1  L2
Fall 2006 Costas Busch - RPI 13
Therefore, we only need
to determine whether

L(M )  (L1  L2 )  (L1  L2 )  

which is a solvable problem for DFAs:


EMPTYDFA

Fall 2006 Costas Busch - RPI 14


Undecidable Languages
undecidable language = not decidable language

There is no decider:
there is no Turing Machine
which accepts the language
and makes a decision (halts)
for every input string

(machine may make decision for some input strings)

Fall 2006 Costas Busch - RPI 15


For an undecidable language,
the corresponding problem is
undecidable (unsolvable):

there is no Turing Machine (Algorithm)


that gives an answer (yes or no)
for every input instance

(answer may be given for some input instances)

Fall 2006 Costas Busch - RPI 16


We have shown before that there are
undecidable languages:

L
Turing-Acceptable L

Decidable

L is Turing-Acceptable and undecidable


Fall 2006 Costas Busch - RPI 17
We will prove that two particular problems
are unsolvable:

Membership problem

Halting problem

Fall 2006 Costas Busch - RPI 18


Membership Problem
Input: •Turing Machine M
•String w

Question: Does M accept w ?


w L(M ) ?

Corresponding language:
ATM  { M ,w : M is a Turing machine that
accepts string w }
Fall 2006 Costas Busch - RPI 19
Theorem: ATM is undecidable
(The membership problem is unsolvable)

Proof:
Basic idea:
We will assume that ATM is decidable;
We will then prove that
every decidable language
is Turing-Acceptable
A contradiction!
Fall 2006 Costas Busch - RPI 20
Suppose that ATM is decidable

Input
string Decider
M ,w for ATM
M YES M accepts w
H
w NO M rejects w

Fall 2006 Costas Busch - RPI 21


Let L be a Turing recognizable language

Let ML be the Turing Machine that accepts L

We will prove that L is also decidable:


we will build a decider for L

Fall 2006 Costas Busch - RPI 22


String description of ML

Decider for L

ML Decider for ATM


YES accept s
ML accepts s ? (and halt)

s NO reject s
Input (and halt)
string

Fall 2006 Costas Busch - RPI 23


Therefore, L is decidable

Since L is chosen arbitrarily, every


Turing-Acceptable language is decidable

But there is a Turing-Acceptable language


which is undecidable

Contradiction!!!!
END OF PROOF
Fall 2006 Costas Busch - RPI 24
We have shown:

Undecidable ATM

Decidable

Fall 2006 Costas Busch - RPI 25


We can actually show:

Turing-Acceptable ATM

Decidable

Fall 2006 Costas Busch - RPI 26


ATM is Turing-Acceptable

Turing machine that accepts ATM :


1. Run M on input w
M ,w 2. If M accepts w
then accept M ,w

Fall 2006 Costas Busch - RPI 27


Halting Problem
Input: •Turing Machine M
•String w

Question: Does M halt while


processing input string w ?

Corresponding language:

HALTTM  { M ,w : M is a Turing machine that


halts on input string w }
Fall 2006 Costas Busch - RPI 28
Theorem: HALTTM is undecidable
(The halting problem is unsolvable)

Proof:
Basic idea:
Suppose that HALTTM is decidable;
we will prove that
every decidable language
is also Turing-Acceptable
A contradiction!
Fall 2006 Costas Busch - RPI 29
Suppose that HALTTM is decidable

Input
string
M ,w
halts on
M YES M w
Decider for input

w HALTTM
NO doesn’t halt
M on input w

Fall 2006 Costas Busch - RPI 30


Let L be a Turing-Acceptable language

Let ML be the Turing Machine that accepts L

We will prove that L is also decidable:


we will build a decider for L

Fall 2006 Costas Busch - RPI 31


Decider for L
Decider for
HALTTM
ML
NO reject s
ML halts on s ? and halt
s YES

Input
accept s
ML halts
string and accepts
Run ML and halt

with input s
reject s
ML halts
and rejects
and halt

Fall 2006 Costas Busch - RPI 32


Therefore, L is decidable

Since L is chosen arbitrarily, every


Turing-Acceptable language is decidable

But there is a Turing-Acceptable language


which is undecidable

Contradiction!!!!
END OF PROOF
Fall 2006 Costas Busch - RPI 33
An alternative proof

Theorem: HALTTM is undecidable


(The halting problem is unsolvable)

Proof:
Basic idea:
Assume for contradiction that
the halting problem is decidable;

we will obtain a contradiction


using a diagonilization technique
Fall 2006 Costas Busch - RPI 34
Suppose that HALTTM is decidable

Input
string Decider
M ,w for HALTTM

M YES M halts on w
H
w NO doesn’t
M w
halt on
Fall 2006 Costas Busch - RPI 35
Looking inside H
Decider for HALTTM
H qaccept YES
Input string:
M ,w q0 M halts on w?
qreject NO

Fall 2006 Costas Busch - RPI 36


Construct machine H :
H Loop forever
H qacceptYES qa qb
M ,w q0 M halts on w?
qreject NO

If M halts on input w Then Loop Forever


Else Halt
Fall 2006 Costas Busch - RPI 37
Construct machine F :

F
Copy M M, M
M
on tape
H

If M halts on input M
Then loop forever
Else halt
Fall 2006 Costas Busch - RPI 38
Run F with input itself
F
Copy F F ,F
F
on tape
H

If F halts on input F
Then F loops forever on input F
Else F halts on input F

CONTRADICTION!!!
END OF PROOF
Fall 2006 Costas Busch - RPI 39
We have shown:

Undecidable HALTTM

Decidable

Fall 2006 Costas Busch - RPI 40


We can actually show:

Turing-Acceptable HALTTM

Decidable

Fall 2006 Costas Busch - RPI 41


HALTTM is Turing-Acceptable

Turing machine that accepts HALTTM :

1. Run M on input w
M ,w
2. If M halts on w
then accept M ,w

Fall 2006 Costas Busch - RPI 42

You might also like