18CS54 - ATCI - MODULE 1 - FSMs
18CS54 - ATCI - MODULE 1 - FSMs
Alp habet
o characte6,
Pn alphabet tafoilë set of ymbols
.
t denotec 6y ihe ymbe
2a,b,c, , z }
E:O EngUsh alphabel
8tnay aphebet 20
* Striog
a fni le quence, posbly empty, of mbolS
A trino
6orne
apha
bet 2.
dran f0
+hat
that cas
can be
, k SbovlstE strono
tues any alphabet
i I l oil+ aj &
8.
for me d
forme d from Ihe Spryin ,
oueL an alphabet %
Jhe set of allpoible stigs
OrHco a
FUMCTIONS OA STRIN6S
in
# a b ba aa) 4
he
Concalenahio af too trinos and t , 9 the
foved
fovmed by oppend'o p t , , orto as | l t oi st.
by
: heo
goo good, f: bye godye
So, zyl l +ly
Concatenatioo
Jhe e, 6 the identity fÅ
he
empt
emp-H hing,
Concatn ahon, as a
funcioo defocd co
thng s,
anoGotye So
Sting Repltcalo
for each %og and each natral numbe , the
defioed as
aaa
bye byye
ab bbb
Strog ReueThal
for each sting , The eerse of i s d e o e d as
Jhen o a)
defioe w au
a u R
3
RELATIONS ON STRINGS
t S Occus
subatino of a stino f
AA thing
hn9 a
A
A iog & i6 a prope ubotog ofa trng t f f
bstoná ft and #t.
ve to i a
sibtring of tself.
Je Empty sting s a subrting of eue
A a pxef a f t { I ¬S t »1)
A is
s a pvopes pe of a
stig t 4f a
Pefoftancd s tt.
Euery ting pef* of rtself
a a
he
ph ngE a pef* of Euey g
Jhe
Jhe prefaeb
pe ef abba ave, E, a,ab, abb , abba
a
f t ff 31 ezCt za
A a
proper suffo a
hóng t
tff is
fand tt.
Evey t 5 a sffr of self
4self
Euev
Jhe Emphy
Enp t i 9 a kuffi of &veny *i
fofle alphabel .
OEr: Let a , b}
OEropty Lanouaoe
Lanougt SF15 Empt s t ECsiogle sting )
a,b
a , a aa, aaaa, . .
1 e , aa, aaaa,
fo L
E, o, aa, aabbb, bb
aye
Shing L
are not fo
aba, ba, abc
are fo L
bbaa , ba
Strin , aa, aaa,
aTe not fo
&,bab,bca
Dumbrr6,
ae fn L.
3+9 2#144
Storfs L.
ase not Po
3 # 8, 12, 2# 12ta
isto L.
A n a lgerithm IFaF ConVer stings to
u night CznvtE to 0 . #
Numbers
S to
nlegi Coovelei faik
to accept E, # 1s not to L
6 L Eia,b/a,bs DO picfY of w cotados b}
no psefa stari
Cheracla of w A a} OjEj
2eia, bs the frst
la he
Ihe Elemen
elemen i 9£
A ppgram lexi cographiCally Enumera
?t enumerala Ihem in lex cograjohie elda.
Lf
Lf
al a' precede all bk}
L 2x¬2a,b}
e
LP
Enumeratfioo of
Ihe lexicogrophic
ab, bb, aoa, aab, ab b, bbb, a aa
E, a, b, aa,
aab, aabb, abbb, bbbb, a
a
6
* C a r d t n aUtt_of hanouaoe
Jhe
Jhe Smallest Languag ovc ay alphabet A , Ohose co 1dinalit
OUeL
an alphabek I is .
The
Jhe Lages language
I f I: ¢ Jhen 2e Ond |= I
*fUnCTIONS O LANGUAGES
2a,bt lo
ewen numbes of a's}
1Aings F Ib an
Kleene Gta
Reverse
ACme aphabe
languages deftned
ovcL
Let L, and a be o o
Jheo Ccocatenaioo
heneY
6,
bone, frod
L i Catbone, cotfovd, deg booe, dogfovd, mosebene
ouefod, biydbone, bdfood
feall Lan guages ie}l
L
LC) (P)L =
Con caleootioo as a functioo defsoed on larguages
aKoCiaive
LL - L, ( L )
Let Lbe
a longuage defned oue sp
alphabct
Jhen Kleene Stal of,o%tten as i s
E L
idog, cak fANh
L e.deg c.,fsh, degdon.degeet,
fhcasdeg. fishdog fsheat,
f L: teo
C:ie}
* Kfeene Pluus
E L : 20,
POER Of AN AuPHABET
A Ihe
Jhe pooc o n alphabck dencre.d by
coor of lengb 8,
S20, S the
20,
: i oo, 10, , 0
Cprofrathat halG on all topuat
Does ot Eist clear fema pecifcallon
L 2 0 s a eoten ce fn En
OS
Fin'te Stali mach:oe
machine (fsm) a computeton al
A fioilë stal
output is one of tay o value k
dev: c e ohobe foput t a
stin hose
that ea d
eaa-
Accept aeject.
fsms are also sometimes Called foi lë stale
It mops from
K
K
Atali
toput tn stale
Jhe
Jhe languqg e acceptrd by M, denoted L(M), the set of all
M.
accepted alphobelk ( l a b e h )
daham
O)fnal stale & So, 1) : bo
O n:bal htale
s(o,0)
lable
diec o edae Sl) b,
e
CO
T
Exampes (Drsm) 107
a bf
OL 3we la,b ewe htmmedate fellaoed
elbl°ab.
L: iwe la,b3:eweyH a
ion is
of even gthf
la°ba°
6lala" | b
8
( bb X
b
ab
a
ba
ababab.
( bababa....
L : 2 we ia,bf:
does not contain the ubsbino aabE
Q.b
b
L:2 : 6 the strng sepiesentation of a floato poiot wmber I08
3
d (o-9) 43
E
d
Close
f 6'
a
P
&
&
( Q
UO
imne diate ps e ceded and
E)L: w ¬la,bt ee
fotlaoed bb
e
the Laneuae accepted d
Gtve a clear Ergsh descptioo of
follosing FSM
- (6)
a,b
b
O-
aa a ba
bbaaa
b aaaaa
b
a
D
-
- ooo
o
- o ° o o O|
o
8o
O
O o o
112
2we 2o-93 Corvesponds o be decmal encoding, s : thout
Ee
Gen-odd: odd
3,S,7,9
O d d
Codd-Gver)-(odd)°: odd
'3S,7,9
L: 2w eio, has no more thao one par of Comecu bve o's and
OLOO
O11IO0
OLO0L
co ends to 03
L:2we io,j: none
of he prefe* of
E Oot
Prefes are O
OOl.
6 an alphabet
EK i the Atart stalé
ACK s the et of fnal tate s and
A hEhe trar tboo selalon.
Examples:
OL iwe ia,hl: w6 made up of an optionat a follaoe d by aaa
fo Uowed 3eo o mose b's
)6
E a
a (oo) b
la, b,c,ds
, d
->( .cd
a,b,d
a,b.C
(8D
()
X
X
L2weia,bl
*
a,
a, a (
Da.b
,
6 3 6 &42
122
3
ShoShow an FSM del xmini stio o« nondelëimioisic)
that accep L:iweia,b,c} : w contaios at least
80
on e
Aubstsoo th at conaiAts of three ldentical
OOoO 96
ymbol O o 0O112
128
Ex
ample Jhe fetlas io stinos are io a abbb baacccbbbOoO
L ,
,6,C 60
a, ,b
O 0 o o ooT
C
b,c
(C
(O
E
Ses
()
( V
Go
T
E
R
O
o
CO
CO
e
CD
GCO
(,.9 (a) (g)(a)(,)%a)
i0,, , da.Os.7.ps,a) : 1 , , . ®u.t
tupu(G,)u(,
D, , s . ,%, b) 20,, a s.&.y.ag3 (8,) (ub G)()(a,G)
SHo.a.s . .®yd, c) 1 G,f
Co,c) (E,c) (c)e) (.c)
okactive -Atales 4
ie,.e,8,5, ¢,i,,ta.. s , , . , 1t,,,, 3 .
2,ag,Os. e, 4. 1e,s3
Con si de
L,4, ,b3s
a, o4, Bc,o,i ,a) t ¢
i , B4. vc, dat, b)
ta,s.eg
S ( , &y, , &, c) i.
& acbve -
6tali :
i i , . s , , ie,. , , s ,
2.Ogt, 2,©4, o,*
3,®s o, gs,24s, L, g, L,%3
Considc 16,, o s O6, .ogS
DCi,,,Os.o. ®3.rs a) 1a. o4,o,Bss
Dlio,,eu, , es. t, B9. ®s, b) 1,,a. , es, ,®9, ts
Sp Ct, ,
s , z ogk,c)
:
active-stales: {
2,ta),¢.io.a.g is. L,4,,%,®,,
i . . s , g 2eyt ,1g.es s , ,
ConideT 1ou ,1ea.,
Slis,a)
Sp (is,c) {tg}e
Consider 1 , gl
Spl,os.te, b) 1ou , » }
p
on
CO
MM
(
terCCAe
f o fos
s each of the flooing NDFSM Use
ndfAmlödf hm lo conntruct
an eguiv alent
DFSM. Begin byshooing the value of epslg) for each
stale
STEP 1
Compu lee epsl) for each stale o Km
epl) 2e, b, os S 1
ep ) e,.
ep () Bo.,,
eps(a) 1e 1 . o 8,9.
eps ()
ep () l,,,
STEP 2 6: epsG) : io,6,, a STEP 4 K': 2 ieo,,.
STEP 3
Compule s'
*acive- stalë :
i&'t ioo.8,,e} i,,
STEP S :
A
Cons:der 1do,o,. , , 2e,,t
SpCite.e,.et. 1%,
SD Ci,8,, ) ie, sS 0,.3
octve stalës: i ito,,,, isy,}
=
(Bo.o)u(0,,o) U (,o)
Consider les, ay, s
SpCtea, st,o) i, . o y u(,) u ( )
SpCt, ,D te,,,e«s s , 0 ) U (,0) U ( o
Ocbve - stales :
1iec.,,,, , x , i,,2,
Ccchide 0,y} , ) u,)u(e.)
s U (3,.) U¢(,,.s)
,a.S,0) ia, y,
(,)u.0)u(e.0)
So( a.,1)
(e.)u) u ( )
3
a
-
STEP 1
Compu e epsle for each stal fo KM
S b
epsl) 1o,,3
eo,,,
ep Ce
ep ( i6,s 2oo,,.xf
ep (4 e,,,
ph Ce)
Gctie
Consid
-stalës
i , tu
12do, .s, ie, Bus, 2Bo,®,,%) fo,.as)
SplLe,eyt, a) i,. 4
Sp(1.ut, b) 2 o, 8,.,
Gctve - staléi : tieo, 8.s, 1 , u 3 , i e 0 . 6 . . , i e , t,iBo,, , ,
Consider 1o.
SC0, e..tt,a)
Sp (ieo.,,egt, b) ieo.,
Conider ie,,e
S C1e,, , u t , a) : 1ea. y , , i
(1 , Bus,b) 1s . o ,
Conb:desiee,, . ,
Sp(io,,,.st,a) 1.u
S (1e0.,,g.%b) 1eo,®,.,
STEP A K': 1ieo . , 1 , u , deo,8, , 16,,t, 1eo.,, e, e
SIEP 5 i . , ie,..,&x 3} i6,, 35
a
eps) *i8,
epe 2s
ep e
eple) ie4
STEP 2 '
eps(A): leos
STEP3 Compue S
acive- stalë : 3s'5 : os
Cons de 1 t
Sp (1e. b eo
& actve- Atalis - os, 1e..8,5
Consi de ieo, .
SlieoR.s,b) i
acve 4talä :2o? , ie , , 1bo,B.
, 1%,®aSS
Con i de
leo,,,
Spl2o,o..3s.a) to,,, a
Sp (1,,,5,b) 2
o,,
active- stala 1 1eos,
1e%3s, 20.,3,. S, 1e.,1,
:
S (2e0,S. b)
2,g
*a cbve ntaleo: i¬k,
id,8,t, 1E0,8,ot,
io,2s,1800,,, 1,.,
1o, , ito,a
Coside 1eo, 8,, ,
Spio,, , , a) iBo,,u,,S
Sp(10,to, gt.b)
te,,,S
&active stal i : i ies, ieo.3,2eo , S , 2 2 . , 1e,,., , iso,3. 25
Spl2e0.o,,,a) ito.8,,,4s
Sp (ito, B, 25,6) ie,, 5S
Spleo,, s , a) 1o,®,,4}
Sp io. s, b) o }
Conbide ito,.a, Eu3
D i , ,, , a ) i ,, ,u,
So l1, 8.,, &t, 6)
ie,,2
Conides iee,E.
S2®,as, a) 1o,,.
Sb lio , uf, b) :
2,
Conhid io,3,, us
S ,,eus, a) i,,, S
Sp lio,, yf,b) 2,l
Conid o,s
PT 0
S I2
O b
20 .
2,,,
e.a.3 eo.., y, , ,s,4
io ,
2o..,.us
20.,,at
ito,,, a.3, us
2e0,a 45
1B,,, ,
ito.,
o,.,u
o,,,, y5 1eo,,
ie, ,,g
.,
2,,
PTO
28
..3) ((0.3.3,4
o,
7 )|
((O,',3,4)
(3,4)
((o,,4)
o,4
Let M be the
folloong NDFSM Cosbruct Cu sin6 ndsma dsm), a
DESM at
accepli L(M).
a
(
b creoting Dead Stale Dand addin the transitios
Complele
3,0,D 4,0,D {Da,D)
5,b,D) T,aD D,bD
29
ep 24,
b
i3 D 25.6
5 D3
* 5,6
D.
D
3,D D
*l3,T3 D 15,6
D,T D
2D,
a,b
a a
(D).
b
(b
DFSM LM) Ps
Occept
.c4-5.)
0
1
Minimi3:ng FSMA 30
Etamples :
Delerminioo L
61
a b
1 we T: eueny a is immediately follooed by
where : 2a ,bs
Jhe
Jhe eguvalence clakeb o are
JLE,b,abb,..J allstvi io L
adjacent characlas.
d) L: u e la,b}"3
) L : o ela,bj: Contasns at least ooe a and ends at least135
two b's 3
clames :
i (a,4J, Li,3,s,6J}
At tep
At 3E p2:
((3,a), C43)
CC3,b), 43) a
C(s, C.4)
CCs, 43)
Exec:se 135
Let M be the following DFSM. Use mioDFSM lo mioi mize M.
Clahes i U , 3 J , (2,4,s,6J}
STEP 1
CC'a), Ca,4,5,63) (C3,a), R.4.5.6) No SptEbng
CC,b, C,4,5,63) CC3,), , 4,563)
b
a
a
fio: lE Stalë TranAducers 13
*Man8 foile stalë +hansducers ave loop that Aimp'y run fovever
Pro cehing opulb
Cample: Traffic Ligh
80 beconds
A Moore machoe M ib a
AMealy machine M : a bi-tuple
even- tuple ( K, E,0, S, D,s,A) (K, E,o,8,^,A) uhere
whes e
Mealy Machine
adds an odd povity bit aflés every four bina digts that
Teadb.
OooO
ooo10
olo, 10 ol
olo olo
Readioo Gene(alog
olo
O000
00ol 10
0000
00
olo olo enevorl cd
O1000 o loo, 1|11
O1D1 1001 Poptt
Ba Code Reade
Bor Ehat encodes usE binay numbeis.
Code b lem
A ingle black colum encodes O
A double black column encode 1
Represeot a black bar i bh the stnbol 8 and a cohile bar oi th
ehe yobol
Read bhe bar code from lesE obE : input
Aumptio0s
bar Code Atarts oith a black columo , so oh:le
Eves
ace
comect
ahead of the firsE black column noed.
onored.
5
bar code there ae at least too hilë
Afl eue complelë
lo ead the nett Code.
column 6. At this po:ot, Teset
Tf eader bees Eree 0% more black column 70 a rOu, i t mutt
lo
BWLode
Letla Subatuhon
bidectionel
that Cao Coovet t n g
tran Aduce1
Buld a simp e
L Vice Veja ohue :}a,6f
alo
Ezercie (39
O Conhtruct a deleministicfoile stale transducer wth iopa t 2o,b}
for cach Of Ehe
follooing tasks
a) On
input «, produce 1", ohese n #)
a1 al
a 3
al lo Scl loop
bl al
Xabab ab
o booba
Ga°h a