Prove the equalities of regular expressions by applying properties?

Data Structure AlgorithmsComputer ScienceComputers

Problem

Prove each of the following equalities of regular expressions.

a. ab*a(a + bb*a)*b = a(b + aa*b)*aa*b.

b. b + ab* + aa*b + aa*ab* = a*(b + ab*).

Solution

Problem 1

Prove that ab*a(a + bb*a)*b = a(b + aa*b)*aa*b.

Let’s take LHS ,
   = ab*a(a + bb*a)*b
Use property of (a+b)* = a*(ba*)*
   = ab*a (a* ((bb*a) a* )* a*b
   = ab* a (a*bb*a)* a*b {Associative property}
   = ab* (a (a*bb*a)*)a*b
   = ab*(aa*bb*)*aa*b
   = a (b*(aa*bb*)*)aa*b
Use property a* (ba*)*= (a+b)*
   = a(b+aa*b)*aa*b
   = RHS
Hence proved

Problem 2

Prove that b + ab* + aa*b + aa*ab* = a*(b + ab*).

Let’s take LHS,
   = b + ab* + aa*b + aa*ab*
   = (b+aa*b)+(ab*+aa*ab*)
   = (^+aa*)b+(^+aa*)ab* {using distributing property}
   = (a*)b+(a*)ab* from ^+aa*=a*
   = a*b+a*ab*
   = a*(b+ab*) {distributive property}
   = RHS
Hence proved
raja
Published on 16-Jun-2021 13:30:42
Advertisements