{a^k,k is a prime is not contextfree}

  • Context: MHB 
  • Thread starter Thread starter evinda
  • Start date Start date
  • Tags Tags
    Prime
Click For Summary
SUMMARY

The language $L=\{a^{k},\text{ k is a prime }\}$ is proven to be non-context-free using the pumping lemma. The discussion highlights that if $p+i|vy|$ must remain a prime for all $i \geq 0$, then for $i=p$, the expression $p+p|vy|=p(1+|vy|)$ cannot be prime since it factors into two integers greater than one. This demonstrates that the conditions of the pumping lemma are violated, confirming that the language is not context-free. The conversation also emphasizes the importance of understanding the limitations of the pumping lemma in this context.

PREREQUISITES
  • Understanding of context-free languages
  • Familiarity with the pumping lemma for context-free languages
  • Basic knowledge of prime numbers and their properties
  • Ability to construct mathematical proofs
NEXT STEPS
  • Study the pumping lemma for context-free languages in detail
  • Explore the properties of prime numbers and their distribution
  • Learn about non-context-free languages and their characteristics
  • Investigate other proofs of non-context-freeness for different languages
USEFUL FOR

Students and researchers in theoretical computer science, particularly those focusing on formal languages, automata theory, and computational complexity.

evinda
Gold Member
MHB
Messages
3,741
Reaction score
0
Hi! :) I have to show that the language $L=\{a^{k},\text{ k is a prime }\}$ is not context-free..I thought that I could show this,using the pumping lemma.I took the word $s^{p}$,and said that if we add $i|vy|$ at the length of $s$,it must still belong in $L$..To show that it is not possible,I said:for i=|vy|,we have $p+i|vy|=p+|vy|^{2}=k$ ,if we take i=|vy|+1,we have $p+i|vy|=k+|vy|$.Some of the prime numbers are:2,3,5,7,11,13,... so we see that the difference of one prime number from the next one is greater or equal to one...So,if $p+(|vy|+1)|vy|$ was the next prime after $p+|vy|^{2}$,$|vy|$ should be greater than one,something that is not given from the pumping lemma.So,the first condition is not satisfied and so we conclude that the language is not contextfree...Could you tell me if I can explain it like that??
 
Technology news on Phys.org
evinda said:
so we see that the difference of one prime number from the next one is greater or equal to one...
What would be the alternative: that the difference between one prime number and the next one is zero? :D

evinda said:
So,if $p+(|vy|+1)|vy|$ was the next prime after $p+|vy|^{2}$,$|vy|$ should be greater than one,something that is not given from the pumping lemma.
In fact, it is given by the lemma; see point 2 here. More importantly, if the lemma does not state something explicitly, it does not follow that it is false.
 
Evgeny.Makarov said:
What would be the alternative: that the difference between one prime number and the next one is zero? :D

In fact, it is given by the lemma; see point 2 here. More importantly, if the lemma does not state something explicitly, it does not follow that it is false.

Ok,I understand...
 
The idea is to prove that an arithmetic progression cannot consists entirely of prime numbers. This requires a bit of ingenuity, but it is possible to construct a member of the progression that definitely factors into two numbers greater than one.
 
Evgeny.Makarov said:
The idea is to prove that an arithmetic progression cannot consists entirely of prime numbers. This requires a bit of ingenuity, but it is possible to construct a member of the progression that definitely factors into two numbers greater than one.

Could I show it maybe like that?

If we add $i|vy|$ at the length of $s$,it must still belong in $L$.
So $p+i|vy|$ must be a prime number for each $i \geq 0$. For $i=p$ we have $p+p|vy|=p(1+|vy|)$. $p$ is a prime greater than 1 and $|vy|>1$, so $ p(1+|vy|)$ is not a prime since it is written as a product of two factors greater than 1.
 
I think this works. Very well! But I have several remarks about the presentation.

evinda said:
I have to show that the language $L=\{a^{k},\text{ k is a prime }\}$ is not context-free..I thought that I could show this,using the pumping lemma.I took the word $s^{p}$
What is $s$ and what is $p$?

evinda said:
and said that if we add $i|vy|$ at the length of $s$
I don't understand the phrase "add ... at the length of ...".

evinda said:
So $p+i|vy|$ must be a prime number for each $i \geq 0$. For $i=p$ we have $p+p|vy|=p(1+|vy|)$. $p$ is a prime greater than 1
Why is $p$ prime? In fact, whether $p$ is prime is irrelevant for the rest of the proof.

evinda said:
and $|vy|>1$
The variant of the lemma from Wikipedia only says $|vy|\ge1$.
 
Evgeny.Makarov said:
I think this works. Very well! But I have several remarks about the presentation.

What is $s$ and what is $p$?

I don't understand the phrase "add ... at the length of ...".

Why is $p$ prime? In fact, whether $p$ is prime is irrelevant for the rest of the proof.

The variant of the lemma from Wikipedia only says $|vy|\ge1$.

Nice..thank you! :)
 

Similar threads

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