CSE 555 Homework Three Sample Solutions

Similar documents
1 Showing Recognizability

V Honors Theory of Computation

CSE 105 THEORY OF COMPUTATION

Homework Assignment 6 Answers

CSCE 551 Final Exam, Spring 2004 Answer Key

CSE 105 THEORY OF COMPUTATION

CPSC 421: Tutorial #1

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

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

CSE 105 THEORY OF COMPUTATION

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

Decidability. Linz 6 th, Chapter 12: Limits of Algorithmic Computation, page 309ff

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

Decidability (What, stuff is unsolvable?)

CSE 105 THEORY OF COMPUTATION

CSE 555 HW 5 SAMPLE SOLUTION. Question 1.

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

CpSc 421 Homework 9 Solution

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

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

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

CS20a: Turing Machines (Oct 29, 2002)

CSCE 551 Final Exam, April 28, 2016 Answer Key

TURING MAHINES

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

Decision Problems with TM s. Lecture 31: Halting Problem. Universe of discourse. Semi-decidable. Look at following sets: CSCI 81 Spring, 2012

Further discussion of Turing machines

Lecture 13: Foundations of Math and Kolmogorov Complexity

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

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

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

Introduction to Languages and Computation

Theory of Computation

Theory Bridge Exam Example Questions

CSE 105 Theory of Computation

CS 361 Meeting 26 11/10/17

CS154, Lecture 10: Rice s Theorem, Oracle Machines

Computability and Complexity

Automata Theory. Lecture on Discussion Course of CS120. Runzhe SJTU ACM CLASS

Computational Models Lecture 8 1

CSE 105 THEORY OF COMPUTATION

Lecture Notes: The Halting Problem; Reductions

ACS2: Decidability Decidability

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

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

Final exam study sheet for CS3719 Turing machines and decidability.

Context Free Languages: Decidability of a CFL

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

T (s, xa) = T (T (s, x), a). The language recognized by M, denoted L(M), is the set of strings accepted by M. That is,

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY

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

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

CSCI3390-Lecture 6: An Undecidable Problem

Theory of Computation

Part I: Definitions and Properties

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

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

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

CS154, Lecture 12: Kolmogorov Complexity: A Universal Theory of Data Compression

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

6.045 Final Exam Solutions

MA/CSSE 474 Theory of Computation

AC68 FINITE AUTOMATA & FORMULA LANGUAGES DEC 2013

Course 4 Finite Automata/Finite State Machines

Computational Models Lecture 8 1

CSE 105 THEORY OF COMPUTATION

Theory of Computation

DM17. Beregnelighed. Jacob Aae Mikkelsen

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

CS 311 Sample Final Examination

Reducability. Sipser, pages

Exam Computability and Complexity

1. Induction on Strings

Section 14.1 Computability then else

SD & Turing Enumerable. Lecture 33: Reductions and Undecidability. Lexicographically Enumerable. SD & Turing Enumerable

CS154 Final Examination

Undecidable Problems and Reducibility

CS20a: Turing Machines (Oct 29, 2002)

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

uring Reducibility Dept. of Computer Sc. & Engg., IIT Kharagpur 1 Turing Reducibility

Computability Theory

Computational Models Lecture 8 1

CS154 Final Examination

Languages, regular languages, finite automata

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

The Unsolvability of the Halting Problem. Chapter 19

Theory of Computation (IX) Yijia Chen Fudan University

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Lecture 12: Mapping Reductions

CS481F01 Solutions 6 PDAS

Finish K-Complexity, Start Time Complexity

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Turing machines and linear bounded automata

Computation Histories

Turing Machines, diagonalization, the halting problem, reducibility

CS481F01 Solutions 8

Decidability: Reduction Proofs

Introduction to Turing Machines. Reading: Chapters 8 & 9

Deterministic Finite Automata. Non deterministic finite automata. Non-Deterministic Finite Automata (NFA) Non-Deterministic Finite Automata (NFA)

Transcription:

