0% found this document useful (0 votes)
2 views

MOD 1 TOC

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

MOD 1 TOC

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

TOC http://www.youtube.

com/c/EDULINEFORCSE
STUDENTS

Course Name : Theory Of Computation (TOC)


Course Code : CS301

Prepared by EBIN P.M , Assistant Professor , IESCE 1

MODULE 1
INTRODUCTION TO AUTOMATA THEORY &
ITS SIGNIFICANCE

Prepared by EBIN P.M , Assistant Professor , IESCE 2

Prepared By Mr. EBIN PM, AP, IESCE 1


TOC http://www.youtube.com/c/EDULINEFORCSE
STUDENTS

Introduction of Theory of Computation (TOC)

Theory Of Computation (TOC) is also known as


Automata theory
TOC is a theoretical branch of Computer Science and
Mathematics, which mainly deals with the logic of computation
with respect to simple machines, referred to as automata.
Automata - An automaton (Automata in plural) is an abstract
self-propelled computing device which follows a
predetermined sequence of operations automatically.
• An automaton with a finite number of states is called a Finite
Automaton (FA) or Finite State Machine (FSM)
Prepared by EBIN P.M , Assistant Professor , IESCE 3

• Automata is a machine that can accept the Strings of a Language


L over an input alphabet Σ.

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

Prepared by EBIN P.M , Assistant Professor , IESCE 4

Prepared By Mr. EBIN PM, AP, IESCE 2


TOC http://www.youtube.com/c/EDULINEFORCSE
STUDENTS

Strings – Sequence of symbols taken from Σ.


Eg: a, b, aa, ab, abc,…….
• Length of a string: It is the number of symbols present in a string.
It is denoted by |S|.
Eg: if S=cabcad. Then |S|=6
• Empty string : if |S|=0, it is called empty string (denoted by  or λ)

Q: Find the number of finite 2 length string using the alphabet


Σ={a,b,c} ?
Ans : aa, ab, ac, ba, bb, bc, ca, cb, cc

Prepared by EBIN P.M , Assistant Professor , IESCE 5

 Let alphabet Σ={a,b}. How many strings of length 2 is possible


from this alphabet?
Ans : aa, ab, ba, bb . (2 = 4)
How many strings of length n are possible from this alphabet
Ans = {a,b} {a,b} {a,b}…………n
= 2 × 2× 2×2×………….n
=𝟐𝒏 (Since we have only 2 symbols in this alphabet, we got 2 )
• If number of symbols in Σ is |Σ| , then number of strings of length n
possible over |Σ| is |𝚺|𝐧

Prepared by EBIN P.M , Assistant Professor , IESCE 6

Prepared By Mr. EBIN PM, AP, IESCE 3


TOC http://www.youtube.com/c/EDULINEFORCSE
STUDENTS

Language – Collection of strings.


Let Σ = {a,b}, then languages can be define like
L₁ = set of all strings of length 2
= {aa, ab, ba, bb} It is a finite set . So, L₁ is a Finite Language.
L₂ = set of all strings of length 3
= {aaa, aab, aba, abb, baa, bab, bba, bbb}. It is a finite set. So L₂
is a Finite Language
L₃ = set of all strings where each string starts with ‘a’.
= {a, aa, ab, aaa, aab, aba, abb, ……………}. It is an infinite set. So L₃
is an Infinite Language.
Language can be Finite or Infinite
Prepared by EBIN P.M , Assistant Professor , IESCE 7

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

Prepared By Mr. EBIN PM, AP, IESCE 4


TOC http://www.youtube.com/c/EDULINEFORCSE
STUDENTS

𝚺 ∗
• 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, ………}

Prepared by EBIN P.M , Assistant Professor , IESCE 10

Prepared By Mr. EBIN PM, AP, IESCE 5


TOC http://www.youtube.com/c/EDULINEFORCSE
STUDENTS

Where we use Languages, strings in practical applications?


