0% found this document useful (0 votes)
121 views45 pages

Atcd Unit 1

The document covers the fundamentals of Finite Automata and Automata Theory, including the need for automata, the Chomsky hierarchy, and the concepts of language, automata, and grammar. It explains the operations on alphabets and strings, as well as basic operations on languages such as union, intersection, and concatenation. Additionally, it discusses the significance of automata theory in various applications, including digital design and AI.

Uploaded by

himajasimhadri
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)
121 views45 pages

Atcd Unit 1

The document covers the fundamentals of Finite Automata and Automata Theory, including the need for automata, the Chomsky hierarchy, and the concepts of language, automata, and grammar. It explains the operations on alphabets and strings, as well as basic operations on languages such as union, intersection, and concatenation. Additionally, it discusses the significance of automata theory in various applications, including digital design and AI.

Uploaded by

himajasimhadri
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/ 45

III B.

Tech AID R20 ATCD-UNIT-1

UNIT-1
Finite Automata
Syllabus:
Automata: Need for Automata Theory, Chomsky hierarchy, Acceptance of a string, Design of
NFA with Є, NFA without Є, DFA, Equivalence of NFA, DFA
Finite Automata Conversions: Conversion from NFA Є to NFA, NFA to DFA, Minimization of
DFA, Moore and Mealy Machines
Automata Theory
 Automata theory is the study of abstract computing devices or machines.
i.e., the study of what can be done by computers in principle and what can be
done in practice.
 In automata theory, we study about computers by building abstract
mathematical and model, study their limitations by analyzing the types of
inputs which they operate successfully.
Three Central Concepts of Automata Theory:
 Language: a system suitable for the expression of ideas, facts, or concepts.
 Automata: an abstract mathematical and theoretical model of a computer.
(Language Acceptor or Language Recognizer)
 Grammar: a mathematical mechanism to describe language (Language
Generator)
Need for Automata Theory:
 Automata theory provides concepts and principles that help us understand
the general nature of the computer.
 There are immediate and important applications of automata theory such as
digital design, programming languages, and compilers and so on.
 Through automata theory we are able to understand how computer compute
function and solve problems, what are computable or decidable problems.
 Finite automata are useful for building several different kinds of software
including the lexical analysis component of a compiler and systems for
verifying the correctness of circuits or protocols.
 Automata theory concepts help us understand what we can expect from our
software.
 Automata theory is used in AI to model and analyze the behaviour of
intelligent systems.
Three basic Concepts of Automata Theory:
Alphabet (∑): a finite, non-empty set of symbols.
String (w): a finite sequence of symbols chosen from some alphabet.
Language (L): a set of strings over the given alphabet.
Alphabet:
 A finite, nonempty set of symbols is called alphabet.
 Symbols in alphabet are used to form strings in the language.
 Conventionally we use the symbol ∑ for an alphabet.
Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 1
III B.Tech AID R20 ATCD-UNIT-1

 Alphabet must be finite and non-empty.


 Common alphabets include:

Note:
 Symbols are indivisible (atomic) objects or entity that cannot be defined.
 Symbol is any single object such as a,b,0,1,#,$
String:
 A finite sequence of symbols chosen from some alphabet is called string.
i.e.; a string over ∑is a finite sequence of symbols in ∑
 String must be finite but can be empty or non-empty.
 For example, if the alphabet Σ = {a, b}, then abab and aaabbba are strings
on Σ.
 For example, if the alphabet Σ = {0, 1}, then 011100, 00000,11111,1010101
are strings on Σ.
 The set of all strings over ∑ will be written ∑*
Language:
 A set of strings drawn from some alphabet is called language.
 A language over ∑ is a subset of ∑* i.e.; L  ∑*
 Language can be empty or non-empty and finite or non-finite.

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 2
III B.Tech AID R20 ATCD-UNIT-1

Note:
 Σ, Σ*,  , { } are languages.
 Smallest language over Σ is 
 Largest language over is Σ is Σ *
 A language over Σ need not includes strings with all the symbols of Σ
 Languages can have an infinite number of strings are restricted to consist of
strings drawn from one fixed finite alphabet.
Note:
 Alphabet and string must be finite but language can be finite or infinite.
 Alphabet must be non-empty but string and language can be empty or non-empty.
Operation on Alphabet:
(Powers of Alphabet)
 If Σ is an alphabet, we can express the set of all strings of a certain length
from that alphabet by using an exponential notation. We define Σk to be
the set of strings of length k, each of whose symbols is in Σ.
Σk = { w / |w| =k & w is string drawn from Σ }
Example: If Σ = {0, 1}, then Σ1 = {0, 1}, Σ2 = {00, 01, 10, 11},
Σ3 = {000,001,010,011,100,101,110,111} and so on.
 Note that Σ0 = {ε}, regardless of what alphabet Σ is. That is, ε is the only
string whose length is 0.
 If Σ is an alphabet, then we use Σ* to denote the set of strings obtained by
concatenating zero or more symbols from Σ. The set Σ* always contains 

∑* = ∑0  ∑1  ∑2.... = i 0 ∑i = {w/ |w| >=0 & w is string formed
using ∑ }
 If Σ is an alphabet, then we use Σ to denote the set of strings obtained by
+

concatenating one or more symbols from Σ.



∑+ = ∑1  ∑2  ∑3.... = i 1 ∑i = {w/ |w| >=1& w is string formed
using ∑}
 Note that there is a slight confusion between Σ and Σ1. The former is an
alphabet; its members 0 and 1 are symbols. The latter is a set of strings;
its members are the strings 0 and 1, each of which is of length 1.
 ∑ is always finite but ∑* and ∑+ are always infinite.
 Note that
 ∑+  ∑*
 ∑* = ∑+  { }
 ∑+ = ∑* - {  }
 ∑*  ∑+ = ∑+
 ∑*  ∑+ = ∑*
 ∑* . ∑+ = ∑+
 ∑+ . ∑* = ∑+

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 3
III B.Tech AID R20 ATCD-UNIT-1

 ∑* . ∑ * = ∑*
 ∑+ . ∑+ = ∑+ - ∑1
 ∑ . ∑* = ∑*.∑ = ∑+
Basic Operations on Strings:
1. Length of string
2. Concatenation of string
3. Reverse of string
4. Substring
5. Prefix and Suffix of string
6. Subsequence
Length:
 The length of a string w, denoted by |w|, is the number occurrence of symbols
