Closure properties of context free languages

前端 未结 2 1898
我寻月下人不归
我寻月下人不归 2021-01-25 04:14

I have the following problem:

Languages L1 = {a^n * b^n : n>=0} and L2 = {b^n * a^n : n>=0} are context free languages so they are closed under the L1L2

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-25 04:29

    I'm not sure that it is -- note that in each of the defintions of L1 and L2, n is scoped within that definition, i.e. they are two different variables. When you combine them you should rename one, and get instead:

    L = {a^n * b^n b^m * a^m : n,m>=0}
    

    This is a very different language from your L, but it is obviously a context free one.

提交回复
热议问题