SlideShare a Scribd company logo
1 of 51
Formal Languages and
Automata Theory
Presented By:
K Lakshmi Sravani(Asst Professor)
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.
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
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.
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).

● Example:
• 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}
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
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.
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.
Input/states 0 1
—>Q0 Q1 Q2
Q1 Q0 Q2
*Q2 Q2 Q2
●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
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)
● 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…..}
● 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
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
● 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 Σ.
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 Σ.
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
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).

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.
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).

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.
NFA VS DFA
Examples of FA Refer Document
FA-1
FA -2
FA-3
● 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
●∈-NFA
● NFA with (null) or ∈ move : If any finite automata
contains ε (null) move or transaction, then that finite
automata is called NFA with ∈ moves
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}
∈-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),∑))
Example
Example:Any no of 0's followed by any 1’s followed by 2’s
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.
● Question 1
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. 
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 } } 
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 } } 
● Solution 1
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.
● Solution
● Question 2
Thank You

More Related Content

What's hot

Context free grammars
Context free grammarsContext free grammars
Context free grammarsRonak Thakkar
 
Theory of automata and formal language
Theory of automata and formal languageTheory of automata and formal language
Theory of automata and formal languageRabia Khalid
 
3.5 equivalence of pushdown automata and cfl
3.5 equivalence of pushdown automata and cfl3.5 equivalence of pushdown automata and cfl
3.5 equivalence of pushdown automata and cflSampath Kumar S
 
Introduction TO Finite Automata
Introduction TO Finite AutomataIntroduction TO Finite Automata
Introduction TO Finite AutomataRatnakar Mikkili
 
Deterministic Finite Automata (DFA)
Deterministic Finite Automata (DFA)Deterministic Finite Automata (DFA)
Deterministic Finite Automata (DFA)Animesh Chaturvedi
 
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)Mohammad Ilyas Malik
 
Ch3 4 regular expression and grammar
Ch3 4 regular expression and grammarCh3 4 regular expression and grammar
Ch3 4 regular expression and grammarmeresie tesfay
 
CONTEXT FREE GRAMMAR
CONTEXT FREE GRAMMAR CONTEXT FREE GRAMMAR
CONTEXT FREE GRAMMAR Zahid Parvez
 
Theory of Automata
Theory of AutomataTheory of Automata
Theory of AutomataFarooq Mian
 
Variants of Turing Machine
Variants of Turing MachineVariants of Turing Machine
Variants of Turing MachineRajendran
 
Regular expressions-Theory of computation
Regular expressions-Theory of computationRegular expressions-Theory of computation
Regular expressions-Theory of computationBipul Roy Bpl
 
Push Down Automata (PDA) | TOC (Theory of Computation) | NPDA | DPDA
Push Down Automata (PDA) | TOC  (Theory of Computation) | NPDA | DPDAPush Down Automata (PDA) | TOC  (Theory of Computation) | NPDA | DPDA
Push Down Automata (PDA) | TOC (Theory of Computation) | NPDA | DPDAAshish Duggal
 
Finite automata examples
Finite automata examplesFinite automata examples
Finite automata examplesankitamakin
 
Minimization of DFA
Minimization of DFAMinimization of DFA
Minimization of DFAkunj desai
 

What's hot (20)

Context free grammars
Context free grammarsContext free grammars
Context free grammars
 
Theory of automata and formal language
Theory of automata and formal languageTheory of automata and formal language
Theory of automata and formal language
 
3.5 equivalence of pushdown automata and cfl
3.5 equivalence of pushdown automata and cfl3.5 equivalence of pushdown automata and cfl
3.5 equivalence of pushdown automata and cfl
 
Introduction TO Finite Automata
Introduction TO Finite AutomataIntroduction TO Finite Automata
Introduction TO Finite Automata
 
Deterministic Finite Automata (DFA)
Deterministic Finite Automata (DFA)Deterministic Finite Automata (DFA)
Deterministic Finite Automata (DFA)
 
pushdown automata
pushdown automatapushdown automata
pushdown automata
 
Finite automata
Finite automataFinite automata
Finite automata
 
Context free grammar
Context free grammarContext free grammar
Context free grammar
 
Chomsky Hierarchy.ppt
Chomsky Hierarchy.pptChomsky Hierarchy.ppt
Chomsky Hierarchy.ppt
 
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)
 
Ch3 4 regular expression and grammar
Ch3 4 regular expression and grammarCh3 4 regular expression and grammar
Ch3 4 regular expression and grammar
 
CONTEXT FREE GRAMMAR
CONTEXT FREE GRAMMAR CONTEXT FREE GRAMMAR
CONTEXT FREE GRAMMAR
 
Theory of Automata
Theory of AutomataTheory of Automata
Theory of Automata
 
Turing Machine
Turing MachineTuring Machine
Turing Machine
 
Variants of Turing Machine
Variants of Turing MachineVariants of Turing Machine
Variants of Turing Machine
 
Turing machine
Turing machineTuring machine
Turing machine
 
