© 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

PDF
tax.utah.gov forms current tc tc-922-pages
PDF
Changes at a glance
PDF
06 (1)
PPTX
N F A - Non Deterministic Finite Automata
PPT
0227 regularlanguages
PDF
Problemes chap1 toc
PPTX
Formal methods 2 - languages and machines
DOC
Flat notes iii i (1)(7-9-20)
tax.utah.gov forms current tc tc-922-pages
Changes at a glance
06 (1)
N F A - Non Deterministic Finite Automata
0227 regularlanguages
Problemes chap1 toc
Formal methods 2 - languages and machines
Flat notes iii i (1)(7-9-20)

Similar to Regular properties (20)

PPTX
THEORYOFAUTOMATATHEORYOFAUTOMATATHEORYOFAUTOMATA.pptx
PPTX
Finals-review.pptx
PDF
F_Autómatas_MIT_2010--------------------
PPTX
Resumen material MIT
PDF
Chapter 3 REGULAR EXPRESSION.pdf
PDF
toc1.pdf the theory of computation for master of computer applications
PPTX
1. Introduction to machine learning and AI
PPTX
1. Introduction automata throry and intoduction
PPTX
DFA Assignment solution.pptx
PDF
Complier Design - Operations on Languages, RE, Finite Automata
PPT
FiniteAutomata.ppt
PPT
FiniteAutomata (1).ppt
PDF
Automata And Computability Solutions To Exercises Fall 2016
PDF
FSM.pdf
PPTX
Lec1.pptx
PPTX
language , grammar and automata
PPT
FiniteAutomata-DFA and NFA from Theory of Computation.ppt
PPTX
introductory Discrete structure workshop.pptx
PDF
Formal Languages and Automata Theory unit 4
PPTX
Module 1 TOC.pptx
THEORYOFAUTOMATATHEORYOFAUTOMATATHEORYOFAUTOMATA.pptx
Finals-review.pptx
F_Autómatas_MIT_2010--------------------
Resumen material MIT
Chapter 3 REGULAR EXPRESSION.pdf
toc1.pdf the theory of computation for master of computer applications
1. Introduction to machine learning and AI
1. Introduction automata throry and intoduction
DFA Assignment solution.pptx
Complier Design - Operations on Languages, RE, Finite Automata
FiniteAutomata.ppt
FiniteAutomata (1).ppt
Automata And Computability Solutions To Exercises Fall 2016
FSM.pdf
Lec1.pptx
language , grammar and automata
FiniteAutomata-DFA and NFA from Theory of Computation.ppt
introductory Discrete structure workshop.pptx
Formal Languages and Automata Theory unit 4
Module 1 TOC.pptx
Ad

More from Wael Badawy (20)

PDF
HTML introduction
PPTX
Np complete reductions
PPTX
Parsers -
PPTX
Computer Vision Cameras
PPTX
Computer Vision Gans
PPTX
Computer Vision image classification
PPTX
Computer Vision Structure from motion
PDF
Universal turing
PDF
Turing Machine
PDF
Turing variations
PDF
Time complexity
PDF
Regular pumping
PDF
Regular pumping examples
PDF
Regular expressions
PDF
Pushdown Automota
PDF
Pda accept context free
PPTX
Computer Vision sfm
PPTX
Computer vision - photometric
PPTX
Computer vision - light
PPTX
Computer vision - two view geometry
HTML introduction
Np complete reductions
Parsers -
Computer Vision Cameras
Computer Vision Gans
Computer Vision image classification
Computer Vision Structure from motion
Universal turing
Turing Machine
Turing variations
Time complexity
Regular pumping
Regular pumping examples
Regular expressions
Pushdown Automota
Pda accept context free
Computer Vision sfm
Computer vision - photometric
Computer vision - light
Computer vision - two view geometry
Ad

Recently uploaded (20)

PPTX
ELIAS-SEZIURE AND EPilepsy semmioan session.pptx
PDF
AI-driven educational solutions for real-life interventions in the Philippine...
PDF
Τίμαιος είναι φιλοσοφικός διάλογος του Πλάτωνα
PPTX
TNA_Presentation-1-Final(SAVE)) (1).pptx
PDF
Environmental Education MCQ BD2EE - Share Source.pdf
PPTX
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
PDF
Trump Administration's workforce development strategy
PDF
IGGE1 Understanding the Self1234567891011
PDF
Practical Manual AGRO-233 Principles and Practices of Natural Farming
PDF
My India Quiz Book_20210205121199924.pdf
PDF
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
PDF
HVAC Specification 2024 according to central public works department
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PPTX
A powerpoint presentation on the Revised K-10 Science Shaping Paper
DOCX
Cambridge-Practice-Tests-for-IELTS-12.docx
PDF
Complications of Minimal Access-Surgery.pdf
PDF
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 2).pdf
PDF
International_Financial_Reporting_Standa.pdf
PPTX
Unit 4 Computer Architecture Multicore Processor.pptx
ELIAS-SEZIURE AND EPilepsy semmioan session.pptx
AI-driven educational solutions for real-life interventions in the Philippine...
Τίμαιος είναι φιλοσοφικός διάλογος του Πλάτωνα
TNA_Presentation-1-Final(SAVE)) (1).pptx
Environmental Education MCQ BD2EE - Share Source.pdf
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
Trump Administration's workforce development strategy
IGGE1 Understanding the Self1234567891011
Practical Manual AGRO-233 Principles and Practices of Natural Farming
My India Quiz Book_20210205121199924.pdf
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
HVAC Specification 2024 according to central public works department
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
Chinmaya Tiranga quiz Grand Finale.pdf
A powerpoint presentation on the Revised K-10 Science Shaping Paper
Cambridge-Practice-Tests-for-IELTS-12.docx
Complications of Minimal Access-Surgery.pdf
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 2).pdf
International_Financial_Reporting_Standa.pdf
Unit 4 Computer Architecture Multicore Processor.pptx

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