1

So, let's say we have two languages $L$ (which is any context-free language) and $M$ which is the basic CFL $\{0^n1^n: n\geq 0\}$.

Can $L \le_p M$ ? Why or why not? How do polynomial time reductions even work with CFLs in general?

David Richerby
  • 81,689
  • 26
  • 141
  • 235
Trap123
  • 13
  • 2

1 Answers1

2

Since context-free languages are in P and $M$ is non-trivial, there is an easy polynomial time reduction from every context-free language $L$ to $M$. The reduction decides whether the input is in $L$ or not, and according to that outputs either $\epsilon$ or $0$, say.

Yuval Filmus
  • 276,994
  • 27
  • 311
  • 503
  • trivial languages can be a context-free language. Therefore the reduction will fail if L is the empty language – ParoX Dec 06 '14 at 21:31
  • No it won't. In that case the reduction would just be a constant function. – Yuval Filmus Dec 06 '14 at 22:09
  • As I understand it, The reduction stated here wouldn't work though, because it relies on weather an input is in L or not, in the case of the empty language it would always return that the input was not in the language and be useless. I guess my point was that there is a specific instance where this particular reduction doesn't work – ParoX Dec 06 '14 at 22:19
  • I think you're wrong. It's only important that $M$ be nontrivial. – Yuval Filmus Dec 06 '14 at 22:20