Regular expressions-Theory of computation
Regular expressions-Theory of computationRegular expressions-Theory of computation
Regular expressions-Theory of computation
 
Push Down Automata (PDA) | TOC (Theory of Computation) | NPDA | DPDA
Push Down Automata (PDA) | TOC  (Theory of Computation) | NPDA | DPDAPush Down Automata (PDA) | TOC  (Theory of Computation) | NPDA | DPDA
Push Down Automata (PDA) | TOC (Theory of Computation) | NPDA | DPDA
 
Finite automata examples
Finite automata examplesFinite automata examples
Finite automata examples
 
Minimization of DFA
Minimization of DFAMinimization of DFA
Minimization of DFA
 

Similar to Formal Languages and Automata Theory Unit 1

@vtucode.in-module-1-21CS51-5th-semester (1).pdf
@vtucode.in-module-1-21CS51-5th-semester (1).pdf@vtucode.in-module-1-21CS51-5th-semester (1).pdf
@vtucode.in-module-1-21CS51-5th-semester (1).pdfFariyaTasneem1
 
Automata theory introduction
Automata theory introductionAutomata theory introduction
Automata theory introductionNAMRATA BORKAR
 
Theory of Computation Basics of Finite Acceptors
Theory of Computation Basics of Finite AcceptorsTheory of Computation Basics of Finite Acceptors
Theory of Computation Basics of Finite AcceptorsRushabh2428
 
Theory of Computation FSM Conversions and Problems
Theory of Computation FSM Conversions and ProblemsTheory of Computation FSM Conversions and Problems
Theory of Computation FSM Conversions and ProblemsRushabh2428
 
Finite automata examples
Finite automata examplesFinite automata examples
Finite automata examplesankitamakin
 
Automata
AutomataAutomata
AutomataGaditek
 
Automata
AutomataAutomata
AutomataGaditek
 
Thoery of Computaion and Chomsky's Classification
Thoery of Computaion and Chomsky's ClassificationThoery of Computaion and Chomsky's Classification
Thoery of Computaion and Chomsky's ClassificationPrafullMisra
 
FiniteAutomata (1).ppt
FiniteAutomata (1).pptFiniteAutomata (1).ppt
FiniteAutomata (1).pptssuser47f7f2
 
FiniteAutomata.ppt
FiniteAutomata.pptFiniteAutomata.ppt
FiniteAutomata.pptRohitPaul71
 
Nondeterministic Finite Automata AFN.pdf
Nondeterministic Finite Automata AFN.pdfNondeterministic Finite Automata AFN.pdf
Nondeterministic Finite Automata AFN.pdfSergioUlisesRojasAla
 
Deterministic finite automata
Deterministic finite automata Deterministic finite automata
Deterministic finite automata Muhammad Love Kian
 
Theory of automata
Theory of automataTheory of automata
Theory of automataArslan905905
 
Finite automata(For college Seminars)
Finite automata(For college Seminars)Finite automata(For college Seminars)
Finite automata(For college Seminars)Naman Joshi
 

Similar to Formal Languages and Automata Theory Unit 1 (20)

5. NFA & DFA.pdf
5. NFA & DFA.pdf5. NFA & DFA.pdf
5. NFA & DFA.pdf
 
Automata
AutomataAutomata
Automata
 
@vtucode.in-module-1-21CS51-5th-semester (1).pdf
@vtucode.in-module-1-21CS51-5th-semester (1).pdf@vtucode.in-module-1-21CS51-5th-semester (1).pdf
@vtucode.in-module-1-21CS51-5th-semester (1).pdf
 
Automata theory introduction
Automata theory introductionAutomata theory introduction
Automata theory introduction
 
Theory of computation and automata
Theory of computation and automataTheory of computation and automata
Theory of computation and automata
 
Theory of computation and automata
Theory of computation and automataTheory of computation and automata
Theory of computation and automata
 
Theory of Computation Basics of Finite Acceptors
Theory of Computation Basics of Finite AcceptorsTheory of Computation Basics of Finite Acceptors
Theory of Computation Basics of Finite Acceptors
 
Theory of Computation FSM Conversions and Problems
Theory of Computation FSM Conversions and ProblemsTheory of Computation FSM Conversions and Problems
Theory of Computation FSM Conversions and Problems
 
Finite automata examples
Finite automata examplesFinite automata examples
Finite automata examples
 
Automata
AutomataAutomata
Automata
 
Automata
AutomataAutomata
Automata
 
Finite automata
Finite automataFinite automata
Finite automata
 
Thoery of Computaion and Chomsky's Classification
Thoery of Computaion and Chomsky's ClassificationThoery of Computaion and Chomsky's Classification
Thoery of Computaion and Chomsky's Classification
 
FiniteAutomata (1).ppt
FiniteAutomata (1).pptFiniteAutomata (1).ppt
FiniteAutomata (1).ppt
 
FiniteAutomata.ppt
FiniteAutomata.pptFiniteAutomata.ppt
FiniteAutomata.ppt
 
