Attach the Question Paper on Top of Your Answer Sheets Type Your Name Here: CSE 5210 Points 60 Formal Languages and Automata Theory Spring 2014 Exam 3 Time 110 min (1a) How many strings of lengths 0, 1, 2, and 3 can be there for Sigma={a,b,c,d}? Length zero -> |Sigma|^0 = 1; Length one -> |Sigma|^1 = 4; Length two-> |Sigma|^2 = 16; … (1b) RL Pumping lemma: Prove that the language {02n 1n 02n | n ≥ 0} is not a Regular Language, Sigma={0,1}. [2+8] Exact steps in the proof are needed. Pump on the beginning 0’s for assumed DFA to accept a string that is not in the language: 02n+k 1n 02n for some k>0. (2) Re & NFA: Write a Regular expression for a language over Sigma={0,1}, where each string is a sequence of one or more 0’s are followed by a sequence of zero or more 1’s. What is the minimum length-string in this language? 00*1* Minimum length is one for the first 0 only. Draw an NFA (NFA-e is ok) for the above language and run one in-language string of length 3 on your NFA. [3+1 +4+2] Connect three stages NFA serially. The last two stages each has a loop for the Kleene star. (3) CFG: Develop a CFG for the language over Sigma={1,2}, {1n 2n+m 1m | n,m ≥ 0} Run one out-of-language string over your CFG. [8+2] S -> S1S2 S1 -> 1 S12 | e S2 -> 1 S22 | e 12221 for an extra 2; 121 for extra 1, etc. I would like to see some steps for attempting to generate the string and then stopping without success – just as a program would run. Blank answer, even on a correct example string, to deduct 1 point. (4) PDA: Define a PDA for the language over Sigma={1,2}, {1n 23n | n ≥ 1} Run one out-of-language string over your PDA. [8+2] Push three Stack symbols for each beginning 1’s and pop for each 2. More 1’s than needed => string finished without reaching # More 2’s than needed => # encountered in stack before finishing the string. (5) TM: Over Sigma={0,1}, define a Turing Machine for the following language. (0n1n)p | n, p >0. Run your machine on the strings 001101, and on 001. [6+2+2] Not “defining” properly (i.e., providing only the table) will deduct for at least 1 point. Usual machine for 0^n 1^n, but there a 0 instead of B in pre-final state scanning Right was empty/reject/crash, but now, it starts behaving like q0 again: in our Slide’s table delta(q3, 0) = (q1, X, R). If the answer significantly deviates from our table, the grader will have to go through carefully to check for correctness of the TM. Examples, 0011 01 is in the language; 001 will crash on XXYB while looking for Y in state q1. (6a) TM: Over Sigma={0,1}, L(M) = {at least one 01 or one 10 in the string, i.e. Σ*(01+10)Σ*}. Define a Turing Machine for L(M) that always halts. No example run is necessary. [4] Scan right for the first character repeated, as soon as you encounter the other character, accept and halt. If q0 sees B (for epsilon or for all characters being the same), then crash. (6b) What is the suffix after the TM encoding prefix in the following string, on Sigma={0,1}? Define the corresponding machine M. [Note that the indices always start from 1 and not from 0, e.g., 0 encodes the first state, 00 encodes the second state, or, 0 encodes the Left Head-movement, and 00 encodes the Right Headmovement.] 11101010101001101001010010011010001001000101100101000101011100 What is the language L(M)? [For some students: I am asking for the exact language, not the type of the language!] Table: first row: (->q1, 0, R) (q1, 1, R) (q2, B, L) Second row: (q3*, 0, L) Third row for *q3 are all empties. L(M) is Sigma*0, or ends with 0. Is the suffix of the above string in L(M)? Justify your answer by running the suffix on your machine M. [1+3+2] One point for You! Suffix is 00. Accepted! You have to show the transitions/steps.