in the string. i.e.; Number of positions for symbols in the string.
 For instance string 01101 has length 5
 We will frequently need to refer to the empty string, which is a string
with no symbols at all. It will be denoted by  .
 For example |01101| = 5 , || = 0
Note:
  is only string whose length is 0
Concatenation:
 If x and y are two strings over an alphabet, the concatenation of x and y is
written xy and consists of the symbols of x followed by those of y.
 If x = ab and y = bab, for example, then xy = abbab and yx = babab.
 When we concatenate the null string  with another string, the result is
just the other string (for every string x, x = x = x);
 In general, for two strings x and y, |xy| = |x| + |y|.
 wk represent string obtained by concatenating string w, k times
Ex: If w=ab then w3 = abababa
Reverse:
 The reverse of a string is obtained by writing the symbols in reverse
order.
 If w is a string w = a1a2 ... an, then its reverse wR is wR = an ... a2 a1.
 For example, if abbaaa is string, then its reverse is aaabba
 In general |w| =|wR|
Substring
 Any string of consecutive symbols in some string w is said to be substring
of w.
 For example, if w = abcd then {, a, b, c, d, ab, bc, cd, abc, bcd, abcd} is
the set of all its substrings.

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 4
III B.Tech AID R20 ATCD-UNIT-1

Prefix and Suffix:


 A prefix of a string is a substring of leading symbols of that string.
 A suffix of a string is a substring of trailing symbols of that string,
 For example, if w = abbab, then {, a, ab, abb, abba, abbab} is the set of
all prefixes of w, while {abbab, bbab, bab, ab, b, } is the set of all its
suffixes.
Subsequence:
 A subsequence is any sequence that can be derived from the string by
deleting some (or no) characters without changing the order of the
remaining characters.
 For a string of length n, each character can either be included or not
included in a subsequence.
 Therefore, there are 2n possible subsequences, including the empty
subsequence.
For a string of length n:
n(n  1)
Number of substrings:  1 (including the empty string)
2
Number of prefixes: n+1 (including the empty string)
Number of suffixes: n+1 (including the empty string)
Number of subsequences: 2n (including the empty subsequence)
Note:
 The string  is a prefix of every string, a suffix of every string, and a substring
of every string and subsequence of every string.
 Every string is a prefix, a suffix, substring and a subsequence of itself.
Basic Operations on Languages:
1. Union
2. Intersection
3. Difference
4. Complement
5. Concatenation
6. Reverse
7. Kleene Closure
8. Positive Closure
Union:
 If L1 and L2 are two languages over an alphabet Σ. Then the union of L1
and L2 is denoted by L1 U L2 is {x | x is in L1 or L2}.
 Example: L1= {0, 01,011} and L2= {001}, then
L1 U L2 = {0, 01,011,001}
Intersection:
 If L1 and L2 are two languages over an alphabet Σ. Then the intersection
of L1 and L2 is denoted by L1 ∩ L2, is {x | x is in L1 and L2}.
 Example: L1= {0, 01,011} and L2 = {01}, then L1 ∩ L2= {01}
Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 5
III B.Tech AID R20 ATCD-UNIT-1

Difference:
 If L1 and L2 are two languages over an alphabet Σ. Then the difference of
L1 and L2 is denoted by L1 - L2.
 Example: L1= {0, 01,011} and L2= {01}, then L1 - L2= {0,011}
Complement:
 The complement of a language is defined with respect to Σ*; that is, the
complement of L is

 Example:
If Σ = {a,b} and L={a,b,aa} then
L = Σ* - L={ ε,a,b,aa,bb,ab.........}-{a,b,aa} = {ε,bb,ab,ba.........}
Reverse:
 The reverse of a language is the set of all string reversals, that is,

 Example:
If L= {0, 011, 0111}, then LR = {0, 110, 1110}
Concatenation:
 The concatenation of two languages L1 and L2 is the set of all strings
obtained by concatenating any element of L1 with any element of L2;
specifically,

 For example L1 = {hope, fear} and L2 = {less, fully} then


L1L2= {hopeless, hopefully, fearless, fearfully}
 For example, {a, aa}{, b, ab} = {a, ab, aab, aa, aaab}. Because x = x
for every string x.
 We have {}L = L{} = L
 Li = L.L.L. ... (i times)

Kleene Closure:

For a language L over an alphabet ∑, we use the notation L* to denote the
language of all strings that can be obtained by concatenating zero or more
strings in L.

This operation on a language L is known as the Kleene star, or Kleene
closure, after the mathematician Stephen Kleene.


=  i 0
L

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 6
III B.Tech AID R20 ATCD-UNIT-1

Positive Closure
 For a language L over an alphabet Σ, we use the notation L + to denote the
language of all strings that can be obtained by concatenating one or more
strings in L. This operation on a language L is known as the positive
closure.


= i 1
Li

Note:
 Lk : set of all strings that can be obtained by concatenating k strings of L
 ∑k : set of strings of length k each of whose symbols is in ∑
 wk: string obtained by concatenating w, k times
 ak : string obtained by concatenating a, k times
 L0 = {}
 ∑0 = {}
 w0 = 
 a0 = 
L. = L
L.  = 
 * = {}
{}* ={}
L+ = L* if L contains 
(L*)* = L*
 k =  for k>0

Chomsky Hierarchy
 The Chomsky hierarchy is a classification of formal languages based on their
generative power. Proposed by Noam Chomsky in 1956, this hierarchy
categorizes languages into four types: Type 0, Type 1, Type 2, and Type 3.
Each type corresponds to a specific class of automaton that can recognize or
generate the languages in that category.
 i.e.; the four classes of languages: regular, context-free, context-sensitive, and
recursively enumerable—make up what is often referred to as the Chomsky
hierarchy.
 Each level in the Chomsky hierarchy is a strict superset of the levels
below it, meaning every regular language is context-free, every context-
free language is context-sensitive, and every context-sensitive language is
recursively enumerable.

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 7
III B.Tech AID R20 ATCD-UNIT-1

 The classes are nested, with type 0 being the largest and most general,
and type 3 being the smallest and most restricted.
 Chomsky Hierarchy contains 4 classes of languages, each having a
corresponding model of computation and a corresponding type of grammar.
 Regular Grammar(RG) generates regular language(RL) which is accepted by
Finite Automata(FA)
 Context Free Grammar(CFG) generates Context Free Language(CFL) which
