SlideShare a Scribd company logo
© 2020 Wael Badawy
1
Properties of Regular Languages
1
DISCLAIMER:
This video is optimized for HD large display using
patented and patent-pending “Nile Codec”, the first
Egyptian Video Codec for more information,
PLEASE check https://NileCodec.com
Also available as a PodCast
© 2020 Wael Badawy
Copyright © 2020 Wael Badawy. All rights reserved
n This video is subject to copyright owned by Wael Badawy “WB”. Any
reproduction or republication of all or part of this video is expressly prohibited
unless WB has explicitly granted its prior written consent. All other rights
reserved.
n This video is intended for education and information only and is offered AS IS,
without any warranty of the accuracy or the quality of the content. Any other
use is strictly prohibited. The viewer is fully responsible to verify the accuracy
of the contents received without any claims of costs or liability arising .
n The names, trademarks service marked as logos of WB or the sponsors
appearing in this video may not be used in any any product or service,
without prior express written permission from WB and the video sponsors
n Neither WB nor any party involved in creating, producing or delivering
information and material via this video shall be liable for any direction,
incidental, consequential, indirect of punitive damages arising out of access
to, use or inability to use this content or any errors or omissions in the
content thereof.
n If you will continue to watch this video, you agree to the terms above and
other terms that may be available on http://nu.edu.eg & https://caiwave.net
2
© 2020 Wael Badawy
© 2020 Wael Badawy
4
1L 2L
21LLConcatenation:
*
1LStar:
21 LL ÈUnion:
Are regular
Languages
For regular languages and
we will prove that:
1L
21 LL Ç
Complement:
Intersection:
R
L1
Reversal:
© 2020 Wael Badawy
5
We say Regular languages are closed under
21LLConcatenation:
Star:
21 LL ÈUnion:
1L
21 LL Ç
Complement:
Intersection:
Reversal:
*
1L
R
L1
© 2020 Wael Badawy
6
a
b
b
a
NFA
Equivalent
NFA
e
e
a
b
b
a
A useful transformation: use one accept state
2 accept states
1 accept state
© 2020 Wael Badawy
7
NFA
Equivalent NFA
Single
accepting
state
e
e
e
In General
© 2020 Wael Badawy
8
NFA without accepting state
Add an accepting state
without transitions
Extreme case
© 2020 Wael Badawy
9
1LRegular language
( ) 11 LML =
1M
Single accepting state
NFA 2M
2L
Single accepting state
( ) 22 LML =
Regular language
NFA
Take two languages
© 2020 Wael Badawy
10
}{1 baL n
=
a
b
1M
{ }baL =2
ab
2M
0³n
Example
© 2020 Wael Badawy
Union
NFA for
11
1M
2M
21 LL È
e
21 LLw ÈÎ 21 or LwLw ÎÎ
e
© 2020 Wael Badawy
12
a
b
ab
}{1 baL n
=
}{2 baL =
}{}{21 babaLL n
È=ÈNFA for
Example
e
e
© 2020 Wael Badawy
Concatenation
13
21LL
1M 2M
e
21LLwÎ
NFA for
221121 and: LwLwwww ÎÎ=
change to
regular state
© 2020 Wael Badawy
NFA for
14
a
b ab
}{1 baL n
=
}{2 baL =
}{}}{{21 bbaababaLL nn
==
e
Example
© 2020 Wael Badawy
Star Operation
15
*
L
Lwwwww ik Î= :21 !
LML =)(
e
e
NFA for
*
LwÎ
or e=w
M
change to
regular state
© 2020 Wael Badawy
16
**
1 }{ baL n
=
a
b
}{1 baL n
=
e
e
Example
NFA for
© 2020 Wael Badawy
Reverse
17
R
L
M
NFA for
M¢
1. Reverse all transitions
2. Make the initial state accept state
and the accept state initial state
LML =)( R
LML =¢)(
© 2020 Wael Badawy
18
}{1 baL n
=
a
b
1M
}{1
nR
baL =
a
b
1M¢
Example
© 2020 Wael Badawy
19
Complement
1. Take the DFA that accepts L
M
LML =)(
M¢
LML =¢)(
2. Make accept states regular
and vice-versa
© 2020 Wael Badawy
20
}{1 baL n
=
a
b
1M
ba,
ba,
}{},{ *
1 babaL n
-=
a
b
1M¢
ba,
ba,
Example
© 2020 Wael Badawy
21
NFAs cannot be used for complement
Make accept states regular
and vice-versa
{})( =ML
M M¢
)(}{)( MLML ¹=¢ e
**
},{)( baML =S=
NFA NFA
it is not the
complement
© 2020 Wael Badawy
22
Same example with DFAs
Make accept states regular
and vice-versa
{})( =ML
M M¢
)(},{)( *
MLbaML ==¢
**
},{)( baML =S=
DFA DFA
ba, ba,
it is the
complement
© 2020 Wael Badawy
Intersection
23
1L regular
2L regular
we show 21 LL Ç
regular
© 2020 Wael Badawy
24
DeMorgan’s Law: 2121 LLLL È=Ç
21 , LL regular, regular
21 , LL regular, regular
21 LL È regular
21 LL È regular
21 LL Ç regular
© 2020 Wael Badawy
25
Example
}{1 baL n
=
},{2 baabL =
regular
regular
}{21 abLL =Ç
regular
© 2020 Wael Badawy
26
1Lfor for 2LDFA
1M
DFA
2M
Construct a new DFA that accepts
Machine Machine
M 21 LL Ç
M simulates in parallel and1M 2M
Another Proof for Intersection Closure
© 2020 Wael Badawy
27
States in M
ji pq ,
1M 2MState in State in
© 2020 Wael Badawy
28
1M 2M
1q 2qa
transition
1p 2pa
transition
DFA DFA
11, pq a
New transition
MDFA
22, pq
© 2020 Wael Badawy
29
0q
initial state
0p
initial state
New initial state
00, pq
1M 2MDFA DFA
MDFA
© 2020 Wael Badawy
30
iq
accept state
jp
accept states
New accept states
ji pq ,
kp
ki pq ,
1M 2MDFA DFA
MDFA
Both constituents must be accepting states
© 2020 Wael Badawy
31
Example:
}{1 baL n
=
a
b
1M
0³n
}{2
m
abL =
b
b
2M
0q 1q 0p 1p
0³m
2q 2p
a
a
ba, ba,
ba,
© 2020 Wael Badawy
32
00, pq
DFA for intersection
}{}{}{)( ababbaML mn
=Ç=
10, pqa
21, pq
b
ab 11, pq
20, pq
a
12, pq
22, pq
b
ba,
a
b
ba,
b
a
M
© 2020 Wael Badawy
33
Construction procedure for intersection
1. Build Initial State
2. For each new state and for each symbol
add transition to either an existing state
or create a new state and point to it
3. Repeat step 2 until no new states
are added
4. Designate accept states
© 2020 Wael Badawy
34
00, pq
Automaton for intersection
}{}{}{ ababbaL mn
=Ç=
initial state
© 2020 Wael Badawy
35
00, pq
Automaton for intersection
}{}{}{ ababbaL mn
=Ç=
10, pqa
add transition and new state
for symbol a 1M 2M
0q 0qa
0p 1pa
00, pq a
M
10 , pq
© 2020 Wael Badawy
36
00, pq
Automaton for intersection
}{}{}{ ababbaL mn
=Ç=
10, pqa
21, pq
b
add transition and new state
for symbol b
1M 2M
0q 1qb 0p 2p
00, pq b
M
21, pq
b
© 2020 Wael Badawy
37
Automaton for intersection
}{}{}{ ababbaL mn
=Ç=
00, pq 10, pqa
21, pq
b
ab 11, pq
20, pq
a
12, pq
22, pq
b
ba,
a
b
ba,
b
a
Repeat until no new states can be added
© 2020 Wael Badawy
38
Automaton for intersection
}{}{}{ ababbaL mn
=Ç=
add Accept state
00, pq 10, pqa
21, pq
b
ab 11, pq
20, pq
a
12, pq
22, pq
b
ba,
a
b
ba,
b
a
accept state for
accept state for
1q 1M
1p 2M
© 2020 Wael Badawy
39
simulates in parallel and1M 2M
accepts string w if and only if:
accepts string w1M
and accepts string w2M
)()()( 21 MLMLML Ç=
Intersection DFA :M

More Related Content

More from Wael Badawy

HTML introduction
HTML introduction HTML introduction
HTML introduction Wael Badawy
 
Np complete reductions
Np complete reductionsNp complete reductions
Np complete reductionsWael Badawy
 
Computer Vision Cameras
Computer Vision CamerasComputer Vision Cameras
Computer Vision CamerasWael Badawy
 
Computer Vision Gans
Computer Vision GansComputer Vision Gans
Computer Vision GansWael Badawy
 
Computer Vision image classification
Computer Vision image classificationComputer Vision image classification
Computer Vision image classificationWael Badawy
 
Computer Vision Structure from motion
Computer Vision Structure from motionComputer Vision Structure from motion
Computer Vision Structure from motionWael Badawy
 
Universal turing
Universal turing Universal turing
Universal turing Wael Badawy
 
Turing variations
Turing variations Turing variations
Turing variations Wael Badawy
 
Regular pumping
Regular pumping Regular pumping
Regular pumping Wael Badawy
 
Pushdown Automota
Pushdown Automota Pushdown Automota
Pushdown Automota Wael Badawy
 
Computer Vision sfm
Computer Vision sfmComputer Vision sfm
Computer Vision sfmWael Badawy
 
Computer vision - photometric
Computer vision - photometricComputer vision - photometric
Computer vision - photometricWael Badawy
 
Computer vision - light
Computer vision - lightComputer vision - light
Computer vision - lightWael Badawy
 
Computer vision - two view geometry
Computer vision -  two view geometryComputer vision -  two view geometry
Computer vision - two view geometryWael Badawy
 
Computer Vision - Stereo Vision
Computer Vision - Stereo VisionComputer Vision - Stereo Vision
Computer Vision - Stereo VisionWael Badawy
 
Computer Vision - Single View
Computer Vision - Single ViewComputer Vision - Single View
Computer Vision - Single ViewWael Badawy
 
Computer Vision single view Modelling
Computer Vision single view ModellingComputer Vision single view Modelling
Computer Vision single view ModellingWael Badawy
 
Computer Vision panoramas
Computer Vision  panoramasComputer Vision  panoramas
Computer Vision panoramasWael Badawy
 

More from Wael Badawy (20)

HTML introduction
HTML introduction HTML introduction
HTML introduction
 
Np complete reductions
Np complete reductionsNp complete reductions
Np complete reductions
 
Parsers -
Parsers -Parsers -
Parsers -
 
Computer Vision Cameras
Computer Vision CamerasComputer Vision Cameras
Computer Vision Cameras
 
Computer Vision Gans
Computer Vision GansComputer Vision Gans
Computer Vision Gans
 
Computer Vision image classification
Computer Vision image classificationComputer Vision image classification
Computer Vision image classification
 
Computer Vision Structure from motion
Computer Vision Structure from motionComputer Vision Structure from motion
Computer Vision Structure from motion
 
Universal turing
Universal turing Universal turing
Universal turing
 
Turing Machine
Turing MachineTuring Machine
Turing Machine
 
Turing variations
Turing variations Turing variations
Turing variations
 
Regular pumping
Regular pumping Regular pumping
Regular pumping
 
Pushdown Automota
Pushdown Automota Pushdown Automota
Pushdown Automota
 
Computer Vision sfm
Computer Vision sfmComputer Vision sfm
Computer Vision sfm
 
Computer vision - photometric
Computer vision - photometricComputer vision - photometric
Computer vision - photometric
 
Computer vision - light
Computer vision - lightComputer vision - light
Computer vision - light
 
Computer vision - two view geometry
Computer vision -  two view geometryComputer vision -  two view geometry
Computer vision - two view geometry
 
Computer Vision - Stereo Vision
Computer Vision - Stereo VisionComputer Vision - Stereo Vision
Computer Vision - Stereo Vision
 
Computer Vision - Single View
Computer Vision - Single ViewComputer Vision - Single View
Computer Vision - Single View
 
Computer Vision single view Modelling
Computer Vision single view ModellingComputer Vision single view Modelling
Computer Vision single view Modelling
 
Computer Vision panoramas
Computer Vision  panoramasComputer Vision  panoramas
Computer Vision panoramas
 

Recently uploaded

Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismDeeptiGupta154
 
Extraction Of Natural Dye From Beetroot (Beta Vulgaris) And Preparation Of He...
Extraction Of Natural Dye From Beetroot (Beta Vulgaris) And Preparation Of He...Extraction Of Natural Dye From Beetroot (Beta Vulgaris) And Preparation Of He...
Extraction Of Natural Dye From Beetroot (Beta Vulgaris) And Preparation Of He...SachinKumar945617
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleCeline George
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chipsGeoBlogs
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXMIRIAMSALINAS13
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...Nguyen Thanh Tu Collection
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxbennyroshan06
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...AzmatAli747758
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxPavel ( NSTU)
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationDelapenabediema
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...Jisc
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasiemaillard
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasiemaillard
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersPedroFerreira53928
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePedroFerreira53928
 
plant breeding methods in asexually or clonally propagated crops
plant breeding methods in asexually or clonally propagated cropsplant breeding methods in asexually or clonally propagated crops
plant breeding methods in asexually or clonally propagated cropsparmarsneha2
 
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.pptBasic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.pptSourabh Kumar
 

Recently uploaded (20)

Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Extraction Of Natural Dye From Beetroot (Beta Vulgaris) And Preparation Of He...
Extraction Of Natural Dye From Beetroot (Beta Vulgaris) And Preparation Of He...Extraction Of Natural Dye From Beetroot (Beta Vulgaris) And Preparation Of He...
Extraction Of Natural Dye From Beetroot (Beta Vulgaris) And Preparation Of He...
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
plant breeding methods in asexually or clonally propagated crops
plant breeding methods in asexually or clonally propagated cropsplant breeding methods in asexually or clonally propagated crops
plant breeding methods in asexually or clonally propagated crops
 
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.pptBasic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
 

Regular properties

  • 1. © 2020 Wael Badawy 1 Properties of Regular Languages 1 DISCLAIMER: This video is optimized for HD large display using patented and patent-pending “Nile Codec”, the first Egyptian Video Codec for more information, PLEASE check https://NileCodec.com Also available as a PodCast
  • 2. © 2020 Wael Badawy Copyright © 2020 Wael Badawy. All rights reserved n This video is subject to copyright owned by Wael Badawy “WB”. Any reproduction or republication of all or part of this video is expressly prohibited unless WB has explicitly granted its prior written consent. All other rights reserved. n This video is intended for education and information only and is offered AS IS, without any warranty of the accuracy or the quality of the content. Any other use is strictly prohibited. The viewer is fully responsible to verify the accuracy of the contents received without any claims of costs or liability arising . n The names, trademarks service marked as logos of WB or the sponsors appearing in this video may not be used in any any product or service, without prior express written permission from WB and the video sponsors n Neither WB nor any party involved in creating, producing or delivering information and material via this video shall be liable for any direction, incidental, consequential, indirect of punitive damages arising out of access to, use or inability to use this content or any errors or omissions in the content thereof. n If you will continue to watch this video, you agree to the terms above and other terms that may be available on http://nu.edu.eg & https://caiwave.net 2
  • 3. © 2020 Wael Badawy
  • 4. © 2020 Wael Badawy 4 1L 2L 21LLConcatenation: * 1LStar: 21 LL ÈUnion: Are regular Languages For regular languages and we will prove that: 1L 21 LL Ç Complement: Intersection: R L1 Reversal:
  • 5. © 2020 Wael Badawy 5 We say Regular languages are closed under 21LLConcatenation: Star: 21 LL ÈUnion: 1L 21 LL Ç Complement: Intersection: Reversal: * 1L R L1
  • 6. © 2020 Wael Badawy 6 a b b a NFA Equivalent NFA e e a b b a A useful transformation: use one accept state 2 accept states 1 accept state
  • 7. © 2020 Wael Badawy 7 NFA Equivalent NFA Single accepting state e e e In General
  • 8. © 2020 Wael Badawy 8 NFA without accepting state Add an accepting state without transitions Extreme case
  • 9. © 2020 Wael Badawy 9 1LRegular language ( ) 11 LML = 1M Single accepting state NFA 2M 2L Single accepting state ( ) 22 LML = Regular language NFA Take two languages
  • 10. © 2020 Wael Badawy 10 }{1 baL n = a b 1M { }baL =2 ab 2M 0³n Example
  • 11. © 2020 Wael Badawy Union NFA for 11 1M 2M 21 LL È e 21 LLw ÈÎ 21 or LwLw ÎÎ e
  • 12. © 2020 Wael Badawy 12 a b ab }{1 baL n = }{2 baL = }{}{21 babaLL n È=ÈNFA for Example e e
  • 13. © 2020 Wael Badawy Concatenation 13 21LL 1M 2M e 21LLwÎ NFA for 221121 and: LwLwwww ÎÎ= change to regular state
  • 14. © 2020 Wael Badawy NFA for 14 a b ab }{1 baL n = }{2 baL = }{}}{{21 bbaababaLL nn == e Example
  • 15. © 2020 Wael Badawy Star Operation 15 * L Lwwwww ik Î= :21 ! LML =)( e e NFA for * LwÎ or e=w M change to regular state
  • 16. © 2020 Wael Badawy 16 ** 1 }{ baL n = a b }{1 baL n = e e Example NFA for
  • 17. © 2020 Wael Badawy Reverse 17 R L M NFA for M¢ 1. Reverse all transitions 2. Make the initial state accept state and the accept state initial state LML =)( R LML =¢)(
  • 18. © 2020 Wael Badawy 18 }{1 baL n = a b 1M }{1 nR baL = a b 1M¢ Example
  • 19. © 2020 Wael Badawy 19 Complement 1. Take the DFA that accepts L M LML =)( M¢ LML =¢)( 2. Make accept states regular and vice-versa
  • 20. © 2020 Wael Badawy 20 }{1 baL n = a b 1M ba, ba, }{},{ * 1 babaL n -= a b 1M¢ ba, ba, Example
  • 21. © 2020 Wael Badawy 21 NFAs cannot be used for complement Make accept states regular and vice-versa {})( =ML M M¢ )(}{)( MLML ¹=¢ e ** },{)( baML =S= NFA NFA it is not the complement
  • 22. © 2020 Wael Badawy 22 Same example with DFAs Make accept states regular and vice-versa {})( =ML M M¢ )(},{)( * MLbaML ==¢ ** },{)( baML =S= DFA DFA ba, ba, it is the complement
  • 23. © 2020 Wael Badawy Intersection 23 1L regular 2L regular we show 21 LL Ç regular
  • 24. © 2020 Wael Badawy 24 DeMorgan’s Law: 2121 LLLL È=Ç 21 , LL regular, regular 21 , LL regular, regular 21 LL È regular 21 LL È regular 21 LL Ç regular
  • 25. © 2020 Wael Badawy 25 Example }{1 baL n = },{2 baabL = regular regular }{21 abLL =Ç regular
  • 26. © 2020 Wael Badawy 26 1Lfor for 2LDFA 1M DFA 2M Construct a new DFA that accepts Machine Machine M 21 LL Ç M simulates in parallel and1M 2M Another Proof for Intersection Closure
  • 27. © 2020 Wael Badawy 27 States in M ji pq , 1M 2MState in State in
  • 28. © 2020 Wael Badawy 28 1M 2M 1q 2qa transition 1p 2pa transition DFA DFA 11, pq a New transition MDFA 22, pq
  • 29. © 2020 Wael Badawy 29 0q initial state 0p initial state New initial state 00, pq 1M 2MDFA DFA MDFA
  • 30. © 2020 Wael Badawy 30 iq accept state jp accept states New accept states ji pq , kp ki pq , 1M 2MDFA DFA MDFA Both constituents must be accepting states
  • 31. © 2020 Wael Badawy 31 Example: }{1 baL n = a b 1M 0³n }{2 m abL = b b 2M 0q 1q 0p 1p 0³m 2q 2p a a ba, ba, ba,
  • 32. © 2020 Wael Badawy 32 00, pq DFA for intersection }{}{}{)( ababbaML mn =Ç= 10, pqa 21, pq b ab 11, pq 20, pq a 12, pq 22, pq b ba, a b ba, b a M
  • 33. © 2020 Wael Badawy 33 Construction procedure for intersection 1. Build Initial State 2. For each new state and for each symbol add transition to either an existing state or create a new state and point to it 3. Repeat step 2 until no new states are added 4. Designate accept states
  • 34. © 2020 Wael Badawy 34 00, pq Automaton for intersection }{}{}{ ababbaL mn =Ç= initial state
  • 35. © 2020 Wael Badawy 35 00, pq Automaton for intersection }{}{}{ ababbaL mn =Ç= 10, pqa add transition and new state for symbol a 1M 2M 0q 0qa 0p 1pa 00, pq a M 10 , pq
  • 36. © 2020 Wael Badawy 36 00, pq Automaton for intersection }{}{}{ ababbaL mn =Ç= 10, pqa 21, pq b add transition and new state for symbol b 1M 2M 0q 1qb 0p 2p 00, pq b M 21, pq b
  • 37. © 2020 Wael Badawy 37 Automaton for intersection }{}{}{ ababbaL mn =Ç= 00, pq 10, pqa 21, pq b ab 11, pq 20, pq a 12, pq 22, pq b ba, a b ba, b a Repeat until no new states can be added
  • 38. © 2020 Wael Badawy 38 Automaton for intersection }{}{}{ ababbaL mn =Ç= add Accept state 00, pq 10, pqa 21, pq b ab 11, pq 20, pq a 12, pq 22, pq b ba, a b ba, b a accept state for accept state for 1q 1M 1p 2M
  • 39. © 2020 Wael Badawy 39 simulates in parallel and1M 2M accepts string w if and only if: accepts string w1M and accepts string w2M )()()( 21 MLMLML Ç= Intersection DFA :M