Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
104 views42 pages

Lecture 1

Uploaded by

Ali Khattak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
104 views42 pages

Lecture 1

Uploaded by

Ali Khattak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 42

CSC312

Theory of Automata

Lecture # 1

Introduction
Administrative Stuff
• Instructor: Aatikah Rasool
[email protected]
Room # B406-D
•Prerequisite: CSC102 - Discrete Structures
Course Objectives:
This course is designed to enable the students to
study and mathematically model various
abstract computing machines that serve as
models for computations and examine the
relationship between these automata and formal
languages.
Course Outline
• Regular Expressions
• Finite Automata
• Push Down Automata
• Context Free Grammar
• Turing Machine
Course Organization
Text Book:
i) Denial I. A. Cohen Introduction to Computer
Theory, Second Edition, John Wiley & Sons.
Reference Books:
i) J. E. Hopcroft, R. Motwani, & J. D. Ullman
Introduction to Automata Theory,
Languages, and Computation, Third Edition,
Pearson, 2008.
Instruments:
There will be 3~4 assignments, 3~4 quizzes,
Weights: Assignments 10%
Quizzes 15%
Sessional I 10%
Sessional II 15%
Final Exam 50%
Some basics
• Automaton = A self-operating machine or
mechanism (Dictionary definition), plural is
Automata.
• Automata = abstract computing devices
• Automata theory = the study of abstract
machines (or more appropriately, abstract
'mathematical' machines or systems), and
the computational problems that can be
solved using these machines.
• Mathematical models of computation
• Finite automata
• Push-down automata
• Turing machines
Computation

CPU memory

7
temporary memory

input memory
CPU
output memory

Program memory

8
3
Example: f ( x ) x

temporary memory

input memory
CPU
output memory
Program memory
compute xx
2
compute x x
9
3
f ( x) x

temporary memory
input memory
x 2
CPU
output memory
Program memory
compute xx
2
compute x x
10
3
temporary memory f ( x) x
z 2 * 2 4
f ( x) z * 2 8
input memory
x 2
CPU
output memory
Program memory
compute xx
2
compute x x
11
3
temporary memory f ( x) x
z 2 * 2 4
f ( x) z * 2 8
input memory
x 2
CPU
f ( x) 8
Program memory output memory
compute xx
2
compute x x
12
Automaton
temporary memory

Automaton
input memory
CPU
output memory

Program memory

13
Different Kinds of Automata
Automata are distinguished by the temporary memo

• Finite Automata: no temporary memory

• Pushdown Automata: stack

• Turing Machines: random access memory

14
Finite Automaton

temporary memory

input memory
Finite
Automaton
output memory

Example: Automatic Door, Vending Machines


(small computing power)
15
Pushdown Automaton
Stack Push, Pop

input memory
Pushdown
Automaton
output memory

Example: Compilers for Programming Languages


(medium computing power)
16
Turing Machine

Random Access
Memory

input memory
Turing
Machine
output memory

Examples: Any Algorithm


(highest computing power)
17
Power of Automata

Finite Pushdown Turing


Automata Automata Machine

Less power More power


Solve more
computational problems
18
Mathematical Preliminaries

• Sets
• Functions
• Relations
• Graphs
• Proof Techniques

19
SETS
A set is a collection of elements
A {1, 2, 3}
B {train, bus, bicycle, airplane}

We write
1 A
ship  B
20
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

S = { j : j > 0, and j = 2k for some


k>0 }

S = { j : j is nonnegative and even }


21
A = { 1, 2, 3, 4, 5 }
U
6 A
2 3 8
1
7 4 5
9
10

Universal Set: all possible elements

U = { 1 , … , 10 }
22
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
23
• 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
24
{ even integers } = { odd
integers }

Integers

1 odd
even 5
2 6
0
4
3 7

25
DeMorgan’s Laws

U
AUB=A B

U
A B=AUB

26
Empty, Null Set:
={}

SU =S
U
S =

S- =S

-S=

27
Subset
A = { 1, 2, 3} B = { 1, 2, 3, 4, 5 }
A B

U
Proper Subset: A B

U
B
A

28
Disjoint Sets
A = { 1, 2, 3 } B = { 5, 6}

U
A B=

A B

29
Set Cardinality
• For finite sets
A = { 2, 5, 7 }

|A| = 3

(set size)

30
Powersets
A powerset is a set of sets

S = { a, b, c }

Powerset of S = the set of all the subsets of S

={ , {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c

Observation: | 2S | = 2|S| ( 8 = 23 )

31
Cartesian Product
A = { 2, 4 } B = { 2, 3, 5 }

A X B = { (2, 2), (2, 3), (2, 5), ( 4, 2), (4, 3), (4, 5) }

32
GRAPHS
A directed graph
e
b
node
a d
ed g e c
Nodes (Vertices)
V = { a, b, c, d, e }
Edges
E = { (a,b), (b,c), (b,e),(c,a), (c,e), (d,c), (e,b), (e,d)
33
Labeled Graph
2
6 e
b 2
1 3
a 6 d
5
c

34
Walk

e
b
a d

Walk is a sequence of adjacent edges


(e, d), (d, c), (c, a)

35
Path

e
b
a d

Path is a walk where no edge is repeated

Simple path: no node is repeated


36
Cycle

base e
b
3
a 1 d
2
c

Cycle: a walk from a node (base) to itself

Simple cycle: only the base node is repeated

37
Euler Tour
8 base
7 e
b 1
4 6
a 5 2 d
3
c

A cycle that contains each edge once

38
Hamiltonian Cycle
5 base
e
b 1
4
a 2 d
3
c

A simple cycle that contains all nodes

39
Trees
root

parent

leaf

child

Trees have no cycles

40
root
Level 0

Level 1
leaf Height 3

Level 2

Level 3

41
Binary Trees

42

You might also like