Lecture 1
Lecture 1
• Example:
• Alphabetic: Σ = {0,1} -> Sentences : 000001, 1010101
• Alphabetic: Σ = {a,b} -> Sentences : ababaabb, bababbabb
OPERATIONS ON STRINGS
• Powers of Σ
• Example : Σ = {0,1}
• Σ0 = {λ} -> set of all strings of length 0
• Σ1 = {0, 1} -> set of all strings of length 1
• Σ2 = {00, 01, 10, 11} -> set of all strings of length 2
• Σ3 = {000, 001, 010, 011, 100, 101, 110, 111}
• Σn -> set of all strings of length n
OPERATIONS ON STRINGS
• Kleene Closure :
• They are two repetition marks, also called Closure or Klene Star.
• * : Repeat (0 - n) times.
• + : Repeat (1 - n) times
OPERATIONS ON STRINGS
• Example:
• If Σ = {x}, then
• Σ* = L1 = {λ, x, xx, xxx, …}
• Σ+ = L1 = { x, xx, xxx, ….}
• If Σ = {aa, b}, then
• Σ* = L2 = {λ, aab, baa, baab, aabb, …}
• Σ+ = L2 = {aaaa, b, baaaa, bb, ….}
OPERATIONS ON STRINGS
• Union (U) / OR
• Example :
• r1 = {a} , r2 = {b} -> L = r1 U r2 = a U b = {a, b}
• Concatenation (.)
• Example:
• r1 = {a} , r2 = {b} -> L = r1r2 = {ab}
• L1 = {a, ab, ba}, L2 = {b, aa} -> L1L2 = {ab, aaa, abb, abaa, bab, baaa}
EXAMPLES
• Σ = {0,1}
• L1 = {Strings that end with 1} = {01, 11, 10101, 10001, …}
• L2 = {Strings that start and end with 0} = {0, 00, 010, 0111010, ….}
• L3 = {Strings that have even numbers of 1’s} = {11, 101, 1101010, 1111, …}
LANGUAGES
• Regular Languages: are formal languages that can be expressed using regular
expressions.
• Regular languages can be generated from one-element languages by applying certain
standard operations a finite number of times. These simple operations include
(Concatenation, Union, and Kleen Closure)
• Example: Write the Language for each of the following regular expressions,
Σ = {a,b}
1. (ab)* = {λ, ab, abab, ababab, …}
2. ab*a = {aa, aba, abba, abbba, abbbba, …}
3. a*b* = {λ, a, b, aa, ab, bb, aaa, aab, abb, bbb, aaaa, …}