TAKE-HOME: OUT 02/21 NOON, DUE 02/25 NOON

Similar documents
1 Showing Recognizability

V Honors Theory of Computation

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

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

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

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

CSE 555 Homework Three Sample Solutions

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?

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

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

Foundations of

Theory of Computation (IX) Yijia Chen Fudan University

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

CpSc 421 Homework 9 Solution

Chomsky Normal Form and TURING MACHINES. TUESDAY Feb 4

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

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

Exam Computability and Complexity

CS 154, Lecture 2: Finite Automata, Closure Properties Nondeterminism,

Recap DFA,NFA, DTM. Slides by Prof. Debasis Mitra, FIT.

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

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

CPSC 421: Tutorial #1

ECS 120: Theory of Computation UC Davis Phillip Rogaway February 16, Midterm Exam

Theory of Computation Turing Machine and Pushdown Automata

Most General computer?

Midterm II : Formal Languages, Automata, and Computability

Decidability (What, stuff is unsolvable?)

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

St.MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad

Intro to Theory of Computation

DM17. Beregnelighed. Jacob Aae Mikkelsen

CSE 105 THEORY OF COMPUTATION

Undecidable Problems and Reducibility

Part I: Definitions and Properties

COMP/MATH 300 Topics for Spring 2017 June 5, Review and Regular Languages

Harvard CS 121 and CSCI E-121 Lecture 14: Turing Machines and the Church Turing Thesis

Lecture 12: Mapping Reductions

4.2 The Halting Problem

Turing Machines A Turing Machine is a 7-tuple, (Q, Σ, Γ, δ, q0, qaccept, qreject), where Q, Σ, Γ are all finite

Equivalent Variations of Turing Machines

MA/CSSE 474 Theory of Computation

Chapter 8. Turing Machine (TMs)

Reducability. Sipser, pages

CSE 105 THEORY OF COMPUTATION

Turing s thesis: (1930) Any computation carried out by mechanical means can be performed by a Turing Machine

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

Further discussion of Turing machines

UNIT-VIII COMPUTABILITY THEORY

Turing Machines (TM) Deterministic Turing Machine (DTM) Nondeterministic Turing Machine (NDTM)

I have read and understand all of the instructions below, and I will obey the University Code on Academic Integrity.

Finite Automata. Mahesh Viswanathan

CSE 555 HW 5 SAMPLE SOLUTION. Question 1.

SYLLABUS. Introduction to Finite Automata, Central Concepts of Automata Theory. CHAPTER - 3 : REGULAR EXPRESSIONS AND LANGUAGES

CSE 311: Foundations of Computing. Lecture 23: Finite State Machine Minimization & NFAs

ACS2: Decidability Decidability

Automata and Computability. Solutions to Exercises

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY

Homework Assignment 6 Answers

Introduction to Turing Machines. Reading: Chapters 8 & 9

CSE 105 THEORY OF COMPUTATION

Final exam study sheet for CS3719 Turing machines and decidability.

Theory of Computation

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

Computability Theory

Non-emptiness Testing for TMs

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

TURING MAHINES

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

6.045 Final Exam Solutions

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

Decidability and Undecidability

CS154, Lecture 10: Rice s Theorem, Oracle Machines

UNRESTRICTED GRAMMARS

Automata and Computability. Solutions to Exercises

CS481F01 Solutions 8

INSTITUTE OF AERONAUTICAL ENGINEERING

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

NODIA AND COMPANY. GATE SOLVED PAPER Computer Science Engineering Theory of Computation. Copyright By NODIA & COMPANY

Computability and Complexity

Computational Models Lecture 8 1

CSCE 551 Final Exam, Spring 2004 Answer Key

Decidability (intro.)

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

Nondeterministic Finite Automata

Testing Emptiness of a CFL. Testing Finiteness of a CFL. Testing Membership in a CFL. CYK Algorithm

Complexity Theory Part I

CS20a: Turing Machines (Oct 29, 2002)

On Rice s theorem. Hans Hüttel. October 2001

Theory of Computation p.1/?? Theory of Computation p.2/?? We develop examples of languages that are decidable

Computational Models Lecture 8 1

CP405 Theory of Computation

CSCC63 Worksheet Turing Machines

CSE 105 THEORY OF COMPUTATION

Transcription:

