Using Union to prove a context-free language?

40 Views Asked by At

I am working through many examples and I seem to have confused myself and made all the questions rather trivial.

If I have the CFLs, $L_1 = \{1^n 0^{mn} : n,m \in \Bbb N\}$ and $L_2 = \{1^m 0^n : m,n \in N\}$.

Could I not use the union property and union it $L_1$ with $L_2$ to equal $L_2$? Then since $L_2$ is a context-free grammar then, then both $L_1$ and $L_2$ must be?

I feel like I have made and error and made it trivial. It seems like I can do this for everything now.

Thank you!

1

There are 1 best solutions below

2
On BEST ANSWER

That CFL is preserved under union means, if $L,M$ are CFL, so is $L \cup M$. But you are using this the other way -- if $M$ and $M \cup L$ are CFL, so $L$ must be as well. This is not true, as your counterexample illustrates.