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

  • Thread starter Thread starter mathmari
  • Start date Start date
  • Tags Tags
    Language
Click For Summary
SUMMARY

The language $L=\{m^{(x)}: m$ is a symbol and $x$ is a perfect square$\}$ is proven to be non-context-free using the Pumping Lemma. By assuming $L$ is context-free, we derive a pumping length $p$ and analyze the string $s=m^{(p)}$. The argument demonstrates that for any integer $i$, the expression $p+i|vy|$ cannot consistently yield perfect squares, thereby violating the conditions of the Pumping Lemma. This conclusion is supported by high school algebra, establishing that not all terms in the arithmetic progression can be perfect squares.

PREREQUISITES
  • Understanding of the Pumping Lemma for context-free languages
  • Basic knowledge of perfect squares and arithmetic progressions
  • Familiarity with algebraic manipulation and integer properties
  • Concept of context-free languages in formal language theory
NEXT STEPS
  • Study the Pumping Lemma for context-free languages in detail
  • Explore examples of non-context-free languages and their proofs
  • Learn about algebraic properties of perfect squares
  • Investigate other methods to prove language non-context-freeness, such as closure properties
USEFUL FOR

Students and researchers in computer science, particularly those focusing on formal languages, automata theory, and computational complexity. This discussion is also beneficial for anyone studying the properties of context-free languages and their limitations.

mathmari
Gold Member
MHB
Messages
4,984
Reaction score
7
Hello! :o

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
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.
 
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$.
 
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.
 
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?
 
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.
 
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! :o
 

Similar threads

  • · Replies 13 ·
Replies
13
Views
4K
  • · Replies 16 ·
Replies
16
Views
5K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 15 ·
Replies
15
Views
4K
  • · Replies 14 ·
Replies
14
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K