Week 1
Week 1
Automata Theory
1
Alphabets
• An alphabet is a finite, nonempty set of
symbols
Σ = {0,1}, the binary alphabet
Σ = {𝑎, 𝑏, … , 𝑧}, the set of all lowercase letters
2
Strings
• A string is a finite sequence of symbols
chosen from some alphabet
3
Alphabets and Strings
• We will use small alphabets: a, b
• Strings
a
ab u ab
abba v bbbaaa
baba w abba
aaabbbaabab
4
Examples:
{0,1,2,,9}
Decimal numbers alphabet
102345 567463386
Binary numbers alphabet {0,1}
100010001 101101111
Unary numbers alphabet {1}
1 11 111 1111 11111
5
Length of a String
w a1a2 an
Length: w n
Examples: abba 4
aa 2
a 1
6
Empty String
• A string with no letters (length zero) is
denoted: 𝜀
7
String Operations
w a1a2 an
v b1b2 bm
Concatenation:
wv a1a2 anb1b2 bm
Reverse:
w an a2 a1
R
8
Length of Concatenation
uv u v
Example: u aab, u 3
v abaab, v 5
uv aababaab 8
uv u v 3 5 8
9
Substring
Substring of string: a subsequence of
consecutive characters
String Substring
abbab ab
abbab abba
abbab b
abbab bbab
10
Powers of an Alphabet
Σ 𝑘 : the set of strings of length k, each of
whose symbols is in Σ
Σ = 0, 1
Σ0 = 𝜀
Σ1 = 0, 1
Σ2 = 00, 01, 10, 11
Σ3 = 000, 001, 010, 011, 100, 101, 110, 111
11
The * Operation
*
: the set of all strings over an alphabet
Σ = 0, 1
Σ ∗ = Σ 0 ∪ Σ1 ∪ Σ 2 ∪ ⋯
12
The + Operation
: the set of all strings over an alphabet
except 𝜀
Σ = 0, 1
Σ + = Σ1 ∪ Σ 2 ∪ ⋯
Σ + = {0, 1, 00, 01, 10, 11, 000, 001, 010, 011, … }
Σ∗ = Σ + ∪ {𝜀}
13
Languages
A language over alphabet is any subset of
*
Example:
Σ = 𝑎, 𝑏
Σ ∗ = 𝜀, 𝑎, 𝑏, 𝑎𝑎, 𝑎𝑏, 𝑏𝑎, 𝑏𝑏, 𝑎𝑎𝑎, …
Languages:
𝜀
𝑎, 𝑎𝑎, 𝑎𝑎𝑏
𝜀, 𝑎𝑏𝑏𝑎, 𝑏𝑎𝑏𝑎, 𝑎𝑎, 𝑎𝑏, 𝑎𝑎𝑎𝑎𝑎𝑎
14
More Language Examples
Alphabet {a, b}
An infinite language L {a b | n 0}
n n
𝜀 bbabb L
ab abb L
L
aabb
aaaaabbbbb
15
Prime numbers
Numbers divisible by 1 and itself
Alphabet {0,1,2,,9}
Language:
PRIMES {2,3,5,7,11,13,17,}
16
Even and odd numbers
Alphabet {0,1,2,,9}
Languages:
EVEN {x | x and x is even}
*
EVEN {0,2,4,6,}
ODD {1,3,5,7,}
17
Addition (of unary numbers)
Alphabet: {1,, }
Language:
ADDITION {x y z | x 1 , y 1 , z 1 ,
n m k
n m k , n 1, m 1}
11 111 11111 ADDITION
111 111 111 ADDITION
ADDITION {1 1 11,1 11 111,11 1 111,11 11 1111, ...}
18
Squares (of unary numbers)
Alphabet: {1, #}
Language:
SQUARES {x#y | x 1 ,y 1 , m n }
n m 2
11#1111 SQUARES
111#1111 SQUARES
SQUARES {1#1,11#1111,111#111111111, ...}
19
Two special languages
Sets { } {𝜀 }
Set size {} 0
28