0

Im trying to prove that $L=\{w\#s : |w|=|s|, w \neq s\} \notin CFL$ using the pumping lemma. So I said, let say $L \in CFL$ so by the pumping exists $p$ which is the pumping length of language $L$, I think $ s = 0^{m}1^{p}\#1^{m}0^{p} \in L$ would be a good word to start with, I can write $s = uvxyz$ and i want $uv^{i}xy^{i}z\notin L$ i want somehow to force the new word to Not contain $'\#'$ or $|w|\neq |s|$. The first option could be achived if ill make sure $'\# \in v\cup y$ and ill just choose $i=0$. And for the second option, i want to force $|v|\neq |y|$ and then for every $i$ it will be good.

But i cant see how to analyize the word fulfills the requirements.

Edit:

I think it isnt a duplicate question, This language isnt context free as mention in the comments.

The $"\#"$ char is the thing that make the difference between the language that was suggested as a duplicate post.

I've succsed to prove it by the pumping lemma when choosing the word $w = 0^{p!+p}1^{p}\#0^{p}1^{p!+p}$ and $i=1+\frac{p!}{t}$ to pump with in the non trivial part where $w=uvxyz$ is the partition and $|v|=|y|, v\subseteq w $ and $ y\subseteq s$ , this way ill get that $uv^{i}xy^{i}z=w\#s$ where $w=s$

Full proof : (more rigorous proof to this question than mine)

Assume by way of contradiction that $L ∈ CFL$. Let $p > 0$ be the pumping constant for $L$ guaranteed by the pumping lemma for context-free languages. We consider the word $s = 0^{m}1^{p}\#0^{p}1^{m}$ where $m=p!+p$ so $s ∈ L$. Since $|s| > p$, according to the pumping lemma there exists a representation $s = uvxyz$, such that $|vy| > 0$, $|vxy| ≤ p$ , and $uv^{j}xy^{j} z ∈ L$ for each $j ≥ 0$.

We get a contradiction by cases:

  • If $v$ or $y$ contain $\#$: Then for $i = 0$, we get that $uxz$ does not contain $\#$, so $uxz \notin L$ in contradiction.
  • If both $v$ and $y$ are left to $\#$: Then for $i = 0$, we get that $uxz$ is of the form $w\#x$, where $|w| < |x|$, so $uxz \notin L$.

  • If both $v$ and $y$ are right to $\#$: Similar to the last case.

  • If $v$ is left to $\#$, $y$ is right to it, and $|v| < |y|$: Then for $i = 0$, we get that $uxz$ is of the form $w\#x$, where $|w| > |x|$, so $uxz \notin L$.

  • If $v$ is left to $\#$, $y$ is right to it, and $|v| > |y|$: Similar to the last case.

  • If $v$ is left to $\#$, $y$ is right to it, and $|v| = |y|$: This is the most interesting case. Since $|vxy| ≤ p$, $v$ must be contained in the $1^{p}$ part of $s$, and $y$ in the $0^{p}$ part. So it holds that $v = 1^{k}$ and $y = 0^{k}$ for the same $1 ≤ k ≤ p$ (in fact, it must be that $k < p/2$). For each $j ≥ 0$, it holds that $uv^{j+1}xy^{j+1}z = 0^{m}1^{p+j·k}\#0^{p+j·k}1^{m}$, so if it happens that $m = p + j · k$, then it holds that $uv^{j+1}xy^{j+1}z \notin L$ in contradiction. To achieve this, we must take $j = (m-p)/k$, which is valid only if $m − p$ is divisible by $k$. Recall that we chose $m = p + p!$, so $m − p = p!$, and $p!$ is divisible by any $1 ≤ k ≤ p$ as wanted.

limitless
  • 266
  • 1
  • 2
  • 8
  • 1
    what kind of strings are $m$ and $s$? If $m, s \in {0,1}^*$ I think it will be impossible to prove that this language is not context free. – abc Apr 08 '17 at 14:16
  • @newbie You are right $m,s \in {0,1}^{*}$ i forgot to say it. – limitless Apr 08 '17 at 14:37
  • The L from the title or the L from the text? Hint: both are context-free. – Raphael Apr 08 '17 at 15:13
  • This is a nice, but fairly standard exercise, and one we've covered before. I'm linking you the duplicates, but I suggest you honestly try to solve it yourself. It's very good problem! – Raphael Apr 08 '17 at 15:22
  • @Raphael This language isnt context free just because the $"#"$. That is what my professor said. And i also think i succsed to prove it by the pumping lemma, when choosing the word $w=0^{p!+p}1^{p}#0^{p}1^{p!+p}$ and $ i=1+\frac{p!}{t}$ for the not trivial part of the $uvxyz $ paration, I think you should remove the duplicate tag.. – limitless Apr 28 '17 at 19:52
  • @limitless CFL is closed against inverse homomorphism, so it's clear that if the language without $#$ is context-free, then so it the one with $#$. So your professor is correct: the separator does not matter. (It only makes the proof a little easier.) Your proof must be wrong. (I suspect you're playing the game wrong; you don't get to pick the partition! See also here. We can always pump if $x = #$ and $|v| = |y|$.) – Raphael Apr 29 '17 at 08:03
  • Im not picking the partition. Im checking every possible paratition according the the choosen word. I'll upload my proof soon. – limitless Apr 29 '17 at 08:08
  • @Raphael I've uploaded a proof to this question. – limitless Apr 29 '17 at 14:43
  • 1
    So we have a proof that the language is context-free, and one for that it is not. One must be wrong. – Raphael Apr 29 '17 at 15:28
  • @Raphael We dont have a proof that the lanuage is context free. We have a proof that a really close looking language is context free :) I think this post sould not be marked as duplicate. – limitless Apr 29 '17 at 16:07
  • As I wrote above, use closure against inverse homomorphism. Let the language here be called $L$, and the one from the duplicate $L'$. Clearly, $L' = f(L)$ for $f : {0,1,#} \to {0,1}$ with $f(0) = 0$, $f(1)=1$, $f(#) = \varepsilon$. Hence, since $L'$ is context-free, so is $L$. q.e.d. (I'd say that is a neat proof, even!) – Raphael Apr 29 '17 at 17:13
  • There's also the automaton (sketch) given here. – Raphael Apr 29 '17 at 17:23
  • But, alas, I can't find the flaw in your proof (attempt). I'm out of shape, apparently. – Raphael Apr 29 '17 at 17:24
  • @Raphael Well, Im not familiar with inverse homomorphism on CFL i'll check your proof later with some help.But the link for the automaton above is for a language that isnt require $|x|=|y|$ such as L in this question – limitless Apr 29 '17 at 17:26
  • @limitless Come on, you have to give the opposite claim the same amount of brainpower. Checking that condition is child's play for a (N)PDA. It's even explained in the question! – Raphael Apr 29 '17 at 17:28
  • Boy, was I off the mark. Sorry for the confusion! I think the newer question is the better one, so I'm leaving this one closed. I rerouted the duplicate, though; it points to the new question now. – Raphael Apr 30 '17 at 11:10

0 Answers0