1 / 28

Module 21

Module 21. Closure Properties for LFSA using NFA’s From now on, when I say NFA, I mean any NFA including an NFA- l unless I add a specific restriction union (second proof) concatenation Kleene closure. LFSA closed under set union (again). LFSA closed under set union.

teva
Download Presentation

Module 21

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. Module 21 • Closure Properties for LFSA using NFA’s • From now on, when I say NFA, I mean any NFA including an NFA-l unless I add a specific restriction • union (second proof) • concatenation • Kleene closure

  2. LFSA closed under set union(again)

  3. LFSA closed under set union • Let L1 and L2 be arbitrary languages in LFSA • Let M1 and M2 be NFA’s s.t. L(M1) = L1, L(M2) = L2 • M1 and M2 exist by definition of L1 and L2 in LFSA and the fact that every FSA is an NFA • Construct NFA M3 from NFA’s M1 and M2 • Argue L(M3) = L1 union L2 • There exists NFA M3 s.t. L(M3) = L1 union L2 • L1 union L2 is in LFSA

  4. L1 L1 union L2 L2 M1 M3 M2 NFA’s Visualization • Let L1 and L2 be arbitrary languages in LFSA • Let M1 and M2 be NFA’s s.t. L(M1) = L1, L(M2) = L2 • M1 and M2 exist by definition of L1 and L2 in LFSA and the fact that every FSA is an NFA • Construct NFA M3 from NFA’s M1 and M2 • Argue L(M3) = L1 union L2 • There exists NFA M3 s.t. L(M3) = L1 union L2 • L1 union L2 is in LFSA LFSA

  5. A Algorithm Specification • Input • Two NFA’s M1 and M2 • Output • NFA M3 such that L(M3) = ? NFA M1 NFA M2 NFA M3

  6. a l a,b l a,b a,b A M3 NFA M1 NFA M2 NFA M3 Use l-transition a M1 a,b a,b a,b M2

  7. M2 M1 l l A M3 NFA M1 NFA M2 NFA M3 General Case *

  8. Input NFA M1 = (Q1, S1, q1, d1, A1) NFA M2 = (Q2, S2, q2, d2, A2) Output NFA M3 = (Q3, S3, q3, d3, A3) What is Q3? Q3 = What is S3? S3 = S1 = S2 What is q3? q3 = A NFA M1 NFA M2 NFA M3 Construction *

  9. Input NFA M1 = (Q1, S1, q1, d1, A1) NFA M2 = (Q2, S2, q2, d2, A2) Output NFA M3 = (Q3, S3, q3, d3, A3) What is A3? A3 = What is d3? d3 = A NFA M1 NFA M2 NFA M3 Construction

  10. Comments • You should be able to execute this algorithm • You should understand the idea behind this algorithm • You should understand how this algorithm can be used to simplify design • You should be able to design new algorithms for new closure properties • You should understand how this helps prove result that regular languages and LFSA are identical • In particular, you should understand how this is used to construct an NFA M from a regular expression r s.t. L(M) = L(r) • To be seen later

  11. LFSA closed under set concatenation

  12. LFSA closed under set concatenation • Let L1 and L2 be arbitrary languages in LFSA • Let M1 and M2 be NFA’s s.t. L(M1) = L1, L(M2) = L2 • M1 and M2 exist by definition of L1 and L2 in LFSA and the fact that every FSA is an NFA • Construct NFA M3 from NFA’s M1 and M2 • Argue L(M3) = L1concatenate L2 • There exists NFA M3 s.t. L(M3) = L1 concatenate L2 • L1 concatenate L2 is in LFSA

  13. L1 L1 concatenate L2 L2 M1 M3 M2 NFA’s Visualization • Let L1 and L2 be arbitrary languages in LFSA • Let M1 and M2 be NFA’s s.t. L(M1) = L1, L(M2) = L2 • M1 and M2 exist by definition of L1 and L2 in LFSA and the fact that every FSA is an NFA • Construct NFA M3 from NFA’s M1 and M2 • Argue L(M3) = L1concatenate L2 • There exists NFA M3 s.t. L(M3) = L1 concatenate L2 • L1 concatenate L2 is in LFSA LFSA

  14. A Algorithm Specification • Input • Two NFA’s M1 and M2 • Output • NFA M3 such that L(M3) = NFA M1 NFA M2 NFA M3

  15. a l a,b a,b a,b A M3 NFA M1 NFA M2 NFA M3 Use l-transition a M1 a,b a,b a,b M2

  16. M2 M1 l l A M3 NFA M1 NFA M2 NFA M3 General Case

  17. Input NFA M1 = (Q1, S1, q1, d1, A1) NFA M2 = (Q2, S2, q2, d2, A2) Output NFA M3 = (Q3, S3, q3, d3, A3) What is Q3? Q3 = What is S3? S3 = S1 = S2 What is q3? q3 = A NFA M1 NFA M2 NFA M3 Construction

  18. Input NFA M1 = (Q1, S1, q1, d1, A1) NFA M2 = (Q2, S2, q2, d2, A2) Output NFA M3 = (Q3, S3, q3, d3, A3) What is A3? A3 = What is d3? d3 = A NFA M1 NFA M2 NFA M3 Construction

  19. Comments • You should be able to execute this algorithm • You should understand the idea behind this algorithm • You should understand how this algorithm can be used to simplify design • You should be able to design new algorithms for new closure properties • You should understand how this helps prove result that regular languages and LFSA are identical • In particular, you should understand how this is used to construct an NFA M from a regular expression r s.t. L(M) = L(r) • To be seen later

  20. LFSA closed under Kleene Closure

  21. LFSA closed under Kleene Closure • Let L be arbitrary language in LFSA • Let M1 be an NFA s.t. L(M1) = L • M1 exists by definition of L1 in LFSA and the fact that every FSA is an NFA • Construct NFA M2 from NFA M1 • Argue L(M2) = L1* • There exists NFA M2 s.t. L(M2) = L1* • L1* is in LFSA

  22. L1 L1* M1 M2 NFA’s Visualization • Let L be arbitrary language in LFSA • Let M1 be an NFA s.t. L(M1) = L • M1 exists by definition of L1 in LFSA and the fact that every FSA is an NFA • Construct NFA M2 from NFA M1 • Argue L(M2) = L1* • There exists NFA M2 s.t. L(M2) = L1* • L1* is in LFSA LFSA

  23. A Algorithm Specification • Input • NFA M1 • Output • NFA M2 such that L(M2) = NFA M1 NFA M2

  24. NFA M1 NFA M2 l a l M2 A Use l-transition a M1

  25. NFA M1 NFA M2 l M1 l A l M3 General Case *

  26. Input NFA M1 = (Q1, S1, q1, d1, A1) Output NFA M2 = (Q2, S2, q2, d2, A2) What is Q2? What is S2? S2 = S1 What is q2? q2 = NFA M1 NFA M2 A Construction

  27. Input NFA M1 = (Q1, S1, q1, d1, A1) Output NFA M2 = (Q2, S2, q2, d2, A2) What is A2? A2 = What is d2? d2 = NFA M1 NFA M2 A Construction

  28. Comments • You should be able to execute this algorithm • You should understand the idea behind this algorithm • Why do we need to make an extra state p? • You should understand how this algorithm can be used to simplify design • You should be able to design new algorithms for new closure properties • You should understand how this helps prove result that regular languages and LFSA are identical • In particular, you should understand how this is used to construct an NFA M from a regular expression r s.t. L(M) = L(r) • To be seen later

More Related