- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Explain the different operations on Regular language in TOC.

A language is a set of strings from some alphabet (finite or infinite). In other words, any subset L of E* is a language in TOC.

Some **special languages** are as follows −

- {} The empty set/language, containing no string.
- {s} A language containing one string, the empty string.

## Examples

E = {0, 1}

L = {x | x is in E* and x contains an even number of 0’s}

E = {0, 1, 2,., 9, .}

L = {x | x is in E* and x forms a finite length real number}

= {0, 1.5, 9.326,.}

E = {a, b, c,., z, A, B,., Z}

L = {x | x is in E* and x is a Pascal reserved word}

= {BEGIN, END, IF,...}

E = {Pascal reserved words} U { (, ), ., :, ;,...} U {Legal Pascal identifiers}

L = {x | x is in E* and x is a syntactically correct Pascal program}

E = {English words}

L = {x | x is in E* and x is a syntactically correct English sentence}

## Operations on Regular Languages

Some of the operations on regular languages are as follows −

- Union
- Intersection
- Difference
- Concatenation
- kleen * closure

Let us understand these operations one by one.

### Union

If Ll and If L2 are two regular languages, their union Ll u L2 will also be regular.

For example, Ll = {an I n > O} and L2 = {bn I n > O}

L3 = Ll U L2 = {an U bn I n > O} is also regular.

### Intersection

If Ll and If L2 are two regular languages, their intersection Ll n L2 will also be regular.

**For example,**

Ll= {am bn I n > 0 and m > O} and

L2= {am bn U bn am I n > 0 and m > O}

L3 = Ll n L2 = {am bn I n > 0 and m > O} is also regular.

### Concatenation

If Ll and If L2 are two regular languages, their concatenation L1.L2 will also be regular.

**For example,**

Ll = {an I n > 0} and L2 = {bn I n > O}

L3 = L1.L2 = {am . bn I m > 0 and n > O} is also regular.

### Kleene Closure

If Ll is a regular language, its Kleene closure Ll* will also be regular.

For example, Ll = (a U b ), Ll* = (a U b)*

### Complement

If L(G) is a regular language, its complement L'(G) will also be regular. Complement of a language can be found by subtracting strings which are in L(G) from all possible strings.

**For example,**

L(G) = {an I n > 3}

L'(G) = {an I n <= 3}

Note: Two regular expressions are equivalent, if languages generated by them are the same. For example, (a+b*)* and (a+b)* generate the same language. Every string which is generated by (a+b*)* is also generated by (a+b)* and vice versa .

### Example 1

Write the regular expression for the language accepting all combinations of a's, over the set l: = {a}

All combinations of a's mean a may be zero, single, double and so on. If a is appearing zero times, that means a null string. That is, we expect the set of {E, a, aa, aaa, ....}.

So we give a regular expression for this as follows −

R = a*

That is Kleen closure of a.

To Continue Learning Please Login

Login with Google