automata theory ppt
TRANSCRIPT
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 1/46
1
CS205
Language Theory
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 2/46
2
Time Table
Day Time Class Room
Monday 12:00-12:55 L201Tuesday 10:00-10:55 CR101
Wednesday 11:00-11:55 CR101
Friday 11:00-11:55 CR101
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 3/46
3
Course Contents
• Introduction
•Finite Automata and regular languages
•Push down Automata and Contet !ree languages
•Push down Automata
•Turing "achines and Com#utability
•$ecidability% undecidability and reducibility
•Com#utational Com#leity & 'P(Com#leteness
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 4/46
4
)oo*s
Text Book: +o#cro!t% ,ohn -./ "otwani% a1ee & 3llman% ,e!!rey $.% Introduction to
Automata Theory% Languages% and Com#utation% Third -dition% Pearson -ducation Inc.%
'ew $elhi% 2004.
Reference Book: Si#ser% "ichael% Introduction to the Theory o! Com#utation% Second
-dition% Cengage Learning India Pt. Ltd.% 'ew $elhi% 2004
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 5/46
5
"ar*s $istribution Quiz 1: 10%
Mid Semester: 25%
Quiz 2: 10%
*End Semester: 50%
+!"ss #erform"nce: 5%
*End Semester co$ers &o!e s'!!"(us st"rtin) from
tod"' itse!f
+!"ss #erform"nce is e$"!u"ted ("sed on "ttend"nce
"nd "ssi)nments
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 6/46
6
Language Processing System
Source Program
"odi!ied source #rogram
Target assembly #rogram
elocatable machine code
Target machine code
re#rocessor
om#i!er
ssem(!er
,inker-,o"der
-#ands macros
library !iles
relocatable ob1ects
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 7/46
7
e will show later in class
• +ow to build com#ilers !or #rogramming languages
• Some com#utational #roblems cannot be soled
• Some #roblems are hard to sole
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 8/46
8
"athematical Preliminaries
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 9/46
9
"athematical Preliminaries
• Sets
• elations
• 6ra#hs
• Proo! Techni7ues
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 10/46
10
}321!= A
A set is a collection o! elements
S-TS
}! airplanebicyclebustrain B =
e write
A∈1
B ship∉
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 11/46
11
Set e#resentations
C 8 9 a% b% c% d% e% !% g% h% i% 1% * :C 8 9 a% b% ;% * :
S 8 9 2% <% =% ; :
S 8 9 1 > 1 ? 0% and 1 8 2* !or some *?0 :
S 8 9 1 > 1 is nonnegatie and een :
!inite set
in!inite set
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 12/46
12
A 8 9 @% 2% % <% 5 :
3niersal Set> All #ossible elements
3 8 9 @ % ; % @0 :
@ 2
< 5
A
3
=
4
B
@0
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 13/46
13
Set D#erations
A 8 9 @% 2% : ) 8 9 2% % <% 5:
• 3nion
A 3 ) 8 9 @% 2% % <% 5 :
• Intersection
A ) 8 9 2% :
• $i!!erence
A ( ) 8 9 @ :
) ( A 8 9 <% 5 :
3
A )
A()
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 14/46
14
• Com#lement
3niersal set 8 9@% ;% 4:
A 8 9 @% 2% : A 8 9 <% 5% =% 4:
@2
<
5
=
4
A A
A 8 A
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 15/46
15
02
<
=
@
5
4
een
9 een integers : 8 9 odd integers :
odd
Integers
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 16/46
16
$e"organEs Laws
A 3 ) 8 A ) 3
A ) 8 A 3 ) 3
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 17/46
17
-m#ty% 'ull Set>
8 9 :
S 3 8 S
S 8
S ( 8 S
( S 8
38 3niersal Set
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 18/46
18
Subset
A 8 9 @% 2% : ) 8 9 @% 2% % <% 5 :
A ) 3
Pro#er Subset> A ) 3
A
)
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 19/46
19
$is1oint Sets
A 8 9 @% 2% : ) 8 9 5% =:
A ) 8 3
A )
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 20/46
20
Set Cardinality
• For !inite sets
A 8 9 2% 5% 4 :
A 8
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 21/46
21
Powersets
A #owerset is a set o! sets
Powerset o! S 8 the set o! all the subsets o! S
S 8 9 a% b% c :
2S 8 9 % 9a:% 9b:% 9c:% 9a% b:% 9a% c:% 9b% c:% 9a% b% c: :
Dbseration> 2S 8 2S G B 8 2 H
C P d
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 22/46
22
Cartesian Product
A 8 9 2% < : ) 8 9 2% % 5 :
A ) 8 9 G2% 2H% G2% H% G2% 5H% G <% 2H% G<% H% G<% <H :
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 23/46
23
-LATID'S
8 9G@% y@H% G2% y2H% G% yH% ;:
i yi
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 24/46
24
-7uialence elations
• e!leie>
• Symmetric> y y
• Transitie> J and y K K
-am#le> 8 8
• 8
• 8 y y 8
• 8 y and y 8 K 8 K
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 25/46
25
6AP+SA directed gra#h
• 'odes GMerticesH
M 8 9 a% b% c% d% e :
• -dges
- 8 9 Ga% bH% Gb% cH% Gc% aH% Gb% dH% Gd% cH% Ge% dH :
e
a
b
c
dnode
e d g e
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 26/46
26
Labeled 6ra#h
a
b
c
d
e
@
5 =
2=
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 27/46
27
al*
a
b
c
d
e
al* is a se7uence o! ad1acent edges Ge% dH% Gd% cH% Gc% aH
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 28/46
28
Path
a
b
c
d
e
Path is a wal* where no edge is re#eated
Sim#le #ath> no node is re#eated
l
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 29/46
29
Cycle
a
b
c
d
e
@2
Cycle> a wal* !rom a node GbaseH to itsel!
Sim#le cycle> only the base node is re#eated
base
- l T
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 30/46
30
-uler Tour
a
b
c
d
e @
2
<5
=
4
B base
A cycle that contains each edge once
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 31/46
31
+amiltonian Cycle
a
b
cd
e@
2
<
5base
A sim#le cycle that contains all nodes
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 32/46
32
Finding All Sim#le Paths
a
b
cd
e!
St @
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 33/46
33
a
b
c
d
e
Gc% aH
Gc% eH
!
Ste# @
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 34/46
34
a
b
c
d
e
Gc% aH
Gc% aH% Ga% bH
Gc% eH
Gc% eH% Ge% bH
Gc% eH% Ge% dH
Ste# 2
!
Ste#
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 35/46
35
Ste#
ab
c
d
e
!
Gc% aHGc% aH% Ga% bH
Gc% eH
Gc% eH% Ge% bH
Gc% eH% Ge% dH
Gc% eH% Ge% dH% Gd% !H
e#eat the same
!or each starting node
Trees
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 36/46
36
Treesroot
lea!
#arent
child
Trees hae no cycles
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 37/46
37
root
lea!
Leel 0
Leel @
Leel 2
Leel
+eight
)i T
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 38/46
38
)inary Trees
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 39/46
39
PDDF T-C+'IN3-S
• Proo! by induction
• Proo! by contradiction
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 40/46
40
Induction
e hae statements P@% P2% P% ;
I! we *now
• !or some * that P@% P2% ;% P* are true• !or any n ?8 * that
P@% P2% ;% Pn im#ly PnO@
Then
-ery Pi is true
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 41/46
41
Proo! by Induction• Inductie basis
Find P@% P2% ;% P* which are true
• Inductie hy#othesisLetEs assume P@% P2% ;% Pn are true%
!or any n ?8 *
• Inductie ste#
Show that PnO@ is true
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 42/46
42
-am#le
Theorem> A binary tree o! height n
has at most 2n leaes.
Proo!>
let lGiH be the number o! leaes at leel i
lG0H 8 @
lGH 8 B
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 43/46
43
e want to show> lGiH 8 2i
• Inductie basis
lG0H 8 @ Gthe root nodeH
• Inductie hy#othesis
LetEs assume lGiH 8 2i !or all i 8 0% @% ;% n
• Induction ste#
we need to show that lGn O @H 8 2nO@
I d ti St
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 44/46
44
Induction Ste#
hy#othesis> lGnH 8 2n
Leel
n
nO@
I d ti St
7/24/2019 Automata theory ppt
http://slidepdf.com/reader/full/automata-theory-ppt 45/46
45
hy#othesis> lGnH 8 2n
Leel
n
nO@
lGnO@H 8 2 Q lGnH 8 2 Q 2n 8 2nO@
Induction Ste#
Proo! by Contradiction