Araara a — Araara

Share
Araara a — Araara
A trevally

For an introduction to the project, read Araara o — Introduction.


In what follows, text written in Araara, the object language, appears in color; English, the metalanguage, remains unmarked or within single quotation marks.


Consider the English alphabet:

abcdefghijklmnopqrstuvwxyz
All 26 English letters in uppercase and lowercase pairs, from A a to Z z, arranged in four rows over peach, yellow, green, and blue pastel washes.
The English alphabet

It has twenty-six letters, each with an uppercase and a lowercase form. For now, let's focus on the lowercase letters, or minuscules. The choice of alphabet is arbitrary, and we won't stick with English for long. Its familiarity makes it a useful starting point.

As promised, we begin by defining integers in Araara. Each letter will have a fixed integer value. By concatenating letters, we can represent integers of any size.

We will call this type Ashort, after the short integer data type in C. This may be a bit of a misnomer: a typical 16-bit signed C short cannot represent integers greater than 32,767, but Ashort can express any integer. In practice, however, its expressions can become unwieldy for large numbers, because we eventually have to repeat the largest letters many times.

So let's define one!

a : Ashort

declares that a has type Ashort. But what value does it have? We will declare it to have the value

a = 1.

It is important to mention here that only the colored parts of these expressions are valid Araara! To say that a is equal to one simply means to interpret it in our metalanguage, English. That this particular Ashort term has a value of one, while correct, does not exhaust its meaning: it is not just one.

Letters and values

We haven't achieved a lot so far. Twenty-five letters don't yet have a value, and the one letter with a value, a, is just one! So, all right, let's continue. But how?

We arrange the letters in pairs: a and b, c and d, and so on. The first letter of each pair has a positive value; the second has the opposite, negative value.

We have seen that a = 1. Because it is paired with b, this must mean that

b = -1.

Indeed it is. Now what about c and d? Simple: to compute the value of c, we multiply the value of a by three and subtract one. Thus,

c = a * 3 - 1 = 1 * 3 - 1 = 2
d = -c = -2

Repeating this gives e = 5 and f = −5, and so on. More precisely, if we write aₙ for the value of the nth letter in the English alphabet, the following recurrence gives all twenty-six values (1 ≤ n ≤ 26):

Recurrence relation: a sub n equals 1 if n equals 1; negative a sub (n minus 1) if n is even; and negative 3 times a sub (n minus 1), minus 1, otherwise.

Adding by concatenation

To concatenate letters means to add them. For example:

abc = a + b + c = 1 - 1 + 2 = 2

We could also write two as c or aa. Their numerical values agree, although the written expressions differ. This will be quite important later on!

If you like exercises, you can find some below that explore the consequences of representing integers as Ashort. They are best answered with pen and paper (and by consulting the OEIS for the second exercise). Feel free to skip them, though, and go straight to the next installment.

Exercises

  1. Continue the calculation through the first ten letters. What are the values of g, h, i, and j?
  2. Which OEIS sequence do we get for odd n? Find a closed-form expression for aₙ when n is even.
  3. What is the value of m? Does this number have any particular significance?
  4. Find three different representations of four using the letters from a to f. What happens to their values if we rearrange the letters?
  5. In Polish, z is followed by ź and ż. Continuing the same recurrence, what value would ż have if the English alphabet ended in yzźż rather than yz?

We have assigned values to individual letters and begun adding them by concatenation. In the next post, we will look at the resulting arithmetic, and at how different ways of writing a number can preserve different information.