User blog comment:Emlightened/New(ish) Concept: Googological Systems/@comment-27513631-20170804212523/@comment-27513631-20170805220105

I'm trying to create a concept of a decreasing function/subterm, similarly to Walther recursion, so that we can do recursion on a well-founded relation inside the definition of a function. Currently, I believe I have three main problems:


 * Ensuring the orderings are well-founded.
 * Case distinction: applying the function in certain cases but not in others (as each wellorder must have a least value, we can't recurse given an input of that type)
 * Separator-like structures vs ordinal-like structures.

The reason union types are useful is the second (although not as much as I thought before, given the third) one of these. Suppose we have the type of lists of natural numbers, defined as a pair of a natural number and list of natural numbers (or, alternatively, the empty list). Here we have an issue, as we don't have a type definible in that way for 'a list of natural numbers that isn't everywhere-0'. We could define an isomorphic type that carries that distinction, but it would only be isomorphic to the subset, not equal. Union types solve this as they allow us to create the subtype we actually desire, although relative compliments would also do that job.

Additionally, union of functions is the easiest way to manage case distinction, instead of an abstraction or sum of functions, as it lets us do things like combine \((\alpha+0)\times \gamma\) and \((0+\beta)\times \gamma\) to get \((\alpha+\beta)\times \gamma\) without some extrenuous machinery to get the job done with the other methods that may also make it harder to keep track of decreasing subterms.

However, this isn't as useful as I'd like it to be, due to the third bullet above. Currently, I've only figured out how to encode ordinal-like structures, and we often wouldn't deal with that sort of object. It's the difference between [3,0,2] and [2,2,2,0,0] to encode the same list. The system can only, currently, deal with the second one, because all orders are currently built up from embedding conditions and (weakened) lexicographic orders. Due to the weakening done to make the ordering consistent, the list effectively has to be decreasing in order for meaningful decreasing functions to be made. The solution would probably be to add another type of order, but that will be postponed until the rest of the system is done.