cs3102: Theory of Computtion Clss 5: Non-Regulr PS1, Prolem 8 Menu Non-regulr lnguges Spring 2010 University of Virgini Dvid Evns PS1 Generl Comments Proofs re for mking convincing rguments, not for ofusction. e.g., If you ssumed pizzs cn only e cut through their center, it is ovious ech cut mkes 2 new pieces, nd the numer of pieces is 2n. Adding n inductive proof only dds unnecessry confusion! Pledges re to remind you to e honorle I ssume you re ll honorle whether you write pledge or not Writing rote pledge (not wht the PS collortion policy sys) doesn t work Prolem 8 DFA tht recognizes: { w w [, ]*nd wdoes not contin two consecutive s }, no- one- two- How mny strings of length nin this lnguge? no- one-, Fioncci Strings! two- n End in no- stte Endin one- stte Totl of length n 0 1 0 1 1 1 1 2 2 1+1 = 2 1 3 3 2+1 = 3 2 5 4 3+2 = 5 3 8 n> 2 E 0 (n-1)+e 1 (n-1) E 0 (n-1) 2E 0 (n-1) + E 1 (n-1) E 1 (n) = E 0 (n-1) E 0 (n) = E 0 (n-1)+e 0 (n-2) T(n) = 2E 0 (n-1) + E 0 (n-2) = 2(E 0 (n-2) +E 0 (n-3)) + E 0 (n-2) = 3E 0 (n-2) + 2E 0 (n-3) T(n -1)=2E 0 (n-2) + E 0 (n-3) + T(n -2)=2E 0 (n-3) + E 0 (n-4) = 2E 0 (n-2) + 3E 0 (n-3)+ E 0 (n-4) = 2E 0 (n-2) + 2E 0 (n-3)+ (E 0 (n-3) + E 0 (n-4)) = 3E 0 (n-2) + 2E 0 (n-3) = T(n)
Wht DFAs Cnnot Do All Regulr Cn e recognized y some DFA Finite Keep trck of non-constnt mount of stte: the mount of stte to keep trck of cnnot scle with the input string DFAs cn hve ny numer of sttes, ut the numer of sttes in ny prticulr DFA is fixed nd finite. The Lnguge Recognition Gme Plyers gree on lnguge A Plyer 1: drw DFA Mtht ttempts to recognize lnguge A. Plyer 2: find string stht Mdecides incorrectly. Either, s Aut M rejects Or, s Aut M ccepts If Plyer 2 cn find such string, Plyer 2 wins. Otherwise, Plyer 1 wins. A= ** Plying the Lnguge Gme If Ais regulr, Plyer 1 should lwys win. If A is non-regulr, Plyer 2 should lwys win. Plying the Lnguge Gme A= { n n n>= 0 } Regulr Lnguge Gme A= { w w [,]* ndw hs mores thns. }
Regulr Lnguge Gme A= { w w [0,1]*ndw is divisile y 3 when interpreted s inry numer} 0 1 0 1 2 0 1 q 0 q z 1 0 If input string is longer thn Q, some stte must repet. y Pumping Lemm Cpture our intuition out wht DFAs cn t do more precisely. We ll see pumping lemms for other types of computtion models. q i q 0 z qz x flickr: ytwhitelight Pumping Lemm for Regulr If Ais regulr lnguge, then there is some numer p(the pumping length) where for ny string s And s p, s my e divided into three pieces, s = xyz, such tht y > 0, xy p, nd for ny i 0, xy i z A. Intuitively: you cn go round the circle ny numer of times. Using the PLRL: Proof y Contrdiction 1. AssumeAis regulr. 2. Then, the pumping lemm is true for A: there is some numer p(the pumping length) where for ny We cn string condense s And the first s p, 2 steps into s my the e sttement: divided into three ``Assume pieces, A is regulr s = xyz, nd p such is the tht pumping y > length 0, xy p, for A.'' nd for ny i 0, xy i z A. 3. The cretive prt:identify string stht cn e uilt using pnd show tht there is no wy to divide s = xyz tht stisfies the pumping lemm: for ll possile divisions where y > 0 there is some i 0 such tht xy i z A.
Exmple: A= { n n n>= 0 } A= { n n n>= 0 }is not regulr A= { w whs mores thns.} A= { w w [0,1]*ndw is divisile y 3 when interpreted s inry numer} Pumping lemm cn e used to show lnguge is not regulr. It strts y ssuming lnguge is regulr nd gets contrdiction. This is no wy to show lnguge is regulr. Regulr One-Slide Summry A lnguge is set of strings. A lnguge is regulr iff some DFA recognizes it. DFAs, NFAs, nd Regulr Expressions re eqully powerful They cn recognize exctly the sme set of lnguges = the regulr lnguges Prove y construction: show how to construct DFA tht recognizes the sme lnguge s NFA, etc. To prove lnguge is regulr: construct DFA, NFA or RE tht recognizes it To prove lnguge is not regulr: show recognizing it requires keeping trck of infinitestte use the pumping lemm to get contrdiction All Regulr Cn e recognized y some DFA Finite Next week: mchines tht cn recognize some non-regulr lnguge.
Return PS1 front of room fg2s (Arthur Gordon) dk8p dr7jx (Dvid Renrdy) jmd9xk jth2ey (Jmes Hrrison) - pmc8p rs3kd (Royn Short) yyz5w