# Construct the Regular expression for the given languages by the user.

Regular expression is the language which is used to describe the language and is accepted by finite automata. Regular expressions are the most effective way to represent any language. Let Σ be an alphabet which denotes the input set.

The regular expression over Σ can be defined as follows −

• Φ is a regular expression which denotes the empty set.
• ε is a regular expression and denotes the set { ε} and it is called a null string.
• For each ‘a’ in Σ ‘a’ is a regular expression and denotes the set {a}.
• If r and s regular expressions denoting the language.
• L1 and l2 respectively then,
• r+s is equivalent to L1 U L2 union
• rs is equivalent to L1L2 concatenation
• r* is equivalent to L1* closure

The r* is known as Kleen closure or closure which indicates occurrence of r for an infinite number of times.

## Problem 1

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

## Solution

All combinations of a's means that 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.

## Problem 2

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

## Solution

The regular expression has to be built for the language L = {a, aa,aaa, ....}

This set indicates that there is no null string. So, we can denote regular expression as follows −

R = a+

## Problem 3

Write the regular expression for the language L over l: = {O, l} such that all the strings do not contain the substring 01.

## Solution

The Language is as follows −

L = {E, 0, 1,00, 11,10,100,.....}

The regular expression for the above language is as follows −

R = (1* O*)

## Problem 4

Write the regular expression for the language containing the string in which every 0 is immediately followed by 11.

## Solution

The regular expectation will be: R = (011+ 1)*