You are on page 1of 4

Tahir Naseem/Handout 3

-1-

Lecture 3
Objectives
Defining Languages
Kleen Closure
Positive Closure
Concatenation
Reverse
Palindrome
Lexicographic Order
Defining Languages
Examples to define Languages
Example 1
L1 =

All strings that contain the substring to

Over
1 = {a, b, , z}

stop, to, toe are in L1

, oyster are not in L1

L1 =

{x 1*: x contains the substring to}

Example 2
L2 =

x 2*: x is divisible by 7}

Over
2 = { 0, 1, , 9}

{ 7, 14, 21, }

Example 3

Theory of Automata and Formal Languages

Tahir Naseem/Handout 3

L3

-2-

Theory of Automata and Formal Languages

= {s#s: s {a, b, , z}*}

ab#ab is in L3

ab#ba is not in L3

a##a# is not in L3

Example 4
L4 =

The language of all strings consisting of n 0s followed by n 1s for some n0

Over
= {0, 1}

{, 0, 1, 01, 001, 0011,.} is invalid because 0 and 1 cannot be occurred alone;


both should be occurred with equal time.

{, 01, 001, 0111, 0010, 0011,.} is also invalid because 001l cannot be occurred ;
all of 0s should be appear before 1s.

{, 01, 0011, 00011, 000111,.} is valid according to statement.

Example 5
L5 =

The language of all strings consisting of equal no. of 0s and 1s.

Over
= {0, 1}
L5 = { , 01, 10, 1100, 0011, 1001,0110,.}
Example 6
L=

{x, xx, xxx, xxxx,}

Over
= {x}
L= { xn for n N}
Kleen Closure
Language of all possible words called kleen closure.

Tahir Naseem/Handout 3

-3-

Theory of Automata and Formal Languages

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

Concatenation is an operation that is performed on two languages. In the result of


concatenation of language combination( word from one language are combined with
words of another language).

The resultant string may not belong to that language as


o Language of odd length over ={x} is {x, xxx, xxxxx,}

If words of above language are concatenated with x the resultant


language will be even length language; so resultant words not belong
to the original language.

The resultant string may also belong to that language as


o Language of all strings (*) over = { a b} is {, a, b, aa, ab, ba, bb,..}
o If words of language are concatenated with a then resultant word will also
belong to the original language.

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,}

reverse of a and aba, abba will word of original language

Tahir Naseem/Handout 3

-4-

Theory of Automata and Formal Languages

reverse of ab and abb is not word of original language.

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}

Example: reverse (aba) = aba so is palindrome

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.

You might also like