is accepted by Push Down Automata(PDA)
 Context sensitive Grammar(CSG) generates Context Sensitive
Language(CSL) which is accepted by Linear Bounded Automata(LBA)
 Recursive Enumerable Grammar(REG) generates Recursive Enumerable
Language(REL) which is accepted by Turing Machine(TM)
 A language L is recursively enumerable if there is a TM that accepts L.
 A language is a context-sensitive language (CSL) if it can be generated by a
context-sensitive grammar.

 Regular languages are the simplest and most restrictive class in the hierarchy
and are used to describe simple patterns like those found in regular
expressions.
Finite Automata Model
 A FA is model that has a finite set of states and control moves from one state
to another state in response to external inputs.
i.e.; FA involves states and transitions among states in response to inputs

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 8
III B.Tech AID R20 ATCD-UNIT-1

The various components of FA are explained as follows:


 Input Tape: The input tape is divided into squares (or cells), each square
containing a single symbol from the input alphabet.
 Reading Head: The head examines only one square at a time and can
move one square to the right side. Initially the head is places at the
leftmost square of the tape
 Finite Control: It can be in any of a finite number of states and change the
state in some defined manner. Initially finite control is set to initial
state(starting sate)
Types of FA
 Finite automata (FA) can be broadly classified into two types:
1. Finite automata without output
 Deterministic Finite Automata(DFA)
 Non deterministic Finite Automata(NFA or NDFA)
 Non deterministic finite automata with ∈(NFA-∈ or ∈-NFA)
2. Finite automata with output
 Moore Machine
 Mealy Machine
Deterministic Finite Automata(DFA)
 In DFA, for each input symbol, one can uniquely determine the state to which
the machine will move. Hence, it is called Deterministic Automata. As it
has a finite number of states, the machine is called Deterministic Finite
Machine or Deterministic Finite Automata.
 The term deterministic refers to the fact that on each input there is one and
only one state to which the automaton can transition from its current state.
 A Deterministic Finite Automata or DFA is defined by the quintuple
M = (Q, Σ, δ, q0, F), where
Q is a finite, nonempty set of states,
Σ is a finite, nonempty set of symbols called the input alphabet,
δ: Q × Σ → Q is a transition function,
q0: is the initial state (starting state), q0 Q, Always one
F: is a set of final states (accepting states), F  Q, 0  |F|  |Q|
Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 9
III B.Tech AID R20 ATCD-UNIT-1

Example:

The graph in above Figure represents the DFA , M =({q0,q1,q2},{0, 1},δ,q0,{q1}),


where δ is given by

Note:
 The term deterministic refers to the fact that on each input there is one and only
one state to which the automaton can transition from its current state.
DFA operation:
 A deterministic finite automata operates in the following manner:
 At the initial time, it is assumed to be in the initial state q0, with its
input mechanism on the leftmost symbol of the input string. During
each move of the automaton, the input mechanism advances one
position to the right, so each move consumes one input symbol.
When the end of the string is reached, the string is accepted if the
automaton is in one of its final states. Otherwise the string is
rejected.
 The input mechanism can move only from left to right and reads
exactly one symbol on each step. The transitions from one internal
state to another are governed by the transition function δ
Notations for DFA:
 There are two preferred notations for representing transition function for
automata:
1. A transition diagram, which is a graph.
2. A transition table, which is a tabular listing of the δ function,
which by implication tells us the set of states and the input
alphabet.

1. Transition Diagram:
 A transition diagram for a DFA, M = (Q, Σ, δ, q0, F) is a graph defined as
follows:
 For each state in Q there is a node.

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 10
III B.Tech AID R20 ATCD-UNIT-1

 For each state q in Q and each input symbol a in Σ, let δ (q, a) = p, then
the transition diagram has an arc from node q to node p, labelled a. If
there are several input symbols that cause transitions from q to p, then
the transition diagram can have one arc, labelled by the list of these
symbols.
 There is an arrow into the start state q0, labelled Start. This arrow does
not originate at any node.
 Nodes corresponding to accepting states (those in F) are marked by a
double circle. States not in F have a single circle.

Example:

Figure: The transition diagram for the DFA accepting all strings with a substring 01
2. Transition Tables
 A transition table is a conventional, tabular representation of a function
like δ that takes two arguments and returns a value.
 The rows of the table correspond to the states, and the columns
correspond to the inputs.
 The entry for the row corresponds to state q and the column corresponds
to input a is the state δ(q, a)
 Start state is marked as arrow and final states are marked with asterisk.
Example:

States Inputs
0 1
q0 q2 q0
*q1 q1 q1
q2 q2 q1

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 11
III B.Tech AID R20 ATCD-UNIT-1

Acceptance of a string by DFA


(Language of a DFA) or (How a DFA Processes Strings)
 A string is accepted by DFA if, starting in the start state, transition caused
by processing the symbols of that string one at time lead to an accepting
state.
i.e.; a string w is said to be accepted by a DFA, M = (Q, Σ, δ, q0, F) iff
 
 (q0, w) = p, for some p in F where  is extended transition function
  
defined as:  (q, wa) =  (  (q, w), a)),  (q, ) = q
Note:
 Extended transition function maps from Q  ∑* to Q i.e.; the second
 
argument of  is a string, rather than a single symbol. We can define 
recursively by:

  (q,a) = δ(q,a)

  (q, )= δ (q, ) = q
 
  (q,wa) = δ (  (q,w),a))
 
  (q,aw) =  (δ(q,a),w))
  
  (q,wx) =  (  (q,w),x))
 In terms of transition diagram, a DFA accepts an input string w, if and
only if there is some path in the transition diagram from the start state to
some final state such that the edges labelled along this path spell out w.
Example:

Processing for the string w=11001


δ(q0,11001)
=δ(q0,1001)
=δ(q0,001)
=δ(q2,01)
=δ(q2,1)
= q1 (final state) accepted
 
Processing string using extended function  (q,aw) =  (δ(q,a),w)) :

 (q0,11001)

=  (δ(q0,1),1001)
 

=  (q0,1001)=  ( δ (q0,1),001)

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 12
III B.Tech AID R20 ATCD-UNIT-1

 

=  (q0,001) =  (δ (q0,0),01)
 

=  (q2,01) =  (δ (q2,0),1)

=  (q2,1) = δ (q2,1) =q1 (final state) Accepted
 
