onote

Recursive definition of an ordinal notation. zero denotes the ordinal 0, and oadd e n a is intended to refer to ω^e * n + a. For this to be valid Cantor normal form, we must have the exponents decrease to the right, but we can't state this condition until we've defined repr, so it is a separate definition NF.

onote.has_zero

Notation for 0

onote.has_one

Notation for 1

onote.omega

Notation for ω

onote.repr

The ordinal denoted by a notation

onote.to_string

Print an ordinal notation

onote.repr'

Print an ordinal notation

onote.of_nat

Convert a nat into an ordinal

onote.cmp

Compare ordinal notations

onote.NF_below

NF_below o b says that o is a normal form ordinal notation satisfying repr o < ω ^ b.

onote.NF

A normal form ordinal notation has the form

ω ^ a₁ * n₁ + ω ^ a₂ * n₂ + ... ω ^ aₖ * nₖ

where a₁ > a₂ > ... > aₖ and all the aᵢ are also in normal form.

We will essentially only be interested in normal form ordinal notations, but to avoid complicating the algorithms we define everything over general ordinal notations and only prove correctness with normal form as an invariant.

onote.top_below

top_below b o asserts that the largest exponent in o, if it exists, is less than b. This is an auxiliary definition for decidability of NF.

onote.add

Addition of ordinal notations (correct only for normal input)

onote.sub

Subtraction of ordinal notations (correct only for normal input)

onote.mul

Multiplication of ordinal notations (correct only for normal input)

onote.split'

Calculate division and remainder of o mod ω. split' o = (a, n) means o = ω * a + n.

onote.split

Calculate division and remainder of o mod ω. split o = (a, n) means o = a + n, where ω ∣ a.

onote.scale

scale x o is the ordinal notation for ω ^ x * o.

onote.mul_nat

mul_nat o n is the ordinal notation for o * n.

onote.power

power o₁ o₂ calculates the ordinal notation for the ordinal exponential o₁ ^ o₂.

nonote

The type of normal ordinal notations. (It would have been nicer to define this right in the inductive type, but NF o requires repr which requires onote, so all these things would have to be defined at once, which messes up the VM representation.)

nonote.mk

Construct a nonote from an ordinal notation (and infer normality)

nonote.repr

The ordinal represented by an ordinal notation. (This function is noncomputable because ordinal arithmetic is noncomputable. In computational applications nonote can be used exclusively without reference to ordinal, but this function allows for correctness results to be stated.)

nonote.of_nat

Convert a natural number to an ordinal notation

nonote.cmp

Compare ordinal notations

nonote.below

Asserts that repr a < ω ^ repr b. Used in nonote.rec_on

nonote.oadd

The oadd pseudo-constructor for nonote

nonote.rec_on

This is a recursor-like theorem for nonote suggesting an inductive definition, which can't actually be defined this way due to conflicting dependencies.

nonote.has_add

Addition of ordinal notations

nonote.has_sub

Subtraction of ordinal notations

nonote.has_mul

Multiplication of ordinal notations

nonote.power

Exponentiation of ordinal notations