Computer Science Stack Exchange is a question and answer site for students, researchers and practitioners of computer science. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to study for an exam and having difficulty with the following practice questions. Any help would be appreciated.

  1. Give a language $L$ such that $L$ is not recursive but $\text{prefix}(L)$ is regular.
  2. Give two languages $L_1$ and $L_2$, such that $L_1$ and $L_2$ are not recursive, but $L_1\cap L_2$ is recursive.
  3. Give a language $L$ such that $L$ is regular but $\text{unary}(L)$ is not context-free.
share|cite|improve this question


  1. Any (infinite) unary language has regular prefix language.

  2. $L_1 = a \cdot K$ and similary $L_2 = b \cdot K$ where $K$ is a well-chosen horrible language.


What is unary($L$)? If it is what I think, there is an easy example. Powers of two are not context-free: $\{ a^{2^n} \mid n\ge 1\}$.

share|cite|improve this answer
The tips were helpful. Thanks – San Nov 28 '12 at 1:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.