CSE 555 Homework Three Sample Solutions Question 1 Let Σ be a fixed alphabet. A PDA M with n states and stack alphabet of size σ may recognize the empty language; if its language is non-empty then denote by µ(m) the length of the shortest string that it accepts. Now define m(n, σ) = max{µ(m) : M is a PDA with n states and stack alphabet of size σ having L(M) }. Prove or disprove: There is an algorithm that, given n and σ, finds a PDA M with n states and stack alphabet of size σ having µ(m) = m(n, σ). Solution: We prove it. Note that E P DA is decidable, and there are only finitely many PDAs that have n states and stack alphabet of size σ: D = On input n, σ: 1. Let L be the list of all PDAs with n states and σ characters in the stack alphabet. 2. ρ 0. 3. M null. 4. For every PDA P L: (a) Run E P DA on input P (b) If E P DA accepts, proceed to the next PDA. (c) Otherwise, enumerate strings s in lexicographic order (in terms of the PDA s input alphabet): i. Run A P DA on P, s. ii. If A P DA rejects, continue on to the next string. iii. Else (A P DA accepts) A. if ρ < s, set M P, ρ s, B. go back to start on the next PDA. 5. Output M. Question 2 Let Σ be a fixed alphabet. A TM M with n states and tape alphabet of size σ may recognize the empty language; if its language is non-empty then denote by µ(m) the length of the shortest string that it accepts. Now define m(n, σ) = max{µ(m) : M is a TM with n states and tape alphabet of size σ having L(M) }. Prove or disprove: There is an algorithm that, given n and σ, finds a TM M with n states and tape alphabet of size σ having µ(m) = m(n, σ). Solution: We disprove it. We can just make another TM, using the recursion theorem, that is guaranteed to have a larger value of m(n, σ) than the current TM. D = On input w: 1. Obtain own description, D, by the recursion theorem. 2. Let n be the number of states in D, σ the number of tape alphabet characters. 3. Calculate N, a TM with n states and tape alphabet size σ for which the shortest string accepted has length m(n, σ). 4. If w is even, reject. 5. Write w = xay with x = y and a = 1; if x y reject. 6. Simulate N on x and if it accepts, accept. (If it rejects or runs forever, we will not accept.) Then the length of the shortest string accepted by D is 2m(n, σ) + 1, a contradiction. Question 3 We know that T h(n, +) is decidable but T h(n, +, ) is undecidable. We want to handle a limited form of multiplication in a decidable theory. To do this, fix a positive integer value n, and permit multiplication by integers k {1,..., n}. Specifically, let k be the relation {(x, kx) : x N}. Show that T h(n, +, 1,..., n ) is decidable. (Hint: Show how 1

to define k using + for every k.) Solution sketch: define this relation as M k (a, b) (i.e., k a = b). Note that M 2 (a, b) = P LUS(a, a, b). Now recursively define M k : M k (a, b) = zp LUS(a, z, b) M k 1 (a, z), where z is a new variable not defined previously. By an induction argument, once we defined M k 1 in terms of P LUS, we can define M k in terms of P LUS. Therefore, T h(n, +, 1,..., n ) is decidable because we can make a DFA for the entire formula ψ, because we know how to make a DFA for P LUS. Now we have a formula in T h(n, +). Therefore, T h(n, +, 1,..., n ) is decidable. Question 4a Using your method for question 3 and the algorithm for deciding T h(n, +), determine the truth or falsity of each of the following statements. Show all steps (first write each as an equivalent statement in T h(n, +) using your method from question 3; you may have to introduce new variables and quantifiers to do this). a b[2a + 2b = 2(a + b)]. Solution: Rewrite the formula using substitutions using our method above: which is the same as: a b x 1 x 2 s s 2 [M 2 (a, x 1 ) M 2 (b, x 2 ) P LUS(a, b, s) M 2 (s, s 2 ) P LUS(x 1, x 2, s 2 )] a b x 1 x 2 s s 2 [P LUS(a, a, x 1 ) P LUS(b, b, x 2 ) P LUS(a, b, s) P LUS(s, s, s 2 ) P LUS(x 1, x 2, s 2 )] The representation of the binary vectors has the form: a b x 1 x 2 s s 2 with each of the 6 entries in {0, 1}. For simplicity, we will interpret a binary number as abx 1 x 2 ss 2, with a being the most significant bit, and s 2 the least significant. For example, if the string is 101011, then a = 1, b = 0,, s 2 = 1. Let the DFAs in the description for each P LUS relation be named as D 1,, D 5. We won t show all the steps in creating each of the DFAs (since there are 192 transitions for each); however, we produce the DFA for L(D 1 ) L(D 5 ) in Tables 1 and 2 (after performing DFA minimization). The tables were produced by the usual DFA intersection algorithm with minimization, written in Python, and not by hand. An entry of indicates a dead state, and all other entries correspond to the state name. The left column corresponds to the length-6 binary vector described above. The DFA now, as described in the T h(n, +) algorithm, is A 6. Now we handle s 2 to get A 5. Since there are no transitions that lead to multiple non-dead states at the same time from any state, we can just collapse rows, and add a new start state with ɛ-transitions to states 0 and. Note that since we a dead state never has transitions out of itself, we can skip the step of having a new start state, and just use the existing NFA from collapsing the rows. But as we can see, we have no nondeterminism. Therefore, this is still a DFA, as is shown in Table 3. We can perform basic DFA minimization by removing states 4, 21, and 121 (since they are equivalent to 0, 19, and 117, respectively). See Table 4 for details: an xxx entry references one of the removed states, and all other entries are reflected to refer to the other equivalent state for each. Now we handle s to get A 4. We add a new state with ɛ-transitions to states 0 and 19, and the resulting NFA is shown in Table 5, and the minimized equivalent DFA is shown in Table 6. Now we handle x 2 to get A 3, as before. The resulting minimized DFA is shown in Table 7. Now we handle x 1 to get A 2. The resulting minimized DFA is shown in Table 8. Now we handle b to get A 1. We first complement the DFA in Table 8, apply as before, then complement back. The resulting minimized DFA is shown in Table 9. Now we handle a to get A 0. Carrying through the steps has A 0 be a single state that is accepting. Therefore, since A 0 accepts ɛ, this this statement is true and proved. Question 4b Using your method for question 3 and the algorithm for deciding T h(n, +), determine the truth or falsity of each of the following statements. Show all steps (first write each as an equivalent statement in T h(n, +) using your method from question 3; you may have to introduce new variables and quantifiers to do this). c a b[2a + 3b = c]. Solution: we can rewrite the formula using substitutions using our method above: 2

