3
Most read
4
Most read
6
Most read
Introduction to Formal Languages
Finite Automata
Mobeen Mustafa1
Chapter 5: Finite Automata
We introduce the simplest deterministic theoretical
machines: Finite Automata.
Chapter 5: Finite Automata
Mobeen Mustafa2
 A finite automaton (FA) is the following 3 things:
1. a finite set of states, one of which is designated as the
start state, and some (maybe none) of which are
designated the final states (or accepting states)
2. an alphabet Σ of input letters
3. a finite set of transitions that indicate, for each state
and letter of the input alphabet, the state to go to next
state state
letter
Chapter 5: Finite Automata
Mobeen Mustafa3
The language defined or accepted by a finite
automaton is the set of words that end in a final
state.
If w is in the language defined by a finite
automaton, then we also say that the finite
automaton accepts w.
Chapter 5: Finite Automata
Mobeen Mustafa4
Example: ∑= {a,b}
states = {x,y,z}
start state : x
final states: {z}
a b
x y z
y x z
z z z
aaa: a
x ya ax y y is not final;
aaa is not accepted
aaba: a
x ya bx z z is final;
aaba is accepted
za
transitions:
Chapter 5: Finite Automata
5
x
–
y
z
+
a
a
a
b b
b
a b
x y z
y x z
z z z
Regular expression: (a+b)*b(a+b)*
aaaabba?
bbaabbbb?
Transition Diagram
Chapter 5: Finite Automata
Mobeen Mustafa6
x
–
y
z
+
a
a
a
b b
b
x
–
y
z
+
a
a
a
b
b
a
a
b
x
–
y
z
+a
b
a
b
b
bb
aaaabba?
bbaabbbb?
Chapter 5: Finite Automata
Mobeen Mustafa7
+ a,b
(a+b)(a+b)* = (a+b)+
– +
a
b
a,b
(a+b)*
Chapter 5: Finite Automata
8
No final state
The middle state is not a final state and all transitions that go
into this state do not exit.
–
a
b
a,b
–
a,b
a,b
+a,b
Finite Automata that Accept No Words
Chapter 5: Finite Automata
Mobeen Mustafa9
Two Ways to Study Finite Automata
1. Starting with a finite automaton (FA), analyze it to determine
the language it accepts.
2. Starting from a language, build an FA.
Chapter 5: Finite Automata
Mobeen Mustafa10
Example of 2: The language of all words with an even
number of letters over the alphabet {a,b}:
● Two states: 1 – even number, 2 – odd number
● Start state: 1
● Final state: 1
● The transitions:
a b
1 2 2
2 1 1
1+ 2
a,b
a,b
Chapter 5: Finite Automata
Mobeen Mustafa11
x
–
y
z
+
a,b
a,b
b
a
a(a+b)*
Not necessarily unique:
–
+
a,b
a,b
b
a
+
a,b
Remark: 2 final states
Chapter 5: Finite Automata
Mobeen Mustafa12
From Languages to Finite Automata
 There is not necessarily a unique FA that accepts a given
language.
 Is there always at least one FA:
 that accepts each possible language?
 that defines a language associated with a given regular
expression?
Chapter 5: Finite Automata
Mobeen Mustafa13
Example: Build an FA that accepts all words containing a
triple letter (either aaa or bbb).
1.Build an FA that accepts aaa
2.Add a path that accepts bbb.
3.Add paths for words that contain a’s and b’s before or
after the aaa or bbb.
Chapter 5: Finite Automata
Mobeen Mustafa14
 Does this FA accept the word ababa?
 The word babbb?
 2 ways to get to state 4
 The only way to get to state 2 is by reading an input a.
 The only way to get to state 3 is by reading an input b.
 What language?
