Introduction To Toc
Introduction To Toc
Introduction To Toc
Computation
C)'
memory
#xamp(e1
temporary memory
f ( x) = x
xx x x
2
5
f ( x) = x
temporary memory
input memory
x=2
C)' )rogram memory compute compute output memory
xx x x
2
6
temporary memory
z = 2*2 = 4 f ( x) = z * 2 = 8
f ( x) = x
input memory
x=2
C)' )rogram memory compute compute output memory
xx x x
2
7
temporary memory
z = 2*2 = 4 f ( x) = z * 2 = 8
f ( x) = x
input memory
x=2
C)' )rogram memory compute compute
f ( x) = 8
output memory
xx x x
2
Automaton
temporary memory Automaton C)' output memory )rogram memory
9
input memory
10
3inite Automaton
temporary memory
3inite Automaton
)ushdo&n Automaton
Stack )ush" )op
)ushdo&n Automaton
Turing !achine
Random Access !emory
Turing !achine
A(gorithms
)o&er of Automata
3inite Automata
)ushdo&n Automata
Turing !achine
14
15
!athematica( )re(iminaries
16
!athematica( )re(iminaries
7ets 3unctions Re(ations )roof Techni9ues
17
7#T7
A set is a co((ection of e(ements
1 A ship B
18
7et Representations
C : ; a" b" c" d" e" f" g" h" i" <" k = C : ; a" b" >" k = 7 : ; *" ." ?" > =
7 : ; < 1 < @ A" and < : *k for some k@A = 7 : ; < 1 < is nonnegati8e and e8en =
19
'
? C %A 'ni8ersa( 7et1 % .
A
* B E D
7et Operations
A : ; %" *" - = 'nion A ' B : ; %" *" -" ." B = Intersection A 2ifference A0B:;%= B 0 A : ; ." B =
A0B
21
'
B : ; *" - =
Comp(ement 'ni8ersa( set : ;%" >" C= A : ; %" *" - = . A : ; ." B" ?" C=
A
% B
A
*
A:A
22
* -
e8en
? C
23
2e!organFs La&s
' A'B:A ' A B
B:A'B
24
70
25
7ubset
A : ; %" *" -= A B B : ; %" *" -" ." B =
' '
)roper 7ubset1 A
B B
A
26
2is<oint 7ets
A : ; %" *" - = ' A B: B : ; B" ?=
27
7et Cardina(ity
3or finite sets A : ; *" B" C = HAH : -
28
)o&ersets
A po&erset is a set of sets 7 : ; a" b" c = )o&erset of 7 : the set of a(( the subsets of 7 *7 : ; " ;a=" ;b=" ;c=" ;a" b=" ;a" c=" ;b" c=" ;a" b" c= = 5 D : *- 6
29
Obser8ation1 H *7 H : *H7H
Cartesian )roduct
A : ; *" . = B : ; *" -" B =
A I B : ; 5*" *6" 5*" -6" 5*" B6" 5 ." *6" 5." -6" 5." .6 = HA I BH : HAH HBH ,enera(iJes to more than t&o sets AIBI>IK
30
3'GCTIOG7
domain A % * f 1 A 0@ B f5%6 : a b range B a c
If A : domain
R#LATIOG7
R : ;5x%" y%6" 5x*" y*6" 5x-" y-6" >= xi R yi e g if R : L@F1 * @ %" - @ *" - @ %
#9ui8a(ence Re(ations
Ref(exi8e1 7ymmetric1 Transiti8e1 #xamp(e1 R : L:L x:x x:y x : y and y : J y:x x:J
33
#9ui8a(ence C(asses
3or e9ui8a(ence re(ation R e9ui8a(ence c(ass of x : ;y 1 x R y= #xamp(e1 R : ; 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 - : ;-" .=
34
)ROO3 T#C$GIN'#7
)roof by induction )roof by contradiction
35
Induction
/e ha8e statements )%" )*" )-" > If &e kno& for some k that )%" )*" >" )k are true for any n @: k that )%" )*" >" )n imp(y )nO% Then #8ery )i is true
36
)roof by Induction
Inducti8e basis 3ind )%" )*" >" )k &hich are true Inducti8e hypothesis LetFs assume )%" )*" >" )n are true" for any n @: k Inducti8e step 7ho& that )nO% is true
37
#xamp(e
Theorem1 A binary tree of height n has at most *n (ea8es )roof1 (et (5i6 be the number of (ea8es at (e8e( i (5A6 : %
(5-6 : D
38
Inducti8e hypothesis LetFs assume (5i6 P: *i for a(( i : A" %" >" n Induction step &e need to sho& that (5n O %6 P: *nO%
39
Induction 7tep
Le8e( n nO%
hypothesis1 (5n6 P: *n
40
Induction 7tep
Le8e( n nO%
hypothesis1 (5n6 P: *n
41
Remark
Recursion is another thing #xamp(e of recursi8e function1 f5n6 : f5n0%6 O f5n0*6 f5A6 : %" f5%6 : %
42
)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
43
#xamp(e
Theorem1 )roof1 Assume by contradiction that it is rationa(
is not rationa(
: nRm
: nRm
* m * : n*
Therefore" n* is e8en
* m* : .k*
m* : *k*
ontradiction!
45