Académique Documents
Professionnel Documents
Culture Documents
Week 1-Introduction
Acknowledgement
While most of the slides are from the Automata course at
coursera.org by Jeff Ullman, and
from the Theory of Automata course given in 2013 @ FASTISL,
some slides are also taken from the lecture notes @ http
://www.eecs.wsu.edu/~ananth/CptS317/Lectures/index.htm
The slides used in this lecture are taken from Automata course by Dr.
Azam at FAST-CFD campus.
Week 1-Introduction
Books
Introduction to Theory of Computation, Michael
Sipser, 3rd Edition
Introduction to Computer Theory, Danial I. A.
Cohen
Introduction to Automata Theory, Languages,
and Computations, John Hopcroft and Jeffery
Ullman, 3rd Edition
An Introduction to Formal Languages and
Automata, Peter Linz
Introduction to Languages and the Theory of
Computation, John C. Martin. Fourth Edition
Government College University, Faisalabad
Week 1-Introduction
Week 1-Introduction
Week 1-Introduction
Context-Free Languages
Week 1-Introduction
Turing Machines
Basic definitions and relation to the notion of an
algorithm or program.
Power of Turing Machines.
Week 1-Introduction
Computation
memory
CPU
Week 1-Introduction
temporary memory
input
CPU
output
Program memory
Week 1-Introduction
f ( x) x
Example:
temporary memory
input
CPU
output
Program memory
compute
compute
xx
2
x x
10
Week 1-Introduction
f ( x) x
temporary memory
input
x2
CPU
output
Program memory
compute
compute
xx
2
x x
11
Week 1-Introduction
temporary memory
z 2*2 4
f ( x) z * 2 8
f ( x) x
input
x2
CPU
output
Program memory
compute
compute
xx
2
x x
12
Week 1-Introduction
temporary memory
z 2*2 4
f ( x) z * 2 8
f ( x) x
input
x2
CPU
f ( x) 8
Program memory
compute
compute
xx
output
x x
13
Week 1-Introduction
Automaton
temporary memory
Automaton
input
CPU
output
Program memory
14
Week 1-Introduction
Automaton
temporary memory
Automaton
input
output
transition
state
15
Week 1-Introduction
no temporary memory
Pushdown Automata:
stack
Turing Machines:
16
Week 1-Introduction
Finite Automaton
temporary memory
input
Finite
Automaton
output
Example: Elevators, Vending Machines
(small computing power)
Government College University, Faisalabad
17
Week 1-Introduction
Temp.
memory
Pushdown Automaton
Stack
Pushdown
Push, Pop
input
Automaton
output
Example: Compilers for Programming Languages
(medium computing power)
Government College University, Faisalabad
18
Week 1-Introduction
Turing Machine
Temp.
memory
input
Turing
Machine
output
19
Week 1-Introduction
Power of Automata
Simple
problems
More complex
problems
Hardest
problems
Finite
Pushdown
Automata
Turing
Automata
Machine
Less power
More power
Solve more
computational problems
Government College University, Faisalabad
20
Week 1-Introduction
(unsolvable problems)
21
Week 1-Introduction
P problems
Solved in polynomial time
Government College University, Faisalabad
22
Week 1-Introduction
23
Week 1-Introduction
Set
A set is a group of objects represented as a unit.
Sets may contain any type of object, including
numbers, symbols, and even other sets.
The objects in a set are called its elements or
members.
24
Week 1-Introduction
Languages
25
Week 1-Introduction
Alphabet:
a , b, c , , z
26
Week 1-Introduction
ab
abba
aaabbbaabab
Government College University, Faisalabad
u ab
v bbbaaa
w abba
Week 1-Introduction
102345
567463386
{ 0,1,2, ,9}
{ 0,1}
101101111
Government College University, Faisalabad
28
Week 1-Introduction
String Operations
w a1a2 an
abba
bbbaaa
v b1b2 bm
Concatenation
wv a1a2 anb1b2 bm
abbabbbaaa
29
Week 1-Introduction
w a1a2 an
ababaaabbb
Reverse
R
w an a2 a1
bbbaaababa
30
Week 1-Introduction
String Length
w a1a2 an
Length: w
Examples:
n
abba 4
aa 2
a 1
Government College University, Faisalabad
31
Week 1-Introduction
String Length
32
Week 1-Introduction
Length of Concatenation
uv u v
Example:u
aab, u 3
v abaab, v 5
uv aababaab 8
uv u v 3 5 8
Government College University, Faisalabad
33
Week 1-Introduction
Empty String
A string with no letters is denoted:
or
Observations: 0
w w w
abba abba abba abba
Government College University, Faisalabad
34
Week 1-Introduction
Substring
Substring of string:
a subsequence of consecutive
characters
String
Substring
abbab
abbab
abbab
ab
abba
b
abbab
bbab
35
Week 1-Introduction
abbab
Prefixes
a
ab
abb
abba
abbab
Suffixes
abbab
bbab
bab
ab
b
w uv
prefix
suffix
36
Week 1-Introduction
Another Operation
n
w ww
w
n
Example:
Definition:
abba abbaabba
2
abba
0
37
Week 1-Introduction
The * Operation
a, b
* , a, b, aa, ab, ba, bb, aaa, aab,
38
Week 1-Introduction
Example
39
Week 1-Introduction
Example 2
40
Week 1-Introduction
Closure of Null
TheoryCollege
Of Automata
Government
University, Faisalabad
41
Week 1-Introduction
The + Operation
except
a, b
* , a, b, aa, ab, ba, bb, aaa, aab,
42
Week 1-Introduction
Languages
a, b
* , a, b, aa, ab, ba, bb, aaa,
Language:
a, aa, aab
Language:
Language:
43
Week 1-Introduction
n n
L {a b : n 0}
ab
aabb
aaaaabbbbb
abb L
44
Week 1-Introduction
Prime numbers
Alphabet
{ 0,1,2, ,9}
Language:
PRIMES {2,3,5,7,11,13,17, }
Government College University, Faisalabad
45
Week 1-Introduction
{ 0,1,2, ,9}
EVEN { 0,2,4,6, }
46
Week 1-Introduction
Unary Addition
Alphabet:
{1,, }
Language:
ADDITION {x y z : x 1n , y 1m , z 1k ,
nm k}
Costas Busch
- RPIUniversity, Faisalabad
Government
College
47
Week 1-Introduction
Squares
Alphabet:
{1, # }
Language:
SQUARES {x # y : x 1 , y 1 , m n }
n
11#1111 SQUARES
111 #1111 SQUARES
Government College University, Faisalabad
48
Week 1-Introduction
Note that:
Sets
{ } {}
Set size
{} 0
Set size
{} 1
String length
49
Week 1-Introduction
Operations on Languages
The usual set operations
L * L
50
Week 1-Introduction
Reverse
Definition:
L {w : w L}
n n
L {a b : n 0}
R
n n
L {b a : n 0}
Government College University, Faisalabad
51
Week 1-Introduction
Concatenation
Definition:
L1L2 xy : x L1, y L2
Example: a, ab, ba b, aa
52
Week 1-Introduction
Concatenation (cont..)
Concatenation does not always produce word in
same language.
53
Week 1-Introduction
Definition:
Another Operation
n
L LL L
n
a, b a, b a, b a, b
aaa, aab, aba, abb, baa, bab, bba, bbb
3
Special case: L0
a , bba , aaa 0
Government College University, Faisalabad
54
Week 1-Introduction
n n
L {a b : n 0}
2
n n m m
L {a b a b : n, m 0}
2
aabbaaabbb L
55
Week 1-Introduction
Star-Closure (Kleene *)
All strings that can be constructed from
Definition:
L* L L L
Example:
a, bb,
a, bb *
aa
,
abb
,
bba
,
bbbb
,
56
Week 1-Introduction
Positive Closure
Definition:
L L L
a, bb,
a, bb aa, abb, bba, bbbb,
57
Week 1-Introduction
Palindrome
58
Week 1-Introduction
Theorem
S* = S**
S* != S+
When S* == S+ ?
Week 1-Introduction
Exercise