Introduction to toc
-
Upload
truptikodinariya9810 -
Category
Documents
-
view
217 -
download
0
Transcript of Introduction to toc
-
8/12/2019 Introduction to toc
1/45
1
Theory of Computation
Subject code: 160704
-
8/12/2019 Introduction to toc
2/45
2
Text and Reference book
Text Book
Introduction To Languages And Theory Of Computation ByJohn C !artin" Third #dition" T!$
Reference Books
% Automata Theory" Languages and Computation" $opcroft"!ot&ani" '((man" )earson #ducation
* Theory of automata" Langusges and computation" +umar"
!c,ra$i((- The Theory of Computation" !oret" )earson #ducation
. Introduction to Computer Theory" Cohen" /i(ey0India
-
8/12/2019 Introduction to toc
3/45
3
Computation
C)' memory
-
8/12/2019 Introduction to toc
4/45
4
C)'
input memory
output memory
)rogram memory
temporary memory
-
8/12/2019 Introduction to toc
5/45
5
C)'
input memory
output memory
)rogram memory
temporary memory
3)( xxf =
compute xx
compute xx 2
#xamp(e1
-
8/12/2019 Introduction to toc
6/45
6
C)'
input memory
output memory
)rogram memory
temporary memory
3)( xxf =
compute xx
compute xx 2
2=x
-
8/12/2019 Introduction to toc
7/45
7
C)'
input memory
output memory
)rogram memory
temporary memory 3)( xxf =
compute xx
compute xx 2
2=x
42*2 ==z
82*)( ==zxf
-
8/12/2019 Introduction to toc
8/45
8
C)'
input memory
output memory)rogram memory
temporary memory 3)( xxf =
compute xx
compute xx 2
2=x
42*2 ==z
82*)( ==zxf
8)( =xf
-
8/12/2019 Introduction to toc
9/45
9
Automaton
C)'
input memory
output memory
)rogram memory
temporary memory
Automaton
-
8/12/2019 Introduction to toc
10/45
10
2ifferent +inds of Automata
Automata are distinguished by the temporary memory
Finite Automata1 no temporary memory
Pushdown Automata1 stack
Turing Machines1 random access memory
-
8/12/2019 Introduction to toc
11/45
11
input memory
output memory
temporary memory
3inite
Automaton
3inite Automaton
4ending !achines 5sma(( computing po&er6
-
8/12/2019 Introduction to toc
12/45
12
input memory
output memory
Stack
)ushdo&n
Automaton
)ushdo&n Automaton
)rogramming Languages 5medium computing po&er6
)ush" )op
-
8/12/2019 Introduction to toc
13/45
13
input memory
output memory
Random Access !emory
Turing
!achine
Turing !achine
A(gorithms 5highest computing po&er6
-
8/12/2019 Introduction to toc
14/45
14
3inite
Automata
)ushdo&n
Automata
Turing
!achine
)o&er of Automata
-
8/12/2019 Introduction to toc
15/45
15
/e &i(( sho& (ater in c(ass
$o& to bui(d compi(ers for programming (anguages
7ome computationa( prob(ems cannot be so(8ed
7ome prob(ems are hard to so(8e
-
8/12/2019 Introduction to toc
16/45
16
!athematica( )re(iminaries
-
8/12/2019 Introduction to toc
17/45
17
!athematica( )re(iminaries
7ets
3unctions
Re(ations
)roof Techni9ues
#
-
8/12/2019 Introduction to toc
18/45
18
}3,2,1{=A
A set is a co((ection of e(ements
7#T7
},,,{ airplanebicyclebustrainB =
/e &rite
A1
Bship
-
8/12/2019 Introduction to toc
19/45
19
7et Representations
C : ; a" b" c" d" e" f" g" h" i"
-
8/12/2019 Introduction to toc
20/45
20
A : ; %" *" -" ." =
'ni8ersa( 7et1 A(( possib(e e(ements
' : ; % " > " % =
% * -
.
A
'
?
D
E%
-
8/12/2019 Introduction to toc
21/45
21
7et Operations
A : ; %" *" - = B : ; *" -" ." =
'nion
A ' B : ; %" *" -" ." =
Intersection
A B : ; *" - =
2ifference
A 0 B : ; % =
B 0 A : ; ." =
'
A B
A0B
-
8/12/2019 Introduction to toc
22/45
22
Comp(ement
'ni8ersa( set : ;%" >" =
A : ; %" *" - = A : ; ." " ?" =
%*
-.
?
A A
A : A
-
8/12/2019 Introduction to toc
23/45
23
*
.
?
%
-
e8en
; e8en integers = : ; odd integers =
odd
Integers
-
8/12/2019 Introduction to toc
24/45
24
2e!organFs La&s
A ' B : A B'
A B : A ' B'
-
8/12/2019 Introduction to toc
25/45
25
#mpty" Gu(( 7et1
: ; =
7 ' : 7
7 :
7 0 : 7
0 7 :
': 'ni8ersa( 7et
-
8/12/2019 Introduction to toc
26/45
26
7ubset
A : ; %" *" -= B : ; %" *" -" ." =
A B'
)roper 7ubset1 A B'
A
B
-
8/12/2019 Introduction to toc
27/45
27
2is
-
8/12/2019 Introduction to toc
28/45
28
7et Cardina(ity
3or finite sets
A : ; *" " =
HAH : -
-
8/12/2019 Introduction to toc
29/45
29
)o&ersets
A po&erset is a set of sets
)o&erset of 7 : the set of a(( the subsets of 7
7 : ; a" b" c =
*7: ; " ;a=" ;b=" ;c=" ;a" b=" ;a" c=" ;b" c=" ;a" b" c= =
Obser8ation1H *7H : *H7H 5 D : *- 6
C t i ) d t
-
8/12/2019 Introduction to toc
30/45
30
Cartesian )roduct
A : ; *" . = B : ; *" -" =
A B : ; 5*" *6" 5*" -6" 5*" 6" 5 ." *6" 5." -6" 5." .6 =
HA BH : HAH HBH
,enera(ies to more than t&o sets
A B > K
-
8/12/2019 Introduction to toc
31/45
31
3'GCTIOG7domain
%*
-
a
bc
range
f 1 A 0@ B
A B
If A : domainthen f is a tota( function
other&ise f is a partia( function
f5%6 : a
-
8/12/2019 Introduction to toc
32/45
32
R#LATIOG7
R : ;5x%" y%6" 5x*" y*6" 5x-" y-6" >=
xiR yi
e g ifR : @F1 * @ %" - @ *" - @ %
In re(ations xican be repeated
-
8/12/2019 Introduction to toc
33/45
33
#9ui8a(ence Re(ations
Ref(exi8e1 x R x
7ymmetric1 x R y y R x
Transiti8e1 x R M and y R x R
#xamp(e1R : :
x : x
x : y y : x
x : y andy : x :
-
8/12/2019 Introduction to toc
34/45
34
#9ui8a(ence C(asses3or e9ui8a(ence re(ationR
e9ui8a(ence c(ass ofx : ;y 1 x R y=
#xamp(e1R : ; 5%" %6" 5*" *6" 5%" *6" 5*" %6"
5-" -6" 5." .6" 5-" .6" 5." -6 =
#9ui8a(ence c(ass of% : ;%" *=
#9ui8a(ence c(ass of- : ;-" .=
-
8/12/2019 Introduction to toc
35/45
35
)ROO3 T#C$GIN'#7
)roof by induction
)roof by contradiction
-
8/12/2019 Introduction to toc
36/45
36
Induction
/e ha8e statements)%" )*" )-" >
If &e kno&
for some k that )%" )*" >" )kare true for any n @: k that
)%" )*" >" )n imp(y )n%
Then
#8ery )i is true
-
8/12/2019 Introduction to toc
37/45
37
)roof by InductionInducti8e basis
3ind )%" )*" >" )k&hich are true
Inducti8e hypothesisLetFs assume )%" )*" >" )nare true"
for any n @: k
Inducti8e step
7ho& that )n%is true
-
8/12/2019 Introduction to toc
38/45
38
#xamp(e
Theorem1 A binary tree of height n
has at most *n (ea8es
)roof1
(et (5i6be the number of (ea8es at (e8e( i
(56 : %
(5-6 : D
-
8/12/2019 Introduction to toc
39/45
39
/e &ant to sho&1 (5i6 P: *i
Inducti8e basis
(56 : % 5the root node6
Inducti8e hypothesis
LetFs assume (5i6 P: *ifor a(( i : " %" >" n
Induction step
&e need to sho& that (5n %6 P: *n%
I d i
-
8/12/2019 Introduction to toc
40/45
40
Induction 7tep
hypothesis1(5n6 P: *nLe8e(
n
n%
I d i 7
-
8/12/2019 Introduction to toc
41/45
41
hypothesis1(5n6 P: *nLe8e(
n
n%
(5n%6 P: * Q (5n6 P: * Q *n : *n%
Induction 7tep
R k
-
8/12/2019 Introduction to toc
42/45
42
Remark
Recursion is another thing
#xamp(e of recursi8e function1
f5n6 : f5n0%6 f5n0*6
f56 : %" f5%6 : %
)roof by Contradiction
-
8/12/2019 Introduction to toc
43/45
43
)roof by Contradiction
/e &ant to pro8e that a statement ) is true
&e assume that ) is fa(se
then &e arri8e at an incorrect conc(usion
therefore" statement ) must be true
-
8/12/2019 Introduction to toc
44/45
44
#xamp(e
Theorem1 is not rationa(
)roof1
Assume by contradiction that it is rationa( : nm
n and m ha8e no common factors
/e &i(( sho& that this is impossib(e
2
2
nm * m* n*2
-
8/12/2019 Introduction to toc
45/45
: nm * m*: n*
Therefore" n* is e8enn is e8en
n : * k
* m*: .k* m*: *k*m is e8en
m : * p
Thus" m and n ha8e common factor *
2