Home10ClosurePumpingandFunctions

Home10ClosurePumpingandFunctions - CS 341 Automata Theory...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 341 Automata Theory Elaine Rich Homework 10 Due Thursday, Nov. 9 at 11:00 1) Determine, for each of the following languages, whether it is (I) Regular, (II) Context free but not regular, or (III) not context free. Prove your answer. a) L = { ww R w : w { a , b }*}. b) L = { w : w = uu R or w = u a n : n = | u |, u { a , b }*}. c) L = { a n b 2 n c m } { a n b m c 2 m }. d) L *, where L = { 0 * 1 i 0 * 1 i 0 * }. Hint: This one is tricky. Be very careful in your analysis of L *. e) L = { w {0, 1}* : # 1 ( w ) = (# 0 ( w )) 2 } f) L = { x { a , b }* : | x | is even and the first half of x has one more a than does the second half} 2) Let L 1 = { a n b m : n m }. Let R 1 = {( a b )* : there is an odd number of a 's and an even number of b 's}. Use the construction described in the book to build a PDA that accepts L 1 R 1 . 3) Suppose that L is context free and R is regular. Is R - L necessarily context free? Prove your answer. 4) Show that the context-free languages are closed under letter substitution. 5) Let alt be a function that maps from any language L over some alphabet Σ to a new language L as follows: alt ( L ) = { x : 5 y,n ( y L , | y | = n , n > 0, y = a 1 a n , 2200 i n ( a i Σ ), and x = a 1 a 3 a 5 a k , where k = (if even ( n ) then n -1 else n ))} a) Consider L = a n b n . Clearly describe L 1 = alt ( L ). b) Are the context free languages closed under the function alt ? Prove your answer. 6) Let chop be a function that maps from any language L over some alphabet Σ to a new language L as follows: chop ( L ) = { x : 5 y L ( y = uvw , u , w Σ *, v Σ , | u | = | w |, and x = uw )} In other words, the strings in chop ( L ) are the odd length strings in L with the middle character chopped out. Prove that the context free languages are not closed under chop .
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CS 341 Automata Theory Elaine Rich Homework 10 Answers 1) Determine, for each of the following languages, whether it is (I) Regular, (II) Context free but not regular, or (III) not context free. Prove your answer. a) L = { ww R w : w { a , b }*} (III) Not Context Free. Use pumping: Let w = a k b k b k a k a k b k 1 | 2 | 3 | 4 In each of these cases, pump in once: 1. If any part of v is in region 1, then to produce a string in L we must also pump a ’s into region 3. But we cannot since | vxy | k . 2. If any part of v is in region 2, then to produce a string in L we must also pump b ’s into region 4. But we cannot since | vxy | k . 3. If any part of v is in region 3, then to produce a string in L we must also pump a ’s into region 1. But we cannot since y must come after v . 4. If any part of v is in region 4, then to produce a string in L we must also pump b ’s into region 2. But we cannot since y must come after v . b)
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

Home10ClosurePumpingandFunctions - CS 341 Automata Theory...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online