Processing string using extended function  (q,wa) = δ (  (q,w),a)) :

 (q0, 11001)

= δ (  (q0, 1100), 1)

= δ (δ (  (q0, 110),0),1)

= δ (δ (δ (  (q0, 11),0),0),1)

= δ(δ (δ (δ (  (q0,1),1),0),0),1)
= δ(δ (δ (δ (δ(q0,1),1),0),0),1)
= δ(δ (δ (δ (q0,1),0),0),1)
= δ(δ (δ (q0,0),0),1)
= δ(δ (q2,0),1)
= δ(q2,1) = q1 (final state) Accepted
 The language of DFA is the set of all strings that result in a sequence of
state transitions from the start state to an accepting state.
i.e.; the language accepted by a DFA, M = (Q, Σ, δ, q0, F) is the set of all
strings on Σ accepted by M.
 In formal notation,

L(M) = { w ∑* :  (q0,w)  F}
Design of DFA
(Finding DFA for given language)
 The definitions of various states in DFA are as follows:
 Starting (or Initial) State: The state where the DFA begins its
processing. There is always exactly one starting state in a DFA.
 Final (or accepting) States: States where the DFA accepts the
input string if it ends in one of these states. There can be one or
more final states in a DFA.
 Non-Accepting States: States that are not final states. The number
of non-accepting states is the total number of states minus the
number of final states.
 Dead (or Trap) States: A state from which no sequence of inputs
can lead to a final state. In a DFA for a non-empty language, there
is typically at most one dead state. This state has self-loops for all
input symbols, leading only to itself, and cannot transition to any
other state.
Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 13
III B.Tech AID R20 ATCD-UNIT-1

Steps to Design a DFA


 Designing a DFA for a specific language involves several steps. Here is a
structured approach to create a DFA:
1. Understand the Language: Clearly define the language for which we are
designing the DFA. This includes understanding the set of strings that the
language consists of and the alphabet.
2. Define the Alphabet: Identify the set of symbols (alphabet) that the DFA
will recognize.
3. Identify the States: Determine the states required for the DFA. Each
state represents a possible condition or status the DFA can be in while
processing an input string.
4. Determine the Starting State: Choose a starting state where the DFA
will begin processing the input string.
5. Define Final (Accepting) States: Identify one or more final states where,
if the DFA ends after reading the input string, the string will be accepted.
6. Establish Transition Functions: Define the transition function, which
specifies the state to which the DFA will move for each combination of
current state and input symbol.
7. Check for Completeness: Ensure that every state has a defined transition
for each symbol in the alphabet.
Facts in designing procedure of DFA:
 In the designing of DFA, first of all we have to analyze the set of strings
i.e.; understand the language for which the DFA has to be designed and
write the language for the set of strings starting with minimum string that
is accepted by DFA.
 Draw transition diagram for the minimum length string.
 Obtain the possible transitions to be made for each state on each input
symbol. i.e.; make sure that every state is check for the output state for
every input symbol of ∑.
 Make sure that no state must have two different output states for a single
input symbol.
 Make sure that there is one start state and at least one final state.
 Verify one string if required.

Note:
 Number of states in DFA:
 Starting State: 1 (always exactly one)
 Final States: At least 1 (for a non-empty language)
 Non-Accepting States: 0 or more
(Total number of states - number of final states)
 Dead States: at most 1 (0 or 1)

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 14
III B.Tech AID R20 ATCD-UNIT-1

Example 1: Design a DFA that accept set of strings, such that every string ends
with 00, over alphabet {0, 1}

Transition Diagram:

Transition Table:

Transition Function:
DFA, M = (Q, Σ, δ, q0, F) where
Q = {q0, q1, q2}
Σ = {0,1}
Start State=q0
F= {q2}
δ is defined as: δ(q0,0) =q1, δ(q0,1) = q0
δ(q1,0)=q2 , δ(q1,1) = q0
δ(q2,0) =q2 , δ(q2,1) = q0

Example1: Construct a DFA accepting all strings w over {0,1} such that the
number of l' s in w is 3 mod 4.

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 15
III B.Tech AID R20 ATCD-UNIT-1

Example 2: Construct a DFA accepting all strings over {a. b} ending in ab

Example3: Find a deterministic finite accepter that recognizes the set of all
strings on Σ= {a,b} starting with the prefix ab.

Example 3: Design a DFA for the language:

Example4: Find a DFA that accepts all the strings on {0,1}, except those
containing the substring 001.

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 16
III B.Tech AID R20 ATCD-UNIT-1

Example5: Find a deterministic finite accepter that recognizes the set of all
strings on Σ= {a,b} starting with the prefix ab.

Example6: Design a DFA to accept the language

Example7: Find DFA that accepts all strings over {0, 1} with substring 01

Problem: Find a deterministic finite accepter that recognizes the set of all strings
on Σ= {a,b} starting with the prefix aba.

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 17
III B.Tech AID R20 ATCD-UNIT-1

Problem: Construct DFA that accepts set of all strings over {0, 1} of length 2.

Problem: Design a DFA for language accepting all strings over {0, 1}containing
101 as substring.

Problem: Construct a DFA for the set of strings over{0,1} having bca as substring

Problem: Design a DFA that accept set of all strings over Σ = {a, b} with no more
than three a’s

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 18
III B.Tech AID R20 ATCD-UNIT-1

Problem: Design a DFA that accept language


L = {w/w  {0,1}* |second symbol of w is 0 and fourth symbol is 1}

Problem: Give DFA’s accepting the following languages over the alphabet {0, 1}.
(a) The set of all strings ending in 00.

