6,957 views
9 9 votes
Show that the language L={xy∣|x|=|y|,x≠y} is context free. Do not give links plz explain in simple manner

2 Answers

12 12 votes
we can take it as wwr .

where x=w

and y=wr so |x|=|y| and it is cfl.
2 2 votes

Can use non-determinism of PDA's to give a simple argument.

Non-deterministically compare 2 positions $\frac n2$ distance apart, if match not found, accept.

Proof is likewise. Only thing reamins in proof is to come up with a way to compare 2 characters $\frac n2$ distance apart.
That can be achieved by pushing some portion (let say length x) on stack, then emptying the stack and store the input symbol in finite automation when stack gets empty.
Once empty, push some portion (let say length y) on stack, then compare current input symbol with symbol in finite automation.
If symbol matches, then branch is discarded, If symbol doesn't match we pop the remaining contents of the stack,
if stack is empty at the end of input, string is accepted, otherwise branch is rejected.
If all branches are rejected, we reject the string.

Position:
Show:

Related questions

0 0 votes
0 0 answers
164
164 views
lambodar_pal asked Jul 27
164 views
The intersection of a context free language and a regular languagea)need not be regularb)need not be context freec) is always regulard) is always context free  
1 1 vote
0 0 answers
437
437 views
dazeeee asked Apr 3, 2024
437 views
Give a context-free grammar for each of the following languages. Consider, Σ={0,1}.A. The language of strings that start with 1B. The language of strings of the form WWR ...
1 1 vote
1 1 answer
737
737 views
practicalmetal asked Mar 20, 2023
737 views
The complement of the languages:i) {ww | w in (0+1)*}ii) {$a^n b^nc^n$ | n>1} area) Context Free b) Not Context Free c)are DCFL’s d)None