Professional Documents
Culture Documents
Lecture # 2
Lecture # 2
Lecture # 2
• Strings
• Grammar
• Language
Alphabets
• An alphabet is a finite, nonempty set of symbols.
Conventionally we use the symbol for an alphabet
• u = ababb = abab2
• v = accbaaa = ac2ba3.
Strings
• Example # 1
• Example # 2
• |011| = 3
•| |=0
Substring
• A part of a string is known as substring
• L1 = abcab
• bca is a substring of L1
• ca is a substring of L1
Prefixes and Suffixes
• A beginning of a string (up to any symbol) is a prefix and
an ending is a suffix
•
The Power of an Alphabet
• Examples if = {0, 1}
• 1 = {0, 1}
• For Example { 0, 1}* = {, 0, 1, 00, 01, 10, 11, 000, ….}
• * = 0 1 2 3 4 5 ….
The Power of an Alphabet: Positive Closure
or Kleene’s Plus
• Sometimes, we wish to exclude the empty string from the set
of strings.
• Thus
• + = 1 2 3 4 5 ….
• * = + {}
Concatenation of Strings
• Let x and y be strings. Then xy denotes the concatenation of
x and y.
• xy = a1a2a3a4…ai b1b2b3b4…bj
Concatenation of Strings
• Let
• x = 01101
• y = 110
Then
• xy = 01101110
• yx = 11001101
Concatenation of Strings
• Remember that for any string w
w = w = w
• WR = cba
Introduction to Grammar
Language
Solution:
Test Yourself
Let L = {ab, aa, baa}. Which of the following strings are in L*
1) abaabaaabaa
2) aaaabaaaa,
3) baaaaabaaaab
4) baaaaabaa