1–
2
4
+
a,ba
b 3
a
a
b
b
This example shows that it is
possible to characterize
states by the purposes they
serve.
From Finite Automata to Languages
Chapter 5: Finite Automata
Mobeen Mustafa15
The third letter is b.
(aab + abb + bab + bbb)(a+b)*
(a+b)(a+b)b(a+b)*
The regular expression is not unique.
Is there always at least one regular expression defining the
language accepted by an FA?
+
a,b
a,b
a
b
– a,ba,b
Chapter 5: Finite Automata
Mobeen Mustafa16
Regular expression: baa
A “collecting bucket” state for all other words.
–
a,b
b +a
a
a
bb a,b
Chapter 5: Finite Automata
Mobeen Mustafa17
Regular expression: baa + ab
–
a,b
b +aa
bb a,b
+ b a
a,b a
Chapter 5: Finite Automata
Mobeen Mustafa
18
+
a,b
a,b
+
b
a
ba
– +
a
a
bb
– +
a
b
ab
Λ (a+b)*a + Λ
Words that do not end in b.
(a+b)*a
Words that end
in a.
?
Chapter 5: Finite Automata
Mobeen Mustafa19
The only letter that can change state is a.
(b*ab*)(ab*ab*)*
an odd number of a’s
– +
a
a
bb
Chapter 5: Finite Automata
Mobeen Mustafa20
Words that contain a double a
(a+b)*aa(a+b)*
Start state: the previous letter (if there is one) was not an a.
Middle state: we have just seen an a that was not preceded
by an a.
Final state: we have seen a double a.
– +
a
b
a,bb
a
Chapter 5: Finite Automata
Mobeen Mustafa21
+
b
a
ba
+
a
b
a
b
–
b
a
+
ba
–
a
a
a
b
b
b
aabbaabb
Chapter 5: Finite Automata
Mobeen Mustafa22
1
+
2
b
b
a
3 4
b
b
a a a
The Language EVEN-EVEN

More Related Content

PPT
Lecture 6
PDF
Lecture: Automata
PPT
Lecture 1,2
PPT
Theory of Automata Lesson 02
PPT
Lecture 7
PPTX
Introduction TO Finite Automata
PPTX
Theory of automata and formal language
PPT
Lecture 3,4
Lecture 6
Lecture: Automata
Lecture 1,2
Theory of Automata Lesson 02
Lecture 7
Introduction TO Finite Automata
Theory of automata and formal language
Lecture 3,4

What's hot (20)

PPT
Lecture 5
PDF
Formal Languages and Automata Theory Unit 1
PPTX
Moore and mealy machines
PPTX
Regular expressions
PPT
Theory of computing
PPTX
Types of grammer - TOC
PPTX
Chomsky Normal Form
PDF
Regular language and Regular expression
PDF
Automata theory
PPT
context free language
PDF
Deterministic Finite Automata (DFA)
PPT
Theory of Automata
PPT
Lecture 3,4
PPTX
Context free grammar
PPT
PDF
Closure properties of context free grammar
PPT
Nondeterministic Finite Automata
PPT
Lecture 8
PPTX
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)
PPT
Intro automata theory
Lecture 5
Formal Languages and Automata Theory Unit 1
Moore and mealy machines
Regular expressions
Theory of computing
Types of grammer - TOC
Chomsky Normal Form
Regular language and Regular expression
Automata theory
context free language
Deterministic Finite Automata (DFA)
Theory of Automata
Lecture 3,4
Context free grammar
Closure properties of context free grammar
Nondeterministic Finite Automata
Lecture 8
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)
Intro automata theory
Ad

Similar to FInite Automata (20)

ODP
Final fa part1
PDF
Fafl notes [2010] (sjbit)
PPTX
Automata introduction to FA_ Anurag Kumar.pptx
PPTX
Chapter-twoChapter-three automata and complexity theory .pptx
PPTX
Finite state system or finite automata
PPT
Introduction to fa and dfa
DOCX
Introduction to Finite Automata .docx
PDF
Atomata assignment 1 solution
PPTX
theory of computaion Finite Automata.pptx
PPT
Lecture12_16717_Lecture1.ppt
PDF
Automata_Theory_and_compiler_design_UNIT-1.pptx.pdf
PPT
Theory of Computation - Lecture 3
PPTX
Theory of computation Lec3 dfa
PPTX
TOC Introduction
PPT
1. finite_automata_new.ppt
PPT
formal language and automata theory unit 2
PPTX
automata presentation with added graphics.pptx
PPT
Finite automata(For college Seminars)
PPT
To lec 03
PPTX
TCS MUBAI UNIVERSITY ATHARVA COLLEGE OF ENGINEERING.pptx
Final fa part1
Fafl notes [2010] (sjbit)
Automata introduction to FA_ Anurag Kumar.pptx
Chapter-twoChapter-three automata and complexity theory .pptx
Finite state system or finite automata
Introduction to fa and dfa
Introduction to Finite Automata .docx
Atomata assignment 1 solution
theory of computaion Finite Automata.pptx
Lecture12_16717_Lecture1.ppt
Automata_Theory_and_compiler_design_UNIT-1.pptx.pdf
Theory of Computation - Lecture 3
Theory of computation Lec3 dfa
TOC Introduction
1. finite_automata_new.ppt
formal language and automata theory unit 2
automata presentation with added graphics.pptx
Finite automata(For college Seminars)
To lec 03
TCS MUBAI UNIVERSITY ATHARVA COLLEGE OF ENGINEERING.pptx
Ad

