You are on page 1of 72

UNIT-I

Unit-I FINITE AUTOMATA

Introduction-Basic Mathematical notation and techniques-finite state systems-Basic


definitions-Finite Automaton-DFA & NDFA-Finite automaton with є-moves-Regular
Languages-Regular Expression-Equivalence of NFA and DFA- Equivalence of NDFA’s
with and without є-moves-Equivalence of finite Automaton and regular expressions-
Minimization of DFA-Pumping Lemma for Regular sets-Problems based on Pumping
Lemma.

1 Introduction:

1.1 Computation:

 Computation is a general term for any type of information processing.


 It is a process following a well defined model that is understood and can be
expressed in an algorithm, protocol network topology etc.,
 It is also a major subject matter of computer science, it investigates what
can or cannot be done in a computational manner.

1.2 Classes of Computation:

Computation can be classified as follows:

 Digital Vs Analog
 Sequential Vs Parallel Vs Concurrent
 Batch Vs interactive

1.3 Computation as Physical Phenomenon:

A computation can be seen as a purely physical phenomenon occurring


inside a closed “physical system” called a computer.

Examples of such physical system includes

 Digital Computers
 Quantum Computers
 DNA Computers
 Molecular Computers
 Analog Computers
1.4 Mathematical model of Computation

In the theory of Computation, a diversity of mathematical models of


computers has been developed. Typical mathematical models of computers are the
following:

1. State models including


a. Turing Machine
b. Pushdown automata
c. Finite Automaton
2. Functional models including
a. Lambda calculus
3. Logical models including
a. Logic programming
4. Concurrent models including
a. Actor model
b.

1.5 Automata (abstract computing devices)

Definition 1

An open-ended computer science discipline that concerns an abstract device called


an automaton, which performs a specific and recognition function.

Definition 2

A formal system that represents a machine that acts according to given


specification.

1.6 Alphabets, Strings, and Languages

1.6.1 Alphabets

An alphabet is a finite, non-empty set of symbols. It is denoted by ∑.

Example:

i. ∑ = {a, b}, an alphabet of 2 symbols a and b.


ii. ∑ = {0, 1, 2}, an alphabet of 3 symbols 0,1 and 2.
1.6.2 Strings

A string or word over an alphabet ∑ is a finite sequence of symbols


from ∑.

Example:

i. If ∑ = {a, b}, then abab, aabba, aaabba are all strings over the alphabet
∑ = {a, b}.
ii. If ∑ = {a}, then a, aa, aaa are all strings over the alphabet ∑ = {a}.

1.6.3 Languages

For any alphabet ∑, any aubset L of ∑* is a language, a set of strings


from an alphabet is called as a ‘Language’.

Example:

i. English: It is a Language over ∑ = {a, b, c, …, z}.


ii. Binary String: {0,1,01,10,0101,…} is a language over ∑ = {0, 1}.
iii. If ∑ = {a, b} is an alphabet then ∑* = { є, a, b, aa, ab, … } is a language.

1.7 Languages and Automata

Languages Automata

Type 0 Turing Machine

Context –sensitive or Type 1 Linear bounded automata

Context-free or Type 2 Pushdown automata

Regular or Finite
Type 3 automaton
2 Introduction to Formal Proof

Definition

A proof of a statement is essentially just a convincing or justifying


argument that the statement is true.

A proof not only convinces but explains why the statement is true and also
how it relates to other statements and how it fits into the overall theory. There are
two types of proofs:

1. Deductive proof
2. Inductive proof
2.1 Deductive Proof
A deductive proof consists of a sequence of statements whose truth leads us
from some initial statement called hypothesis or given statements to a conclusion
statement.
The theorem that is proved when we go from a hypothesis H to a
conclusion C is the statement “if H then C”, we say that “C is deduced from H”.
Theorem 1:
If x≥4 then 2x ≥x2.
Proof:
Here Hypothesis H is x≥4
Conclusion C is 2x ≥x2
x≥4:
 Hypothesis has a parameter x and it is neither true nor false.
 The truth depends on the value of the parameter i.e) h is true for x=6 and
false for x=2.

2x ≥x2:

The conclusion C is 2x ≥x2. This statement also uses parameter x and is true
for certain values of x and not for others.

Example:

 C is false for x=3 since 23=8 which is not as large as 32=9 (8 ≥ 9).
 C is true for x=4 since 24=42=16.
 For x=5. The statement is also true since 25=32 is at least as large as 52=25 (32 ≥
25).
 Let us conclude the conclusion as 2x ≥x2 will be true whenever x≥4.

Theorem 2:

If x is the sum of the squares of four positive integers then 2x ≥x2.

////// Need Proof

Modus ponens:

 The hypothesis of some theorem is a previous statement, then the conclusion of


that theorem is true, and can be written down as a statement of our proof. This
logical rule is called modus ponens.
 If we know that H is true, and we know “if H then C” is true, we may conclude
that C is true.

Proof:

The intuitive argument that tells the conclusion 2x ≥x2 is true for the hypothesis
x ≥ 4. If the hypothesis is true for x, that is, x is the sum of the squares of four integers,
then x must be at least 4.

Statement Justification
1. x=a2+b2+c2+d2 Given
2. a≥1,b≥1,c≥1,d≥1 Given
3. a2≥1,b2≥1,c2≥1,d2≥1 Follows statement 2
4. x ≥ 4 Follows statement 1 and 3
5. 2x ≥x2 Follows statement 4

Step 1:

Let a, b, c and d is the names of the four integers. One of the given statements of
the theorem says x is the sum of the squares of four integers.
Step 2:

This statement represents four distinct statements, one of the four integers
involved. Each values being squared must be at least 1.

Step 3:

We observe that if a number is at least 1 then its square also at least 1.

Step 4:

It uses the statements 1 and 3 using well known properties of arithmetic; we


conclude that x is at least 1+1+1+1 or 4.

Step 5:

In the final step, we use the statement 4. Theorem 1 is the justification for writing
down its conclusion since its hypothesis is a previous statement.

Reduction to Definition:

If you are not sure how to start the proof, convert all terms in the hypothesis to
their definitions.

Example:

Reduction to definition uses the following two definitions.

Definition 1:

 A set S is finite if there exists an integer ‘n’ such that S has exactly n
elements.
 We write ║S║=n, where ║S║ is used to denote the number of elements in
the set S.

Definition 2:

If S and T are both subsets of some set U, then T is the complement of S, if


S∪T=U and S∩T=ϕ.

Theorem 3:
Let S be a finite subset of some infinite set U. let T be the compliment of S with
respect to U. Then T is infinite.

Original Statement New statement


S is finite There is a integer n such that ║S║=n
U is infinite For no integer p ║U║=p
T is the compliment of S S∪T=U and S∩T=ϕ
Other Theorem Forms:

Ways of saying “if-then”

1. H implies C
2. H only if C
3. C if H
4. Whenever H holds, C follows

Example:

1. x ≥ 4 implies 2x ≥x2
2. x ≥ 4only if 2x ≥x2
3. 2x ≥x2 if x ≥ 4
4. Whenever x ≥ 4, 2x ≥x2 follows.

if and only if statements:

 This statement is actually two if then statements:

“if A then B” and “if B then A”

 The operator ↔ or ≡ is used to denote an “if and only if” statement.

Example:

A ≡ B and A ↔ B mean the same as “A if and only if B” or “A iff B”

Additional forms of Proof:

 Proofs about sets


 Proofs by contradiction
 Proofs by counterexample
 Proofs by Contrapositiv

Proof by Contrapositive:
The contrapositive of a conditional statements is formed by negating both the
hypothesis and the conclusion and then interchanging the resulting negations.

Ex: p→q

Contrapositive is ‫ך‬q → ‫ך‬p

In other words, it does both the jobs inverse and converse.

Theorem:

Conditional: For any real numbers a, b, if ab=0 then either a=0 or b=0.

Contrapositive: For any real numbers a, b, if a is not 0 and b is not 0, then ab is not 0.

Proof by Contradiction:

“H and not C implies falsehood”

 That is start by assuming both the hypothesis H and the negation of the conclusion
C
 Complete the proof by showing that something known to be false follows logically
from H to not C. This form of proof is called as proof by contradiction.

Theorem:

To prove for any sets A, B, and C if A∩B = ϕ and C subset B and A∩C ≠ ϕ.
Therefore there exists x with x Є A∩C, then x Є A and x Є C.

 Since C subset B and x Є C, it follows that x Є B.


 Therefore x Є A∩B which contradicts the assumption that A∩B =ϕ
 Since the assumption that the conditional statement is false leads to a
contradiction, the statement is proved.

Proof by Counter Example:

In order to prove certain statement, we need to see all possible conditions in which
that statement remains rue. There are some situations n which the statement cannot be
true.

Theorem:

There is no such pair of integers such that a mod b = b mod a.


Proof:

Consider a=2 and b=3, then clearly 2 mod 3 ≠ 3 mod 2.

 Thus the given pairs is true for any pairs of integers but if a=b then naturally a
mod b = b mod a.
 Thus we need to change the statement slightly, we can say a mod b = b mod a
when a = b.

Proof about Sets:

If E and F are two expressions representing sets, the statement E=F means that the
two sets represented are the same.

Example 1:

The commutative law of union says that we can take the union of two sets R and S
in either order.

 That is R∪S=S∪R
 In this case E is the expression R∪S and F is the expression S∪R.
 The commutative law of union says that E = F.

Example 2: “if and only if statement”

 An element x is in E if and only if x is in F.


 The form of any if and only if proof are as follows:
o Proof that “ if x is in E, then x is in F”
o Proof that if x is in F, then x is in E”

Theorem:

(Let us prove the distributive law of union over intersection)

R∪(S∩T)=(R∪S) ∩ (R∪T)

Proof:

The two set expressions involved are

E= R∪(S∩T) and F=(R∪S) ∩ (R∪T)

