Chap5 - Reducability2

Problem
X is reduced to problem Y
If we can solve problem Y
then we can solve problem X
Fall 2006
Costas Busch - RPI
1
A
Definition:
Language A
is reduced to
language B
w
B
f (w )
There is a computable
function f (reduction) such that:
w  A  f (w )  B
Fall 2006
Costas Busch - RPI
2
Recall:
Computable function f :
There is a deterministic Turing machine M
which for any string w computes f (w)
Fall 2006
Costas Busch - RPI
3
Theorem:
If: a: Language A is reduced to B
b: Language B is decidable
Then: A is decidable
Proof:
Basic idea:
Build the decider for A
using the decider for B
Fall 2006
Costas Busch - RPI
4
Decider for A
Input
string
w
Reduction
compute f (w ) Decider
f (w )
for B
YES
accept
(halt)
NO
reject
(halt)
YES
accept
(halt)
NO
reject
(halt)
w  A  f (w )  B
END OF PROOF
Fall 2006
Costas Busch - RPI
5
Example:
EQUALDFA  { M1 , M2 : M1 and M2 are DFAs
that accept the same languages }
is reduced to:
EMPTYDFA  { M : M is a DFA that accepts
the empty language }
Fall 2006
Costas Busch - RPI
6
We only need to construct:
M1 ,M2
Turing Machine
for reduction f
M1, M2  EQUALDFA
Fall 2006

Costas Busch - RPI
f  M1 , M2

 M DFA
M  EMPTYDFA
7
Let
Let
M1 ,M2
L1 be the language of DFA M1
L2 be the language of DFA M2
Turing Machine
for reduction f
f  M1 , M2

 M DFA
construct DFA M
by combining M1 and M so that:
2
L(M )  (L1  L2 )  (L1  L2 )
Fall 2006
Costas Busch - RPI
8
L(M )  (L1  L2 )  (L1  L2 )
L1  L2
M1, M2  EQUALDFA
Fall 2006

L(M )  

M  EMPTYDFA
Costas Busch - RPI
9
Decider for EQUALDFA
Input
string
Reduction
compute
M1 ,M2
f  M1,M2
Fall 2006

YES
M
Decider
EMPTYDFA
Costas Busch - RPI
NO
YES
NO
10
Theorem (version 1):
If: a: Language A is reduced to B
b: Language A is undecidable
Then: B is undecidable
(this is the negation of the previous theorem)
Proof:
Suppose B is decidable
Using the decider for B
build the decider for A
Contradiction!
Fall 2006
Costas Busch - RPI
11
If B is decidable then we can build:
Decider for A
Input
string
w
Reduction
compute f (w ) Decider
f (w )
for B
YES
accept
(halt)
NO
reject
(halt)
YES
accept
(halt)
NO
reject
(halt)
w  A  f (w )  B
CONTRADICTION!
Fall 2006
Costas Busch - RPI
END OF PROOF
12
Observation:
In order to prove
that some language B is undecidable
we only need to reduce a
known undecidable language A
to B
Fall 2006
Costas Busch - RPI
13
State-entry problem
Input: •Turing Machine
•State q
•String w
M
Question: Does M enter state q
while processing input string
w?
Corresponding language:
STATETM  { M,w , q : M is a Turing machine that
enters state q on input string w }
Fall 2006
Costas Busch - RPI
14
Theorem: STATETM
is undecidable
(state-entry problem is unsolvable)
Proof:
Reduce
HALTTM
(halting problem)
to
STATETM (state-entry problem)
Fall 2006
Costas Busch - RPI
15
Halting Problem Decider
Decider for HALTTM
Reduction
M,w
Compute
f  M ,w

state-entry problem
decider
Mˆ, q ,w
Given the reduction,
if STATETM is decidable,
then HALTTM is decidable
Fall 2006
Costas Busch - RPI
Decider
STATETM
YES
YES
NO
NO
A contradiction!
since HALTTM
is undecidable
16
We only need to build the reduction:
Reduction
M,w
Compute
f  M ,w
Mˆ, q ,w

 f  M ,w

