Homework Assignment 6 Answers

Similar documents
Computability and Complexity

CSCE 551: Chin-Tser Huang. University of South Carolina

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine)

V Honors Theory of Computation

Equivalence of TMs and Multitape TMs. Theorem 3.13 and Corollary 3.15 By: Joseph Lauman

Undecidable Problems and Reducibility

CSCC63 Worksheet Turing Machines

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine)

Chapter 3: The Church-Turing Thesis

CpSc 421 Final Exam December 15, 2006

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY

More Turing Machines. CS154 Chris Pollett Mar 15, 2006.

CS5371 Theory of Computation. Lecture 12: Computability III (Decidable Languages relating to DFA, NFA, and CFG)

CSE 105 THEORY OF COMPUTATION

CSCI3390-Assignment 2 Solutions

Automata and Computability. Solutions to Exercises

Mapping Reducibility. Human-aware Robotics. 2017/11/16 Chapter 5.3 in Sipser Ø Announcement:

Automata and Computability. Solutions to Exercises

CSE 105 THEORY OF COMPUTATION

What languages are Turing-decidable? What languages are not Turing-decidable? Is there a language that isn t even Turingrecognizable?

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018

Theory of Computation (IX) Yijia Chen Fudan University

Computability Theory

CSE 555 Homework Three Sample Solutions

Reducability. Sipser, pages

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

DM17. Beregnelighed. Jacob Aae Mikkelsen

Part I: Definitions and Properties

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

CSCE 551 Final Exam, Spring 2004 Answer Key

CS20a: Turing Machines (Oct 29, 2002)

Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2018, face-to-face day section Prof. Marvin K. Nakayama

CS 311 Sample Final Examination

1 Unrestricted Computation

Computability Theory. CS215, Lecture 6,

Turing Machines. 22c:135 Theory of Computation. Tape of a Turing Machine (TM) TM versus FA, PDA

Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2016, face-to-face day section Prof. Marvin K. Nakayama

CSE 105 THEORY OF COMPUTATION

Introduction to Languages and Computation

Decidability (intro.)

Computation Histories

1 Showing Recognizability

Most General computer?

Exam Computability and Complexity

Lecture 12: Mapping Reductions

CSE 105 THEORY OF COMPUTATION

Decidability (What, stuff is unsolvable?)

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

Foundations of

CS154, Lecture 10: Rice s Theorem, Oracle Machines

Lecture 24: Randomized Complexity, Course Summary

Harvard CS 121 and CSCI E-207 Lecture 10: Ambiguity, Pushdown Automata

ACS2: Decidability Decidability

ECS 120 Lesson 15 Turing Machines, Pt. 1

CS20a: Turing Machines (Oct 29, 2002)

An example of a decidable language that is not a CFL Implementation-level description of a TM State diagram of TM

The Church-Turing Thesis

CS21 Decidability and Tractability

Turing Machines Part II

CS4026 Formal Models of Computation

Non-emptiness Testing for TMs

Undecidability. We are not so much concerned if you are slow as when you come to a halt. (Chinese Proverb)

CSE 105 THEORY OF COMPUTATION

CS5371 Theory of Computation. Lecture 15: Computability VI (Post s Problem, Reducibility)

CPSC 421: Tutorial #1

Theory Bridge Exam Example Questions

The Power of One-State Turing Machines

CSE 105 THEORY OF COMPUTATION

6.045J/18.400J: Automata, Computability and Complexity. Quiz 2. March 30, Please write your name in the upper corner of each page.

Foundations of Informatics: a Bridging Course

Pumping Lemma for CFLs

Please give details of your answer. A direct answer without explanation is not counted.

Introduction to Turing Machines. Reading: Chapters 8 & 9

Decidability. Human-aware Robotics. 2017/10/31 Chapter 4.1 in Sipser Ø Announcement:

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

CS154 Final Examination

Finite Automata. Mahesh Viswanathan

Pushdown automata. Twan van Laarhoven. Institute for Computing and Information Sciences Intelligent Systems Radboud University Nijmegen

Variants of Turing Machine (intro)

Student#: CISC-462 Exam, December XY, 2017 Page 1 of 12

Homework 8. a b b a b a b. two-way, read/write

Turing machines COMS Ashley Montanaro 21 March Department of Computer Science, University of Bristol Bristol, UK

Intro to Theory of Computation

