O'Reilly logo

Theory of Computation by George Tourlakis

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

4.4  NON CONTEXT FREE LANGUAGES; ANOTHER PUMPING LEMMA

In this section we prove a pumping lemma for CFL that is similar, but as expected from the richer structure of the PDA, more complex than the one for regular languages. We will benefit in our proof from the concept of parse tree for a CFG. The reader has most likely encountered trees in courses on discrete mathematics, data structures, etc. A tree is a structure like the one drawn below:

images

Since by default all edges point “downwards”, one does not need to emphasize so by drawing them as arrows. The round nodes may or may not have names. Our parse trees will have all their nodes named. The precise angle or slope of the edges does not matter—meaning, we allow variation in drawings without changing the tree we want to depict. However, left to right order matters, thus the following is a different tree from the one above. Our trees are ordered.

images

Of course, the reader has encountered many aspects of discrete mathematics before, but this did not stop me from reintroducing some such concepts in Chapter 1. So, let us revisit the definition of trees. A tree has both a “data” component (the node “contents”, whatever they may be) and a structural component or geometry, that is, how the nodes are interconnected. This motivates us to opt for ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required