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

TOC 1

The document provides an overview of Finite Automata and their classifications, including Deterministic Finite Automata (DFA) and Non-deterministic Finite Automata (NDFA). It covers formal definitions, related terminologies, graphical representations, and the differences between DFA and NDFA, as well as algorithms for converting NDFA to DFA and minimizing DFA. Additionally, it discusses the concepts of acceptors, classifiers, and transducers in the context of automata theory.

Uploaded by

laleshpawar2025
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)
11 views

TOC 1

The document provides an overview of Finite Automata and their classifications, including Deterministic Finite Automata (DFA) and Non-deterministic Finite Automata (NDFA). It covers formal definitions, related terminologies, graphical representations, and the differences between DFA and NDFA, as well as algorithms for converting NDFA to DFA and minimizing DFA. Additionally, it discusses the concepts of acceptors, classifiers, and transducers in the context of automata theory.

Uploaded by

laleshpawar2025
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/ 28

An Education Empowered by industry . . .

FABTECH TECHNICAL CAMPUS


COLLEGE OF ENGINEERING AND RESEARCH
( Approved by AICTE, New Delhi, DTE., (M.S.) & affiliated to Solapur University & DBATU , Lonere)
Pandharpur Road, Gat No. 565/1, Sangola, Taluka:- Sangola, District:- Solapur. 413 307. P.O. Box No.04
M: 8408888657, 8408888612 Website: www.fabtecheducation.com E-mail : [email protected]

BTCOC502 Theory of Computations

Unit 1: Finite Automata and Regular Expressions:

Motivation
• Automata = abstract computing devices
• Turing studied Turing Machines (= computers) before there were any real computers
• We will also look at simpler devices than Turing machines (Finite State Automata, Pushdown
Automata, . . . ), and specification means, such as grammars and regular expressions.
• NP-hardness = what cannot be efficiently computed.
• Undecidability = what cannot be computed at all.

Finite Automata
Finite Automata are used as a model for
• Software for designing digital cicuits
• Lexical analyzer of a compiler
• Searching for keywords in a file or on the web.
• Software for verifying finite state systems, such as communication protocols.

Automata – What is it?


The term "Automata" is derived from the Greek word "αὐτόματα" which means "self-acting".
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).

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

Related Terminologies
Alphabet

● Definition − An alphabet is any finite set of symbols.


● Example − ∑ = {a, b, c, d} is an alphabet set where ‘a’, ‘b’, ‘c’, and ‘d’ are symbols.

String

● Definition − A string is a finite sequence of symbols taken from ∑.


● Example − ‘cabcad’ is a valid string on the alphabet set ∑ = {a, b, c, d}

Length of a String

● Definition − It is the number of symbols present in a string. (Denoted by |S|).


● Examples −
o If S = ‘cabcad’, |S|= 6
o If |S|= 0, it is called an empty string (Denoted by λ or ε)

Kleene Star

● Definition − The Kleene star, ∑*, is a unary operator on a set of symbols or


strings, ∑, that gives the infinite set of all possible strings of all possible lengths
over ∑ including λ.
● Representation − ∑* = ∑0 ∪ ∑1 ∪ ∑2 ∪……. where ∑p is the set of all possible strings
of length p.
● Example − If ∑ = {a, b}, ∑* = {λ, a, b, aa, ab, ba, bb,………..}

Kleene Closure / Plus

● Definition − The set ∑+ is the infinite set of all possible strings of all possible lengths
over ∑ excluding λ.
● Representation − ∑+ = ∑1 ∪ ∑2 ∪ ∑3 ∪…….
∑+ = ∑* − { λ }
● Example − If ∑ = { a, b } , ∑+ = { a, b, aa, ab, ba, bb,………..}

Language

● Definition − A language is a subset of ∑* for some alphabet ∑. It can be finite or


infinite.
● Example − If the language takes all possible strings of length 2 over ∑ = {a, b}, then
L = { ab, aa, ba, bb }
Finite Automaton can be classified into two types −

● Deterministic Finite Automaton (DFA)


● Non-deterministic Finite Automaton (NDFA / NFA)

Deterministic Finite Automaton (DFA)


