Show that contextfree languages are closed under concatenati

Show that context-free languages are closed under concatenation. That is, if L1 and L2 are both context free, then L1L2 = {xw | x L1 and w L2} is also context free.

Solution

We know that every context free language has a context free grammer. Let us say G1 is CFG for L1 and G2 for L2. Let S1 be start for G1 and S2 for G2. We create a new CFG and a create a new start S, and a new rule saying S -> S1S2. This rule combined with all other rules from G1 and G2 will form a new CFG. This represents all the words which are concantenation of L1L2. As we are able to form a CFG for the concatenation, it is a CFL.

Show that context-free languages are closed under concatenation. That is, if L1 and L2 are both context free, then L1L2 = {xw | x L1 and w L2} is also context f

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site