• Consider C programming Language. The symbols used in C are {a,
b,….z, A, B,….Z, 0, 1, 2,…...9, +, *, #,….. }. It is a finite set of symbols.
This set is actually Alphabet Σ.
• Σ = {a, b,….z, A, B,….Z, 0, 1, 2,…...9, +, *, #,….. }
• Using this alphabet we are forming strings , shown below
void main()
{
Int a, b; (In C, it is a program. But in TOC, it is a string)
……….
……….
}

Prepared by EBIN P.M , Assistant Professor , IESCE 11

What is C programming language? . It is a set of all valid programs.


What are the valid programs? How can we say a program is valid or
not?
We know that, there are infinite number of valid programs are
possible in C language. Ie, {p₁, p₂, p₃…….}
• Suppose, given a C program Pn, how can we say that it is valid? One
solution is that to save all possible programs and check it with our
program Pn. Since computer has a finite memory and set of all valid
programs are infinite, we can’t do this technique.
• Ie, we can give a Language L and a string S and check whether this
string is a part of this language or not. If the language is finite, we
can find it but if the language is infinite it is not possible
Prepared by EBIN P.M , Assistant Professor , IESCE 12

Prepared By Mr. EBIN PM, AP, IESCE 6


TOC http://www.youtube.com/c/EDULINEFORCSE
STUDENTS

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

Prepared by EBIN P.M , Assistant Professor , IESCE 13

What is Finite representation

The finite representation is called FINITE AUTOMATA (FA), which


is a small machine.

Prepared by EBIN P.M , Assistant Professor , IESCE 14

Prepared By Mr. EBIN PM, AP, IESCE 7


TOC http://www.youtube.com/c/EDULINEFORCSE
STUDENTS

Let alphabet Σ={a,b}. Consider the language L₁=set of all strings


which starts with “a”.
L₁ = {a, aa, ab, aaa,………} which is infinite.
• The finite representation of the above language is given as
follows. It is called Finite Automata (FA).
* The circles are called states.
* A, B and C are states.
* A is called initial state
* B is called final state

Prepared by EBIN P.M , Assistant Professor , IESCE 15

Eg: Consider a string “aab” . We can find whether this string is a


part of the above language or not using the following FA
a a b
A B B B

• Up on scanning the entire string, the state is in final state. We


reach from initial state to final state. So, the string is accepted.

Prepared by EBIN P.M , Assistant Professor , IESCE 16

Prepared By Mr. EBIN PM, AP, IESCE 8


TOC http://www.youtube.com/c/EDULINEFORCSE
STUDENTS

Eg: Consider a string “bba” . We can find whether this string is a


part of the above language or not using the following FA
b b a
A C C C

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

Prepared by EBIN P.M , Assistant Professor , IESCE 17

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

Prepared By Mr. EBIN PM, AP, IESCE 9


TOC http://www.youtube.com/c/EDULINEFORCSE
STUDENTS

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

Prepared by EBIN P.M , Assistant Professor , IESCE 19

Finite
Automata
(FA)

FA with FA without
output output

Moore Mealy
Machine Machine
DFA NFA -NFA

Prepared by EBIN P.M , Assistant Professor , IESCE 20

Prepared By Mr. EBIN PM, AP, IESCE 10


TOC http://www.youtube.com/c/EDULINEFORCSE
STUDENTS

Deterministic Finite Automata (DFA)


• Consider the following FA
Here Q = (Set of all states) A, B, C
Σ = (input alphabet) {a, b}
q₀ = (start state) A
F = (set of all final states) B
More than one final state is possible.
The relation between all the states and the final state is Q Ↄ F.
Q, Σ, q₀ and F are common for DFA , NFA and -NFA. The only
change is in .
Prepared by EBIN P.M , Assistant Professor , IESCE 21

•  is a transition function from Q×Σ → Q


That is {A, B, C} × {a, b}
= (A,a) (A,b) (B,a) (B,b) (C,a) (C,b)
 : Q×Σ → Q
{A, B, C} × {a, b}

(A, a) A
(A, b)
(B, a) B
(B, b)
(C, a) C
(C, b)

Prepared by EBIN P.M , Assistant Professor , IESCE 22

Prepared By Mr. EBIN PM, AP, IESCE 11


TOC http://www.youtube.com/c/EDULINEFORCSE
STUDENTS

A Finite Automata(FA) is said to be deterministic, if corresponding


to an input symbol, there is single resultant state i.e. there is only
one transition.
Eg: DFA is used in Compiler Design.
Construction of DFA
Q: Construct a DFA that accepts set of all strings over {a, b} of length 2
• First, identify Σ
Σ= {a, b}
• Second, identify language
L = {aa, ab, ba, bb}

Prepared by EBIN P.M , Assistant Professor , IESCE 23

• Take the smallest string, “aa” from the language L={aa, ab, ba, bb}
• Construct a skeleton

(a) (b)

(c)
(d)

Prepared by EBIN P.M , Assistant Professor , IESCE 24

Prepared By Mr. EBIN PM, AP, IESCE 12


TOC http://www.youtube.com/c/EDULINEFORCSE
STUDENTS

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

Prepared by EBIN P.M , Assistant Professor , IESCE 25

String Accept : Scan the entire string and if we reach a final


state from the initial state, we can say that the string is
accepted. (more than one final state is possible)
Language Accept : A finite automata is said to accept a
language, if all the strings in the language are accepted and all
the strings not in the language are rejected.
• The following FA accepts all the string in the language L={aa,
ab, ba, bb}. Here the same state act as initial and final states.
But it does not satisfies the second condition, because it accept
anything.

Prepared by EBIN P.M , Assistant Professor , IESCE 26

Prepared By Mr. EBIN PM, AP, IESCE 13


TOC http://www.youtube.com/c/EDULINEFORCSE
STUDENTS

Q: Construct a DFA that accepts set of all strings w over {a, b}


where |w|≥2
Ans : Σ={a,b}
L={aa, ab, ba, bb, aaa,……,bbb……..} this is infinite language.
• If a language is finite, we can create finite automata.
• If a language is infinite, we can’t predict whether it able to give
FA or not. We shall try to give a finite automata for this.
• Take the smallest string “aa”

Prepared by EBIN P.M , Assistant Professor , IESCE 27

Q: Construct a DFA that accepts set of all strings w over {a, b}


where |w|≤ 2 (at most 2)
Ans: Σ={a,b}
L={, a, b, aa, ab, ba, bb} this is a finite language. So we can
create FA definitely.

• In the language  is there and ||=0. So to accept  we


should make the initial state as final state.
• State B will accept one length strings. D is dead state.
• One language can have many DFA. But only one minimal DFA
Prepared by EBIN P.M , Assistant Professor , IESCE 28

Prepared By Mr. EBIN PM, AP, IESCE 14


TOC http://www.youtube.com/c/EDULINEFORCSE
STUDENTS

Comparison

If |w|= n, then states required in minimal DFA is n+2


If |w|≥ n, then states required in minimal DFA is n+1
If |w|≤ n, then states required in minimal DFA is n+2
There can be many possible DFAs for a pattern. A DFA with
minimum number of states is generally preferred.
Prepared by EBIN P.M , Assistant Professor , IESCE 29

Q: Construct a DFA that accepts set of all strings w over {a, b}


where |w|≤ 3 (at most 3)
Ans: Σ={a,b}
L={, a, b, aa, ab, ba, bb, aaa, abb, aab,……}

Prepared by EBIN P.M , Assistant Professor , IESCE 30

Prepared By Mr. EBIN PM, AP, IESCE 15


TOC http://www.youtube.com/c/EDULINEFORCSE
STUDENTS

Q: Construct a minimal DFA which accepts set of all strings w over


{a,b} such that |w|mod 2=0. (ie, even length strings)
L={, aa, ab, ba, bb, aaaa,…….bbbb….}. The Language is infinite.

• 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

Prepared by EBIN P.M , Assistant Professor , IESCE 32

Prepared By Mr. EBIN PM, AP, IESCE 16


TOC http://www.youtube.com/c/EDULINEFORCSE
STUDENTS

Based on the previous question, we can create a DFA which


accept odd length strings. (|w|mod 2=1)

Prepared by EBIN P.M , Assistant Professor , IESCE 33

Q: Construct a minimal DFA which accepts set of all strings w over


{a,b} such that |w|mod 3= 0. (ie, length of string is divisible by 3)
L={, aaa,bab, ….bbb, …..aaaaaa,…..bbbbbb,……..} infinite.
• If we divide a number using 3, the possible remainders are 0, 1
or 2. So, to distinguish the remainders, we need 3 states.

Prepared by EBIN P.M , Assistant Professor , IESCE 34

Prepared By Mr. EBIN PM, AP, IESCE 17


TOC http://www.youtube.com/c/EDULINEFORCSE
STUDENTS

Q: Construct a minimal DFA which accepts set of all strings w over


{a,b} such that |w|mod 3= 1. (|w|≡1mod 3)

• Let, the length of string |w|mod n=0, then minimal DFA


contains n number of state.

Prepared by EBIN P.M , Assistant Professor , IESCE 35

Q: Construct a minimal DFA which accepts set of all strings w over


{a,b} such that 𝑛 (w)=2.(number of ‘a’ in a string should be two)
L={aa, baa, aba, aab, bbaa…….}. It is infinite

• Here, ‘b’ should never contribute the counting because we only


consider the number of a’s.
• There is no transition while seeing ‘b’ and we kept out of
counting.
Prepared by EBIN P.M , Assistant Professor , IESCE 36

Prepared By Mr. EBIN PM, AP, IESCE 18


TOC http://www.youtube.com/c/EDULINEFORCSE
STUDENTS

Q: Construct a minimal DFA which accepts set of all strings w over


{a,b} such that 𝑛 (w)≥2.(number of ‘a’ in a string should be ≥2)
L={aa, baaa, aaaab, abab…….}. It is infinite

Prepared by EBIN P.M , Assistant Professor , IESCE 37

Q: Construct a minimal DFA which accepts set of all strings w over


{a,b} such that 𝑛 (w)≤ 2.(number of ‘a’ in a string should be ≤ 2)
L={,a, ab, ba, aa , baa, aba,……}. It is infinite

Prepared by EBIN P.M , Assistant Professor , IESCE 38

Prepared By Mr. EBIN PM, AP, IESCE 19


TOC http://www.youtube.com/c/EDULINEFORCSE
STUDENTS

Q: Construct a minimal DFA which accepts set of all strings w over


{a,b} such that 𝑛 (w)mod 2 =0
L={, aa , baa, aba, aaaa, abab,……}. It is infinite

Prepared by EBIN P.M , Assistant Professor , IESCE 39

Q: Construct a minimal DFA which accepts set of all strings w over


{a,b} such that 𝑛 (w)mod 2 =0 and 𝑛 (w)mod 2 =0 (That is,
number of a’s and number of b’s should be even)
• All the even number of strings need not contains, even number
of a’s and even number of b’s.
L={, aa, bb, aabb, abab, bbbb,…..}
𝒏𝒂 (w) 𝒏𝒃 (w) Example
Even Even , aa, bb
Even Odd aab
Odd Even aaabb
Odd Odd ab

Prepared by EBIN P.M , Assistant Professor , IESCE 40

Prepared By Mr. EBIN PM, AP, IESCE 20


TOC http://www.youtube.com/c/EDULINEFORCSE
STUDENTS

Prepared by EBIN P.M , Assistant Professor , IESCE 41

Nondeterministic Finite Automata (NFA)


A Finite Automata(FA) is said to be non deterministic, if there is
more than one possible transition from one state on the same
input symbol.
If we are starting from some state (say q₁), on seeing the input
w, it will go to many state include nothing state(ϕ).

Prepared by EBIN P.M , Assistant Professor , IESCE 42

Prepared By Mr. EBIN PM, AP, IESCE 21


TOC http://www.youtube.com/c/EDULINEFORCSE
STUDENTS

Nondeterministic machines are not real. (no real machines exist)


If we want to do exhaustive search and backtracking, Non-
determinism can be used.
If we don’t want to do any backtracking, determinism is used.
NFA has a different transition function, rest is same as DFA.
NFA 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
Prepared by EBIN P.M , Assistant Professor , IESCE 43

• Consider the example


Construct NFA which accept set of all strings over Σ={a,b} in which
every string ends with ‘a’.
Here language L={a, aa, ba,…..}
Lets take the string ‘a’
On seeing ‘a’, the state A go to state A or
state B. This is non-determinism. If at least
one state will be final, then we can say
that the string is accepted.

Prepared by EBIN P.M , Assistant Professor , IESCE 44

Prepared By Mr. EBIN PM, AP, IESCE 22


TOC http://www.youtube.com/c/EDULINEFORCSE
STUDENTS

• Lets take another string ‘ab’, which is not in our language.

• Here , A and ϕ are not final states. So the string ‘ab’ is rejected.
Now we can define the transition function of NFA
δ:Q×Σ→ 𝐐

• 2 is the power set of Q . That is, all possible subset of Q. Lets


check how it works.

Prepared by EBIN P.M , Assistant Professor , IESCE 45

δ:Q×Σ→ 𝑸

Q= {A, B} Σ={a, b}
Q×Σ 2

(A, a) ϕ
(A, b) {A}
(B, a) {B}
(B, b) {A,B}

Prepared by EBIN P.M , Assistant Professor , IESCE 46

Prepared By Mr. EBIN PM, AP, IESCE 23


TOC http://www.youtube.com/c/EDULINEFORCSE
STUDENTS

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’

Prepared by EBIN P.M , Assistant Professor , IESCE 47

Q: construct NFA which accepts set of all strings over Σ={a,b}

Prepared by EBIN P.M , Assistant Professor , IESCE 48

Prepared By Mr. EBIN PM, AP, IESCE 24


TOC http://www.youtube.com/c/EDULINEFORCSE
STUDENTS

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.

Prepared by EBIN P.M , Assistant Professor , IESCE 49

CONVERSION OF NFA TO DFA


Q : Construct NFA which accepts set of all strings over Σ={a,b}
which starts with ‘a’ and convert to DFA

• The above diagram is called state transition diagram.


• To convert NFA to DFA many methods are possible. Here we use
Subset Construction Method.
Prepared by EBIN P.M , Assistant Professor , IESCE 50

Prepared By Mr. EBIN PM, AP, IESCE 25


TOC http://www.youtube.com/c/EDULINEFORCSE
STUDENTS

STEP1: Draw state transition table for the NFA


NFA

STEP2: Draw state transition table for DFA from the above table
Here D indicates dead state

Prepared by EBIN P.M , Assistant Professor , IESCE 51

STEP3 : Draw state transition diagram for DFA

Here, for every state we shows what happens on a or b.

Prepared by EBIN P.M , Assistant Professor , IESCE 52

Prepared By Mr. EBIN PM, AP, IESCE 26


TOC http://www.youtube.com/c/EDULINEFORCSE
STUDENTS

Convert to DFA

State transition table for the above NFA Corresponding state transition table for
DFA

Prepared by EBIN P.M , Assistant Professor , IESCE 53

Q: Find the equivalent DFA for the following NFA?

Prepared by EBIN P.M , Assistant Professor , IESCE 54

Prepared By Mr. EBIN PM, AP, IESCE 27


TOC http://www.youtube.com/c/EDULINEFORCSE
STUDENTS

Corresponding state transition table for


State transition table for the above NFA DFA

Prepared by EBIN P.M , Assistant Professor , IESCE 55

DFA

Prepared by EBIN P.M , Assistant Professor , IESCE 56

Prepared By Mr. EBIN PM, AP, IESCE 28


TOC http://www.youtube.com/c/EDULINEFORCSE
STUDENTS

 - NFA
•  is an empty string.

• It can be defined as (Q, Σ, , q₀, F)


•  : Q×Σ U {} →𝟐𝐐
• From a particular state, on seeing an input symbol or without
seeing something (), a transition occurs. It is also called -closure
Prepared by EBIN P.M , Assistant Professor , IESCE 57

 -closure (∗ )
• -closure(A)

Prepared by EBIN P.M , Assistant Professor , IESCE 58

Prepared By Mr. EBIN PM, AP, IESCE 29


TOC http://www.youtube.com/c/EDULINEFORCSE
STUDENTS

Conversion of -NFA to NFA

-closure((-closure(A), 0))

Prepared by EBIN P.M , Assistant Professor , IESCE 59

Prepared by EBIN P.M , Assistant Professor , IESCE 60

Prepared By Mr. EBIN PM, AP, IESCE 30


TOC http://www.youtube.com/c/EDULINEFORCSE
STUDENTS

Prepared by EBIN P.M , Assistant Professor , IESCE 61

Prepared by EBIN P.M , Assistant Professor , IESCE 62

Prepared By Mr. EBIN PM, AP, IESCE 31


TOC http://www.youtube.com/c/EDULINEFORCSE
STUDENTS

Some state can reach to final


state only on seeing  ,that state
should be a final state.

Prepared by EBIN P.M , Assistant Professor , IESCE 63

Prepared By Mr. EBIN PM, AP, IESCE 32

You might also like