SlideShare uma empresa Scribd logo
1 de 22
Lecture #5
Automata Theory and formal languages
(CSC-307)
Muhammad Shahzeb
Finite Automata
Defining Languages (continued)…
Method 4 (Finite Automaton)
 Definition:
A Finite automaton (FA), is a collection of the followings
1. Finite number of states, having one initial and some
(may be none) final states.
2. Finite set of input letters (Σ) from which input strings
are formed.
3. Finite set of transitions i.e. for each state and for each
input letter there is a transition showing how to move
from one state to another.
Example
 Σ = {a,b}
 States: x, y, z where x is an initial state and z is
final state.
 Transitions:
1. At state x reading a go to state z,
2. At state x reading b go to state y,
3. At state y reading a, b go to state y
4. At state z reading a, b go to state z
Example Continued …
These transitions can be expressed by the following
table called transition table
Note
It may be noted that the information of an FA,
given in the previous table, can also be depicted
by the following diagram, called the transition
diagram, of the given FA
a , b
Y
Z +
X -
a , b
b
a
Remark
The previous transition diagram is an FA accepting
the language of strings, defined over Σ={a, b},
starting with a. It may be noted that this
language may be expressed by the regular
expression
a (a + b)*
Note
It may be noted that to indicate the initial state,
an arrow head can also be placed before that
state and that the final state with double circle, as
shown below. It is also to be noted that while
expressing an FA by its transition diagram, the
labels of states are not necessary.
Example
Σ = {a,b}
States: x, y, where x is both initial and final state.
Transitions:
1. At state x reading a or b go to state y.
2. At state y reading a or b go to state x.
Example Continued …
These transitions can be expressed by the following
transition table
Example Continued …
It may be noted that the previous transition table
may be depicted by the following transition
diagram.
a , b
YX +
a , b
Example Continued …
The previous transition diagram is an FA accepting
the language of strings, defined over Σ={a, b} of
even length. It may be noted that this language
may be expressed by the regular expression
((a+ b) (a + b))*
TASK
Build an FA for the language L of strings, defined
over Σ={a, b}, of odd length.
Example
Consider the language L of strings, defined over
Σ={a, b}, starting with b. The language L may
be expressed by RE b(a + b)* , may be accepted
by the following FA
+
l
-
a , b
b
a
a , b
Example:
Consider the language L of strings, defined over
Σ={a, b}, ending in a. The language L may be
expressed by RE (a+b)*a
This language may be accepted by the following FA
Example Continued …
There may be another FA corresponding to the
given language.
a
+-
b
ab
Example continued …
Note
It may be noted that corresponding to a given
language there may be more than one FA
accepting that language, but for a given FA there
is a unique language accepted by that FA.
Note
It is to be noted that given the languages L1 and
L2 ,where
L1 = The language of strings, defined over Σ={a,
b}, beginning with a
L2 = The language of strings, defined over
Σ={a, b}, not beginning with b
The Λ does not belong to L1 while it does belong to
L2. This fact may be depicted by the corresponding
transition diagrams of L1 and L2.
FA1 Corresponding to L1
The language L1 may be expressed by the regular
expression a(a + b)*
FA2 Corresponding to L2
The language L2 may be expressed by the regular
expression a (a + b)* + Λ
Thank You…

Mais conteúdo relacionado

Mais procurados (20)

Lesson 03
Lesson 03Lesson 03
Lesson 03
 
Theory of Automata
Theory of AutomataTheory of Automata
Theory of Automata
 
Chapter1 Formal Language and Automata Theory
Chapter1 Formal Language and Automata TheoryChapter1 Formal Language and Automata Theory
Chapter1 Formal Language and Automata Theory
 
Introduction to Computer theory (Automata Theory) 2nd Edition By Denial I.A. ...
Introduction to Computer theory (Automata Theory) 2nd Edition By Denial I.A. ...Introduction to Computer theory (Automata Theory) 2nd Edition By Denial I.A. ...
Introduction to Computer theory (Automata Theory) 2nd Edition By Denial I.A. ...
 
Language
LanguageLanguage
Language
 
Lesson 04
Lesson 04Lesson 04
Lesson 04
 
Theory of automata and formal language
Theory of automata and formal languageTheory of automata and formal language
Theory of automata and formal language
 
Theory of Automata Lesson 01
 Theory of Automata Lesson 01  Theory of Automata Lesson 01
Theory of Automata Lesson 01
 