In the ‘if’ part we assume element x is in E and show it is in F. Steps in ‘if part’ are as
follows:
Step No. Statement Justification
1 x is in R∪(S∩T) Given
2 x is in R or x is in S∩T (1) and definition of union
3 x is in R or x is in S and T (2) and definition of intersection
4 x is in R∪S (3) and definition of union
5 x is in R∪T (3) and definition of union
6 x is in (R∪S) ∩ (R∪T) (4), (5) and definition of intersection

Steps in ‘only if part’ are as follows:

Step No. Statement Justification


1 x is in (R∪S) ∩ (R∪T) Given
2 x is in R∪S (1) and definition of intersection.
3 x is in R∪T (1) and definition of intersection.
4 x is in R or x is in S and T (2), (3) and reasoning about unions.
5 x is in R or x is in S∩T (4) and definition of intersection.
6 x is in R∪(S∩T) (5) and definition of union.

Since we have now proved both parts of the if-and-only-if statement, the distributive law
of union over intersection is proved.

Inductive Proofs:

 There is a special form of proof called inductive ie) essential when dealing with
recursively defined objects.
 Many of the most familiar inductive proofs deals with integers, but in automata
theory we also need inductive proofs about such recursively defined concepts as
trees and expression of various sorts such as regular expressions.

Induction on Integers:

Suppose we are given a statement s(n) about an integer n.

Steps:

Step 1:
The basis where we show s(i) for a particular integer c. Usually i=0

or i=1.

Step 2:

The inductive step where we assume n ≥ i, where i is the basis


integer s

///////////////////////////////

Example 1:
𝑛(𝑛+1)
Prove by mathematical induction 1+2+3+…+n=
2

Proof:

1. Basis of induction:

(Base case) n=1


𝑛(𝑛+1) (1)(1+1)
R.H.S = = =1
2 2

L.H.S = 1

2. By Induction hypothesis:
𝑘(𝑘+1)
For every k > 0, 1+2+3+… + k =
2

3. Statement to be shown in induction step:


(𝑘+1)((𝑘+1)+1)
1+2+3+… + k + (k+1) =
2

4. Proof of Induction step:

L.H.S
𝑘(𝑘+1)
1+2+3+… + k + (k+1) = + (k+1)
2
𝑘
= (k+1) [ +1]
2

𝑘+2
= (k+1) [ ]
2

(𝑘+1)(𝑘+2) (𝑘+1)(𝑘+1+1)
= [∵ ]
2 2

= R.H.S

P(k+1) is also true for every k > 1

Example 2:
𝑛(𝑛+1)(2𝑛+1)
Prove by mathematical induction ∑𝑛𝑖=1 𝑖 2 =
6

[∴ ∑𝒏𝒊=𝟏 = 12+22+32+…+n2]

Proof:

1. Basis:
n=1
L.H.S = 12=1.
𝑛(𝑛+1)(2𝑛+1) 1(1+1)(2∗1+1)
R.H.S = =
6 6
1(2)(3)
= = 1.
6
L.H.S = R.H.S, given expression is true for n=1.
2. By induction Hypothesis:
𝑘(𝑘+1)(2𝑘+1)
For every k > 0, 12+22+32+…k2 = .
6
3. Statement to be shown in inductive step:
(𝑘+1)((𝑘+1)+1)(2(𝑘+1)+1)
12+22+32+…k2+(k+1)2 = .
6
L.H.S:
𝑘(𝑘+1)(2𝑘+1)
= +(k+1)2
6
𝑘(2𝑘+1)
= (k+1) [ +k+1]
6
𝑘(2𝑘+1)+6(𝑘+1)
= (k+1) [ ]
6
2𝑘 2 +𝑘+6𝑘+6
= (k+1) [ ]
6
2𝑘 2 +7𝑘+6
= (k+1) [ ]
6
2𝑘 2 +4𝑘+3𝑘+6
= (k+1) [ ]
6
2𝑘(𝑘+2)+3(𝑘+2)
= (k+1) [ ]
6
(𝑘+1)(2𝑘+2)
= (k+1) [ ]
6
(𝑘+1)+1 (2(𝑘+1)+1)
= (k+1) [ ]
6
(𝑘+1)(𝑘+1)+1 (2(𝑘+1)+1)
=
6
= R.H.S
Therefore P(k+1) is also true for every k > 0.
Example 3:
𝑛(3𝑛−1)
Prove that 1+4+7+… + (3n-2) = for n > 0.
2
Proof:
1. Basis of Induction:
n=1
L.H.S = 3(1) – 2
= 3-2=1
𝑛(3𝑛−1) 1(3(1)−1) 2
R.H.S = = = =1
2 2 2
Therefore L.H.S = R.H.S, given expression is true for n=1.
2. By induction hypothesis:
𝑘(3𝑘−1)
For every k >0, 1+4+7+…+ (3k-2) =
2
3. Statement to be shown in induction step:
(𝑘+1)(3(𝑘+1)−1)
1+4+7+…+(3k-2)+(3(k+1)-2) =
2
4. Proof of induction step:

L.H.S = 1+4+7+…+(3k-2)+(3(k+1)-2)
𝑘(3𝑘−1)
= + (3(k+1)) – 2, by induction hypothesis.
2

𝑘(3𝑘−1)+2(3(𝑘+1)−2)
=
2

3𝑘 2 −𝑘+2(3𝑘+3−2)
=
2

3𝑘 2 −𝑘+6𝑘+6−4
=
2

3𝑘 2 +5𝑘+2
=  By factorization,
2
(𝑘+1)(3𝑘+2)
= 3𝑘 2 + 5𝑘 + 2 = 3𝑘 2 + 2𝑘 + 3𝑘 + 2
2

(𝑘+1)(3(𝑘+1)−1)
= =(2k+2)+3k(k+1) = 2(k+1) + 3k(k+1)
2

= L.H.S =(2+3k)(k+1) = (3k+2) (k+1)s

Therefore P(K+1) is also true for every k > 0.

Example 4:

Prove 7+13+19+…+(6n+1) = n(3n+4)

Proof:

1. Basis of Induction:
n=1
L.H.S = 6(1)+1 = 7
R.H.S = 1(3*1+4)
= 1(3+4) = 1(7)
=7
L.H.S = R.H.S
Therefore P(1) is true.
2. Induction Hypothesis:
For every k ≥ 1
7+13+19+…+ (6k+1) = k (3k+4)
P(k) is true.
3. Statement to be shown in induction step:
7+13+19+…+ (6k+1) + (6(k+1) +1)
= (k+1) (3(k+1) +4)
Therefore [(k+1) (3k+7)]
4. Proof of induction step:
L.H.S = 7+13+19+…+ (6k+1) +6(k+1) +1

= k (3k+4) + 6 (k+1) + 1 by factorization,


= 3k2+ 4k+ 6k+6+1 3k2+3k+7K+7
= 3k2+10k+7 = 3k (k+1) +7(k+1)
= (k+1) (3k+7) = (3k+7) (k+1)
= (k+1(3k+3+4)
= (k+1)(3(k+1)+4)
Therefore P(k+1) is true for every k > 0.

Example 5:
1 𝑛
Prove by mathematical induction ∑𝑛𝑖=1 =
𝑖(𝑖+1) 𝑛+1
1 1 1 1 𝑛
i.e) + + +⋯+ =
1(2) 2(3) 3(4) 𝑛(𝑛+1) 𝑛+1
Proof:
1. Basis of induction:
n=1
1 1
L.H.S = =
1(1+1) 2
𝑛 1 1
R.H.S = = =
𝑛+1 1+1 2
∴ L.H.S = R.H.S
∴ P (1) is true.
2. Induction Hypothesis:
n=k
1 1 1 𝑘
for every k > 0, + + ⋯+ =
1(2) 2(3) 𝑘(𝑘+1) 𝑘+1
P(k) is true.
3. Statement to be shown in induction step:
1 1 1 1 𝑘+1
+ +⋯+ + =
1(2) 2(3) 𝑘(𝑘+1) (𝑘+1)((𝑘+1)+1) (𝑘+1)+1
4. Proof of induction step:
1 1 1 1 1 𝑘+1
+ + +⋯+ + (𝑘+1)((𝑘+1)+1) =
1(2) 2(3) 3(4) 𝑘(𝑘+1) 𝑘+1+1
1 1 1 1 1
L.H.S = + + + ⋯+ + (𝑘+1)((𝑘+1)+1)
1(2) 2(3) 3(4) 𝑘(𝑘+1)

𝑘 1
= + (𝑘+1)((𝑘+1)+1)
𝑘+1

𝑘(𝑘+1)((𝑘+1)+1)+(𝑘+1)
=
(𝑘+1)(𝑘+1)((𝑘+1)+1)

𝑘(𝑘+1)(𝑘+2)+(𝑘+1)
=
(𝑘+1)(𝑘+1)(𝑘+2)

𝑘(𝒌+𝟏)(𝑘+2)+(𝑘+1)
=
(𝒌+𝟏)(𝑘+1)(𝑘+2)
𝑘(𝑘+2)+1
=  by factorization, k2+k+k+1
(𝑘+1)(𝑘+2)

k2 +2k+1
= =k (k+1) + (k+1) = (k+1) (k+1)
(𝑘+1)(𝑘+2)

(𝒌+𝟏)(𝑘+1)
=
(𝒌+𝟏)(𝑘+2)

𝑘+1
=
𝑘+1+1

= R.H.S

P (k+1) is also true for every k > 0.

Example 6:

Prove by mathematical induction 1+∑𝑛𝑖=1 𝑖 ∗ 𝑖! = (n+1)!

Proof:

∑𝑛𝑖=1 𝑖 ∗ 𝑖! = (n+1)! – 1

i.e) 1*1! +2*2! +3*3! +…+n*n! = (n+1)! – 1

1. Basis of induction:

n=1

L.H.S = n*n! = 1*1! =1

