Preprint
Article

This version is not peer-reviewed.

A Mathematical Approach to the Theory of Finite Automata

Submitted:

05 September 2025

Posted:

09 September 2025

You are already at the latest version

Abstract

There is a lack of rigorous mathematical treatment in the theory of finite automata. This paper provides a rigorous mathematical approach to automata theory which doesn’t currently exist in the literature of theoretical computer science. Basic definitions are developed in mathematical terms and used as the foundation for constructing mathematical proofs for theorems. It provides a model for instructors to write better lecture notes and authors to write better textbooks for educational purpose. It also corrects some critical errors and erroneous arguments that can be found in many textbooks which are widely used in the education of theoretical computer science.

Keywords: 
;  ;  ;  ;  ;  

1. Deterministic Finite Automaton (DFA)

Definition 1.
A deterministic finite automaton denoted by D F A is a 5-tuple,
M = ( Q , Σ , δ , q 0 , F ) , where
(i) Q is a finite set of states;
(ii) Σ is a finite alphabet;
(iii) δ : Q × Σ Q is the transition function;
(iv) q 0 Q is the start state; and
(v) F Q is the set of accept states.
Let w = w 1 w 2 w 3 , , w n be a string over Σ where each w i Σ and n 1 .
M accepts w if and only if r 0 , r 1 , r 2 , , r n Q s.t. the following conditions are satisfied:
(a) r 0 = q 0 ;
(b) δ ( r i , w i + 1 ) = r i + 1 for i = 0 , 1 , 2 , , n 1 ; and
(c) r n F
For n = 0 , w = ϵ . Only conditions (a) and (c) are applicable and they become r 0 = q 0 and r 0 F . We therefore define M to accept ϵ if the start state is also an accept state.
On the other hand, since there is no ϵ-movement in a D F A , the only way the D F A can accept an empty string is to accept it at the start state.
Accordingly, M accepts ϵ if and only if the start state is also an accept state.
If we write r i w i + 1 , δ r i + 1 instead of δ ( r i , w i + 1 ) = r i + 1 for i = 0 , 1 , 2 , , n 1 , then conditions (a), (b) and (c) can be written as follows:
q 0 = r 0 w 1 , δ r 1 w 2 , δ r 2 r n 1 w n , δ r n , r n F
We say M recognizes language A if A = { w Σ * M accepts w } and it is written as L ( M ) = A
Definition 2.
A language is called regular if it is recognized by a D F A .
Definition 3.
For any language L,
L 0 = { ϵ } , L 1 = L , L 2 = L L , , L m + 1 = L m L for m > 0 .
L * = L 0 L 1 L 2 = k = 0 L k
= { w | w = w 1 w 2 w 3 w n ; w i L for 1 i n ; n 1 } { ϵ }
Definition 4.
Inductive Transition Function
Let M = ( Q , Σ , δ , q 0 , F ) be a D F A .
δ ^ : Q × Σ * Q s.t.
(i) δ ^ ( q , ϵ ) = q q Q
(ii) δ ^ ( q , w a ) = δ ( δ ^ ( q , w ) , a ) a Σ , w Σ * , q Q
Definition 5.
p , q Q , w Σ * , p w , δ ^ q d e f q = δ ^ ( p , w )
Proposition 1.
δ ^ ( q , a ) = δ ( q , a ) q Q , a Σ
< P r o o f >
δ ^ ( q , a ) = δ ^ ( q , ϵ a ) = δ ( δ ^ ( q , ϵ ) , a ) ( D e f i n i t i o n 1.4 ( i i ) ) = δ ( q , a ) ( D e f i n i t i o n 1.4 ( i ) )
Theorem 1.
( DFA Acceptance )
For any D F A , M = ( Q , Σ , δ , q 0 , F )
δ ^ ( q 0 , w ) F M accepts w w Σ *
< P r o o f >
Claim: If w = w 1 w 2 w n where n 0 and
q 0 = r 0 w 1 , δ r 1 w 2 , δ r 2 r i w i + 1 , δ r i + 1 r n 1 w n , δ r n , then δ ^ ( r 0 , w ) = r n
This Claim can be proved by induction on n.
For n = 0 , w = ϵ and the computation becomes q 0 = r 0 .
δ ^ ( q 0 , w ) = δ ^ ( q 0 , ϵ )
= q 0    (By Definition 1.4(i))
= r 0
Therefore, the statement is true for n = 0 .
Assume the statement is true for n = k , where k 0 .
That is, δ ^ ( r 0 , w 1 w 2 w k ) = r k
δ ^ ( r 0 , w 1 w 2 w k w k + 1 ) = δ ( δ ^ ( r 0 , w 1 w 2 w k ) , w k + 1 ) ( Definition   1.4 ( i i ) ) = δ ( r k , w k + 1 ) ( Induction   Hypothesis ) = r k + 1 ( Definition   of   r i + 1 )
Therefore, the statement is true for n = k + 1 .
If M accepts w = w 1 w 2 w n , where w i Σ for 1 i n and n 1 or ( w = ϵ and n = 0 )
r 0 , r 1 , r 2 , r n Q st
q 0 = r 0 w 1 , δ r 1 w 2 , δ r 2 r i w i + 1 , δ r i + 1 r n 1 w n , δ r n , r n F
By Claim, δ ^ ( r 0 , w 1 w 2 w n ) = r n
Therefore, δ ^ ( q 0 , w ) = r n ( r 0 = q 0 ; w = w 1 w 2 w n )
Since r n F ,
δ ^ ( q 0 , w ) F
Therefore, M accepts w δ ^ ( q 0 , w ) F
Conversely, if δ ^ ( q 0 , w ) F
δ ^ ( q 0 , w 1 w 2 w n ) F
Take r 0 = q 0
r i + 1 = δ ( r i , w i + 1 ) i = 0 , 1 , 2 , n 1
q 0 = r 0 w 1 , δ r 1 w 2 , δ r 2 r i w i + 1 , δ r i + 1 r n 1 w n , δ r n
By Claim, δ ^ ( r 0 , w 1 w 2 w n ) = r n
Since δ ^ ( q 0 , w 1 w 2 w n ) F , r n F .
Therefore, M accepts w.
Therefore, δ ^ ( q 0 , w ) F M accepts w.
Therefore, δ ^ ( q 0 , w ) F M accepts w.
This completes the proof.
Theorem 2.
For any D F A s , M and M where
M = ( Q , Σ , δ , q 0 , F )
M = ( Q , Σ , δ , q 0 , F )
q Q , a Σ , w Σ *
δ ( q , a ) = δ ( q , a ) δ ^ ( q , w ) = δ ^ ( q , w )
< P r o o f >
The proof is by induction on | w | 0 .
For | w | = 0 , w = ϵ .
By Definition 1.4(i),
δ ^ ( q , ϵ ) = q and δ ^ ( q , ϵ ) = q
Therefore, δ ^ ( q , ϵ ) = δ ^ ( q , ϵ )
Assume the statement is true for | w | = k 0 .
δ ^ ( q , w a ) = δ ( δ ^ ( q , w ) , a ) = δ ( δ ^ ( q , w ) , a ) ( δ ( q , a ) = δ ( q , a ) ) = δ ( δ ^ ( q , w ) , a ) ( Induction   Hypothesis ) = δ ^ ( q , w a ) ( Definition   1.4 ( i i ) )
The statement is also true for | w | = k + 1

2. Nondeterministic Finite Automaton (NFA)

Definition 6.
A nondeterministic finite automaton ( N F A ) is a 5-tuple,
N = ( Q , Σ , δ , q 0 , F ) , where
(i) Q is a finite set of states;
(ii) Σ is a finite alphabet;
(iii) δ : Q × Σ ϵ P ( Q ) is the transition function, where
   Σ ϵ = Σ { ϵ } , P ( Q ) = the power set of Q = { S S Q } .