(b) The set of all strings with three consecutive 0’s (not necessarily at the end

(c) The set of strings with 011 as a substring.

(d) The set of all strings whose tenth symbol from the left end is a 1.

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 19
III B.Tech AID R20 ATCD-UNIT-1

(e) The set of strings that either begin or end (or both) with 01

(f) The set of strings such that the number of 0’s is divisible by five, and the
number of 1’s is divisible by 3.

Problem: Obtain DFAs to accept strings of 0’s and 1’s having 01 as substring.

Problem: Obtain a DFA to accept strings of a’s and b’s starting with the string ab.

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 20
III B.Tech AID R20 ATCD-UNIT-1

Problem: Draw a DFA to accept string of 0’s and 1’s ending with the string 011.

Problem: Design a DFA to accept string of 0’s & 1’s, whose length is multiple of 3.

Problem: Obtain a DFA to accept strings of a’s and b’s having a sub string aa

Problem: Construct DFA accepting binary strings with two consecutive 0's.

Problem: Design a FA with ∑ = {0, 1} accepts those string which starts with 1 and
ends with 0.

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 21
III B.Tech AID R20 ATCD-UNIT-1

Problem: Let Σ = {a, b} and let L = { w ∈ Σ* | w is a nonempty string whose


characters alternate between a's and b's }. Design a DFA whose language is L.

Problem: Construct a finite automata for the language {0n | n mod 3 = 2, n ≥ 0}.

Problem: Given Σ = {a, b}, construct a DFA which recognize the language
L= {bm abn :m,n>0}.

Problem: Design FA to check whether given decimal number is divisible by three.

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 22
III B.Tech AID R20 ATCD-UNIT-1

Problem: Design a DFA to accept the binary numbers which are divisible by 5.

Problem: Construct a DFA accepting all string w over {0, 1}, such that number of
1's in w is 3 mod 4.

Problem: Design a FA for following language


L = {W|W is Binary word of length 4i (where i >= 1) such that each consecutive
block of 4 bits contains at least 2 0s}

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 23
III B.Tech AID R20 ATCD-UNIT-1

Nondeterministic Finite Automaton (NFA or NDFA)


 A FA in which some moves can’t be determined uniquely is called NFA
 NFA allows multiple transitions (zero, one or more) from the same
combination of state and input symbol
 Formally, a nondeterministic finite automaton (NFA or NDFA) is defined
as a 5-tuple (Q, ∑,, q0, F), where
 Q is a finite nonempty set of states;
 ∑ is a finite nonempty set of inputs;
  is the transition function mapping from Q x ∑ into 2Q which is the
power set of Q, the set of all subsets of Q;
 q0  Q is the initial(starting) state; and
 F  Q is the set of final (accepting) states.
 Example1:

00101

 Transition Table:

 The NFA can be specified formally as

Where is  defined as
(q0,0) = {q0,q1}

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 24
III B.Tech AID R20 ATCD-UNIT-1

(q0,1) = {q0}
(q1,0) = 
(q1,1) = {q2}
(q2,0) = 
(q2,1) = 
Example2:

Significance of NFA:
 NFA is an extension of the behaviour of DFA and in some cases greatly
simplifies the description of automata
 It is useful because constructing an NFA to recognize a given language is
sometimes much easier than constructing a DFA for that language.
 Using greater flexibility of NFA, language recognizer can be design
without actually extending the class of language.
 Certain theoretical results are more easily established for NFA's than for
DFA's.
 Non-determinism is sometimes helpful in solving problems easily.
 Non-determinism is an effective mechanism for describing some
complicated languages concisely.
 A nondeterministic algorithm that can make the best choice would be
able to solve the problem without backtracking. For this reason, Non-
deterministic mechanisms can serve as models of search and backtrack
algorithms.

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 25
III B.Tech AID R20 ATCD-UNIT-1

Differences between NFA and DFA:


NFA DFA
1. NFA stands for Nondeterministic Finite
DFA stands for Deterministic Finite Automata.
Automata.
2. Some moves of NFA can’t be determined
All moves are uniquely determined
uniquely by the input symbol and present state.
3. Allows multiple transitions from the same For each input symbol there is exactly one
combination of sate and input symbol transition out of each state
4. It is not fixed that with a specific input where It is fixed that with a specific input where to go
to go next on which state. next on which state.
5. NFA can use Empty String transition. DFA cannot use Empty String transition.
i.e can have transition on  i.e no transition on 

6. There may not be any transition defined for


Transition is defined for all pairs of state and input
the specific pair of current state and input
symbol
symbol.
i.e. the set (q,a) must be nonempty
i.e the set (q,a) may be empty

7.It is generalization of DFA It is specialization of NFA


i.e. Not all NFAs are DFA i.e. All DFAs are NFA
8.δ: Q X Σ → 2Q next possible state belongs to
δ: Q x ∑→Q next possible state belongs to Q.
power set of Q
i.e. outcome of transition function is element of Q
i.e. outcome of transition function is subset of Q
9.Each entry in transition table can have
Each entry in transition table must have single state
multiple states
DFA is more strict with rules and so difficult to
10.NFA is easier to design
design

Note:
 Accepting power of NFA= Accepting power of DFA.
 NFA is a theoretical engine and is not implementable, but it is very easy to design
compare to DFA.
 No concept of dead state, therefore complementation of DFA is also not possible.
 NFA will respond for only valid strings and no need to respond for invalid strings. (it
is a Incomplete system)

Problem: Design an NFA in which all the string over {0,1} contain a substring
1110.

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 26
III B.Tech AID R20 ATCD-UNIT-1

Design an NFA with ∑ = {0, 1} accepts all string in which the third symbol
from the right end is always 0.

Problem: Design an NFA (non-deterministic finite automata) to accept the set


of strings of 0’s and 1’s that either (a) end in 010 and have 011 somewhere
preceding, or (b) end in 101 and have 100 somewhere preceding.

Note:
 DFA: For each state and input symbol, there is exactly one transition to a next state.
 NFA: For each state and input symbol, there can be zero, one, or multiple transitions
to next states.
Conversion of NFA to DFA
 Let given NFA is M=(Q,∑,,q0,F),the equivalent DFA M’=(Q’,∑,
’,q0’,F’) can be constructed by subset construction method as fallows
i) From the states that are subset of states of given NFA ,start
construction of ’ for[q0] i,e starting state is [q0]
ii) Continue the process of constructing ’ by considering only new states
appearing earlier under input columns using
’(S,a) = U (p,a)
P in S
iii)Stop the process of constructing when no new state appear under input
columns
iv) F’(set of final sates in DFA) is the set of all subsets of Q which are
having any final state of given NFA
Example:

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 27
III B.Tech AID R20 ATCD-UNIT-1

Problem: Convert the following NFA to DFA

Transition Table of Given NFA:

State 0 1

→q0 q0 q1

q1 {q1, q2} q1

*q2 q2 {q1, q2}

Transition Table of equivalent DFA:

State 0 1

→[q0] [q0] [q1]

[q1] [q1, q2] [q1]

*[q2] [q2] [q1, q2]

*[q1, q2] [q1, q2] [q1, q2]

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 28
III B.Tech AID R20 ATCD-UNIT-1

