Reductions for Decidability

advertisement
Reductions
Prof. Busch - LSU
1
Problem
X is reduced to problem Y
If we can solve problem Y
then we can solve problem X
Prof. Busch - LSU
2
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
Prof. Busch - LSU
3
Recall:
Computable function f :
There is a deterministic Turing machine M
which for any string w computes f (w)
Prof. Busch - LSU
4
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
Prof. Busch - LSU
5
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
Prof. Busch - LSU
6
Example:
EQUALDFA  { M1 , M2 : M1 and M2 are DFAs
that acceptthe same languages}
is reduced to:
EMPTYDFA  { M : M is a DFA that accepts
the empty language}
Prof. Busch - LSU
7
We only need to construct:
M1, M2
Turing Machine
for reduction f
M1, M2  EQUALDFA

Prof. Busch - LSU
f  M1 , M2

 M DFA
M  EMPTYDFA
8
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 M2 so that:
L(M)  (L1  L2 )  (L1  L2 )
Prof. Busch - LSU
9
L(M)  (L1  L2 )  (L1  L2 )
L1  L2
M1, M2  EQUALDFA

L(M )  

M  EMPTYDFA
Prof. Busch - LSU
10
Decider for EQUALDFA
Input
string
Reduction
compute
M1, M2
f  M1, M2

YES
M
Decider
EMPTYDFA
Prof. Busch - LSU
NO
YES
NO
11
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!
Prof. Busch - LSU
12
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!
Prof. Busch - LSU
END OF PROOF
13
Observation:
In order to prove
that some language B is undecidable
we only need to reduce a
known undecidable language A
to B
Prof. Busch - LSU
14
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 inputstring w }
Prof. Busch - LSU
15
Theorem: STATETM
is undecidable
(state-entry problem is unsolvable)
Proof:
Reduce
HALTTM (halting problem)
to
STATETM (state-entry problem)
Prof. Busch - LSU
16
Halting Problem Decider
Decider for HALTTM
Reduction
M ,w
state-entry problem
decider
Compute Mˆ, q ,w
f  M ,w

Given the reduction,
if STATETM is decidable,
then HALTTM is decidable
Prof. Busch - LSU
Decider
STATETM
YES
YES
NO
NO
A contradiction!
since HALTTM
is undecidable
17
We only need to build the reduction:
Reduction
M ,w
Compute
f  M ,w

Mˆ, q ,w
 f  M,w

So that:
Mˆ,w , q  STATETM
M,w  HALTTM
Prof. Busch - LSU
18
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
Prof. Busch - LSU
19
Mˆ
special
halt state
M
halting
states
M halts
q
qi
Mˆ halts on state q
Prof. Busch - LSU
20
M halts on input w
Therefore:
Mˆ halts on state q on input w
Equivalently:
Mˆ,w , q  STATETM
M,w  HALTTM
END OF PROOF
Prof. Busch - LSU
21
Blank-tape halting problem
Input:
Turing Machine
Question: Does
M
M halt when started with
a blank tape?
Corresponding language:
BLANKTM  { M : M is aTuringmachine that
halts when started on blank tape }
Prof. Busch - LSU
22
Theorem: BLANKTM is undecidable
(blank-tape halting problem is unsolvable)
Proof:
Reduce
HALTTM (halting problem)
to
BLANKTM (blank-tape problem)
Prof. Busch - LSU
23
Halting Problem Decider
Decider for HALTTM
blank-tape problem
decider
Reduction
M ,w
Compute
f  M ,w