(iv) q 0 Q is the start state; and
(v) F Q is the set of accept states.
Let w = w 1 w 2 w 3 w m where w i Σ ϵ for 1 i m and m 1 .
N accepts w if and only if r 0 , r 1 , r 2 , , r m Q s.t. the following conditions are satisfied:
(a) r 0 { q 0 }
(b) r i + 1 δ ( r i , w i + 1 ) for i = 0 , 1 , 2 , , m 1
(c) r m F
For m = 0 , w = ϵ .
Only conditions (a) and (c) are applicable and they become r 0 = q 0 and r 0 F .
We therefore define N to accept ϵ if the start state is also an accept state.
If we write r i w i + 1 , δ r i + 1 instead of r i + 1 δ ( r i , w i + 1 ) for i = 0 , 1 , 2 , , m 1 , then conditions (a), (b) and (c) can be written as follows:
q 0 = r 0 w 1 , δ r 1 w 2 , δ r 2 r i w i + 1 , δ r i + 1 r m 1 w m , δ r m , r m F .
Note that when m = 0 , this computation becomes q 0 = r 0 and r 0 F .
Definition 7.
(Inductive Transition Function)
Let N = ( Q , Σ , δ , q 0 , F ) be an N F A .
δ ^ : P ( Q ) × Σ ϵ * P ( Q ) such that
(i) δ ^ ( A , ϵ ) = A A P ( Q )
(ii) δ ^ ( A , w a ) = q δ ^ ( A , w ) δ ( q , a ) a Σ ϵ , w Σ ϵ * , A P ( Q ) .
Definition 8.
p , q Q , w Σ ϵ * , p w , δ ^ q d e f q δ ^ ( { p } , w ) .
Proposition 2.
If N = ( Q , Σ , δ , q 0 , F ) is an N F A , then
a Σ ϵ , p Q , δ ^ ( { p } , a ) = δ ( p , a ) .
< P r o o f >
δ ^ ( { p } , a ) = δ ^ ( { p } , ϵ a )
= q δ ^ ( { p } , ϵ ) δ ( q , a ) (Definition 1.10 (ii))
= q { p } δ ( q , a ) (Definition 1.10 (i))
= δ ( p , a )
Proposition 3.
If N = ( Q , Σ , δ , s 0 , F ) is an N F A ,
w Σ ϵ * where w = w 1 w 2 w 3 w n ; w i Σ ϵ for 1 i n and n 1 or w = ϵ for n = 0 .
( r 0 , r 1 , r 2 , , r n Q s.t. s 0 = r 0 w 1 , δ r 1 w 2 , δ r 2 r n 1 w n , δ r n ) r n δ ^ ( { s 0 } , w )
< P r o o f >
This proposition can be proved by induction on n.
Let P ( n ) denote the statement:
( r 0 , r 1 , r 2 , , r n Q s.t. s 0 = r 0 w 1 , δ r 1 w 2 , δ r 2 r n 1 w n , δ r n ) ; and
Q ( n ) denote the statement: r n δ ^ ( { s 0 } , w ) .
For n = 0 , w = ϵ .
P ( 0 ) ( r 0 Q s.t. s 0 = r 0 )
r 0 { s 0 }
r 0 δ ^ ( { s 0 } , ϵ ) (Definition 1.10(i))
r 0 δ ^ ( { s 0 } , w ) ( w = ϵ )
Q ( 0 )
Assume P ( k ) Q ( k ) for any k 0 .
P ( k + 1 ) ( r 0 , r 1 , r 2 , r k , r k + 1 Q s.t. s 0 = r 0 w 1 , δ r 1 w 2 , δ r 2 r k 1 w k , δ r k w k + 1 , δ r k + 1 )
P ( k + 1 ) P ( k ) (From computation path of P ( k + 1 ) )
Q ( k ) (Induction Hypothesis)
r k δ ^ ( { s 0 } , w ) where w 1 w 2 w 3 w k = w (Definition of Q ( k ) )
Since
δ ^ ( { s 0 } , w w k + 1 ) = q δ ^ ( { s 0 } , w ) δ ( q , w k + 1 ) (Definition 1.10(ii)
and r k δ ^ ( { s 0 } , w ) ,
δ ( r k , w k + 1 ) δ ^ ( { s 0 } , w w k + 1 )
r k w k + 1 , δ r k + 1 (From computation path of P ( k + 1 ) )
Therefore, r k + 1 δ ( r k , w k + 1 ) δ ^ ( { s 0 } , w w k + 1 )
Therefore, r k + 1 δ ^ ( { s 0 } , w w k + 1 )
Therefore, P ( k + 1 ) Q ( k + 1 ) .
Conversely,
Q ( k + 1 ) r k + 1 δ ^ ( { s 0 } , w w k + 1 )
r k + 1 q δ ^ ( { s 0 } , w ) δ ( q , w k + 1 )
r k + 1 δ ( r k , w k + 1 ) for some r k δ ^ ( { s 0 } , w )
r k δ ^ ( { s 0 } , w ) Q ( k )
P ( k ) (Induction Hypothesis)
( r 0 , r 1 , r 2 , r k Q s.t. s 0 = r 0 w 1 , δ r 1 w 2 , δ r 2 r k 1 w k , δ r k )
r k + 1 δ ( r k , w k + 1 ) r k w k + 1 , δ r k + 1
Combining the two computation paths,
s 0 = r 0 w 1 , δ r 1 w 2 , δ r 2 r k 1 w k , δ r k w k + 1 , δ r k + 1
Therefore, Q ( k + 1 ) P ( k + 1 ) and the proof is complete.
Proposition 4.
x , y Σ ϵ * & A P ( Q ) , δ ^ ( A , x y ) = δ ^ ( δ ^ ( A , x ) , y )
< P r o o f >
The proof is by induction on n = | y | .
Let T ( n ) denote the statement corresponding to n = 0 , 1 , 2 ,
For | y | = 0 , y = ϵ .
δ ^ ( A , x ϵ ) = δ ^ ( A , x )
= δ ^ ( δ ^ ( A , x ) , ϵ ) (Definition 1.10(i))
T ( 0 ) is true.
Assume T ( k ) is true for | y | = k 0 .
That is δ ^ ( A , x y ) = δ ^ ( δ ^ ( A , x ) , y ) for | y | = k 0
For any a Σ ϵ , y Σ ϵ * , | y | = k
LHS of T ( k + 1 ) = δ ^ ( A , x y a )
= q δ ^ ( A , x y ) δ ( q , a ) (By Definition 1.10(ii))
= q δ ^ ( δ ^ ( A , x ) , y ) δ ( q , a ) (By Induction Hypothesis)
= δ ^ ( δ ^ ( A , x ) , y a ) (By Definition 1.10(ii))
= RHS of T ( k + 1 )
Therefore, T ( k ) T ( k + 1 ) .
Proposition 5.
A i Q , x Σ ϵ * , i = 1 , 2 , n , n N , δ ^ i = 1 n A i , x = i = 1 n δ ^ ( A i , x )
< P r o o f >
The proof is by induction on | x | .
For | x | = 0 , x = ϵ .
δ ^ i = 1 n A i , ϵ = i = 1 n A i (Definition 1.10(i))
= i = 1 n δ ^ ( A i , ϵ ) (Definition 1.10(i))
Claim: n N , sets A i and S x
x i = 1 n A i S x = i = 1 n x A i S x
<Proof of Claim>
LHS = x A 1 A 2 A n S x
= x A 1 S x x A 2 S x x A n S x
= i = 1 n x A i S x
= RHS
Assume the statement is true for | x | = k for k 0 .
a Σ ϵ , | x a | = k + 1 .
δ ^ i = 1 n A i , x a = p δ ^ ( ( i = 1 n A i ) , x ) δ ( p , a ) (Definition 1.10(ii))
= p i = 1 n δ ^ ( A i , x ) δ ( p , a ) (Induction Hypothesis)
= i = 1 n p δ ^ ( A i , x ) δ ( p , a ) (Claim)
= i = 1 n δ ^ ( A i , x a ) (Definition 1.10(ii))
Therefore, the statement is also true for | x | = k + 1 .
Proposition 6.
δ ^ ( A , x ) = q A δ ^ ( { q } , x ) for all A Q .
< P r o o f >
LHS = δ ^ q A { q } , x
= q A δ ^ ( { q } , x ) (Proposition 1.15)
= RHS
Proposition 7.
A , B , where A B Q , δ ^ ( A , x ) δ ^ ( B , x )
< P r o o f >
B = A ( B A ) (Set Theory)
δ ^ ( B , x ) = δ ^ ( A ( B A ) , x )
= δ ^ ( A , x ) δ ^ ( B A , x ) (Proposition 1.15)
Therefore, δ ^ ( A , x ) δ ^ ( B , x )
Proposition 8.
For any two N F A s N 1 and N 2 , where
N 1 = ( Q 1 , Σ , δ 1 , q 1 , F 1 )
N 2 = ( Q 2 , Σ , δ 2 , q 2 , F 2 ) and Q 1 Q 2
q Q 1 , a Σ ϵ , δ 1 ( q , a ) δ 2 ( q , a ) δ 1 ^ ( { q } , w ) δ 2 ^ ( { q } , w ) w Σ ϵ *
< P r o o f >
The proof is by induction on | w | .
For | w | = 0 , w = ϵ .
δ 1 ^ ( { q } , ϵ ) = { q } and δ 2 ^ ( { q } , ϵ ) = { q } (By Definition 1.10(i))
Therefore, δ 1 ^ ( { q } , ϵ ) δ 2 ^ ( { q } , ϵ ) .
The statement is true for | w | = 0 .
Assume the statement is true for | w | = k 0 .
That is, δ 1 ^ ( { q } , w ) δ 2 ^ ( { q } , w ) for | w | = k 0 .
For k + 1 ,
δ 1 ^ ( { q } , w a ) = p δ 1 ^ ( { q } , w ) δ 1 ( p , a )
p δ 2 ^ ( { q } , w ) δ 2 ( p , a ) (By Induction Hypothesis and δ 1 ( q , a ) δ 2 ( q , a ) )
= δ 2 ^ ( { q } , w a ) (By Definition 1.10(ii))
Theorem 3.
(NFA acceptance)
N = ( Q , Σ , δ , s 0 , F ) is an N F A .
w Σ ϵ * where w = w 1 w 2 w 3 w n ; and
( w i Σ ϵ for 1 i n and n 1 ) or ( w = ϵ and n = 0 ) .
N accepts w if and only if δ ^ ( { s 0 } , w ) F
In other words, N accepts w if and only if ( r F s.t. s 0 w , δ ^ r )
< P r o o f >
If N accepts w
r 0 , r 1 , r 2 , r n Q s.t. s 0 = r 0 w 1 , δ r 1 w 2 , δ r 2 r n 1 w n , δ r n and r n F .
r n δ ^ ( { s 0 } , w ) (By Proposition 1.13)
Since r n is also in F,
δ ^ ( { s 0 } , w ) F
Conversely, if δ ^ ( { s 0 } , w ) F ,
r n δ ^ ( { s 0 } , w ) and r n F .
r 0 , r 1 , r 2 , r n Q s.t. s 0 = r 0 w 1 , δ r 1 w 2 , δ r 2 r n 1 w n , δ r n ; r n F (Proposition 1.13)
Therefore, N accepts w.

3. Epsilon-Closure

The ϵ -Closure of a set of states is a collection of states that can be reached from a member of the given set of states via zero or a finite number of ϵ transitions.
Formally, we define ϵ -Closure as follows.
Definition 9.
Let N = ( Q , Σ , δ , s 0 , F ) be an N F A .
For any R Q , the ϵ-Closure of R is
E ( R ) = { q Q p ϵ i , δ ^ q for some p R } where
i is an integer 0 and p ϵ 0 , δ ^ q means p = q .
Proposition 9.
A i Q , i = 1 , 2 , n , n N , E i = 1 n A i = i = 1 n E ( A i )
< P r o o f >
Claim. E ( A 1 A 2 ) = E ( A 1 ) E ( A 2 )
<Proof of Claim>
q E ( A 1 A 2 ) p A 1 A 2 s.t. p ϵ i , δ ^ q where i 0
( ( p A 1 ) ( p A 2 ) ) ( p ϵ i , δ ^ q where i 0 )
( q E ( A 1 ) ) ( q E ( A 2 ) )
q E ( A 1 ) E ( A 2 )
Therefore, E ( A 1 A 2 ) = E ( A 1 ) E ( A 2 )
With this Claim and an induction argument, we can conclude Proposition 1.21.

4. The Equivalence of DFA and NFA

Lemma 1.
Let N = ( Q , Σ , δ , q 0 , F ) be an N F A , M = ( Q , Σ , δ , q 0 , F ) be a D F A .
Q = P ( Q ) , q 0 = E ( { q 0 } ) , F = { R Q R F }
δ : Q × Σ Q such that
δ ( R , a ) = r R E ( δ ( r , a ) ) a Σ , R Q
Let w = w 1 w 2 w 3 w n such that if n = 0 , w = ϵ and if n 1 , then w i ϵ 1 i n .
Let i 0 , i 1 , i 2 , i n be integers 0 , q 0 , q 1 , q 2 , q n Q , p 1 , p 2 , p 3 , p n Q and q Q .
The following holds:
q 0 ϵ i 0 , δ ^ q 1 w 1 , δ p 1 ϵ i 1 , δ ^ q 2 w 2 , δ p 2 ϵ i 2 , δ ^ q 3 q n 1 w n 1 , δ p n 1 ϵ i n 1 , δ ^ q n w n , δ p n ϵ i n , δ ^ q .
q δ ^ ( q 0 , w )
< P r o o f >
Proof is by induction on | w | = n .
Let P ( n ) denote the statement of
q 0 ϵ i 0 , δ ^ q 1 w 1 , δ p 1 ϵ i 1 , δ ^ q 2 w 2 , δ p 2 ϵ i 2 , δ ^ q 3 q n 1 w n 1 , δ p n 1 ϵ i n 1 , δ ^ q n w n , δ p n ϵ i n , δ ^ q .
and Q ( n ) denote the statement of q δ ^ ( q 0 , w ) corresponding to n 0 .
For | w | = n = 0 , w = ϵ .
P ( 0 ) q 0 ϵ i 0 , δ ^ q q E ( { q 0 } ) q q 0 ( q 0 = E ( { q 0 } ) ) q δ ^ ( q 0 , ϵ ) (Definition 1.4(i))
q δ ^ ( q 0 , w ) ( w = ϵ )
Q ( 0 )
Assume P ( k ) Q ( k ) for k 0 .
P ( k + 1 )
q 0 ϵ i 0 , δ ^ q 1 w 1 , δ p 1 ϵ i 1 , δ ^ q 2 w 2 , δ p 2 ϵ i 2 , δ ^ q 3 q k w k , δ p k ϵ i k , δ ^ q k + 1 w k + 1 , δ p k + 1 ϵ i k + 1 , δ ^ q .
P ( k ) & q k + 1 w k + 1 , δ p k + 1 ϵ i k + 1 , δ ^ q
Q ( k ) & q k + 1 w k + 1 , δ p k + 1 ϵ i k + 1 , δ ^ q (Induction Hypothesis)
q k + 1 δ ^ ( q 0 , w ) where | w | = k & q k + 1 w k + 1 , δ p k + 1 ϵ i k + 1 , δ ^ q
q k + 1 δ ^ ( q 0 , w ) where | w | = k & q E ( δ ( q k + 1 , w k + 1 ) )
q r δ ^ ( q 0 , w ) E ( δ ( r , w k + 1 ) ) where | w | = k
q δ ( δ ^ ( q 0 , w ) , w k + 1 ) where | w | = k
(Consider R = δ ^ ( q 0 , w ) , w k + 1 = a & δ ( R , a ) = d e f r R E ( δ ( r , a ) ) )
q δ ^ ( q 0 , w w k + 1 ) where | w | = k (Definition 1.4(ii))
Q ( k + 1 )
This completes the proof of Lemma 1.22.
Theorem 4.
Every N F A can be converted to an equivalent D F A .
< P r o o f >
Let N = ( Q , Σ , δ , q 0 , F ) be an N F A .
Construct a DFA as follows.
M = ( Q , Σ , δ , q 0 , F ) where
Q = P ( Q ) , q 0 = E ( { q 0 } ) , F = { R Q R F }
δ : Q × Σ Q such that
δ ( R , a ) = r R E ( δ ( r , a ) ) a Σ , R Q
We claim that N and M are equivalent by showing that
w Σ ϵ * , N accepts w M accepts w
The proof is divided into two cases, one with w = ϵ and one with w ϵ .
(i) w = ϵ
If N accepts w,
j 0 s.t. q 0 ϵ j , δ ^ p and p F .
Therefore, p E ( { q 0 } ) & p F .
Therefore, p q 0 & p F .
Therefore, q 0 F .
Therefore, q 0 F .
Therefore, the start state of M is also an accept state of M.
By definition, M accepts ϵ ( = w ) .
Conversely, if M accepts w = ϵ ,
q 0 F (A D F A accepts ϵ iff its start state is also an accept state.)
q 0 F (By definition of F )
p q 0 and p F .
Since q 0 = E ( { q 0 } ) , q 0 ϵ j , δ ^ p for some j 0 .
Since p F , N accepts ϵ j , which is same as ϵ.
(ii) w ϵ
w i ϵ , 1 i n , n 1 and
w = ϵ i 0 w 1 ϵ i 1 w 2 ϵ i 2 w 3 ϵ i 3 w n ϵ i n for some integers i 0 , i 1 , i 2 , i n 0
If N accepts w,
q 0 , q 1 , q 2 , q n Q , p 1 , p 2 , p 3 , p n Q and q Q . s.t.
q 0 ϵ i 0 , δ ^ q 1 w 1 , δ p 1 ϵ i 1 , δ ^ q 2 w 2 , δ p 2 ϵ i 2 , δ ^ q 3 q n 1 w n 1 , δ p n 1 ϵ i n 1 , δ ^ q n w n , δ p n ϵ i n , δ ^ q & q F .
By Lemma 1.22, q δ ^ ( q 0 , w ) where w = w 1 w 2 w 3 w n .
Therefore, δ ^ ( q 0 , w ) F .
Therefore, δ ^ ( q 0 , w ) F .
Therefore, M accepts w ( D F A acceptance)
Conversely, if M accepts w = w 1 w 2 w 3 w n ,
δ ^ ( q 0 , w ) F ( D F A acceptance)
δ ^ ( q 0 , w ) F (Definition of F )
q δ ^ ( q 0 , w ) and q F .
By Lemma 1.22,
q 0 ϵ i 0 , δ ^ q 1 w 1 , δ p 1 ϵ i 1 , δ ^ q 2 w 2 , δ p 2 ϵ i 2 , δ ^ q 3 q n 1 w n 1 , δ p n 1 ϵ i n 1 , δ ^ q n w n , δ p n ϵ i n , δ ^ q & q F .
Therefore, N accepts w = ϵ i 0 w 1 ϵ i 1 w 2 ϵ i 2 w 3 ϵ i 3 w n ϵ i n
This completes the proof of Theorem 1.23.
Corollary 1.
A language is regular iff some N F A recognizes it.

5. Regular Operators

Regular Languages are closed under the operation of Regular Operators.
Theorem 5.
L is regular Σ * L is regular.
< P r o o f >
Let M = ( Q , Σ , δ , q 0 , F ) be the D F A that recognizes L.
That is, L ( M ) = L .
Define M = ( Q , Σ , δ , q 0 , Q F ) where
δ : Q × Σ Q s.t. q Q , a Σ , δ ( q , a ) = δ ( q , a )
w Σ * L ,
w L δ ^ ( q 0 , w ) F
δ ^ ( q 0 , w ) Q F
δ ^ ( q 0 , w ) Q F (Theorem 1.8)
M accepts w
Conversely, if M accepts w, δ ^ ( q 0 , w ) Q F
δ ^ ( q 0 , w ) Q F (Theorem 1.8)
Therefore, δ ^ ( q 0 , w ) F
Therefore, w L (because w L M accepts w δ ^ ( q 0 , w ) F )
w Σ * L
Therefore, w Σ * L M accepts w.
L ( M ) = Σ * L
Σ * L is regular.
Theorem 6.
L 1 and L 2 are regular L 1 L 2 is regular.
< P r o o f >
D F A s M 1 and M 2 s.t. L ( M 1 ) = L 1 and L ( M 2 ) = L 2
Let M 1 = ( Q 1 , Σ , δ 1 , s 0 , F 1 )
M 2 = ( Q 2 , Σ , δ 2 , s 0 , F 2 )
Define M 3 as follows.
M 3 = ( Q 3 , Σ , δ 3 , s 0 , F 3 )
where s 0 = ( s 0 , s 0 ) , Q 3 = Q 1 × Q 2 , F 3 = F 1 × F 2
δ 3 : Q 3 × Σ Q 3 s.t.
δ 3 ( ( q 1 , q 2 ) , a ) = ( δ 1 ( q 1 , a ) , δ 2 ( q 2 , a ) ) q 1 Q 1 , q 2 Q 2 , a A .
Claim. n N { 0 } , w Σ * , where | w | = n , if
(i) s 0 = r 0 w 1 , δ 1 r 1 w 2 , δ 1 r 2 r n 1 w n , δ 1 r n
(ii) s 0 = r 0 w 1 , δ 2 r 1 w 2 , δ 2 r 2 r n 1 w n , δ 2 r n
(iii) s 0 = r 0 w 1 , δ 3 r 1 w 2 , δ 3 r 2 r n 1 w n , δ 3 r n
then r n = ( r n , r n ) .
Proof of Claim is by induction on n.
For n = 0 , (i), (ii) and (iii) become s 0 = r 0 , s 0 = r 0 , and s 0 = r 0 .
s 0 = ( s 0 , s 0 ) (By definition of M 3 .)
Therefore, r 0 = ( r 0 , r 0 )
Assume the statement is true for n = k 0 .
(i), (ii) & (iii) for n = k + 1
s 0 = r 0 w 1 , δ 1 r 1 w 2 , δ 1 r 2 r k 1 w k , δ 1 r k w k + 1 , δ 1 r k + 1
s 0 = r 0 w 1 , δ 2 r 1 w 2 , δ 2 r 2 r k 1 w k , δ 2 r k w k + 1 , δ 2 r k + 1
s 0 = r 0 w 1 , δ 3 r 1 w 2 , δ 3 r 2 r k 1 w k , δ 3 r k w k + 1 , δ 3 r k + 1
⇒ (i), (ii) & (iii) for n = k & r k w k + 1 , δ 1 r k + 1 & r k w k + 1 , δ 2 r k + 1 & r k w k + 1 , δ 3 r k + 1
r k = ( r k , r k ) & r k + 1 = δ 1 ( r k , w k + 1 ) & r k + 1 = δ 2 ( r k , w k + 1 ) & r k + 1 = δ 3 ( r k , w k + 1 )
(Induction Hypothesis)
r k + 1 = δ 1 ( r k , w k + 1 ) & r k + 1 = δ 2 ( r k , w k + 1 ) & r k + 1 = δ 3 ( ( r k , r k ) , w k + 1 )
r k + 1 = δ 1 ( r k , w k + 1 ) & r k + 1 = δ 2 ( r k , w k + 1 ) & r k + 1 = ( δ 1 ( r k , w k + 1 ) , δ 2 ( r k , w k + 1 ) )
(Definition of δ 3 )
r k + 1 = ( r k + 1 , r k + 1 )
We now need to show L 1 L 2 = L ( M 3 ) .
w L 1 L 2 , w L 1 and w L 2 .
w L 1 s 0 = r 0 , r 1 , r 2 , r n s.t. s 0 = r 0 w 1 , δ 1 r 1 w 2 , δ 1 r 2 r n 1 w n , δ 1 r n & r n F 1
w L 2 s 0 = r 0 , r 1 , r 2 , r n s.t. s 0 = r 0 w 1 , δ 2 r 1 w 2 , δ 2 r 2 r n 1 w n , δ 2 r n & r n F 2
Let r 0 = s 0 = ( s 0 , s 0 )
r 1 = δ 3 ( r 0 , w 1 ) , r i + 1 = δ 3 ( r i , w i + 1 ) , r n = δ 3 ( r n 1 , w n ) .
Therefore, s 0 = r 0 w 1 , δ 3 r 1 w 2 , δ 3 r 2 r n 1 w n , δ 3 r n
By Claim, r n = ( r n , r n )
Since r n F 1 and r n F 2 , r n F 1 × F 2 = F 3 .
Therefore, M 3 accepts w.
w L ( M 3 )
L 1 L 2 L ( M 3 )
Conversely, if w L ( M 3 ) ,
r 0 , r 1 , r 2 , r n Q 3 s.t. s 0 = r 0 w 1 , δ 3 r 1 w 2 , δ 3 r 2 r n 1 w n , δ 3 r n & r n F 3
Take
r 0 = s 0 ;
r i + 1 = δ 1 ( r i , w i + 1 ) i = 0 , 1 , 2 , n 1 ;
r 0 = s 0 ;
r i + 1 = δ 2 ( r i , w i + 1 ) i = 0 , 1 , 2 , n 1 .
Therefore,
s 0 = r 0 w 1 , δ 1 r 1 w 2 , δ 1 r 2 r n 1 w n , δ 1 r n
s 0 = r 0 w 1 , δ 2 r 1 w 2 , δ 2 r 2 r n 1 w n , δ 2 r n
By Claim, r n = ( r n , r n )
Since r n F 3 = F 1 × F 2 , r n F 1 and r n F 2 .
M 1 accepts w and M 2 accepts w.
w L ( M 1 ) and w L ( M 2 )
w L 1 and w L 2
w L 1 L 2
L ( M 3 ) L 1 L 2
Combining both directions, L ( M 3 ) = L 1 L 2
L 1 L 2 is regular.
Theorem 7.
L 1 and L 2 are regular L 1 L 2 is regular.
< P r o o f >
From set theory, Σ * ( L 1 L 2 ) = ( Σ * L 1 ) ( Σ * L 2 )
L 1 is regular Σ * L 1 is regular. (Theorem 1.25)
L 2 is regular Σ * L 2 is regular. (Theorem 1.25)
Σ * L 1 and Σ * L 2 are regular ( Σ * L 1 ) ( Σ * L 2 ) is regular. (Theorem 1.26)
Therefore, Σ * ( L 1 L 2 ) is regular.
Therefore, L 1 L 2 is regular. (Theorem 1.25)
Theorem 8.
Every N F A can be converted to another N F A with the following properties.
(i) There is only one accept state which has transition arrows coming in and no
transition arrows going out.
(ii) The accept state is different from the start state.
(iii) The start state has no arrows coming in from other states but only transition
arrows going out.
< P r o o f >
Let N 1 = ( Q 1 , Σ , δ 1 , q 1 , F 1 ) be the N F A to be converted.
Define N F A , N = ( Q , Σ , δ , q 0 , { q a } ) where Q = Q 1 { q 0 , q a } , q 0 q a and
δ ( q , x ) = { q 1 } i f ( q , x , ) = ( q 0 , ϵ ) i f q = q 0 a n d x ϵ i f q = q a δ 1 ( q , x ) i f q Q 1 F 1 δ 1 ( q , x ) i f q F 1 a n d x ϵ δ 1 ( q , x ) { q a } i f q F 1 a n d x = ϵ
It is clear that N satisfies conditions (i), (ii) and (iii).
Furthermore, δ 1 ( q , x ) δ ( q , x ) x Σ ϵ , q Q 1 and hence
δ ^ 1 ( { q } , w ) δ ^ ( { q } , w ) w Σ ϵ * by Proposition 1.18.
It remains to show that w Σ ϵ * , N 1 accepts w N accepts w.
For forward direction " " ,
Let N 1 accepts w.
q 1 w , δ ^ 1 r , r F 1 .
Since δ ^ 1 ( q 1 , w ) δ ^ ( q 1 , w ) , q 1 w , δ ^ r , r F 1 .
Since δ ( q 0 , ϵ ) = { q 1 } , q 0 ϵ , δ q 1 .
Furthermore, since δ ( q , ϵ ) = δ 1 ( q , ϵ ) { q a } q F 1 , δ ( r , ϵ ) = δ 1 ( r , ϵ ) { q a } .
Therefore, q a δ ( r , ϵ ) .
That is, r ϵ , δ q a
Therefore, q 0 ϵ , δ q 1 w , δ ^ r ϵ , δ q a .
Therefore N accepts ϵ w ϵ which is the same as w.
Therefore, N 1 accepts w N accepts w.
Conversely, if N accepts w = x 1 x 2 x n where x i Σ ϵ for n 1 & 1 i n .
(Note that w = ϵ if x i = ϵ i .)
r 0 , r 1 , r 2 , r n Q s.t.
q 0 = r 0 x 1 , δ r 1 x 2 , δ r 2 r n 1 x n , δ r n & r n { q a }
Since the only way to transition to q a using δ is from a state in F 1 via the ϵ arrow, we must have r n 1 F 1 & x n = ϵ .
Since the only way to transition out of q 0 ( = r 0 ) using δ is via an ϵ arrow, we must have x 1 = ϵ .
Since δ ( q 0 , ϵ ) = { q 1 } , we must have r 1 = q 1 .
We now can rewrite the above computation as
q 0 = r 0 ϵ , δ q 1 x 2 , δ r 2 r n 2 x n 1 , δ r n 1 ϵ , δ q a & r n 1 F 1 .
For all 1 j n 2 , r j { q 0 , q a } because r j has both incoming and outgoing arrows.
Therefore, r j Q 1 .
Claim. r j x j + 1 , δ 1 r j + 1 1 j n 2 .
Since r j Q 1 , δ ( r j , x j + 1 ) = δ 1 ( r j , x j + 1 ) or δ 1 ( r j , x j + 1 ) { q a } by definition of δ.
r j x j + 1 , δ r j + 1
r j + 1 δ ( r j , x j + 1 )
r j + 1 δ 1 ( r j , x j + 1 ) or r j + 1 δ 1 ( r j , x j + 1 ) { q a }
r j + 1 δ 1 ( r j , x j + 1 ) or r j + 1 δ 1 ( r j , x j + 1 ) (because r j + 1 q a )
r j + 1 δ 1 ( r j , x j + 1 )
r j x j + 1 , δ 1 r j + 1
The computation now becomes
q 0 = r 0 ϵ , δ q 1 x 2 , δ 1 r 2 r n 2 x n 1 , δ 1 r n 1 ϵ , δ q a & r n 1 F 1 .
Therefore, q 1 x 2 , δ 1 r 2 r n 2 x n 1 , δ 1 r n 1 & r n 1 F 1 .
Therefore, N 1 accepts x 2 x 3 x n 1 .
Therefore, N 1 accepts w = x 1 x 2 x 3 x n 1 x n because x 1 = x n = ϵ .
Therefore, N accepts w N 1 accepts w.
This completes the proof of Theorem 1.28.
Theorem 9.
For any regular languages L 1 and L 2 , the language L 1 L 2 is regular.
< P r o o f >
Since L 1 and L 2 are regular, there exist N F A s N 1 , N 2 that recognize L 1 and L 2 .
By Theorem 1.28, we can start with N 1 and N 2 defined as follows.
N 1 = ( Q 1 , Σ , δ 1 , q 1 s , { q 1 a } ) where
q 1 s q 1 a , q 1 s δ 1 ( q , x ) q Q 1 , x Σ ϵ and δ 1 ( q 1 a , x ) = x Σ ϵ .
N 2 = ( Q 2 , Σ , δ 2 , q 2 s , { q 2 a } ) where
q 2 s q 2 a , q 2 s δ 2 ( q , x ) q Q 2 , x Σ ϵ and δ 2 ( q 2 a , x ) = x Σ ϵ .
We can further assume that Q 1 Q 2 = because we can always replace Q 1 with a set of objects which are completely different from those in Q 2 without affecting the function of N 1 .
Now construct N = ( Q , Σ , δ , q 1 s , { q 2 a } ) where Q = Q 1 Q 2 .
δ ( q , x ) = δ 1 ( q , x ) i f q Q 1 { q 1 a } δ 1 ( q 1 a , x ) i f q = q 1 a & x ϵ δ 1 ( q 1 a , x ) { q 2 s } i f q = q 1 a & x = ϵ δ 2 ( q , x ) i f q Q 2
We now need to show L ( N ) = L 1 L 2 .
If w L 1 L 2 , w = w 1 w 2 where w 1 , w 2 Σ ϵ * and w 1 L 1 , w 2 L 2 .
Since N 1 recognizes L 1 and N 2 recognizes L 2 , N 1 accepts w 1 and N 2 accepts w 2 .
r 1 { q 1 a } and r 2 { q 2 a } such that
q 1 s w 1 , δ ^ 1 r 1 and q 2 s w 2 , δ ^ 2 r 2 (By Theorem 1.19 of N F A Acceptance)
q 1 s w 1 , δ ^ q 1 a and q 2 s w 2 , δ ^ q 2 a (Proposition 1.18 and r 1 = q 1 a ; r 2 = q 2 a ).
By definition of δ , q 2 s δ ( q 1 a , ϵ ) .
Therefore,
q 1 s w 1 , δ ^ q 1 a ϵ , δ q 2 s w 2 , δ ^ q 2 a .
Therefore, N accepts w 1 ϵ w 2 , which is the same as w 1 w 2 .
L 1 L 2 L ( N )
Conversely, if N accepts w = x 1 x 2 x n , where x 1 , x 2 , x n Σ ϵ for n 1 ,
r 0 , r 1 , r 2 , r n Q such that
q 1 s = r 0 x 1 , δ r 1 x 2 , δ r 2 r n 1 x n , δ r n & r n = q 2 a .
(Note that w = ϵ if x i = ϵ i ).
Since the only way to transition from a state of N 1 to a state of N 2 is via q 1 a to q 2 s using the ϵ arrow, an r i = q 1 a and r i + 1 = q 2 s such that x i + 1 = ϵ and the computation becomes
q 1 s = r 0 x 1 , δ r 1 x 2 , δ r 2 r i 1 x i , δ q 1 a ϵ , δ q 2 s x i + 2 , δ r i + 2 r n 1 x n , δ r n ; r n = q 2 a .
Claim 1. r 0 , r 1 , r 2 , r i 1 Q 1 .
<Proof of Claim 1>
q 1 s = r 0 r 0 Q 1 .
Assume for contradiction that r i 1 Q 1 .
Then r i 1 Q 2 .
r i 1 x i , δ q 1 a
r i 1 x i , δ 2 q 1 a ( δ ( q , x ) = δ 2 ( q , x ) if q Q 2 )
q 1 a Q 2
⇒ Contradiction
Therefore, r i 1 Q 1 .
With similar and inductive argument, we can conclude r i 2 , r 2 , r 1 are all in Q 1 .
Claim 2. r j q 1 a 0 j i 1 .
Assume for contradiction r j = q 1 a for some 0 j i 1 .
Therefore, r j x j + 1 , δ r j + 1 q 1 a x j + 1 , δ r j + 1 r j + 1 δ ( q 1 a , x j + 1 ) .
By definition of δ , δ ( q 1 a , x j + 1 )
= δ 1 ( q 1 a , x j + 1 ) or δ 1 ( q 1 a , x j + 1 ) { q 2 s }
= or { q 2 s }
= or { q 2 s }
Therefore, r j + 1 or r j + 1 { q 2 s } .
Either of these leads to a contradiction.
Therefore, r j q 1 a 0 j i 1 .
Combining Claim 1 and Claim 2, r j Q 1 { q 1 a } 0 j i 1 .
By definition of δ , δ ( r j , x ) = δ 1 ( r j , x ) 0 j i 1 .
Therefore, computation q 1 s = r 0 x 1 , δ r 1 x 2 , δ r 2 r i 1 x i , δ q 1 a can be replaced by computation
q 1 s = r 0 x 1 , δ 1 r 1 x 2 , δ 1 r 2 r i 1 x i , δ 1 q 1 a .
Therefore, N 1 accepts w 1 = x 1 x 2 x i .
w 1 L ( N 1 ) = L 1 .
Claim 3. r j Q 2 i + 2 j n 1 .
<Proof of Claim 3>
q 2 s x i + 2 , δ r i + 2
r i + 2 δ ( q 2 s , x i + 2 )
r i + 2 δ 2 ( q 2 s , x i + 2 ) ( δ ( q , x ) = δ 2 ( q , x ) if q Q 2 )
q 2 s x i + 2 , δ 2 r i + 2
r i + 2 Q 2 .
With similar and inductive argument, we can show that r i + 3 , r n 1 are all in Q 2 .
Therefore, computation q 2 s x i + 2 , δ r i + 2 r n 1 x n , δ r n ; r n = q 2 a can be replaced by computation
q 2 s x i + 2 , δ 2 r i + 2 r n 1 x n , δ 2 r n ; r n = q 2 a
Therefore, N 2 accepts w 2 = x i + 2 x i + 3 x n .
w 2 L ( N 2 ) = L 2 .
w 1 w 2 L 1 L 2 .
w = x 1 x 2 x i x i + 1 x i + 2 x n
= w 1 x i + 1 w 2
= w 1 w 2 ( x i + 1 = ϵ )
Therefore, w L 1 L 2 .
Therefore, L ( N ) L 1 L 2 .
Combining both directions, L ( N ) = L 1 L 2 .
Theorem 10.
For any regular language L , L * is regular.
< P r o o f >
Let N 1 be the N F A that recognizes L.
By Theorem 1.28, we can start with an N 1 defined as follows.
N 1 = ( Q 1 , Σ , T 1 , q 1 , { q a } ) where
q 1 q a , q 1 T 1 ( q , x ) q Q 1 , x Σ ϵ and T 1 ( q a , x ) = x Σ ϵ .
Let N = ( Q , Σ , T , q 0 , { q a , q 0 } ) such that Q = Q 1 { q 0 } .
T ( q , x ) = T 1 ( q , x ) i f q Q 1 { q a } { q 1 } T 1 ( q a , ϵ ) i f q = q a & x = ϵ T 1 ( q a , x ) i f q = q a & x ϵ { q 1 } i f q = q 0 & x = ϵ i f q = q 0 & x ϵ
We need to show w L * N accepts w.
If w L * ,
w L M for some M 0 .
If M = 0 , w L 0 = { ϵ } .
Therefore, w = ϵ .
ϵ is accepted by N because N has a start state that is also an accept state.
For M 1 ,
let w = w 1 w 2 w M with each w i L for 1 i M .
Therefore, N 1 accepts w i for each i.
For each i , q 1 w i , T 1 ^ q a (By Theorem 1.19 of N F A Acceptance)
For each i , q 1 w i , T ^ q a (Proposition 1.18)
Since T ( q a , ϵ ) = { q 1 } T 1 ( q a , ϵ ) ,
q 1 { q 1 } T 1 ( q a , ϵ ) q 1 T ( q a , ϵ ) q a ϵ , T q 1 .
Therefore,
q 0 ϵ , T q 1 w 1 , T ^ q a ϵ , T q 1 w 2 , T ^ q a ϵ , T q 1 q a ϵ , T q 1 w M , T ^ q a
Therefore, N accepts ϵ w 1 ϵ w 2 ϵ w M = w 1 w 2 w M = w .
Therefore, w L * N accepts w.
Conversely, if N accepts w = x 1 x 2 x 3 x n where x i Σ ϵ for 1 i n & n 1 .
(Note that w = ϵ if x i = ϵ i .)
r 0 , r 1 , r 2 , r n Q such that
q 0 = r 0 x 1 , T r 1 x 2 , T r 2 r n 1 x n , T r n & r n { q 0 , q a } .
Since T ( q 0 , x ) = if x ϵ , x 1 = ϵ .
Furthermore, T ( q 0 , ϵ ) = { q 1 } .
Therefore, r 1 = q 1 .
r n { q 0 , q a } r n = q a because q 0 has no incoming arrows.
The computation now becomes
q 0 ϵ , T q 1 x 2 , T r 2 r n 1 x n , T q a .
Therefore, q 1 x 2 , T r 2 r n 1 x n , T q a .
Claim 1:
For the computation, q 0 = r 0 x 1 , T r 1 x 2 , T r 2 r i x i + 1 , T r i + 1 r n 1 x n , T r n & r n = q a ,
if r i = q a for 1 < i < n 1 , then r i + 1 = q 1 & x i + 1 = ϵ .
<Proof of Claim 1>
r i x i + 1 , T r i + 1 q a x i + 1 , T r i + 1 r i + 1 T ( q a , x i + 1 ) .
T ( q a , x i + 1 )
= T 1 ( q a , x i + 1 ) or T 1 ( q a , x i + 1 ) { q 1 } (by definition of T)
= or { q 1 } (by definition of N 1 )
= or { q 1 }
Therefore, r i + 1 or r i + 1 { q 1 } .
Therefore, r i + 1 { q 1 } and hence r i + 1 = q 1 .
Therefore, r i x i + 1 , T r i + 1
q a x i + 1 , T q 1
q 1 T 1 ( q a , x i + 1 ) if x i + 1 ϵ
q 1 if x i + 1 ϵ (by definition of N 1 )
⇒ Contradiction if x i + 1 ϵ .
Therefore, x i + 1 = ϵ .
Claim 2:
For any computation q 1 x 1 , T s 1 x 2 , T s 2 s i x i + 1 , T s i + 1 s n 1 x n , T s n x n + 1 , T q a ,
ifno q a in between q 1 and q a , that is s i q a for 1 i n , then
q 1 w , T 1 ^ q a for some w Σ ϵ * .
<Proof of Claim 2>
q 0 { s 1 , s 2 , s n } because q 0 has no incoming arrows.
Therefore, s 1 , s 2 , s n Q 1 .
Therefore, s 1 , s 2 , s n Q 1 { q a } .
By definition of T , T ( q , x ) = T 1 ( q , x ) if q Q 1 { q a } .
Therefore, T ( s i , x ) = T 1 ( s i , x ) for 1 i n & x Σ ϵ .
The given computation can be replaced by
q 1 x 1 , T 1 s 1 x 2 , T 1 s 2 s i x i + 1 , T 1 s i + 1 s n 1 x n , T 1 s n x n + 1 , T 1 q a ,
q 1 w , T 1 ^ q a where w = x 1 x 2 x 3 x n + 1 .
Back to computation q 1 x 2 , T r 2 x 3 , T r 3 r n 1 x n , T q a .
Let m be the number of q a ’s in between q 1 & q a .
If m = 0 , by Claim 2, q 1 w , T 1 ^ q a where w = x 2 x 3 x n .
N 1 accepts w .
w = x 1 w = ϵ w = w .
N 1 accepts w.
w L L * .
For m 1 , r j 1 = r j 2 = r j m = q a .
By Claim 1, r j 1 + 1 = r j 2 + 1 = r j m + 1 = q 1 .
q 1 w 1 , T 1 ^ r j 1 = q a (Claim 2)
q a = r j 1 ϵ , T r j 1 + 1 = q 1 (Claim 1)
q 1 = r j 1 + 1 w 2 , T 1 ^ r j 2 = q a (Claim 2)
q a = r j 2 ϵ , T r j 2 + 1 = q 1 (Claim 1)
   ⋮
   ⋮
q 1 = r j m 1 + 1 w m , T 1 ^ r j m = q a (Claim 2)
q a = r j m ϵ , T q 1 w m + 1 , T 1 ^ q a (Claim 1 & Claim 2)
Therefore, N 1 accepts w 1 , w 2 , w m , w m + 1 .
w 1 , w 2 , w m , w m + 1 L .
w 1 w 2 w m w m + 1 L m + 1
However, x 2 x 3 x n = w 1 ϵ w 2 ϵ ϵ w m ϵ w m + 1 = w 1 w 2 w m w m + 1 .
w = x 1 x 2 x 3 x n = ϵ x 2 x 3 x n = x 2 x 3 x n = w 1 w 2 w m w m + 1 .
Therefore, w L m + 1 L * .
Therefore, N accepts w w L * .
Combining both directions, w L * N accepts w.
This completes the proof of Theorem 1.30.
Definition 10.
For any string w = x 1 x 2 x n , where x i Σ ϵ for each i, the reverse of w, written w R is the string x n x n 1 x 1 .
For any language A, A R = d e f { w R w A } .
Theorem 11.
For any language A, A is regular iff A R is regular.
< P r o o f >
Since A is regular, there is an N F A , N A that recognizes it.
Let N A = ( Q A , Σ , δ A , q A , F A ) .
Construct N A R = ( Q A { q s } , Σ , δ A R , q s , { q A } ) where q s Q A such that
δ A R ( q , x ) = F A i f ( q , x ) = ( q s , ϵ ) i f q = q s & x ϵ { p Q A q δ A ( p , x ) } i f q Q A
From the third row of this definition, it immediately follows that
p δ A R ( q , x ) q δ A ( p , x ) or
q x , δ A R p p x , δ A q ( * ) .
Claim: a computation path for w from p to q via transition function δ A iff a computation path for w R from q to p via transition function δ A R .
That is, p w , δ A ^ q q w R , δ A R ^ p .
This Claim can be proved by induction on | w | .
For | w | = 1 , w = w R = x where x Σ ϵ .
From ( * ) , q x , δ A R p p x , δ A q
Therefore, the statement is true for | w | = 1 .
Assume the statement is true for | w | = k where k 1 .
That is , p w , δ A ^ q q w R , δ A R ^ p for | w | = k .
p w x , δ A ^ q
p w , δ A ^ q x , δ A q (Proposition 1.12)
p w , δ A ^ q and q x , δ A q
q w R , δ A R ^ p and q x , δ A R q (Induction Hypothesis and (*))
q x , δ A R q w R , δ A R ^ p
q x w R , δ A R ^ p (Proposition 1.12)
q ( w x ) R , δ A R ^ p ( x w R = ( w x ) R )
The statement is true for | w | = k + 1 and the proof of Claim is complete.
To prove that A R is regular, we need to prove that
w R A R iff N A R accepts w R .
If w R A R , w A .
Since N A accepts w, q A w , δ A ^ q , q F A (Theorem 1.19 – N F A acceptance)
By Claim, q w R , δ A R ^ q A
Since δ A R ( q s , ϵ ) = F A , and q F A ,
q s ϵ , δ A R q .
Therefore, q s ϵ , δ A R q w R , δ A R ^ q A .
N A R accepts ϵ w R (Theorem 1.19 – N F A acceptance)
N A R accepts w R .
Conversely, if N A R accepts w R ,
N A R accepts ϵ w R .
q s ϵ w R , δ A R ^ q A (Theorem 1.19 – N F A acceptance)
q s ϵ , δ A R q w R , δ A R ^ q A (Proposition 1.12)
Since δ A R ( q s , ϵ ) = F A , q F A .
q A w , δ A ^ q , and q F A (Claim)
Therefore, N A accepts w (Theorem 1.19 – N F A acceptance)
w A ( N A recognizes A)
w R A R .
w R A R iff N A R accepts w R .
We have proved that A is regular A R is regular.
On the other hand, sine ( A R ) R = A ,
A R is regular ( A R ) R is regular A is regular.
Therefore, A is regular iff A R is regular.

6. Regular Expression

Definition 11.
(Regular Expression)
Let Σ be a finite alphabet.
Σ is a set with the following properties:
(a)  R Σ iff R is one of the following:
  (i) a for some a Σ
  (ii) ϵ ^
  (iii) ^
  (iv) R 1 ^ R 2 for some R 1 , R 2 Σ
  (v) R 1 ^ R 2 for some R 1 , R 2 Σ
  (vi) R 1 * ^ for some R 1 Σ
  where ^ , ^ and * ^ are operations in Σ with
   ^ : Σ × Σ Σ
   ^ : Σ × Σ Σ
   * ^ : Σ Σ
(b)  ∃ an injective (one-to-one) mapping L : Σ P ( Σ * ) s.t.
  (i) L ( a ) = { a } a Σ
  (ii) L ( ϵ ^ ) = { ϵ }
  (iii) L ( ^ ) =
  (iv) L ( R 1 ^ R 2 ) = L ( R 1 ) L ( R 2 ) R 1 , R 2 Σ
  (v) L ( R 1 ^ R 2 ) = L ( R 1 ) L ( R 2 ) R 1 , R 2 Σ
  (vi) L ( R 1 * ^ ) = ( L ( R 1 ) ) * R 1 Σ
Σ is called the set of all regular expressions over the alphabet Σ.
Any member of Σ is called a regular expression over Σ.
For any regular expression R, L ( R ) is called the language described by R.
While ^ , ^ and * ^ are operations in Σ , , and * are set operations in P ( Σ * ) .
When there is no danger of confusion, ^ , ^ and * ^ are usually written same as , and *.
While ϵ ^ and ^ are regular expressions, ϵ is the empty string and ∅ is the empty language. When there is no danger of confusion, they are all written as ϵ and ∅.
Proposition 10.
Let Σ be a finite alphabet and Σ be the set of all regular expressions over Σ.
The following statements are true.
(a) R 1 , R 2 Σ , R 1 R 2 = R 2 R 1
(b) regular expressions Σ ^ and Σ * ^ such that L ( Σ ^ ) = Σ and L ( Σ * ^ ) = Σ * . When there is no danger of confusion, Σ ^ and Σ * ^ are usually written same as Σ and Σ * .
< P r o o f >
(a) L ( R 1 R 2 ) = L ( R 1 ) L ( R 2
   L ( R 2 R 1 ) = L ( R 2 ) L ( R 1 )
   L ( R 1 ) L ( R 2 ) = L ( R 2 ) L ( R 1 ) from set theory.
  Therefore, L ( R 1 R 2 ) = L ( R 2 R 1 )
  Therefore, R 1 R 2 = R 2 R 1 (L is one-one)
(b) Define Σ ^ = a Σ a
   Σ ^ is a regular expression by Definition 1.33(a)(i) and 1.33(a)(iv).
  By Definition 1.33(b)(iv)
   L ( Σ ^ ) = L a Σ a = a Σ L ( a ) = a Σ { a } = Σ
  Define Σ * ^ = ( Σ ^ ) * ^ .
   Σ * ^ is a regular expression by Definition 1.33(a)(vi).
  By Definition 1.33(b)(vi),
   L ( Σ * ^ ) = L ( ( Σ ^ ) * ^ ) = ( L ( Σ ^ ) ) * = Σ * ( L ( Σ ^ ) = Σ )
Example 1.
Find the language described by Σ * 1 Σ * where Σ = { 0 , 1 } .
L ( Σ * 1 Σ * ) = L ( Σ * ) L ( 1 ) L ( Σ * ) = Σ * { 1 } Σ * = { w w h a s a t l e a s t o n e 1 } .
Example 2.
Find the language described by ( Σ Σ Σ ) * where Σ = { 0 , 1 } .
L ( ( Σ Σ Σ ) * ) = ( L ( Σ Σ Σ ) ) * = ( L ( Σ ) L ( Σ ) L ( Σ ) ) * = ( Σ Σ Σ ) *
= { x y z x , y , z Σ } * = { w | w | i s a m u l t i p l e o f t h r e e } .
Lemma 2.
If a language is described by a regular expression, then it is regular. That is, if A = L ( R ) for some R Σ , then A = L ( N ) for some finite automaton N.
< P r o o f >
From the formal definition of regular expressions, R is one of the following:
  (i) a for some a Σ
  (ii) ϵ ^
  (iii) ^
  (iv) R 1 ^ R 2 for some R 1 , R 2 Σ
  (v) R 1 ^ R 2 for some R 1 , R 2 Σ
  (vi) R 1 * ^ for some R 1 Σ
In case (i), L ( a ) = { a } and { a } can be recognized by the N F A defined as follows:
N = ( { q 1 , q 2 } , Σ ϵ , δ , q 1 , { q 2 } ) such that δ ( q 1 , a ) = { q 2 } , δ ( q , b ) = q q 1 , b a .
In case (ii), L ( ϵ ) = { ϵ } and { ϵ } can be recognized by the following N F A :
N = ( { q 1 } , Σ ϵ , δ , q 1 , { q 1 } ) , where δ ( q 1 , b ) = b ϵ and δ ( q 1 , ϵ ) = { q 1 } .
In case (iii), L ( ) = , which is recognized by the following N F A :
N = ( { q } , Σ ϵ , δ , q , ) where δ ( q , b ) = b Σ ϵ .
In cases (iv), (v) and (vi), R is repeated operations of ^ , ^ and * ^ on a, ϵ and ∅. Since we have shown above L ( a ) , L ( ϵ ) and L ( ) are regular and we have proved before that regular languages are closed under , and * , L ( R ) is regular.
Definition 12.
A generalized nondeterministic finite automaton (denoted by G N F A ) has all the properties as described in Theorem 1.28 and is a 5-tuple, ( Q , Σ , δ , q s t a r t , { q a c c e p t } ) where
  (i) Q is a finite set of states;
  (ii) Σ is a finite alphabet;
  (iii) δ : ( Q { q a c c e p t } ) × ( Q { q s t a r t } ) Σ is the transition function;
  (iv) q s t a r t is the start state; and
  (v) q a c c e p t is the accept state.
A G N F A accepts a string w Σ * , if w = w 1 w 2 w n , where each w i is in Σ * and a sequence of states q 0 , q 1 , q 2 , q n exist such that
(1) q 0 = q s t a r t ;
(2) q n = q a c c e p t ; and
(3) For each i, w i L ( R i ) where
   R i = δ ( q i 1 , q i ) and L ( R i ) is the language described by expression R i .
If we write q i R , δ q j instead of δ ( q i , q j ) = R , the definition of acceptance can be written as
q s t a r t = q 0 R 1 , δ q 1 R 2 , δ q 2 R n , δ q n = q a c c e p t with w i L ( R i ) for i = 1 , 2 , , n .
Lemma 3.
Every N F A can be converted into an equivalent G N F A .
< P r o o f >
Because of Theorem 1.28, we can start with an N F A defined as follows.
N = ( Q , Σ , δ , q s t a r t , { q a c c e p t } ) where
q s t a r t q a c c e p t ; δ ( q a c c e p t , a ) = a Σ ϵ ; and q s t a r t δ ( q , a ) a Σ ϵ , q Q .
Define G N F A , N G as follows:
N G = ( Q , Σ , δ G , q s t a r t , { q a c c e p t } ) where
δ G : ( Q { q a c c e p t } ) × ( Q { q s t a r t } ) Σ such that:
( q i , q j ) ( Q { q a c c e p t } ) × ( Q { q s t a r t } )
δ G ( q i , q j ) = R i , j where
R i , j = w S i , j w ; and
S i , j = { w Σ * q i w , δ ^ q j } .
Note that if i = j , δ G ( q i , q i ) = R i , i , S i , i = { w Σ * q i w , δ ^ q i } ; and
R i , i = w S i , i w *
( q i , q j ) , S i , j is unique and therefore R i , j is unique.
Since w is the concatenation of symbols from Σ, and every symbol in Σ is a regular expression, w is a regular expression.
Therefore, R i , j = w S i , j w is a regular expression.
Therefore, δ G ( q i , q j ) = R i , j is well defined.
Claim 1. For any string w in Σ * , L ( w ) = { w } .
< Proof of Claim 1 >
L ( w ) = L ( a 1 a 2 a n ) where a i Σ
   = L ( a 1 ) L ( a 2 ) L ( a n )
   = { a 1 } { a 2 } { a n }
   = { a 1 a 2 a n }
   = { w }
Claim 2. w Σ * , N accepts w N G accepts w.
< Proof of Claim 2 >
For forward direction " "
Let N accepts w where w = w 1 w 2 w n , n 1 , and each w i is in Σ * for 1 i n .
By theorem of acceptance, q 0 , q 1 , q 2 , q n Q such that
q s t a r t = q 0 w 1 , δ ^ q 1 w 2 , δ ^ q 2 q n 1 w n , δ ^ q n = q a c c e p t .
Since q i 1 w i , δ ^ q i , w i S i 1 , i .
By definition of δ G ,
δ G ( q i 1 , q i ) = R i 1 , i = w S i 1 , i w
L δ G ( q i 1 , q i )
= L R i 1 , i
= L w S i 1 , i w
= w S i 1 , i L ( w )
= w S i 1 , i { w } (By Claim 1)
= S i 1 , i .
Since w i S i 1 , i , w i L ( R i 1 , i ) .
Since q i 1 R i 1 , i , δ G q i i = 1 , 2 , n ,
q s t a r t = q 0 R 0 , 1 , δ G q 1 R 1 , 2 , δ G q 2 q i 1 R i 1 , i , δ G q i q n 1 R n 1 , n , δ G q n = q a c c e p t .
N G accepts w.
Conversely, if N G accepts w for w = w 1 w 2 w n , n 1 , and each w i is in Σ * ,
q 0 , q 1 , q 2 , q n Q such that
q s t a r t = q 0 R 0 , 1 , δ G q 1 R 1 , 2 , δ G q 2 q i 1 R i 1 , i , δ G q i q n 1 R n 1 , n , δ G q n = q a c c e p t
with w i L ( R i 1 , i ) i { 1 , 2 , 3 , n } ,
R i 1 , i = w S i 1 , i w
and
S i 1 , i = { w Σ * q i 1 w , δ ^ q i }
L ( R i 1 , i )
= L w S i 1 , i w
= w S i 1 , i L ( w )
= w S i 1 , i { w } (By Claim 1)
= S i 1 , i .
i { 1 , 2 , 3 , n } ,
w i L ( R i 1 , i )
w i S i 1 , i
q i 1 w i , δ ^ q i (Definition of S i , j )
Therefore, q s t a r t = q 0 w 1 , δ ^ q 1 w 2 , δ ^ q 2 q n 1 w n , δ ^ q n = q a c c e p t .
Therefore, N accepts w = w 1 w 2 w n .
N and N G are equivalent and the Lemma is proved.
Lemma 4.
Every G N F A of n states ( n 2 ) can be reduced to an equivalent G N F A of 2 states.
< P r o o f >
This lemma can be proved by induction on n.
It is trivial that the statement is true for n = 2 .
Assume that the statement is true for n = k 2 .
Let G = ( Q , Σ , δ , q s t a r t , { q a c c e p t } ) be a G N F A with k + 1 states.
q r i p Q { q s t a r t , q a c c e p t } because k + 1 3 .
Construct G = ( Q , Σ , δ , q s t a r t , { q a c c e p t } ) such that
Q = Q { q r i p }
( q i , q j ) ( Q { q a c c e p t } ) × ( Q { q s t a r t } ) ,
δ ( q i , q j ) = δ ( q i , q r i p ) δ ( q r i p , q r i p ) * δ ( q r i p , q j ) δ ( q i , q j ) .
Therefore, Q is a G N F A with k states.
Let G accept w = w 1 w 2 w n where each w i Σ * .
q 0 , q 1 , q 2 , q n Q such that
q s t a r t = q 0 R 1 , δ q 1 R 2 , δ q 2 q i 1 R i , δ q i q n 1 R n , δ q n = q a c c e p t ; and
w i L ( R i ) = L ( δ ( q i 1 , q i ) ) .
If none of q 0 , q 1 , q 2 , q n is q r i p , then they are all in Q .
Also,
w i L ( δ ( q i 1 , q i ) )
w i L δ ( q i 1 , q r i p ) ( δ ( q r i p , q r i p ) ) * δ ( q r i p , q i ) L ( δ ( q i 1 , q i ) )
w i L δ ( q i 1 , q r i p ) ( δ ( q r i p , q r i p ) ) * δ ( q r i p , q i ) δ ( q i 1 , q i )
w i L ( δ ( q i 1 , q i ) )
w i L ( R i ) where R i = δ ( q i 1 , q i )
q s t a r t = q 0 R 1 , δ q 1 R 2 , δ q 2 q i 1 R i , δ q i q n 1 R n , δ q n = q a c c e p t
with w i L ( R i ) .
Therefore, G accepts w = w 1 w 2 w n .
If some q’s in the sequence q 0 , q 1 , q 2 , q n which are q r i p ,
let q i be the first such q r i p and q j be the first state in the sequence after q i such that q j q r i p .
q i 1 R i q i = q r i p R i + 1 q r i p q r i p R j 1 q r i p R j q j .
R i + 1 = δ ( q i , q i + 1 ) = δ ( q r i p , q r i p ) w i + 1 L ( δ ( q r i p , q r i p ) )
        ⋮
R j 1 = δ ( q j 2 , q j 1 ) = δ ( q r i p , q r i p ) w j 1 L ( δ ( q r i p , q r i p ) )
w i + 1 w j 1 L j i 1 ( δ ( q r i p , q r i p ) )
w i + 1 w j 1 L * ( δ ( q r i p , q r i p ) )
Let w j = w i w i + 1 w j 1 w j
w i L ( δ ( q i 1 , q i ) ) and q i = q r i p w i L ( δ ( q i 1 , q r i p ) )
w j L ( δ ( q j 1 , q j ) ) and q j 1 = q r i p w j L ( δ ( q r i p , q j ) )
w j L ( δ ( q i 1 , q r i p ) ) L * ( δ ( q r i p , q r i p ) ) L ( δ ( q r i p , q j ) )
w j L ( δ ( q i 1 , q r i p ) ) L * ( δ ( q r i p , q r i p ) ) L ( δ ( q r i p , q j ) ) L ( δ ( q i 1 , q j ) )
Therefore, w j L δ ( q i 1 , q r i p ) ( δ ( q r i p , q r i p ) ) * δ ( q r i p , q j ) δ ( q i 1 , q j )
w j L ( δ ( q i 1 , q j ) )
w j L ( R j ) where R j = δ ( q i 1 , q j )
If there are no more q r i p ’s in the sequence,
q s t a r t = q 0 R 1 , δ q 1 R 2 , δ q 2 q i 1 R j , δ q j R j + 1 , δ q j + 1 q n 1 R n , δ q n = q a c c e p t
is the path of acceptance in G for ( w 1 w 2 w i 1 ) ( w j ) ( w j + 1 w n ) ,
which is the same as ( w 1 w 2 w i 1 ) ( w i w i + 1 w j 1 w j ) ( w j + 1 w n ) because
w j = w i w i + 1 w j 1 w j .
Therefore, G accepts w = w 1 w 2 w n .
If there are some more q r i p ’s in the sequence, repeat the above process until all q r i p ’s are removed and the resulting computation path is the path of acceptance of w in G .
Conversely, if G accepts w = w 1 w 2 w n where w i Σ * ,
q 0 , q 1 , q 2 , q n Q such that
q s t a r t = q 0 R 1 , δ q 1 R 2 , δ q 2 q i 1 R i , δ q i q n 1 R n , δ q n = q a c c e p t
with w i L ( R i ) where R i = δ ( q i 1 , q i ) .
Therefore, w i L ( δ ( q i 1 , q r i p ) ( δ ( q r i p , q r i p ) ) * δ ( q r i p , q i ) δ ( q i 1 , q i ) )
Therefore, w i L ( δ ( q i 1 , q r i p ) ( δ ( q r i p , q r i p ) ) * δ ( q r i p , q i ) ) or w i L ( δ ( q i 1 , q i ) ) .
If w i L ( δ ( q i 1 , q i ) ) ,
q s t a r t = q 0 R 1 , δ q 1 R 2 , δ q 2 q i 1 R i , δ q i q n 1 R n , δ q n = q a c c e p t where w i L ( R i )
is the acceptance path for w = w 1 w 2 w n in G.
If w i L ( δ ( q i 1 , q r i p ) ( δ ( q r i p , q r i p ) ) * δ ( q r i p , q i ) ) ,
let w i = w i 1 w i 2 w i 3 where
w i 1 L ( δ ( q i 1 , q r i p ) ) = L ( R i 1 , r i p ) ,
w i 2 L * ( δ ( q r i p , q r i p ) ) = L * ( R r i p , r i p ) , and
w i 3 L ( δ ( q r i p , q i ) ) = L ( R r i p , i ) .
m 0 such that w i 2 L m ( δ ( q r i p , q r i p ) ) .
w i 2 = w i 2 ( 1 ) w i 2 ( 2 ) w i 2 ( m ) where each w i 2 ( j ) L ( δ ( q r i p , q r i p ) ) = L ( R r i p , r i p ) .
q i 1 R i 1 , r i p , δ q r i p R r i p , r i p , δ q r i p q r i p R r i p , i , δ q i
is a computation path in G for w i 1 w i 2 w i 3 = w i .
This is true for all 1 i n .
Therefore, there is a computation path in G from q 0 to q n for w 1 w 2 w n = w .
Therefore, G accepts w = w 1 w 2 w n .
So G and G are equivalent.
Since G has k states, by induction hypothesis, G can be reduced to an equivalent G N F A of 2 states.
Hence, G can be reduced to an equivalent G N F A of 2 states.
This completes the proof.
Lemma 5.
If an N F A , N = ( Q , Σ , δ , q 0 , F ) is equivalent to a 2-state G N F A , N G = ( Q , Σ , δ G , q s t a r t , { q a c c e p t } ) , then L ( N ) = L ( R ) where R = δ G ( q s t a r t , q a c c e p t ) .
< P r o o f >
w L ( N )
N accepts w
N G accepts w (N and N G are equivalent.)
w L ( R ) ( R = δ G ( q s t a r t , q a c c e p t ) )
By Lemmas 1.39, 1.40, 1.41, we have the following conclusion:
Lemma 6.
If a language is regular, it is described by a regular expression.
By Lemma 1.37 and Lemma 1.42, we have the following theorem.
Theorem 12.
A language is regular iff some regular expression describes it.

7. Pumping Lemma

Theorem 13.
- Pumping Lemma
Let A be a language.
Let ( S ) denote the following statement:
a number p (the pumping length) where, if s is any string in A of length at least p, then s may be divided into three pieces, s = x y z , satisfying the following conditions:
(1) For each i 0 , x y i z A ,
(2) | y | > 0 , and
(3) | x y | p .
The Pumping Lemma states that A is regular ( S ) .
< P r o o f >
Since A is regular, there exists a finite automaton M = ( Q , Σ , δ , q 0 , F ) that recognizes A.
That is, A = L ( M ) .
Let p be the number of states in M.
Let s = s 1 s 2 s n where each s i Σ and 0 p n .
r 0 , r 1 , r n Q , such that
q 0 = r 0 s 1 , δ r 1 s 2 , δ r 2 r n 1 s n , δ r n , r n F .
Since p n , q 0 = r 0 s 1 , δ r 1 s 2 , δ r 2 r p 1 s p , δ r p is a sub path with p + 1 states.
Since M has only p states, by the pigeonhole principle, k , l such that 0 k < l p and r k = r l .
Let x = s 1 s 2 s k , y = s k + 1 s k + 2 s l and z = s l + 1 s l + 2 s n .
Therefore, r 0 x , δ ^ r k y , δ ^ r l z , δ ^ r n .
Since r k = r l , r k y i , δ ^ r l i 0 .
Therefore, r 0 x , δ ^ r k y i , δ ^ r l z , δ ^ r n with r n F .
Therefore, M accepts x y i z .
Therefore, x y i z A .
Since k < l , | y | > 0 .
| x y | = | x | + | y | = k + l k = l p .
This completes the proof of the Pumping Lemma.
Theorem 14.
- Pumping Lemma (contra positive form)
¬ ( S ) A is not regular where
¬ ( S ) is equivalent to:
p 1 , s A with | s | p such that whenever s = x y z , at least one of the conditions ( 1 ) , ( 2 ) , or ( 3 ) cannot be satisfied.
The contra positive form of the Pumping Lemma is used to prove a language is not regular. The general strategy is to find an s A with | s | p for any given p 1 so that whenever s is broken into s = x y z , at least one of the conditions of ( 1 ) , ( 2 ) , or ( 3 ) must be false. This can be usually accomplished by showing one of the following:
(i) Condition 1 alone is false.
(ii) Condition 3 ¬ (Condition 1)
(iii) (Condition 2 and Condition 3) ¬ (Condition 1).
Example 3.
Show that A = { 0 n 1 n n 0 } is not regular.
The strategy is to create an s that will force y to contain all 0’s or all 1’s so that when y is pumped indefinitely, x y i z will contain too many 0’s or 1’s to make it impossible for x y i z to remain in A.
Since Condition 3 requires | x y | p , a prefix of 0 p in s will achieve that purpose.
Formally, we make the argument as follows.
p 1 , let s = 0 p 1 p .
s A and | s | p .
If s = x y z , then x y z = 0 p 1 p .
Condition 3
| x y | p
x y consists of only 0’s
y consists of only 0’s.
| x y y z | = | x y z | + | y | .
Since Condition 2 requires | y | > 0 , x y y z adds a positive number of 0’s to x y z .
Since x y z has equal numbers of 0’s and 1’s, x y y z must have more 0’s than 1’s and hence is not in A.
Therefore, (Condition 2 + Condition 3) ¬ (Condition 1) and hence A is not regular.
Example 4.
Show that A = { w w w { 0 , 1 } * } is not regular.
The strategy is to create an s with some leading 0’s on the left, say 0 m but we also want to make sure that 0 m is long enough to force x y to contain all 0’s in it so that when y is pumped up indefinitely, it will create too many 0’s to make it impossible for s = w w .
Since Condition 3 requires | x y | p , we want to make m p .
A natural candidate for s is therefore 0 p 10 p 1 .
To prove that this construction works, however, requires some algebraic manipulation.
Formally, we make the argument as follows.
p 1 , take s = 0 p 10 p 1 .
If s = x y z , then x y z = 0 p 10 p 1 .
Condition 3
| x y | p
x y consists of only 0’s
y consists of only 0’s.
Let x y i z = 0 p 10 p 1 where p p = ( i 1 ) | y | or p = p + ( i 1 ) | y | .
For i > 3 , p > p + ( 3 1 ) ( | y | 1 by Condition 2)
Therefore, p > p + 2 for i > 3 .
Assume for contradiction that i 0 , x y i z A .
That is, x y i z = 0 p 10 p 1 = w w .
For all i > 3 ,
| w |
= | 0 p 10 p 1 | 2
= p + p + 2 2
> p + 2 + p + 2 2 ( p > p + 2 for i > 3 )
= p + 2
Therefore, | w | > | 10 p 1 | .
This implies w consists of at least two 1’s.
On the other hand, p + p + 2 = 2 | w | .
p | w | = | w | ( p + 2 ) > 0
p > | w |
This implies w must consist of all 0’s.
This leads to a contradiction.
Therefore, (Condition 2 + Condition 3) ¬ (Condition 1) and hence A is not regular.
Example 5.
Show that A = { 1 n 2 n 0 } is not regular.
The idea behind this problem is every time we pump up y, we increase the length of s by an amount of | y | which is bounded by p and p is fixed. On the other hand, s has to be the square of a natural number and the difference between two consecutive squares, say n 2 and ( n + 1 ) 2 will grow to infinity as n goes to infinity. In this case, we don’t have to worry about how to create more 0’s in s so as to outnumber the 1’s or vice versa. This particular nature of s will automatically lead to a contradiction to Condition 1 as | s | grows to infinity.
Proving this to work requires some algebraic manipulation.
The formal argument is made as follows.
p 1 , take s = 1 p 2
p 1
p ( p 1 ) 0
p 2 p
| 1 p 2 | | 1 p | = p
Therefore, | s | p .
Assume for contradiction that Condition 1 is true.
That is, i 0 , x y i z A .
Both x y i z and x y i + 1 z are in A.
Let x y i z = 1 n 2 and x y i + 1 z = 1 m 2 where m and n are positive integers.
| x y i z | = n 2 and | x y i + 1 z | = m 2 .
By Condition 2,
| y | 1
| y i + 1 | > | y i |
| x y i + 1 z | > | x y i z |
m 2 > n 2
m > n
m n + 1
By Condition 3, | x y | p | y | p .
Therefore, | x y i + 1 z | | x y i z | = | y | p .
Therefore, m 2 n 2 p .
( n + 1 ) 2 n 2 m 2 n 2 p .
2 n + 1 p .
n p 1 2 ( 1 ) where ( 1 ) is true for all i.
On the other hand,
Condition 2 | y | 1 | y i | i .
n 2 = | x | + | y i | + | z | | y i | i .
n i for all i.
For i > ( p 1 ) 2 4 , i > p 1 2 and n > p 1 2
This contradicts ( 1 ) which is true for all i.
Therefore, (Condition 2 + Condition 3) ¬ (Condition 1) and hence A is not regular.

8. Myhill-Nerode Theorem

Definition 13.
x , y Σ * , L Σ * ,
we say that x and y are indistinguishable by L iff z Σ * , x z L y z L .
We say that x and y are distinguishable by L iff there exists z Σ * such that exactly one of x z and y z is in L.
If x and y are indistinguishable by L, we write x L y .
Proposition 11.
L is an equivalence relation.
< P r o o f >
x L , x z L x z L z Σ *
x L x
L is reflexive.
x , y L ,
x L y
( z Σ * , x z L y z L )
( z Σ * , y z L x z L )
y L x
L is symmetric.
x , y , w Σ * ,
( x L y ) ( y L w )
( z Σ * , x z L y z L ) ( z Σ * , y z L w z L )
( z Σ * , x z L w z L )
x L w
L is transitive.
Proposition 12.
L is right congruence. That is x L y x a L y a a Σ .
< P r o o f >
z Σ * , a Σ ,
x a z L y a z L ( x L y )
x a L y a (Definition of L )
Proposition 13.
x , y Σ * , ( x L y ) ( x L y L )
< P r o o f >
Take z = ϵ .
x ϵ L y ϵ L
Therefore, x L y L .
Theorem 15.
- Myhill-Nerode Theorem
Let L Σ * , X Σ * .
X is said to be pairwise distinguishable by L iff every two distinct strings in X are
distinguishable by L.
The index of L is defined as
I n d e x L = m a x { | X | X i s p a i r w i s e d i s t i n g u i s h a b l e b y L } .
The following statements are true:
a If L is recognized by a D F A with k states, L has an index at most k.
b If the index of L is a finite number k, it is recognized by a D F A with k states.
c L is regular iff it has finite index. Moreover, its index is the size of the smallest D F A
recognizing it.
< P r o o f >
a Let M = ( Q , Σ , δ , q 0 , F ) be a D F A with k states that recognizes L.
  Assume for contradiction that L has an index greater than k.
   X (pairwise distinguishable by L) that has more than k members.
  Let s 1 , s 2 , s 3 s k + 1 be k + 1 distinct and pairwise distinguishable members in X.
   δ ^ ( q 0 , s 1 ) , δ ^ ( q 0 , s 2 ) , δ ^ ( q 0 , s 3 ) , δ ^ ( q 0 , s k + 1 ) are k + 1 states in Q.
  Since | Q | = k , by the pigeonhole principle, there are i , j where 1 i < j k + 1 s.t.
   δ ^ ( q 0 , s i ) = δ ^ ( q 0 , s j ) .
   z Σ * ,
   s i z L
   δ ^ ( q 0 , s i z ) F (M recognizes L)
   δ ^ ( δ ^ ( q 0 , s i ) , z ) F (Proposition 1.14)
   δ ^ ( δ ^ ( q 0 , s j ) , z ) F
   δ ^ ( q 0 , s j z ) F (Proposition 1.14)
   s j z L (M recognizes L)
  Therefore, s i L s j (Definition of L )
  This contradicts the assumption that X is pairwise distinguishable by L.
b Let X = { s 1 , s 2 , s k } be pairwise distinguishable by L.
  Claim 1. I n d e x L 2 L and hence L = I n d e x L = 1 .
  <Proof of Claim 1>
   I n d e x L 2
   X (pairwise distinguishable by L) that has at least 2 members.
   s i , s j X where s i s j and s i , s j are distinguishable by L.
   z Σ * s.t. s i z L and s j z L or vice versa.
   L .
  Since L = I n d e x L < 2 or I n d e x L = 1 , I n d e x L is defined to be 1 whenever L = .
  Claim 2. w Σ * , there is one and only one s w X s.t. w L s w . Hence by taking w = ϵ ,
  there is one and only one s ϵ X s.t. ϵ L s ϵ .
  <Proof of Claim 2>
  Either w X or w X .
  If w X , s i X s.t. w = s i .
  Call this s w so that w = s i = s w .
  Since L is reflexive, it follows that w L s w .
  If w X , w must be indistinguishable with a member of X otherwise it will contradict
  the assumption that I n d e x L = k .
  Therefore, w L s w for some s w X .
  Either case, w L s w for some s w X .
  If there is another s w X s.t. w L s w , then s w L s w because L is transitive.
  This contradicts the assumption that X is pairwise distinguishable by L.
  Therefore, s w is unique.
  Claim 3. If L then L X
  <Proof of Claim 3>
   L w L
  By Claim 2, there is one and only one s w X s.t. w L s w .
  By Proposition 1.52, w L s w L .
  Therefore, s w L X .
  Therefore, L X .
  This completes proof of Claim 3.
  If Index L = k = 1 , L = which is recognized by the one-state D F A , M = ( { q } , Σ , δ , q , )
  where δ ( q , b ) = b Σ .
  If I n d e x L = k 2 ,
   X = { s 1 , s 2 , s 3 s k } where X is pairwise distinguishable by L.
  Let Q = { q 1 , q 2 , q 3 q k }
  Let f : X Q such that f ( s i ) = q i i with 1 i k
  f is bijective (one-one and onto).
   q i Q , a unique s i X s.t. f ( s i ) = q i since f is bijective.
   a Σ , a unique s j X s.t. s i a L s j by Claim 2.
  Since f is a bijective mapping, there is a unique q j such that f ( s j ) = q j .
  Let M = ( Q , Σ , δ , q 0 , F ) where
   δ : Q × Σ Q s.t. δ ( q i , a ) = q j where
   a Σ , q i , q j Q s.t. f ( s i ) = q i , f ( s j ) = q j where s i X , s j X and s i a L s j .
  If there is another q k Q such that δ ( q i , a ) = q k , s k X such that f ( s k ) = q k and
  by definition of δ , s i a L s k .
  Since L is transitive, s j L s k .
  This contradicts that both s j and s k are in X and hence must be distinguishable by L.
  Therefore, δ ( q i , a ) = q j is uniquely defined.
   q 0 = q ϵ where q ϵ = f ( s ϵ ) and s ϵ is defined in Claim 2.
   F = { f ( s ) s L X }
   F because of Claim 1 and Claim 3.
  Claim 4. w Σ * , δ ^ ( q ϵ , w ) = q i w L s i where f ( s i ) = q i .
  <Proof of Claim 4>
  Claim 4 can be proved by induction on | w | .
  For w = ϵ , there exists one and only one s ϵ X s.t. ϵ L s ϵ by Claim 2.
   δ ^ ( q ϵ , w ) = q i
   δ ^ ( q ϵ , ϵ ) = q i ( w = ϵ )
   q ϵ = q i (Definition of 1.4(i))
   f ( s ϵ ) = q i (Definition of q ϵ )
   f ( s ϵ ) = f ( s i ) (Definition of q i )
   s ϵ = s i (f is bijective)
   ϵ L s i ( ϵ L s ϵ by Claim 2)
   w L s i ( w = ϵ )
  The statement is true for w = ϵ .
  Let δ ^ ( q ϵ , w a ) = f ( s i ) = q i .
   δ ( δ ^ ( q ϵ , w ) , a ) = f ( s i ) = q i .
   q j s.t. δ ^ ( q ϵ , w ) = q j
   s j s.t. f ( s j ) = q j and
   w L s j (By induction hypothesis)
   w a L s j a ( L is right congruence by Proposition 1.51)
   δ ( q j , a ) = q i
   s j a L s i (Definition of δ)
   w a L s i ( L is transitive)
  Conversely, if w a L s i for some s i X ,
   δ ^ ( q ϵ , w a )
   = δ ( δ ^ ( q ϵ , w ) , a )
   = δ ( q j , a ) where q j = δ ^ ( q ϵ , w )
  By induction hypothesis, w L s j because δ ^ ( q ϵ , w ) = q j .
   w a L s j a (Right congruence by Proposition 1.51)
  Let δ ( q j , a ) = q k
   s j a L s k (By definition of δ)
   w a L s k ( L is transitive)
   w a L s i (Assumption)
   s k = s i (Claim 2)
   f ( s k ) = f ( s i )
   q k = q i
   δ ^ ( q ϵ , w a )
   = δ ( q j , a )
   = q k
   = q i
  This completes the proof of Claim 4.
  It remains to prove L = L ( M ) .
   w L , one and only one s i X s.t. w L s i (By Claim 2)
   w L s i L (Proposition 1.52)
  Therefore, s i L ( w L )
  Since s i L X and q i = f ( s i ) , q i F (Definition of F)
   δ ^ ( q ϵ , w ) = q i (Claim 4)
   δ ^ ( q 0 , w ) = q i ( q 0 = q ϵ )
  M accepts w ( q i F )
  Conversely, if M accepts w,
   δ ^ ( q ϵ , w ) = q i and q i F ( q 0 = q ϵ )
   w L s i where q i = f ( s i ) (Claim 4)
   w L s i L (Proposition 1.52)
  Since q i F and q i = f ( s i ) ,
   s i L X by definition of F.
  Therefore, s i L .
  Therefore, w L .
   L = L ( M ) and M has k states.
c L is regular
   M s.t. L = L ( M )
   I n d e x L k where k = the number of states in M (by (a))
   L has a finite index
  L has a finite index
   I n d e x L = k
   L = L ( M ) for some k-state D F A M (by (b))
   L is regular
  Assume for contradiction that there is a k -state D F A accepting L where k < k .
  By (a), I n d e x L k .
  This would contradict k < k = I n d e x L.

9. An Application of the Myhill-Nerode Theorem

The Myhill-Nerode Theorem can be used to determine whether a language L is regular
or non-regular by determining the number of members in X, the set that is pairwise
distinguishable by L.
Example 6.
Determine if L = { a n b n n 0 } is regular.
Consider X = { a , a 2 , a 3 }
∀ distinct x , y X , x = a i , y = a j where 1 i < j <
z = b i such that
x z = a i b i L and y z = a j b i L .
x and y are distinguishable by L. ( x ¬ L y )
X is pairwise distinguishable by L.
I n d e x L | X |
I n d e x L is infinite.
L is not regular.

References

  1. Sipser, Michael. Introduction to the Theory of Computation, Third Edition.
  2. Dexter C. Kozen. Automata & Computability.
  3. John E. Hopcroft, Rajeev Motwani, Jeffrey D Ullman. Introduction to Automata Theory, Languages, & Computation, Third Edition.
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.
Copyright: This open access article is published under a Creative Commons CC BY 4.0 license, which permit the free download, distribution, and reuse, provided that the author and preprint are cited in any reuse.
Prerpints.org logo

Preprints.org is a free preprint server supported by MDPI in Basel, Switzerland.

Subscribe

Disclaimer

Terms of Use

Privacy Policy

Privacy Settings

© 2026 MDPI (Basel, Switzerland) unless otherwise stated