Table 1: Question 3a: Intersection DFA (64-character alphabet), Part 1 0 4 19 21 32 37 45 85 91 117 121 128 000000 0 19 000001 0 19 000010 21 21 000011 21 21 000100 19 19 000101 0 000110 4 21 000111 21 001000 19 001001 0 001010 4 001011 21 001100 19 19 001101 19 001110 4 21 001111 4 010000 45 45 010001 45 45 010010 32 32 010011 32 32 010100 37 45 010101 45 010110 32 32 010111 32 011000 37 011001 45 011010 32 011011 32 011100 37 45 011101 37 011110 32 32 011111 32 3

Table 2: Question 3a: Intersection DFA (64-character alphabet), Part 2 0 4 19 21 32 37 45 85 91 117 121 128 100000 91 91 100001 91 91 100010 85 85 100011 85 85 100100 91 91 100101 91 100110 85 85 100111 85 101000 91 101001 91 101010 85 101011 85 101100 91 91 101101 91 101110 85 85 101111 85 110000 117 128 110001 117 128 110010 121 121 110011 121 121 110100 128 128 110101 117 110110 121 121 110111 121 111000 128 111001 117 111010 121 111011 121 111100 128 128 111101 128 111110 121 121 111111 121 4

Table 3: Question 3a: Intersection DFA (32-character alphabet) 0 4 19 21 32 37 45 85 91 117 121 128 00000 0 0 19 19 00001 21 21 21 21 00010 0 19 19 00011 21 4 21 00100 0 19 00101 21 4 00110 19 19 19 00111 4 4 21 01000 45 45 45 45 01001 32 32 32 32 01010 45 37 45 01011 32 32 32 01100 45 37 01101 32 32 01110 37 37 45 01111 32 32 32 10000 91 91 91 91 10001 85 85 85 85 10010 91 91 91 10011 85 85 85 10100 91 91 10101 85 85 10110 91 91 91 10111 85 85 85 11000 117 117 128 128 11001 121 121 121 121 11010 117 128 128 11011 121 121 121 11100 117 128 11101 121 121 11110 128 128 128 11111 121 121 121 5

