Infinite CFLs and Another Pumping Theorem
Explore infinite context-free languages and build up to the pumping theorem from infinite CFLs.
We'll cover the following...
Intuitive reasoning behind the pumping theorem for CFLs
Now that we know how to determine if a context-free grammar generates an infinite language, let’s look a little closer at such languages. Suppose is a recursive variable in some CFG. Beginning with the start variable until the time first appears in a working derivation, symbols will have accumulated around . Look at the CFG below and the following derivation:
We’ll denote the prefix by and the last by so we have so far. Now we continue substituting until is repeated:
We have picked up and around , giving us:
We can make the same choices we made previously between the occurrences of to arrive at again, giving us:
In general, with any recursive variable, we can derive this:
Eventually, we must terminate. We denote our terminating choices with , finally arriving at . In this instance, we can use the rule and ending with the string , where . We could also go right to the terminal rules, avoiding generating and in the first place, by letting , which is the derivation:
Since ...