0% found this document useful (0 votes)
18 views23 pages

At Tutorail 1 Merged

The document contains tutorial notes on formal language theory, including definitions and examples of regular expressions, deterministic finite automata (DFA), non-deterministic finite automata (NFA), and their properties. It discusses concepts like the Kleene closure, positive closure, and recursive definitions for functions such as factorial and Fibonacci. Additionally, it includes various exercises and proofs related to these topics.

Uploaded by

regularuse0001
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views23 pages

At Tutorail 1 Merged

The document contains tutorial notes on formal language theory, including definitions and examples of regular expressions, deterministic finite automata (DFA), non-deterministic finite automata (NFA), and their properties. It discusses concepts like the Kleene closure, positive closure, and recursive definitions for functions such as factorial and Fibonacci. Additionally, it includes various exercises and proofs related to these topics.

Uploaded by

regularuse0001
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

dassmate

Date
Page

Tutoial No.1

s.wike cown the zegulax expzess ion fox the tallowing bngueges?
L=ab, a¡b, bah, aabbab,.. over Ea,bË
Ans R.E =(atb)"ab
L=it,1io, 1111i1oiio__3over E-f0,1

A sting with cdd number of 's oyerE=lo13

i9A sbing containing either ab or bba asj^


Ans R.E= othË Cabtbha) (otb)*

Ans:'= fa,bc
?=aaabac ha, bb, be ca_cb,cc
¿3{aag, aah aac, aba,abb abc, aca, acb ac, baa, bab, bac,
bba,bhh bbc bca, bcb,hcc cac,cab, cac, cba, cbb, cbe, cca,
ccb, cec3
Q.3pene the kleere Closuze Positive closue and Power of alphabets.
Ans:-Dkleene Closue:
kleene Cosune is he infinike set of all possible ings ot all
possible stings of a possibe lesglhe incleing E.
It is denoked by
So *= °yEs?uss
for eg Over E-0.1
clAsSMate
Date
Page

Positive Closuzei
osibe closune s Lhe iofnile sek of all pssible songs
of oll possible lengths excludig E
It is denoled
Sa, =¿*e
So, Et= s'Uug°u,

E=0,1,00,o1, Lo 11,o00.00L,oLo, 1o0,j


3owey of Alphabeti
I£ &is an alphobet the set of all be expressed
Q
stigs
ceatain length fan that alphabet by usiag euponental
exp
notation.
-The pQwer of on alghabet is denoted by Ek Gnd is the set
lof sbings of length kk
tor eg-o}hen
E=lo13 2'=2)
s°= fooo, oo1,olo, o21, Loo, 1o L, Lia,11) =
Q4Prove the follawing using mathernatial Toduckion 2
1+243ttn= n(n+1)2
Ans:Step I:Bose Step
Let us assume thot
Po)=142+3+.. tn= n Cot)/2

LHS=1
RHS=1+1 21
2 22

Step : Toducbve case


clasSute
Date
Page

Let n=k
1+2+ 3ttk= ka) be ue
2

Let n=kti
LHS=142+3t.ktkt)

LHS= (k +) (k42)
2

RHS= k (k+)
2

RHS = k+) Ck+2)


2.

LHS RHS
ie 142+3t.tn =nntt)

sFnd the gecuasiye definiton af:


afactorial function
AFboracci function
AosFactorial fuocbon:
Base Step: tor h=0
flo)=1
Recusswe step: fCn)=n*o-)
for any L
classmate
Date

Page

þEibonacci hunction:
Bose Step: ox n=O ,n=l
fo) =o,f)=1
Recus sive Step : fo) =£n-)flo-2)

So6 Find be ecuasive definilion of set 13,6, 1o, 1S,21,aj


Ans- Base Step: Assume ti= 1
Recus sie Step: fux ony n
tn=tn -1+n. 2-2-l+2
Q.z IE s=io1. Then fnd the tollowing 3
sbings khat langages.
a The 2 1
language of slaing of leagth ZeO.

AnsiL=e
The language of stongs of Os and is with equal nnumber of
leach.
Ans:=o1 i0, 0011, 11o0, oo0111

)The
Ans={01, oo11, 000111

) The language fo'oosi<ji


Ans-L=lae O0,DOo, 0OO0,y

)The 1'slanguge sbig with odd number of o's and evennunbe

A n s - e0,011,1o1, 110, o0011,iao01,u

Sbings that either slosks with o1 or encs with o.


Ans:REAéncosd+[cott)"(o]
classMite
Date
Page

Sbings that kae alleast two conseubire 0'4 ond i's


Cot)' Coot) (ot)
Sbings staling with 1and cnds with o

D Sbings of length exactly. 2

lStings that stork oith dkrtat symbol over ~- obj


Ars- RE=fattat)t