Flat unit 3
Flat unit 3Flat unit 3
Flat unit 3
 
Automata definitions
Automata definitionsAutomata definitions
Automata definitions
 
Lesson 10
Lesson 10Lesson 10
Lesson 10
 
Lesson 08
Lesson 08Lesson 08
Lesson 08
 
Theory of automata and formal language
Theory of automata and formal languageTheory of automata and formal language
Theory of automata and formal language
 
FInite Automata
FInite AutomataFInite Automata
FInite Automata
 
Lesson 02
Lesson 02Lesson 02
Lesson 02
 
Lesson 05
Lesson 05Lesson 05
Lesson 05
 
Formal language & automata theory
Formal language & automata theoryFormal language & automata theory
Formal language & automata theory
 
Lesson 09
Lesson 09Lesson 09
Lesson 09
 
Automata theory
Automata theoryAutomata theory
Automata theory
 
Lesson 02
Lesson 02Lesson 02
Lesson 02
 

Semelhante a Lecture 5

CS 162 Fall 2015 Homework 1 Problems September 29, 2015 Timothy Johnson 1. Ex...
CS 162 Fall 2015 Homework 1 Problems September 29, 2015 Timothy Johnson 1. Ex...CS 162 Fall 2015 Homework 1 Problems September 29, 2015 Timothy Johnson 1. Ex...
CS 162 Fall 2015 Homework 1 Problems September 29, 2015 Timothy Johnson 1. Ex...parmeet834
 
Problemes chap1 toc
Problemes chap1 tocProblemes chap1 toc
Problemes chap1 tocparmeet834
 
Lesson-01-29092022-081117pm.ppt
Lesson-01-29092022-081117pm.pptLesson-01-29092022-081117pm.ppt
Lesson-01-29092022-081117pm.pptashja1
 
Regular Expression in Compiler design
Regular Expression in Compiler designRegular Expression in Compiler design
Regular Expression in Compiler designRiazul Islam
 
theory of computation lecture 02
theory of computation lecture 02theory of computation lecture 02
theory of computation lecture 028threspecter
 
NLP_KASHK:Finite-State Morphological Parsing
NLP_KASHK:Finite-State Morphological ParsingNLP_KASHK:Finite-State Morphological Parsing
NLP_KASHK:Finite-State Morphological ParsingHemantha Kulathilake
 
Mod 2_RegularExpressions.pptx
Mod 2_RegularExpressions.pptxMod 2_RegularExpressions.pptx
Mod 2_RegularExpressions.pptxRaviAr5
 
Automata_Theory_and_compiler_design_UNIT-1.pptx.pdf
Automata_Theory_and_compiler_design_UNIT-1.pptx.pdfAutomata_Theory_and_compiler_design_UNIT-1.pptx.pdf
Automata_Theory_and_compiler_design_UNIT-1.pptx.pdfTONY562
 
Automata
AutomataAutomata
AutomataGaditek
 

Semelhante a Lecture 5 (20)

5.ppt
5.ppt5.ppt
5.ppt
 
To lec 03
To lec 03To lec 03
To lec 03
 
CS 162 Fall 2015 Homework 1 Problems September 29, 2015 Timothy Johnson 1. Ex...
CS 162 Fall 2015 Homework 1 Problems September 29, 2015 Timothy Johnson 1. Ex...CS 162 Fall 2015 Homework 1 Problems September 29, 2015 Timothy Johnson 1. Ex...
CS 162 Fall 2015 Homework 1 Problems September 29, 2015 Timothy Johnson 1. Ex...
 
Hwsoln03 toc
Hwsoln03 tocHwsoln03 toc
Hwsoln03 toc
 
Lesson 12
Lesson 12Lesson 12
Lesson 12
 
Problemes chap1 toc
Problemes chap1 tocProblemes chap1 toc
Problemes chap1 toc
 
Lesson-01-29092022-081117pm.ppt
Lesson-01-29092022-081117pm.pptLesson-01-29092022-081117pm.ppt
Lesson-01-29092022-081117pm.ppt
 
Finite Automata
Finite AutomataFinite Automata
Finite Automata
 
Regular Expression in Compiler design
Regular Expression in Compiler designRegular Expression in Compiler design
Regular Expression in Compiler design
 
theory of computation lecture 02
theory of computation lecture 02theory of computation lecture 02
theory of computation lecture 02
 
NLP_KASHK:Finite-State Morphological Parsing
NLP_KASHK:Finite-State Morphological ParsingNLP_KASHK:Finite-State Morphological Parsing
NLP_KASHK:Finite-State Morphological Parsing
 
