Skip to main content
AAddmmiissssiioonn iinn IInnddiiaa 22001155 
By: 
admission.edhole.com
FFiinniittee AAuuttoommaattaa aanndd 
NNoonn DDeetteerrmmiinniissmm 
http://cis.k.hosei.ac.jp/~yukita/ 
admission.edhole.com
finite automaton 
Q S 
d 
q F 
A is a 5 - tupple ( , , , , ), where 
states 
Q 
1. is a finite set called the , 
alphabet 
S 
2. is a finite set called the , 
transition function 
Q ´S® 
Q 
d 
3. : is the , 
start state 
q Î 
Q 
4. is the , and 
0 
set of accept states 
F Í 
Q 
5. is the . 
0 
DDeeffiinniittiioonn 11..11:: FFiinniittee AAuuttoommaattoonn 
admission.edhole.com 3
0 1 
1 0 
SSttaattee DDiiaaggrraamm ffoorr MM11 
4 
qq 3 1 q2 
0, 1 
admission.edhole.com
Q = 
q q q 
1. { , , } 
1 2 3 
S = 
2. {0,1} 
d 
3. is described as 
q 
4. is the start state, and 
1 
F = 
q 
5. { }. 
, 
0 1 
2 
q q q 
1 1 2 
q q q 
2 3 2 
q q q 
3 2 2 
DDaattaa RReepprreesseennttaattiioonn ffoorr MM11 
admission.edhole.com 5
1. Implement M1 with your favorite 
programming language. 
2. GUI 
• Two buttons for input 0 and 1 
• State chart with the current state 
highlighted 
TTaasskk 0011 
DDFFAA 
admission.edhole.com 6
M L M 
language of machine 
The , written as ( ), 
is the set of all strings that machine accepts. 
M A 
We can say that . 
1 L M w w 
( ) { | contains at least one 1 and 
an even number of 0s follow the last 1} 
LLaanngguuaaggee ooff MM11 
M 
= 
recognizes 
admission.edhole.com 7
0, <RESET> 0 
2 
SSttaattee DDiiaaggrraamm ffoorr MM55 
8 
q2 
q1 
q0 
0 
1 
1 
2 
2, <RESET> 
1, <RESET> 
admission.edhole.com
Q = 
q q q 
1. { , , } 
0 1 2 
S = 
2. { RESET ,0,1,2} 
d 
3. is described as 
R 
q q q q q 
0 0 0 1 2 
q q q q q 
1 0 1 2 0 
q q q q q 
2 0 2 0 1 
q 
4. is the start state, and 
0 
F = 
q 
5. { }. 
, 
0 1 2 
0 
DDaattaa RReepprreesseennttaattiioonn ffoorr MM55 
admission.edhole.com 9
M5 keeps a running count of the sum of 
the numerical symbols it reads, modulo 3. 
Every time it receives the <RESET> 
symbol it resets the count to 0. 
M5 accepts if the sum is 0, modulo 3. 
IInnffoorrmmaall DDeessccrriippttiioonn ooff MM55 
admission.edhole.com 10
A language is called a regular language 
if some finite automaton recognizes it. 
DDeeffiinniittiioonn 11..77:: RReegguullaarr 
LLaanngguuaaggee 
admission.edhole.com 11
E2 recognizes the regular language of all 
strings that contain the string 001 as a 
substring. 
0010, 1001, 001, and 1111110011110 
are all accepted, 
but 11 and 0000 are not. 
EExxaammppllee 11..99:: AA ffiinniittee aauuttoommaattoonn EE22 
admission.edhole.com 12
You 
1. haven’t just seen any symbols of the 
pattern, 
2. have just seen a 0, 
3. have just seen 00 or, 
4. have just seen the entire pattern 001. 
Assign the states q,q0,q00, and q001 to these 
possibilities. 
FFiinndd aa sseett ooff ssttaatteess ooff EE22 
admission.edhole.com 13
0 0, 1 
1 
1 
DDrraaww aa SSttaattee DDiiaaggrraamm ffoorr EE22 
14 
q00 q001 
1 
q 0 0 
0 
q 
admission.edhole.com
A B 
Let and be languages. 
A È B = x x Î A x Î 
B 
: { | or }. 
A B = xy x Î A y Î 
B 
: { | and }. 
Union 
Concatenation 
* 
 
A x x x k x A 
k i = ³ Î 
: { | 0 and each }. 
1 2 
binary 
 