Table 4: Question 3a: Intersection DFA (32-character alphabet), Minimized 0 xxx 19 xxx 32 37 45 85 91 117 xxx 128 00000 0 xxx 19 xxx 00001 19 xxx 19 xxx 00010 0 19 19 00011 19 0 19 00100 0 19 00101 19 0 00110 19 xxx 19 00111 0 xxx 19 01000 45 xxx 45 xxx 01001 32 xxx 32 xxx 01010 45 37 45 01011 32 32 32 01100 45 37 01101 32 32 01110 37 xxx 45 01111 32 xxx 32 10000 91 xxx 91 xxx 10001 85 xxx 85 xxx 10010 91 91 91 10011 85 85 85 10100 91 91 10101 85 85 10110 91 xxx 91 10111 85 xxx 85 11000 117 xxx 128 xxx 11001 117 xxx 117 xxx 11010 117 128 128 11011 117 117 117 11100 117 128 11101 117 117 11110 128 xxx 128 11111 117 xxx 117 Table 5: Question 3a: 16-character alphabet NFA 0 xxx 19 xxx 32 37 45 85 91 117 xxx 128 s ɛ 0, 19 0000 {0,19} xxx {19} xxx 0001 {0,19} {0,19} {19} 0010 {0,19} {0,19} 0011 {0,19} xxx {19} 0100 {32,45} xxx {32,45} xxx 0101 {32,45} {32,37} {32,45} 0110 {32,45} {32,37} 0111 {32,37} xxx {32,45} 1000 {85,91} xxx {85,91} xxx 1001 {85,91} {85,91} {85,91} 1010 {85,91} {85,91} 1011 {85,91} xxx {85,91} 1100 {117} xxx {117,128} xxx 1101 {117} {117,128} {117,128} 1110 {117} {117,128} 1111 {117,128} xxx {117,128} 6

Table 6: Question 3a: 16-character alphabet DFA, Minimized 3 2 1 0 0000 3 0001 3 0010 3 0011 3 0100 1 0101 1 0110 1 0111 1 1000 0 1001 0 1010 0 1011 0 1100 2 1101 2 1110 2 1111 2 Table 7: Question 3a: 8-character alphabet DFA, Minimized. The only final state is 1, and is also the start state. 0 1 000 1 001 1 010 1 011 1 100 0 101 0 110 0 111 0 Table 8: Question 3a: 4-character alphabet DFA, Minimized. The only final state is 0, and is also the start state. 0 1 00 0 0 01 0 0 10 1 1 11 1 1 Table 9: Question 3a: 2-character alphabet DFA, Minimized. The only final state is 0, and is also the start state. 0 1 0 0 0 1 1 1 7

c a b a 1 b 1 [M 2 (a, a 1 ) M 3 (b, b 1 ) P LUS(a 1, b 1, c)] which is the same as: c a b a 1 b 1 z[p LUS(a, a, a 1 ) P LUS(b, z, b 1 ) P LUS(b, b, z) P LUS(a 1, b 1, c)] We won t show all the details, but the process is nearly identical to the (a) part, and turns out to be false. The proof requires constructing the DFAs and working with the quantifiers, but intuitively, it is false by setting c = 1; there do not exist a, b such that 2a + 3b = c. Question 5 MIN A TM TM = { M : M is a TM with an oracle for A TM for which the size of M is no larger than the size of M when M is a TM with an oracle for A TM for which L(M) = L(M )}. Prove that MIN A TM TM Solution: Suppose MIN A TM is not Turing recognizable. TM were recognizable; therefore, it is enumerable by an enumerator E. Construct the following TM which has an oracle for A TM : C A TM = On input w: 1. Obtain own description, C A TM, as given by the Oracle recursion theorem. 2. Run E until a TM with an oracle for A TM, D A TM, with longer description than C A TM, is found. 3. Run D A TM on w. The argument for contradiction is the same as for MIN TM, except we didn t establish the recursion theorem for oracle TMs. A solution to this is in the HW #3 solutions of Spring 2014 s offering of CSE555: http://www.public.asu.edu/ ccolbou/src/555hw3s14sol.pdf 8