Find a context-sensitive grammar for language $L = \left\{ww \mid w \in \left\{a,b\right\}^* \right\}$ where $L \in DCSL \setminus CFL$.
I find this task from old exam but there is no solution. I try for solve it for practice, I needed many hour for my solution I write here but I don't think it works.. But I think I almost have it!
So my start symbol is $S \rightarrow AC, BX \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,$ $AC$ end with $a$ and $BC$ end with $b$
$A \rightarrow aAY, bAZ, a\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,$ Create $a$ on the left side
$B \rightarrow aBY, bBZ, b\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,$ Create $b$ on the left side
$YC \rightarrow aC$
$YX \rightarrow aX$
$ZC \rightarrow bC$
$ZX \rightarrow bX$
$C \rightarrow a$
$X \rightarrow b$
$Ya \rightarrow aY$
$Yb \rightarrow bY$
$Za \rightarrow aZ$
$Zb \rightarrow bZ$
Here we want make sure we move everything to the right so we get the same word.
For example I don't get the wordd $aabbaabb$ and there are some ways so my grammar don't even end.. I mean there are some non terminals left but you can't continue. I hope you can say how do this correct because I don't find it and I try it many hours and I think I have it correct almost..
I also try to make grammar where you make same word twice and sort the second but didn't work either.