In DFA, for each input symbol, one can determine the state to which the machine will move.
Hence, it is called Deterministic Automaton. As it has a finite number of states, the
machine is called Deterministic Finite Machine or Deterministic Finite Automaton.

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 digraphs called 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.

Example

Let a deterministic finite automaton be →

● Q = {a, b, c},
● ∑ = {0, 1},
● q0 = {a},
● F = {c}, and
Transition function δ as shown by the following table −

Present State Next State for Input 0 Next State for Input 1

a a b

b c a

c b c

Its graphical representation would be as follows −

In NDFA, for a particular input symbol, the machine can move to any combination of the
states in the machine. In other words, the exact state to which the machine moves cannot
be determined. Hence, it is called Non-deterministic Automaton. As it has finite number
of states, the machine is called Non-deterministic Finite Machine or Non-deterministic
Finite Automaton.

Formal Definition of an NDFA

An NDFA 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 an NDFA: (same as DFA)


An NDFA is represented by digraphs called 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.
Example
Let a non-deterministic finite automaton be →

● Q = {a, b, c}
● ∑ = {0, 1}
● q0 = {a}
● F = {c}
The transition function δ as shown below −

Present State Next State for Input 0 Next State for Input 1

a a, b b

b c a, c

c b, c c

Its graphical representation would be as follows −

DFA vs NDFA
The following table lists the differences between DFA and NDFA.

DFA NDFA

The transition from a state is to a single The transition from a state can be to
particular next state for each input symbol. multiple next states for each input
Hence it is called deterministic.
symbol. Hence it is
called non-deterministic.

Empty string transitions are not seen in DFA. NDFA permits empty string transitions.

Backtracking is allowed in DFA In NDFA, backtracking is not always


possible.

Requires more space. Requires less space.

A string is accepted by a DFA, if it transits to a A string is accepted by a NDFA, if at least


final state. one of all possible transitions ends in a
final state.

Acceptors, Classifiers, and Transducers


Acceptor (Recognizer)

An automaton that computes a Boolean function is called an acceptor. All the states of an
acceptor is either accepting or rejecting the inputs given to it.

Classifier

A classifier has more than two final states and it gives a single output when it terminates.

Transducer

An automaton that produces outputs based on current input and/or previous state is called
a transducer. Transducers can be of two types −
● Mealy Machine − The output depends both on the current state and the current
input.
● Moore Machine − The output depends only on the current state.

Acceptability by DFA and NDFA


A string is accepted by a DFA/NDFA iff the DFA/NDFA starting at the initial state ends in an
accepting state (any of the final states) after reading the string wholly.
A string S is accepted by a DFA/NDFA (Q, ∑, δ, q0, F), iff
δ*(q0, S) ∈ F
The language L accepted by DFA/NDFA is
{S | S ∈ ∑* and δ*(q0, S) ∈ F}
A string S′ is not accepted by a DFA/NDFA (Q, ∑, δ, q0, F), iff
δ*(q0, S′) ∉ F
The language L′ not accepted by DFA/NDFA (Complement of accepted language L) is
{S | S ∈ ∑* and δ*(q0, S) ∉ F}
Example
Let us consider the DFA shown in Figure 1.3. From the DFA, the acceptable strings can be
derived.

Strings accepted by the above DFA: {0, 00, 11, 010, 101, ...........}
Strings not accepted by the above DFA: {1, 011, 111, ........}

Finite Automata Informally


Protocol for e-commerce using e-money
Allowed events:
1. The customer can pay the store (=send the money-file to the store)
2. The customer can cancel the money (like putting a stop on a check)
3. The store can ship the goods to the customer
4. The store can redeem the money (=cash the check)
5. The bank can transfer the money to the Store
Description of a DFA

Note that a DFA is an abstract (computing) device. The depiction given in