Nondeterministic Finite Automata AFN.pdf
Nondeterministic Finite Automata AFN.pdfNondeterministic Finite Automata AFN.pdf
Nondeterministic Finite Automata AFN.pdf
 
Deterministic finite automata
Deterministic finite automata Deterministic finite automata
Deterministic finite automata
 
Finite Automata
Finite AutomataFinite Automata
Finite Automata
 
Theory of automata
Theory of automataTheory of automata
Theory of automata
 
Finite automata(For college Seminars)
Finite automata(For college Seminars)Finite automata(For college Seminars)
Finite automata(For college Seminars)
 

More from Srimatre K

ML_ Unit 2_Part_B
ML_ Unit 2_Part_BML_ Unit 2_Part_B
ML_ Unit 2_Part_BSrimatre K
 
ML_Unit_2_Part_A
ML_Unit_2_Part_AML_Unit_2_Part_A
ML_Unit_2_Part_ASrimatre K
 
ML_Unit_1_Part_C
ML_Unit_1_Part_CML_Unit_1_Part_C
ML_Unit_1_Part_CSrimatre K
 
ML_Unit_1_Part_B
ML_Unit_1_Part_BML_Unit_1_Part_B
ML_Unit_1_Part_BSrimatre K
 
Internet of things unit-1
Internet of things unit-1Internet of things unit-1
Internet of things unit-1Srimatre K
 
ML_ Unit_1_PART_A
ML_ Unit_1_PART_AML_ Unit_1_PART_A
ML_ Unit_1_PART_ASrimatre K
 
Formal Languages and Automata Theory unit 5
Formal Languages and Automata Theory unit 5Formal Languages and Automata Theory unit 5
Formal Languages and Automata Theory unit 5Srimatre K
 
Formal Languages and Automata Theory unit 4
Formal Languages and Automata Theory unit 4Formal Languages and Automata Theory unit 4
Formal Languages and Automata Theory unit 4Srimatre K
 
Formal Languages and Automata Theory unit 3
Formal Languages and Automata Theory unit 3Formal Languages and Automata Theory unit 3
Formal Languages and Automata Theory unit 3Srimatre K
 
Formal Languages and Automata Theory unit 2
Formal Languages and Automata Theory unit 2Formal Languages and Automata Theory unit 2
Formal Languages and Automata Theory unit 2Srimatre K
 

More from Srimatre K (10)

ML_ Unit 2_Part_B
ML_ Unit 2_Part_BML_ Unit 2_Part_B
ML_ Unit 2_Part_B
 
ML_Unit_2_Part_A
ML_Unit_2_Part_AML_Unit_2_Part_A
ML_Unit_2_Part_A
 
ML_Unit_1_Part_C
ML_Unit_1_Part_CML_Unit_1_Part_C
ML_Unit_1_Part_C
 
ML_Unit_1_Part_B
ML_Unit_1_Part_BML_Unit_1_Part_B
ML_Unit_1_Part_B
 
Internet of things unit-1
Internet of things unit-1Internet of things unit-1
Internet of things unit-1
 
ML_ Unit_1_PART_A
ML_ Unit_1_PART_AML_ Unit_1_PART_A
ML_ Unit_1_PART_A
 
Formal Languages and Automata Theory unit 5
Formal Languages and Automata Theory unit 5Formal Languages and Automata Theory unit 5
Formal Languages and Automata Theory unit 5
 
Formal Languages and Automata Theory unit 4
Formal Languages and Automata Theory unit 4Formal Languages and Automata Theory unit 4
Formal Languages and Automata Theory unit 4
 
Formal Languages and Automata Theory unit 3
Formal Languages and Automata Theory unit 3Formal Languages and Automata Theory unit 3
Formal Languages and Automata Theory unit 3
 
Formal Languages and Automata Theory unit 2
Formal Languages and Automata Theory unit 2Formal Languages and Automata Theory unit 2
Formal Languages and Automata Theory unit 2
 

Recently uploaded

Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
Planning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxPlanning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxLigayaBacuel1
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 

Recently uploaded (20)

Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
Rapple "Scholarly Communications and the Sustainable Development Goals"
Rapple "Scholarly Communications and the Sustainable Development Goals"Rapple "Scholarly Communications and the Sustainable Development Goals"
Rapple "Scholarly Communications and the Sustainable Development Goals"
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Planning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxPlanning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptx
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 

Formal Languages and Automata Theory Unit 1

  • 1. Formal Languages and Automata Theory Presented By: K Lakshmi Sravani(Asst Professor)
  • 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.
  • 13. Input/states 0 1 —>Q0 Q1 Q2 Q1 Q0 Q2 *Q2 Q2 Q2
  • 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.
  • 27.
  • 28.
  • 30. Examples of FA Refer Document
  • 31. FA-1
  • 32. FA -2
  • 33. FA-3
  • 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),∑))
  • 40. Example:Any no of 0's followed by any 1’s followed by 2’s
  • 41.
  • 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.