2. Course Outcomes
1. Able to understand the concept of abstract machines and their power to recognize
the languages.
2. Able to employ finite state machines for modeling and solving computing
problems.
3. Able to design context free grammars for formal languages.
4. Able to distinguish between decidability and undecidability.
5. Able to gain proficiency with mathematical tools and formal methods.
3. UNIT - I
PART-1
Introduction to Finite Automata: Structural Representations, Automata and Complexity, the Central
Concepts of Automata Theory – Alphabets, Strings, Languages, Problems.
PART-2
Nondeterministic Finite Automata: Formal Definition, an application, Text Search, Finite Automata
with Epsilon-Transitions.
PART-3
Deterministic Finite Automata: Definition of DFA, How A DFA Process Strings, The language of
DFA, Conversion of NFA with €-transitions to NFA without €-transitions. Conversion of NFA to
DFA, Moore and Melay machines
4. What is automata
● The term "Automata" is derived from the Greek word
"αὐτό%ατα" which means “self-acting”.
● Automatons are abstract models of machines that
performs computations of an input by moving
through a series of states.
5. Finite Automata(FA)
● An automaton with a finite number of states is called a Finite Automaton (FA) or Finite State Machine (FSM).
● Formal definition of a Finite Automaton
An automaton can be represented by a
5-tuple (Q, ∑, δ, q0, F), where −
• Q is a finite set of states.
• ∑ is a finite set of symbols, called
the alphabet of the automaton.
• δ is the transition function.
• q0 is the initial state from where
any input is processed (q0 ∈ Q).
• F is a set of final state/states of Q
(F ⊆ Q).
7. • The Circle represent the states.
• The arcs labeled with an input alphabet show the transitions.
• The initial state is denoted by an empty single incoming arc.
• The final state is indicated by double circles.
Q = {a, b, c},
∑ = {0, 1},
q0 = {a},
F = {c}
8.
9. Structural Representation
● FA is represented in 2 ways
A. Transition Diagram
B. Transition Table States/
Input
0 1
—>A A B
B C A
*C B C
10. Transition Diagram
● A transition diagram or state transition diagram is a directed
graph which can be constructed as follows:
◦ There is a node for each state in Q, which is represented by the
circle.
◦ There is a directed edge from node q to node p labeled a if
δ(q, a) = p.
◦ In the start state, there is an arrow with no source.
◦ Accepting states or final states are indicating by a double
circle.
11.
12. Transition Table
● The transition table is basically a tabular representation of the
transition function. It takes two arguments (a state and a
symbol) and returns a state (the "next state").
A transition table is represented by the following things:
◦ Columns correspond to input symbols.
◦ Rows correspond to states.
◦ Entries correspond to the next state.
◦ The start state is denoted by an arrow with no source.
◦ The accept state is denoted by a star.
14. ●Chomsky Normal Form
Grammar Languages Automaton
Type-0 Recursively
enumerable
Turing machine
Type-1
Context-
sensitive
Linear-
bounded non-
deterministic
Turing
machine
Type-2 Context-free
pushdown
automaton
Type-3 Regular
Finite state
automaton
15. Alphabets, Strings, Languages, Problems
● Alphabet: An alphabet is a finite collection of
symbols.
● Example:
● Σ = {a, b} be an alphabet
● Σ = {0,1} be an alphabet
● Σ = {a, b…..z} be an alphabets (set of lower case
letters)
16. ● String: A string over an alphabet Σ is a finite
sequence of symbols of Σ.
● Example:
● Let Σ = {a, b} be an alphabet; then {a, b, aa, ab, bba,
baaba, . . . } are some examples of strings over Σ.
A infinite number of strings can be generated.
● Let Σ = {0,1} be an alphabet; then
{0,1,01,0011,0101,100000…..}
17. ● Language: It is collection of appropriate strings.
● Examples:
● L= The set of all strings over {0, 1} that start with 0
Σ={0,00,010,011,0111,0101…..}
• The set of all strings over {a, b, c} having ac as a substring
Σ={ac, abaca, acba, bcac, abac……..}
Since languages are sets, we can apply various well known set operations
such as union, concatenation ,Kleene star or Kleene closure, complement,
difference, intersection on languages
18. Kleene Star/Kleene Closure
● The Kleene star, ∑*, is a unary operator on a set of symbols
or strings ∑.
● For example, if Σ = {0, 1}, then ∑*= {ε, 0, 1, 00, 01, 10, 11,
000, 001, . . .}
● ∑0=ε. The length of string
● ∑1={0,1}
● ∑2={00,11,10,01}
● ∑3={000,001,011,010,111,110,101,100}
● The Kleene closure of a language L is denoted by L* is
defined as
19. ● The Kleene star of the language L = {0, 1} over the
alphabet Σ = {0, 1} is
● L* = L 0 ∪ L1 ∪ L 2 ∪ · · ·
● = {ε} ∪ {0, 1} ∪ {00, 01, 10, 11} ∪ · · ·
● = {ε, 0, 1, 00, 01, 10, 11, · · · }
● = the set of all strings over Σ.
20. Kleene Plus
● The positive closure of a language L is denoted by
L+ is defined as over the alphabet Σ = {0, 1} is
● L+ = L1 ∪ L 2 ∪ · · ·
● = {0, 1} ∪ {00, 01, 10, 11} ∪ · · ·
● = {0, 1, 00, 01, 10, 11, · · · }
● = the set of all strings over Σ.
21. Types of FA
● 2 types of FA. They are
● Deterministic Finite Automaton(DFA) or
Deterministic Finite Machine
● Non-Deterministic Finite Automaton(NFA) or Non-
Deterministic Finite Machine
22.
23. DFA
Formal Definition of a DFA
A DFA can be represented by a 5-tuple (Q, ∑, δ, q0, F) where −
• Q is a finite set of states.
• ∑ is a finite set of symbols called the alphabet.
• δ is the transition function where δ: Q × ∑ → Q
• q0 is the initial state from where any input is processed (q0 ∈ Q).
• F is a set of final state/states of Q (F ⊆ Q).
24. Graphical Representation of a DFA
A DFA is represented by state diagram.
• The vertices represent the states.
• The arcs labeled with an input alphabet show the transitions.
• The initial state is denoted by an empty single incoming arc.
• The final state is indicated by double circles.
25. NFA
An NFA can be represented by a 5-tuple (Q, ∑, δ, q0, F) where −
• Q is a finite set of states.
• ∑ is a finite set of symbols called the alphabets.
• δ is the transition function where δ: Q × ∑ → 2Q
(Here the power set of Q (2Q) has been taken because in case of NDFA, from a state,
transition can occur to any combination of Q states)
• q0 is the initial state from where any input is processed (q0 ∈ Q).
• F is a set of final state/states of Q (F ⊆ Q).
26. Graphical Representation of a NFA
• The vertices represent the states.
• The arcs labeled with an input alphabet show the
transitions.
• The initial state is denoted by an empty single incoming
arc.
• The final state is indicated by double circles.
34. ● Conversion from NFA to DFA
● Suppose there is an NFA N < Q, ∑, q0, δ, F > which recognizes
a language L. Then the DFA D < Q’, ∑, q0, δ’, F’ > can be
constructed for language L as:
Step 1: Initially Q’ = ɸ.
Step 2: Add q0 to Q’.
Step 3: For each state in Q’, find the possible set of states for each
input symbol using transition function of NFA. If this set of states
is not in Q’, add it to Q’.
Step 4: Final state of DFA will be all states with contain F (final
states of NFA)
Examples: refer document
35. ●∈-NFA
● NFA with (null) or ∈ move : If any finite automata
contains ε (null) move or transaction, then that finite
automata is called NFA with ∈ moves
36.
37. Epsilon (∈) – closure :
Epsilon closure for a given state X is a set of states which can be
reached from the states X with only (null) or ε moves including
the state X itself. In other words, ε-closure for a state can be
obtained by union operation of the ε-closure of the states which
can be reached from X with a single ε move in recursive manner.
For the above example ∈ closure are as follows :
∈ closure(A) : {A, B, C}
∈ closure(B) : {B, C}
∈ closure(C) : {C}
38. ∈-NFA TO NFA CONVERSION
● Step1: Find e-closure for each state in
machine(default e-closure applicable to every state)
● Step 2: output of step 1 apply input alphabets we will
get a result.
● Step 3: On result of step 2 again apply closure.
● Formula: e-closure(δ(e-closure(q),∑))
42. Minimisation of DFA -Equivalence Theorem
Step 1: We will divide Q (set of states) into two sets. One set will
contain all final states and other set will contain non-final states.
This partition is called P0.
Step 2: Initialize k = 1
Step 3: Find Pk by partitioning the different sets of Pk-1. In each set
of Pk-1, we will take all possible pair of states. If two states of a set
are distinguishable, we will split the sets into different sets in Pk.
Step 4: Stop when Pk = Pk-1 (No change in partition)
Step 5: All states of one set are merged into one. No. of states in
minimized DFA will be equal to no. of sets in Pk.
44. Step 1. P0 will have two sets of states. One set will contain q1, q2, q4 which are final
states of DFA and another set will contain remaining states. So P0 = { { q1, q2, q4 }, { q0,
q3, q5 } }.
Step 2. To calculate P1, we will check whether sets of partition P0 can be partitioned or
not:
i) For set { q1, q2, q4 }
δ ( q1, 0 ) = q2 ( q2, 0 ) = q2 and δ ( q1, 1 ) = q5 ( q2, 1 ) = q5, So q1 and q2 are not
distinguishable.
Similarly, δ ( q1, 0 ) = δ ( q4, 0 ) = q2 and δ ( q1, 1 ) = δ ( q4, 1 ) = q5, So q1 and q4 are
not distinguishable.
Since, q1 and q2 are not distinguishable and q1 and q4 are also not distinguishable, So q2
and q4 are not distinguishable. So, { q1, q2, q4 } set will not be partitioned in P1.
45. ii) For set { q0, q3, q5 } :
δ ( q0, 0 ) = q3 and δ ( q3, 0 ) = q0
δ ( q0, 1) = q1 and δ( q3, 1 ) = q4
Moves of q0 and q3 on input symbol 0 are q3 and q0 respectively which are in same set in
partition P0
Moves of q0 and q3 on input symbol 1 are q3 and q0 which are in same set in partition P0.
So, q0 and q3 are not distinguishable
δ( q0, 0 ) = q3 and δ ( q5, 0 ) = q5
δ ( q0, 1 ) = q1 and δ ( q5, 1 ) = q5
Moves of q0 and q5 on input symbol 1 are q1 and q5 respectively which are in different set
in partition P0.
So, q0 and q5 are distinguishable. So, set { q0, q3, q5 } will be partitioned into { q0, q3 }
and { q5 }.
P1 = { { q1, q2, q4 }, { q0, q3}, { q5 } }
46. To calculate P2:
ii)For set { q1, q2, q4 } :
δ ( q1, 0 ) = δ ( q2, 0 ) = q2 and δ ( q1, 1 ) = δ ( q2, 1 ) = q5, So q1 and q2 are not distinguishable.
Similarly, δ ( q1, 0 ) = δ ( q4, 0 ) = q2 and δ ( q1, 1 ) = δ ( q4, 1 ) = q5, So q1 and q4 are not
distinguishable.
Since, q1 and q2 are not distinguishable and q1 and q4 are also not distinguishable, So q2 and q4 are
not distinguishable. So, { q1, q2, q4 } set will not be partitioned in P2.
iv)For set { q0, q3 } :
δ ( q0, 0 ) = q3 and δ ( q3, 0 ) = q0
δ ( q0, 1 ) = q1 and δ ( q3, 1 ) = q4
Moves of q0 and q3 on input symbol 0 are q3 and q0 respectively which are in same set in partition P1.
Similarly, Moves of q0 and q3 on input symbol 1 are q3 and q0 which are in same set in partition P1. So,
q0 and q3 are not distinguishable.
v) For set { q5 }:
Since we have only one state in this set, it can’t be further partitioned. So,
P2 = { { q1, q2, q4 }, { q0, q3 }, { q5 } }
48. Minimisation of DFA- Myphill-Nerode Theorem
Step 1 − Draw a table for all pairs of states (Qi, Qj) not
necessarily connected directly [All are unmarked
initially]
Step 2 − Consider every state pair (Qi, Qj) in the DFA
where Qi ∈ F and Qj ∉ F or vice versa and mark them.
[Here F is the set of final states]
Step 3 − Repeat this step until we cannot mark
anymore states −
If there is an unmarked pair (Qi, Qj), mark it if the pair
{δ (Qi, A), δ (Qi, A)} is marked for some input alphabet.
Step 4 − Combine all the unmarked pair (Qi, Qj) and
make them a single state in the reduced DFA.