Figure 4.1 shall facilitate one to understand its behavior. As shown in the
figure, there are mainly three components namely input tape, reading head,
and finite control. It is assumed that a DFA has a left-justified infinite tape
to accommodate an input of any length. The input tape is divided into cells
such that each cell accommodate a single input symbol. The reading head is
connected to the input tape from finite control, which can read one symbol
at a time. The finite control has the states and the information of the
transition function along with a pointer that points to exactly one state.
At a given point of time, the DFA will be in some internal state, say p,
called the current state, pointed by the pointer and the reading head will be
reading a symbol, say a, from the input tape called the current symbol. If
δ(p, a) = q, then at the next point of time the DFA will change its internal
state from p to q (now the pointer will point to q) and the reading head will
move one cell to the right.

Figure 4.1: Depiction of Finite Automaton

Initializing a DFA with an input string x Σ∗ we mean x be placed on the


input tape from the left most (first) cell of the tape with the reading head
placed on the first cell and by setting the initial state as the current state. By
the time the input is exhausted, if the current state of the DFA is a final
state, then the input x is accepted by the DFA. Otherwise, x is rejected by
the DFA.

Problem Statement
Let X = (Qx, ∑, δx, q0, Fx) be an NDFA which accepts the language L(X). We have to design
an equivalent DFA Y = (Qy, ∑, δy, q0, Fy) such that L(Y) = L(X). The following procedure
converts the NDFA to its equivalent DFA −
Algorithm
Input − An NDFA
Output − An equivalent DFA
Step 1 − Create state table from the given NDFA.
Step 2 − Create a blank state table under possible input alphabets for the equivalent DFA.
Step 3 − Mark the start state of the DFA by q0 (Same as the NDFA).
Step 4 − Find out the combination of States {Q0, Q1,... , Qn} for each possible input alphabet.
Step 5 − Each time we generate a new DFA state under the input alphabet columns, we
have to apply step 4 again, otherwise go to step 6.
Step 6 − The states which contain any of the final states of the NDFA are the final states of
the equivalent DFA.

Example
Let us consider the NDFA shown in the figure below.

q δ(q,0) δ(q,1)

a {a,b,c,d,e} {d,e}

b {c} {e}

c ∅ {b}

d {e} ∅

e ∅ ∅
Using the above algorithm, we find its equivalent DFA. The state table of the DFA is shown
in below.

q δ(q,0) δ(q,1)

[a] [a,b,c,d,e] [d,e]

[a,b,c,d,e] [a,b,c,d,e] [b,d,e]

[d,e] [e] ∅

[b,d,e] [c,e] [e]

[e] ∅ ∅

[c, e] ∅ [b]

[b] [c] [e]

[c] ∅ [b]

The state diagram of the DFA is as follows −


DFA Minimization using Myphill-Nerode Theorem
Algorithm

Input − DFA
Output − Minimized DFA
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.

Example

Let us use Algorithm 2 to minimize the DFA shown below.


Step 1 − We draw a table for all pair of states.

a b c d e f

Step 2 − We mark the state pairs.

a b c d e f

c ✔ ✔
d ✔ ✔

e ✔ ✔

f ✔ ✔ ✔

Step 3 − We will try to mark the state pairs, with green colored check mark, transitively. If
we input 1 to state ‘a’ and ‘f’, it will go to state ‘c’ and ‘f’ respectively. (c, f) is already
marked, hence we will mark pair (a, f). Now, we input 1 to state ‘b’ and ‘f’; it will go to state
‘d’ and ‘f’ respectively. (d, f) is already marked, hence we will mark pair (b, f).

a b c d e f

c ✔ ✔

d ✔ ✔

e ✔ ✔

f ✔ ✔ ✔ ✔ ✔

After step 3, we have got state combinations {a, b} {c, d} {c, e} {d, e} that are unmarked.
We can recombine {c, d} {c, e} {d, e} into {c, d, e}
Hence we got two combined states as − {a, b} and {c, d, e}
So the final minimized DFA will contain three states {f}, {a, b} and {c, d, e}
DFA Minimization using Equivalence Theorem
If X and Y are two states in a DFA, we can combine these two states into {X, Y} if they are
not distinguishable. Two states are distinguishable, if there is at least one string S, such that
one of δ (X, S) and δ (Y, S) is accepting and another is not accepting. Hence, a DFA is
minimal if and only if all the states are distinguishable.

Algorithm 3

