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.

1 Answer 1



  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\}$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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