In: Computer Science
Given two languages A and B, let A/B denote the language
{w | w x ∈ A for some x ∈ B}.
Show that if A is a context-free language and B is a regular language, then A/B is a context-free
language. hint (construct PDAs)
Here we are given two languages
A : Context Free Language
B: Regular Language
And A/B denotes the language as {w | w x ∈ A for some x ∈ B}
We need to prove that A/B is context free.
Let M be PDA for A and N be DFA for B.
Let's consider that we want to show that if a string wx is accepted by a CGF, then we know that x will by default be accepted by regular language and thus is also accepted by CFG.And now we will prove it by contradiction. Assuming that A is CFG , B is regular but A/B is not CFG.
First we will construct a PDA for A/B by modifying M so that it can run parallely for this we can use cartesian product. To build PDA for A/B we have 2 steps:
Step 1: read i/p word x and advance it in M and ignore state of N. This will be for word w of language.
Step 2: after reaching the end of w we can perform epsilon transitions in order to reach an accepting state of cartesian product i.e. M x N. The word x will be assumed to continue to advance in M and also start to advance in N and that has to reach acceptance in both M and N automata simultaneously. In simple words You can say that from this point the machine gusses a string x and processes x by both M and N.
The machine will accept only if both mahines simultaneously accepts it.
From the below diagram you can easily understand the realtion between different types of languages.