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

  • MHB
  • Thread starter evinda
  • Start date
  • Tags
    Prime
In summary, the conversation discusses a proof that the language $L=\{a^{k},\text{ k is a prime }\}$ is not context-free. The proof uses the pumping lemma and shows that if we add $i|vy|$ at the length of $s$, it must still belong in $L$. However, this is not possible because the difference between one prime number and the next one is greater than or equal to one. The conversation also discusses an alternative approach to proving this, which involves showing that an arithmetic progression cannot consist entirely of prime numbers.
  • #1
evinda
Gold Member
MHB
3,836
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
  • #2
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.
 
  • #3
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...
 
  • #4
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.
 
  • #5
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.
 
  • #6
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$.
 
  • #7
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! :)
 

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

1. What is the statement "{a^k, k is a prime} is not context-free?"

The statement means that the language consisting of strings of the form a^k, where k is a prime number, is not a context-free language. This means that it cannot be recognized by a pushdown automaton or described by a context-free grammar.

2. What is a context-free language?

A context-free language is a type of formal language that can be described by a context-free grammar. It is a subset of the more general class of formal languages known as recursively enumerable languages.

3. What is a pushdown automaton?

A pushdown automaton is a type of finite automaton that has an added stack memory. It is used to recognize context-free languages by keeping track of previously read symbols and making decisions based on them.

4. How is it proven that "{a^k, k is a prime} is not context-free?"

This is proven using the pumping lemma for context-free languages. This lemma states that for any context-free language L, there exists a constant n such that any string in L with length greater than n can be divided into five parts, uvxyz, where |vxy| ≤ n, and that for any i ≥ 0, the string uv^ixy^iz is also in L. By applying this lemma to the language {a^k, k is a prime}, it can be shown that it does not satisfy the conditions, proving that it is not context-free.

5. What are some examples of other languages that are not context-free?

Other examples of languages that are not context-free include the language of palindromes, the language of balanced parentheses, and the language of even-length palindromes over the alphabet {a, b}. These languages can be proven to be not context-free using various methods, such as the pumping lemma or the closure properties of context-free languages.

Similar threads

Back
Top