# Mapping letters to the natural numbers

It’s the end of the fall semester, and I have one last final exam problem to grade for the semantics class I’m TAing for. Actually, it’s the first problem on the exam, but I saved it till last because nearly every student seems to have gotten it totally wrong. Which is surprising, given that the problem revolves around one of the first concepts the students learned, a concept that is central to formal semantics: generating and interpreting expressions in some suitable way. What’s more, they even saw the converse (so to speak) of this problem on the midterm.

The problem says to use the symbols , , , , and to generate a set of expressions that denote all and only the natural numbers (i.e., the set of non-negative integers) and to do so without any natural number being named more than once. In other words, provide syntactic formation rules for generating infinitely many expressions from just those five letters, and provide semantic valuation rules for mapping those expressions onto the natural numbers, such that each expression corresponds to exactly one natural number, and each natural number is the correspondent of exactly one expression, i.e., an isomorphism between the set of -expressions and the set of natural numbers. (The problem on the midterm was the converse: to decide whether the set of expressions formed, in some given way, from the four letters , , , and were, under some given valuation rules, isomorphic to the natural numbers.)

The spirit of the problem, I think, is to use all and only the (mutually distinct) letters , , , , and . However, in principle the problem can be solved using just one letter.

For example, let . Then we can generate an infinite set of expressions with the following recursive formation rules.

- .
- If , then .
- Nothing else is a member of .

Rule 2 is essentially a suffixation rule. Thus, contains the expressions , , , etc., where we suffix a single to any already well-formed expression to generate a new well-formed expression. We can interpret these expressions with the following valuation rules.

- .
- If , then .

Thus, for example, we have the following valuations.

And in general, , where is shorthand for the expression consisting of exactly occurrences of . Clearly, these valuation rules make the set isomorphic to the set of natural numbers: each expression in correpsonds to exactly one natural number, and each natural number is in turn the correspondent of (is expressible by) exactly one expression in .

But this language isn’t all that interesting. More interesting are the languages formed from two or more letters. For example, let and consider the following formation rules.

- If , then .
- If , , , then .
- Nothing else is a member of .

Again, rule 2 is a suffixation rule, with the stipulation that nothing can be suffixed to . (We’ll see why in a moment.) Thus, contains the expressions , , , , , , etc., but does not contain the expressions , , , etc. The reason for excluding these latter expressions should become clear from the following valuation rules.

- and .
- If , , , then .

Since , if were a well-formed expression, i.e., if the condition “” were removed, then the valuation of would be the same as that of . That is, the valuation rules would fail to make isomorphic to the set of natural numbers because there would be at least one natural number, namely , that has more than one correspondent in . ( would be expressible by more than one -expression.)

Continuing on, we have the following valuations.

This language, and its interpretation, should look familiar: it’s binary, except we’ve replaced with and with . The following table shows the expressions of , the corresponding expressions in binary, and the corresponding expressions in decimal; and of course by “corresponding” expressions we mean expressions whose valuations are the same natural number.

From here it’s easy to see that the solution to the problem, with , amounts to devising a base-5 language. I won’t write down the answer here, just in case some student stumbles on this post, but extending the binary, or two-letter, case is pretty straightforward.