R.H.S = (n+1)! – 1 = (1+1)! – 1 = 2! - 1 = 2 -1 =1

L.H.S = R.H.S

2. Induction Hypothesis:

n=k

for every k > 0 1*1! + 2*2! +… +k*k! = (k+1)! – 1

P (k) is true.

3. Statement to be shown in induction step:

1*1! + 2* 2! + … + k*k! + (k+1) * (k+1)! = (k+1+1)! – 1


= (k+2)! – 1

4. Proof of induction step:

L.H.S = (k+1)! – 1 + (k+1) * (k+1)!

= (k+1)! + (k+1) * (k+1)! – 1

= (k+1)! (1+ (k+1)) – 1

= (k+1)! (k+2) – 1  1*2*3*4 = 4!

= (k+2)! – 1 3! * 4 = 4!

= R.H.S

∴ P (k+1) is also true for every k > 0.

Concepts of Automata Theory:

Alphabet:

An alphabet is a finite, non-empty set of symbols. It is denoted by ∑.

Example:

i) ∑ = {a,b}, an alphabet of 2 symbols a and b.


ii) ∑ = {0, 1, 2}, an alphabet of 3 symbols 0, 1 and 2.
iii) ∑ = {a,b,…,z}, the set of all lower case letters.

String:

A string (or) word over an alphabet set ∑ is a finite sequence of symbols from ∑.

Example:

i) If ∑ = {a,b} then abab, aabba area all strings over the alphabet ∑ = {a,b}.
ii) If ∑ = {a} then a, aa, aaa, are all strings over the alphabet ∑ = {a}.

Operation on Integers:

 Length of a String:
Let w be the string then “length of the string │w│ is the number of
symbols composing the string.

Example:

i) If w=abcd then │w│ = 4.


ii) If x=0101010 then │x│= 7.
iii) │ ε │= 0.
 Empty or Null String:
i) The string consisting of zero symbols or the length of a string is
zero.
ii) It is denoted by ε.
iii) │ ε │=0=│ x│
 Concatenation of String:

The concatenation of two strings w and v is the string obtained by


appending the symbols of v to the right end of w.

i.e) if w=a1a2a3…am and v=b1b2b3…bn

then wv=a1a2a3…amb1b2b3…bn.

Example:

i) If x=010, y=1 then

xy=0101 and yx=1010

ii) If x=COMP and y=UTER then


xy=COMPUTER
iii) Empty string is the identity element for concatenation operator i.e)
wε = εw.
 Reverse of a String:
i) The reverse of a string is obtained by writing the symbols in reverse
order.
ii) Let w is a string. Then its reverse is wR.
i.e) w=a1a2a3…am
wR = am… a3a2a1
iii) If u=100010 the uR=010001
 Power of an alphabet:
Let ∑ be an alphabet, then
∑* denotes the set of all string over the alphabet ∑.
∑m denotes the set of all string over the alphabet ∑ of length m.

Example:

If ∑ = {0, 1} then

∑0 = {ε} empty string.

∑1 = {0, 1} set of all string of length one over ∑ = {0, 1}.

∑2 = {00, 01, 10, 11} set of all string of length over ∑ = {0, 1}.

 Kleen’s Closure:
Let ∑ be an alphabet, then “kleen’s closure ∑*” denotes the set of all
strings over the alphabet ∑ (includes ε, empty string).
Example:
i) If ∑ = {a} then ∑* = {ε,a,aa…}.
ii) If ∑ = {0,1} then ∑*={ε,0,1,00,11,10…}
iii) If ∑ = {0} then ∑* = {ε, 0, 00, 000…}
∑0= {ε}
∑1= {a}
∑2= {aa}
∴ ∑* = ∑0∪∑1∪∑2∪…
 Substring:
A string v appears within another string w(w=uv) is called substring of w.
If w=uv, then substrings u and v are said to be prefix and suffix of w respectively.
Example:
i) w=abbab be a string over an alphabet ∑ = {a,b} then
a,ab,abb,ba,bab,… are all substrings of w.
ii) w=123

Prefixes = {ε, 1, 12, 123}

Suffixes = {ε, 3, 23, 123}

iii) w=abbab
Prefixes = {ε, a, ab, abb, abba, abbab}

Suffixes = {ε, b, ab, bab, bbab, abbab}

 Palindrome:
i) A palindrome is a string, which is same whether written forward or
backward.
Example:
madam, 121
ii) If the length of the palindrome is even, then it can be obtained by
concatenation of a string and its reverse.
Example:
If U = 10 and UR = 01 then even palindrome UUR=1001.
 Properties of string operations:
i) Concatenation is associative, that is for all strings u,v, and w
(uv)w = u(vw).
ii) If u and v are strings then the length of their concatenation is the
sum of the individual length, i.e) │uv│=│u│+│v│.

Example:

x=abc and y=123

xy = abc123

│xy│=6 i.e) │x│=3, │y│=3 hence │xy│=│x│+│y│

 Languages:
For any alphabet ∑, any subset L of ∑* is a language. A set of strings from
an alphabet is called a language.
Example:
i) English: It is a language over ∑= {a,b,c,…z}.
ii) Binary string: {0, 1, 01, 0101 …} is a language over ∑ = {o,1}.
iii) If ∑={a,b} is a alphabet then ∑*={ε, a,b,aa,ab…} is a language.
 Notations:
1. {λ} or {ε} : Empty string or Null string language. It is a language over
every alphabet and it contains exactly one string ε or λ.
Example:
{λ} or {ε} has one string λ or ε.
2. Φ: Empty language.
Example:
It contains no strings.

3. ∑*: Universal language.


It contains all string over the alphabet ∑.
 Operations on Languages:
1. Product or concatenation
L1.L2 = L1L2 = {xy: xЄL1, yЄL2}
i.e) the concatenation of two languages L1 and L2 are set of all strings
constructed by concatenating any element of L1 with element of L2.
2. Reversal:
The reverse of a language is the set of all string reversals.
i.e) LR={wR : w Є L}
3. Power:
For a given language L,L0={λ} we define Ln as L concatenated itself
n times.
i.e) L0 = {λ}
L1 = L
Lk = L.Lk-1

////////////////////////////
 Kleene Star (or) Star Closure:
For a language L, L* = ⋃∞ 𝑖
𝑖=0 𝐿 (or) L* = L ∪L ∪L …
0 1 2

 Kleene plus (or) Positive Closure:


For a language L
L+ = ⋃∞ 𝑖 + 1 2
𝑖=0 𝐿 (or) L = L ∪L ∪L ∪…
3

= L* - {λ}
 Union:
The union of L1 and L2 denoted by L1∪L2 is
L1∪L2 = {w: wЄL1 or w Є L2}
 Intersection:
The intersection of L1 and L2 denoted by L1 ∩ L2 is
L1∩ L2 = {w: wЄL1 and wЄL2}

Introduction to Theory of computation: (TOC)

 TOC describes the basic ideas and models underlying computing.


 Computation is executing an algorithm i.e) it involves taking some inputs and
performing required operation on it to produce an output.

Computation:
Function f
Input x Output y=f(x)
 TOC suggests various abstract models of computation represented mathematically.

Applications:

i) Compiler Design
ii) Robotics
iii) Artificial intelligence
iv) Knowledge Engineering

Finite Automaton:

Definition 1: A finite automaton has a set of states and its control moves from state to
state in response to external inputs.

Automaton = Abstract Computing Device

Definition 2: A finite automata is a mathematical model of how computer functions


while running a program. It consists of finite set of states and a set of
transitions from state to state that occurs on input symbols from alphabet ∑.

Classification of finite automata:

 Deterministic finite automata (DFA)


 Nondeterministic finite automata (NFA)

Examples:

1. Finite automaton for on/off switch – Digital systems:

push

off on

push

2. Lexical Analysis – Recognizing a string “then” :

h e n
Start
t th the then
Definitions:

Deterministic Finite Automata:

The automaton cannot be in more than one state at any one time.

(or)

“One and only one transition on same input symbol”

Nondeterministic Finite Automata:

This type of automaton can be in several states at once.

(or)

“More than one transition on same input symbol”

Deterministic Finite Automata: (DFA)

The term “deterministic” refers to the fact that for one each input there is one and
only one state to which the automaton can transition from its current state.

 A deterministic finite automaton consists of


i. A finite set of states often denoted by φ.
ii. A finite set of input symbols often denoted ∑.
iii. A transition function that takes as arguments a state and input
symbol and return a state. It is denoted by δ.
1. δ is represented by arcs between states and the labels on the
arcs.
2. If ‘q’ is a state and ‘a’ is an input symbol then δ(q,a) is the
state ‘p’ such that //////////////// δ(q,a)=p.
iv. A start state one of the states in Q.
v. A set of final or accepting states F. The set F is a subset of Q.
i.e) F subset Q
 DFA is generally specified by a five tuple M = (Q, ∑, S, F, δ).
o Q is a finite non empty set of states.
o ∑ is an input alphabet.
o S subset of Q is a start state.
o F subset Q is a set of final states.
o δ is a transition function defined as
δ: Q X ∑ → Q
Notation for DFAs:

1. Transition Diagram

A transition diagram for a DFA M = (Q, ∑, δ, q0, F) is a graph defined as


follows:

i. For each state in Q there is a node.


ii. 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 labeled ‘a’.
iii. There is an arrow into the start state q0 labeled start.
iv. Nodes corresponding to accepting states are marked by a
double circle.

Example:

M = {{q0q1q2},{0,1},δ, q0,{ q2}}


0
0
1 1
Start
q0 q1 q2
0 1

The δ function is defined as follows;

{q0,0} = q0

{q0,1} = q1

{q1,0} = q0

{q1,1} = q2

{q2,0} = q2

{q2, 1} = q1

Transition table:

 A transition table is a 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
inputs ‘a’ is the state δ(q,a).
Example:
0
0
1 1
Start
q0 q1 q2
0 1