Astings tet stot with Some

Latb
Q aa ab abb
classmate
Date
Page

Tutoial No.2
9.1Give the omo fosmal definilion of DEA. Define Extended
toansition fmction (s)
Ans:-DEA:
A Detesministic Finile Automaton (DE) is dehinel by aguintyale
6-tupe) as (sESgo, Awhexe,
S=fnite set of states,
E-finite set of input Symbol
6=A tansihion tunction that maps
go=A stast state ; goé QXE9
F=set of inal state;FE Q

Extended Tronsition Function:


The extended toansiion function of DEA cdenoted by d* is a
kronsibion function that takes kwo aaquments iaput
.The frst aqument s a stete and the Secondd axgument is
a
sbing
con be detned as the state in wbich the FA e s ue, f
Tt begins in stale 9 and
and eceives sboing x of inpul Symbos.
) For ony e 9 , = e
for ony qeQ and atE,

Q.2In each paat below, coaw an A


acptig the indcated langug
over a,by
The languge of all staiags that begin or end wi
aobh, aaba, babb aab,..en uith bb
classHate
Date

Page

The langusge acepla the slaing erd wilh abb


abh, aabb, babb, ababb,...3

Te longege of al stngs in wbich both the numbeY of a' and


Ehe numher of b's are even
AsLl,aa, bb,aabh, abab, bhaa, abba

a The langusge of all sings coataining both aba and bab ai


substins Ocontuiina aba
Aas=sbe hab ababah, aaababab, aabababh ( coniaa bob

RE=fa.hj" lh,aaj la,b


Ansfb,aa, ab, bh haa,aaa,
classmAte
Date
Page

)RE= fbbb. baa faj


AnL-ia. bhbsbaaa,s

RE=}a,bj"{baaas
AncL=baa abaaa bbaaa, abbaaa

$3_IdentihE te language generaked hyby fllawing FA Qnd aske


Kegulr Expession
Ans

Qh Constuct DEA fox he Jangugge that


in O oYex E o,1. ite RE and accepk the sbings ending
alsO coaw he taensitio
t
able Calulele S*lga, lo4o) f sting io.
to1o and chec that tA
ic
acepled Dejeckd by DEA.
Ans:
Lio,lo, lo.oola,.3
cAsSMate
Date
Page

Tzansibontable:

T check lhe shing iss acepled ox zejecked

&6(8(qe,a))a)

-gtAlaceptame Skale)
4 is end stale so il s

QConsde the DEA-M=(ixY.zi io.1iz.).bere s


Qnd txcnsha
table
Also
a calaulete J*loo)
calculate ga,olol)
X

X
X 2
ASSMAte
Date.
Page

Taonsition Digi

Trursbon Table:
Stales
X X

N
X
N2

=s(s*(Ma),o)

The gien input is not accepted

bJa*Cgo,olal)
cdassMate
Date
Page

Te gien inpul is accepled


Date
Page

Tutoziol No.3

Q.1Give foml defisbon ofi


.NEA is a mathenhcal ohi
Determinstic Finite Automaton(NFA)
Ans:*A_Non- baan sibion
asel of stales, a sel of hput symbas, e
Lcosising of
nctton, an inital stote ond a set of accephing states.
Unlike, a Detesminstic Finite Automoton (OFA,on NAA allouws
muliple tansitions fom a state on the same inpuk Symbol and
Lacepts a stbing i theze exists ot least one Computotion pat
leading to an acepling stade.
* ExGmpe
Coosider an
huncbon S defined as follouas:

.The inibal state is go, ond the selt of acep hng states is o4
This NEA accepts stings hat end with "1 since these is a
Eronsition fron gn gu to qi on input "y"
bNEA-A taansi tion
Ans:-+ A NÍn-Detesministe Finile
is an exkension of a
Automtonwith epslon tansiions NFA
agulax NEA, allauing toansitions on the emaly
sbaing
A
lepsilay).
NEA -A consists O a set of states, a set of
input symbos,a
ransition tunctice, an initial State, Q set of acepting states, ond na
epsilos toansbons.
cassmate
Date

Page

oNFA-4:

oSet otstates : Q

Tunsitn hnc tion:d:QxeuiE3) >


a Trunsiton Cpower set of a)
OToital staleiga CQ
states: FeQ

Exarmde:
.Consder an NEA-A wth stutes lga,q-g1, input sypabols foif,aod
20silon txnstians denated hy 4, The bansibon funcbon d s dehned
las tollaws
fCqo.)=igaj

In this eKomple, bhe epsilon transihion tom q o ge allous tre


NEA to

Extended tsansihon tynction


