edited by
3,944 views

2 Answers

Best answer
8 votes
8 votes

All  the given languages are CFLs.Let us understand how..

A) a2n . bn

For this we push the a's till b's do not come in the input.As soon as b starts coming , for every b that is read , pop 2 a's from the stack.Thus the given language can be modelled on deterministic PDA since how many push or pop needs to be done at each step.

Hence it is a DCFL to be more accurate and hence CFL as well

C)a4m .  bm

For this we proceed in similar manner as in A) .Just the modification that is required is when b starts coming in input for very b that is read , pop 4 a's from the stack.Thus 

Thus the given language can be modelled on deterministic PDA as well since how many push or pop needs to be done at each step.

Hence it is a DCFL to be more accurate and hence CFL as well.

Now coming to B)

B) an . bm    such that m <= n <= 3m

Let this language be L.Now L can be decomposed into sublanguages L0 , L2 , ......, L2m as shown below :

L0  =  { am bm} for m = n

L1  =  { am+1 bm } for n = m+1

...

...

L2m = { a3m bm} for n = 3m

We know each of these sublanguages are CFL(also DCFL) but the result is not going to DCFL as in the above language the number of pops of 'a' w.r.t 'b'   will vary according to each of the sublanguages.This is not deterministic behaviour and hence cannot be modelled on deterministic push down automata.So it is not DCFL

But yes it can be modelled using non deterministic PDA.

Hence the given language is  CFL but not DCFL

selected by
0 votes
0 votes

Case I

Push all the a' into the stack after crossing all the 'a' whenever u find 'b' ,then correspondingly pop two 'bb' from the top of the stack.

Therefore above languages is CFL so it must be DCFL.

Case 2:"

Second language is nothing but union of two context free say L1={a^n b^n/n>=1}  and L2={a^n b^2n/n>=1} therfore second languages must be CFL not DCFL.

Case 3::

It is obvious that it can be accepted by PDA for every one 'a' pop 4'b'------------->DCFL

Related questions

1 votes
1 votes
1 answer
1
3 votes
3 votes
2 answers
2
0 votes
0 votes
1 answer
3
0 votes
0 votes
1 answer
4
practicalmetal asked Mar 15, 2023
516 views
Is the following language context free:The set of all strings with number of a’s equal to number of b’s and the sum of a’s and b’s to be divisible by 3.