More from Mobeen Mustafa (11)

PPTX
Theory of automata
PDF
Language
PPT
Mathematical preliminaries in Automata
PPT
Kleene's theorem
PPT
Lect3 ch15-unit2
DOCX
Incremental Model
PPTX
Types of graphics cards
PPTX
convert number to string
PPTX
Process or preparing effective b.m
PDF
Lecture1
Theory of automata
Language
Mathematical preliminaries in Automata
Kleene's theorem
Lect3 ch15-unit2
Incremental Model
Types of graphics cards
convert number to string
Process or preparing effective b.m
Lecture1

Recently uploaded (20)

PDF
Horaris_Grups_25-26_Definitiu_15_07_25.pdf
PDF
Myanmar Dental Journal, The Journal of the Myanmar Dental Association (2013).pdf
PDF
semiconductor packaging in vlsi design fab
PPTX
CAPACITY BUILDING PROGRAMME IN ADOLESCENT EDUCATION
PPTX
Thinking Routines and Learning Engagements.pptx
PPTX
ACFE CERTIFICATION TRAINING ON LAW.pptx
PDF
LIFE & LIVING TRILOGY - PART - (2) THE PURPOSE OF LIFE.pdf
PDF
faiz-khans about Radiotherapy Physics-02.pdf
PDF
0520_Scheme_of_Work_(for_examination_from_2021).pdf
DOCX
Cambridge-Practice-Tests-for-IELTS-12.docx
PPTX
BSCE 2 NIGHT (CHAPTER 2) just cases.pptx
PDF
fundamentals-of-heat-and-mass-transfer-6th-edition_incropera.pdf
PDF
Everyday Spelling and Grammar by Kathi Wyldeck
PPTX
UNIT_2-__LIPIDS[1].pptx.................
PDF
Environmental Education MCQ BD2EE - Share Source.pdf
PPTX
PLASMA AND ITS CONSTITUENTS 123.pptx
DOCX
Ibrahim Suliman Mukhtar CV5AUG2025.docx
PDF
Nurlina - Urban Planner Portfolio (english ver)
PDF
Civil Department's presentation Your score increases as you pick a category
PPTX
What’s under the hood: Parsing standardized learning content for AI
Horaris_Grups_25-26_Definitiu_15_07_25.pdf
Myanmar Dental Journal, The Journal of the Myanmar Dental Association (2013).pdf
semiconductor packaging in vlsi design fab
CAPACITY BUILDING PROGRAMME IN ADOLESCENT EDUCATION
Thinking Routines and Learning Engagements.pptx
ACFE CERTIFICATION TRAINING ON LAW.pptx
LIFE & LIVING TRILOGY - PART - (2) THE PURPOSE OF LIFE.pdf
faiz-khans about Radiotherapy Physics-02.pdf
0520_Scheme_of_Work_(for_examination_from_2021).pdf
Cambridge-Practice-Tests-for-IELTS-12.docx
BSCE 2 NIGHT (CHAPTER 2) just cases.pptx
fundamentals-of-heat-and-mass-transfer-6th-edition_incropera.pdf
Everyday Spelling and Grammar by Kathi Wyldeck
UNIT_2-__LIPIDS[1].pptx.................
Environmental Education MCQ BD2EE - Share Source.pdf
PLASMA AND ITS CONSTITUENTS 123.pptx
Ibrahim Suliman Mukhtar CV5AUG2025.docx
Nurlina - Urban Planner Portfolio (english ver)
Civil Department's presentation Your score increases as you pick a category
What’s under the hood: Parsing standardized learning content for AI

