Upload
kylee-oswald
View
217
Download
0
Embed Size (px)
Citation preview
Fall 2006 Costas Busch - RPI 1
Reductions
Fall 2006 Costas Busch - RPI 2
Problem is reduced to problemX Y
If we can solve problem then we can solve problemX
Y
Fall 2006 Costas Busch - RPI 3
Language is reduced tolanguage
There is a computable function (reduction) such that:f
BwfAw )(
A
B
Definition: A B
w )(wf
Fall 2006 Costas Busch - RPI 4
Computable function : f
which for any string computes )(wfwThere is a deterministic Turing machineM
Recall:
Fall 2006 Costas Busch - RPI 5
If: a: Language is reduced to b: Language is decidableThen: is decidable
Theorem:
Proof:
A BB
A
Basic idea:Build the decider for using the decider for
A
B
Fall 2006 Costas Busch - RPI 6
Decider for B
Decider for A
compute
)(wf
)(wfw
accept
reject
accept
reject
(halt)
(halt)(halt)
(halt)
Inputstring
BwfAw )(
END OF PROOF
Reduction YES YES
NO NO
Fall 2006 Costas Busch - RPI 7
Example:
}languages same the accept that
DFAs are and :,{ 2121 MMMMEQUALDFA
} language empty the
accepts that DFA a is :{
MMEMPTYDFA
is reduced to:
Fall 2006 Costas Busch - RPI 8
Turing Machinefor reduction
DFADFA EMPTYMEQUALMM 21,
f21,MM M
MMf
21,
DFA
We only need to construct:
Fall 2006 Costas Busch - RPI 9
21,MM M
MMf
21,
Let be the language of DFA Let be the language of DFA
1L
2L1M
2M
)()()( 2121 LLLLML
construct DFA by combining and so that:
M
DFA
1M 2M
Turing Machinefor reduction f
Fall 2006 Costas Busch - RPI 10
)(21 MLLL
)()()( 2121 LLLLML
DFADFA EMPTYMEQUALMM 21,
Fall 2006 Costas Busch - RPI 11
Decider
Decider for
compute M
Inputstring
DFAEQUAL
21,MM 21,MMf DFAEMPTY
YESYES
NONO
Reduction
Fall 2006 Costas Busch - RPI 12
If: a: Language is reduced to b: Language is undecidableThen: is undecidable
Theorem (version 1):
A B
BA
(this is the negation of the previous theorem)
Proof:
Using the decider for build the decider forA
BSuppose is decidable B
Contradiction!
Fall 2006 Costas Busch - RPI 13
Decider for B
Decider for A
compute
)(wf
)(wfw
accept
reject
accept
reject
(halt)
(halt)(halt)
(halt)
Inputstring
BwfAw )(
Reduction
END OF PROOF
If is decidable then we can build:B
CONTRADICTION!
YES YES
NO NO
Fall 2006 Costas Busch - RPI 14
Observation:
In order to prove that some language is undecidablewe only need to reduce a known undecidable language to
B
BA
Fall 2006 Costas Busch - RPI 15
State-entry problem
Input: M•Turing Machine•State q
Question: Does M
•Stringw
enter state qwhile processing input string ?w
Corresponding language:
} string input on state enters
that machine Turing a is :,,{
wq
MqwMSTATE TM
Fall 2006 Costas Busch - RPI 16
Theorem:
(state-entry problem is unsolvable)
Proof: Reduce (halting problem) to (state-entry problem)
TMSTATE is undecidable
TMHALT
TMSTATE
Fall 2006 Costas Busch - RPI 17
Decider for
YES
NO
wM,
state-entry problem decider
TMSTATEDeciderCompute
Reduction
wMf ,
wqM ,,ˆ
TMHALT
YES
NO
Given the reduction,if is decidable,then is decidable
TMSTATE
TMHALT
A contradiction!sinceis undecidable
Halting Problem Decider
TMHALT
Fall 2006 Costas Busch - RPI 18
wM,Compute
Reduction
wMf ,wqM ,,ˆ
We only need to build the reduction:
TMHALTwM , TMSTATEqwM ,,ˆ
wMf ,
So that:
Fall 2006 Costas Busch - RPI 19
Mqhalting
states
specialhalt state
M̂
Rxx ,
Construct from :M̂ M
A transition for every unused tape symbol of x
iq
iq
Fall 2006 Costas Busch - RPI 20
M̂ halts on state qM halts
Mqhalting
states
specialhalt state
M̂
iq
Fall 2006 Costas Busch - RPI 21
M̂ halts on state on inputq
M halts on input w
w
Therefore:
Equivalently:
END OF PROOF
TMHALTwM , TMSTATEqwM ,,ˆ
Fall 2006 Costas Busch - RPI 22
Blank-tape halting problem
Input: MTuring Machine
Question: Does M halt when started with
a blank tape?
Corresponding language:
}tape blank on started when halts
that machin aTuring is :{ eMMBLANKTM
Fall 2006 Costas Busch - RPI 23
Theorem:
(blank-tape halting problem is unsolvable)
Proof: Reduce (halting problem) to (blank-tape problem)
TMBLANK is undecidable
TMHALT
TMBLANK
Fall 2006 Costas Busch - RPI 24
Decider for
YES
NO
wM,
blank-tape problem decider
DeciderCompute
Reduction
wMf ,
M̂
TMHALT
YES
NO
Given the reduction,If is decidable,then is decidableTMHALT
A contradiction!sinceis undecidable
Halting Problem Decider
TMHALT
TMBLANK
TMBLANK
Fall 2006 Costas Busch - RPI 25
wM,Compute
Reduction
wMf ,M̂
We only need to build the reduction:
TMHALTwM , TMBLANKM ˆ
wMf ,
So that:
Fall 2006 Costas Busch - RPI 26
no
yes
M̂
Write on tape w
Tape is blank?
Run
with input
Construct from :M̂ wM,
If halts then halt
M
w
M
Fall 2006 Costas Busch - RPI 27
M̂ halts when started on blank tape
M halts on input
no
yesM
Write on tape w
Tape is blank?
Run
with inputw
M̂
w
Fall 2006 Costas Busch - RPI 28
END OF PROOF
M̂ halts when started on blank tape
M halts on inputw
TMHALTwM , TMBLANKM ˆ
Equivalently:
Fall 2006 Costas Busch - RPI 29
If: a: Language is reduced to b: Language is undecidableThen: is undecidable
Theorem (version 2):
A B
BA
Proof:
Using the decider for build the decider for A
B
Suppose is decidable B
Contradiction!
Then is decidableB
Fall 2006 Costas Busch - RPI 30
Suppose is decidableB
Decider for B
s
accept
reject
(halt)
(halt)
Fall 2006 Costas Busch - RPI 31
Suppose is decidableB
Decider for B
s
accept
reject
(halt)
(halt)
Then is decidableB(we have proven this in previous class)
reject
accept(halt)
(halt)
Decider for BNO YES
YES NO
Fall 2006 Costas Busch - RPI 32
Decider for B
Decider for A
compute
)(wf
)(wfw
accept
reject
accept
reject
(halt)
(halt)(halt)
(halt)
Inputstring
BwfAw )(
Reduction
If is decidable then we can build:B
CONTRADICTION!
YES YES
NO NO
Fall 2006 Costas Busch - RPI 33
Decider for B
Decider for A
compute
)(wf
)(wfw
accept
reject accept
reject
(halt)
(halt)(halt)
(halt)
Inputstring
BwfAw )(
Reduction
END OF PROOFCONTRADICTION!
Alternatively:
NO YES
YES NO
Fall 2006 Costas Busch - RPI 34
Observation:
In order to prove that some language is undecidablewe only need to reduce some known undecidable languagetoor to B
(theorem version 1)
(theorem version 2)
B
AB
Fall 2006 Costas Busch - RPI 35
Undecidable Problems for Turing Recognizable languages
• is empty?L
L• is regular?
L• has size 2?
Let be a Turing-acceptable language L
All these are undecidable problems
Fall 2006 Costas Busch - RPI 36
• is empty?L
L• is regular?
L• has size 2?
Let be a Turing-acceptable language L
Fall 2006 Costas Busch - RPI 37
Empty language problem
Input: MTuring Machine
Question: Is )(ML empty?
Corresponding language:
} language empty the accepts
that machine aTuring is :{
MMEMPTYTM
?)( ML
Fall 2006 Costas Busch - RPI 38
Theorem:
(empty-language problem is unsolvable)
is undecidable
Proof: Reduce (membership problem) to
(empty language problem)
TMA
TMEMPTY
TMEMPTY
Fall 2006 Costas Busch - RPI 39
Decider for
YES
NO
wM,
empty problem decider
DeciderCompute
Reduction
wMf ,
M̂YES
NO
Given the reduction,if is decidable,then is decidable
membership problem decider
TMA
TMATMEMPTY
TMEMPTY
A contradiction!sinceis undecidable
TMA
Fall 2006 Costas Busch - RPI 40
wM,Compute
Reduction
wMf ,M̂
We only need to build the reduction:
TMATwM , TMEMPTYM ˆ
wMf ,
So that:
Fall 2006 Costas Busch - RPI 41
skip inputstring s
write on tape
run
on input
w Mw
M w
M̂
yes
then accept
If
s
sTape of M̂
input string
accepts ?
troys
Construct from :M̂ wM,
Fall 2006 Costas Busch - RPI 42
skip inputstring s
write on tape
run
on input
w Mw
M w
M̂
yes
then accept
If
s
s
accepts ?
troys
Tape of M̂
Fall 2006 Costas Busch - RPI 43
skip inputstring s
write on tape
run
on input
w Mw
M w
M̂
yes
then accept
If
s
s
accepts ?
w
troys
Tape of M̂
Fall 2006 Costas Busch - RPI 44
skip inputstring s
write on tape
run
on input
w Mw
M w
M̂
yes
then accept
If
s
s
accepts ?
During this phase this area is not touched
working area of
wM
troys
Fall 2006 Costas Busch - RPI 45
skip inputstring s
write on tape
run
on input
w Mw
M w
M̂
yes
then accept
If
s
s
accepts ?
waltered
Simply check if entered an accept stateM
troys
Fall 2006 Costas Busch - RPI 46
skip inputstring s
write on tape
run
on input
w Mw
M w
M̂
yes
then accept
If
s
s
accepts ?
Now check input string
troys
Fall 2006 Costas Busch - RPI 47
skip inputstring s
write on tape
run
on input
w Mw
M w
M̂
yes
then accept
If
saccepts ?
The only possible accepted string
troys
t r o y
Fall 2006 Costas Busch - RPI 48
skip inputstring s
write on tape
run
on input
w Mw
M w
M̂
yes
then accept
If
saccepts ?
troys
accepts }{)ˆ( troyMLM w
does notaccept
M w )ˆ(ML
Fall 2006 Costas Busch - RPI 49
Therefore:
acceptsM w )ˆ(ML
Equivalently:
TMATwM , TMEMPTYM ˆ
END OF PROOF
Fall 2006 Costas Busch - RPI 50
• is empty?L
L• is regular?
L• has size 2?
Let be a Turing-acceptable language L
Fall 2006 Costas Busch - RPI 51
Regular language problem
Input: MTuring Machine
Question: Is )(ML a regular language?
Corresponding language:
language} regular a accepts
that machine aTuring is :{ MMREGULARTM
Fall 2006 Costas Busch - RPI 52
Theorem:
(regular language problem is unsolvable)
is undecidable
Proof: Reduce (membership problem) to (regular language problem)
TMA
TMREGULAR
TMREGULAR
Fall 2006 Costas Busch - RPI 53
Decider for
YES
NO
wM,
regular problem decider
DeciderCompute
Reduction
wMf ,
M̂YES
NO
Given the reduction,If is decidable,then is decidable
membership problem decider
TMA
TMA
TMREGULAR
A contradiction!sinceis undecidable
TMATMREGULAR
Fall 2006 Costas Busch - RPI 54
wM,Compute
Reduction
wMf ,M̂
We only need to build the reduction:
TMATwM , TMREGULARM ˆ
wMf ,
So that:
Fall 2006 Costas Busch - RPI 55
skip inputstring s
write on tape
run
on input
w Mw
M w
M̂
yes
then accept
If has the form
s
sTape of M̂
input string
accepts ?
nnba
Construct from :M̂ wM,
s
Fall 2006 Costas Busch - RPI 56
skip inputstring s
write on tape
run
on input
w Mw
M w
M̂
yesaccepts ?
accepts }0:{)ˆ( nbaML nnM w
does notaccept
M w )ˆ(ML
then accept
If has the form
s
nnbas
not regular
regular
Fall 2006 Costas Busch - RPI 57
Therefore:
acceptsM w )ˆ(ML
Equivalently:
TMATwM , TMREGULARM ˆ
END OF PROOF
is not regular
Fall 2006 Costas Busch - RPI 58
• is empty?L
L• is regular?
L• has size 2?
Let be a Turing-acceptable language L
Fall 2006 Costas Busch - RPI 59
Does have size 2?
Size2 language problem
Input: MTuring Machine
Question: )(ML
Corresponding language:
strings} two exactly accepts
that machine aTuring is :{2 MMSIZE TM
?2|)(| ML
(accepts exactly two strings?)
Fall 2006 Costas Busch - RPI 60
Theorem:
(regular language problem is unsolvable)
is undecidable
Proof: Reduce (membership problem) to (size 2 language problem)
TMA
TMSIZE 2
TMSIZE 2
Fall 2006 Costas Busch - RPI 61
Decider for
YES
NO
wM,
size2 problem decider
DeciderCompute
Reduction
wMf ,
M̂YES
NO
Given the reduction,If is decidable,then is decidable
membership problem decider
TMA
TMA
A contradiction!sinceis undecidable
TMA
TMSIZE 2
TMSIZE 2
Fall 2006 Costas Busch - RPI 62
wM,Compute
Reduction
wMf ,M̂
We only need to build the reduction:
TMATwM , TMSIZEM 2ˆ
wMf ,
So that:
Fall 2006 Costas Busch - RPI 63
skip inputstring s
write on tape
run
on input
w Mw
M w
M̂
yes
then accept
If
s
sTape of M̂
input string
accepts ?
Construct from :M̂ wM,
},{ albanytroys
Fall 2006 Costas Busch - RPI 64
skip inputstring s
write on tape
run
on input
w Mw
M w
M̂
yesaccepts ?
accepts },{)ˆ( albanytroyML M w
does notaccept
M w )ˆ(ML
2 strings
0 strings
then accept
If
s
},{ albanytroys
Fall 2006 Costas Busch - RPI 65
Therefore:
acceptsM w )ˆ(ML
Equivalently:
TMATwM , TMSIZEM 2ˆ
END OF PROOF
has size 2
Fall 2006 Costas Busch - RPI 66
RICE’s Theorem
• is empty?L
L• is regular?
L• has size 2?
Undecidable problems:
This can be generalized to all non-trivialproperties of Turing-acceptable languages
Fall 2006 Costas Busch - RPI 67
Non-trivial property:
A property possessed by some Turing-acceptable languages but not all
: is empty?LExample:
L
}{troyL YES
NO
},{ albanytroyL NO
P
1P
Fall 2006 Costas Busch - RPI 68
: is regular?
More examples of non-trivial properties:
L
}0:{ nbaL nn
YES
NO
L2P
}0:{ naL nYES
: has size 2?L3PL
}{troyL },{ albanytroyL
NO
YES
NO
Fall 2006 Costas Busch - RPI 69
Trivial property:
A property possessed by ALL Turing-acceptable languages
P
: has size at least 0?LExamples: 4PTrue for all languages
: is accepted by some Turing machine?
L5P
True for allTuring-acceptable languages
Fall 2006 Costas Busch - RPI 70
We can describe a property as the setof languages that possess the property
P
: is empty?LExample:
L
}{troyL YES
NO
},{ albanytroyL NO
P
}{P
If language has property then PL PL
Fall 2006 Costas Busch - RPI 71
: has size 1?LP
}{a
},{ a
NO
NO
YES
Example: Suppose alphabet is }{a
}{aa},{ aa
}{aaa}{},{ aaa
}},{},{},{},{},{{ aaaaaaaaaaP
},,{ aaaNO },,{ aaaaaaaaa
Fall 2006 Costas Busch - RPI 72
Non-trivial property problem
Does have the non-trivial property ?
Input: MTuring Machine
Question: )(ML
Corresponding language:
})( is, that , property
trivial-non the has )( that such
machine aTuring is :{
PMLP
ML
MMPROPERTYTM
?)( PML P
Fall 2006 Costas Busch - RPI 73
Rice’s Theorem: TMPROPERTY is undecidable
(the non-trivial property problem is unsolvable)
Proof: Reduce (membership problem)
to
TMA
TMPROPERTY TMPROPERTYor
Fall 2006 Costas Busch - RPI 74
We examine two cases:
Case 1:
Case 2:
P
P
Examples: : is empty?)(MLP
: is regular?)(MLP
: has size 2?)(MLPExample:
Fall 2006 Costas Busch - RPI 75
Let be the Turing machine thataccepts
Case 1: P
Since is non-trivial, there is a Turing-acceptable languagesuch that:
PX
PX
XM
X
Fall 2006 Costas Busch - RPI 76
Reduce (membership problem) to
TMA
TMPROPERTY
Fall 2006 Costas Busch - RPI 77
Decider for
YES
NO
wM,
Non-trivial property problem decider
DeciderCompute
Reduction
wMf ,
M̂YES
NO
Given the reduction,if is decidable,then is decidable
membership problem decider
TMA
TMA
A contradiction!sinceis undecidable
TMA
TMPROPERTY
TMPROPERTY
Fall 2006 Costas Busch - RPI 78
wM,Compute
Reduction
wMf ,M̂
We only need to build the reduction:
TMATwM , TMPROPERTYM ˆ
wMf ,
So that:
Fall 2006 Costas Busch - RPI 79
skip inputstring s
write on tape
run
on input
w Mw
M w
M̂
yes
then accept
If
s
sTape of M̂
input string
accepts ?
Construct from :M̂ wM,
Xs
Fall 2006 Costas Busch - RPI 80
skip inputstring s
write on tape
run
on input
w Mw
M w
M̂
yes
then accept
If
saccepts ?
Xs
For this phase we can run machinethat accepts , with input string
XMX s
Fall 2006 Costas Busch - RPI 81
skip inputstring s
write on tape
run
on input
w Mw
M w
M̂
yesaccepts ?
accepts XML )ˆ(M w
does notaccept
M w )ˆ(ML
P
P
then accept
If
s
Xs
Fall 2006 Costas Busch - RPI 82
Therefore:
acceptsM w PML )ˆ(
Equivalently:
TMATwM , TMPROPERTYM ˆ
Fall 2006 Costas Busch - RPI 83
Let be the Turing machine thataccepts
Case 2: P
Since is non-trivial, there is a Turing-acceptable languagesuch that:
PX
PX
XM
X
Fall 2006 Costas Busch - RPI 84
Reduce (membership problem) to
TMA
TMPROPERTY
Fall 2006 Costas Busch - RPI 85
Decider for
YES
NO
wM,
Non-trivial property problem decider
DeciderCompute
Reduction
wMf ,
M̂YES
NO
Given the reduction,if is decidable,then is decidable
membership problem decider
TMA
TMA
A contradiction!sinceis undecidable
TMA
TMPROPERTY
TMPROPERTY
Fall 2006 Costas Busch - RPI 86
wM,Compute
Reduction
wMf ,M̂
We only need to build the reduction:
TMATwM , TMPROPERTYM ˆ
wMf ,
So that:
Fall 2006 Costas Busch - RPI 87
skip inputstring s
write on tape
run
on input
w Mw
M w
M̂
yes
then accept
If
s
sTape of M̂
input string
accepts ?
Construct from :M̂ wM,
Xs
Fall 2006 Costas Busch - RPI 88
skip inputstring s
write on tape
run
on input
w Mw
M w
M̂
yesaccepts ?
accepts XML )ˆ(M w
does notaccept
M w )ˆ(ML
P
P
then accept
If
s
Xs
Fall 2006 Costas Busch - RPI 89
Therefore:
acceptsM w PML )ˆ(
Equivalently:
TMATwM , TMPROPERTYM ˆ
END OF PROOF