1 / 25

Finite State Automata

Finite State Automata. Formal Specification of Languages. Generators Context-free Grammars Regular Expressions Recognizers Parsers, Push-down Automata Finite State Automata FSA is a mechanism to recognize a set of valid inputs before carrying out an action.

Antony
Download Presentation

Finite State Automata

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Finite State Automata L9FSA

  2. Formal Specification of Languages • Generators • Context-free Grammars • Regular Expressions • Recognizers • Parsers, Push-down Automata • Finite State Automata • FSA is a mechanism to recognize a set of valid inputs before carrying out an action. • FSA is a notation for describing a family of language recognition algorithms. L9FSA

  3. Parity Problem 1 0 EP 0 OP 1 L9FSA

  4. Basic Features • Consumes the entire input string. • Remembers the parity of the bit string by abstracting from the number of 1s in the string. • Finite amount of memory required for this purpose. • Observe that counting requires unbounded memory, while computing the parity requires very small and fixed amount of memory. • Accepts/Rejects the input in a deterministic fashion. L9FSA

  5. State • Indicates the status of the machine after consuming some portion of the input. • Summarizes the history of the computation that is relevant to the future course of action. • Initial / Start State • Final / Accepting state • State Transition 0 1 Even Parity Odd Parity L9FSA

  6. Deterministic Finite State Automaton (DFA) Q: Finite set of states S: Finite Alphabet d: Transition function total function from QxS to Q : Initial/Start State F : Set of final/accepting state L9FSA

  7. Operation of the machine 0 0 1 Input Tape • Read the current letter of input under the tape head. • Transit to a new state depending on the current input and the current state, as dictated by the transition function. • Halt after consuming the entire input. Finite Control L9FSA

  8. Associating Language with the DFA • Machine configuration: • Yields relation: • Language: L9FSA

  9. Examples L9FSA

  10. Set of strings over {a,b} that contain bb • Design states by parititioning S*. • Strings containing bb q2 • Strings not containing bb • Strings that end in b q1 • Strings that do not end in b q0 • Initial state: q0 • Final state: q2 L9FSA

  11. State Diagram and Table a a b q0 q1 q2 b a b L9FSA

  12. Strings over {a,b} that do not contain bb a a b q0 q1 q2 b a b L9FSA

  13. DFA for the complement of L given DFA for L Let M = (Q,S,d,q0,F) be a DFA. Then, M’ = (Q,S,d,q0,Q-F) is a DFA with L(M’) = S* - L(M). Implication: Languages associated with DFAs are closed under complementation. (Recall that languages associated with regular expressions are closed under union, concatenation, and Kleene Star operations, by definition.) L9FSA

  14. Strings over {a,b} containing even number of a’s and odd number of b’s. S* Ea Oa Eb Ob Eb Ob b [Ea,Eb] [Ea,Ob] b a a a a b [Oa,Ob] [Oa,Eb] b L9FSA

  15. (ab)*c S* valid prefix invalid prefix end_a end_b end_c a a Ea Eb b c a,c l b c Ec Err a,b,c a,b,c b L9FSA

  16. (ab)*c S* valid prefix invalid prefix end_a end_b end_c a Ea Eb b c a,c b Ec Err a,b,c a,b,c L9FSA

  17. Nondeterministic Finite Automata a a qi qi qj qj a DFA a qk q NFA L9FSA

  18. How do we associate a language with an NFA? • Every DFA is an NFA. However, does non-determinism make NFAs strictly more expressive (powerful) than DFAs? DFA: Unique computation for a given string NFA: Accept if there exists an accepting computation L9FSA

  19. NFA State Diagram (Strings over {a,b} ending in bb) b a q0 q1 q2 b b L9FSA

  20. Halts in non-accepting state after consuming the input. Halts in accepting state after consuming the input. L9FSA

  21. a b b a q0 q1 q2 b b NFA State Diagram (a Ub)*bb (a Ub)* DFA a b a q0 q1 q2 b b a L9FSA

  22. a b b a q0 q1 q2 a a NFA for (a Ub)*(aaUbb)(a Ub)* a b q11 q22 b b L9FSA

  23. Introducing l-transitions into NFA • A l-transition causes the machine to change its state non-deterministically, without consuming any input. L9FSA

  24. Closure Properties of NFA-ls l l M1 l l M M2 l l L(M)* L(M1) UL(M2) l l l M1 M2 L(M1) L(M2) L9FSA

  25. a1 a2 a3 a3 b3 b1 b2 b3 a … a a a a0 an b b b b … b b b bn This construction cannot be generalized to recognize because the machine will have infinite number of states. L9FSA

More Related