Lecture 5 Dynamic Programming. Dynamic Programming Self-reducibility.
Reducibility
description
Transcript of Reducibility
1
Reducibility
2
Problem is reduced to problemA B
If we can solve problem thenwe can solve problem
BA
B
A
3
If is undecidable then is undecidable
If is decidable then is decidableB A
A B
Problem is reduced to problemA B
4
Example: the halting problem
is reduced to
the state-entry problem
5
The state-entry problem
Inputs: M•Turing Machine
•State q
Question: Does M
•Stringw
enter state q
on input ?w
6
Theorem:
The state-entry problem is undecidable
Proof: Reduce the halting problem to
the state-entry problem
7
Suppose we have an algorithm (Turing Machine)
that solves the state-entry problem
We will construct an algorithmthat solves the halting problem
8
Algorithm for state-entry problem
M
w
q
YES
NO
entersM q
doesn’t enterM q
Assume we have the state-entry algorithm:
9
Algorithm for Halting problem
M
w
YES
NO
halts onM w
doesn’t halt onM w
We want to design the halting algorithm:
10
Modify input machine :M
•Add new state q
•From any halting state add transitions to q
M q
halting statesSinglehalt state
M
11
M halts
M halts on state q
if and only if
12
machine and string
Algorithm for halting problem:
Inputs: M w
1. Construct machine with state M q
2. Run algorithm for state-entry problem with inputs: M wq, ,
13
Generate
M M
w
M qw
State-entry
algorithm
Halting problem algorithm
YES
NO
YES
NO
14
Since the halting problem is undecidable,it must be that the state-entry problemis also undecidable
END OF PROOF
We reduced the halting problemto the state-entry problem
15
Another example:
the halting problem
is reduced to
the blank-tape halting problem
16
The blank-tape halting problem
Input: MTuring Machine
Question: Does M halt when started with
a blank tape?
17
Theorem:
Proof:Reduce the halting problem to the
blank-tape halting problem
The blank-tape halting problem is undecidable
18
Suppose we have an algorithmfor the blank-tape halting problem
We will construct an algorithmfor the halting problem
19
Algorithm for blank-tape halting problem
M
YES
NO
halts onblanks tape
M
doesn’t halton blank tape
M
Assume we have the blank-tape halting algorithm:
20
Algorithm for halting problem
M
w
YES
NO
halts onM w
doesn’t halt onM w
We want to design the halting algorithm:
21
wMConstruct a new machine
• On blank tape writes w
• Then continues execution like M
wM
Mthen write w
step 1 step2
if blank tape executewith input w
22
M halts on input string
wM halts when started with blank tape
if and only if
w
23
Algorithm for halting problem:
1. Construct wM
2. Run algorithm for blank-tape halting problem with input
, ,
wM
machine and stringInputs: M w
24
Generate
wMM
w
blank-tape halting algorithm
Halting problem algorithm
YES
NOwM
YES
NO
25
Since the halting problem is undecidable,the blank-tape halting problem is also undecidable
END OF PROOF
We reduced the halting problemto the blank-tape halting problem
26
Does machine halt on input ?
Summary of Undecidable Problems
Halting Problem:
M w
Membership problem:
Is a string member of a
recursively enumerable language ? Lw
Does machine accept string ?M w
In other words:
27
Does machine enter state on input ?
Does machine halt when startingon blank tape?
Blank-tape halting problem:
M
State-entry Problem:
Mw
q
28
Uncomputable Functions
29
Uncomputable Functions
A function is uncomputable if it cannotbe computed for all of its domain
Domain Valuesregion
f
30
An uncomputable function:
)(nfmaximum number of moves untilany Turing machine with stateshalts when started with the blank tape
n
31
Theorem:Function is uncomputable)(nf
Proof:
Then the blank-tape halting problem is decidable
Assume for contradiction that is computable)(nf
32
Algorithm for blank-tape halting problem:
Input: machineM
1. Count states of : M m
2. Compute )(mf
3. Simulate for steps starting with empty tape
M )(mf
If halts then return YES otherwise return NO
M
33
Therefore, the blank-tape haltingproblem is decidable
However, the blank-tape haltingproblem is undecidable
Contradiction!!!
34
Therefore, function in uncomputable)(nf
END OF PROOF
35
Rice’s Theorem
36
Non-trivial properties of recursively enumerable languages:
any property possessed by some (not all)recursively enumerable languages
Definition:
37
Some non-trivial properties of recursively enumerable languages:
• is emptyL
L• is finite
L• contains two different strings of the same length
38
Rice’s Theorem:
Any non-trivial property of a recursively enumerable languageis undecidable
39
We will prove some non-trivial propertieswithout using Rice’s theorem
40
Theorem:
For any recursively enumerable language Lit is undecidable to determine whether is empty L
Proof:
We will reduce the membership problemto this problem
41
Algorithm for empty languageproblem
M
YES
NO
Assume we have the empty language algorithm:
Let be the machine that accepts M L
)(ML
)(ML
empty
not empty
LML )(
42
Algorithm for membershipproblem
M
w
YES
NO
acceptsM w
rejectsM w
We will design the membership algorithm:
43
First construct machine : wM
When enters a final state, compare original input string with w
M
Accept if original input is the same with w
44
Lw
)( wML is not empty
if and only if
}{)( wML w
45
Algorithm for membership problem:
Inputs: machine and string M w
1. Construct wM
2. Determine if is empty )( wML
YES: then )(MLw
NO: then )(MLw
46
construct
wM
Check if)( wML
is empty
YES
NO
M
w
NO
YES
Membership algorithm
wM
END OF PROOF