Transition Diagram of Equivalent DFA:

Problem: Convert the given NFA to DFA.

Transition Table of Given NFA:


State 0 1

→q0 {q0, q1} {q1}

*q1 ϕ {q0, q1}


Transition Table of equivalent DFA:
State 0 1

→[q0] [q0, q1] [q1]

*[q1] ϕ [q0, q1]

*[q0, q1] [q0, q1] [q0, q1]

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 29
III B.Tech AID R20 ATCD-UNIT-1

Transition Diagram of Equivalent DFA:

Minimization of Finite Automata


(Reducing Number of States of DFA)
 The minimization of FA refers to the construction of finite automata (FA)
with a minimum number of states, which is equivalent to the given finite
automata.
 Each DFA defines a unique language but converse is not true. For a given
language there may be many DFAs that accept it.
 For each DFA, there exist an equivalent FA that has few states as any
DFA accept the same language
 Larger number of states in FA requires higher memory and computing
power.
 An NFA of n states result to 2n maximum number of states in an
equivalent DFA, therefore design of DFA is crucial.
 Minimization of a DFA refers to detecting and eliminating those states
whose absence does not affect the language acceptability of DFA. A
reduced automata, called minimum-state DFA or minimal DFA consumes
lesser memory, and complexity of implementation is reduced. This results
to faster execution time, easier to analyze.
 Minimum-state DFA(MDFA) is unique for the language
 Table filling algorithm(also called Myhill-Nerode Algorithm) can be used
to find the minimum-state DFA

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 30
III B.Tech AID R20 ATCD-UNIT-1

Procedure
(Table filling algorithm or Myhill-Nerode Algorithm)

1. Remove all the states that are unreachable from the initial state via any
set of the transition of DFA.
2. Draw the transition table for given DFA.
3. A table is constructed with an entry for each pair of states.
4. Initially X place in each entry corresponding to one final state and one
non-final state.
5. Next, X is placed in entry corresponding to the pair (p,q) if δ (q, a) = r
, δ (r, a) = s and pair(r,s) is marked as X, for any a ε ∑
6. After applying above steps for all the pairs remaining pairs are
equivalent. All equivalent pairs are merged and used with single state.
Example:

Given DFA:

Minimization Table:

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 31
III B.Tech AID R20 ATCD-UNIT-1

Minimal DFA:

Types of states:

 Unreachable states are the states that are not reachable from the initial state
of the DFA, for any input string. These states can be removed.
 Dead states are the states from which no final state is reachable. These
states can be removed unless the automaton is required to be complete
 Non-distinguishable states (Equivalent states) are those that cannot be
distinguished from one another for any input string. These states can be
merged.
i.e.; two states p, q ∈ Q are equivalent, if for every string x ∈ Σ∗ the state
that DFA reaches from p given x is accepting if and only if the state that
DFA reaches from q given x is accepting.
 Distinguishable(distinct) states:

NFA with ε-transition (NFA-ε or ε-NFA)


 The NFA with epsilon-transition is a finite state machine in which the
transition from one state to another state is allowed without any input
symbol i.e. empty string ε.
 FA that allows transition without consuming any input symbol (transition
on empty input or transition on ε or transition with no input symbol at all)
along with zero, one or more transition on input symbols is called ε-NFA
or NFA- ε.
 Formally, ε-NFA is defined as quintuple M=(Q,∑,δ,q0,F) where all
components have their same interpretation as for an NFA, except that δ is
mapping from Q ∑ U{ ε} to 2Q
 €-NFA is a 5-tuple M=(Q,∑,δ,q0,F) where:
• Q is a finite and non-empty set of states
• ∑ is a finite non-empty set of input alphabet
• δ is a transition function mapping from Q ∑ U{ ε} to 2Q
• q0 is initial state (always one) (q 0  Q)
• F is a set of final states (F  Q) (0<=|F|<=|Q|

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 32
III B.Tech AID R20 ATCD-UNIT-1

 Example1:

 Example2:

Significance of ε-NFA
 ε–NFA allows ε-transition but each ε along a path is invisible
i.e. It contributes nothing to the string along the path.
 ε -NFA simplifies the design of FA
 ε –NFA’s can be converted DFA’s accepting the same language
 This is very helpful when we study regular expression (RE) and prove the
equivalence between the class of language accepted by RE and finite
automata.
Equivalence between Null ε -NFA to NFA
 There will be no change in the initial state.
 No change in the total no. of states
 May be change in the number of final states.
 All the states will get the status of the final state in the resulting NFA,
whose €-closure contains at least one final state in the initial €-NFA.
ε-closure:
 ε-closure (q) is defined as set of states that can be reached from q using
only epsilon transitions.
 Formally ε-closure (q) is defined recursively as:
 State q is in ε-closure (q)
 If state p is in ε-closure (q) and there is transition from state p to
state r labelled  ,then r is in ε-closure (q)

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 33
III B.Tech AID R20 ATCD-UNIT-1

 Example:

Note:
 ε-closure (q) always include q
 ε-closure of any state is always a non-empty and finite set of states.
 ε-closure () =
n 1
 ε-closure (q0 ,q1, ... ,qn-1) =  ε-Closure (q )
i
i 0

Conversion of -NFA to NFA:


 Let N=(Q,∑,δ,q0,F) be an -NFA ,then equivalent NFA is
N’=(Q,∑,δ’,q0,F’):
i) Find ε-closure of each states of given -NFA
ii) Find the ’(q,a) for each state q and each input symbol a using
’(q,a) = ε-closure ((ε-closure (q),a))
iii) F’ = set of all states whose ε-closure contains a final stat

Example:

Convert the given NFA with epsilon to NFA without epsilon.

Solution:
We will first obtain ε-closure of each state i.e., we will find ε-reachable states
from the current state.
Hence,
 ε-closure(q0) = {q0,q1,q2}
 ε-closure(q1) = {q1,q2}
 ε-closure(q2) = {q2}

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 34
III B.Tech AID R20 ATCD-UNIT-1

Now we will obtain 𝛿’ transitions for each state on each input symbol as shown
below:

δ'(q0, 0) = ε-closure(δ(ε-closure(q0),0))
= ε-closure(δ(q0,q1,q2), 0))
= ε-closure(δ(q0, 0) ∪ δ(q1, 0) U δ(q2, 0) )
= ε-closure(q0 U Φ ∪ Φ)
= ε-closure(q0)
= {q0,q1, q2}

