This question already has an answer here:

I've been trying to make a CFG, a pushdown automaton and a regular expression for the language

$\qquad L(M) = \{ww : w \in \{a, b\}^*, |w| \text{ is even}\}$.

I understand how the reverse of the string work, that is

$\qquad L' = \{ ww^R : w \in \{a, b\}^*\}$,

what i am asking for is to do it this way , i have already solved (L') : http://i921.photobucket.com/albums/ad53/Johann_1990/IMG_20150117_132616.jpg

but is there is a way to solve this one too?
$\qquad L(M) = \{ww : w \in \{a, b\}^*, |w| \text{ is even}\}$.

For example, $abaaba \in L$ with $w = aba$.


marked as duplicate by D.W., Rick Decker, David Richerby, Luke Mathieson, Juho Jan 17 '15 at 9:58

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ Note that $ww = abaaba$ is a bad example (as in, you don't learn anything from it) here as $w = w^R$. $\endgroup$ – Raphael Jan 16 '15 at 14:58
  • $\begingroup$ @Raphael , i need to train my self for any example.. when i am learning ! i know how to make the reverse of string pushdown or cfg, i was just trying something new! Thank you ! $\endgroup$ – AaoIi Jan 16 '15 at 20:52
  • $\begingroup$ @D.W.,its not the same question am talking about another thing completely.. $\endgroup$ – AaoIi Jan 16 '15 at 20:53

You can not do so as $L$ is not context-free.

See our reference questions for how to prove that, i.e.

  • $\begingroup$ so are you saying that it cannot be proved ? only the reverse of the string can be proved ? $\endgroup$ – AaoIi Jan 16 '15 at 13:00
  • $\begingroup$ @AaoIi That's what I'm saying, yes. At least, your first statement. I don't understand the second. $\endgroup$ – Raphael Jan 16 '15 at 14:54
  • $\begingroup$ I'm saying that this L′={wwR:w∈{a,b}∗}, I've seen that its accomplished in cfg and pushdown automata , so why L={ww:w∈{a,b}∗,|w| is even}.cannot be accomplished ? prove is not what I'm asking for, I'm asking for making the cf grammar for it as S -->aB and drawing the pushdown ? $\endgroup$ – AaoIi Jan 16 '15 at 15:34
  • 1
    $\begingroup$ I recommend you read some literature covering the basics and then go read the questions I link. (Your terminology is shaky; what is "accomplish"?) The answers are all there, hence I only link. (Hint: "L is not context-free" implies "there is no context-free grammar, pushdown-automaton or regular expression for L".) $\endgroup$ – Raphael Jan 16 '15 at 15:38
  • $\begingroup$ i got it, I'm just trying to understand Formal Language and Automata, Thank you for you help :) $\endgroup$ – AaoIi Jan 16 '15 at 15:42

Not the answer you're looking for? Browse other questions tagged or ask your own question.