Ansl The extended bansitios honchion tY a Non- Dekenajnisbe Finike
Automaton CNEA) is a unction thst takes a statean inputsting.
land ehsns the set of possible states thot the NPA cos be
io aftey thot Saput string
Tt is deooked by S* and s dehined xecuzsiely as6lowsi
Base case :st, = where Eis te emey soing

siogje input syabel, andx kasbing


o Sirapley teams, * capbres al possible stakes hat the NFA
lCan be ater
clas Mute
Date
Page

follouwbng lransibon tables tor NFA, To each


y2Considex the
toble and conext to DEA.
using

S
is$ s

NEA
DEA ansiion table:

pgs

*pos ps 2s
Pgs ps.

po

DFA
+123123
13
13 123 13 f33
13 12 12 2
12
42311 >1
1
b
tebleboaa_hon DEA tble tensiton >NFA
NFA
leg same accepting
lhe FA an
daw tomethod
souctio subset using NFA Qs
below gien iguze each InQal
DFA
1
bletaansihon
: DEA
NEA
Page
Date
classmate
obe
classMate
Date
Paga

Cakulale cach of follouing:


oAbb)
-i1j
udd(a.),)=d()=iL24
s)dç(,b). b) d(lu23,b) -6CLub) u d(2,b)
-1,23

Obab)

=f34,6,23

=1,3.43

lÛ4d-d6*as).-bli,a)- 4s,zj

=is, 73

=L,2Buí9i
classMute
Date
Page

O&(10abbab)

Laabb) =ós*(i, ca),.A)1,8.) =6(L4) Ua,)


=fL,2,9
*(4,aabba)= 6(s(A, aab) o) =ó/i1,2.93,o) =6Lo UJea) uJa.a
-4,6,23usuo
={3,46,23

6,aba)
S*(1,9)= S(o*(1,¬);,a)- d(i,a)= {4,6,73
d4,4b)-6((1,),4) =6(4.6,73.4) =l4) Ud6,b) USb)
6(2,aba) =8,33
z66*(1,sb).a)2s(i8.9t.a)=d(&,9) 0d(9,9)
classmate
Date
Pnge

o.5Given is a toansition diagam of on NFA -A

Foy each ool Be


he slang below sgy whether ba sFA .A aapl: it:

e NEA -A acse the gitn saing.


A
input, hene te e

Now, without consunming any irput, ue cao more to stote gG with


A state e hare to use the
he "b"
b symbol, As a zesult, ue
can eithe stay in the sgme stete ox
f we so stoy in te sane State hen we can more to sta te

"Z we more to state D a we Demain in he


same szte, then usiag n more to the Angl stte

abah
The NFA-A cbes not accept the gien stoing

G"as Gn input bence we


go to stte e)
Nou wibaout consuing Gny input we can move to stse wts
AA state , we bave to Use "5" yatol, As
either stay in the Same stale or More to
to stae ..
I! We stay in he sanne stle then we uill taka
Înput et and ore tb sale but afes Bot we haye to use
cAsSmAte
Date
Page

because it is in the gien sting, Hena, be w!


back to stt 2.ie stong ú not aCCeptel, as we dont eaco

I# we more to stete ) using "b" hen he have to use'


next,which lwih keep win he same state
- Then, lue Can { reach to the end state,becUSe be hre
tke 'b iot nextwhich will take us back to stote 2 dic
is not aceptd

.aacbbb
The NEA-A acepts the gien sbig

Zaitialy, stabig fon state Dwe qive o input ard moe to


At state 2we take a" tnput ond pertem a self-loop to sty
in stote then take "A to moye to State
" At stete ,ue take "a" ingut
iogut cned
and move to state
At state we take "b" input to go back to
At state we take " to move to stute .
AE state )we tako b" input ond pestom a
in stute ten we take another "bto move to stute

Finally at state G, we take "A" to more to te bnal staties


o6A tansiion table Psgven for NEA-A with7 states.
1
23
2
clAssMAte
Date
Page

Q. Find
oA23)isi
A ):
A(13,&)
.a)
Kabab a)

=f23

=S13

S4Gbaba)-fa,obob)a
=ACA,aba)b)a
-dCCCL,ab)a) b) a
=d(CCL.ab)a)b)a
-dlELaa)a)b)

=
classMate
Date
Page

Consder the tolouing NEA -A is gien as.

Dsaw an FA
acep hing t seme
closue (A,o)-Aa {B,c,DEA)
language
E-closwe (A,)= ED

E-clos (B.)= {ES


Eclosue (c)=oi

E-closuse (D)-n
E-closue (Eo-l3
E-closu (ED-igs
clAssMate
Date
Page

whee

*fs,o) = iga3

Consbuct toansiton diagam of NEA 4 find ih egalent


DEA, Show g intenedta k Seps

NEA-diaga
Õ,

NEA - banatm able

DCOansitin te DEA -dagogm

You might also like