Let $L$ be context free and $\Sigma $ an alphabet
Define $s(L):=\{y \in \Sigma ^*\mid \exists x,z \in \Sigma ^*: xyz \in L\}$
Is $s(L)$ context free ?
I haven't been able to find a counterexample so im thinking i have to prove it.
I was trying to use the closure properties. $s(L)$ obviously contains $L$ so maybe i can write $s(L)$ as the union of several context free languages.
Could i please get some help, im stuck.
Hint: given a CFG grammar $G$ for $L$, construct a grammar $G'$ that generates all possible substrings.
This involves adding a lot of rules that start in the middle of an original rule, followed by adding a lot of possible suffixes for each rule. It is a bit tricky to get correct, but definitely possible.