Models of Comput:on Lecture #8 Chpter 7 con:nued Any lnguge tht e defined y regulr expression, finite utomton, or trnsi:on grph cn e defined y ll three methods We prove this y showing tht ny lnguge defined y n FA cn lso e defined y TG ny lnguge defined y n TG cn lso e defined y RE ny lnguge defined y n RE cn lso e defined y FA We prove this y showing tht ny lnguge defined y n FA cn lso e defined y TG DONE! ny lnguge defined y n TG cn lso e defined y RE ny lnguge defined y n RE cn lso e defined y FA We prove this y showing tht ny lnguge defined y n FA cn lso e defined y TG DONE! ny lnguge defined y n TG cn lso e defined y RE DONE! ny lnguge defined y n RE cn lso e defined y FA We prove this y showing tht ny lnguge defined y n FA cn lso e defined y TG DONE! ny lnguge defined y n TG cn lso e defined y RE DONE! ny lnguge defined y n RE cn lso e defined y FA TODAY! 1
Prt 3: Any lnguge defined y n RE cn lso e defined y FA Rememer tht FA model is more restrined thn TG. There is one edge from every stte for every possile lphet symol. There is no such thing s crsh There is no such thing s non- determinism Prt 3: RE FA Construc:ve proof with rules for severl cses. Rule 1. Bse cses. There is n FA tht ccepts ny pr:culr le_er of ny lphet. There is n FA tht ccepts only Λ Bse cse: RE FA Proof of Rule 1. If x is then this FA ccepts ny pr:culr single le_er of the lphet nd nothing else. Bse cse: RE FA Proof of Rule 1. This FA ccepts Λ only. ny letter except x x + ny letter ± ny letter ny letter ny letter Union: RE FA Rule 2. If FA 1 is n FA tht ccepts the lnguges defined y regulr expression r 1 nd FA 2 is n FA tht ccepts the lnguge defined y regulr expression r 2, then there is n FA 3 which is n FA tht ccepts the lnguge defined y r 1 +r 2 Union: RE FA How to hndle choice? Construc:ve lgorithm. Imgine trcing through the input on oth mchines nd then construc:ng new mchine tht emodied the or choices. Esiest to understnd y exmple. Text exmple: Doule- or EVEN- EVEN 2
Exmple: Doule- Exmple: Doule-, EVEN- EVEN,, Doule- + EVEN- EVEN Let s uild the or mchine., Doule- + EVEN- EVEN Crete new sttes tht emody the or New strt stte, clled z 1, tht mens x 1 or y 1 Note tht y 1 ws finl stte, so z 1 is lso finl, Doule- + EVEN- EVEN Doule- + EVEN- EVEN Crete new sttes tht emody the or New strt stte, z 1, mens x 1 or y 1 Since y 1 ws finl stte, so is z 1 Follow z 1 on input x 1 would go to y 1 would go to New stte mens or New sttes ±z 1 : x 1 or +y 1, New sttes red red ±z 1 : x 1 or +y 1, 3
Doule- + EVEN- EVEN Doule- + EVEN- EVEN Follow z 1 on input x 1 would go to y 1 would go to New stte mens or Follow z 1 on input x 1 would sty t x 1 y 1 would go to y 3 New stte mens x 1 or y 3 New sttes red red ±z 1 : x 1 or +y 1 : or, New sttes red red ±z 1 : x 1 or +y 1 : or, Doule- + EVEN- EVEN Follow z 1 on input x 1 would sty t x 1 y 1 would go to y 3 New stte mens x 1 or y 3 Follow on input would go to x 3 finl stte would go to y 1 finl stte New stte +z 4 mens x 3 or y 1 New sttes red red : or, New sttes red red : or, Follow on input would go to x 3 finl stte would go to y 1 finl stte New stte +z 4 mens x 3 or y 1 Follow on input would go to x 1 would go to y 4 New stte z 5 mens x 1 or y 4 New sttes red red : or +z 4, New sttes red red : or +z 4, 4
Follow on input would go to x 1 would go to y 4 New stte z 5 mens x 1 or y 4 z 5 New sttes red red : or +z 4 z 5, Wht is the mximum numer of sttes? nswer: sttes in FA 1 x sttes in FA 2 Not ll of which will lwys e used In this cse they re Let s work out the rest together New sttes red red : or +z 4 z 5, If :me llows New sttes red red : or +z 4 z 5 Crete the union of these two FAs,, y 1 + If :me llows Crete the union of these two FAs No:ce tht or is not possile So only five sttes in union, not 3 Complete s non- collected homework for next clss., y 1 + 5