# HM4-FSMsAndRegEXs-Ch7-Closure-Answers - CS 341 Automata...

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

CS 341 Automata Theory Elaine Rich Homework 4 Due: Thursday, February 8, 2007 1) Consider the following FSM M : a a b 1 b 2 a 3 b 4 a,b a) Show a regular expression for L ( M ). ( a bb * aa )* ( ε bb *( a ε )). b) Describe L ( M ) in English. All strings in { a , b }* that contain no occurrence of bab . 2) Consider the following FSM M : q 0 a q 1 b q 3 b a b q 2 a) Write a regular expression that describes L ( M ). ε (( a ba )( ba )* b ). b) Show a DFSM that accepts ¬ L ( M ). a {1} {2, 3} b {0} a b a {2} a,b b 3) Show a regular grammar for each of the following languages: a) { w { a , b }* : w does not end in aa }. S a A | b B | ε A a C | b B | ε B a A | b B | ε C a C | b B

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

View Full Document
b) { w { a , b }* : w does not contain the substring aabb }. S a A A a B B a B C a A S b S A b S B b C C ε S ε A ε B ε 4) Consider the following regular grammar G : S a T T b T T a T a W W ε W a T a) Write a regular expression that generates L ( G ). b) Use grammartofsm to generate an FSM M that accepts L ( G ). 5) Prove by construction that the regular languages are closed under: a) intersection. b) set difference. 6) Prove that the regular languages are closed under each of the following operations: a) pref ( L ) = { w : 5 x Σ * ( wx L )}. By construction. Let M = ( K , Σ , δ , s , A ) be any FSM that accepts L : Construct M′ = ( K , Σ′ , δ′ , s , A ) to accept pref ( L ) from M : 1) Initially, let M′ be M . 2) Determine the set X of states in M′ from which there exists at least one path to some accepting state: a) Let n be the number of states in M′ . b) Initialize X to {}. c) For each state q in M′ do: For each string w in Σ where 0 ≤ w n -1 do: Starting in state q , read the characters of w one at a time and make the appropriate transition in M′ . If this process ever lands in an accepting state of M′ , add q to X and quit processing w .
This is the end of the preview. Sign up to access the rest of the document.