1

语言 L 不是上下文无关语言。

但是 L* 可以是上下文无关的语言吗?

4

1 回答 1

3

Yes, this is possible. As an example, consider the alphabet Σ = {1} and let L be the language { 1p | p is a prime number }. You can prove that this language is not context-free by using the pumping lemma.

However, the language L* is the set of all strings except for 1. The reason for this is that

  • ε ∈ L*, because ε ∈ N* for any language N.
  • 12 ∈ L* because 2 is prime.
  • 13 ∈ L* because 3 is prime.
  • 1n ∈ L* for any n ≥ 2, because you can start with either 12 or 13 and concatenate an appropriate number of copies of 12 to it.

This language is indeed context-free, and you can prove that by writing a grammar for it.

Hope this helps!

于 2013-10-09T21:05:31.720 回答