Explain the problems for equivalence of two regular expressions.

Data Structure AlgorithmsComputer ScienceComputers

Problem 1

Prove that (1+00*1)+(1+00*1)(0+10*1)*(0+10*)=0*1(0+10*1)*

Solution

Here, we need to prove LHS=RHS (Left hand side = Right hand side)

Let us solve first LHS

(1+00*1)+(1+00*1)(0+10*1)*(0+10*)

Take (1+00*1) as a common factor

(1+00*1)( ε+(0+10*1)*(0+10*1)

Where,

(0+10*1)*(0+10*1). It is in the form of R*R where R=0+10*1

As we know, (ε+R*R)=( ε+RR*)=R*

Therefore,

(1+00*1)((0+10*1)*)

Taking 1 as common factor

(ε+00*)1(0+10*1)*

Apply ε+00*=0*

0*1(0+10*1)*

=RHS

Hence, the two regular expressions are equal.

Problem 2

Show that (0*1*)*=(0+1)*

Solution

Consider LHS

(0*1*)*= { ε,0,00,1,11,111,01,10,……}

= {any combinations of 0’s, any combinations of 1’s, any combinations of 0 and 1, ε}

Similarly,

RHS=(0+1)*

= { ε,0,00,1,11,111,01,10,…..}

= { ε, any combinations of 0’s, any combinations of 1’s, any combinations of 0 and 1}

Hence, it is proved that

LHS=RHS

raja
Published on 12-Jun-2021 10:18:23
Advertisements