Mˆ
Decider
BLANKTM
Given the reduction,
If BLANKTM is decidable,
then HALTTM is decidable
Prof. Busch - LSU
YES
YES
NO
NO
A contradiction!
since HALTTM
is undecidable
24
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
Prof. Busch - LSU
25
Construct Mˆ from
Tape is blank?
M ,w :
no
yes
Write
w
Mˆ
Accept and halt
Run M
on tape
with input w
If M halts then halt
Prof. Busch - LSU
26
Mˆ
Tape is blank?
no
yes
Write
w
on tape
Accept and halt
Run M
with input w
M halts on input w
Mˆ halts when started on blank tape
Prof. Busch - LSU
27
M halts on input w
Mˆ halts when started on blank tape
Equivalently:
Mˆ  BLANKTM
M,w  HALTTM
END OF PROOF
Prof. Busch - LSU
28
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!
Prof. Busch - LSU
29
Suppose B is decidable
reject
s
Decider
for B
(halt)
accept
(halt)
Prof. Busch - LSU
30
Suppose B is decidable
Then B is decidable
(we have proven this in previous class)
Decider for B
NO
reject
s
Decider
for B
(halt)
YES
accept
(halt)
Prof. Busch - LSU
YES
accept
(halt)
NO
reject
(halt)
31
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!
Prof. Busch - LSU
32
Alternatively:
Decider for A
Input
string
w
Reduction
compute f (w ) Decider
f (w )
for B
NO
reject
(halt)
YES
accept
(halt)
YES
accept
(halt)
NO
reject
(halt)
w  A  f (w )  B
CONTRADICTION!
Prof. Busch - LSU
END OF PROOF
33
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)
Prof. Busch - LSU
34
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
Prof. Busch - LSU
35
Let L be a Turing-acceptable language
• L is empty?
• L is regular?
• L has size 2?
Prof. Busch - LSU
36
Empty language problem
Input: Turing Machine
M
Question: Is L(M ) empty?
L(M )   ?
Corresponding language:
EMPTYTM  { M : M is aTuringmachine that
accepts the empty language}
Prof. Busch - LSU
37
Theorem: EMPTYTM
is undecidable
(empty-language problem is unsolvable)
Proof:
Reduce
ATM
(membership problem)
to
EMPTYTM (empty language problem)
Prof. Busch - LSU
38
membership problem decider
Decider for ATM
empty problem
decider
Reduction
M ,w
Compute
f  M ,w

Mˆ
Decider
EMPTYTM
Given the reduction,
if EMPTYTM is decidable,
then ATM is decidable
Prof. Busch - LSU
YES
YES
NO
NO
A contradiction!
since ATM
is undecidable
39
We only need to build the reduction:
Reduction
M ,w
Compute
f  M ,w

Mˆ
 f  M,w

So that:
Mˆ  EMPTYTM
M,w  ATTM
Prof. Busch - LSU
40
Construct
Mˆ from
M ,w :
s
input string
Tape of
Turing Machine
Mˆ
Mˆ
Accept s
s  Loui si ana?
yes
yes
w on tape, and
•Simulate M on input w
•Write
Prof. Busch - LSU
M accepts w ?
41
The only possible accepted string
Louisiana
s
Turing Machine
Mˆ
Accept s
s  Loui si ana?
yes
yes
w on tape, and
•Simulate M on input w
•Write
Prof. Busch - LSU
M accepts w ?
42
M accepts w
L(Mˆ)  {Louisiana}  
does not
M
w
accept
L(Mˆ)  
Turing Machine
Mˆ
Accept s
s  Loui si ana?
yes
yes
w on tape, and
•Simulate M on input w
•Write
Prof. Busch - LSU
M accepts w ?
43
Therefore:
L(Mˆ)  
M accepts w
Equivalently:
Mˆ  EMPTYTM
M,w  ATTM
END OF PROOF
Prof. Busch - LSU
44
Let L be a Turing-acceptable language
• L is empty?
• L is regular?
• L has size 2?
Prof. Busch - LSU
45
Regular language problem
Input: Turing Machine
M
Question: Is L(M ) a regular language?
Corresponding language:
REGULARTM  { M : M is aTuringmachinethat
accepts a regularlanguage}
Prof. Busch - LSU
46
Theorem: REGULARTM is undecidable
(regular language problem is unsolvable)
Proof:
Reduce
ATM
(membership problem)
to
REGULARTM (regular language problem)
Prof. Busch - LSU
47
membership problem decider
Decider for ATM
regular problem
decider
Reduction
M ,w
Compute
f  M ,w

YES
YES
REGULARTM NO
NO
Decider
Mˆ
Given the reduction,
If REGULARTM is decidable,
then ATM is decidable
Prof. Busch - LSU
A contradiction!
since ATM
is undecidable
48
We only need to build the reduction:
Reduction
M ,w
Compute
f  M ,w

Mˆ
 f  M,w