So that:
M ,w  HALTTM
Fall 2006
Mˆ,w , q  STATETM
Costas Busch - RPI
17
Construct M̂ from M :
special
halt state
M
halting
states
Mˆ
q
qi
x  x ,R
A transition for every unused
tape symbol x of qi
Fall 2006
Costas Busch - RPI
18
Mˆ
special
halt state
M
halting
states
M halts
Fall 2006
q
qi
Mˆ halts on state q
Costas Busch - RPI
19
M halts on input w
Therefore:
Mˆ halts on state q on input w
Equivalently:
M ,w  HALTTM
Mˆ,w , q  STATETM
END OF PROOF
Fall 2006
Costas Busch - RPI
20
Blank-tape halting problem
Input:
Turing Machine
Question: Does
M
M halt when started with
a blank tape?
Corresponding language:
BLANKTM  { M : M is aTuring machin e that
halts when started on blank tape }
Fall 2006
Costas Busch - RPI
21
Theorem: BLANKTM is undecidable
(blank-tape halting problem is unsolvable)
Proof:
Reduce
HALTTM
(halting problem)
to
BLANKTM (blank-tape problem)
Fall 2006
Costas Busch - RPI
22
Halting Problem Decider
Decider for HALTTM
M,w
Reduction
blank-tape problem
decider
Compute
Decider
f  M ,w

M̂
BLANKTM
Given the reduction,
If BLANKTM is decidable,
then HALTTM is decidable
Fall 2006
Costas Busch - RPI
YES
YES
NO
NO
A contradiction!
since HALTTM
is undecidable
23
We only need to build the reduction:
Reduction
M,w
Compute
f  M ,w

M̂
 f  M ,w

So that:
Mˆ  BLANKTM
M ,w  HALTTM
Fall 2006
Costas Busch - RPI
24
Construct M̂ from
Tape is blank?
M,w :
no
yes
Write
w
Mˆ
Run M
on tape
with input w
If M halts then halt
Fall 2006
Costas Busch - RPI
25
Mˆ
Tape is blank?
no
yes
Write
w
on tape
Run M
with input w
M halts on input w
Mˆ halts when started on blank tape
Fall 2006
Costas Busch - RPI
26
M halts on input w
Mˆ halts when started on blank tape
Equivalently:
Mˆ  BLANKTM
M ,w  HALTTM
END OF PROOF
Fall 2006
Costas Busch - RPI
27
Theorem (version 2):
If: a: Language A is reduced to B
b: Language A is undecidable
Then: B is undecidable
Proof:
Suppose B is decidable
Then B is decidable
Using the decider for B
build the decider for A
Contradiction!
Fall 2006
Costas Busch - RPI
28
Observation:
In order to prove
that some language B is undecidable
we only need to reduce some
known undecidable language A
(theorem version 1)
to B
or to B (theorem version 2)
Fall 2006
Costas Busch - RPI
29
Undecidable Problems for
Turing Recognizable languages
Let L be a Turing-acceptable language
• L is empty?
• L is regular?
• L has size 2?
All these are undecidable problems
Fall 2006
Costas Busch - RPI
30
Let L be a Turing-acceptable language
• L is empty?
• L is regular?
• L has size 2?
Fall 2006
Costas Busch - RPI
31
Empty language problem
Input: Turing Machine
M
Question: Is L(M ) empty?
L(M )   ?
Corresponding language:
EMPTYTM  { M : M is aTuring machine that
accepts the empty language }
Fall 2006
Costas Busch - RPI
32
Theorem: EMPTYTM
is undecidable
(empty-language problem is unsolvable)
Proof:
Fall 2006
Reduce
ATM
(membership problem)
to
EMPTYTM (empty language problem)
Costas Busch - RPI
33
membership problem decider
Decider for ATM
M,w
Reduction
empty problem
decider
Compute
Decider
f  M ,w

M̂
EMPTYTM
Given the reduction,
if EMPTYTM is decidable,
then ATM is decidable
Fall 2006
Costas Busch - RPI
YES
YES
NO
NO
A contradiction!
since ATM
is undecidable
34