Question: Given a string w, a string u is a prefix of w if and only if v, w = uv. Therefore, un is a prefix
Given a string w, a string u is a prefix of w if and only if v, w = uv. Therefore, un is a prefix of the word unhappy. Given a language L, Lpre = {u | w L, and u is a prefix of w}. Show that if L is a context free language, then Lpre is also context free.
Hint: The most elegant way to do this is to use recursive constructions. Given a context free language L, think of proving Lrev, the reverse of strings in the language to be context free. You can apply similar ideas for constructing Lpre.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
