CS4 45- Determinisitic Finite Automt -: Genertors vs. Checkers Regulr expressions re one wy to specify forml lnguge String Genertor Genertes strings in the lnguge Deterministic Finite Automt (DFA) re nother wy to specify lnguge String Checker Given ny string, determines if tht string is in the lnguge or not -: DFA Exmple Exmple Deterministic Finite Automton,, -: DFA Exmple DFA for ll strings over{,} tht contin exctly s -: DFA Exmple DFA for ll strings over{,} tht contin exctly s, -4: DFA Exmple All strings over, tht hve length. -5: DFA Exmple All strings over, tht hve length.,,,,, -6: DFA Components
CS4 45- Determinisitic Finite Automt Wht mkes up DFA?, -7: DFA Components Wht mkes up DFA?, Sttes -8: DFA Components Wht mkes up DFA?, Alphet (chrcters thn cn occur in strings ccepted y DFA) -9: DFA Components Wht mkes up DFA?
CS4 45- Determinisitic Finite Automt, Trnsitions -: DFA Components Wht mkes up DFA?, Initil Stte -: DFA Components Wht mkes up DFA?, Finl Stte(s) (there cn e> ) -: DFA Definition A DFA is 5-tupleM = (K,Σ,δ,s,F) K Set of sttes Σ Alphet
CS4 45- Determinisitic Finite Automt 4 δ : (K Σ) K is Trnsition function s K Initil stte F K Finl sttes -: DFA Definition, K = {q,q,q,q } Σ = {,} δ = {((q,),q ),((q,),q ),((q,),q ),((q,),q ), ((q,),q ),((q,),q ),((q,),q ),((q,),q )} s = q F = {q } -4: Fun with DFA Crete DFA for: All strings over{, } tht contin the sustring -5: Fun with DFA Crete DFA for: All strings over{, } tht contin the sustring, 4-6: Fun with DFA Crete DFA for: All strings over{, } tht end with -7: Fun with DFA Crete DFA for: All strings over{, } tht end with
CS4 45- Determinisitic Finite Automt 5-8: Fun with DFA Crete DFA for: All strings over{, } tht egin with -9: Fun with DFA Crete DFA for: All strings over{, } tht egin with, 4, -: Fun with DFA Crete DFA for: All strings over{, } tht egin or end with -: Fun with DFA Crete DFA for: All strings over{, } tht egin or end with
CS4 45- Determinisitic Finite Automt 6, 4 5 6 7 -: Fun with DFA Crete DFA for: All strings over{, } tht egin nd end with -: Fun with DFA Crete DFA for: All strings over{, } tht egin nd end with, 8 4 5 6 7-4: Fun with DFA Crete DFA for: All strings over{, } tht contin or -5: Fun with DFA Crete DFA for: All strings over{, } tht contin or
CS4 45- Determinisitic Finite Automt 7 4 5 6 7, -6: Fun with DFA Crete DFA for: All strings over{, } tht egin nd end with the sme letter -7: Fun with DFA Crete DFA for: All strings over{, } tht egin nd end with the sme letter -8: Why DFA? Why re these mchines clled Deterministic Finite Automt Deterministic Ech trnsition is completely determined y the current stte nd next input symol. Tht is, for ech stte / symol pir, there is exctly one stte tht is trnsitioned to Finite Every DFA hs finite numer of sttes Automt (singulr utomton) mens mchine (From Merrim-Wester Online Dictionry, definition: A mchine or control mechnism designed to follow utomticlly predetermined sequence of opertions or respond to encoded instructions) -9: DFA Configurtion & M Wy to descrie the computtion of DFA Configurtion: Wht stte the DFA is currently in, nd wht string is left to process
CS4 45- Determinisitic Finite Automt 8 K Σ (q,) Mchine is in stte q, hs left to process (q 8,) Mchine is in stte q 8, hs left to process (q 4,ǫ) Mchine is in stte q 4 t the end of the computtion (ccept iffq 4 F ) -: DFA Configurtion & M Wy to descrie the computtion of DFA Configurtion: Wht stte the DFA is currently in, nd wht string is left to process K Σ Binry reltion M : Wht mchinem yields in one step M (K Σ ) (K Σ ) M = {((q,w),(q,w)) : q,q K M,w Σ M, Σ M,((q,),q ) δ M } -: DFA Configurtion & M Given the following mchine M:,, ((q,),(q,)) M cn lso e written(q,) M (q,) -: DFA Configurtion & M (q,) M (q,) M (q,) M (q,) M (q,) M (q,ǫ) -: DFA Configurtion & M
CS4 45- Determinisitic Finite Automt 9 (q,) M (q,) M (q,) M (q,) M (q,) M (q,ǫ) -4: DFA Configurtion & M M is the reflexive, trnsitive closure of M Smllest superset of M tht is oth reflexive nd trnsitive yields in or more steps Mchine M ccepts string w if: (s M,w) M (f,ǫ) for somef F M -5: DFA & Lnguges Lnguge ccepted y mchine M = L[M] {w : (s M,w) M (f,ǫ) for somef F M} DFA Lnguges,L DFA Set of ll lnguges tht cn e defined y DFA L DFA = {L : M,L[M] = L} To think out: How doesl DFA relte to L REG