Step 1 − All the states Q are divided in two partitions − final states and non-final
states and are denoted by P0. All the states in a partition are 0th equivalent. Take a
counter k and initialize it with 0.
Step 2 − Increment k by 1. For each partition in Pk, divide the states in Pk into two partitions
if they are k-distinguishable. Two states within this partition X and Y are k-distinguishable if
there is an input S such that δ(X, S) and δ(Y, S) are (k-1)-distinguishable.
Step 3 − If Pk ≠ Pk-1, repeat Step 2, otherwise go to Step 4.
Step 4 − Combine kth equivalent sets and make them the new states of the reduced DFA.

Example

Let us consider the following DFA −


q δ(q,0) δ(q,1)

a b c

b a d

c e f

d e f

e e f

f f f

Let us apply the above algorithm to the above DFA −

● P0 = {(c,d,e), (a,b,f)}
● P1 = {(c,d,e), (a,b),(f)}
● P2 = {(c,d,e), (a,b),(f)}
Hence, P1 = P2.
There are three states in the reduced DFA. The reduced DFA is as follows −
Q δ(q,0) δ(q,1)

(a, b) (a, b) (c,d,e)

(c,d,e) (c,d,e) (f)

(f) (f) (f)

A Regular Expression can be recursively defined as follows −


● ε is a Regular Expression indicates the language containing an empty
string. (L (ε) = {ε})
● φ is a Regular Expression denoting an empty language. (L (φ) = { })
● x is a Regular Expression where L = {x}
● If X is a Regular Expression denoting the language L(X) and Y is a Regular
Expression denoting the language L(Y), then
o X + Y is a Regular Expression corresponding to the language L(X) ∪
L(Y) where L(X+Y) = L(X) ∪ L(Y).
o X . Y is a Regular Expression corresponding to the language L(X) .
L(Y) where L(X.Y) = L(X) . L(Y)
o R* is a Regular Expression corresponding to the
language L(R*)where L(R*) = (L(R))*
● If we apply any of the rules several times from 1 to 5, they are Regular
Expressions.

Some RE Examples

Regular Regular Set


Expressions
(0 + 10*) L = { 0, 1, 10, 100, 1000, 10000, … }

(0*10*) L = {1, 01, 10, 010, 0010, …}

(0 + ε)(1 + ε) L = {ε, 0, 1, 01}

(a+b)* Set of strings of a’s and b’s of any length including the null
string. So L = { ε, a, b, aa , ab , bb , ba, aaa…….}

(a+b)*abb Set of strings of a’s and b’s ending with the string abb. So
L = {abb, aabb, babb, aaabb, ababb, …………..}

(11)* Set consisting of even number of 1’s including empty


string, So L= {ε, 11, 1111, 111111, ……….}

(aa)*(bb)*b Set of strings consisting of even number of a’s followed by


odd number of b’s , so L = {b, aab, aabbb, aabbbbb,
aaaab, aaaabbb, …………..}

(aa + ab + ba + bb)* String of a’s and b’s of even length can be obtained by
concatenating any combination of the strings aa, ab, ba
and bb including null, so L = {aa, ab, ba, bb, aaab, aaba,
…………..}

Regular Sets
Any set that represents the value of the Regular Expression is called a Regular
Set.

Properties of Regular Sets

Property 1. The union of two regular set is regular.