Input Symbols
State 0 1
q0 q0 q1
q1 q0 q2
q2 q2 q1

Extending the transition function to strings:

 We define an extended transition function that describes what happens when we


start in any state and follow any sequence of inputs.
 If δ is our transition function, then the extended transition function constructed
from δ will be called δ’.
 The extended transition function is a sequence is a function that takes a state ‘q’
and a string ‘w’ and returns a state P.
δ'(q,w) = δ(δ’(q,x),a) [w=xa]

Properties of Transition function δ:

 δ(q,ε) = q
 for all string w and input a, δ(q,wa) = δ(δ(q,w),a)
 Similarly δ(q,aw) = δ(δ(q,a),w)
 The transition function δ can be extended to δ’ that operates on states and strings.
i.e) δ’(q, ε) = q.
 δ'(q,wa)= δ(δ’(q,w),a).

Properties of Transition function δ:

 δ(q,ε) = q
 for all string w and input a, δ(q,wa) = δ(δ(q,w),a)
 Similarly δ(q,aw) = δ(δ(q,a),w)
 The transition function δ can be extended to δ’ that operates on states and strings.
i.e) δ’(q, ε) = q.
 δ'(q,wa)= δ(δ’(q,w),a).

Solution:

Properties of Transition function δ:

 δ(q,ε) = q
 for all string w and input a, δ(q,wa) = δ(δ(q,w),a)
 Similarly δ(q,aw) = δ(δ(q,a),w)
 The transition function δ can be extended to δ’ that operates on states and strings.
i.e) δ’(q, ε) = q.
 δ'(q,wa)= δ(δ’(q,w),a).

Example 1:

Design a FA which accepts the only input 101 over the input set ∑={0,1}.

start 1 0 1
S1 S2 S2 S3 S4 S4

Example 2:

Design a FA which checks whether the given binary number is even.

Solution:

 Any binary number ends with ‘0’ are always “even”. [0010 (2), 0100 (4)…]
 When a binary number ends with ‘1’ it always “odd”. [0001 (1), 0011(3)].
0

0 q2
Start
q0 1
0
1 q1

1
For example consider the input string 0100 i.e) 4 (even number) is traversed as
0 1 0 0
q0  q2  q1  q2  *q2  Accepted

Consider the string 0101 i.e) 5 (odd number) is traversed as

0 1 0 1
q0  q2  q1  q2  q1  Not Accepted

Transition Table:

Input
State
0 1
q0 q2 q 1
q1 q2 q 1
*q2 q2 q 1

Example 3:

Design FA which accepts only those strings which start with 1 and ends with 0.

Solution:
1 0
0
Start 1
q0 q1 q2
1
For example consider the string w=1000

1 0 0 0
q0 q1 q2  q2*q2  Accepted

Consider another string w=1001

1 0 0 1
q0 q1 q2  q2q1  Not Accepted

Example 4:

Design FA which accepts odd number of 1’s and any number of 0’s.

Solution: 0

1 q2
Start
q0 1 1
Consider the string 1011 (odd) which is accepted and 1010 (even) not accepted.

Example 5:

Design a FA which checks whether the given unary number is divisible by 3.

Solution:

 The unary number is made up of ones.


 For example, the number 3 can be written in unary form as 111 and 5 can be
written in unary form as 11111.

Start 1 1 1
q0 q1 q2 q3

Transition Table:

Input
State
1
q0 q1
q1 q2
q2 q3
*q3 q1

Example 6:

Design DFA to accept the string that always ends with 00.

Solution:

1 0
Start 0 0
q0 q1 q2

1
Consider the string 101000,

1 0 1 0 0 0
q0  q0  q1  q0  q1  q2  q2 Accepted

Consider the string 101001,

1 0 1 0 0 1
q0  q0  q1  q0  q1  q2  q0  Not Accepted

Transition Table:

Input
State
0 1
q0 q1 q 0
q1 q2 q 0
*q2 q2 q 0

Example 7:

Construct the transition graph for a FA which accepts a language L over ∑ = {0,1}
in which every string starts with 0 and ends with 1.
0 1
Start 1
0
q0 q1 q2

1
0
q3 Dead state

0,1

Example 8:
Design a DFA for accepting all the strings of {L=0m1n | m ≥ 0, n ≥ 0}

Solution:
0 1

Start 1
Transition Table: q0 q1

Input
State
0 1
q0 q0 q 1
*q1 - q1

Example 9:

Language accepted by DFA is L = {awa: w Є {a,b}*}

Solution:
a
b

Start a a
q0 q1 q2

b
b

q3

a,b

Example 10:

Design DFA over ∑ = {a,b} for

i. (ab)n with n ≥ 0
ii. (ab)n with n ≥ 1
i) (ab)n with n ≥ 0

a
Start
q0 q1
b
ii) (ab)n with n ≥ 1

Start a b
q0 q1 q2

Example 11: a

Input
State
0 1
q0 q1 q 0
q1 q2 q 0
*q2 q2 q 0
Check whether the input string 101000 is accepted or not?

Solution:

δ'(q0,ε) = q0\

δ'(q0,1) = δ(δ'(q0,ε),1)

= δ(q0,1) = q0

δ'(q0,10) = δ(δ'(q0,1),0)

= δ(q0,0) = q1

δ'(q0,101) = δ(δ'(q0,10),1)

= δ(q1,1) = q0

δ'(q0,1010) = δ(δ'(q0,101),0)

= δ(q0,0) = q1

δ'(q0,10100) = δ(δ'(q0,1010),0)

= δ(q1,0) = q2

δ'(q0,101000) = δ(δ'(q0,10100),0)

= δ(q2,0) = q2

q2 is the final state. Hence the given string 101000 is accepted.

Example 12:
Input
State
0 1
q0 q2 q 1
q1 q2 q 1
*q2 q2 q 1
Check whether the input strings 0100 and 0101 are accepted or not.

Solution:

Input string: 0100

δ'(q0,ε) = q0

δ'(q0,0) = δ(δ'(q0,ε),0)

= δ(q0,0) = q2

δ'(q0,01) = δ(δ'(q0,0),1)

= δ(q2,1) = q1

δ(δ'(q0,010) = δ(δ'(q0,01),0)

= δ(q1,0) = q2

δ(δ'(q0,0100) = δ(δ'(q0,010),0)

= δ(q2,0) = q2

q2 is the final state. Hence the given string 0100 is accepted.

Input string: 0101

δ'(q0,ε) = q0

δ'(q0,0) = δ(δ'(q0,ε),0)

= δ(q0,0) = q2

δ'(q0,01) = δ(δ'(q0,0),1)

= δ(q2,1) = q1

δ'(q0,010) = δ(δ'(q0,01),0)

= δ(q1,0) = q2
δ'(q0,0101) = δ(δ'(q0,010),1)

= δ(q2,1) = q1

q1 is not the final state. Hence the given string 0101 is not accepted.

Non deterministic Finite Automata (NFA)

 An NFA has a finite set of states, a finite set of input symbols, one start state and
set of accepting states.
 The difference between the DFA and the NFA is in the type of δ
i) For the NFA, δ is a function that takes a state and an input symbol as
arguments, but returns a set of zero, one or more states.
δ (q,a) = {p,q}
Ex: δ (q0,a) = {q1,q2}
ii) For the DFA, δ is a function returns only one state.
δ (q,a) = {ps}
Ex: δ (q0,a) = {q1}

Example: An NFA accepting all strings that ends with 01.

NFA:
0,1

Start 0 1
q0 q1 q2

Definition of Nondeterministic Finite Automata (NFA):

The non deterministic finite automata (NFA) is defined by a five tuple notation

(Q, ∑, δ, S, F) where

1. Q = finite set of states


2. ∑ = alphabet
3. S = start state where S Є Q
4. F = set of final states where F Є Q
5. δ = the transition function which takes a state in Q and an input symbol in ∑ as
arguments and returns a subset of Q, i.e)
δ (q,a) = {p,q} where p,q are states
δ: Q X ∑ to 2Q (2Q is the power set of Q).
Example:

An NFA accepting all strings that end with 01.

Transition Diagram:

0,1

Start 0 1
q0 q1 q2

Transition Table is

Input
State
0 1
q0 { q0q1} {q1}
q1 φ {q1}
*q2 φs φ

The above NFA can be specifies formally as follows:

({q0, q1, q2}, {0,1}, δ, q0,{q2})

The extended transition function (δ’):

 To extend the transition function δ of an NFA to a function δ’ that takes a state q


and a string of input symbol w, and returns the set of states that the NFA is in if it
starts in state q and process the string w.

Basis: δ’ (q, w) = {q}

Induction:

 Suppose w is of the form w=xa, where a is the final symbol of w and x is the rest
of w.
 Also suppose that δ’(q,x) = {p1,p2,…,pk}.

Let

⋃𝑘𝑖=1 δ(Pi, a)= {r1, r2,…, rm}


Then δ’ (q,w) = (r1,r2,…,rm)

δ’(q,wa) = ⋃𝑃ϵδ’(q,w) δ(P, a) for each w ϵ ∑*, a ϵ ∑, Pϵ δ’(q,w).

Example:

0,1

Start 0 1
q0 q1 q2

Let us use δ’ to describe the process of input 00101 by the above NFA.

δ’(q0,ε) = {q0}

δ’(q0,0) = δ(q0,0) = {q0,q1}

δ’(q0,00) = δ((q0,0),0)

= δ({q0,q1},0)

= δ(q0,0) ∪ δ(q1,0)

= {q0,q1} ∪ φ

= {q0,q1}
Finite Automata with Epsilon-Transition:

Introduction:

The ε-transitions in NFA are given in order to move from one state to another
without having any symbol from input set ∑.

Example:
2
0 1

Start 0,ε 1,ε


q0 q1 q2

 In this NFA with ε, q0 is a start state with input 0; one can either be in state q0 or in
state q1.
 If we get at the start a symbol 1, then with ε-move we can change state from q0 to
