A Generalisation of "Cousin"

The term cousin has several meanings. In the first place it is used for the relationship between children of siblings: the child of your mother’s brother is your cousin. By analogy, we speak of second cousins, referring to the relationship between children of cousins, and of third cousins for that between children of second-cousins, and so on.

Thus we have a definition for the term nth-cousin when n ≥ 1. This raises the question: can we speak of a zeroth-cousin, i.e. a cousin where n = 0? But to answer this question we must first answer: What is n?

This brief article offers an interesting answer to these questions; an answer which, if nothing else, I find very satisfying. If you have never thought about these questions, I would encourage you to stop reading at this point and come up with your own answers first, because

Trying to solve [a problem] on your own seems the only way in which you can assess how difficult the problem is; it gives you the opportunity to compare your own solution with mine; and it may give you the satisfaction of having discovered yourself a solution that is superior to mine.
Dijkstra, A Discipline of Programming.

Read More

What I Learned Implementing Lex

Compiler construction is at the heart of computer science. As I continue to make my way, if very slowly, though The Dragon Book, it is becoming absolutely clear to me that some things cannot be understood without building them. What Halmos stated so strikingly about mathematics is applicable here:

The only way to learn mathematics is to do mathematics […] The right way to read mathematics is first to read the definitions of the concepts and the statements of the theorems, and then, putting the book aside, to try to discover the appropriate proofs. If the theorems are not trivial, the attempt might fail, but it is likely to be instructive just the same. To the passive reader a routine computation and a miracle of ingenuity come with equal ease, and later, when he must depend on himself, he will find that they went as easily as they came. The active reader, who has found out what does not work, is in a much better position to understand the reason for the success of the author’s method, and, later, to find answers that are not in books. — Paul Halmos, A Hilbert Space Problem Book.

Read More