MOD 1 TOC
MOD 1 TOC
com/c/EDULINEFORCSE
STUDENTS
MODULE 1
INTRODUCTION TO AUTOMATA THEORY &
ITS SIGNIFICANCE
TOC BASICS
Symbols – Symbols are the basic building blocks of TOC. It can be
any letter, picture or number.
Eg : a, b, c, 0, 1, 2, ,
Alphabets (Σ) – Collection of symbols which are always finite.
Eg : Σ = {0, 1} Binary alphabet
Σ = {0, 1, 2, 3,……..9} Decimal alphabet
Σ = {a, b, c, ……z} English alphabet
Power of Σ
• Let Σ ={a, b}.
• Σ 𝟎 = set of all strings of length 0.
= {} [ is a special symbol of length 0. ie, ||= 0 ]
• Σ 𝟏 = set of all strings over Σ of length 1.
= {a, b}
• Σ 𝟐 = set of all strings overΣ of length 2
=Σ.Σ = {a, b} . {a, b} = {aa, ab, ba, bb}
• Σ 𝟑 = Σ.Σ.Σ = set of all strings over Σ of length 3
Cardinality = |Σ 𝟑 |=8
• Σ 𝒏 = n length strings
Prepared by EBIN P.M , Assistant Professor , IESCE 8
𝚺 ∗
• In place of * , we can substitute any number starting from 0.
• 𝚺 ∗ = 𝚺 𝟎 U 𝚺 𝟏 U 𝚺 𝟐 …………..
Let, Σ={a, b}
𝚺 ∗ = {} U {a, b} U {aa, ab, ba, bb}……….
𝚺 ∗ = a set of all possible strings over {a, b} of all lengths. It can be
considered as a universal set. So 𝚺 ∗ contains every thing. It is
infinite.
𝚺∗
L₂ L₁ С 𝚺 ∗ (L₁ is a subset of 𝚺 ∗ )
L₁
L₂ С 𝚺 ∗ (L₂ is a subset of 𝚺 ∗ )
L₃ L₃ С 𝚺 ∗ (L₃ is a subset of 𝚺 ∗ )
Prepared by EBIN P.M , Assistant Professor , IESCE 9
Formal Language
• A formal language L over an alphabet Σ is a subset of Σ*, that is, a
set of strings over that alphabet.
• A formal language consists of strings whose letters are taken
from an alphabet and are well-formed according to a specific set
of rules.
Eg: Let Σ ={a, b}.
𝒂𝐧 |n≥0
L={, a, aa, aaa, aaaa, ……..}
𝒂𝐧 𝒃𝐧 |n≥0
L= {, ab, aabb, aaabbb, ………}
• Let Σ={a,b}
L₁={aa, ab, ba, bb}.Check whether the string “aaa” is a part of this
language or not?
Ans: no. Because L₁ is finite language.
L₂ = {a, aa, aaa, ab,…….}. Check whether the string “baba” is a part
of this language or not?
Ans: because L₂ is infinite, we should check with all strings in the
language. Instead of this, we can use an easy method.
For a given infinite language, we can create a finite representation.
• Up on scanning the entire string, the state is not in final state. So,
the string is not accepted and is not present in the Language.
FINITE AUTOMATA
An automaton with a finite number of states is called a Finite
Automaton (FA) or Finite State Machine (FSM)
Finite automata are used to recognize patterns
It takes the string of symbol as input and changes its state
accordingly. When the desired symbol is found, then the
transition occurs.
At the time of transition, the automata can either move to the
next state or stay in the same state.
Finite automata have two states, Accept state or Reject state.
When the input string is processed successfully, and the
automata reached its final state, then it will accept.
Prepared by EBIN P.M , Assistant Professor , IESCE 18
Formal Definition of FA
A finite automaton is a collection of 5-tuple (Q, ∑, δ, q0, F),
where:
Q : finite set of states
∑ : finite set of the input alphabet
q0 : initial state (start state)
F : Set of final states
δ : Transition function
Finite
Automata
(FA)
FA with FA without
output output
Moore Mealy
Machine Machine
DFA NFA -NFA
(A, a) A
(A, b)
(B, a) B
(B, b)
(C, a) C
(C, b)
• Take the smallest string, “aa” from the language L={aa, ab, ba, bb}
• Construct a skeleton
(a) (b)
(c)
(d)
If more than two length string comes, it will go to dead state D
Once to reach D , it will never go to previous state. So state D is
called dead state.
A string is said to be accepted by a FA, if we are able to reach
the final state starting from initial state up on scanning entire
string, then the string is said to be accepted by the FA.
If not reach to the final state, the string is said to be Rejected
Comparison
• If we are using the above method (Fig : 1), The FA will never end.
But we can create a finite automata by decreasing the number of
states. For that, we can distinguish with two classes.
1. odd length strings
2. Even length strings
Prepared by EBIN P.M , Assistant Professor , IESCE 31
In the left side DFA, we reduce the number of states. But it is not
minimal DFA. The DFA shown on right side is the minimal DFA.
Here one state accept even length strings and other for odd length
string
• Here , A and ϕ are not final states. So the string ‘ab’ is rejected.
Now we can define the transition function of NFA
δ:Q×Σ→ 𝐐
δ:Q×Σ→ 𝑸
Q= {A, B} Σ={a, b}
Q×Σ 2
(A, a) ϕ
(A, b) {A}
(B, a) {B}
(B, b) {A,B}
NFA : δ : Q × Σ → 𝟐𝐐
DFA : δ : Q × Σ → Q , here Q is a part of 𝟐𝐐 . So we can
say that
Every DFA is an NFA , but the reverse is not true.
Q: Construct NFA which accepts set of all strings over Σ={a,b}
which (1) starts with ‘a’ (2) starts with ‘b’
DFA NFA
DFA stands for Deterministic Finite Automata NFA stands for Nondeterministic Finite Automata.
For each symbolic representation of the alphabet, there is No need to specify how does the NFA react according to
only one state transition in DFA some symbol.
DFA cannot use Empty String transition. NFA can use Empty String transition.
DFA can be understood as one machine. NFA can be understood as multiple little machines
computing at the same time.
In DFA, the next possible state is distinctly set. In NFA, each pair of state and input symbol can have many
possible next states.
DFA is more difficult to construct. NFA is easier to construct.
DFA rejects the string in case it terminates in a state that is NFA rejects the string in the event of all branches dying or
different from the accepting state. refusing the string.
Time needed for executing an input string is less. Time needed for executing an input string is more.
All DFA are NFA. Not all NFA are DFA.
DFA requires more space. NFA requires less space than DFA.
STEP2: Draw state transition table for DFA from the above table
Here D indicates dead state
Convert to DFA
State transition table for the above NFA Corresponding state transition table for
DFA
DFA
- NFA
• is an empty string.
-closure (∗ )
• -closure(A)
-closure((-closure(A), 0))