compu'ty5-6 - university of aberdeenhomepages.abdn.ac.uk/.../abdn.only/compu'ty5-6.pdf ·...
TRANSCRIPT
CS4026Formal Models of Computation
Part IIIComputability & Complexity
Part III-A – Computability Theory
formal models of computation 2
Reducibility: Introduction• Chapter 5 of Sipser’s Book
• Overview:– 2 Examples of proofs using reduction
– Mapping Reducibility
formal models of computation 3
Reducibility: Introduction• Reducibility: method to prove that problems are
computationally unsolvable
• Reduction: convert problem A into problem B– so that B’s solution applies to A OR
– so that A’s lack of solution applies to B
• Intuitive example: travelling from ABZ to New York– Reduces to: buying a ticket WHICH
– Reduces to: getting money to buy ticket WHICH
– Reduces to: getting a Summer job WHICH
– Reduces to: …
• Reducibility in maths:– Measuring the area of a rectangle reduces to measuring
its height and width
formal models of computation 4
Reducibility: Introduction (Cont’d)• Reducibility helps us classifying problems
• When A is reducible to B– Solving A cannot be harder than solving B, because a
solution to B gives a solution to A
• In computability theory:– If A is reducible to B and B is decidable, A is also
decidable
– If A is undecidable and reducible to B, B is also undecidable
• Method to prove that a problem B is undecidable:– Show that some other problem A already known to be
undecidable reduces to B
– “If B was decidable then A would also be decidable, and we know that that’s not the case”
formal models of computation 5
Problem No. 1• Problem: determine if a Turing machine halts
(accepting or rejecting) on a given input
• Let
HALTTM = {⟨M,w ⟩|M is a TM and M halts on input w }
And remember
ATM = {⟨M,w ⟩|M is a TM that accepts input stringw }
• HALTTM is the real halting problem– ATM is called the acceptance problem
• Theorem: HALTTM is undecidable
• Proof idea:– Reduce ATM to HALTTM then
– Use undecidability of ATM to prove undecidability of HALTTM
formal models of computation 6
Problem No. 1 (Cont’d)Proof:• Assume (to obtain contradiction) that TM R decides
HALTTM
• We can then construct TM S to decide ATM:
S = “On input ⟨M,w ⟩ where M is a TM and w is a string:
1. Run TM R on input ⟨M,w ⟩.
2. If R rejects, reject. {<M,w> does not halt}
3. If R accepts {<M,w> halts}
then simulate M on w until it halts.
4. If M accepts w, accept;
If M rejects w, reject.”
• If R decides HALTTM then S decides ATM– Because ATM is undecidable, HALTTM must also be
undecidable!!
formal models of computation 7
Problem No. 1 (Cont’d)
ATM consists of two problems: For given <M,w>,
1. Decide whether <M,w> halts.Given R, we can do this!
2. If yes then determine whether M accepts w. (We know a TM exists that recognises ATM , so we can do this too, by constructing a suitable TM.)
3. If no then reject.
formal models of computation 8
S⟨M,w ⟩Yes
No
M accepts w
M rejects or loops on w
S
⟨M,w ⟩
Yes M accepts w
NoM rejects or loops on w
Problem No. 1 (Cont’d)Diagrammatically:
R⟨M,w ⟩Yes
No
M halts on w
M loops on w
R⟨M,w ⟩Yes
No
M accepts w
M rejects w
simulateM on w
formal models of computation 9
Problem No. 1 (Cont’d)In summary:
• ATM reduces to HALTTM
– A TM S would require a TM R if it could be built
– The added functionality is straightforward
• Since ATM is undecidable, HALTTM is also undecidable
S
⟨M,w ⟩
Yes M accepts w
NoM rejects or loops on w
R⟨M,w ⟩Yes
No
M accepts w
M rejects w
simulateM on w
formal models of computation 10
THE REST OF THIS LECTURE IS OPTIONAL
formal models of computation 11
Problem No. 2• Problem: determine if a Turing machine does not
accept any input, that is, its language is empty
• Let
ETM = {⟨M ⟩|M is a TM and L(M ) = ∅ }
• Theorem: ETM is undecidable
• Proof idea: same as before– Assume that ETM is decidable and
– Show that ATM is decidable – a contradiction
• Let R be a TM that decides ETM
• We use R to build S that decides ATM
formal models of computation 12
Problem No. 2 (Cont’d)• However, we run R on a modification of ⟨M ⟩:
– We modify ⟨M ⟩ to ensure M rejects all strings except w
– On input w, M works as usual
– In our notation, the modified machine is
– The only string M1 may now accept is w
– M1 language is non-empty if, and only if, it accepts w
M1 = “On input x :
1. If x ≠ w, reject.
2. If x =w, run M on input w and accept if M does.”
formal models of computation 13
Problem No. 2 (Cont’d)Proof:
– We assume TM R decides ETM
– We then build TM S (using R ) that decides ATM:
• N.B.: S must be able to compute M1 from ⟨M,w ⟩
– Just add extra states to M to perform x =w test
• The reasoning:– If R were a decider for ETM, S would be a decider for ATM
– A decider for ATM cannot exist
– Hence, ETM must be undecidable
S = “On input ⟨M,w ⟩ where M is a TM and w is a string:
1. Use the description of M andw to built M1 as explained
2. Run R on input ⟨M1⟩.
3. If R accepts, reject; if R rejects, accept.”
formal models of computation 14
S⟨M,w ⟩Yes
No
M accepts w
M rejects or loops on w
R⟨M ⟩No
Yes
L(M ) ≠ ∅
L(M ) = ∅
S
⟨M,w ⟩Yes M accepts w
NoM rejects or loops on w
Problem No. 2 (Cont’d)Diagrammatically:
RNo
Yes
⟨M1⟩modify
M onto M1⟨M,w ⟩
formal models of computation 15
Mapping Reducibility• Let’s now formalise the notion of reducibility
– There are various alternatives
• Ours is called mapping reducibility– Also called “many-one reducibility”
• In a nutshell– If we can reduce problem A to problem B and
– We have a solution to problem B
– Then we have a solution to problem A
• Diagrammatically:
aReduction
f(a) = bb
Solver for B
output
formal models of computation 16
Mapping Reducibility (Cont’d)• To reduce problem A to problem B via mapping
reducibility:– We must find a computable function to convert instances
of problem A to instances of problem B
– If we have such function (called a reduction) we can solve A with a solver for B
formal models of computation 17
Computable Functions• A function f : ∑* → ∑* is a computable function if
some Turing machine M, on every input w, halts with just f (w ) on its tape
• Example:– A TM that takes input ⟨m,n⟩ and returns m +n
formal models of computation 18
Definition of Mapping Reducibility• Language A is mapping reducible to language B if
there is a computable function f : ∑* → ∑* such that for every w,
w ∈A ↔ f (w )∈ B
• This is denoted as A ≤m B
• Function f is called the reduction of A to B
• Diagrammatically:
A Bf
formal models of computation 19
Mapping Reducibility (Cont’d)• If problem A is mapping reducible to problem B
– If problem B has been previously solved, then
– We can obtain a solution to problem A
• Theorem:– if A ≤m B and B is decidable, then A is decidable
• Proof: – Let M be the decider for B
– Let f be the reduction from A to B
– We describe a decider N for A asN = “On input w :
1. Compute f (w ).
2. Run M on input f (w ) and output whatever M outputs.”
– Clearly, if w ∈ A then f (w ) ∈ B as f is a reduction from A to B.– Thus, M accepts f (w ) whenever w ∈ A.
– Therefore M works as desired.
formal models of computation 20
Revisiting an Example• Let’s revisit our example and prove that
HALTTM = {⟨M,w ⟩|M is a TM and M halts on input w }
is undecidable.
– We shall do this using mapping reducibility
– We give a reduction f from ATM to HALTTM
– A computable function (i.e., a TM!) that takes as input ⟨M,w ⟩ and returns as output ⟨M′,w′ ⟩ where
⟨M,w ⟩∈ATM if and only if ⟨M′,w′ ⟩∈HALTTM
– The following machine F computes a reduction fS = “On input ⟨M,w ⟩:
1. Construct the following machine M′ :M′ = “On input x :
1. Run M on x2. If M accepts, accept.3. If M rejects, enter a loop.”
2. Output ⟨M′,w ⟩”
formal models of computation 21
Mapping Reducibility (Cont’d)• Corollary:
– if A ≤m B and A is undecidable, then B is undecidable
• Theorem: – if A ≤m B and B is Turing-recognisable, then A is Turing-
recognisable
• Corollary: – if A ≤m B and A is not Turing-recognisable, then B is not
Turing-recognisable
formal models of computation 22
The end ...
• In the course 2007-2008, this is the end of the material for the CS4026 exam
• Given more time, we would have shown that the method of reduction is also applicable to proofs concerning the complexity of a problem. A typical reasoning pattern:– “If problem A was solvable within time limitations X then
B would also be solvable within X. We know (or believe) that B is not solvable within X, therefore A is not either”
formal models of computation 23
Reading List
• Introduction to the Theory of Computation. Michael Sipser. PWS Publishing Co., USA, 1997. (A 2nd Edition has recently been published). Chapter 5.
• Algorithmics: The Spirit of Computing. 3rd
Edition. David Harel with Yishai Feldman. Addison-Wesley, USA, 2004. Chapter 8.