2022 CSC 353 2.0 2 Alphabets and Languages
2022 CSC 353 2.0 2 Alphabets and Languages
1
An alphabet is a finite set of symbols.
Definition 2.1.2
A string over an alphabet is a finite sequence of symbols from the alphabet.
We usually use u, v, w, x, y, z and Greek letters to denote strings.
Definition 2.1.3
Alphabets and Languages The empty string, denoted by e, is the string containing no symbols at all.
Note:
Set of all strings, including empty string, over an alphabet is denoted by *.
Example:
= {a, b}
* = {e, a, b, aa, ab, ba, bb, aaa, aab, aba, abb, baa, bab, … }
Definition 2.1.4
The length of a string w, denoted by w, is defined as its length as a sequence.
1
2
Regular expression 7
8
Definition 2.4.2 Example:
• L() = Let = c*(a (bc*))*
• L(a) = {a} for any a L() is the set of all strings over {a, b, c} that do not contain the
substring ac
• If and are regular expressions, then
L() = L() L() Definition 2.4.3
L( ) = L() L() Class of regular languages over an alphabet is defined as the set of all
languages L() for some regular expression over .
L(*) = L()*
Example: Regular languages can be defined in terms of closures.
Let {a, b}. The language represented by the regular expression (a b)*a Class of regular languages over is the closure of the set of languages
is
{ {} } {} under union, concatenation, and Kleene star.
L((a b)*a) = L((a b)*) L(a)
i.e., the class of regular languages is the set of languages satisfying the
= L((a b)*) {a}
following properties:
= L(a b)* {a}
= (L(a) L(b))* {a} • Empty language () is regular
= ({a} {b})* {a} = {a, b}* {a} • {} ; is a regular language
= {w {a, b} w ends with an a} • If L1 and L2 are regular languages, then L1*, L1 L2, and L1 o L2
9 are also regular 10