So that:
Mˆ  REGULARTM
M,w  ATTM
Prof. Busch - LSU
49
Mˆ from
Construct
M ,w :
s
input string
Tape of
Turing Machine
(for some k  0)
s a b ?
k
k
Mˆ
Mˆ
Accept s
yes
yes
w on tape, and
•Simulate M on input w
•Write
Prof. Busch - LSU
M accepts w ?
50
not regular
M accepts w
L(Mˆ)  {a n b n : n  0}
does not
M
w
accept
L(Mˆ)   regular
Turing Machine
(for some k  0)
s a b ?
k
k
Mˆ
Accept s
yes
yes
w on tape, and
•Simulate M on input w
•Write
Prof. Busch - LSU
M accepts w ?
51
Therefore:
M accepts w
L(Mˆ)
is not regular
Equivalently:
Mˆ  REGULARTM
M,w  ATTM
END OF PROOF
Prof. Busch - LSU
52
Let L be a Turing-acceptable language
• L is empty?
• L is regular?
• L has size 2?
Prof. Busch - LSU
53
Size2 language problem
Input: Turing Machine
M
Question: Does L(M ) have size 2 (two strings)?
| L(M ) | 2 ?
Corresponding language:
SIZE 2TM  { M : M is aTuringmachine that
accepts exactly two strings}
Prof. Busch - LSU
54
Theorem: SIZE 2TM
is undecidable
(size2 language problem is unsolvable)
Proof:
Reduce
ATM
(membership problem)
to
SIZE 2TM
(size 2 language problem)
Prof. Busch - LSU
55
membership problem decider
Decider for ATM
size2 problem
decider
Reduction
M ,w
Compute
f  M ,w

Mˆ
Decider
SIZE 2TM
Given the reduction,
If SIZE 2TM is decidable,
then ATM is decidable
Prof. Busch - LSU
YES
YES
NO
NO
A contradiction!
since ATM
is undecidable
56
We only need to build the reduction:
Reduction
M ,w
Compute
f  M ,w

Mˆ
 f  M,w

So that:
Mˆ  SIZE 2TM
M,w  ATTM
Prof. Busch - LSU
57
Construct
Mˆ from
M ,w :
s
input string
s  {Baton, Rouge} ?
yes
Tape of
Turing Machine
Mˆ
Mˆ
Accept s
yes
w on tape, and
•Simulate M on input w
•Write
Prof. Busch - LSU
M accepts w ?
58
2 strings
L(Mˆ)  {Baton , Rouge }
M accepts w
does not
M
w
accept
L(Mˆ)   0 strings
Turing Machine
s  {Baton, Rouge} ?
yes
Mˆ
Accept s
yes
w on tape, and
•Simulate M on input w
•Write
Prof. Busch - LSU
M accepts w ?
59
Therefore:
M accepts w
L(Mˆ)
has size 2
Equivalently:
Mˆ  SIZE 2TM
M,w  ATTM
END OF PROOF
Prof. Busch - LSU
60
RICE’s Theorem
Undecidable problems:
• L is empty?
• L is regular?
• L has size 2?
This can be generalized to all non-trivial
properties of Turing-acceptable languages
Prof. Busch - LSU
61
Non-trivial property:
A property P possessed by some
Turing-acceptable languages
but not all
Example:
P1 : L is empty?
YES L  
NO L  {Louisiana}
NO L  {Baton, Rouge}
Prof. Busch - LSU
62
More examples of non-trivial properties:
P2 : L is regular?
YES L  
YES L  {a n : n  0}
n n
NO L  {a b : n  0}
P3 : L has size 2?
NO L  
NO L  {Louisiana}
YES L  {Baton, Rouge}
Prof. Busch - LSU
63
Trivial property:
A property P possessed by ALL
Turing-acceptable languages
Examples:
P4 : L has size at least 0?
True for all languages
P5 : L is accepted by some
Turing machine?
True for all
Turing-acceptable languages
Prof. Busch - LSU
64
We can describe a property P as the set
of languages that possess the property
If language
Example:
P  {L1 }
L has property P then L  P
P : L is empty?
YES L1  
NO L2  {Louisiana}
NO L3  {Baton, Rouge}
Prof. Busch - LSU
65
Example:
Suppose alphabet is   {a }
P : L has size 1?
NO 
YES { }
{a } {aa } {aaa } 
NO {, a } {, aa } {a , aa } 
NO {, a , aa } {aa, aaa, aaaa} 
P  {{ }, {a }, {aa }, {aaa }, {aaaa},}
Prof. Busch - LSU
66
Non-trivial property problem
Input: Turing Machine
M
Question: Does L(M ) have the non-trivial
L(M )  P ?
property P ?
Corresponding language:
PROPERTYTM  { M : M is aTuringmachine
such that L(M ) has the non - trivial
property P , that is, L(M )  P }
Prof. Busch - LSU
67
Rice’s Theorem: PROPERTYTM
is undecidable
(the non-trivial property problem is unsolvable)
Proof:
Reduce
ATM
(membership problem)
to
PROPERTYTM
or PROPERTYTM
Prof. Busch - LSU
68
We examine two cases:
Case 1:   P
Examples: P : L(M ) is empty?
P : L(M ) is regular?
Case 2:
P
Example:
P : L(M ) has size 2?
Prof. Busch - LSU
69
Case 1:   P
Since P is non-trivial, there is
a Turing-acceptable language X
such that: X  P
Let MX be the Turing machine that
accepts X
Prof. Busch - LSU
70
Reduce
ATM
(membership problem)
to
PROPERTYTM
Prof. Busch - LSU
71
membership problem decider
Decider for ATM
Non-trivial property
problem decider
Reduction
M ,w
Compute
f  M ,w

