Adren’s lemma will state that it has infinite many solutions here. As P contaions .

Dark Mode

6,827 views

24 votes

Which one of the following regular expressions correctly represents the language of the finite automaton given below?

- $ab^{\ast}bab^{\ast} + ba^{\ast}aba^{\ast}$
- $(ab^{\ast}b)^{\ast}ab^{\ast} + (ba^{\ast}a)^{\ast} ba^{\ast}$
- $(ab^{\ast}b + ba^{\ast}a)^{\ast} (a^{\ast} + b^{\ast})$
- $(ba^{\ast}a + ab^{\ast}b)^{\ast} (ab^{\ast} + ba^{\ast})$

21 votes

Best answer

Answer : D

$\color{red}{\text{Method 1(Complete Analysis) :}}$

We have two final states, $Q,R.$

First find the regular expression for set of all strings that end up at the initial state $P$ when running the given $\textsf{NFA}.$ Let’s call this $P.$

Note that $P$ is the initial state, so, NFA execution starts at $P.$ Now, to end up on state $P$ at the end of the string, we can do any of the following, in any order, any number of times :

- Read $’a’$, go to state $Q,$ then read any number of $b’s$, then read $b$ to come back to state $P.$ So, $1 = ab^*b$
- Read $’b’$, go to state $R,$ then read any number of $a’s$, then read $a$ to come back to state $P.$ So, $2= ba^*a$

So, $P = (1+2)^* = [(ab^*b)+(ba^*a)]^*$ (Because we can do $1$ or $2$ in any order, any number of times)

Now, we want to find language of the given NFA $N$, whose final states are $Q,R.$

So, $RegEx(N) = Q + R $

Where $Q$ is the regular expression for set of all strings that end up at the state $Q$ when running the given $\textsf{NFA}$ and $R$ is the regular expression for set of all strings that end up at the state $R$ when running the given $\textsf{NFA}.$

$Q = P ab^*$

$R = Pba^*$

So, $RegEx(N) = Q + R = P ab^* + Pba^* = P(ab^* + ba^*)$

$RegEx(N) = [(ab^*b)+(ba^*a)]^* (ab^* + ba^*)$

Hence, Option D is Correct Answer.

$\color{blue}{\text{Method 2 (Option Elimination) :}}$

Option A :

The Strings $\text{“}a\text{”}$ and $\text{“}b\text{”}$ are accepted by the given NFA BUT these strings are Not generated by the regular expression in Option A. So Option A is wrong.

Option B :

The String $abbbbaa$ is accepted by the given NFA BUT this string is Not generated by the regular expression in Option B. So Option B is wrong.

Option C :

The Empty String is NOT accepted by the given NFA BUT this string is generated by the regular expression in Option C. So Option C is wrong.

Correct answer is D.

0

4 votes

For option A,

The String “a” is not accepted which is in the language.So it is false.

For Option B,

The String “abbbaa” is accepted by the NFA but it is not generated by the regular expression.So it is false.

For option C,

It will accepted empty string which is not in the language.So it is false.

Correct answer is D.

The String “a” is not accepted which is in the language.So it is false.

For Option B,

The String “abbbaa” is accepted by the NFA but it is not generated by the regular expression.So it is false.

For option C,

It will accepted empty string which is not in the language.So it is false.

Correct answer is D.

1

reshown
Sep 18, 2022
by Prateek pallaw

@Sanjay Sharma sir how to solve this using the state elimination method or state elimination method will not work here?

0

1 vote

using adren’s lemma

P=∈+Qb+Ra

Q=Pa+Qb*

by adren’s thorem

if R=Q+RP

then R=QP*

so, here

Q=Pa(b*)*……………..(1)

R=Pb+Ra*

so R=Pb(a*)*…………...(2) (by adren’s theorem)

now P=∈+Qb+Ra

P=∈+Pa(b*)*b+ Pb(a*)*a

P=∈+P{a(b*)*b+b(a*)*a}

P=∈[a(b*)*b+b(a*)*a]*

P=[a(b*)*b+b(a*)*a]*………..(3)

now from Eqn(1) and Eqn(2)

RE: Q+R=Pa(b*)*+Pb(a*)*

=P[a(b*)*+b(a*)*]

put the value of P from equ(3)

**RE:** Q+R=[a(b*)*b+b(a*)*a]*[a(b*)*+b(a*)*]

**RE: Q+R** = [ab*b+ba*a]*[ab*+ba*]

so Option D is correct