edited by
675 views
0 0 votes
I saw some where that a language which accepts $a^{n^{2}} | n \geq1$ is not context free Language and not regular language.

is it not a language that has at least one $'a'$ as the string?. It should be regular as well according to this Logic right. Please correct me if wrong.

2 Answers

Best answer
1 1 vote
Hi,

I got your confusion. You might be thinking that since 'a' is the only element in the Language. So any power 'a' is raised to must result in either Regular Language or CFL.

But please check for other values of n for L = a ^ (n^2) / n >=1

n=1  L = a

n=2 L = aaaa

n=3 L = aaaaaaaaa

: : : : : : : :: : : : :: : : : :

Thus I don't think there will be any pattern for Regular Expression to be created. Means you can't create the Regular expression as a* which you might be thinking of or neither of any other Regular expression justifies it.

Also for CFL, we need to push the 'a' to the push into the stack but we are not sure when to pop the 'a' from the stack or in simple terms we are not sure how to compare them.

Take the example of 'aaaa' you will push 2 a's then pop 2 a's to compare that they are equal but when the string is 'aaaaaaaaa' for n = 3 this logic fails.

 

I think this Language must be implemented by LBA(Linear Bounded Automata thus it is CSL)

Hope you might have got it.

Please ask if require more clarification.
selected by
0 0 votes
  • It is not CFL. It is CSL.

  • Regular expression for atleast one a is " aa*". And it gives string like aa,aaa . But given language is not genrate .So how can you say is is atleast one a.
Position:
Show:

Related questions

4 4 votes
2 2 answers
186
186 views
GO Classes asked Sep 1
186 views
Consider the CFG$$\begin{aligned}S &\to VS \mid cT \\T &\to VT \mid cU \\U &\to \epsilon \mid VU \\V &\to a \mid b\end{aligned} $$Which language is generated by this gram...
2 2 votes
1 1 answer
105
105 views
GO Classes asked Sep 1
105 views
Which CFG generates the language $L = \{a^m b^n \mid 2m=n \text{ or } m=2n\}$?$S \to aSbb \mid aaSb \mid \epsilon$ $S \to X \mid Y$$X \to aXbb \mid \epsilon$$Y \to aaYb \...
5 5 votes
2 2 answers
479
479 views
GO Classes asked Sep 9, 2025
479 views
Consider the following CFG $G$ over $\Sigma = \{\mathbf{a},\mathbf{b},\mathbf{c},\mathbf{d}\}$:\[\begin{array}{rcl}S & \rightarrow & S\mathbf{a} \;\mid\; \mathbf{d}T \\T ...
1 1 vote
1 1 answer
756
756 views