Solution Prolem Set 2 Prolem.4 () Let M denote the DFA contructed y wpping the ccept nd non-ccepting tte in M. For ny tring w B, w will e ccepted y M, tht i, fter conuming the tring w, M will e in n ccepting tte. However, M will e in n non-ccpeting tte fter conuming the me tring w. So, M will reject w. For ny tring w B, w will e rejected y M, tht i, fter conuming the tring w, M will e in n ccepting tte. However, M will e in n non-ccpeting tte fter conuming the me tring w. So, M will reject w. Therefore, M recognize the complement of B (tht i thoe tring not in B). Thu, for ny lnguge L ccepted y DFA (i.e., for ny regulr lnguge L) there exit DFA which recognize the complement of L. Hence the cl of regulr lnguge i cloed under complement..4 (). Conider the NFA given elow. The tring i ccepted y oth mchine. Therefore, wpping the ccepting nd non-ccepting tte of n NFA which recognize the lnguge C doe not necerily yield nd NFA which recognize the complement of C.,, M M But till the cl of lnguge recognized y NFA re cloed under complement ecue the lnguge recognized y NFA re the me et of lnguge recognized y DFA. Prolem 2. memer:, not-memer:,. memer:,
not-memer:, c. memer:, not-memer:, d. memer:, not-memer:, e. memer:, not-memer:, f. memer:, not-memer:, g. memer:, not-memer:, g. memer:, not-memer:, Prolem 3 () {w w egin with nd end with } ( )* () {w w contin t let three } ( )*( )*( )*( )* (c) {w the length of w i t mot 5} ( )( )( )( )( ) (d) {w w contin n even numer of, or contin exctly two } w contin n even numer of : (***)* w contin exctly two : *** w contin n even numer of, or contin exctly two : (***)* *** 2
Prolem 4 Prt () ()* (()*()) 3
(()*()) ((()*()) )* Prt () Let u give the following nme to ech tte: c d e f g h i j k l m n o 4
Then the DFA correponding to the NFA ove i:, k,l,h i,j,,c,g,h,l m,n d,e,i,j f,,c,g,h,l o,,c,g,h,l Prolem 5 Prt () 2 Firt, convert to n equivlent GNFA 2 5
Next, eliminte tte (except nd ) one y one. We will firt eliminte tte * 2 (*) Then eliminte tte 2. *( (*))* Hence the regulr expreion correponding to the given DFA i: *( (*))* Prt (), 2 3 Firt, convert to n equivlent GNFA 2 3 6
Next, eliminte tte (except nd ) one y one. The order in which the tte re eliminted doe not mtter. However, eliminting tte in different order my reult in different (ut lo correct) regulr expreion. Firt eliminte tte 2 ( ) 3 Next, eliminte tte 2 ( )* 3 ( )* Next, eliminte tte 3 (( )* )( ( )*)*( ) Hence the regulr expreion correponding to the given DFA i: (( )*)( ( )*)*( ) 7
Prolem 6,,/ # / # # /,,#,,/,,,/,# Prt () /#(( /) (#*( )))*#/ Prolem 7 Solution to prt () nd (c) re given in textook (p. 96) Prt () Aume tht A 2 i regulr. Chooe = p p p Since, ccording to pumping lemm, xy < p the pumping tring y cn conit of only of. When we pump y the numer of leding will e lrger thn the ret which men tht the new tring will not e in the lnguge A 2. Thi i contrdiction. So A 2 i not regulr. Prolem 8 In exmple.73 the lnguge i { n n n }. But in thi prolem the lnguge i **. When the tring i pumped the reultnt tring i till in ** ince thi lnguge conit of thoe tring in which ny numer of i followed y ny numer of (the numer of cn e lrger thn the numer of, they don t need to e equl). 8
Prolem 9.6c,.6e,,,,.6g,,,,,,,.6h Firt drw the DFA which ccept only nd then tke the complement y wpping the ccepting nd nonccepting tte. The finl DFA i given elow.,, 9
.6j Firt drw the DFA for tring coniting of t let two., x y z String conit of exctly one,, c Now drw the finl DFA which imulte thee two DFA nd ccept only when oth of thee DFA re in n ccept tte., y z zc x xc yc y z
.7 The DFA in.6c i lredy with five tte. Since ll DFA re lo NFA the olution i the me in.6c.7d.7e.7f The olution i given in your textook p.95.