Designing 1-tape Deterministic Turing Machines

Notes for Comp 497 (Comp 454) Week 12 4/19/05. Today we look at some variations on machines we have already seen. Chapter 21

jflap demo Regular expressions Pumping lemma Turing Machines Sections 12.4 and 12.5 in the text

Lecture 23: Rice Theorem and Turing machine behavior properties 21 April 2009

Lecture Notes: The Halting Problem; Reductions

An example of a decidable language that is not a CFL Implementation-level description of a TM State diagram of TM

Section 1 (closed-book) Total points 30

Turing s Thesis. Fall Costas Busch - RPI!1

Chap. 4,5 Review. Algorithms created in proofs from prior chapters

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

A Note on Turing Machine Design

Turing Machines. Our most powerful model of a computer is the Turing Machine. This is an FA with an infinite tape for storage.

CS5371 Theory of Computation. Lecture 14: Computability V (Prove by Reduction)

Final exam study sheet for CS3719 Turing machines and decidability.

Decidable and undecidable languages

Introduction to Turing Machines

Answers to the CSCE 551 Final Exam, April 30, 2008

Transcription:

Homework Assignment 6 Answers CSCI 2670 Introduction to Theory of Computing, Fall 2016 December 2, 2016 This homework assignment is about Turing machines, decidable languages, Turing recognizable languages, and (un)decidability There are 7 questions, but Q6 is not required to be answered, with total 100 points. 1. Consider the following Turing machine, which recognizes language L = {w#w : w {0, 1} }. For each part in (a) and (b), give the sequence of configurations that the TM enters when started on the indicated string. (a) 10#11 (b) 10#10 Answers: (15 points in total) Two kinds of knowledge are needed to answer this question. configurations of a TM on an input, how transitions work in a TM. 1

(a) The Turing machine has the following configuration changes on input 10#11: q 1 10#11 q 1 0#11 0q 3 #11 0q 3 #11 0#q 5 11 0q 6 # 1 q 7 0# 1 q 7 0# 1 q 1 0# 1 q 2 # 1 #q 4 1 # q 4 1 (The TM cannot proceed, because expecting 0. So reject the input) (b) The Turing machine has the following configuration changes on input 10#11: q 1 10#10 q 1 0#10 0q 3 #10 0q 3 #10 0#q 5 10 0q 6 # 0 q 7 0# 0 q 7 0# 0 q 1 0# 0 q 2 # 0 #q 4 0 # q 4 0 #q 6 q 6 # q 7 # q 1 # #q 8 # q 8 # q 8 # q accept

2. Design a Turing machine that recognizes the following language {w : w {0, 1} contains at least two same symbols, with one at the end } You need to answer this question by taking the following steps: (1) outline how a TM may accept such a string w; (2) give more details to each of the steps outlined in (1); (3) draw a Turing machine diagram based on (2). Answers: (20 points in total) This and Q3 questions are designed to force the students to work toward designing a TM with the good habit of algorithm crafting. (1) (3 points) This part should be statements that describe briefly how the TM recognizes such strings. example answer: scan the input all the way to the rightmost symbol and memorize it; scan leftward to find a matched symbol, accept if found or reject else. (2) (5 points) This part is a refinement of (1) to some technical steps that are detailed enough to allow a direct translation to a TM diagram for (3). example answer: remember the leftmost position, e.g., by changing 1 to W and 0 to Z; scan rightward to skip all 0s and 1s until seeing t; according to the symbol on the left of t, branch to two different states; scan leftward to find a match symbol (it could be the leftmost symbol); accept if there is a match and halt; reject if even the leftmost is not a match; halt. (3) (12 points) An example TM diagram, based on (2).

3. Give an implementation-level description of a Turing machine for the following language {w#w R : w {0, 1} and w R is the reversed string of w} You need to answer this question by taking the following steps: (1) outline how a TM may accept string w#w R ; (2) give more details to each of the steps outlined in (1); (3) draw a Turing machine diagram based on (2). Answers: (20 points in total) Same criteria for Q2 are applied to Q3. (1) (3 points) This part should be statements that describe briefly how the TM recognizes such strings. example answer: compare the pair of symbols on the left and right of #; repeat the comparison for all other pairs in the inside-out fashion; reject if any pair do not match, halt; accept if all pairs match, halt. (2) (5 points) This part is a refinement of (1) to some technical steps that are detailed enough to allow a direct translation to a TM diagram for (3). example answer: 0. replace the leftmost symbol, from 1 to W and from 0 to Z; 1. scan rightward to pass all # symbols to read the first non-# symbol; 2. if it is, go to step 8; 3. otherwise, according to the symbol, branching to two different states; and replace the symbol with #; 4. scan leftward to pass all # symbols to read the first non-# symbol; 5. compare it with the one memorized (including the cases of Z and W); 6. if not matched, reject and halt; 7. otherwise replace the symbol with # (but replace Z and W with $), and go to step 1. 8. scan leftward to pass all # symbols, reject if there are non-# symbols; 9. otherwise accepts. (3) (12 points) An example TM diagram, based on (2). See figure in the next page.

4. A 2-PDA is a Push Down Automaton equipped with two stacks, in which the tops of the two stacks (instead of one stack) may be updated at each step. Prove that 2-PDAs are as powerful as Turing machines. (Hint: place the two stacks head-to-head to simulate the work tape of a Turing machine so the joint point of the two stacks simulates the position of the read-head of the TM.) Answers: (10 points in total) A hint has been given. You just need to add a bit of additional details about how to use the two stacks to simulate every transition of the given TM. A typical transition is a b, M where a, b Σ and M {L, R} which means the current symbol a is replaced with b and move the read-head to direction M. A bit of details: the tape content to the left of the read-head (inclusive) is stored in stack 1 (S1 ); with the current symbol being the top of S1 ; the tape content to the right of the read-head (exclusive) is stored in stack 1 (S2 ); with the symbol on the right of the current symbol being the top of S2 ; simulation of a b, R can be done with P OP (S1 ); P U SH(S1, b); P U SH(S1, P OP (S2 )) while simulation of a b, L can be done with P OP (S1 ); P U SH(S2, b)

5. Show that the class of decidable languages is closed under the following operations: (a) concatenation, (b) complementation, (c) intersection, Is the class of Turing recognizable languages also closed under all the above operations? Why? Answers: (20 points in total) 5 points for each of (a)-(c) and the additional question. Answers: (a) Let L 1 and L2 be two decidable languages and M 1 and M 2 be two deciders (i.e., Turing machines that halt) for L 1 and L 2, respectively. The following decider M recognizes L 1 L 2 : Given input w, M nondeterministically partitions w = w 1 w 2, M calls M 1 to run on w 1 and calls M 2 to runs on w 2, M accepts w iff both M 1 accepts w 1 and M 2 accepts w 2. Because M 1 and M 2 halt, so does M. (b) Let L 1 be a decidable language and M 1 be a decider for L 1. The following decider M recognizes L 1 : Given input w, M calls M 1 to run on w, M accepts w iff M 1 rejects w 1. Because M 1 halts, so does M. (c) Let L 1 and L2 be two decidable languages and M 1 and M 2 be two deciders (i.e., Turing machines that halt) for L 1 and L 2, respectively. The following decider M recognizes L 1 L 2 : Given input w, M calls M 1 to run on w and calls M 2 to runs on w, M accepts w iff both M 1 accepts w and M 2 accepts w. Because M 1 and M 2 halt, so does M.

Answer to the additional question: The class of Turing-recognizable languages is closed under operations concatenation and intersection because in the proof (a) and (c), M runs forever iff either M 1 or M 2 runs forever. But the class is not closed under complementation. This is because in (b) M is supposed to accept the input if M 1 runs forever (on the input) but M does not know if M 1 is going to stop eventually.

6. Question 4.1, page 210 (exercise only, you do NOT need to turn in your answers). Answers: Answers are in the book. You would like to do the exercise because you may see this type of questions again in the final exam!

7. Question 4.2, page 211 (Hint: use theorem 4.5 and theorem 1.54 (or lemma 1.55)). Answers: (15 points in total) First, we express the problem as a language: EQ DF A,RE = { A, E DFA A recognizes the same language described by regular expression E} Then we prove that Language EQ DF A,RE is decidable because we can construct a decider TM M to recognizes EQ DF A,RE. On input A, E, M transforms E to an DFA B (Lemma 1.55, Theorem 1.54), M then calls the decider C for language EQ DF A on input A, B (Theorem 4.5) M accepts A, E iff C accepts A, B. Since all above steps are finite, M always halts.