1 Module 21 Closure Properties for LFSA using NFA’s –From now on, when I say NFA, I mean any NFA...
-
date post
19-Dec-2015 -
Category
Documents
-
view
215 -
download
0
Transcript of 1 Module 21 Closure Properties for LFSA using NFA’s –From now on, when I say NFA, I mean any NFA...
![Page 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.](https://reader030.fdocuments.in/reader030/viewer/2022032800/56649d3b5503460f94a16419/html5/thumbnails/1.jpg)
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
![Page 2: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032800/56649d3b5503460f94a16419/html5/thumbnails/2.jpg)
2
LFSA closed under set union(again)
![Page 3: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032800/56649d3b5503460f94a16419/html5/thumbnails/3.jpg)
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
![Page 4: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032800/56649d3b5503460f94a16419/html5/thumbnails/4.jpg)
4
Visualization
L1 union L2
L1
L2
LFSA
M3
M1
M2
NFA’s
•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
![Page 5: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032800/56649d3b5503460f94a16419/html5/thumbnails/5.jpg)
5
Algorithm Specification
• Input– Two NFA’s M1 and M2
• Output– NFA M3 such that L(M3) = ?
NFA M1
NFA M2
NFA M3A
![Page 6: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032800/56649d3b5503460f94a16419/html5/thumbnails/6.jpg)
6
Use -transitionNFA M1
NFA M2
NFA M3A
a
M1
a,b a,b
a,b
M2
a
a,b a,b
a,b
M3
![Page 7: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032800/56649d3b5503460f94a16419/html5/thumbnails/7.jpg)
7
General Case *NFA M1
NFA M2
NFA M3A
M1
M2
M3
![Page 8: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032800/56649d3b5503460f94a16419/html5/thumbnails/8.jpg)
8
Construction *
• Input – NFA M1 = (Q1, , q1, , A1)
– NFA M2 = (Q2, , q2, , A2)
• Output– NFA M3 = (Q3, , q3, , A3)
– What is Q3?
• Q3 =
– What is 3?
• 3 = 1 = 2
– What is q3?
• q3 =
NFA M1
NFA M2
NFA M3A
![Page 9: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032800/56649d3b5503460f94a16419/html5/thumbnails/9.jpg)
9
Construction
• Input – NFA M1 = (Q1, , q1, , A1)
– NFA M2 = (Q2, , q2, , A2)
• Output– NFA M3 = (Q3, , q3, , A3)
– What is A3?
• A3 =
– What is 3?
• 3 =
NFA M1
NFA M2
NFA M3A
![Page 10: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032800/56649d3b5503460f94a16419/html5/thumbnails/10.jpg)
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
![Page 11: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032800/56649d3b5503460f94a16419/html5/thumbnails/11.jpg)
11
LFSA closed under set concatenation
![Page 12: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032800/56649d3b5503460f94a16419/html5/thumbnails/12.jpg)
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) = L1 concatenate L2
• There exists NFA M3 s.t. L(M3) = L1 concatenate L2
• L1 concatenate L2 is in LFSA
![Page 13: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032800/56649d3b5503460f94a16419/html5/thumbnails/13.jpg)
13
Visualization
L1 concatenate L2
L1
L2
LFSA
M3
M1
M2
NFA’s
• 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 concatenate L2
• There exists NFA M3 s.t. L(M3) = L1 concatenate L2
• L1 concatenate L2 is in LFSA
![Page 14: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032800/56649d3b5503460f94a16419/html5/thumbnails/14.jpg)
14
Algorithm Specification
• Input– Two NFA’s M1 and M2
• Output– NFA M3 such that L(M3) =
NFA M1
NFA M2
NFA M3A
![Page 15: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032800/56649d3b5503460f94a16419/html5/thumbnails/15.jpg)
15
Use -transitionNFA M1
NFA M2
NFA M3A
a
M1
a,b a,b
a,b
M2
a
a,b a,b
a,b
M3
![Page 16: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032800/56649d3b5503460f94a16419/html5/thumbnails/16.jpg)
16
General CaseNFA M1
NFA M2
NFA M3A
M1
M2
M3
![Page 17: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032800/56649d3b5503460f94a16419/html5/thumbnails/17.jpg)
17
Construction
• Input – NFA M1 = (Q1, , q1, , A1)
– NFA M2 = (Q2, , q2, , A2)
• Output– NFA M3 = (Q3, , q3, , A3)
– What is Q3?
• Q3 =
– What is 3?
• 3 = 1 = 2
– What is q3?
• q3 =
NFA M1
NFA M2
NFA M3A
![Page 18: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032800/56649d3b5503460f94a16419/html5/thumbnails/18.jpg)
18
Construction
• Input – NFA M1 = (Q1, , q1, , A1)
– NFA M2 = (Q2, , q2, , A2)
• Output– NFA M3 = (Q3, , q3, , A3)
– What is A3?
• A3 =
– What is 3?
• 3 =
NFA M1
NFA M2
NFA M3A
![Page 19: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032800/56649d3b5503460f94a16419/html5/thumbnails/19.jpg)
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
![Page 20: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032800/56649d3b5503460f94a16419/html5/thumbnails/20.jpg)
20
LFSA closed under Kleene Closure
![Page 21: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032800/56649d3b5503460f94a16419/html5/thumbnails/21.jpg)
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
![Page 22: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032800/56649d3b5503460f94a16419/html5/thumbnails/22.jpg)
22
Visualization
L1*
L1
LFSA
NFA’s
• 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
M1 M2
![Page 23: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032800/56649d3b5503460f94a16419/html5/thumbnails/23.jpg)
23
Algorithm Specification
• Input– NFA M1
• Output– NFA M2 such that L(M2) =
NFA M1 NFA M2A
![Page 24: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032800/56649d3b5503460f94a16419/html5/thumbnails/24.jpg)
24
Use -transition NFA M1 NFA M2A
a
M1a
M2
![Page 25: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032800/56649d3b5503460f94a16419/html5/thumbnails/25.jpg)
25
General Case * NFA M1 NFA M2A
M1
M2
![Page 26: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032800/56649d3b5503460f94a16419/html5/thumbnails/26.jpg)
26
Construction
• Input – NFA M1 = (Q1, , q1, , A1)
• Output– NFA M2 = (Q2, , q2, , A2)
– What is Q2?
• Q2 =
– What is 2?
• 2 = 1
– What is q2?
• q2 =
NFA M1 NFA M2A
![Page 27: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032800/56649d3b5503460f94a16419/html5/thumbnails/27.jpg)
27
Construction
• Input – NFA M1 = (Q1, , q1, , A1)
• Output– NFA M2 = (Q2, , q2, , A2)
– What is A2?
• A2 =
– What is 2?
• 2 =
NFA M1 NFA M2A
![Page 28: 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.](https://reader030.fdocuments.in/reader030/viewer/2022032800/56649d3b5503460f94a16419/html5/thumbnails/28.jpg)
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