Question 4 (2006)
So L
1 and L
2 could be describe as follows.
The language L
1 S -> L
The language L
2 S -> L
Now take all nonterminals in L
1 and append a subscript 1 and
take all nonterminals in L
2 and append a subscript 2
So you get
S
1 -> L
1 and
S
2 -> L
2
Now create a new CFG of the combined languages and add the line
S -> S
1S
2
Obviously the languages have not been changed by the additional sub script, and no duplicate nonterminals have been created. The CFL create by S
1 followed by the CFL S
2 is still context free, therefore the product of two CFL's is context free/closed.
Now proof that the CFG is still correct (will fill later):
1) All words in L
1L
2 can be generated by S
2) S generates all words in L
1L
2