Professional Documents
Culture Documents
-1-
Lecture 3
Objectives
Defining Languages
Kleen Closure
Positive Closure
Concatenation
Reverse
Palindrome
Lexicographic Order
Defining Languages
Examples to define Languages
Example 1
L1 =
Over
1 = {a, b, , z}
L1 =
Example 2
L2 =
x 2*: x is divisible by 7}
Over
2 = { 0, 1, , 9}
{ 7, 14, 21, }
Example 3
Tahir Naseem/Handout 3
L3
-2-
ab#ab is in L3
ab#ba is not in L3
a##a# is not in L3
Example 4
L4 =
Over
= {0, 1}
{, 01, 001, 0111, 0010, 0011,.} is also invalid because 001l cannot be occurred ;
all of 0s should be appear before 1s.
Example 5
L5 =
Over
= {0, 1}
L5 = { , 01, 10, 1100, 0011, 1001,0110,.}
Example 6
L=
Over
= {x}
L= { xn for n N}
Kleen Closure
Language of all possible words called kleen closure.
Tahir Naseem/Handout 3
-3-
It is denoted by *
Example
= {a b}
* ={ , a, b, ab, ba, aa, bb, }
Positive Closure
Language of all possible words excluding empty string called positive closure.
It is denoted by +
Example
= {a b}
+ ={ a, b, ab, ba, aa, bb, }
Concatenation
Reverse
If x is a word in some language L, then reverse (x) is the string of letters spelled
backward, called the reverse of x, even if this backward string is not a word in L.
o Example: Language of all strings that starts with a and having at least one a
over ={a b} is {a, ab, aba, abb, abba,}
Tahir Naseem/Handout 3
-4-
Palindrome:
For a word x; if reverse of word is equivalent to that word then we say that particular
word is palindrome
o Palindrome ={, and all string such that reverse(x) = x}
Lexicographic Order
Order according to size, from shorter to longer length.
o {, a, b, aa, bb, ab, ba, aaa, aba, aab, } is in lexicographic order
o {, ab, abbb, a, b, aa, bb, abaa, ba, aaa, aba, aab, } is not in lexicographic
order.