Theory of computation
Theory of computation
OF
COMPUTATION
Subject: Topic:
Module 1
Date:
to
Previous Topic:
introduction
Prove that for any no I
722 37 Transition
trienants diagram
for b
Éo
n 1
go 1 q Transition
É ya o q table
Replace n with K 9 Go 0
y 1222 33 tk kcktDE.at
n Kt1
1 27 3 t a Akt I Font Intimate Imel
if enter user
us a
Ktm at
gate
transition
fitted diagram
wrong
password
N th
Three branches of Theory of computation
ComputabilityTheory
sexy iii
Complexity Theory
iii
245
EXILED Inductive Proof
Theproof by Induction Can bedone in 3 Steps 1 2 3 th
a
Ite
ÉÉÉÉÉhégv'atio
2 Inductive Hypothesis assign valueof n
Replace in with k
2K3t9kgti3 1 2 3 4 K
KCz C
3 Inductive step
for n l
KEI Ktr
1 G
32 3 1
for n k
Witt
RHS i n Kti
I tt 2 41
3 NID
k
II ty
at 7 t Gk2 34 1 z
new
Kt
2
3kt 2
13
3 KIK ok 6 4 342 2 t't
2 2 Lng RHS
3K 2 3K't5kt 2
52K
LHS Rus
1 2 2 3 34 man
ummmm
Subject:
Date:
Topic:
Basic Terminologies
Previous Topic:
II
E O I
01010011
length of the string Iwl
YE
Reverse of the string WR
Power of an alphabet
E a b
Io d
I a b
I a b ab aa ba ab bb
I E E aabaabbb a b
aag aba baa bba abbaabbab bbb
no of elements NE
n number of symbols in a alphabet
N power of alphabet
Kleeneclosure
III V E V E WE
I
Positive Closure
It It E excluding the empty string E
4 Language
a set of strings over an alphabet i e subset of E
I a b
EI Ubb
Operations on Languages
4 Union
4 ab be Cd
sinners
L Lz
L U Lz ab beCd 12 23,34
6 Intersection
ab be ed
ed ef gh is
a
L A Lz ed
L R Lz 242 in Lzand Li
B Concatenation
Li ab
L 1,23
4 Lz ab 12
Subject:
Date:
Topic:
Previous
Module 2
to Topic:
finite state Automata
Design a bra which
accepts finite state automata
only 101 over the input
set 2 90,19
Automatafate
a Dfa where
DFA CDeterministic finite
9 finiteseries q az as IM 9 E S S f
E Inputsymbols 0,1
S axe
Startingstate go
Final state as I input symbols i five
D 9,01
diagram Az as
D S quo 1 As
3 92,1 Correct Input 411
q
the answer
58
tence
is accepted 5Cao 111 do 1 ill
Design a DFA for b ai 11
4G a'In u D Caz l
go a q a
92
a
93 Az final state
Hence Input is accepted
q 0
n
0
I
o
Design a bra that starts
w
y
a
l
go
v
E 0 I o 000111
g
8 E 79
y
101010
EI EI v 00401
of zeroes
a fig a
1
go t
ÉÉq
Design a DFA for the
following language DFA that accepts binary strings divisible
3
L w lwlmodsojweqa.by
by
L W lwlmodstgwefa.bg
w abwww.wzthb
0
a
go by q aby q 2
a b O
1011010 3 90
a a
0 I
r aya a alo all b bCao D 011010
ath a o ya
o
sa
O 1 into
go do 9
A Az Az q L
Az An 90
93 An Az
94 A 94
Non deterministic finite Automata NFA
90 head tail
a a b e
a ar q
E O
E
a b c
90 go q
0 0
As of air
a 0
0 anas
as a d d
S go abb cc 5 b go a bbc
D Go aig bbc c 3 go b ubfqibl.be
S 0u 9,92 bcc b b q b us qub c
b ai ai ud cc b bCq c us and c
S 00 arias c
secanduscasid
3692,9s v9 quest
NFA for E ab where
Iwl mod 3 0 HE
a as
b
a 9 q
b
abGao 9 egg
c
a
sq go
b abc
go
b bCqo a be bla
convert thegiven NFA to
Conversion of NFA to DFA
DFA
go
a
a by q q a D
Ga Ob Gb
aa bag Step Define NEA na
M Q E S S F
A
A 9 7B
a 7 C Q finite States go q
E Input Symbol 0,1
I v93 20
D
S Gx I
E Db
La S go F EE
Ob Step LetofmDFAbe the DFA with S the transition
S go o b go o go 9 I
5 go D Eq
S goD 2
lets find the state for i with E 0,1
S go q o 5 quo v5 quo 90,9
lets find States for 2 with E 91
b'Cq o 03 0
b qua 9
lets rename
Step 3 transition table
I0 step 4 transition diagram
Go 90,9 9
0
Goa goq a A B Do
g p 9 I
c
go a 2
I
A B C
90,9 B
c
Be
9
Convert NFA E to DFA
I e
F Esa
b
go
g Iq s au
92 I
ept Definenea e machine'm
Step1 Define NFA E machine M
9 Q E S SF
M QESSF
go91,92193
S E9b Q go q az qs q
go 5 E Q1
9
epa Find 5 Deaformachine'm S go
closure
Cqo Goai CA
ply E in AL p q
SCA a Eclosure scan Step 2 Find 5 DFA for machine na
EclosureCSCqo q E closure q
a go a 9 CA
closureCb
go a v59.19
closure
dug Apply I in AC
closure q
az B 5 A 0 E closure S Aco
A b Eclosure scabs E closure bCao a saz o
Eclosure E closure 590,0 u Sca O 0569210
closure
qua ap b E closure 0 09300
qub ub91 b E closure 93 93 B
Ub q b
closure
gov 0090 yay closure b 90,9192 l
E closure 8690,1 US ant UCE D
closure Cao goq ggA E closure 000093
find 5 for B with E E Closure q 93 I
Ba closureHq a uglya Find 5 for B with E G I
E closure
E closure q uq 5 B o E closure 569310
q aq B
Bb EclosureSCabv59b
E closure O 0
Eclosure
Colugo B D E closure 869311
EclosureCad E closure qa q
qua az A
Step transitiontable
ping g for C with 2 01
E O 1 A
29
A B B
É
G A B
I
Minimization of DFA
i stept Define the
IM 9,5 5 Sf
bra
9
g q q g finite state 90,9 19
b b E input symbols I
1 b
vb
E Transition QX E
Az 95 96
S starting state a
F Final state as
a 9 a
97
Step2 transition table
a b
92 9 93
94 95
Step findequivalence
Oeg 91,92 93,99197 9951963
leg 1 2,5 6 9 93 4,73
1,2 transitionggramy
73
b
7
G b I
pg
a b
f g
Subject:
Date:
Topic:
Module 3
Previous Topic:
q 95
q Ga b q q
at
a it
a
Coot
o 1 t I o otto lotI
yO oÉ
I to
ooÉ
toooo o o to
Converting finite Automata to regular expressions
a
it is Y as
i Bz
E
B O BO R l
I I I A
2O R E R RO
A
G
yay
R at 9
aby Da 1 d
1Rz b
I b 32 A
c E
E 313
R 5 I
R A ab
R b b
2 I
R at a tab
22
When K l c I j I
C.se
b t b b Cb
b tb b b
b b abt
Arden's theorem
If Re G t RP
then Reg p
In
o
É n
o
o
sa
1
9 goo q it 9,00
9 Goo q 1 00
E IE
9 go i too
Go Et got 9,01 30
go Et got g 061 00 E
Go E t go I to citoot01
E I I
go E It 1 00 0 1
Go I to 1 00 01 E RT rt
Pumping lemma for regular languages
It is used to prove that a language is not regular
and cannot be used vice versa
If L is Regularlanguage then L has a pumping leng
a
such that any string's where 15120 may be divide
into 3 parts S xyz such that
i Xyz EA for every v20
Eat p Il
Prove that the given language is not regular
e L ab M
Lei L a Ip is prime
A O B
oa
00101 Rightmost derivation
s AIB
s A IOB i R
S A IOI B E R
S A IOI E R
S OAIOI Ci Ra
S 004101 C Ra
S 002101 C Ra
S 00101
1001 LMD
s Al B
s
I
e
1B
10 B
IIe
r
r
I
s y 100 B R
S 1001 B R
E Rs
I 9
1001 RMP E
S
S AIB
S A IOB
S A 100 B A B
S A 1001 B
S 7 A tool E E o B
S T A 1001
S T
S 7
E 1001
100 1
0 IB
I
i B
000 11 I
E
O AI B B
S
e
s
th
I
000 I B
0001 I E
00011
I
S
I
using given grammar generate string
E I Et E E E CES
l al bl la is to 1
Ctb
Step i Define Grammar
G N T SIP
N non Terminal
JITE.figa'state s
Cats
EEE
iii
E LMD Cat E Rz
at 1 14
2 a 10 b ta I a at boo
F E ER
É HE e
E
CE
E
Eye
la th
ÉÉ can
E E a tb BE a at E Ra
1 to atb
y
Ambiguous Grammar
A context free grammar is said to be ambiguous if
there exists two or more emo or Rmb or parse tree for
Same W E L ca
x atx x you a
at a a
i Since there is onlyone
x LMD Ktx LMD it is not
x LMD I x ambiguous
LMD A t x
x a t X K
x LMD a t I I
x LMD a t at a
Converting language to grammar
L anb t na
as b E
g
L weWR W a bJ
g as a bsb e
L a b t ha
x aasb
L a b 3 H n 3
g asb aaa
2 9a b H nd I
g as sb
L an b emam him 71
asb es d
g
Simplification of grammar
FB ab
s a Aa s bB b
s a a a s b bb
S al b xy s bxy
A B da bs X a s
BT ASB baby
x SBD a By ad
x SB a XY b
S 7 artsy XA
S XA
x bs za s b 529A
y asy2 by 2 s bazza A
2 ay ad s baadza A
A ab at s y bandada A
s baadadaab
Simplification of CFG
Elimination of E
s 7 xyz
Ox E
y ly E
Sub XT E
s xyz ya say y
x ox o
YT IT E
Sub
yee
5 7 xxx xx xx Y XXX X
x OX 0
Y T 14 1
finally
57 xxx xx xy y xx x
x ox 0
y 714 1
Chomsky's Normal Form CNF
N Non Terminal
NT NN T Terminal
N T
42
5
I 8
S
PTE Productions
Steph remove useless parts
a
384 s
s 25 Sy non terminal
Step3 remove E
X 7 041 140 2 01 10
Y OY 14 014
Y 010
Z
Stepy remove unit production
10
4384147 9101
Step 5 CMF conversion
Ei Ci Cz
EF BEEF
X DG Dac EC CiCz GCI
Y C Y GY C Cz
Greibach Normal Form Gnr
a Terminal
A ax Non terminal
HI Sa
I Iodictigntings state
step2 make a new non terminal for every terminal symbol
S ASB A a
S AB B b
Steps rename the non terminals
5 A A AzA A
A Az A AzA
B A
step4 use Ai AjY j i
A AA Az
A aAz
Closure properties of CFL
1 A CFL is closed under
union
Li Ula is CFL
b Concatenation If L andLa are CFL
e Kleene closure If 4
I ft Cfl
d reversal if L is CFL LR c's CFL
2 A CFL is not closed under
a Intersection
b Complementation
input symbol of FA
input symbol of stack
I mark
Zo Starting state of stack
3 Transition
F final state
Step
drawing 45marks
a b
plush pop
819 b a que
b qz b a
gu Er
S 92 E Zo 93
Stef validate an input aaabbb
5 go Aaabbb Zo Cq aabbb azo
b q aabbb azo q abbb aa2o
b q abbb aazo t Cq bbb aaazo
b q bbb aaazo q2 Ebb Eaazo Imark
b ga bb aazo 92 Eb E azo
5Cqz b azo 92 E Ezo
b q z E Zo 93,20
an ban
stack
empty
ait
2
9120
g É za
b E
I I
push
yen pop
o É
dime
g É
final
aa aaa
i e to
go 92 7 q base q g
anbm and
stack
Mptp
2
9120
gg
ait an
z É
P
É E egg
final
an aa bib bb ab c da E
areas ba ba cb e d.ae
q q q q q
push pop Enzo
95
final
L Wcw t w ab
W aaa b
Wr b aaa
input symbol of FA
of stack
S starting state
Zo Starting state of stack
3 Transition
F final state
Steph transition diagram
bath ab ab b
É
Arto
go go away of
2 a
É
d
ab ab É É
1153 bibs adabbaaa
q
9 74
q
5938
III so
q
anbn
La anbmc
a
aa a
mphcase E
920,2 ba a
q 299
Ezo a
aaa Ccc
9
q
91207
ÉÉ beat b q base
94 E
Subject: Topic:
Module 6
Date:
to
Previous Topic:
Turing Machine
Construct a turing machine which accepts
L a'b'c nai
3 9 91392,93 99,95
X Y Z Abc 4
GF Lao
Bf Tas 99 Ybbzce
Steph 392 b bit
ax r a Ma 313,2 Egg
go
xox R
YAY R
Jag w wa 95
YR
242 R
steps transition state
5690,9 q x r 569,4 q x R
5 q a q a r 5690,4 q y r
569 y q y r 5694,4 q y R
569 b q y R 5694,2 9,2 R
SC b 92 b r b qiu q W L
5692,2 92,2 R
b q C q zz L
519,2
b q b
q z L
q b itL
b q y q y
Scapa q aah
step Y validation aabbec
go.aabbcctxqiabbcctxaqibbc xayqubcctxaybqz.cc
t Xavbq Ze
Xa y 93 b Ze t Xagybze
t X 93 ay bzctxgo.at bZctXX9
Yb2 tXXY9
bZctXXYY9zZc tXXYY
292C t XX 4422937
Subject: Module 7
Topic:
Date: Previous Topic:
Recursive decidable
The language accepted by Turing machine
for which it always halt
Recursively Enumerable 7 partially decidable
Thelanguage accepted byTuring machine
may or maynot halt
Undecidable
list A list B
D ba d
2 bba abb
3 bb a ab
I ba aka d
4 Aaabbababa
manors
999 3 a label
bb a aaa bba
ab adab
list A list B
10 101 Yo
017
go di 181811
ListA list B
27 TAB
I
2 A AB
3 CA P AABBCA
a a I
3 ABCA
ABCA A
27 ABCA A
ABCA A AB
4 ABCAA ABC
ABC AAA BC