Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Module 21 Closure Properties for LFSA using NFA’s –From now on, when I say NFA, I mean any NFA including an NFA- unless I add a specific restriction.

Similar presentations


Presentation on theme: "1 Module 21 Closure Properties for LFSA using NFA’s –From now on, when I say NFA, I mean any NFA including an NFA- unless I add a specific restriction."— Presentation transcript:

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

2 2 LFSA closed under set union (again)

3 3 LFSA closed under set union Let L 1 and L 2 be arbitrary languages in LFSA Let M 1 and M 2 be NFA’s s.t. L(M 1 ) = L 1, L(M 2 ) = L 2 –M 1 and M 2 exist by definition of L 1 and L 2 in LFSA and the fact that every FSA is an NFA Construct NFA M 3 from NFA’s M 1 and M 2 Argue L(M 3 ) = L 1 union L 2 There exists NFA M 3 s.t. L(M 3 ) = L 1 union L 2 L 1 union L 2 is in LFSA

4 4 Visualization L 1 union L 2 L1L1 L2L2 LFSA M3M3 M1M1 M2M2 NFA’s Let L 1 and L 2 be arbitrary languages in LFSA Let M 1 and M 2 be NFA’s s.t. L(M 1 ) = L 1, L(M 2 ) = L 2 M 1 and M 2 exist by definition of L 1 and L 2 in LFSA and the fact that every FSA is an NFA Construct NFA M 3 from NFA’s M 1 and M 2 Argue L(M 3 ) = L 1 union L 2 There exists NFA M 3 s.t. L(M 3 ) = L 1 union L 2 L 1 union L 2 is in LFSA

5 5 Algorithm Specification Input –Two NFA’s M 1 and M 2 Output –NFA M 3 such that L(M 3 ) = ? NFA M 1 NFA M 2 NFA M 3 A

6 6 Use -transition NFA M 1 NFA M 2 NFA M 3 A a M1M1 a,b M2M2 a M3M3

7 7 General Case * NFA M 1 NFA M 2 NFA M 3 A M1M1 M2M2 M3M3

8 8 Construction * Input –NFA M 1 = (Q 1,  , q 1,  , A 1 ) –NFA M 2 = (Q 2,  , q 2,  , A 2 ) Output –NFA M 3 = (Q 3,  , q 3,  , A 3 ) –What is Q 3 ? Q 3 = –What is  3 ?  3 =  1 =  2 –What is q 3 ? q 3 = NFA M 1 NFA M 2 NFA M 3 A

9 9 Construction Input –NFA M 1 = (Q 1,  , q 1,  , A 1 ) –NFA M 2 = (Q 2,  , q 2,  , A 2 ) Output –NFA M 3 = (Q 3,  , q 3,  , A 3 ) –What is A 3 ? A 3 = –What is  3 ?  3 = NFA M 1 NFA M 2 NFA M 3 A

10 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 11 LFSA closed under set concatenation

12 12 LFSA closed under set concatenation Let L 1 and L 2 be arbitrary languages in LFSA Let M 1 and M 2 be NFA’s s.t. L(M 1 ) = L 1, L(M 2 ) = L 2 –M 1 and M 2 exist by definition of L 1 and L 2 in LFSA and the fact that every FSA is an NFA Construct NFA M 3 from NFA’s M 1 and M 2 Argue L(M 3 ) = L 1 concatenate L 2 There exists NFA M 3 s.t. L(M 3 ) = L 1 concatenate L 2 L 1 concatenate L 2 is in LFSA

13 13 Visualization L 1 concatenate L 2 L1L1 L2L2 LFSA M3M3 M1M1 M2M2 NFA’s Let L 1 and L 2 be arbitrary languages in LFSA Let M 1 and M 2 be NFA’s s.t. L(M 1 ) = L 1, L(M 2 ) = L 2 –M 1 and M 2 exist by definition of L 1 and L 2 in LFSA and the fact that every FSA is an NFA Construct NFA M 3 from NFA’s M 1 and M 2 Argue L(M 3 ) = L 1 concatenate L 2 There exists NFA M 3 s.t. L(M 3 ) = L 1 concatenate L 2 L 1 concatenate L 2 is in LFSA

14 14 Algorithm Specification Input –Two NFA’s M 1 and M 2 Output –NFA M 3 such that L(M 3 ) = NFA M 1 NFA M 2 NFA M 3 A

15 15 Use -transition NFA M 1 NFA M 2 NFA M 3 A a M1M1 a,b M2M2 a M3M3

16 16 General Case NFA M 1 NFA M 2 NFA M 3 A M1M1 M2M2 M3M3

17 17 Construction Input –NFA M 1 = (Q 1,  , q 1,  , A 1 ) –NFA M 2 = (Q 2,  , q 2,  , A 2 ) Output –NFA M 3 = (Q 3,  , q 3,  , A 3 ) –What is Q 3 ? Q 3 = –What is  3 ?  3 =  1 =  2 –What is q 3 ? q 3 = NFA M 1 NFA M 2 NFA M 3 A

18 18 Construction Input –NFA M 1 = (Q 1,  , q 1,  , A 1 ) –NFA M 2 = (Q 2,  , q 2,  , A 2 ) Output –NFA M 3 = (Q 3,  , q 3,  , A 3 ) –What is A 3 ? A 3 = –What is  3 ?  3 = NFA M 1 NFA M 2 NFA M 3 A

19 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 20 LFSA closed under Kleene Closure

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

22 22 Visualization L1*L1* L1L1 LFSA NFA’s Let L be arbitrary language in LFSA Let M 1 be an NFA s.t. L(M 1 ) = L –M 1 exists by definition of L 1 in LFSA and the fact that every FSA is an NFA Construct NFA M 2 from NFA M 1 Argue L(M 2 ) = L 1 * There exists NFA M 2 s.t. L(M 2 ) = L 1 * L 1 * is in LFSA M1M1 M2M2

23 23 Algorithm Specification Input –NFA M 1 Output –NFA M 2 such that L(M 2 ) = NFA M 1 NFA M 2 A

24 24 Use -transition NFA M 1 NFA M 2 A a M1M1 a M2M2

25 25 General Case * NFA M 1 NFA M 2 A M1M1 M2M2

26 26 Construction Input –NFA M 1 = (Q 1,  , q 1,  , A 1 ) Output –NFA M 2 = (Q 2,  , q 2,  , A 2 ) –What is Q 2 ? Q 2 = –What is  2 ?  2 =  1 –What is q 2 ? q 2 = NFA M 1 NFA M 2 A

27 27 Construction Input –NFA M 1 = (Q 1,  , q 1,  , A 1 ) Output –NFA M 2 = (Q 2,  , q 2,  , A 2 ) –What is A 2 ? A 2 = –What is  2 ?  2 = NFA M 1 NFA M 2 A

28 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


Download ppt "1 Module 21 Closure Properties for LFSA using NFA’s –From now on, when I say NFA, I mean any NFA including an NFA- unless I add a specific restriction."

Similar presentations


Ads by Google