You are on page 1of 45

Decidability

1 ELTP-GATE 2017
Consider problems with answer YES or NO

Examples:
• Does Machine M have three states ?

• Is string w a binary number?

• Does DFA M accept any input?

2 ELTP-GATE 2017
A problem is decidable if some Turing machine
Solves (decides) the problem

Decidable problems:
• Does Machine M have three states ?

• Is string w a binary number?

• Does DFA M accept any input?

3 ELTP-GATE 2017
The Turing machine that solves a problem
answers YES or NO for each instance

Input YES
problem Turing Machine
instance NO

ELTP-GATE 2017
The machine that decides a problem:

• If the answer is YES


then halts in a yes state

• If the answer is NO
then halts in a no state

These states may not be final states

5 ELTP-GATE 2017
Turing Machine that decides a problem

YES states

NO states

YES and NO states are halting states


6 ELTP-GATE 2017
Difference between
Recursive Languages and Decidable problems

For decidable problems:


The YES states may not be final states

7 ELTP-GATE 2017
Some problems are undecidable:

which means:
there is no Turing Machine that
solves all instances of the problem

8 ELTP-GATE 2017
A simple undecidable problem:

The membership problem for TM

9 ELTP-GATE 2017
The Membership Problem for TM

Input: •Turing Machine M


•String w

Question: Does M accept w ?

w∈ L(M ) ?

10 ELTP-GATE 2017
Thus, there exists a Turing Machine H
that solves the membership problem

M YES M accepts w
H
w NO M rejects w

11 ELTP-GATE 2017
Turing Machine that accepts L
and halts on any input

H
M YES accept w
M accepts w ?
w NO reject w

12 ELTP-GATE 2017
Since L is chosen arbitrarily
But there are recursively enumerable
languages which are not recursive

Therefore, the membership problem


is undecidable

ELTP-GATE 2017
Another famous undecidable problem:

The halting problem

14 ELTP-GATE 2017
The Halting Problem

Input: •Turing Machine M


•String w

Question: Does M halt on any input w ?

15 ELTP-GATE 2017
If the halting problem was decidable then

every recursively enumerable language

would be recursive

16 ELTP-GATE 2017
Turing Machine that accepts L and halts on any input
M H
NO reject w
M halts on w ?
w YES

accept w
Halts on final state
Run M
with input w reject w
Halts on non-final
state
ELTP-GATE 2017
Since L is chosen arbitrarily
But there are recursively enumerable
languages which are not recursive

Therefore, the halting problem is undecidable

18 ELTP-GATE 2017
Reducibility

19 ELTP-GATE 2017
Problem A is reduced to problem B

If we can solve problem B then


we can solve problem A

B
A

20 ELTP-GATE 2017
Problem A is reduced to problem B

If B is decidable then A is decidable

If A is undecidable then B is undecidable

21 ELTP-GATE 2017
Example: the halting problem (A)

is reduced to

the state-entry problem (B)

22 ELTP-GATE 2017
The state-entry problem
Inputs: •Turing Machine M
•State q
•String w

Question: Does M enter state q


on input w ?

23 ELTP-GATE 2017
Theorem:
The state-entry problem is undecidable

Proof: Reduce the halting problem to

the state-entry problem

24 ELTP-GATE 2017
Suppose we have an algorithm (Turing Machine)
that solves the state-entry problem

We will construct an algorithm


that solves the halting problem

25 ELTP-GATE 2017
Assume we have the state-entry algorithm:

YES
M Algorithm for M enters q
w state-entry
problem NO
q M doesn’t q
enter

26 ELTP-GATE 2017
We want to design the halting algorithm:

M YES M halts on w
Algorithm for
Halting problem
w NO doesn’t
M w
halt on

27 ELTP-GATE 2017
Modify input machine M :
• Add new state q
• From any halting state add transitions to q
M′

M q
Single
halting states halt state
28 ELTP-GATE 2017
M halts
if and
only if

M ′ halts on state q

29 ELTP-GATE 2017
Algorithm for halting problem:

Inputs: machine M and string w

1. Construct machine M ′ with state q

2. Run algorithm for state-entry problem


with inputs: M ′ , q , w

30 ELTP-GATE 2017
Halting problem algorithm

M′ YES YES
Generate q State-entry
M M′ w algorithm NO NO

31 ELTP-GATE 2017
We reduced the halting problem
to the state-entry problem

Since the halting problem is undecidable,


it must be that the state-entry problem
is also undecidable

END OF PROOF
32 ELTP-GATE 2017
Another example:

the halting problem (A)

is reduced to

the blank-tape halting problem (B)

33 ELTP-GATE 2017
The blank-tape halting problem

Input: Turing Machine M

Question: Does M halt when started with


a blank tape?

34 ELTP-GATE 2017
Theorem:
The blank-tape halting problem is undecidable

Proof: Reduce the halting problem to the

blank-tape halting problem

35 ELTP-GATE 2017
Suppose we have an algorithm
for the blank-tape halting problem

We will construct an algorithm


for the halting problem

36 ELTP-GATE 2017
Assume we have the
blank-tape halting algorithm:

M halts on
YES
Algorithm for blank tape
M blank-tape
halting problem NO M doesn’t halt
on blank tape

37 ELTP-GATE 2017
We want to design the halting algorithm:

M YES M halts on w
Algorithm for
halting problem
w NO doesn’t
M w
halt on

38 ELTP-GATE 2017
Construct a new machine Mw
• On blank tape writes w

• Then continues execution like M


Mw
step 1 step2
if blank tape execute M
then write w with input w

39 ELTP-GATE 2017
M halts on input string w

if and
only if

M w halts when started with blank tape

40 ELTP-GATE 2017
Algorithm for halting problem:

Inputs: machine M and string w

1. Construct Mw

2. Run algorithm for


,
blank-tape halting problem
with input M w
41 ELTP-GATE 2017
Halting problem algorithm

blank-tape YES YES


M Generate Mw halting
w Mw NO NO
algorithm

42 ELTP-GATE 2017
We reduced the halting problem
to the blank-tape halting problem

Since the halting problem is undecidable,


the blank-tape halting problem is
also undecidable

END OF PROOF
43 ELTP-GATE 2017
Another example:

The membership problem (A)

is reduced to

the halting problem (B)

44 ELTP-GATE 2017
membership problem algorithm

M H
NO reject w
M halts on w ?
w YES

accept w
Halts on final state
Run M
with input w reject w
Halts on non-final
state
45 ELTP-GATE 2017

You might also like