q1 and then input we can be in state q1.
For example, the string w=002 is accepted by the NFA along the path q0, q0, q0, q1,
q2, q2 with labelled 0, 0, ε, ε, 2.
Definition (or) Formal notation for an ε-NFA:
The language accepted by NFA with ε denoted by M = (Q, ∑, δ, q0, F) can
be defined as follows:
Let
M= (Q, ∑, δ, q0, F) be a NFA with ε where,
Q is a finite set of states
∑ is input symbols
δ is a transition function for transition from Q X { ∑ ∪ ε } to 2Q
q0 is a start state.
F is a set of final states such that F ⊆ Q.
The string w is accepted by NFA can be represented as
L(M) = {w | w ⊆ ∑* and δ transition for w from q0 reaches to F}
Example:
Construct NFA with ε which accepts a language consisting the strings of
any number of a’s followed by any number of b’s followed by any number of c’s.
Solution:
a b c

Start ε ε
q0 q1 q2

Transition Table:

input
State
a b c ε
q0 q0 φ φ q1
q1 φ q1 φ q2
*q2 φ φ q2 φ

Epsilon Closures: (ECLOSE)

 Informally, we ε-close a state q by following all transitions out of q that are


labelled ε.
 When we get to other states by following ε we follow the ε-transitions out of those
states and so on.
 Finding every state that can be reached from q along any path whose arcs are
labelled ε.

Example:

0 1 2

Start ε ε
q0 q1 q2

Transition diagram

Input
State
0 1 2 ε
q0 q0 φ φ q1
q1 φ q1 φ q2
*q2 φ φ q2 φ
 The ε-CLOSURE(q0) = { q0, q1, q2}. i.e) the path consisting of q0 along is a path
from q0 to q2 with all arcs labelled ε.
 The path from q0 to q1 labelled ε shows that q0 is in ε-CLOSURE(q0) and path q0 ,
q1, q2 shows q2 is in ε-CLOSURE(q0).

ε-CLOSURE definition:

1. Let p be set of states.


2. Then ε-CLOSURE(p) = ∪𝑞∈𝑝 ε-CLOSURE(q)
3. δ' transition function is defined as
a. δ'(q,ε) = ε-CLOSURE(q)
b. for w in ∑*, and a in ∑
δ'(q,wa) = ε-CLOSURE(p), where p= {p | for some r in δ'(q,w), p in
δ(r,a)}
c. δ(R,a) = ∪𝑞 𝑖𝑛 𝑅 δ(q,a)
d. δ’(R,w) = ∪𝑞 𝑖𝑛 𝑅 δ’(R,w)
4. he language accepted by NFA with ε-moves is defined as:
L(M) = {w | δ'(q0,w) contains a state in F}.

Example:

ε ε
2 3 6
ε

1
b

4 5 7
a ε
ε-closure(1) = {1,2,4,3,6}={1,2,3,4,6}

ε-closure(2) = {2,3,6}

ε-closure(5) = {5,7}

Example:

1. Consider the NFA given below and find ẟ(q0,01).


0 1 2

Start ε ε
q0 q1 q2

Solution:

ẟ(q0, ε) = ε-closure(q0) = {q0,q1,q2} --------------- 1

Thus

ẟ(q0,0) = ε-closure(ẟ(ẟ(q0, ε),0))

= ε-closure(ẟ({q0,q1,q2},0))

= ε-closure(ẟ(q0,0)∪ẟ(q1,0) )∪ ẟ(q2,0)

= ε-closure({q0}∪{φ}∪{φ})

= ε-closure({q0})

= {q0, q1, q2} from the equation 1

Then

ẟ(q0,01) = ε-closure(ẟ(ẟ(q0, 0),1))

= ε-closure(ẟ({q0,q1,q2},1))

= ε-closure(ẟ(q0,1)∪ẟ(q1,1) )∪ ẟ(q2,1)

= ε-closure({φ}∪{q1}∪{φ})

= ε-closure({q1})

= {q1, q2}

Since ẟ(q0,01) = {q1, q2} which contains final state {q2}, it is an accepting string.

Conversion and equivalence:

NFA with ԑ NFA without ԑ DFA


Conversion from NFA with ε to without ε

1. Find out all the ε transitions from each state from Q. That will be called as ε-
closure({qi}).

2. Then ẟ' transitions can be obtained. The ẟ' transitions means ε-closure on ẟ moves.

3. Step 2 is repeated for each input symbol and for each state of given NFA.

4. Using the resultant states the transition table for equivalent NFA without ε can be
built.

Rules for conversion:

ẟ'(q,a) = ε-closure(ẟ(ẟ'(q, ε),a)) where ẟ'(q, ε) = ε-closure(q)

Example 1:

Convert the following NFA with ε to without ε.

0 1 2

Start ε ε
q0 q1 q2

1. Finding out ε-transitions

ε-closure(q0) = {q0, q1, q2}

ε-closure(q1) = {q1, q2}

ε-closure(q2) = {q2}

2. ẟ' transitions for each state on each input symbol

ẟ'(q0,0) = ε-closure(ẟ(ẟ'(q0, ε),0)

= ε-closure(ẟ(ε-closure(q0),0)

= ε-closure(ẟ({q0, q1, q2}),0)

= ε-closure(ẟ(q0,0)∪ẟ(q1,0) ∪ ẟ(q2,0))
= ε-closure(q0 ∪ φ ∪ φ)

= ε-closure(q0)

= {q0, q1, q2}

ẟ'(q0,1) = ε-closure(ẟ(ẟ'(q0, ε),1)

= ε-closure(ẟ(ε-closure(q0),1)

= ε-closure(ẟ({q0, q1, q2}),1)

= ε-closure(ẟ(q0,1)∪ẟ(q1,1) ∪ẟ(q2,1))

= ε-closure(φ ∪ q1 ∪ φ)

= ε-closure(q1)

= {q1, q2}

ẟ'(q0,2) = ε-closure(ẟ(ẟ'(q0, ε),2)

= ε-closure(ẟ(ε-closure(q0),2)

= ε-closure(ẟ({q0, q1, q2}),2)

= ε-closure(ẟ(q0,2)∪ẟ(q1,2) ∪ẟ(q2,2))

= ε-closure(φ ∪ φ ∪ q2)

= ε-closure(q2)

= {q2}

ẟ'(q1,0) = ε-closure(ẟ(ẟ'(q1, ε),0)

= ε-closure(ẟ(ε-closure(q1),0)

= ε-closure(ẟ({q1, q2}),0)

= ε-closure(ẟ(q1,0) ∪ẟ( q2,0))

= ε-closure(φ ∪ φ)

= ε-closure(φ)


ẟ'(q1,1) = ε-closure(ẟ(ẟ'(q1, ε),1)

= ε-closure(ẟ(ε-closure(q1),1)

= ε-closure(ẟ({q1, q2}),1)

= ε-closure(ẟ(q1,1) ∪ẟ( q2,1))

= ε-closure(q1 ∪ φ)

= ε-closure(q1)

= {q1,q2}

ẟ'(q1,2) = ε-closure(ẟ(ẟ'(q1, ε),2)

= ε-closure(ẟ(ε-closure(q1),2)

= ε-closure(ẟ({q1, q2}),2)

= ε-closure(ẟ(q1,2) ∪ẟ( q2,2))

= ε-closure(φ ∪q2)

= ε-closure(q2)

= {q2}

ẟ'(q2,0) = ε-closure(ẟ(ẟ'(q2, ε),0)

= ε-closure(ẟ(ε-closure(q2),0)

= ε-closure(ẟ(q2,0))

= ε-closure(φ)

ẟ'(q2,1) = ε-closure(ẟ(ẟ'(q2, ε),1)

= ε-closure(ẟ(ε-closure(q2),1)

= ε-closure(ẟ(q2,1))

= ε-closure(φ)


ẟ'(q2,2) = ε-closure(ẟ(ẟ'(q2, ε),2)