Proof −
Let us take two regular expressions
RE1 = a(aa)* and RE2 = (aa)*
So, L1 = {a, aaa, aaaaa,.....} (Strings of odd length excluding Null)
and L2 ={ ε, aa, aaaa, aaaaaa,.......} (Strings of even length including Null)
L1 ∪ L2 = { ε, a, aa, aaa, aaaa, aaaaa, aaaaaa,.......}
(Strings of all possible lengths including Null)
RE (L1 ∪ L2) = a* (which is a regular expression itself)
Hence, proved.
Property 2. The intersection of two regular set is regular.
Proof −
Let us take two regular expressions
RE1 = a(a*) and RE2 = (aa)*
So, L1 = { a,aa, aaa, aaaa, ....} (Strings of all possible lengths excluding Null)
L2 = { ε, aa, aaaa, aaaaaa,.......} (Strings of even length including Null)
L1 ∩ L2 = { aa, aaaa, aaaaaa,.......} (Strings of even length excluding Null)
RE (L1 ∩ L2) = aa(aa)* which is a regular expression itself.
Hence, proved.
Property 3. The complement of a regular set is regular.
Proof −
Let us take a regular expression −
RE = (aa)*
So, L = {ε, aa, aaaa, aaaaaa, .......} (Strings of even length including Null)
Complement of L is all the strings that is not in L.
So, L’ = {a, aaa, aaaaa, .....} (Strings of odd length excluding Null)
RE (L’) = a(aa)* which is a regular expression itself.
Hence, proved.
Property 4. The difference of two regular set is regular.
Proof −
Let us take two regular expressions −
RE1 = a (a*) and RE2 = (aa)*
So, L1 = {a, aa, aaa, aaaa, ....} (Strings of all possible lengths excluding Null)
L2 = { ε, aa, aaaa, aaaaaa,.......} (Strings of even length including Null)
L1 – L2 = {a, aaa, aaaaa, aaaaaaa, ....}
(Strings of all odd lengths excluding Null)
RE (L1 – L2) = a (aa)* which is a regular expression.
Hence, proved.
Property 5. The reversal of a regular set is regular.
Proof −
We have to prove LR is also regular if L is a regular set.
Let, L = {01, 10, 11, 10}
RE (L) = 01 + 10 + 11 + 10
LR = {10, 01, 11, 01}
RE (LR) = 01 + 10 + 11 + 10 which is regular
Hence, proved.
Property 6. The closure of a regular set is regular.
Proof −
If L = {a, aaa, aaaaa, .......} (Strings of odd length excluding Null)
i.e., RE (L) = a (aa)*
L* = {a, aa, aaa, aaaa , aaaaa,……………} (Strings of all lengths excluding Null)
RE (L*) = a (a)*
Hence, proved.
Property 7. The concatenation of two regular sets is regular.
Proof −
Let RE1 = (0+1)*0 and RE2 = 01(0+1)*
Here, L1 = {0, 00, 10, 000, 010, ......} (Set of strings ending in 0)
and L2 = {01, 010,011,.....} (Set of strings beginning with 01)
Then, L1 L2 = {001,0010,0011,0001,00010,00011,1001,10010,.............}
Set of strings containing 001 as a substring which can be represented by an RE −
(0 + 1)*001(0 + 1)*
Hence, proved.

Identities Related to Regular Expressions


Given R, P, L, Q as regular expressions, the following identities hold −

● ∅* = ε
● ε* = ε
● RR* = R*R
● R*R* = R*
● (R*)* = R*
● RR* = R*R
● (PQ)*P =P(QP)*
● (a+b)* = (a*b*)* = (a*+b*)* = (a+b*)* = a*(ba*)*
● R + ∅ = ∅ + R = R (The identity for union)
● R ε = ε R = R (The identity for concatenation)
● ∅ L = L ∅ = ∅ (The annihilator for concatenation)
● R + R = R (Idempotent law)
● L (M + N) = LM + LN (Left distributive law)
● (M + N) L = ML + NL (Right distributive law)
● ε + RR* = ε + R*R = R*

Construction of an FA from an RE
We can use Thompson's Construction to find out a Finite Automaton from a Regular
Expression. We will reduce the regular expression into smallest regular expressions
and converting these to NFA and finally to DFA.
Some basic RA expressions are the following −
Case 1 − For a regular expression ‘a’, we can construct the following FA −

Case 2 − For a regular expression ‘ab’, we can construct the following FA −

Case 3 − For a regular expression (a+b), we can construct the following FA −


Case 4 − For a regular expression (a+b)*, we can construct the following FA −

Method

Step 1 Construct an NFA with Null moves from the given regular expression.
Step 2 Remove Null transition from the NFA and convert it into its equivalent DFA.
Problem
Convert the following RA into its equivalent DFA − 1 (0 + 1)* 0
Solution
We will concatenate three expressions "1", "(0 + 1)*" and "0"