5. NFA & DFA.pdf
5. NFA & DFA.pdf5. NFA & DFA.pdf
5. NFA & DFA.pdf
 
Final fa part1
Final fa part1Final fa part1
Final fa part1
 
Mod 2_RegularExpressions.pptx
Mod 2_RegularExpressions.pptxMod 2_RegularExpressions.pptx
Mod 2_RegularExpressions.pptx
 
Automata_Theory_and_compiler_design_UNIT-1.pptx.pdf
Automata_Theory_and_compiler_design_UNIT-1.pptx.pdfAutomata_Theory_and_compiler_design_UNIT-1.pptx.pdf
Automata_Theory_and_compiler_design_UNIT-1.pptx.pdf
 
Lec1.pptx
Lec1.pptxLec1.pptx
Lec1.pptx
 
Regular Expression
Regular ExpressionRegular Expression
Regular Expression
 
To lec 04
To lec 04To lec 04
To lec 04
 
L_2_apl.pptx
L_2_apl.pptxL_2_apl.pptx
L_2_apl.pptx
 
Automata
AutomataAutomata
Automata
 

Último

Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxAmita Gupta
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 

Último (20)

Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 

Lecture 5

  • 1. Lecture #5 Automata Theory and formal languages (CSC-307) Muhammad Shahzeb
  • 3. Defining Languages (continued)… Method 4 (Finite Automaton)  Definition: A Finite automaton (FA), is a collection of the followings 1. Finite number of states, having one initial and some (may be none) final states. 2. Finite set of input letters (Σ) from which input strings are formed. 3. Finite set of transitions i.e. for each state and for each input letter there is a transition showing how to move from one state to another.
  • 4. Example  Σ = {a,b}  States: x, y, z where x is an initial state and z is final state.  Transitions: 1. At state x reading a go to state z, 2. At state x reading b go to state y, 3. At state y reading a, b go to state y 4. At state z reading a, b go to state z
  • 5. Example Continued … These transitions can be expressed by the following table called transition table
  • 6. Note It may be noted that the information of an FA, given in the previous table, can also be depicted by the following diagram, called the transition diagram, of the given FA a , b Y Z + X - a , b b a
  • 7. Remark The previous transition diagram is an FA accepting the language of strings, defined over Σ={a, b}, starting with a. It may be noted that this language may be expressed by the regular expression a (a + b)*
  • 8. Note It may be noted that to indicate the initial state, an arrow head can also be placed before that state and that the final state with double circle, as shown below. It is also to be noted that while expressing an FA by its transition diagram, the labels of states are not necessary.
  • 9. Example Σ = {a,b} States: x, y, where x is both initial and final state. Transitions: 1. At state x reading a or b go to state y. 2. At state y reading a or b go to state x.
  • 10. Example Continued … These transitions can be expressed by the following transition table
  • 11. Example Continued … It may be noted that the previous transition table may be depicted by the following transition diagram. a , b YX + a , b
  • 12. Example Continued … The previous transition diagram is an FA accepting the language of strings, defined over Σ={a, b} of even length. It may be noted that this language may be expressed by the regular expression ((a+ b) (a + b))*
  • 13. TASK Build an FA for the language L of strings, defined over Σ={a, b}, of odd length.
  • 14. Example Consider the language L of strings, defined over Σ={a, b}, starting with b. The language L may be expressed by RE b(a + b)* , may be accepted by the following FA + l - a , b b a a , b
  • 15. Example: Consider the language L of strings, defined over Σ={a, b}, ending in a. The language L may be expressed by RE (a+b)*a This language may be accepted by the following FA
  • 16. Example Continued … There may be another FA corresponding to the given language. a +- b ab
  • 18. Note It may be noted that corresponding to a given language there may be more than one FA accepting that language, but for a given FA there is a unique language accepted by that FA.
  • 19. Note It is to be noted that given the languages L1 and L2 ,where L1 = The language of strings, defined over Σ={a, b}, beginning with a L2 = The language of strings, defined over Σ={a, b}, not beginning with b The Λ does not belong to L1 while it does belong to L2. This fact may be depicted by the corresponding transition diagrams of L1 and L2.
  • 20. FA1 Corresponding to L1 The language L1 may be expressed by the regular expression a(a + b)*
  • 21. FA2 Corresponding to L2 The language L2 may be expressed by the regular expression a (a + b)* + Λ