= ε-closure(ẟ(ε-closure(q2),2)

= ε-closure(ẟ(q2,2))

= ε-closure(q2)

= {q2}

Therefore,

ẟ'(q0,0)= {q0, q1, q2}

ẟ'(q0,1)= φ

ẟ'(q0,2)= φ

ẟ'(q1,0)= {q1, q2}

ẟ'(q1,1)= {q1, q2}

ẟ'(q1,2)= φ

ẟ'(q2,0)= {q2}

ẟ'(q2,1)= {q2}

ẟ'(q2,2)= {q2}

Transition Table:

Input
State
0 1 2
*q0 {q0, q1, q2} {q1, q2} {q2}
*q1 φ {q1, q2} {q2}
*q2 φ φ {q2}

The equivalent NFA is


0 1

0,1
q0 q1

0,1,2 1,2

q2
Here q0,q1 and q2 are the final state because ε-closure(q0), ε-closure(q1) and ε-closure(q2)
contains final state q2.

Exercise Problems:

1. Convert the given NA with ε to ordinary NFA


ε

4 5
a ε
ε
Start a b ε ε
0 1 2 3 8 9

b
ε 6 7 ε

2. Convert the given NA with ε to ordinary NFA


b

Start
q0 a ε q2
q1

3. Convert the given NA with ε to ordinary NFA


b b

q0 ε ε
q1 q2

Conversion of NFA with ε to DFA

Method for converting NFA with ε to DFA


Step 1:

Consider M=(Q,∑,ẟ,q0,F) is a NFA with ε, we have to convert this NFA with ε to


equivalent DFA denoted by

MD = (QD,∑,ẟD,q0,FD)

Then obtain,

ε-closure(q0) = {p1,p2,...pn} then [p1,p2,...pn] becomes a start state of DFA. Now


[p1,p2,...pn] ϵ FD.

Step 2:

We will obtain ẟ transitions on [p1,p2,...pn] for each input.

ẟD([[p1,p2,...pn],a) = ε-closure(ẟ(p1,a) ∪ẟ(p2,a) ∪...ẟ(pn,a))

= ⋃𝑛𝑖=1 ε − closure(pi, a) where 'a' is the input ϵ ∑.

Step 3:

The state obtained [p1,p2,...pn] ϵ QD. The state containing in pi is a final state in
DFA.

Example:

Convert the following NFA with ε to equivalent DFA.

b a
ε
Start ε q2
q0 q1

b
Solution:

The transition table for the above diagram can be drawn as

Input
State
a b c
-> q0 φ q0 q1
q1 q1 φ q2
*q2 q1 q0 φ
Step 1:

ε-closure(q0) = {q0,q1,q2}

ε-closure(q1) = {q1,q2}

ε-closure(q2) = {q2}

Step 2:

Find new states, here {q0,q1,q2} and {q1,q2} are new states, so find ẟ transition of
every input symbols.

{q0,q1,q2} ------------> A

{q1,q2} ------------> B

ẟ'(A,a) = ε-closure(ẟ(A,a))

= ε-closure(ẟ({q0,q1,q2}),a)

= ε-closure(ẟ(q0,a)∪ẟ(q1,a)∪ẟ(q2,a))

= ε-closure(φ∪ q1∪ q1)

= ε-closure(q1)

ẟ'(A,a) = {q1,q2} ----------------> B

ẟ'(A,b) = ε-closure(ẟ(A,b))

= ε-closure(ẟ({q0,q1,q2}),b)

= ε-closure(ẟ(q0,b)∪ẟ(q1,b)∪ẟ(q2,b))

= ε-closure(q0∪φ∪ q0)

= ε-closure(q0)

ẟ'(A,b) = { q0,q1,q2} ----------------> A

ẟ'(B,a) = ε-closure(ẟ(B,a))

= ε-closure(ẟ({q1,q2}),a)
= ε-closure(ẟ(ẟ(q1,a)∪ẟ(q2,a))

= ε-closure(q1∪ q1)

= ε-closure(q1)

ẟ'(B,a) = {q1,q2} ----------------> B

ẟ'(B,b) = ε-closure(ẟ(B,b))

= ε-closure(ẟ({q1,q2}),b)

= ε-closure(ẟ(ẟ(q1,b)∪ẟ(q2,b))

= ε-closure(φ∪ q0)

= ε-closure(q0)

ẟ'(B,b) = {q0,q1,q2} ----------------> A

Step 3:

Transition Table:

Input
State
a b
->*A B A
*B B A

Transition Diagram (DFA)

b a
a

A B

b
Example 2:

Convert the following NFA with ε into its equivalent DFA.

0 1 2

Start ε ε
q0 q1 q2
Solution:

Transition table for the above given diagram is,

Input
State
0 1 2 ε
->q0 q0 φ φ q1
q1 φ q1 φ q2
*q2 φ φ q2 φ
Step 1:

ε-closure(q0) = {q0,q1,q2} ----------> A

ε-closure(q1) = {q1,q2} ----------> B

ε-closure(q2) = {q2} ------------> C

Step 2:

ẟ'(A,0) = ε-closure(ẟ(A,0))

= ε-closure(ẟ({q0,q1,q2}),0)

= ε-closure(ẟ(q0,0)∪ẟ(q1,0)∪ẟ(q2,0))

= ε-closure(q0∪ φ∪ φ)

= ε-closure(q0)

ẟ'(A,0) = { q0,q1,q2} ----------------> A

ẟ'(A,1) = ε-closure(ẟ(A,1))

= ε-closure(ẟ({q0,q1,q2}),1)

= ε-closure(ẟ(q0,1)∪ẟ(q1,1)∪ẟ(q2,1))

= ε-closure(φ∪q1∪ φ)

= ε-closure(q1)

ẟ'(A,1) = {q1,q2} ----------------> B

ẟ'(A,2) = ε-closure(ẟ(A,2))
= ε-closure(ẟ({q0,q1,q2}),2)

= ε-closure(ẟ(q0,2)∪ẟ(q1,2)∪ẟ(q2,2))

= ε-closure(φ∪ φ ∪ q2)

= ε-closure(q2)

ẟ'(A,2) = {q2} ----------------> C

ẟ'(B,0) = ε-closure(ẟ(B,0))

= ε-closure(ẟ({q1,q2}),0)

= ε-closure(ẟ(q1,0)∪ẟ(q2,0))

= ε-closure(φ∪ φ)

= ε-closure(φ)

ẟ'(BS,0) = { φ }

ẟ'(B,1) = ε-closure(ẟ(B,1))

= ε-closure(ẟ({q1,q2}),1)

= ε-closure(ẟ(q1,1)∪ẟ(q2,1))

= ε-closure({q1} ∪ φ)

= ε-closure({q1})

ẟ'(B,1) = { q1, q2} ----------------> B

ẟ'(B,2) = ε-closure(ẟ(B,2))

= ε-closure(ẟ({q1,q2}),2)

= ε-closure(ẟ(q1,2)∪ẟ(q2,2))

= ε-closure(φ ∪ {q2})

= ε-closure({q2})

ẟ'(B,2) = {q2} ----------------> C

ẟ'(C,0) = ε-closure(ẟ(C,0))
= ε-closure(ẟ({q2}),0)

= ε-closure(φ)

ẟ'(C,0) = { φ }

ẟ'(C,1) = ε-closure(ẟ(C,1))

= ε-closure(ẟ({q2}),1)

= ε-closure(φ)

ẟ'(C,1) = { φ }

ẟ'(C,2) = ε-closure(ẟ(C,2))

= ε-closure(ẟ({q2}),2)

= ε-closure({q2})

ẟ'(C,1) = {q2} ----------------> C

Step 3:

Transition table:

Input
State
0 1 2
->*A A B C
*B φ B C
*C φ φ C

Transition Diagram:
0 1

Start 1
A B

C
Exercise Problems:

1. Convert the given NFA with ε to its equivalent DFA.

q1
0
ε
Start 1
q0 q3 q4

ε 1
q2

2. Convert the given NFA with ε to its equivalent DFA.

Input
State
a b c ε
->p {p} {q} {r} φ
Q {q} {r} φ {p}
*r {r} φ {p} {q}

Theorem:

A language L is accepted by some ε-NFA if and only if(iff) L is accepted by some


DFA.

Proof:

Suppose

 L=L(D) for some DFA.


 D into an ε-NFA E by adding transition δ(q, ε) = φ for all states q of D.
 we must also convert the transition of D on input symbols.
Example:
δD(p,a) = p into an NFA transition to the set containing only p.
i.e) δE(p,a) = {p}.
 Thus e transition of E and D are the same, but E explicitly states that there
are no transition out of any state on ε.
 Let E=(QE,Σ,δE,q0,FE) be an ε-NFA. Apply the modified subset construction
described above to produce the DFA.
D = (QD,Σ,δD,q0,FD)
 we need to show that L(D) = L(E) an we do so b showing that the extended
transition functions of E and D are the same.
 Formally
δ'E(q0,w) = δ'D(qD,w) by induction on the length of w.
Basis:
 if |w| = 0, then w = ε.
 we know δ'E(q0, ε) = ECLOSE(q0).
 we also know that qD = ECLOSE(q0), because this is how the start state of D is
defined.
 for DFA, we know that δ'(p, ε) = p for any state p, so on particular
δ'D(qD, ε) = ECLOSE (q0).
 we have thus proved that δ'E(q0, ε) = δ'D(qD, ε).
Induction:
Suppose w=xa, where a is the final symbol of w and assume that the statement
holds for x.
i.e) δ'E(q0, x) = δ'D(qD, x).
 let both these sets of states be {p1,p2,...pk}.
 By the definition of δ' for ε-NFA's ,we compute δ'E(q0, w) by
 let {r1,r2,...rm} be ⋃𝑘𝑖=1 δE(Pi, a)
 Then δ'E(q0,w) = ECLOSE({r1,r2,...rm})
 If we examine the construction of DFA D in the modified subset construction, we
see that δD({P1,P2,...Pk},a) is the same set as δ'E(q0, w).
 we have now proved that δ'E(q0, x) = δ'D(qD, w) and completed the inductive part.

Theorem:

If L is accepted by NFA with ε-transitions, then L is accepted by an NFA without


ε-transitions. That is L(M) = L(M')
Proof:
 Let M = (Q,Σ,δ,q0,F) be an NFA with ε-transitions.
 Construct M' which is NFA without ε-transitions. M' = (Q,,',q0,F') where
𝐹 ∪ {𝑞0} 𝑖𝑓 ε − closure(q0) contains a state of F
F' = {
𝐹, 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
By induction:

In ε-NFA,  and ' are same and in NFA  and ' are different.
Let x be any string (q0,x) = '(q0,x) and '(q0, ε) = ε-closure(q0).

Basic step:

1 * 1 = 1, x is a symbol whose value is a /////////////////

Induction Step:

Let x=wa, where a is in.

'(q0,wa) = '('(q0,w) ,a)

= '((q0,w) ,a)

= '(p,a)

Now we must show that (p,a) = '(q0,a), but

(p,a) = ⋃𝑞 𝑖𝑛 𝑝 (q, a) = ⋃𝑞 𝑖𝑛 𝑝 ′(q, a)

= ’(’(q0,w),a)

= ’(q0,wa)

= ’(q0,x)

Hence, (q0,x) = ’(q0,x).

 But according to the second condition,


o (q,0,x) = {q,xx}
(q,ε,x) = {(p, ε}
(q,1,x) = {(q,x)}
o (p,1,x) = {(p, xx}
(p,ε,x) = {(p,ε}
The above transition, for (q,a,x) is not empty and (q,ε,x) is also non empty that violates
the second condition of
Finite Automata with Epsilon-Transition:

Introduction:

The ε-transitions in NFA are given in order to move from one state to another
without having any symbol from input set ∑.

Example:
2
0 1

Start 0,ε 1,ε


q0 q1 q2

 In this NFA with ε, q0 is a start state with input 0; one can either be in state q0 or in
state q1.
 If we get at the start a symbol 1, then with ε-move we can change state from q0 to
q1 and then input we can be in state q1.
For example, the string w=002 is accepted by the NFA along the path q0, q0, q0, q1,
q2, q2 with labelled 0, 0, ε, ε, 2.
Definition (or) Formal notation for an ε-NFA:
The language accepted by NFA with ε denoted by M = (Q, ∑, δ, q0, F) can
be defined as follows:
Let
M= (Q, ∑, δ, q0, F) be a NFA with ε where,
Q is a finite set of states
∑ is input symbols
δ is a transition function for transition from Q X { ∑ ∪ ε } to 2Q
q0 is a start state.
F is a set of final states such that F ⊆ Q.
The string w is accepted by NFA can be represented as

L(M) = {w | w ⊆ ∑* and δ transition for w from q0 reaches to F}


Example:
Construct NFA with ε which accepts a language consisting the strings of
any number of a’s followed by any number of b’s followed by any number of c’s.
Solution:
a b c

Start ε ε
q0 q1 q2

Transition Table:

input
State
a b c ε
q0 q0 φ φ q1
q1 φ q1 φ q2
*q2 φ φ q2 φ

Epsilon Closures: (ECLOSE)

 Informally, we ε-close a state q by following all transitions out of q that are


labelled ε.
 When we get to other states by following ε we follow the ε-transitions out of those
states and so on.
 Finding every state that can be reached from q along any path whose arcs are
labelled ε.
Example:

0 1 2

Start ε ε
q0 q1 q2

Transition diagram

Input
State
0 1 2 ε
q0 q0 φ φ q1
q1 φ q1 φ q2
*q2 φ φ q2 φ
 The ε-CLOSURE(q0) = { q0, q1, q2}. i.e) the path consisting of q0 along is a path
from q0 to q2 with all arcs labelled ε.
 The path from q0 to q1 labelled ε shows that q0 is in ε-CLOSURE(q0) and path q0 ,
q1, q2 shows q2 is in ε-CLOSURE(q0).

ε-CLOSURE definition:

5. Let p be set of states.


6. Then ε-CLOSURE(p) = ∪𝑞∈𝑝 ε-CLOSURE(q)
7. δ' transition function is defined as
a. δ'(q,ε) = ε-CLOSURE(q)
b. for w in ∑*, and a in ∑
δ'(q,wa) = ε-CLOSURE(p), where p= {p | for some r in δ'(q,w), p in
δ(r,a)}
c. δ(R,a) = ∪𝑞 𝑖𝑛 𝑅 δ(q,a)
d. δ’(R,w) = ∪𝑞 𝑖𝑛 𝑅 δ’(R,w)
8. he language accepted by NFA with ε-moves is defined as:
L(M) = {w | δ'(q0,w) contains a state in F}.

Example:

ε ε
2 3 6
ε

1
b

4 5 7
a ε
ε-closure(1) = {1,2,4,3,6}={1,2,3,4,6}

ε-closure(2) = {2,3,6}

ε-closure(5) = {5,7}

Example:

1. Consider the NFA given below and find ẟ(q0,01).

0 1 2

Start ε ε
q0 q1 q2

Solution:

ẟ(q0, ε) = ε-closure(q0) = {q0,q1,q2} --------------- 1

Thus

ẟ(q0,0) = ε-closure(ẟ(ẟ(q0, ε),0))

= ε-closure(ẟ({q0,q1,q2},0))

= ε-closure(ẟ(q0,0)∪ẟ(q1,0) )∪ ẟ(q2,0)

= ε-closure({q0}∪{φ}∪{φ})

= ε-closure({q0})

= {q0, q1, q2} from the equation 1

Then

ẟ(q0,01) = ε-closure(ẟ(ẟ(q0, 0),1))

= ε-closure(ẟ({q0,q1,q2},1))

= ε-closure(ẟ(q0,1)∪ẟ(q1,1) )∪ ẟ(q2,1)

= ε-closure({φ}∪{q1}∪{φ})
= ε-closure({q1})

= {q1, q2}

Since ẟ(q0,01) = {q1, q2} which contains final state {q2}, it is an accepting string.

Conversion and equivalence:

NFA with ԑ NFA without ԑ DFA

Conversion from NFA with ε to without ε

1. Find out all the ε transitions from each state from Q. That will be called as ε-
closure({qi}).

2. Then ẟ' transitions can be obtained. The ẟ' transitions means ε-closure on ẟ moves.

3. Step 2 is repeated for each input symbol and for each state of given NFA.

4. Using the resultant states the transition table for equivalent NFA without ε can be
built.

Rules for conversion:

ẟ'(q,a) = ε-closure(ẟ(ẟ'(q, ε),a)) where ẟ'(q, ε) = ε-closure(q)

Example 1:

Convert the following NFA with ε to without ε.

0 1 2

Start ε ε
q0 q1 q2

1. Finding out ε-transitions

ε-closure(q0) = {q0, q1, q2}

ε-closure(q1) = {q1, q2}


ε-closure(q2) = {q2}

2. ẟ' transitions for each state on each input symbol

ẟ'(q0,0) = ε-closure(ẟ(ẟ'(q0, ε),0)

= ε-closure(ẟ(ε-closure(q0),0)

= ε-closure(ẟ({q0, q1, q2}),0)

= ε-closure(ẟ(q0,0)∪ẟ(q1,0) ∪ ẟ(q2,0))

= ε-closure(q0 ∪ φ ∪ φ)

= ε-closure(q0)

= {q0, q1, q2}

ẟ'(q0,1) = ε-closure(ẟ(ẟ'(q0, ε),1)

= ε-closure(ẟ(ε-closure(q0),1)

= ε-closure(ẟ({q0, q1, q2}),1)

= ε-closure(ẟ(q0,1)∪ẟ(q1,1) ∪ẟ(q2,1))

= ε-closure(φ ∪ q1 ∪ φ)

= ε-closure(q1)

= {q1, q2}

ẟ'(q0,2) = ε-closure(ẟ(ẟ'(q0, ε),2)

= ε-closure(ẟ(ε-closure(q0),2)

= ε-closure(ẟ({q0, q1, q2}),2)

= ε-closure(ẟ(q0,2)∪ẟ(q1,2) ∪ẟ(q2,2))

= ε-closure(φ ∪ φ ∪ q2)

= ε-closure(q2)

= {q2}

ẟ'(q1,0) = ε-closure(ẟ(ẟ'(q1, ε),0)


= ε-closure(ẟ(ε-closure(q1),0)

= ε-closure(ẟ({q1, q2}),0)

= ε-closure(ẟ(q1,0) ∪ẟ( q2,0))

= ε-closure(φ ∪ φ)

= ε-closure(φ)

ẟ'(q1,1) = ε-closure(ẟ(ẟ'(q1, ε),1)

= ε-closure(ẟ(ε-closure(q1),1)

= ε-closure(ẟ({q1, q2}),1)

= ε-closure(ẟ(q1,1) ∪ẟ( q2,1))

= ε-closure(q1 ∪ φ)

= ε-closure(q1)

= {q1,q2}

ẟ'(q1,2) = ε-closure(ẟ(ẟ'(q1, ε),2)

= ε-closure(ẟ(ε-closure(q1),2)

= ε-closure(ẟ({q1, q2}),2)

= ε-closure(ẟ(q1,2) ∪ẟ( q2,2))

= ε-closure(φ ∪q2)

= ε-closure(q2)

= {q2}

ẟ'(q2,0) = ε-closure(ẟ(ẟ'(q2, ε),0)

= ε-closure(ẟ(ε-closure(q2),0)

= ε-closure(ẟ(q2,0))

= ε-closure(φ)

ẟ'(q2,1) = ε-closure(ẟ(ẟ'(q2, ε),1)

= ε-closure(ẟ(ε-closure(q2),1)

= ε-closure(ẟ(q2,1))

= ε-closure(φ)

ẟ'(q2,2) = ε-closure(ẟ(ẟ'(q2, ε),2)

= ε-closure(ẟ(ε-closure(q2),2)

= ε-closure(ẟ(q2,2))

= ε-closure(q2)

= {q2}

Therefore,

ẟ'(q0,0)= {q0, q1, q2}

ẟ'(q0,1)= φ

ẟ'(q0,2)= φ

ẟ'(q1,0)= {q1, q2}

ẟ'(q1,1)= {q1, q2}

ẟ'(q1,2)= φ

ẟ'(q2,0)= {q2}

ẟ'(q2,1)= {q2}

ẟ'(q2,2)= {q2}

Transition Table:

Input
State
0 1 2
*q0 {q0, q1, q2} {q1, q2} {q2}
*q1 φ {q1, q2} {q2}
*q2 φ φ {q2}

The equivalent NFA is


0 1

0,1
q0 q1

0,1,2 1,2

q
Here q0,q1 and q2 are the final state because
2
ε-closure(q0), ε-closure(q1) and ε-closure(q2)
contains final state q2.
2
Exercise Problems:

1. Convert the given NA with ε to ordinary NFA


ε

4 5
a ε
ε
Start a b ε ε
0 1 2 3 8 9

b
ε 6 7 ε

2. Convert the given NA with ε to ordinary NFA


b

Start
q0 a ε q2
q1

3. Convert the given NA with ε to ordinary NFA


b b

q0 ε ε
q1 q2

a
Conversion of NFA with ε to DFA

Method for converting NFA with ε to DFA

Step 1:

Consider M=(Q,∑,ẟ,q0,F) is a NFA with ε, we have to convert this NFA with ε to


equivalent DFA denoted by

MD = (QD,∑,ẟD,q0,FD)

Then obtain,

ε-closure(q0) = {p1,p2,...pn} then [p1,p2,...pn] becomes a start state of DFA. Now


[p1,p2,...pn] ϵ FD.

Step 2:

We will obtain ẟ transitions on [p1,p2,...pn] for each input.

ẟD([[p1,p2,...pn],a) = ε-closure(ẟ(p1,a) ∪ẟ(p2,a) ∪...ẟ(pn,a))

= ⋃𝑛𝑖=1 ε − closure(pi, a) where 'a' is the input ϵ ∑.

Step 3:

The state obtained [p1,p2,...pn] ϵ QD. The state containing in pi is a final state in
DFA.

Example:

Convert the following NFA with ε to equivalent DFA.

b a
ε
Start ε q2
q0 q1

b
Solution:

The transition table for the above diagram can be drawn as

Input
State
a b c
-> q0 φ q0 q1
q1 q1 φ q2
*q2 q1 q0 φ
Step 1:

ε-closure(q0) = {q0,q1,q2}

ε-closure(q1) = {q1,q2}

ε-closure(q2) = {q2}

Step 2:

Find new states, here {q0,q1,q2} and {q1,q2} are new states, so find ẟ transition of
every input symbols.

{q0,q1,q2} ------------> A

{q1,q2} ------------> B

ẟ'(A,a) = ε-closure(ẟ(A,a))

= ε-closure(ẟ({q0,q1,q2}),a)

= ε-closure(ẟ(q0,a)∪ẟ(q1,a)∪ẟ(q2,a))

= ε-closure(φ∪ q1∪ q1)

= ε-closure(q1)

ẟ'(A,a) = {q1,q2} ----------------> B

ẟ'(A,b) = ε-closure(ẟ(A,b))

= ε-closure(ẟ({q0,q1,q2}),b)
= ε-closure(ẟ(q0,b)∪ẟ(q1,b)∪ẟ(q2,b))

= ε-closure(q0∪φ∪ q0)

= ε-closure(q0)

ẟ'(A,b) = { q0,q1,q2} ----------------> A

ẟ'(B,a) = ε-closure(ẟ(B,a))

= ε-closure(ẟ({q1,q2}),a)

= ε-closure(ẟ(ẟ(q1,a)∪ẟ(q2,a))

= ε-closure(q1∪ q1)

= ε-closure(q1)

ẟ'(B,a) = {q1,q2} ----------------> B

ẟ'(B,b) = ε-closure(ẟ(B,b))

= ε-closure(ẟ({q1,q2}),b)

= ε-closure(ẟ(ẟ(q1,b)∪ẟ(q2,b))

= ε-closure(φ∪ q0)

= ε-closure(q0)

ẟ'(B,b) = {q0,q1,q2} ----------------> A

Step 3:

Transition Table:

Input
State
a b
->*A B A
*B B A

Transition Diagram (DFA)

b a
a

A B

b
Example 2:

Convert the following NFA with ε into its equivalent DFA.

0 1 2

Start ε ε
q0 q1 q2

Solution:

Transition table for the above given diagram is,

Input
State
0 1 2 ε
->q0 q0 φ φ q1
q1 φ q1 φ q2
*q2 φ φ q2 φ
Step 1:

ε-closure(q0) = {q0,q1,q2} ----------> A

ε-closure(q1) = {q1,q2} ----------> B

ε-closure(q2) = {q2} ------------> C

Step 2:

ẟ'(A,0) = ε-closure(ẟ(A,0))

= ε-closure(ẟ({q0,q1,q2}),0)

= ε-closure(ẟ(q0,0)∪ẟ(q1,0)∪ẟ(q2,0))

= ε-closure(q0∪ φ∪ φ)

= ε-closure(q0)

ẟ'(A,0) = { q0,q1,q2} ----------------> A

ẟ'(A,1) = ε-closure(ẟ(A,1))
= ε-closure(ẟ({q0,q1,q2}),1)

= ε-closure(ẟ(q0,1)∪ẟ(q1,1)∪ẟ(q2,1))

= ε-closure(φ∪q1∪ φ)

= ε-closure(q1)

ẟ'(A,1) = {q1,q2} ----------------> B

ẟ'(A,2) = ε-closure(ẟ(A,2))

= ε-closure(ẟ({q0,q1,q2}),2)

= ε-closure(ẟ(q0,2)∪ẟ(q1,2)∪ẟ(q2,2))

= ε-closure(φ∪ φ ∪ q2)

= ε-closure(q2)

ẟ'(A,2) = {q2} ----------------> C

ẟ'(B,0) = ε-closure(ẟ(B,0))

= ε-closure(ẟ({q1,q2}),0)

= ε-closure(ẟ(q1,0)∪ẟ(q2,0))

= ε-closure(φ∪ φ)

= ε-closure(φ)

ẟ'(BS,0) = { φ }

ẟ'(B,1) = ε-closure(ẟ(B,1))

= ε-closure(ẟ({q1,q2}),1)

= ε-closure(ẟ(q1,1)∪ẟ(q2,1))

= ε-closure({q1} ∪ φ)

= ε-closure({q1})

ẟ'(B,1) = { q1, q2} ----------------> B

ẟ'(B,2) = ε-closure(ẟ(B,2))
= ε-closure(ẟ({q1,q2}),2)

= ε-closure(ẟ(q1,2)∪ẟ(q2,2))

= ε-closure(φ ∪ {q2})

= ε-closure({q2})

ẟ'(B,2) = {q2} ----------------> C

ẟ'(C,0) = ε-closure(ẟ(C,0))

= ε-closure(ẟ({q2}),0)

= ε-closure(φ)

ẟ'(C,0) = { φ }

ẟ'(C,1) = ε-closure(ẟ(C,1))

= ε-closure(ẟ({q2}),1)

= ε-closure(φ)

ẟ'(C,1) = { φ }

ẟ'(C,2) = ε-closure(ẟ(C,2))

= ε-closure(ẟ({q2}),2)

= ε-closure({q2})

ẟ'(C,1) = {q2} ----------------> C

Step 3:

Transition table:

Input
State
0 1 2
->*A A B C
*B φ B C
*C φ φ C
Transition Diagram:
0 1

Start 1
A B

Exercise Problems: C

1. Convert the given NFA with ε to its equivalent DFA.


2
q1
0
ε
Start 1
q0 q3 q4

ε 1
q2

2. Convert the given NFA with ε to its equivalent DFA.

Input
State
a b c ε
->p {p} {q} {r} φ
Q {q} {r} φ {p}
*r {r} φ {p} {q}

Theorem:

A language L is accepted by some ε-NFA if and only if(iff) L is accepted by some


DFA.

Proof:
Suppose

 L=L(D) for some DFA.


 D into an ε-NFA E by adding transition δ(q, ε) = φ for all states q of D.
 we must also convert the transition of D on input symbols.
Example:
δD(p,a) = p into an NFA transition to the set containing only p.
i.e) δE(p,a) = {p}.
 Thus e transition of E and D are the same, but E explicitly states that there
are no transition out of any state on ε.
 Let E=(QE,Σ,δE,q0,FE) be an ε-NFA. Apply the modified subset construction
described above to produce the DFA.
D = (QD,Σ,δD,q0,FD)
 we need to show that L(D) = L(E) an we do so b showing that the extended
transition functions of E and D are the same.
 Formally
δ'E(q0,w) = δ'D(qD,w) by induction on the length of w.
Basis:
 if |w| = 0, then w = ε.
 we know δ'E(q0, ε) = ECLOSE(q0).
 we also know that qD = ECLOSE(q0), because this is how the start state of D is
defined.
 for DFA, we know that δ'(p, ε) = p for any state p, so on particular
δ'D(qD, ε) = ECLOSE (q0).
 we have thus proved that δ'E(q0, ε) = δ'D(qD, ε).
Induction:
Suppose w=xa, where a is the final symbol of w and assume that the statement
holds for x.
i.e) δ'E(q0, x) = δ'D(qD, x).
 let both these sets of states be {p1,p2,...pk}.
 By the definition of δ' for ε-NFA's ,we compute δ'E(q0, w) by
 let {r1,r2,...rm} be ⋃𝑘𝑖=1 δE(Pi, a)
 Then δ'E(q0,w) = ECLOSE({r1,r2,...rm})
 If we examine the construction of DFA D in the modified subset construction, we
see that δD({P1,P2,...Pk},a) is the same set as δ'E(q0, w).
 we have now proved that δ'E(q0, x) = δ'D(qD, w) and completed the inductive part.
Theorem:

If L is accepted by NFA with ε-transitions, then L is accepted by an NFA without


ε-transitions. That is L(M) = L(M')
Proof:
 Let M = (Q,Σ,δ,q0,F) be an NFA with ε-transitions.
 Construct M' which is NFA without ε-transitions. M' = (Q,,',q0,F') where
𝐹 ∪ {𝑞0} 𝑖𝑓 ε − closure(q0) contains a state of F
F' = {
𝐹, 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
By induction:

In ε-NFA,  and ' are same and in NFA  and ' are different.

Let x be any string (q0,x) = '(q0,x) and '(q0, ε) = ε-closure(q0).

Basic step:

1 * 1 = 1, x is a symbol whose value is a /////////////////

Induction Step:

Let x=wa, where a is in.

'(q0,wa) = '('(q0,w) ,a)

= '((q0,w) ,a)

= '(p,a)

Now we must show that (p,a) = '(q0,a), but

(p,a) = ⋃𝑞 𝑖𝑛 𝑝 (q, a) = ⋃𝑞 𝑖𝑛 𝑝 ′(q, a)

= ’(’(q0,w),a)

= ’(q0,wa)

= ’(q0,x)
Hence, (q0,x) = ’(q0,x).

 But according to the second condition,


o (q,0,x) = {q,xx}
(q,ε,x) = {(p, ε}
(q,1,x) = {(q,x)}
o (p,1,x) = {(p, xx}
(p,ε,x) = {(p,ε}
The above transition, for (q,a,x) is not empty and (q,ε,x) is also non empty that violates
the second condition of

You might also like