Theory of Computation Regular Languages II Nov 1 4 Context Free Languages 15 Nov 1 MY Decidability 22 Nov Undecidability 29 Nov There are unsolvable problems uncountable may countably many possible algos possible problems what is a computer T't tcompu p L O outputs Restrict inputs I input I 011010 multiplexing input 2 IO 0 II 0 input Jt Io 44 Can assume I single input 2 one bit of output instruction Cpu state of system charges Assumptions possibly a fixed internal memory bi once done reading input machine stops C Machine starts in some state State names Example fy I 1 wide circle start stoles is a t state stole a transitions Example only input O 00 tension Example o Every state E na est www.oiIS ufI Iff't fo accept has I accept lion try possible empty string inputs C o A Deterministic Finite Automaton DFA has the following attributes I Q finite set of States 2 Ei finite input alphabet 3 Co E Q the stat state 4 F E Q set of final states 5 S transition function 8 Q X E Q is a total function f every possible state we what to statelinput pair are in read is defined Define formally co_ Q 90,91 92,933 Iff't Iff't 8 20,13 go Eo F 9 92 0 Transition Table gI μ 91 90 97 92 93 90 93 I 92 I 91 Defs computation of DFA M on input w sequence of slates visited can repeat states a computation is accepting if last state is in F a language is a set of strings can be finite or infinite a language is regular if it is the language of Sony DFA I set of strings that have on accepting computation I L all strings over E soit's I having odd length Ex Lis regular E all strings over 83 regular 29197 empty set rain g hors Ei't Ee chars a in all nonempty strings Set Operations on reg languages Let be a set of languages Say C is closed under operation if applying to languages in C results in a language that is in C Regular Operations Li Lz be langs union L U Lz X X EL or X E L Concatenation L L Lz xz XE Li z E Lz e star Ll L o Io U Lik I 1013 KIO K L OI 010 40 43 Iot 101013 K I Lik L l I Complement L be a language I E t L in every string not in L Then Regular tongs closed under complement I O Union O II 4 it 9091919 Lz ro ro ri ro I Thor Rhs are closed under union Idea simulate both machines at the same time A no Earles product of state sets what about intersection I De Morgan's laws L n LE I ULT 2 Do the product construction and change final states Concatenation L Lz X Z X E 4 X E Lz f where is He split W Wz we Wi Witi Wn C 4 E Lz Nondeterministic Finite Automaton NFA any of transitions from any state E transition if taker no character Is it so Edina iii it a final state we will accept of comps can be anything REo nea E Concatenation Str Ezo Understand relationship between NFAs t D FA s F very DFA is an NFA NFA a is re non a 9g9z Thai NFAs are equivalent to DFA s DFA s NFAs accept a language provide a string it computes says accept or not WE o 13 number of 0 Is in w number of IO s in w Ftjescribe a language precisely Regular Expression Let be an alphabet A regular expression R is one Ri Reggae of the following y y I R 0 4 R R V R2 Z R E 5 Re R R2 3 Rea a c Ei 6 R Ri t Et OUI IOI all strings ending in IO't OI all strings of form F 010101 I 20 times Then NFAs t regexes are equivalent Lemma Every regex can be converted into an NFA Regex R I f 0 O 4 R R O R2 2 F E 5 R R R2 3 F a 6 R Ri t 0500 F Eu Iz t toooo 0 00 E O 2,00 a 070 o reef lemma Every NFA can be converted into an equivalent regex R regex 0 00 Every NFA can wlog have exactly 1 final state Wlog have a start state with no oefoNFafo8E inYminssia.ns Je R BO R t I R2 Generalized Ri A Rz NFA every transition is a regex and 4 nothing going into start state nothing 4 leaving 4 final state Repeatedly rip i.e delete a state and add any transitions as necessary At end the 6 NFA will be of the form Koo equivalent regex is R Rip Ez b ESO s a.fi f t RipX9o Rip GYU ab 6 aUab Rip 92 Tryout sod I q q 90 92 f final regex μ μ Cab't aUdb suppose w is accepted by DFA M what other strings are also accepted or soo when can we flooperists left side guarantee infinitely many other strings such a loop we accepted For any W E L with w z of States in DFA get this behavior to Note I XyiZ EL fo all iz o Z ly l z't y f e 3 Xy E of slates in DFA Pumping Lemma for Regular languages of state Let L be a reg long in DFA Ther Hee exists a pumping constant for L For all WE L with w Z P there exists X y Z s t W Xyz so that I X y t E L for all iz o 2 ly Iz't 3 1 Xy Ep f on in n 203 X Oa is not regular y Ob 6 I Suppose L is regular 2 rest Exists the constant p for L pick i 2 choose w OP IP yyz Opt b II Look at all possible breakups d w into Xyz Only way this is in the language is it p t b p 6 0 Perf S Ori n o is not regular Suppose Perfs is regular exists a constant p for Perfs Choose w OR w p Look at all decompositions lxt a.ly 6 Pump up to E Z Xyyz p't f Only way this is in Perf 5 is it p't 6 is a perfect square Know b I I p's p't 6 Next pet square pti p 72 p t I 76 E ft p s p2t2ptI r aep ia EEE length of string xyyz Max possible length of X y y z