Star 
The first two operations are operations, 
unary 
and the last one a operation. 
RReegguullaarr OOppeerraattiioonnss oonn 
LLaanngguuaaggeess 
admission.edhole.com 15
Let the alphabet be {a,b, , z}. 
= = 
Let {good, bad} and {boy, girl}. Then, we have 
{good, bad, boy, girl}, 
A B 
È = 
{goodboy, goodgirl, badboy, badgirl}, and 
= 
A B 
{ , good, bad, goodgood, goodbad, badbad, 
 
* 
goodgoodgood, good goodbad, goodbadgood, 
goodbadbad,  
}. 
EExxaammppllee 11..1111 
 
= e 
S 
A 
A B 
admission.edhole.com 16
TThheeoorreemm 11..1122 CClloosseeddnneessss ffoorr 
UUnniioonn 
The class of regular languages is closed under 
the union operation. 
In other words, if and are regular languages, 
so is . 
1 2 
1 2 
A A 
A A 
È 
admission.edhole.com 17
M A M = Q S 
d 
q F 
Let recognize , where ( , , , , ), 
1 1 1 1 1 1 1 
M A M = Q S 
d 
q F 
and recognize , where ( , , , , ). 
2 2 2 2 2 2 2 
M A È 
A 
Construct to recognize , 
M = Q S 
d 
q F 
where ( , , , , ). 
1 2 
Then, check the correctness of the construction. 
PPrrooooff ooff TThheeoorreemm 11..1122 
admission.edhole.com Proof of Th 1.12 18
Q = Q ´ Q = r r r Î Q r Î 
Q 
1. {( , ) | and }. 
1 2 1 2 1 1 2 2 
M M 
2. We can assume that and have the same 
S 
alphabet . (Why?) 
1 2 
r r Q a r r a r a r a 
" Î " ÎS = 
d d d 
3. ( , ) , ; (( , ), ) ( ( , ), ( , )) 
1 2 1 2 1 1 2 2 
q = 
q q 
4. ( , ). 
0 1 2 
F = F ´ Q È Q ´ F = r r r Î F r Î 
F 
5. ( ) ( ) {( , ) | or }. 
1 2 1 2 1 2 1 1 2 2 
CCoonnssttrruuccttiioonn ooff MM 
admission.edhole.com Proof of Th 1.12 19
You should check the following. 
1. For any string recognized by M1 is 
recognized by M. 
2. For any string recognized by M2 is 
recognized by M. 
3. For any string recognized by M is 
recognized by M1 or M2. 
CCoorrrreeccttnneessss 
admission.edhole.com Proof of Th 1.12 20
The class of regular languages is closed under concatenation 
A A 
operation. In other words, if and are regular languages, 
A A 
so is  
. 
1 2 
1 2 
TThheeoorreemm 11..1133 CClloosseeddnneessss ffoorr 
ccoonnccaatteennaattiioonn 
admission.edhole.com 21
To prove Theorem 1.13, we need 
nondeterminism. 
Nondeterminism is a generalization of 
determinism. So, every deterministic 
automaton is automatically a 
nondeterministic automaton. 
NNoonnddeetteerrmmiinniissmm 
admission.edhole.com 22
A nondeterministic finite automaton can 
be different from a deterministic one in 
that 
◦ for any input symbol, nondeterministic one can 
transit to more than one states. 
◦ epsilon transition 
NFA and DFA stand for nondeterministic 
finite automaton and deterministic finite 
automaton, respectively. 
NNoonnddeetteerrmmiissttiicc FFiinniittee AAuuttoommaattaa 
admission.edhole.com 23
0,1 
NNFFAA NN11 
24 
1 0,e q4 
qq 3 1 q2 
0,1 
1 
admission.edhole.com
PPaarraalllleell wwoorrlldd aanndd NNFFAA 
25 
... 
... 
accept 
admission.edhole.com
0,1 
1 0,1 q4 
EExxaammppllee 11..1144 NNFFAA NN22 
26 
qq 3 1 q2 
0,1 
Let language A consist of all strings over {0,1} containing a 1 in the third 
position from the end. N2 recognizes A. 
admission.edhole.com
0 
0 0 q110 
1 q111 
AA DDFFAA eeqquuiivvaalleenntt ttoo NN22 
27 
qq 010 000 q100 
qq 011 001 q101 
1 
0 
1 
0 
0 
1 
1 0 
1 
1 0 
1 admission.edhole.com
e 
0 
0 
0 
EExxaammppllee 11..1155 NNFFAA NN33 
28 
e 
0 
0 
Let language A consist of all strings 0k , where k is a multiple of 2 or 3. N3 
recognizes A. 
admission.edhole.com
0 q0 
AA DDFFAA eeqquuiivvaalleenntt ttoo NN33 
29 
0 q 0 q 0 q0 qq1 2 3 4 
5 
0 
q-1 
1 1 
1 1 1 
1 
0, 1 
admission.edhole.com
EExxaammppllee 11..1166 NNFFAA NN44 
30 
q1 
q2 q3 
a 
b 
a,b 
e 
a 
N4 accepts e, a, baba, and baa. N4 does not accept b, nor babba. 
admission.edhole.com
nondeterministic finite automaton 
A is a 5 - tupple ( , , , , ), where 
states 
Q 
1. is a finite set called the , 
alphabet 
2. is a finite set called the , 
transition function 
Q 
3. : 2 is the , 
start state 
q Î 
Q 
4. is the , and 
0 
5. is the . 
DDeeffiinniittiioonn 11..1177:: NNFFAA 
0 
set of accept states 
F Q 
Q q F 
Q 
Í 
´S ® 
S 
S 
e d 
d 
admission.edhole.com 31
Q = 
q q q q 
1. { , , , }, 
1 2 3 4 
2. {0,1} 
3. is given as 
0,1 
q q q q 
1 1 1 2 
1 0,e 
q q q 
2 3 3 
q q 
Æ Æ 
3 4 
q 
4. is the start state. 
0 1 
{ } { , } 
{ } { } 
{ } 
{ } { } 
EExxaammppllee 11..1188 NNFFAA NN5. { }. 11 
4 
1 
4 4 4 
F q 
q q q 
= 
Æ 
Æ 
Æ 
S = 
e 
d 
32 
qq 3 1 q2 
0,1 
q4 
1 
admission.edhole.com
Von Neumann machines are deterministic. 
However, there are many cases where 
machine specification is all we need. 
IInn wwhhaatt ssiittuuaattiioonn iiss NNoonn 
DDeetteerrmmiinniissmm rreelleevvaanntt?? 
admission.edhole.com 33
Every nondeterministic finite automaton 
has an equivalent deterministic finite 
automaton. 
◦ Def. The two machines are equivalent is they 
recognize the same language. 
TThheeoorreemm 11..1199 
admission.edhole.com 34
N = Q S 
d 
q F A 
Let ( , , , , ) be the NFA recognizing some language . 
0 
N 
e 
Let us assume first that has no arrows. 
= ¢ S ¢ ¢ ¢ 
M Q d 
q F 
Construct ( , , , , ) such that 
¢ = 
Q 
Q 
1. 2 , 
¢ = 
R a r a 
d d 
2. ( , ) ( , ), 
¢ = 
r Î 
R 
q q 
3. { }, and 
0 0 
0 
¢ = Î ¢ Ç ¹ Æ 
F R Q R F 
4. { | }. 
PPrrooooff ooff TThh.. 11..1199 
admission.edhole.com Proof of Th 1.19 35
E R = 
q q R 
( ) { | can be reached from by traveling along zero or 
more e 
arrows.} 
We modify d 
¢ 
as follows. 
¢ ( R , a ) = { q Î Q | q Î E ( ( r , a )) for some r Î 
R 
}. 
We modify as follows. 
d d 
q 
¢ 
0 
¢ = 
q E q 
({ }). 
0 0 
We omit the correctness p 
roof. 
IInnccoorrppoorraattee e aarrrroowwss 
admission.edhole.com Proof of Th 1.19 36
A language is regular if and only if some 
nondeterministic finite automaton 
recognizes it. 
CCoorroollllaarryy 11..2200 
admission.edhole.com 37
N = 
a b d 
Given {{1,2,3},{ , }, ,1,{3}}, we want to construct 
4 
D D 
an equivalent DFA . The 's state set may be takes as 
{1,2,3} 
= Æ 
2 { ,{1},{2},{3},{1,2},{1,3},{2,3},{1,2,3}}. 
b 
EExxaammppllee 11..2211 NNFFAA NN44 ttoo DDFFAA 
38 
1 
2 3 a 
a,b 
e 
a 
admission.edhole.com
1. Write a program that simulates N4. 
2. GUI 
◦ Three buttons for input 0, 1, and epsion. 
◦ State chart that reflect the branching of the 
world. 
TTaasskk 0022 
PPaarraalllleell WWoorrlldd 
admission.edhole.com 39
The start state is E({1}) = {1,3}. 
The set of accept states is {{3},{1,3},{2,3},{1,2,3}}. 
The state diagram is given as follows. 
SSttaarrtt aanndd AAcccceepptt ssttaatteess 
admission.edhole.com 40
f {1} {2} {1,2} 
{3} {1,3} {2,3} {1,2,3} 
TThhee ssttaattee ddiiaaggrraamm ooff DD 
41 
a,b 
a,b 
a 
a 
a 
a 
a 
a 
b 
b b b 
b 
b 
admission.edhole.com
TThheeoorreemm 11..2222 TThhee ccllaassss ooff rreegguullaarr 
llaanngguuaaggeess iiss cclloosseedd uunnddeerr tthhee uunniioonn 
ooppeerraattiioonn.. 
42 
N1 
N2 
N 
e 
e 
admission.edhole.com
N = Q S 
q F A 
Let ( , , , , ) recognize , and 
1 1 1 1 1 1 
N Q q F A 
( , , , , ) recognize . 
2 2 2 2 2 2 
N Q q F A A 
Construct { , , , , ) to recognize . 
Q q Q Q 
1. { } 
  
