0% found this document useful (0 votes)
20 views45 pages

Theory of computation

The document discusses various concepts in the Theory of Computation, including finite state automata, regular expressions, and the conversion between non-deterministic and deterministic finite automata. It covers topics such as transition diagrams, inductive proofs, and operations on languages, providing examples and definitions for clarity. Additionally, it introduces Arden's theorem for constructing regular expressions and outlines the steps for converting finite automata to regular expressions.

Uploaded by

Ashira Mir
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)
20 views45 pages

Theory of computation

The document discusses various concepts in the Theory of Computation, including finite state automata, regular expressions, and the conversion between non-deterministic and deterministic finite automata. It covers topics such as transition diagrams, inductive proofs, and operations on languages, providing examples and definitions for clarity. Additionally, it introduces Arden's theorem for constructing regular expressions and outlines the steps for converting finite automata to regular expressions.

Uploaded by

Ashira Mir
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/ 45

THEORY

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 all values ofEhh


substitute n Ktl
n Lts 1 2 3 K Kt l

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:

Let x are 4 Symbols a 1st 1


y strings infinite
ab c and 123
find 121 Alphabet E finite
yr E
x ab c
a b c 23
y 123 E L 0 1,2
finite
YR 3 21

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

Iansition table S Starting state a


QE 0 1 F Final State as
0 a
as 0
1 g Tao ai Taz I
N 101
590,101 SCSCquy01
Transition I do a

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

ge a µ 5 Cao 11 56560 DID


go 9 E a Da 3 aril
q Az
92 9s accepted as it doesn't reach
Az notfinal
93 Aa state
an Aq
Design a Dea of all strings
nding with o acceptseven
q
1
I It 0
q
l's ando's

q 0
n
0
I
o
Design a bra that starts
w
y
a
l
go
v

is accepts add i'sando's

E 0 I o 000111
g
8 E 79
y
101010

EI EI v 00401

with 1 and ending with ÉÉ no

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

as al 912 a o b 941,0 11010


I b 90 1 1010
É at of any ace ace
b becc D 010
hence 1011010 b b 92,0 10
is accepted S Scar D o
56903,0 ad
DFA that accepts binary strings divisible
5
by
I

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

input transit to multiple


States Clor more INF
input transit to one state IDFA

NFA for the language L anbmc min pl I

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

NFA for E a bic ends with ab becca

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

at a b 56,0 E closure 5cg o


E closure O 0
A B A
56 D E closure scan D
E closure of
B B A o
tepy transitiondiagram Obtained DFA

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

Leg 1,23 5,63 93,73 49


3eq 1,23 5,03 3949 73
Steph

1,2 transitionggramy
73
b

7
G b I
pg
a b
f g
Subject:
Date:
Topic:
Module 3
Previous Topic:

Language accepted by finiti automata can be


easily described by simple expressions Called regular
expression
Ab
A b
go sq s q
Atb d
91 a 93 E

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

Construct a regular expression for the following


using arden's theorem

In
o
É n
o

o
sa
1

Step 1 form all incoming equations


go E g I get
9 900 9 I 30920
92 9,0
Step2 apply arden'stheorem

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

é Let L be a language and W EL


we xyz
i wi I n
Ixyl E n
w
xyz anb
ay an z b y am
say Z E L H n KI
se
y z xyy z an am b an.amm b
for x b ml D anbn
y antmcz
a regular
for x z D.br antm b irregular
for x 3 antma b ant m bn irregular
ee let L be regular
let w a then Iwl p n
W Xyz 1 411 n and 14171
Y am is men let i ptt p i 1
now I y 21 1 421 ly 11 1 421HY it

Pt m i 1 e p tmp mtl p is not prim


i
xy z E L
L is not regular
Design a DFA for a library shelf where 1st book
should be maths 2ndbook can be either physics
or chemistry and third book should be computer

Step Define the DFA


M E S FS
E m p Chico
8 Q XE
S Go
f 9
Step transition diagram
M DCh A co
go G q
Bch M
co th
mp ch co
na
trapState
Step transition table
M P onco
9 9 9 9,9
9,9 a a 9
9,9 9,9 as
9 A G 9,9
Subject:
Date:
Topic:
Module 4
Previous Topic:

Context free Grammar


let G be a grammar
G NTS P
N Non terminal
T Terminal
S Starting state
P production

using the given grammar generate string


00101 1001 00011
S 7 ALB
AT OA E
B OB IB E
Step i Define Grammar
G N T SIP

N non Terminal SAB


T Terminal OI E
S starting state Ls
00101 Left most deviation
s A 1B
S O AIB Li Ra
S Oo AIB C Re
S T OO EIB C Ra
S OOI B E R E D
S 0010 B L R
S 0010 B C R
S 00101 E CR
S 00101 C R E R
s
Parse tree
A 1 B

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

find if the given grammar is ambiguous

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

remove remove remove unit


production
YE
remove useless from given grammar
T Y AaB ab A aat
A AA
B ab b
c ad
p T AaB aat
B abl b
s T
S AB a
I s aa B
aa ab
A b
B D s
S a Aa b Bb
A 4 a
B T C b

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

Convert the given CFG to CNF


X OY 1 140 12
Y OY 14 E
35889sy
Step1 Define the grammar
Let G EN T P S

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

Convert the following Cfa to 9nF


s as b
s ab

step 1 define grammar


Let G E N T P S

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

37 If L is CFL a R e's regular then


L N R is CFL
Subject:
Date:
Topic:
Module 5
Previous Topic:

Push do.wn Automata PDA

Construct a PDA for a b 27,0

Step Define the PDA


let na be PDA where 7 tuples
a
M G E T S Zo S F

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

Ste Transition function


b go a Zo qua za
8 q a a q aa 3 marks

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

step define PDA


Step transition diagram
Steps transition function
Steph Validate with a string
Kept Conclude

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

Step Define Pba


let na be a PDA where 7 tuples
M G E T S Zo S F

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

Step 1 define the turing machine


M 99 2,1 8 go B F

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

No turing machinefor this

Properties of recursive andrecursivelyenumerable


of two recursive is recursive
i Union of
2 Union two recursively enumerable is recursively
enumerable
3 Complement of recursive e's recursive
UY if L and L are recursively enumerable
L c's recursive
Post Correspondence problems

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

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy