Show that the language is not context-free with the Pumping Lemma

  • MHB
  • Thread starter mathmari
  • Start date
  • Tags
    Language
In summary, the language L is not context-free. There is a pumping length $p$, and conditions of the pumping lemma are satisfied. To show that $p+i|vy|$ is not a perfect square for any $i$, I have thought the following: for $i=0$: p is a perfect squarefor $i>0$: Since p is a perfect square, $p=w^2$. If $p+i|vy|$ is also a perfect square, then $w^2+i|vy|=n^2$ $\Rightarrow$ $i|vy|=n^2-w^2$ $\Rightarrow$ $i=\frac{
  • #1
mathmari
Gold Member
MHB
5,049
7
Hello! :eek:

Given the language $L$=$\{m^{(x)}: m$ is a symbol and $x$ is a perfect square$\}$, I have to show that L is not context-free using the Pumping Lemma.

First, we assume that L is context-free. So, from the pumping lemma there is a pumping length $p$. Let $s=m^{(p)}$, that can be divided into $uvxyz$.

How can I continue? How can I find something so that I can conclude that one of the conditions of Pumping Lemma is not satisfied?
Conditions of Pumping Lemma:
1) $ \forall i\geq 0$ $uv^ixy^iz$ $\epsilon$ $L$
2) $ |vy|>0$
3) $|vxy| \leq p$
 
Technology news on Phys.org
  • #2
mathmari said:
How can I continue? How can I find something so that I can conclude that one of the conditions of Pumping Lemma is not satisfied?
Conditions of Pumping Lemma:
1) $ \forall i\geq 0$ $uv^ixy^iz$ $\epsilon$ $L$
2) $ |vy|>0$
3) $|vxy| \leq p$
This fact requires the simplest version of the pumping lemma, where $|vxy| \leq p$ is not mentioned. The most important thing is that $uv^ixy^iz\in L$ and $|vy|>0$. That is, you can add $i|vy|$ to the length of $s$ for any $i\in\mathbb{N}$ and still stay in the language. Since $s\in L$, $p$ is a perfect square. Then so is $p+i|vy|$ for any $i$. You just need to show that such arithmetic progression cannot consists of perfect squares only. This fact can be proved using high school algebra.
 
  • #3
Evgeny.Makarov said:
This fact requires the simplest version of the pumping lemma, where $|vxy| \leq p$ is not mentioned. The most important thing is that $uv^ixy^iz\in L$ and $|vy|>0$. That is, you can add $i|vy|$ to the length of $s$ for any $i\in\mathbb{N}$ and still stay in the language. Since $s\in L$, $p$ is a perfect square. Then so is $p+i|vy|$ for any $i$. You just need to show that such arithmetic progression cannot consists of perfect squares only. This fact can be proved using high school algebra.

I got it!
To show that $p+i|vy|$ is not a perfect square for any $i$, I have thought the following:
for $i=0$: p is a perfect square
for $i>0$: Since p is a perfect square, $p=w^2$. If $p+i|vy|$ is also a perfect square, then $w^2+i|vy|=n^2$ $\Rightarrow$ $i|vy|=n^2-w^2$ $\Rightarrow$ $i=\frac{n^2-w^2}{|vy|}$, but that is not always a number in $\mathbb{N}$. So, $p+i|vy|$ is not a perfect square for any $i$.
 
  • #4
mathmari said:
To show that $p+i|vy|$ is not a perfect square for any $i$
Out of context, I would interpret this as saying that for all $i$, the number $p+i|vy|$ is not a perfect square (which does not have to be true). It's better to say, "$p+i|vy|$ is not a perfect square for some $i$" or "$p+i|vy|$ cannot a perfect square for all $i$".

mathmari said:
I have thought the following:
for $i=0$: p is a perfect square
for $i>0$: Since p is a perfect square, $p=w^2$. If $p+i|vy|$ is also a perfect square, then $w^2+i|vy|=n^2$ $\Rightarrow$ $i|vy|=n^2-w^2$ $\Rightarrow$ $i=\frac{n^2-w^2}{|vy|}$, but that is not always a number in $\mathbb{N}$.
The last sentence is true, but it is not obvious at the level we are working here. (Of course if this were the remaining step to prove Fermat's last theorem, we could say that it is obvious.) I would recommend making this argument more detailed.
 
  • #5
Evgeny.Makarov said:
Out of context, I would interpret this as saying that for all $i$, the number $p+i|vy|$ is not a perfect square (which does not have to be true). It's better to say, "$p+i|vy|$ is not a perfect square for some $i$" or "$p+i|vy|$ cannot a perfect square for all $i$".

The last sentence is true, but it is not obvious at the level we are working here. (Of course if this were the remaining step to prove Fermat's last theorem, we could say that it is obvious.) I would recommend making this argument more detailed.

How could I make it more detailed?
 
  • #6
Here is one way. Let $a,d$ be positive integers. It is sufficient to prove that an arithmetic progression $a+kd$, $k\in\mathbb{N}$, cannot consist exclusively of perfect squares. Take $k=d$ and suppose that $a+kd=a+d^2=n^2$ for some positive integer $n$. Then $n>d$, so $(n+1)^2-n^2=2n+1>2d+1>d$. That is, the next perfect square is greater than $a+(k+1)d$, which, therefore, cannot be a perfect square.
 
  • #7
Evgeny.Makarov said:
Here is one way. Let $a,d$ be positive integers. It is sufficient to prove that an arithmetic progression $a+kd$, $k\in\mathbb{N}$, cannot consist exclusively of perfect squares. Take $k=d$ and suppose that $a+kd=a+d^2=n^2$ for some positive integer $n$. Then $n>d$, so $(n+1)^2-n^2=2n+1>2d+1>d$. That is, the next perfect square is greater than $a+(k+1)d$, which, therefore, cannot be a perfect square.

Thanks a lot! :eek:
 

Related to Show that the language is not context-free with the Pumping Lemma

1. What is the Pumping Lemma?

The Pumping Lemma is a tool used in formal language theory to prove that a language is not context-free. It states that if a language is context-free, then there exists a constant number (called the "pumping length") where any string in the language longer than that length can be "pumped" or divided into smaller segments in a way that still satisfies the rules of the language.

2. How is the Pumping Lemma used to show that a language is not context-free?

In order to show that a language is not context-free using the Pumping Lemma, we must prove that for any given pumping length, there exists a string in the language longer than that length which cannot be pumped. This means that the string either contains a violation of the rules of the language or cannot be divided into smaller segments while still satisfying the rules.

3. Can the Pumping Lemma be used to prove that a language is context-free?

No, the Pumping Lemma can only be used to prove that a language is not context-free. It is possible for a language to be context-free without satisfying the conditions of the Pumping Lemma.

4. What are the limitations of the Pumping Lemma?

The Pumping Lemma can only be used to prove that a language is not context-free. It cannot be used to prove that a language is context-free or to prove that a language is not in another class of formal languages, such as regular or recursively enumerable. Additionally, the pumping length must be manually determined and may vary for different languages.

5. Are there any other methods for showing that a language is not context-free?

Yes, there are other methods such as using closure properties or constructing a context-free grammar for the language. However, the Pumping Lemma is often the most straightforward and widely used method for proving that a language is not context-free.

Similar threads

  • Programming and Computer Science
Replies
13
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
16
Views
5K
  • Programming and Computer Science
Replies
6
Views
2K
  • Differential Equations
Replies
5
Views
981
  • Calculus and Beyond Homework Help
Replies
2
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Programming and Computer Science
Replies
2
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Programming and Computer Science
Replies
15
Views
3K
Back
Top