Decider
Mˆ
PROPERTYTM
Given the reduction,
if PROPERTYTM is decidable,
then ATM is decidable
Prof. Busch - LSU
YES
YES
NO
NO
A contradiction!
since ATM
is undecidable
72
We only need to build the reduction:
Reduction
M ,w
Compute
f  M ,w

Mˆ
 f  M,w

So that:
Mˆ  PROPERTYTM
M,w  ATTM
Prof. Busch - LSU
73
Construct
Mˆ from
M ,w :
s
input string
s X ?
Tape of
Turing Machine
Mˆ
Mˆ
Accept s
yes
yes
w on tape, and
•Simulate M on input w
•Write
Prof. Busch - LSU
M accepts w ?
74
For this we can run machine MX ,
that accepts language X ,
with input string s
Turing Machine
s X ?
Mˆ
Accept s
yes
yes
w on tape, and
•Simulate M on input w
•Write
Prof. Busch - LSU
M accepts w ?
75
M accepts w
L(Mˆ)  X
P
does not
M
w
accept
L(Mˆ)  
P
Turing Machine
s X ?
Mˆ
Accept s
yes
yes
w on tape, and
•Simulate M on input w
•Write
Prof. Busch - LSU
M accepts w ?
76
Therefore:
L(Mˆ)  P
M accepts w
Equivalently:
M,w  ATTM
Mˆ  PROPERTYTM
Prof. Busch - LSU
77
Case 2:   P
Since P is non-trivial, there is
a Turing-acceptable language X
such that: X  P
Let MX be the Turing machine that
accepts X
Prof. Busch - LSU
78
Reduce
ATM
(membership problem)
to
PROPERTYTM
Prof. Busch - LSU
79
membership problem decider
Decider for ATM
Non-trivial property
problem decider
Reduction
M ,w
Compute
f  M ,w

YES
YES
PROPERTYTM NO
NO
Decider
Mˆ
Given the reduction,
if PROPERTYTM is decidable,
then ATM is decidable
Prof. Busch - LSU
A contradiction!
since ATM
is undecidable
80
We only need to build the reduction:
Reduction
M ,w
Compute
f  M ,w

Mˆ
 f  M,w

So that:
Mˆ  PROPERTYTM
M,w  ATTM
Prof. Busch - LSU
81
Construct
Mˆ from M ,w :
s
input string
s X ?
Tape of
Turing Machine
Mˆ
Mˆ
Accept s
yes
yes
w on tape, and
•Simulate M on input w
•Write
Prof. Busch - LSU
M accepts w ?
82
M accepts w
L(Mˆ)  X
P
does not
M
w
accept
L(Mˆ)  
P
Turing Machine
s X ?
Mˆ
Accept s
yes
yes
w on tape, and
•Simulate M on input w
•Write
Prof. Busch - LSU
M accepts w ?
83
Therefore:
L(Mˆ)  P
M accepts w
Equivalently:
M,w  ATTM
Mˆ  PROPERTYTM
END OF PROOF
Prof. Busch - LSU
84
Download