CSC312 Automata Theory: Lecture # 1
CSC312 Automata Theory: Lecture # 1
Automata Theory
Lecture # 1
Introduction
Administrative Stuff
• Instructor: Dr. Ashfaq Ahmad
[email protected]
CPU memory
13
temporary memory
input memory
CPU
output memory
Program memory
14
3
Example: f ( x) x
temporary memory
input memory
CPU
output memory
Program memory
compute xx
2
compute x x
15
3
f ( x) x
temporary memory
input memory
x2
CPU
output memory
Program memory
compute xx
2
compute x x
16
3
temporary memory f ( x) x
z 2*2 4
f ( x) z * 2 8
input memory
x2
CPU
output memory
Program memory
compute xx
2
compute x x
17
3
temporary memory f ( x) x
z 2*2 4
f ( x) z * 2 8
input memory
x2
CPU
f ( x) 8
Program memory output memory
compute xx
2
compute x x
18
Automaton
temporary memory
Automaton
input memory
CPU
output memory
Program memory
19
Different Kinds of Automata
Automata are distinguished by the temporary memory
20
Finite Automaton
temporary memory
input memory
Finite
Automaton
output memory
input memory
Pushdown
Automaton
output memory
input memory
Turing
Machine
output memory
BATTERY
input: switch
output: light bulb
actions: flip switch
states: on, off
A simple “computer”
I TCH
SW
input: switch
bulb is on if and only if
output: light bulb
there was an odd number of
actions: f for “flip switch” flips
states: on, off
Another “computer” 1
1 start off off
1
2 2 2 2
BATTERY
1
2
off on
1
• Sets
• Functions
• Relations
• Graphs
• Proof Techniques
28
SETS
A set is a collection of elements
A {1, 2, 3}
B {train, bus, bicycle, airplane}
We write
1 A
ship B
29
Set Representations
C = { a, b, c, d, e, f, g, h, i, j, k }
C = { a, b, …, k } finite set
S = { 2, 4, 6, … } infinite set
30
A = { 1, 2, 3, 4, 5 }
U
6 A
2 3 8
1
7 4 5
9
10
U = { 1 , … , 10 }
31
Set Operations
A = { 1, 2, 3 } B = { 2, 3, 4, 5}
A B
• Union
2 4
1
3
A U B = { 1, 2, 3, 4, 5 } 5
• Intersection
U 2
A B = { 2, 3 } 3
• Difference
1
A-B={1}
B - A = { 4, 5 } Venn diagrams 5
32
• Complement
Universal set = {1, …, 7}
A = { 1, 2, 3 } A = { 4, 5, 6, 7}
4
A
A 3 6
1
2
5 7
A=A
33
{ even integers } = { odd integers }
Integers
1 odd
even 5
2 6
0
4
3 7
34
DeMorgan’s Laws
U
AUB=A B
U
A B=AUB
35
Empty, Null Set:
={}
SU =S
U
S = = Universal Set
S- =S
-S=
36
Subset
A = { 1, 2, 3} B = { 1, 2, 3, 4, 5 }
A B
U
Proper Subset: A B
U
B
A
37
Disjoint Sets
A = { 1, 2, 3 } B = { 5, 6}
U
A B=
A B
38
Set Cardinality
• For finite sets
A = { 2, 5, 7 }
|A| = 3
(set size)
39
Powersets
A powerset is a set of sets
S = { a, b, c }
2S = { , {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c} }
Observation: | 2S | = 2|S| ( 8 = 23 )
40
Cartesian Product
A = { 2, 4 } B = { 2, 3, 5 }
A X B = { (2, 2), (2, 3), (2, 5), ( 4, 2), (4, 3), (4, 5) }
|A X B| = |A| |B|
AXBX…XZ
41
FUNCTIONS
domain range
4 A B
f(1) = a a
1
2 b
3 c
5
f : A -> B
If A = domain
then f is a total function
otherwise f is a partial function
42
RELATIONS
Let A & B be sets. A binary relation “R” from A to B
R = {(x1, y1), (x2, y2), (x3, y3), …}
Where xi A and yi B
R⊆AxB
xi R yi to denote (a, b) R
45
Walk
e
b
a d
46
Path
e
b
a d
base e
b
3
a 1 d
2
c
48
Euler Tour
8 base
7 e
b 1
4 6
a 5 2 d
3
c
49
Hamiltonian Cycle
5 base
e
b 1
4
a 2 d
3
c
50
Trees
root
parent
leaf
child
51
root
Level 0
Level 1
leaf Height 3
Level 2
Level 3
52
Binary Trees
53