Now we will remove the ε transitions. After we remove the ε transitions from the
NDFA, we get the following −
It is an NDFA corresponding to the RE − 1 (0 + 1)* 0. If you want to convert it into a
DFA, simply apply the method of converting NDFA to DFA discussed in Chapter 1.

Finite Automata with Null Moves (NFA-ε)


A Finite Automaton with null moves (FA-ε) does transit not only after giving input
from the alphabet set but also without any input symbol. This transition without input
is called a null move.
An NFA-ε is represented formally by a 5-tuple (Q, ∑, δ, q0, F), consisting of
● Q − a finite set of states
● ∑ − a finite set of input symbols
● δ − a transition function δ : Q × (∑ ∪ {ε}) → 2Q
● q0 − an initial state q0 ∈ Q
● F − a set of final state/states of Q (F⊆Q).

The above (FA-ε) accepts a string set − {0, 1, 01}

Removal of Null Moves from Finite Automata


If in an NDFA, there is ϵ-move between vertex X to vertex Y, we can remove it using
the following steps −

● Find all the outgoing edges from Y.


● Copy all these edges starting from X without changing the edge labels.
● If X is an initial state, make Y also an initial state.
● If Y is a final state, make X also a final state.
Problem
Convert the following NFA-ε to NFA without Null move.

Solution
Step 1 −
Here the ε transition is between q1 and q2, so let q1 is X and qf is Y.
Here the outgoing edges from qf is to qf for inputs 0 and 1.
Step 2 −
Now we will Copy all these edges from q1 without changing the edges from qf and
get the following FA −
Step 3 −
Here q1 is an initial state, so we make qf also an initial state.
So the FA becomes −

Step 4 −
Here qf is a final state, so we make q1 also a final state.
So the FA becomes −

Pumping Lemma For Regular Grammars


Theorem

Let L be a regular language. Then there exists a constant ‘c’ such that for every
string w in L −
|w| ≥ c
We can break w into three strings, w = xyz, such that −

● |y| > 0
● |xy| ≤ c
● For all k ≥ 0, the string xykz is also in L.

Applications of Pumping Lemma


Pumping Lemma is to be applied to show that certain languages are not regular. It
should never be used to show a language is regular.
● If L is regular, it satisfies Pumping Lemma.
● If L does not satisfy Pumping Lemma, it is non-regular.

Method to prove that a language L is not regular


● At first, we have to assume that L is regular.
● So, the pumping lemma should hold for L.
● Use the pumping lemma to obtain a contradiction −
o Select w such that |w| ≥ c
o Select y such that |y| ≥ 1
o Select x such that |xy| ≤ c
o Assign the remaining string to z.
o Select k such that the resulting string is not in L.
Hence L is not regular.
Problem
Prove that L = {aibi | i ≥ 0} is not regular.
Solution −
● At first, we assume that L is regular and n is the number of states.
● Let w = anbn. Thus |w| = 2n ≥ n.
● By pumping lemma, let w = xyz, where |xy| ≤ n.
● Let x = ap, y = aq, and z = arbn, where p + q + r = n, p ≠ 0, q ≠ 0, r ≠ 0. Thus |y|
≠ 0.
● Let k = 2. Then xy2z = apa2qarbn.
● Number of as = (p + 2q + r) = (p + q + r) + q = n + q
● Hence, xy2z = an+q bn. Since q ≠ 0, xy2z is not of the form anbn.
● Thus, xy2z is not in L. Hence L is not regular.
● If (Q, ∑, δ, q0, F) be a DFA that accepts a language L, then the complement of
the DFA can be obtained by swapping its accepting states with its
non-accepting states and vice versa.
● We will take an example and elaborate this below −


● This DFA accepts the language
● L = {a, aa, aaa , ............. }
● over the alphabet
● ∑ = {a, b}
● So, RE = a+.
● Now we will swap its accepting states with its non-accepting states and vice
versa and will get the following −


● This DFA accepts the language
● Ľ = {ε, b, ab ,bb,ba, ............... }
● over the alphabet
● ∑ = {a, b}
● Note − If we want to complement an NFA, we have to first convert it to DFA
and then have to swap states as in the previous method.

You might also like