Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Introduction to Computational Complexity - Solutions to Homework 3 | CS 530, Assignments of Computer Science

Material Type: Assignment; Class: Theory of Computation; Subject: Computer Science; University: Illinois Institute of Technology; Term: Fall 2008;

Typology: Assignments

Pre 2010

Uploaded on 08/18/2009

koofers-user-bwo-1
koofers-user-bwo-1 ๐Ÿ‡บ๐Ÿ‡ธ

10 documents

1 / 3

Toggle sidebar

Related documents


Partial preview of the text

Download Introduction to Computational Complexity - Solutions to Homework 3 | CS 530 and more Assignments Computer Science in PDF only on Docsity! CS530: Introduction to Computational Complexity Homework 3 Oct 28th, 2008 Problem 1: Give pseudocode for the Turing machine that accepts the following lan- guage: L = {xxrw | x โˆˆ ฮฃ+, w โˆˆ ฮฃ+}. Here ฮฃ = {a, b, c}. Then draw the diagram of the Turing machine. Solution 1: The pseudocode is as following: Algorithm 1 TM1 1: Mark the last unmarked character on the tape as END 2: if There is no unmarked characters then 3: Reject w 4: Compare teh first character without any mark with the last character before a marked character 5: if Matching then 6: Marking the two characters as CROSS 7: Go to (2) 8: if There is no unmarked characters then 9: Accept w 10: else 11: Clear all the CROSS marks. 12: Go to (1) a,b,c โˆ’> R B, END โˆ’> L a,b,cโˆ’> END(a,b,c),L a,b,c โˆ’> L CROSS(a,b,c)โˆ’> R a,b,c โˆ’> Stay aโˆ’> CROSS(a),R bโˆ’>CROSS(b),R cโˆ’>CROSS(c),R a,b,cโˆ’>R a,b,c โˆ’>R a,b,cโˆ’>R END(a,b,c)โˆ’>L CROSS(a,b,c)โˆ’>L END(a,b,c)โˆ’>L CROSS(a,b,c)โˆ’>L END(a,b,c)โˆ’>L CROSS(a,b,c)โˆ’>L aโˆ’>CROSS(a),L bโˆ’>CROSS(b),L cโˆ’>CROSS(c),L a,b,cโˆ’>L CROSS(a,b,c)โˆ’>R a,b,cโˆ’>Stay Problem 2: Without directly using Rice Theorem, prove that the following language is not decidable. L = {ใ€ˆMใ€‰ | M is a Turing machine and the size of L(M) can be divided by 3}. Proof: Assume that there exists a TM R decides L. Now we construct a TM S decides ATM = {ใ€ˆM, wใ€‰ | 3-1 M accepts w}. S = input ใ€ˆM,wใ€‰ 1. construct a TM M2 input: a TM ใ€ˆT ใ€‰ if size of L(T ) can not be diveded by 3, accept. else run M on w, if M accepts w, accept 2. Run R on ใ€ˆM2ใ€‰ if R accepts it, then accept, else reject it. Clearly, S is a decider for ATM . However, ATM is not recursive as we have already know. Thus there is a contradiction. So L is not decidable. Problem 3: Which of the following languages is undecidable? Give proofs of your answer. You can use Rice Theorem whenever you can to say a language is not decidable. 1. L = {ใ€ˆMใ€‰ | M is a Turing machine and the size of L(M) can be divided by 3}. 2. L = {ใ€ˆMใ€‰ | M is a Turing machine and M has at most 75 states}. 3. L = {ใ€ˆM1,M2ใ€‰ | M1 and M2 are Turing machines and L(M1) โˆฉ L(M2) = โˆ… }. 4. L = {ใ€ˆMใ€‰ | M is a Turing machine and L(M) is recursive}. Solution 3: 1. There are three languages can not be decided. They are: (a) L = {ใ€ˆMใ€‰ | M is a Turing machine and the size of L(M) can be divided by 3} (b) L = {ใ€ˆM1,M2ใ€‰ | M1 and M2 are Turing machines and L(M1) โˆฉ L(M2) = โˆ… }. (c) L = {ใ€ˆMใ€‰ | M is a Turing machine and L(M) is recursive}. Proof: We use Rice Theorem to proof these three languages are not decidable. By Rice Theorem, to prove language is not decidable, we only need to prove that the property of that language is non-trivial. For that the property of all these three languages are not trivial, thus they are all undecidable. 2. There is only one language can be decided. It is: (a) L = {ใ€ˆMใ€‰ | M is a Turing machine and M has at most 75 states}. Proof: For that we only need to check that the size of Q is 75 or not, which can be done at most 75 steps. So we can decide this language. Problem 4: Prove that Turing machines as a generator is equivalent to Turing machines as acceptor. Here a TM G as a generator produces a language L(G), if it will print all strings of L(G) on the tape (here the printer will not go backward when printing). In other words, you have to prove 1. Given a generator G, there is always a TM M such that L(M) = L(G), and 2. Given a TM M , there is always a generator G, such that L(M) = L(G). Proof: 1. In this part, we proof that given a generator G, there is always a TM M such that L(M) = L(G). Given a generator G, we construct the TM M in the following way: TM M = input w: (a) Lineary compare w with all the strings generated by G. (b) If matching, then accept. 3-2
Docsity logo



Copyright ยฉ 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved