- 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 problems for equivalence of two regular expressions.
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