Reducibility
Fall 2004
COMP 335
1
Problem
A
is reduced to problem
If we can solve problem
we can solve problem A
B
B then
B
A
Fall 2004
COMP 335
2
Problem
If
If
Fall 2004
A
A
is reduced to problem
B
B is decidable then A is decidable
is undecidable then
COMP 335
B is undecidable
3
Example:
the halting problem
is reduced to
the state-entry problem
Fall 2004
COMP 335
4
The state-entry problem
Inputs:
•Turing Machine
•State
q
•String
w
M
Question: Does
M enter state q
on input w ?
Fall 2004
COMP 335
5
Theorem:
The state-entry problem is undecidable
Proof:
Reduce the halting problem to
the state-entry problem
Fall 2004
COMP 335
6
Suppose we have a Decider
for the state-entry algorithm:
M
w
q
Fall 2004
state-entry
problem
decider
YES
M enters q
NO
doesn’t
enter
COMP 335
M
q
7
We want to build a decider
for the halting problem:
M
w
Fall 2004
Halting problem
decider
YES
M halts on w
NO
doesn’t
halt on
COMP 335
M
w
8
We want to reduce the halting problem to
the state-entry problem:
Halting problem decider
M
w
Fall 2004
M
q
w
YES
YES
State-entry
problem
NO NO
decider
COMP 335
9
We need to convert one problem instance
to the other problem instance
Halting problem decider
M
w
Fall 2004
Convert
Inputs
?
M
q
w
YES
YES
State-entry
problem
NO NO
decider
COMP 335
10
M to M :
q
•Add new state
Convert
•From any halting state of
M
add transitions to
q
M
q
M
halting states
Fall 2004
COMP 335
Single
halt state
11
M halts on input w
if and
only if
M halts on state q on input w
Fall 2004
COMP 335
12
Halting problem decider
M
Generate
M
M
q
w
YES
YES
State-entry
problem
NO NO
decider
w
Fall 2004
COMP 335
13
We reduced the halting problem
to the state-entry problem
Since the halting problem is undecidable,
the state-entry problem is undecidable
END OF PROOF
Fall 2004
COMP 335
14
Another example:
the halting problem
is reduced to
the blank-tape halting problem
Fall 2004
COMP 335
15
The blank-tape halting problem
Input:
Turing Machine
Question: Does
M
M halt when started with
a blank tape?
Fall 2004
COMP 335
16
Theorem:
The blank-tape halting problem is undecidable
Proof: Reduce the halting problem to the
blank-tape halting problem
Fall 2004
COMP 335
17
Suppose we have a decider for the
blank-tape halting problem:
YES
M
blank-tape
halting problem
NO
decider
M halts on
blank tape
M doesn’t halt
on blank tape
Fall 2004
COMP 335
18
We want to build a decider
for the halting problem:
M
w
Fall 2004
halting problem
decider
YES
M halts on w
NO
doesn’t
halt on
COMP 335
M
w
19
We want to reduce the halting problem to
the blank-tape halting problem:
Halting problem decider
M
YES
M
w
Fall 2004
Blank-tape
w halting problem
NO
decider
COMP 335
YES
NO
20
We need to convert one problem instance
to the other problem instance
Halting problem decider
M
w
Fall 2004
Convert
Inputs
?
YES
M
Blank-tape
w halting problem
NO
decider
COMP 335
YES
NO
21
Construct a new machine
Mw
• When started on blank tape, writes
• Then continues execution like
w
M
Mw
Fall 2004
step 1
if blank tape
step2
execute M
then write
with input
w
COMP 335
w
22
M halts on input string w
if and
only if
M w halts when started with blank tape
Fall 2004
COMP 335
23
Halting problem decider
M
w
Fall 2004
Generate
Mw
M
YES YES
blank-tape
w halting problem
NO
NO
decider
COMP 335
24
We reduced the halting problem
to the blank-tape halting problem
Since the halting problem is undecidable,
the blank-tape halting problem is undecidable
END OF PROOF
Fall 2004
COMP 335
25
Summary of Undecidable Problems
Halting Problem:
Does machine
M halt on input w ?
Membership problem:
Does machine M accept string
Fall 2004
COMP 335
w?
26
Blank-tape halting problem:
Does machine M halt when starting
on blank tape?
State-entry Problem:
Does machine
on input w ?
Fall 2004
M enter state q
COMP 335
27
Uncomputable Functions
Fall 2004
COMP 335
28
Uncomputable Functions
Domain
f
Values
region
A function is uncomputable if it cannot
be computed for all of its domain
Fall 2004
COMP 335
29
An uncomputable function:
f (n)
Fall 2004
maximum number of moves until
any Turing machine with n states
halts when started with the blank tape
COMP 335
30
Theorem: Function
Proof:
f (n) is uncomputable
Assume for contradiction that
f (n) is computable
Then the blank-tape halting problem
is decidable
Fall 2004
COMP 335
31
Decider for blank-tape halting problem:
Input: machine
M
1. Count states of
2. Compute
M: m
f (m)
3. Simulate M for f (m) steps
starting with empty tape
If
M halts then return YES
otherwise return NO
Fall 2004
COMP 335
32
Therefore, the blank-tape halting
problem is decidable
However, the blank-tape halting
problem is undecidable
Contradiction!!!
Fall 2004
COMP 335
33
Therefore, function
f (n) in uncomputable
END OF PROOF
Fall 2004
COMP 335
34
Undecidable Problems
for
Recursively Enumerable Languages
Fall 2004
COMP 335
35
Take a recursively enumerable language L
Decision problems:
• L is empty?
• L is finite?
• L contains two different strings
of the same length?
All these problems are undecidable
Fall 2004
COMP 335
36
Theorem:
For any recursively enumerable language
it is undecidable to determine whether
L is empty
L
Proof:
We will reduce the membership problem
to this problem
Fall 2004
COMP 335
37
Let
M be the TM with L( M ) L
Suppose we have a decider for the
empty language problem:
M
Fall 2004
empty language
problem
decider
YES
L(M ) empty
NO
L(M ) not empty
COMP 335
38
We will build the decider for the
membership problem:
M
w
Fall 2004
membership
problem
decider
YES
NO
COMP 335
M accepts w
M rejects w
39
We want to reduce the membership problem to
the empty language problem:
Membership problem decider
M
w
Fall 2004
Mw
empty language
problem
decider
COMP 335
YES
NO
NO
YES
40
We need to convert one problem instance
to the other problem instance
Membership problem decider
M
w
Fall 2004
Convert
inputs
?
Mw
empty language
problem
decider
COMP 335
YES
NO
NO
YES
41
Construct machine
Mw :
On arbitrary input string
s
M w executes the same as with M
When M enters a final state,
compare s with w
Accept only if
Fall 2004
sw
COMP 335
42
w L
if and
only if
L( M w ) is not empty
L( M w ) {w}
Fall 2004
COMP 335
43
Membership problem decider
M
w
construct M
w
Mw
empty language
problem
decider
YES
NO
NO
YES
END OF PROOF
Fall 2004
COMP 335
44
© Copyright 2026 Paperzz