δ'(q0, 1) = ε-closure(δ(ε-closure(q0),1))
= ε-closure(δ(q0,q1,q2), 1))
= ε-closure(δ(q0, 1) ∪ δ(q1, 1) U δ(q2, 1) )
= ε-closure(Φ ∪q1 U Φ)
= ε-closure(q1)
= {q1, q2}

δ'(q0, 2) = ε-closure(δ(ε-closure(q0),2))
= ε-closure(δ(q0,q1,q2), 2))
= ε-closure(δ(q0, 2) ∪ δ(q1, 2) U δ(q2, 2) )
= ε-closure(Φ U ΦU q2)
= ε-closure(q2)
= {q2}
δ'(q1, 0) = ε-closure(δ(ε-closure(q1),0))
= ε-closure(δ(q1,q2), 0))
= ε-closure(δ(q1, 0) U δ(q2, 0) )
= ε-closure(Φ ∪ Φ)
= ε-closure(Φ)

δ'(q1,1) = ε-closure(δ(ε-closure(q1),1))
= ε-closure(δ(q1,q2), 1))
= ε-closure(δ(q1, 1) U δ(q2, 1) )
= ε-closure(q1 ∪ Φ)
= ε-closure(q1)
= {q1,q2}

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 35
III B.Tech AID R20 ATCD-UNIT-1

δ'(q1, 2) = ε-closure(δ(ε-closure(q1),2))
= ε-closure(δ(q1,q2), 2))
= ε-closure(δ(q1, 2) U δ(q2, 2) )
= ε-closure(Φ ∪ q2)
= ε-closure(q2)
= {q2}

δ'(q2, 0) = ε-closure(δ(ε-closure(q2),0))
= ε-closure(δ(q2), 0))
= ε-closure(δ(q2, 0))
= ε-closure(Φ)

δ'(q2, 1) = ε-closure(δ(ε-closure(q2),1))
= ε-closure(δ(q2), 1)
= ε-closure(δ(q2, 1))
= ε-closure(Φ)

δ'(q2, 2) = ε-closure(δ(ε-closure(q2),2))
= ε-closure(δ({q2}, 2))
= ε-closure(δ(q2, 2))
= ε-closure(q2)
= {q2}

Now, we will summarize all the computed δ' transitions as given below:

δ'(q0,0)={q0,q1,q2}
δ'(q0,1)={q1,q2}
δ'(q0,2)={q2}

δ'(q1,0)= { Φ }
δ'(q1,1)={q1,q2}
δ'(q1,2)={q2}

δ'(q2,0)={ Φ }
δ'(q2,1)={ Φ }
δ'(q2,2)={q2}

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 36
III B.Tech AID R20 ATCD-UNIT-1

The transition table is given below:

States\inputs 0 1 2

q0 {q0,q1,q2} {q1,q2} {q2}

q1 Φ {q1,q2} {q2}

q2 Φ Φ {q2}

Note:
 The presence of ε-transitions adds more flexibility in state transitions compared to a
regular NFA.
 The ε-NFA provides a flexible way of designing automata by allowing transitions on ε,
enabling non-deterministic computation paths. By strategically placing ε-transitions,
you can simplify the design of complex automata and capture a broader range of
languages.
Moore and Mealy machines
(Finite Automata with output)
 An FA that accepts input strings and translates them into output strings is
called FA with outputs.
 Both Moore and Mealy machines are special case of DFA.
 Both acts like output producers rather than language acceptors
 In both no need to define final state
 In both no concept of dead state
 Both are equivalent in power
 Moore machine is created by E.F.Moore in 1956 and Mealy machine is
created by G.H.Mealy in 1955
Moore Machine:
 Moore machine is a FA whose outputs depend on only the present state.
 The output is associated with the state i.e. Output is placed on state.

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 37
III B.Tech AID R20 ATCD-UNIT-1

 The output at a given time depends only upon the present state of the
machine
 On input  it gives output (q0) i.e. output of starting state.
i.e. It responses for empty string
 If the input string is of length n, the output string is of length n+1
 A Moore machine can be described by a 6-tuple (Q, ∑, ∆, δ, , q0) where
Q is a finite set of states.
∑ is a finite set of symbols called the input alphabet.
∆ is a finite set of symbols called the output alphabet.
δ is the input transition function where δ: Q × ∑ → Q
 is the output transition function where : Q → ∆
q0 is the initial state from where any input is processed (q0 ∈ Q).
 Example: The state diagram of the Moore Machine :

 The state table of a Moore Machine is shown below :


Next State
Present state Output
Input = a Input = b

q0 q1 q0 0

q1 q2 q0 0

q2 q2 q3 0

q3 q1 q0 1

Mealy Machine
 A Mealy Machine is a FA whose output depends on the present state as
well as the present input.
 The output is associated with the transition i.e. Output is placed on
transition.
Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 38
III B.Tech AID R20 ATCD-UNIT-1

 The output at a given time is function of the present input as well as the
present state of the machine
 On input  it gives output  i.e. It does not responses for empty string
 If the input string is of length n, the output string is also of length n
 It can be described by a 6-tuple (Q, ∑, ∆, δ, X, q0) where
Q is a finite, non-empty set of states.
∑ is a finite, non-empty set of symbols called the input alphabet.
∆ is a finite, non-empty set of symbols called the output alphabet.
δ is the transition function where δ: Q × ∑ → Q
 is the output function where : Q × ∑ → ∆
q0 is the initial state from where any input is processed (q0 ∈ Q).
 The state Diagram of a Mealy Machine is shown below :

 The state Table of the above Mealy Machine :

Next state

Present state input = a input = b

State Output State Output

q0 q1 0 q3 0

q1 q3 1 q2 1

q2 q3 0 q3 1

q3 q3 1 q0 1

Problem: Design a Moore machine which counts occurrence of sub-string ‘aab’


in input strings over {a,b}

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 39
III B.Tech AID R20 ATCD-UNIT-1

Problem: Design a Mealy machine for a binary input sequence such that if it
has a substring 101, the machine output A, if the input has substring 110, it
outputs B otherwise it outputs C.

Moore Machine vs Mealy Machine


The difference between the Mealy machine and Moore machine are as follows:

Moore Machine Mealy Machine

The output is associated with the state The output is associated with the transition
i.e. Output is placed on state. i.e. Output is placed on transition.