FInite Automata

  • 1. Introduction to Formal Languages Finite Automata Mobeen Mustafa1 Chapter 5: Finite Automata We introduce the simplest deterministic theoretical machines: Finite Automata.
  • 2. Chapter 5: Finite Automata Mobeen Mustafa2  A finite automaton (FA) is the following 3 things: 1. a finite set of states, one of which is designated as the start state, and some (maybe none) of which are designated the final states (or accepting states) 2. an alphabet Σ of input letters 3. a finite set of transitions that indicate, for each state and letter of the input alphabet, the state to go to next state state letter
  • 3. Chapter 5: Finite Automata Mobeen Mustafa3 The language defined or accepted by a finite automaton is the set of words that end in a final state. If w is in the language defined by a finite automaton, then we also say that the finite automaton accepts w.
  • 4. Chapter 5: Finite Automata Mobeen Mustafa4 Example: ∑= {a,b} states = {x,y,z} start state : x final states: {z} a b x y z y x z z z z aaa: a x ya ax y y is not final; aaa is not accepted aaba: a x ya bx z z is final; aaba is accepted za transitions:
  • 5. Chapter 5: Finite Automata 5 x – y z + a a a b b b a b x y z y x z z z z Regular expression: (a+b)*b(a+b)* aaaabba? bbaabbbb? Transition Diagram
  • 6. Chapter 5: Finite Automata Mobeen Mustafa6 x – y z + a a a b b b x – y z + a a a b b a a b x – y z +a b a b b bb aaaabba? bbaabbbb?
  • 7. Chapter 5: Finite Automata Mobeen Mustafa7 + a,b (a+b)(a+b)* = (a+b)+ – + a b a,b (a+b)*
  • 8. Chapter 5: Finite Automata 8 No final state The middle state is not a final state and all transitions that go into this state do not exit. – a b a,b – a,b a,b +a,b Finite Automata that Accept No Words
  • 9. Chapter 5: Finite Automata Mobeen Mustafa9 Two Ways to Study Finite Automata 1. Starting with a finite automaton (FA), analyze it to determine the language it accepts. 2. Starting from a language, build an FA.
  • 10. Chapter 5: Finite Automata Mobeen Mustafa10 Example of 2: The language of all words with an even number of letters over the alphabet {a,b}: ● Two states: 1 – even number, 2 – odd number ● Start state: 1 ● Final state: 1 ● The transitions: a b 1 2 2 2 1 1 1+ 2 a,b a,b
  • 11. Chapter 5: Finite Automata Mobeen Mustafa11 x – y z + a,b a,b b a a(a+b)* Not necessarily unique: – + a,b a,b b a + a,b Remark: 2 final states
  • 12. Chapter 5: Finite Automata Mobeen Mustafa12 From Languages to Finite Automata  There is not necessarily a unique FA that accepts a given language.  Is there always at least one FA:  that accepts each possible language?  that defines a language associated with a given regular expression?
  • 13. Chapter 5: Finite Automata Mobeen Mustafa13 Example: Build an FA that accepts all words containing a triple letter (either aaa or bbb). 1.Build an FA that accepts aaa 2.Add a path that accepts bbb. 3.Add paths for words that contain a’s and b’s before or after the aaa or bbb.
  • 14. Chapter 5: Finite Automata Mobeen Mustafa14  Does this FA accept the word ababa?  The word babbb?  2 ways to get to state 4  The only way to get to state 2 is by reading an input a.  The only way to get to state 3 is by reading an input b.  What language? 1– 2 4 + a,ba b 3 a a b b This example shows that it is possible to characterize states by the purposes they serve. From Finite Automata to Languages
  • 15. Chapter 5: Finite Automata Mobeen Mustafa15 The third letter is b. (aab + abb + bab + bbb)(a+b)* (a+b)(a+b)b(a+b)* The regular expression is not unique. Is there always at least one regular expression defining the language accepted by an FA? + a,b a,b a b – a,ba,b
  • 16. Chapter 5: Finite Automata Mobeen Mustafa16 Regular expression: baa A “collecting bucket” state for all other words. – a,b b +a a a bb a,b
  • 17. Chapter 5: Finite Automata Mobeen Mustafa17 Regular expression: baa + ab – a,b b +aa bb a,b + b a a,b a
  • 18. Chapter 5: Finite Automata Mobeen Mustafa 18 + a,b a,b + b a ba – + a a bb – + a b ab Λ (a+b)*a + Λ Words that do not end in b. (a+b)*a Words that end in a. ?
  • 19. Chapter 5: Finite Automata Mobeen Mustafa19 The only letter that can change state is a. (b*ab*)(ab*ab*)* an odd number of a’s – + a a bb
  • 20. Chapter 5: Finite Automata Mobeen Mustafa20 Words that contain a double a (a+b)*aa(a+b)* Start state: the previous letter (if there is one) was not an a. Middle state: we have just seen an a that was not preceded by an a. Final state: we have seen a double a. – + a b a,bb a
  • 21. Chapter 5: Finite Automata Mobeen Mustafa21 + b a ba + a b a b – b a + ba – a a a b b b aabbaabb
  • 22. Chapter 5: Finite Automata Mobeen Mustafa22 1 + 2 b b a 3 4 b b a a a The Language EVEN-EVEN