CSE 555 MIDTERM EXAMINATION SOLUTIONS TAKE-HOME: OUT 02/21 NOON, DUE 02/25 NOON The completed test is to be submitted electronically to colbourn@asu.edu before the deadline, or time-stamped by the main office in CIDSE and placed in Prof. Colbourn s physical mailbox. Answer every question, whether or not you think your answer is complete or correct. You can use any materials desired, but this is an individual effort, so limit your discussions with fellow students, and under no circumstances should written work be shared. Part of the exercise of doing the questions is understanding the questions. Read each carefully so as not to waste time. All questions are equally weighted (but not necessarily equally difficult.) 1. Question 1. Consider the statement w x y z[(w + x = y) ((y = z) ((w + x z))]. We operate in the universe of natural numbers with two relations, equal and plus, having their natural interpretations. (a) When w, x, y, z are provided as input in binary, encoded in a 16-letter alphabet whose letters are the 2 4 binary vectors of length four, devise a DFA that accepts precisely when (w + x = y) ((y = z) ((w + x z)). Here is a DFA for a + b = c with inputs encoded as binary vectors of length 3 with the first bit from a, the second from b, and the third from c. Note that it has not reversed the language, so it is using borrows rather than carries. State Input 000 001 010 011 100 101 110 111 q 0 start, accept q 0 q b q d q 0 q d q 0 q d q d q b q d q d q b q d q d q 0 q 0 q b q d q d q d q d q d q d q d q d q d Many students now simplified the formula. I do not see how to do so unless you prove a rule of implication in the theory, or establish that the DFA is equivalent. Now I use this DFA to make one for (w + x = y) ((y = z) ((w + x z)), with inputs encoded as binary vectors of length four with the bits of w, x, y, and z in that order. I name the states as pqr where p indicates the state (0, b, d) of the DFA for w + x = y, q indicates the state (0, b, d) of the DFA for w + x = z, and r indicates the state (e, n) of the DFA for y = z. 1

2 TAKE-HOME: OUT 02/21 NOON, DUE 02/25 NOON State Input 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 00e 00e 0bn b0n bbe dde d0n 0dn 00e dde d0n 0dn 00e dde ddn ddn dde 0be 0de 0dn bdn bde dbe ddn 0bn 0de dde d0n 0dn 00e d0e dbn d0n dbe 0de 0de 0dn bdn bde dde ddn 0dn 0de dde ddn 0dn 0de dde ddn ddn dde b0e d0e dbn d0n dbe bde b0n ddn d0e dde d0n 0dn 00e 0de 0dn bdn bde bbe dde ddn ddn dde bbe bdn dbn dde dde d0n 0dn 00e 00e 0bn b0n bbe bde dde ddn ddn dde bde bdn ddn dde dde ddn 0dn 0de 0de 0dn bdn bde d0e d0e dbn d0n dbe dde d0n ddn d0e dde d0n ddn d0e dde ddn ddn dde dbe dde ddn ddn dde dbe ddn dbn dde dde d0n ddn d0e d0e dbn d0n dbe dde dde ddn ddn dde dde ddn ddn dde dde ddn ddn dde dde ddn ddn dde 00n 00n 0bn b0n bbn ddn d0n 0dn 00n ddn d0n 0dn 00n ddn ddn ddn ddn 0bn 0dn 0dn bdn bdn dbn ddn 0bn 0dn ddn d0n 0dn 00n d0n dbn d0n dbn 0dn 0dn 0dn bdn bdn ddn ddn 0dn 0dn ddn ddn 0dn 0dn ddn ddn ddn ddn b0n d0n dbn d0n dbn bdn b0n ddn d0n ddn d0n 0dn 00n 0dn 0dn bdn bdn bbn ddn ddn ddn ddn bbn bdn dbn ddn ddn d0n 0dn 00n 00n 0bn b0n bbn bdn ddn ddn ddn ddn bdn bdn ddn ddn ddn ddn 0dn 0dn 0dn 0dn bdn bdn d0n d0n dbn d0n dbn ddn d0n ddn d0n ddn d0n ddn d0n ddn ddn ddn ddn dbn ddn ddn ddn ddn dbn ddn dbn ddn ddn d0n ddn d0n d0n dbn d0n dbn ddn ddn ddn ddn ddn ddn ddn ddn ddn ddn ddn ddn ddn ddn ddn ddn ddn

CSE 555 MIDTERM EXAMINATION SOLUTIONS 3 The start state is 00e. To accept we must have (w+x = y) ((y = z) ((w+x z)) so we accept whenever we are in state 00e, 0bn, or 0dn. Having formed the DFA, we can apply DFA minimization to make it much simpler. In particular, once we are in a state pqr with p = d, we can never get to an accepting state, so we can collapse these six states into one state. Carrying through DFA minimization completely, we get the DFA: State Input 0000 0010 0100 0110 1000 1010 1100 1110 0001 0011 0101 0111 1001 1011 1101 1111 q 0 start, accept q 0 q b q d q 0 q d q 0 q d q d q b q d q d q b q d q d q 0 q 0 q b q d q d q d q d q d q d q d q d q d This should look familiar. I did not use any rules of implication in the theory (which I have not proved) to do this. (b) Transform the quantifications into nondeterminism and show the NFA produced for w x y z[(w + x = y) ((y = z) ((w + x z))]. Then state whether the statement is true or false, and why. I write ψ 3 = z[(w + x = y) ((y = z) ((w + x z))] as z [(w + x = y) ((y = z) ((w + x z))] to get a DFA for ψ 3, which looks very familiar! State Input 000 001 010 011 100 101 110 111 q 0 start, accept q 0 q b q d q 0 q d q 0 q d q d q b q d q d q b q d q d q 0 q 0 q b q d q d q d q d q d q d q d q d q d For ψ 2 = y[ψ 3 ], I make the NFA: I convert it to a DFA: State Input 00 01 10 11 ε s start 0, b, d 0 accept 0, b 0, d 0, d d b d b, d 0, d 0, b d d d d d State Input 00 01 10 11 c: 0b accept 0bd 0bd 0d 0d d: 0d accept 0bd 0d 0d d e: 0bd start, accept 0bd 0bd 0d 0bd f: d d d d d I write ψ 1 = x[ψ 2 ] as x [ψ 2 ] and form an NFA for x [ψ 2 ] as follows:

4 TAKE-HOME: OUT 02/21 NOON, DUE 02/25 NOON State Input 0 1 ε s start d,e d d,e d,f e e d,e f accept f f Now convert it to a DFA and complement: State Input 0 1 j: de start, accept de def k: def def def This is the DFA for ψ 1 = x[ψ 2 ]. Now write φ = ψ 0 = w[ψ 1 ] as w [ψ 1 ]. To make an NFA for w [ψ 1 ] first convert the complement of the DFA just given to an NFA: State Input [] ε s start j,k j j,k k accept k Now convert it to a DFA and complement the final states to get the DFA for φ: State Input [] jk start,accept jk This machine accepts every string including the the empty string, so the statement is true (and proved). 2. Question 2. FINITE LG = { G : the language generated by linear grammar G is finite}. Show that FINITE LG is decidable. Let the longest right hand side of a rule have n terminals in it, and suppose that there are m variables. The language is infinite if and only if it contains a string of length at least nm + 1 by the pigeonhole principle. So enumerate strings of length mn + 1 and for each check whether it is in the language (A CF G is decidable). If none is, accept; otherwise reject. Alternatively: Convert the grammar to Chomsky normal form. Now eliminate all variables that are not productive in that they can never produce a string of terminals, and eliminate all rules that contain them. Then eliminate all variables that can never be produced starting with S, and eliminate rules that contain them. Then check whether any variable is recursive (appears in a cycle). It does not work to simply check whether a grammar has a cycle in the variables, even if the grammar is in CNF. The grammar {S A, A B, B A} has a finite language. So does the grammar {S aa a, A ab, B aa}

CSE 555 MIDTERM EXAMINATION SOLUTIONS 5 3. Question 3. REGULAR T M = { M : the language recognized by Turing machine M is regular}. (a) Show that REGULAR T M is not decidable. Apply Rice s theorem. Or do the (b) part first and then draw the conclusion. (b) Determine whether REGULAR T M is co-turing recognizable, Turing-recognizable, or neither. Explain your answer carefully. We show that A T M m REGULAR T M, and that A T M m REGULAR T M, which will prove that it is neither. A T M m REGULAR T M : On input M, w : Form a TM R as follows: On input x: If x is of the form 0 n 1 n, accept. Otherwise run M on w and accept if M accepts w. Output R. Then R accepts a regular language if and only if M accepts w. A T M m REGULAR T M : On input M, w : Form a TM S as follows: On input x: If x is not of the form 0 n 1 n, reject. Otherwise run M on w and accept if M accepts w. Output S. Then S accepts a regular language if and only if M does not accept w. 4. Question 4. Show how to use the recursion theorem to produce two different Turing machines M and N so that when M is run on any input, it prints N, and when N is run on any input, it prints M. N = On input x: Obtain own description N. Form a TM M by behaves just like N but then moves the head to the left hand end of the tape before it halts. Erase tape and write M on the tape left to right, leaving the tape head on the last nonblank cell M = On input x: Obtain own description M. Form a TM N by behaves just like M but having written the configuration,

6 TAKE-HOME: OUT 02/21 NOON, DUE 02/25 NOON leaves the head on the last nonblank cell. Erase tape and write N on the tape left to right, then moving the tape head on the first cell One idea is to get the machine to add or subtract some useless operation, like moving the tape head as we have done above. 5. Question 5. We have focussed on deterministic Turing machines. (a) Justify this by showing that there is a computable function t : Σ Σ so that whenever M is a nondeterministic Turing machine, t( M ) = M where M is a deterministic Turing machine with L(M) = L(M ) (and if x does not properly encode a nondeterministic Turing machine, then t(x) does not properly encode a deterministic Turing machine). The gist of this is to argue that Sipser s Theorems 3.13 and 3.16 not only establish the equivalence, which is not enough for what we need, but also give algorithms for producing the equivalent deterministic TM. (b) Can you show that the language of encodings of nondeterministic Turing machines with minimal length descriptions is not recognizable? Explain. This is the same enumeration argument as for MIN T M.