The output at a given time depends only upon The output at a given time is function of the present input
the present state of the machine as well as the present state of the machine

The output function maps from Q to ∆ The output function maps from Q×∑ to ∆

On input  it gives output (q0) i.e. On input  it gives output 


output on starting state. i.e. It does not responses for empty string
i.e. It responses for empty string

If the input string is of length n, the output If the input string is of length n, the output string is also of
string is of length n+1 length n

Generally, it has more states than Mealy


Machine. Generally, it has fewer states than Moore Machine.

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 40
III B.Tech AID R20 ATCD-UNIT-1

Tutorial Questions:
1. Why do we need to study automata theory and formal languages?
2. What is DFA? Find the DFA for the following languages over {0, 1}*
i) The set of all strings such that number of 0’s is odd
ii) The set of all strings that contain exactly three 1’s
iii) The set of all strings that do not contain 1101
3. Design DFA which accepts language L={0,000,00000…….} over {0}
4. Design a DFA L(M) = {w | w ε {0, 1}*} and W is a string that does not contain
three consecutive 1's.Process the string 0011001 on machine.
5. Design DFA to accept strings with ‘c’ and ‘d’ such that number of d’s are
divisible by 4.Show the moves of DFA for the string cdcddcd
6. Design a DFA to accept the language:
L = {w |w has both an even number of 0’s and an even number of 1’s}.
Represent obtained DFA by transition table. Show the transitions of DFA for
the string 110101.
7. What is DFA? Find the DFA’s accepting for the following languages over the
alphabet {a,b,c}:
i) The set of all strings with abc as a substring
ii) The set of all strings ending in bac
iii) The set of all strings starting with cab
8. Draw a deterministic and non-deterministic finite automata for ∑= {A-Z}
which accept a string containing “CSE” at the end of a string of {A-Z}.
9. Design DFA for the following over {a,b}.
i) All string containing not more than three a’s.
ii) All strings that has at least two occurrences of b between any two occurrences
of a.
iii) All strings ending with aa
10. Construct a DFA for set of strings containing either the substring ‘aaa’ or
‘bbb’.
11. Construct a DFA for accepting a set of strings over Σ = {0, 1} not ending in
‘010’.
12. Design the DFA for the language, containing strings in which leftmost symbol differ
from rightmost symbol. Σ = {0, 1}
13. What is DFA? Construct a DFA accepting the language
{ W  {a,b}*| W has neither aa nor bb as substring}
14. Draw the DFA for the following
i) To accept decimal strings divisible by 3 over the alphabet ∑={0,1,2,3,4,5,6,7,8,9}
ii) To accept odd number of a’s and even number of b’s over alphabet ∑ = {a,b}

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 41
III B.Tech AID R20 ATCD-UNIT-1

15. Design a DFA that reads strings made up of letters in the word ‘CHARIOT’ and
recognizes these strings that contain the word ‘CAT’ as a substring.
16. Define Deterministic and Non-deterministic finite automaton.
17. Differentiate between NFA and DFA?
18. Design an NFA with Σ = {0, 1} accepts all string in which the third symbol from
the right end is always 0.
19. Construct an NFA that accepts the set of all strings over {0,1} that start with 0
or 1 and end with 10 or 01.
20. Design a NFA for the following language L={0101n where n>0}
21. Describe the procedure of converting NFA to DFA with a suitable example.
22. Convert the given NFA to equivalent DFA

23. Construct a DFA equivalent to the NFA given below

24. Define NFA with ∈ - moves and give example.


25. Depict the steps in converting an NFA with ∈ into NFA without ∈ with an example.
26. Show with an example equivalence between NFA with and without €-
transitions
27. Convert the following NFA- to NFA

28. Explain the procedure for constructing minimum state DFA with an example.
(OR) What is minimal DFA? Write the minimization Algorithm for DFA?
29. Let ∑= {a, b}, Give DFA that accepts any string with aababb as a substring.
Minimize the DFA obtained.

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 42
III B.Tech AID R20 ATCD-UNIT-1

30. Reduce the following DFA where q1 is the start state and q6 is the final state.

31. Construct Minimum state Automata for the following DFA?

32. Reduce the DFA given below

33. Construct Minimum state Automata for the following DFA

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 43
III B.Tech AID R20 ATCD-UNIT-1

34. Construct Minimum state Automata for the following DFA

35. Minimize the finite automaton shown in figure below.

36. Bring out the differences between Moore and Mealy machines?
37. Design a Moore machine with the input alphabet {0, 1} and output alphabet
{Y, N} which produces Y as output if input sequence contains 1010 as a
substring otherwise, it produces N as output.
38. Design a mealy machine to print out 1’s complement of an input bit string?
39. Design a Moore machine for 2’s complement of binary number.
40. Construct the Moore machine to compute residue modulo 5 and finds to its
equivalent Mealy machine.
41. Draw a Moore machine for calculating mod 3 of a given binary number. Find
its equivalent mealy machine.
42. Construct a Moore machine that determines whether an input string contains
an even or odd number of 1's. The machine should give 1 as output if an even
number of 1’s is in the string and 0 otherwise.
43. Design a Moore and Mealy machines for a binary input sequence such that if
it has a substring 101, the machine outputs A, if the input has substring 110, it
outputs B otherwise it outputs C.
44. Design a Moore and Mealy machine that scans sequence of input of 0 and 1
and generates output 'A' if the input string terminates in 00, output 'B' if the
string terminates in 11, and output 'C' otherwise.
45. Design Moore and Mealy Machine to increment binary number by 1

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 44
III B.Tech AID R20 ATCD-UNIT-1

46. Give Mealy and Moore machine for the following: For input from ∑*, where ∑=
{0,1,2}, print the residue modulo 5 of the input treated as a ternary (base 3,
with digits 0, 1 and 2) number.
47. Design a Moore Machine that will read sequences made up of letters a, e, i, o,
u and will give as output, same characters except when an ‘i’ is followed by ‘e’,
it will be changed to ‘u’.
48. Design a Mealy machine to add two binary numbers of the form x1x2…xk,
y1y2…yk?
49. Convert the following Mealy machine to an equivalent Moore machine

50. Convert the following Mealy machine into equivalent Moore machine.

Prepared By: MD SHAKEEL AHMED, Associate Professor, Dept. Of IT, VVIT, Guntur Page 45

You might also like