{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

HM5-Chapters8-9-Answers

# HM5-Chapters8-9-Answers - CS 341 Automata Theory Elaine...

This preview shows pages 1–2. Sign up to view the full content.

CS 341 Automata Theory Elaine Rich Homework 5 Due: Thursday, February 15, 2007 This assignment covers Chapters 8 and 9. 1) For each of the following languages L , state whether or not L is regular. Prove your answer: a) { a i b j : i, j ≥ 0 and i + j = 5}. Regular. A simple FSM with five states just counts the total number of characters. b) { a i b j : i, j ≥ 0 and i - j = 5}. Not regular. L consists of all strings of the form a * b * where the number of a ’s is five more than the number of b ’s. We can show that L is not regular by pumping. Let w = a k +5 b k . Since | xy | k , y must equal a p for some p > 0. We can pump y out once, which will generate the string a k +5- p b k , which is not in L because the number of a ’s is is less than 5 more than the number of b ’s. c) { w = xy : x , y { a , b }* and | x | = | y | and # a ( x ) # a ( y )}. Not regular, which we’ll show by pumping. Let w = a k bba k . y must occur in the first a region and be equal to a p for some nonzero p . Let q = 0. If p is odd, then the resulting string is not in L because all strings in L have even length. If p is even it is at least 2. So both b ’s are now in the first half of the string. That means that the number of a ’s in the second half is greater than the number in the first half. So resulting string, a k-p bba k , is not in L . d) { w = xyzy R x : x , y , z { a , b }*}. Regular. Note that L = ( a b )*. Why? Take any string s in ( a b )*. Let x and y be ε . Then s = z . So the string can be written in the required form. Moral: Don’t jump too fast when you see the nonregular “triggers”, like ww or ww R . The entire context matters. e) { w = xyzy : x , y , z { 0 , 1 } + }. Regular. All that’s required is that the last letter must occur in at least one other place in the string, that place is not immediately to its left, and thereare at least 4 letters. Either the repeated character is 0 or 1 .

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 4

HM5-Chapters8-9-Answers - CS 341 Automata Theory Elaine...

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

View Full Document
Ask a homework question - tutors are online