0 1 2 
2. The state is the start state of 
F F F 
d 
ì 
ï ï 
í 
q a q Q 
( , ) for 
1 1 
q a q Q 
( , ) for 
2 2 
q q q q a 
{ , } for and 
ï ï 
Î 
Î 
1 2 0 
Æ = ¹ 
î 
= 
3. 
PPrrooooff ooff TThh.. 11..2222 
= = 
= 
= 
= S 
= S 
e 
for and . 
4. ( , ) 
0 
1 2 
0 
0 1 2 
e 
d 
d 
d 
d 
d 
q q a 
q a 
q N. 
 
 
admission.edhole.com 43
TThheeoorreemm 11..2233 TThhee ccllaassss ooff rreegguullaarr 
llaanngguuaaggeess iiss cclloosseedd uunnddeerr tthhee ccoonnccaatteennaattiioonn 
ooppeerraattiioonn.. 
44 
N1 N2 
N e 
e 
admission.edhole.com
N = Q S 
q F A 
Let ( , , , , ) recognize , and 
1 1 1 1 1 1 
N Q q F A 
( , , , , ) recognize . 
2 2 2 2 2 2 
N Q q F A A 
Construct { , , , , ) to recognize . 
1. 
2. The start state is the same as that of . 
3. The set of accept states is the same as that of 
d 
ì 
ï ï 
d e 
í 
d e 
ï ï 
î 
q a q Q q F 
( , ) for and 
1 1 1 
q a q F a 
( , ) for and 
1 1 
q a q q F a 
( , ) { } for and 
1 2 1 
PPrrooooff ooff TThh.. 11..2233 
Î Ï 
Î ¹ 
Î = 
Î 
= 
= 
= S 
= S 
( , ) for . 
4. ( , ) 
2 2 
2 
1 1 
1 2 
1 2 1 2 
q a q Q 
q a 
N 
q N 
Q Q Q 
d 
d 
d 
d 
d 
 
 
 
admission.edhole.com 45
TThheeoorreemm 11..2244 TThhee ccllaassss ooff rreegguullaarr 
llaanngguuaaggeess iiss cclloosseedd uunnddeerr tthhee ssttaarr 
ooppeerraattiioonn.. 
46 
N1 
N 
e e 
e 
admission.edhole.com
N = Q S 
q F A 
Let ( , , , , ) recognize . 
1 1 1 1 1 1 
N Q q F A 
Construct { , , , , ) to recognize . 
1. { } 
 
2. The start state is the new start state. 
F q F 
ì 
ï ï ï 
q a q Q q F 
q a q F a 
d e 
q a q q F a 
d e 
í 
ï ï ï 
Î Ï 
( , ) for and 
1 1 1 
Î ¹ 
( , ) for and 
1 1 
Î = 
( , ) { } for and 
1 1 1 
q q q a 
{ } for and 
1 0 
Æ = ¹ 
î 
= 
3. { } 
PPrrooooff ooff TThh.. 11..2244 
= = 
= 
= 
= S 
e 
for and . 
4. ( , ) 
0 
0 1 
0 
0 1 
* 
0 1 
e 
d 
d 
d 
d 
q q a 
q a 
q 
Q q Q 
 
 
admission.edhole.com 47