Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS4026 Formal Models of Computation Part III Computability & Complexity Part III-A – Computability Theory.

Similar presentations


Presentation on theme: "CS4026 Formal Models of Computation Part III Computability & Complexity Part III-A – Computability Theory."— Presentation transcript:

1 CS4026 Formal Models of Computation Part III Computability & Complexity Part III-A – Computability Theory

2 formal models of computation 2 Reducibility: Introduction Chapter 5 of Sipsers Book Overview: –2 Examples of proofs using reduction –Mapping Reducibility

3 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 Bs solution applies to A OR –so that As 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

4 formal models of computation 4 Reducibility: Introduction (Contd) 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 thats not the case

5 formal models of computation 5 Problem No. 1 Problem: determine if a Turing machine halts (accepting or rejecting) on a given input Let HALT TM = { M, w | M is a TM and M halts on input w } And remember A TM = { M, w | M is a TM that accepts input string w } HALT TM is the real halting problem –A TM is called the acceptance problem Theorem: HALT TM is undecidable Proof idea: –Reduce A TM to HALT TM then –Use undecidability of A TM to prove undecidability of HALT TM

6 formal models of computation 6 Problem No. 1 (Contd) Proof: Assume (to obtain contradiction) that TM R decides HALT TM We can then construct TM S to decide A TM : 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. { does not halt} 3. If R accepts { halts} then simulate M on w until it halts. 4. If M accepts w, accept; If M rejects w, reject. If R decides HALT TM then S decides A TM –Because A TM is undecidable, HALT TM must also be undecidable!!

7 formal models of computation 7 Problem No. 1 (Contd) A TM consists of two problems: For given, 1.Decide whether halts. Given R, we can do this! 2.If yes then determine whether M accepts w. (We know a TM exists that recognises A TM, so we can do this too, by constructing a suitable TM.) 3.If no then reject.

8 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 No M rejects or loops on w Problem No. 1 (Contd) 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 simulate M on w

9 formal models of computation 9 Problem No. 1 (Contd) In summary: A TM reduces to HALT TM –A TM S would require a TM R if it could be built –The added functionality is straightforward Since A TM is undecidable, HALT TM is also undecidable S M,w Yes M accepts w No M rejects or loops on w R M,w Yes No M accepts w M rejects w simulate M on w

10 formal models of computation 10 THE REST OF THIS LECTURE IS OPTIONAL

11 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 E TM = { M | M is a TM and L(M ) = } Theorem: E TM is undecidable Proof idea: same as before –Assume that E TM is decidable and –Show that A TM is decidable – a contradiction Let R be a TM that decides E TM We use R to build S that decides A TM

12 formal models of computation 12 Problem No. 2 (Contd) 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 M 1 may now accept is w –M 1 language is non-empty if, and only if, it accepts w M 1 = On input x : 1. If x w, reject. 2. If x =w, run M on input w and accept if M does.

13 formal models of computation 13 Problem No. 2 (Contd) Proof: –We assume TM R decides E TM –We then build TM S (using R ) that decides A TM : N.B.: S must be able to compute M 1 from M, w –Just add extra states to M to perform x =w test The reasoning: –If R were a decider for E TM, S would be a decider for A TM –A decider for A TM cannot exist –Hence, E TM must be undecidable S = On input M, w where M is a TM and w is a string: 1. Use the description of M and w to built M 1 as explained 2. Run R on input M If R accepts, reject; if R rejects, accept.

14 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 No M rejects or loops on w Problem No. 2 (Contd) Diagrammatically: R No Yes M 1 modify M onto M 1 M,w

15 formal models of computation 15 Mapping Reducibility Lets 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: a Reduction f(a) = b b Solver for B output

16 formal models of computation 16 Mapping Reducibility (Contd) 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

17 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

18 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 B f

19 formal models of computation 19 Mapping Reducibility (Contd) 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 as N = 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.

20 formal models of computation 20 Revisiting an Example Lets revisit our example and prove that HALT TM = { 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 A TM to HALT TM –A computable function (i.e., a TM!) that takes as input M, w and returns as output M, w where M, w A TM if and only if M, w HALT TM –The following machine F computes a reduction f S = On input M,w : 1. Construct the following machine M : M = On input x : 1. Run M on x 2. If M accepts, accept. 3. If M rejects, enter a loop. 2. Output M,w

21 formal models of computation 21 Mapping Reducibility (Contd) 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

22 formal models of computation 22 The end... In the course , 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

23 formal models of computation 23 Reading List Introduction to the Theory of Computation. Michael Sipser. PWS Publishing Co., USA, (A 2 nd Edition has recently been published). Chapter 5. Algorithmics: The Spirit of Computing. 3 rd Edition. David Harel with Yishai Feldman. Addison-Wesley, USA, Chapter 8.


Download ppt "CS4026 Formal Models of Computation Part III Computability & Complexity Part III-A – Computability Theory."

Similar presentations


Ads by Google