2. Languages Flashcards
Alphabet
any non-empty finite set Σ
Symbols
members of the alphabet
String
finite sequence of symbols
ε = empty string
Examples of strings over the alphabet {0,1}
over this alphabet = strings in this alphabet
ε, 0, 11001111000101…
String Length
NOT set cerdinality
|w| = the number of alphabet symbols in the string w
|ε| = 0, |ababb| = 5
The set of all strings over Σ
Σ*
contains all strings that can be created by symbols from this alphabet
{a}* = {ε, a, aa, aaa, aaaa,…}
w,x ∈ Σ*
wx =
Concatenation of w and x
ORDER MATTERS
w = ab, x = aabb then xw = aabbab and wx = abaabb
For all strings w, wε = εw = ?
w, you’re adding nothing
w^k
w = string, k = not negative
w^k = concatenation of w, k times w^0 = ε
w^R
reverse of w
(aabbb)^R = bbbaa
when is w a substring of x?
when there exists y, z ∈ Σ* (possibly empty) such that x = ywz (y = substring, w = substring, z = substring)
when is w a suffix of x?
(second half) if there exists y ∈ Σ* (element of all possible strings) such that x = yw
when is w a prefix of x?
(first half) if there exists y ∈ Σ* (element of all possible strings) such that x =wy
Language
set of strings made up of symbols from a given alphabet
language OVER Σ = subset of Σ* (alphabet of all possible strings)
{a,b}* =
all the possible strings you can create with a and b
{ε, a, b, aa, bb, ba, ab, aab,…}