Professional Documents
Culture Documents
V Semester
Automata Theory and Computability (17CS54)
[As per Choice Based Credit System (CBCS) Scheme]
MODULE - 1
Introduction to Computation
Today's programmers cannot read the code that was written 50 years back. The programmers of
early days would not imagine a program of the form we have today. The theory that we study
addresses the properties and useful in 2 different ways.
1. It provides a set of abstract structure for solving certain class of problems and implantable
on whatever hardware or software platform available.
2. It defines provable limits to what can be implemented regardless of processor speed and
size.
SD Languages
D Languages
Context-Free
La es
Regular
Languages
FSMs
PDAs
Turing Machines
l. Regular languages: They are accepted by some Finite State Machines. They are used in
string processing.
2. Context-Free Languages: They are accepted by Push Down Automata (PDA). They are used
in compilers for parsing.
3. Decidable (D) Languages: They can be decided by some Turing Machine that always halts.
4. Semidecidable (SD) Languages: They can be decided by some Turing Machine that halts on
all strings in the language.
5. Turing Machines: It is used in Machine Learning, Software Engineering, Computer
Networks.
6. Push Down Automata: They are FSM with some memory called stack. It is used in compiler
design(parser design for syntactic analysis).
Finite Automata
I. Finite Automata
2. Linear Bounded Automata
3. Push Down Automata
4. Turing Machine
t h e n
start t &they; then
thi this
Applications of FA
7. String processing
8. Software Design (in communication protocols in computer networks)
Compiler Construction
FA is used in the design of Lexical analyzer (first phase ol' compiler design) which breaks thc input
text into various units such as identifiers, keywords, punctuators ctc.
Sum • numi • num2 . acyept xcept
Identlfier o Identlfier
An•lvtet accept
for-keyword
[a-np-
[a-eg- 2) la-q .9) (a-om
numt
'teat&er ' Operatot
acceM
'dent'fler
[æzo-9]
String matching
In designing a software for identifying the words, phrases and other patterns in web pages.
•fSErior Success
A circle with -+ which is not originating from any node represents start state
of the machine.
1. Alphabet (E) :
A language consists of various symbols from which the words, statements etc. can be obtained.
These symbols are called as alphabets. An alphabet is a finite non-empty set of symbols. It is
denoted by E.
Examples :
E = {0, 1} Binary alphabets
z} -+ Set of lower case letters
= ßb,....z, A, B, ...Z, O, 1 9, #, (, {, }, [, l, ..... } —Alphabets of C Language
2. Power of an alphabet
It is denoted by El. It is the set of words of length I taken from E.
Example:
If: = {0, 1} then
= {E}denotes set of words of length 0
El = {0, 1} denotes set of words of length I
2 2 = {00, 01, 10, 11} denotes set of words of length 2
3. String (w) :
the alphabets of a language.
A string is a finite sequence of symbols obtained from
alphabet E. It is denoted by w.
It is defined as a finite sequence of symbols from the
Empty string :denoted by e (epsilon)
Example:
Let E= {0,1} is a set of alphabets.
Different strings
Notations:
E is for empty string
Ex : w=100101
Lowercase letters such as u,v,w,x,y,z are normally used to indicate strings.
Functions of strings
1. Length of a string
:
It is the number of
symbols in the string w and denoted
Examples: by lwl.
'001 110' is a string
from the alphabets {0, I} has length 6.
{a, b} and S = 'aabbabbba'
then ISI= 9.
The length of an empty
string—O.
2. Concatenation of two
strings :
Concatenation of two strings u and v is
the string obtained by appending symbols of v to the right
of u.
Example:
u=abc, v=def
uv=abcdef
3. Reversal of a string :
It is obtained by writing the symbols in reverse order.
Example : ifw=abc, then w —cba.
Relations on strings
1. Substring :
A string s is a substring oft ifs occurs contiguously as a part oft.
Example :aaa is a substring of abaaabbaa
A substring s is a proper substring of a string t ifs is a substring oft and s#t.
2. Prefix:
A string s is a prefix oft is xeE* (t=sx).
Example : the prefix ofabba are e, a, ab, abb, abba
3. Suffix:
A string s is a suffix oft is xeE* (t=xs).
Example : the suffix of abba are E, a, ba, ba, abba
4. Language :
A language is a subset of E* denoted by LCE*
Examples:
I. A languageof strings consisting of equal number of O'Sand I's
5. Cardinality of a language :
It defines size of the language. The smallest language over any alphabet is (t)whose cardinality is O.
The largest language over any alphabet of is E*.
Functions of language
Since languages are sets, all standard operations are well defined on languages.
1. Union :
2. Intersection :
Ll L2 = { aa, aaaa
3. Complement :
Ll —L2= {E,aa, aaaa, .... }
L2—Ll = { a, aaa, aaaaa, }
4. Concatenation :
Let Ll and L2 be two languages defined over the alphabets E.
Ll.L2 = { weE* I seLl, teL2 then w=st}
Example :
Ll = {chair, table, desk}
L2 = {book, paper}
LIL2 = {chairbook, tablebook, deskbook, chairpaper, tablepaper, deskpaper}
5. Kleen'sstar :
Let L be a Language defined over some alphabet E. The Kleen's star L* is the set of strings that can
be formed by concatenating to gather zero or more strings from L.
Example :
L={dog, cat, fish}
L* = {E,dog, cat, fish, catdog, catfish, fishcafish
6. Sentence :
A string that belongs to a language is called word or sentence of that language.
If L = {e, }, then 01 is a sentence, 0011 is a sentence etc.
In DFSM, there is always exactly one move that can be made at each state. This move is determined
by the current state and next input character. Example : A telephone switching circuit can be easily
modelied as DFSM.
Formally, a DFSM —M is a quintuple (K, E, 6, S, A) where
K = Finite no. of states
E = input alphabets
SEK = Start state
ACK = Set of Accepting/Final states
= transition function
x to K
(current state) (input symbol) (next state)
The transition function 6 defines an operation of DFSM. We will define the relation "yields-in-one-
step" written as l- M
yields-in-one-step" relates configurationl to configuration2if M can move from configuration I to
configuration2 in one step.
Designing DFSM
Steps :
l. Identify the minimum string.
2. Identify the alphabets.
3. Construct a skeleton DFSM.
4. Identify other transitions not defined in step 3.
5. Complete the DFSM.
Questions
(1) Draw a DFSM to accept string of a's having atleast one a.
Solution:
l. Min. string = a
2. Input alphabets E = {a}
3. Draw skeleton DFSM
a
start
4. Identify transitions not defined in step 3.
qoon a
(lion a
5. Complete the DFSM.
a
a
Transition table
K = { qo, q}
a
2ονψΗ'Όη '
@ ok-H€T
Ηοο 'fabke
Πταρσ-»ι'
9.2
one a ,
cao ηα 6k
DV-SM
Tabks
@ Cosop\eEe
b
—-3Τ τατ»
@ D'QkO Q 1-0 accepv tog q; Ex
q,bl
Table
O Qbb @ Dßgtvj
b
b b
b
b
CLI 70
10
9-3
9-0
abb
pvevtou.% .
vevesg,l'ng
b
13
99
b
τσαγ-,ΑΉΟΌ 7 able
73
@ a DPSFI OK dc and b'g
bab
golu
O bab
Table
80
DV-SM to oe Qk a-d bk
@ Desegn
@ D€cxgraro
01 b
b
D FSM
b
6 CK, S, dB, N) , S: (QIb3 30
@ Que# ,
10Q , 001 as, Iq M)
O gke\0-on
o o 23
o
o
o o
⑩ Degtgn 0 代0いpト い、
ハ OK 00d 修 いq 、 し
のヾ い、
トいい9 - 000 - ( ,兄, ざ,雪合丿
ーヾの し 、 , 73
D「円
0 0、 0
ユ0
丁Q 「
内ぐい の
℃
ざ 0
0
0 0 0
gら
〇D色 p トng く
0 夜0 「
d、b* [0ト
e破
し Q +ト
)ン 0}
The ト い、
ぐ みト a て
ト(い0
のの 「
円 ス
cx0「0 「 &
出 Q
and endtng
Cooptel--e
O C16,2, TQbte
32
endJ, vo&h 2
tton
01L
o
o
2
WOO TQb(e
3)
6
c - (o,1,21
roenvtoned
DC-QM
TQNe
ROD
b b
b b b
ok ether or end*
nab"
Qb ab Cornb(ne them
Tcme
43
N0\e. O;-3
mod S !z 01 haxrcng
q tb
even À havtnù
01
Tab le
qab
O
eYe TQb(e
too
Oh
b
uOOrd
@ ReQd CHQ vx'OF' and
ct_A
c-
Boo odd
eg..,
odd
o
(AROD
De.scgo Dr-gm u p 10 g
Τ)τακΟ
Ok ard even no Ιλ
Tabl€
Tab&-
1. To accept strings of a's and b's such that every 'a' is immediately followed by a 'b'
ql
q3
Tra State
2. To accept strings of a's and b's such that strings start with ab.
q0 ql
Tra State
3. To accept strings of a's and b's such that 'a' is of odd parity.
ql
number of 'a's and even number
4. To accept strings of •a's and 'b's such that odd
of 'b's
ql
5. To accept strings of 'a's and 'b's such that there is even length regions of 'a's
ql
6. To accept strings of 'a's and 'b' s such no two consecutivecharacters are same.
ql
qo
Tra State
l-z 00 t. TA (0)
bab
DPSM
Os
DPSM'
Țțap AtQhe
Dote by erne'
PX-OH
Q DF-gMI dtvdu,
(5)
t5 cb(e by 3
F-oy— ,
, 10
28
Obl-QA'ned Q ever t-enC by
eek'. For dz
To f ououoed
90
we p ccLenY the b
6 (gi,d) :
@ obove
be •
0000,
@ Cr), Chl-X.kY
crtphQbeEAcd), (H)
@ c_ornpu-kVe POK4(ble }
6 &bere
mocA
mod
mod 5 o
6Cșo,l)
6Cîl
5
6Cą2,o) cą_u
3+0) 5
Ucą3,
Tab\e
90
92-
šoke t
s, DFAYI:5
, bpgyr--
țor
Q DPSM) 'A
2. 0000, 000, -
 o, As
poA%ôbțe
C2C+d) mod 2
690 ,
cu
@ YBe pogeÄble
@ Compul--e 6 ,d) •j
O 9 Yhe Ye rn@1'ndJ
bCå 3 ,
o j 20
I I I..A,I
2.s,S
o
o 6 CV, 02-
Fem
Voc Q
Sven
@ ecru ed
@ bpgm
emcepHY0ng•
netli- Atoae.l
get<
bkd by
tb'x
O L2 qq,bĽ or
L2 1 00C- QE:xbh
epAC9-) as c 0$
veaebable 0f- 6
DV-gN •
gyep\ • eavh
eps(Zo)
epA )
Ηση TQEle αχ-"
Tab\e ος-
epg( ι) Ζ
evcH'\Je @
9-12 ρο) :
eps C υ
epsC , 221)
@ eps(
Ac-Fve
,
@ epxc
6 l) l) 2 epscqqxl)t
C epf-,Qoò29
vq-a&eg
dD, SD,BD)
0
→。 }
70,し9
0
0
90′田 70′ し 工
1
レ
し
0
ct3
epACîô
eps(î3)-_
gt•ępz:
epsCîo)
Ack•€ve ,
60 epĂC ,o)
D 2 eps C
@ 1-0
epg(D):
€pACc)2 FFq
epr-,C D)
6C : epsQ qCi
Acttve
epA Q
epg( RD
esc-k<Ve
RD , qc, E,PÎ
ȚQble DPSM
cv
( D, 乥, , s', ADD
丁a 00、 DF-SMJ
6 0
0 0
0 乁090 ”g 「g
○ C00 0 卜”
了「 ℃ 0 Table 0 ND「
b
3: K&at-e
σ ( 13)
TOble
6 b
23
90 φ
b
О
гЧЂРем DPSM
Ь с
ерясф--
ф
Ме 2:
ерк(р) ЯРЗ ЯАо.&е
дчер
б С(РА ерксрЂ2
р,зд
(р,ъх3)
Ас-чме 4о&еЈ
тоне
рит
с-
Др,ъху
20
ерця») 2
дчер 2
ерсЭо)--
TQb\c 0K
VI_I , ,9-2A
From-n Vs'Mk
by
can be Vvangkcy\-ed Q
dtvecHßd
aspecY ov
T-r•OicàvAH
o L Hssc_ro accepH•ng
non acc Aa-Eu ehes-Ja re Fo6e
DVSMt ç-rorn L
O - AccepU empHd
ト b・
、
boaいト 0、 、
ヘヾ」 DPgMl
Theろ ( 1、 、
トトト
。
(へは( [3 いは
、い 〕
〕
0均 0。
[。 。 改0 ・
一 一0
0、 や 0
C、0 、0 0
0 00 ~
。 、
0 0 、。守 0 0 。 0姿
、
0 000 0、
0 し
トぐ 、 0等 、曾
みい、
(.ー 、
0 , b い02 ,
3
bP-gY1
•.bÇgry1)
6 Ctasses z q A, op
-ace epH•rg
@ Bepeak no {-0
been
bQAtkd Q hQ-kO
CAa-gxu, Old
omeg,
Atcxte-9 be
ave force
eaeh , e-lnrneolc oC
, e veacl
ave p Fhere eg
(Vgou k-o ,
be
ro OKose behavtour ,
8, 6, ( ekememU
OF
tpj
0 D
b
( 0, 3 工u 〕
, t冂,「 )
20 g
b
b
* 3 5
0 3
3
: 00 00 00〔 0 , 丶0 〕
0
0
6 0
5
T d
3 ,讠5
6
D
C tD3)
6 o
Nng
îrg,p3,
6 O
6
6 o
c
o
o
6
6
o
B C E
evep \
6 o
(C, F, r 2 * &ecuxtred
6 o
qtHng
ed
(t t c, FIT] )
6 o
cĚ,e
o o
R DVQM
@ eng
BO b
6
b
0,讠 3
20
Q
b
Q,b
ta (2Ml)
Ici)
Cc]
VB,D , p,
o 6 o
(BID, p, H F}
, , LB,H3,
o 6 o
e&LkCed
o
No o
o
29
OU&PCkU
O M OUe
r€leaq e
Q deperdA upon fhe
6 e.senk
Tn , e ach
6 VuoeROD Qx g
H-òe
1-0t H )
S
or bb.
b 10
@ eoça
go
FOY chec«
D 101 - A
ekse
c } eue C.
01C
Olc Olc
olB
IIC
DesÄSm Q
he
and QA
oc- number
0! 00
oll
(10
@ Q k--t-nt
LSE
OID 011
\o too
o
o \ too
(10
mcove
Q dependß On!q on o (
mcu\Ä€vxe,
g Q_kkemce eneoum'ceted
goux\-con:
o
o
1b
Otp
'e Qkketi(e Qbb'
oveç .
9010 10 %311
IO
o o
o o o o o
b Q b
rqeQ VA M(OOx-e
ÑOOve e
ouvpwt-
c-KQnge-L, dou. nov
O more no sop
@ EQ.A(d cle.Atgn
Comvexnor“) γο Y\OOY€
a
Το N\eay
ττ Tabke οβ
Ehe Ι
•
@ Conves\- Y\eakH k-o
olb
ο
οια
ο
llb
ι
ο
Ota
11B
O C.omver\- to •
otb
Ata
O moote YONeqlkå
9.212
blo blrz
tF,eo
etcotan\eved Q
o
o
ct2
Olb
ofb
olb
• •Automata Theory and Computation
4 eoncatcmd.con and a At-zinc/
'dheoyem: 60 and æu 41Mr,
:
+duo/ton /x/:
8æe y,qer-,
x re, and 002) e.ooc) FOR
ID-rood: (
$4 en
dome
Conot{.u QA . x, eOheu no.
a and lul n :
(RDX)2
( (eou)a ) ax' 01
a (u%0 2 )
hotho
a. Yhe
Yheorem: '-1 81 -"Cun. Counéa6Q/ n.f
06
el.-cu-2RG ear) be lexico enuuuaåd
• knu aa 06 1, 4U-2r,
le».ffR.a and -40 (7
ren
G) ordu.
Sushmiåra S@GAT Module I
Page I
15CS54: Automata Theory and Computation
enamel at-on uQr '-o aon ed__
-luxu C-.f<
,40n.C...2
eon
OUL( Jf Q %%
e an dern 01 ZQn%ate a-t- o and al- mad
'Soau ao
et4QU OY Ooun&a
e one attRcxtcoo and t-Rtveyre
O Zan ()u.oqeg
and ko% u.oq
and
-l(.uoren.A•
and
Coneaü-naübo O a
D O .coreo-r.zr-uatmo
01
on NIOcsrn acce123
(3 (k, 4, S, s, A)
me Ian e L, accel
exi4FJ an
6 Con Nruc4Υon
-104
6a'ed on -Itu unc&nn e/oc and On
$4Qr-n 4a
an -ICLE
Al-aa' m' Corregpond 40 p/ Al-a&t
S' e ehc(s)
fagk : a,' A
g' (a,c) -v feÉs(f) : 39 ca ( (q , c, f,) e a) à
KDeAhou.zd a&ou.l- -LC'
dl .z&aa an k' eacA
mageZ"Mer , man -100"
01 f'(k). %+.oeua, -relerü-a
om S • Ào *.oeeotu
be un AcxcLa6&
Al-a@' a'
name eaeuo A-a& k' -'tu ob F(R) 40
A9ta•ca cor-ru/,ohdc • -RIO* make
—Ie%DO-.Rd LO*O --10-1 eoovki • uon
-r-.zozeda6el'
rnenol --1txo.j- namel. '-oe eou-ld
catad
ro cûcz'o& Q t-fn k' on aec-L/,Mn
ADhe4Qu 40 an 06 # k ) 4C..(.D.-F
Con 4a.zPnc 0a..sé OM A de one acez/,.u•,-•,tQt-a&
ehc(s )
a) Qc*tu-z-zeatll f sq%
Æaek 9 Q do
• P ..zuet-& (9IQ'P) c do
K-.U.O- e A.X'.OQ-Q& V
Add 'Cu (Q, e, MA9-Å.&aå)40 g'
QCk0u-.t- a--aü,.1 4tun
Qel-t(..u
k' ack•u-2 -A.ka&ß
eondâucZîon O/ m e ( k, 6, g,s, n)
k eonV-cu0nś. n OM ea..c.ZzequTvaz-TA.ćT
g te J, Q9cu00QLtA,U e(au O C• cunol.u
Qnd ce 4.
( fir), &)