# a - CpSc 421 Homework 9 Solution Attempt any three of the...

This preview shows pages 1–2. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CpSc 421 Homework 9 Solution Attempt any three of the six problems below. The homework is graded on a scale of 100 points, even though you can attempt fewer or more points than that. Your recorded grade will be the total score on the problems that you attempt. 1. ( 30 points ) For each language below, determine whether or not it is Turing decidable. If it is Turing decidable, describe a Turing machine that decides it. If it is not decidable, show this using a reduction from a problem shown to be undecidable in Sipser , from lectures. or earlier homework or midterm 2. (a) ( 10 points) { M | M describes a TM that halts when run with the empty string for input. } S olution: Let A denote the language for this problem. I’ll reduce A T M to A . Construct a TM M AT M does the following when run with input M # w : Step 1. ( M AT M ): Compute the description of a TM, M that does the following when run with input s : Step 1. ( M ): Erase it’s input tape (i.e. overwrite every symbol in s with a blank. Step 2. ( M ): Write w on its tape. Step 3. ( M ): Run M on input w . Step 2.a. ( M ): If M accepts w , M accepts. Step 2.b. ( M ): If M rejects w , M rejects. Step 2.c. ( M ): If M loops on w , M loops. Step 2. ( M AT M ): Check if M ∈ A (i.e. run a decider for A on the description of M ): Step 2.a. ( M AT M ): If M ∈ A , then M accepts M # w . Step 2.b. ( M AT M ): If M ∈ A , then M rejects M # w . Thus, we’ve reduced deciding whether or not M accepts w to whether or not M accepts the empty string, and our construction works for any M and w . This shows that A T M ≤ m A ; therefore X is undecidable (because we have already shown that A T M is undecidable). (b) ( 10 points) { M | M describes a TM with exactly 42 states. } S olution: Let A 42- states denote the language described above. A 42- states is Turing decidable. We can construct a TM, M 42- states that reads the description of M . If M is not a valid description of a TM, then M 42- states rejects. Otherwise, M 42- states simply checks the number of states in the the description of M and accepts if there are 42 such states. For example, the format for describing TMs that presented in the Oct. 27 lecture has the binary encoding of the number of states of the machine as the first element of the description. Using this this format, M 42- states just needs to make sure that its input is a valid TM description and then makes sure that this description starts with the substring: 101010, (c) ( 10 points) { M | M describes a TM that accepts exactly 42 strings. } S olution: Let A 42- strings denote the language described above. A 42- strings is Turing not decidable. I’ll reduce A T M to A . For the same of contradiction, assume that there is a TM, M 42- strings that decides A 42- strings . Construct a TM M AT M does the following when run with input M # w : Step 1. ( M AT M ): Compute the description of a TM, M that does the following when run with input s : Step 1. ( M ): If s = w , run M on w .....
View Full Document

## This note was uploaded on 02/22/2010 for the course CS 881 taught by Professor H.f. during the Spring '10 term at Shahid Beheshti University.

### Page1 / 6

a - CpSc 421 Homework 9 Solution Attempt any three of the...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online