1 / 50

Single Final State for NFAs and DFAs

Single Final State for NFAs and DFAs . Observation. Any Finite Automaton (NFA or DFA) can be converted to an equivalent NFA with a single final state. Equivalent NFA. Example. NFA. Equivalent NFA. Single final state. In General. NFA. Add a final state Without transitions.

carson
Download Presentation

Single Final State for NFAs and DFAs

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. Single Final State for NFAs and DFAs

  2. Observation • Any Finite Automaton (NFA or DFA) • can be converted to an equivalent NFA • with a single final state

  3. Equivalent NFA Example NFA

  4. Equivalent NFA Single final state In General NFA

  5. Add a final state Without transitions Extreme Case NFA without final state

  6. Some Properties of Regular Languages

  7. Union: Concatenation: Are regular Languages Star: Properties For regular languages and we will prove that:

  8. Union: Concatenation: Star: We Say: Regular languages are closed under

  9. Regular language Regular language NFA NFA Single final state Single final state

  10. Example

  11. Union • NFA for

  12. Example NFA for

  13. Concatenation • NFA for

  14. Example • NFA for

  15. Star Operation • NFA for

  16. Example • NFA for

  17. Regular Expressions

  18. Regular Expressions • Regular expressions • describe regular languages • Example: • describes the language

  19. Given regular expressions and Are regular expressions Recursive Definition Primitive regular expressions:

  20. Not a regular expression: Examples A regular expression:

  21. Languages of Regular Expressions • : language of regular expression • Example

  22. Definition • For primitive regular expressions:

  23. Definition (continued) • For regular expressions and

  24. Example • Regular expression:

  25. Example • Regular expression

  26. Example • Regular expression

  27. = { all strings with at least two consecutive 0 } Example • Regular expression

  28. = { all strings without two consecutive 0 } Example • Regular expression

  29. Equivalent Regular Expressions • Definition: • Regular expressions and • are equivalent if

  30. and are equivalent regular expr. Example = { all strings with at least two consecutive 0 }

  31. Regular ExpressionsandRegular Languages

  32. Theorem Languages Generated by Regular Expressions Regular Languages

  33. 1. For any regular expression the language is regular Theorem - Part 1 Languages Generated by Regular Expressions Regular Languages

  34. 2. For any regular language there is a regular expression with Theorem - Part 2 Languages Generated by Regular Expressions Regular Languages

  35. 1. For any regular expression the language is regular Proof by induction on the size of Proof - Part 1

  36. NFAs regular languages Induction Basis • Primitive Regular Expressions:

  37. Inductive Hypothesis • Assume • for regular expressions and • that • and are regular languages

  38. Inductive Step • We will prove: Are regular Languages

  39. By definition of regular expressions:

  40. We also know: Regular languages are closed under union concatenation star By inductive hypothesis we know: and are regular languages

  41. Therefore: Are regular languages

  42. And trivially: is a regular language

  43. Proof – Part 2 2. For any regular language there is a regular expression with Proof by construction of regular expression

  44. Since is regular take the • NFA that accepts it Single final state

  45. From construct the equivalent • Generalized Transition Graph • transition labels • are regular expressions Example:

  46. Another Example:

  47. Reducing the states:

  48. Resulting Regular Expression:

  49. In General • Removing states:

  50. Obtaining the final regular expression:

More Related