edited by
412 views
0 votes
0 votes
L={$a^nb^n | n\geq 0$}
please show how $L^2$ is CFL
edited by

1 Answer

Best answer
2 votes
2 votes

L = {a$^n$.b$^n$} = {ab,aabb,aaabbb,aaaabbbb,.....}

L$^2$ = L . L =$ \color{red}{\{\text{ab,aabb,aaabbb,aaaabbbb,.....}\}} . \color{Magenta}{ \{\text{ ab,aabb,aaabbb,aaaabbbb,.....}\}}$

= $\{\color{red}{\text{ab}}\color{magenta}{\text{ab}},\color{red}{\text{ab}}\color{magenta}{\text{aabb}},\color{red}{\text{ab}}\color{magenta}{\text{aaabbb}},\color{red}{\text{ab}}\color{magenta}{\text{aaaabbbb}},\color{red}{\text{ab}}\color{magenta}{\text{aaaaabbbbb}},......\color{red}{\text{aabb}}\color{magenta}{\text{ab}},\color{red}{\text{aabb}}\color{magenta}{\text{aabb}},\color{red}{\text{aabb}}\color{magenta}{\text{aaabbb}},\color{red}{\text{aabb}}\color{magenta}{\text{aaaabbbb}},\color{red}{\text{aabb}}\color{magenta}{\text{aaaaabbbbb}},......\}$

L$^2$ = ${\{\color{red}{\text{a}^p\text{b}^p}\color{magenta}{\text{a}^q\text{b}^q} | \;p >0 , \;q>0\}}$

Now, we must be already knowing that we can draw a PDA for it, 

How ?

first input p a's and pop using all b's , then if stack is empty or has Z$_0$

then  we can push q a's and then pop using all b's 

selected by

Related questions

1 votes
1 votes
1 answer
1