Expressing computable ordinals as programs
by Paul Crowley
I loved John Baez’s three-part system on large countable ordinals (1, 2, 3) but something nagged at me. It felt like a description of an algorithm in prose, and I feel like I don’t really understand an algorithm until I’ve implemented it. But what does it mean to implement an ordinal?
I found a couple of answers to that online. One is the definition of a recursive ordinal, and the other is Kleene’s O. However both seemed pretty unsatisfactory to me; I wanted something that could naturally express operations like addition/multiplication/exponentiation, as well as expressing finite ordinals.
Here’s where I ended up: we express an ordinal as a set of lexicographically-sorted and well-ordered binary strings with the “prefix property” that no string in the set is a prefix of any other. If is the ordinal represented by set , we have
- ( is the empty string)
These are just samples: for every ordinal, there are infinitely many sets that could represent it.
Addition and multiplication are easy here:
Exponentiation is a bit harder, I use this idea: consider a function with finite support. Let where . Then we represent this function as . If is the set of all such representations for all such functions , then
Instead of limits, I define an infinite sum function. Given a function we have
The obvious way to represent these sets as programs would be as functions that test for membership of the set. It should be clear how to implement addition and infinite sum with this representation, and multiplication is only a little more complicated. Unfortunately I don’t see how to do exponentiation, because of one small wrinkle: if we’re to get the right answer for finite exponents, we must ensure that every one of our entries are non-zero, ie not the smallest elements of B, and we have no way to find that. So instead I propose a slight wrinkle: we implement instead a function which tells us whether a string is a prefix of any string in the set.
I’ll try to share code implementing all this ASAP, but I wanted to put the ideas out there first. Thanks!