2

$L=\{W_1W_2 \mid W_1 \ne W_2 \: \text{and} \: |W_1|=|W_2|\}$

Alphabet = { a , b }*

Considering L={WW} is not context free, shouldn't this be non context free as well? otherwise can you provide a machine or grammar which accepts this?

Richard Jones
  • 307
  • 3
  • 11
  • Cross-posted: https://cs.stackexchange.com/q/81708/755, https://math.stackexchange.com/q/2446349/14578. Please do not post the same question on multiple sites. Each community should have an honest shot at answering without anybody's time being wasted. – D.W. Sep 27 '17 at 00:57
  • @TeamBright please do not edit closed questions, if you add LaTeX support, the question gets bumped to reopen queue. After your edit the queston is still duplicate. – Evil Oct 12 '17 at 19:06

1 Answers1

0

This is a classical example of a context-free language whose complement is not context-free. It is context-free since every word in $w$ has the form $$ \Sigma^i a \Sigma^j \Sigma^i b \Sigma^j = \Sigma^i a \Sigma^i \Sigma^j b \Sigma^j $$ or the similar form with the locations of $a$ and $b$ switched.

Yuval Filmus
  • 276,994
  • 27
  • 311
  • 503