practice-q2-solutions

practice-q2-solutions - 6.045J/18.400J: Automata,...

Info iconThis preview shows page 1. Sign up to view the full content.

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

Unformatted text preview: 6.045J/18.400J: Automata, Computability and Complexity Prof. Nancy Lynch Practice Quiz 2: Solutions March 21, 2007 Please write your name in the upper corner of each page. INFORMATION ABOUT QUIZ 2: Quiz 1 will be closed-book, closed-notes. However, you are allowed to bring one sheet of paper with review notes. Problem Score Elena Grigorescu 1 2 3 4 5 6 Total PQ2-1 Name: Problem 1: True or False (20 points) Full credit will be given for correct answers. If you include justification for your answers, you may obtain partial credit for incorrect answers. 1. True or False: There exists a Turing machine that enumerates a set of (encodings of) decider Turing machines, such that includes Turing machines that decide infinitely many different decidable languages. 2. True or False: There exists a Turing machine that enumerates a set of (encodings of) decider Turing machines, such that includes at least one Turing machine that decides each decidable language. False. Disprove by diagonalizing (Recall that this was Problem 2 of homework 5). 3. True or False: There exists a Turing machine that enumerates an infinite set of (encodings of) decider Turing machines, such that every machine that outputs is "minimal". (Here "minimal" means that there is no other smaller decider Turing machine that decides the same language.) False. This is an application of Recursion Theorem. Consider a machine that first gets its own description (via Recursion Theorem), and proceeds to run the enumerator till outputs a machine that has a longer description than . Then it continues to simulate . , and therefore is not minimal. This is a contradiction. ) # $" & ' 0(' ) & ! ! # %" # $" # $" 4. True or False: Rice's Theorem immediately implies that @ B @ 7 DCA98) & 6 is a Turing machine and is undecidable. E True. This is a non-trivial property of languages. A machine has the property, but a machine that decides does not. @ H F G" that decides the empty language " " True. It is easy to enumerate a set of Turing machines the language . such that for each , recognizes " 4" 5 3 1 2 Name: True. is, in particular, recognizable. Then, this follows from the closure of Turing-recognizable languages under concatenation (this was again a homework problem !!) 7. True or False: A three-dimensional Turing machine is like an ordinary Turing machine except that its "tape" storage consists of a three dimensional "tape", where each tape cell is a unit cube. In one step, the single tape head can move north, south, east, west, up, or down. The class of languages recognized by three-dimensional Turing machines is exactly the Turing-recognizable languages. True. One can simulate this by a single-tape machine. 8. True or False: The class of languages recognized by three-stack machines is exactly the Turing recognizable languages. True. Three stacks is equivalent to two stacks which is as powerful as Turing machines. `S 6. True or False: If is a Turing recognizable language and be Turing-recognizable. I is a decidable language, then F V U Y W'T F XQ V U W'T @ H S False. Does not hold if and is . is , which is not recognizable. Q RIP F 5. True or False: If is a decidable language and must be Turing-recognizable. I is a Turing recognizable language, then must F F F F Name: Problem 2: (25 points) Consider the following formal description of a Turing Machine , where , , . Assume that any unspecified transitions go to . a e B e `fd B e C H vq t xt w b e v utqq p b e i b yg(gh`r(ssrhfdhe F 0 1 R R q0 0 ,R q L 1 R q 1 2 R q accept 1. (5 points) Write out the accepting computation history of on input , in the form given in class and in Sipser's book. Describe the behavior represented in this computation history in words. B " " v utqq b r(ssrp c b r B b F b B 8 B b B c Idb i b vq t xt w g(db b e b e c b ggfd 0 1 L L ,L q 3 v ut q q r(ssrp b v ut q q r(ssdp b v ut q q r(ssrp b r(ssrp h v ut q q b l v utqq r(ssrp b d r(ssdp b r(ssdp b v ut q q v utqq y v ut q q r(ssrp b v utqq r(ssdp b r(ssrp B r(ssdp g v ut q q b v utqq b B k Bb i B i e b db i i b e B B i jCdb B i B b B i Cdb i b dB i ib B e b F h b F e b B i DCdb B B b F DB b F B b v`utsqsqrph b c Prb cr b i Sb B b B Pb g b fb b e c Irb Name: 3. (10 points) Give the set of tiles for the modified Post Correspondence Problem, for this particular machine and input . Indicate which is the initial tile. " 2. (5 points) What language does We have started things off by listing the tiles needed for completing the match from the point where an accepting state is encountered. You must define the initial tile and the tiles needed to represent all the moves. B The initial tile : d B c db The alphabet tiles: Tiles for the left moves : Tiles for the right moves : . , recognize? (Give a precise definition.) , , l B The "clean-up" tiles : B i db B i f b i fdb i b f i 2db B f b F 2 b F f b " d5 B Wf , , vr(ssrp b utqq v utqq B `ssrp b , , , , , Name: 4. (5 points) Write the accepting computation history you wrote for part (b) twice, one above the other, and mark the boundaries of the MPCP tiles involved in the match. You may skip the part involved in terminating the computation--just mark the tiles up to the first occurrence of the accept state. d k v`utsqsqrpe b c Drb B b F B b l B b B b d cde b i b $ B B e b c b m hdb i B e b F B c b $ Name: Problem 3: (10 points) Suppose we have a Turing Machine that, on each input string , either halts with an output string on its tape or loops forever. Describe briefly how to constuct an enumerator Turing machine that enumerates the outputs produced by on all the inputs. n " ! This is a simple dove-tail construction. The enumerator does the following: In the first "phase", on the string for step. In the second "phase", it runs the machine it runs on for steps, and on for step. More generally, in the phase, it runs on the string (in the lexicographic order) for steps. This ensures that if outputs something on input , it does so in a finite amount of time, and eventually outputs it too. " " r sv q ! ! Q utq B B o " p o " n r sv " Name: Rice's theorem does apply to , because this is clearly a language property and it is non-trivial. This is because a machine that accepts exactly the even length strings has this property, and a machine that accepts nothing, does not. | | z y ! v m}{0! This means that is undecidable. 2. (9 points) Is EVENODD Turing-recognizable? Prove your answer. You may use any results proved in class or in Sipser's book, but if you do, then cite the results explicitly. . If indeed accepts , then and therefore, . On the other hand, if does not accept , then is precisely the set of all even length strings. . Therefore, | | z y ! v m}{x! ) # " & ' @ H ) & ' | | z y ! v m}{x! " # 4" " first checks if its input is of even length. If so, it accepts. Else, it runs on and accepts if accepts, and rejects if # 4" " # 4" " " rejects. 1 ye |m|}z{yx!v! 1 83 # " | | z y ! v m}{x! 1 . Given , we construct a machine 3# " 3 " No, is not Turing recognizable. to We show this by reducing such that if and only if V WU Y T V WU Y T S3 | | z y ! v d}{xxw! ye " 1 # $" | | z y ! v m}uxx! 1. (2 points) Does Rice's Theorem apply to does this imply about EVENODD? 1 2 " | | z y ! v m}uxx! | | z y ! v d}{xxw! Problem 4: (20 points) Let accept any strings of odd length " 5 3 ~d4" accepts all strings of even length and does not ? Why or why not? If it does apply, then what F R" Name: 3. (9 points) Is the complement of EVENODD Turing-recognizable? Again, prove your answer. Again, you may use any results proved in class or in the book, but cite them explicitly. | | z y ! v m}{x! indeed accepts , then is precisely the set of all even-length strings and If . therefore, On the other hand, if does not accept , then . Therefore, # 4" E ) # " & ' ) & ' " | | z y ! v m}{x! # $" " first checks if its input is of odd length. If so, it rejects. Else, it runs on and accepts if accepts, and rejects if " # 4" " " rejects. V U W6T | | z y ! v m}uxx! S3 ye " 1 No, the complement of is not Turing recognizable. We show this by reducing to the complement of to . Given , we construct a machine such that if and only if . 3# " 1 | | z y ! v m}{xx! V WU Y T |d|}z{yx!xvw! 1 3# 84" he 1 3 " | | z y ! v m}{x! V WU T # " , or equivalently, . Name: Problem 5: (15 points) Let be the following language of Turing machine descriptions: is a Turing machine with input alphabet and accepts every string consisting of just zeros (it may accept other strings) Prove that is undecidable using the Recursion Theorem. Do this by filling in the following proof outline: " B e C (1 " 3 j84" 1 2 Define a Turing machine : : On input do: Obtain the description of This is possible because of the Recursion theorem. s1 | Run | on input If | accepts then reject. rejects then accept. 3 If which is impossible. On the other hand, if | (1 does not accept all strings consisting of only zeros, then which is also impossible. Therefore, we have a contradiction, and cannot be decidable. @ But this implies that, accepts all strings, (and in particular accepts all strings of the form rejects | , because is a decider for , and @ But this implies that, rejects all strings (and in particular rejects all strings of the form x3 s1 3 | because is a decider for and . ), (1 | If accepts all strings consisting of only zeros, then 83 3 | Let be the decider for . itself. Suppose for the sake of contradiction that is decidable. accepts , ), Name: Problem 6: (10 points) Consider a new kind of machine, a -Queue Machine. A -Queue Machine has the same general structure as a -Counter Machine or a -Stack Machine. However, it has queues for storage instead of counters or stacks. Initially, each queue is empty. It supports the following operations (Let be the alphabet of queue symbols): 1. : takes a symbol in , and adds it to the end of queue . 2. : removes the symbol at the front of queue , if is nonempty. If is empty, this operation does nothing. 3. : a boolean, which returns 1 if queue is currently empty, 0 otherwise. Briefly outline an argument that the acceptance problem for -Queue-Machines is undecidable. p q b q b b q b q b b q W2 b Wb st q We do this by showing that a -queue machine can simulate a -counter machine. This, in particular, shows that the acceptance problem for a -counter machine can be reduced to the acceptance problem for a -queue machine. Since we know that the acceptance problem for a -counter machine is undecidable, the acceptance problem for a -queue machine is undecidable, too. We need to show how to simulate the increment, decrement and isZero functions on a counter, using a queue. increment: is implemented by enqueueing a symbol on the queue. decrement: is implemented by dequeueing a symbol from the queue. isZero: is implemented by invoking the function empty on the queue, and returning true if and only if empty returns true. It is trivial to see that this correctly implements the functionality of a counter. Since the acceptance problem for a -counter machine is undecidable, we conclude that the acceptance problem for a -queue machine is undecidable too. p p p q q q q p Name: Scratch Work ...
View Full Document

Ask a homework question - tutors are online