Cantor Normal Form #
The Cantor normal form of an ordinal is generally defined as its base ω expansion, with its
non-zero exponents in decreasing order. Here, we more generally define a base b expansion
Ordinal.CNF in this manner, which is well-behaved for any b ≥ 2.
Implementation notes #
We implement Ordinal.CNF as an association list, where keys are exponents and values are
coefficients. This is because this structure intrinsically reflects two key properties of the Cantor
normal form:
- It is ordered.
- It has finitely many entries.
Todo #
- Prove the basic results relating the CNF to the arithmetic operations on ordinals.
Cantor normal form as a list #
Inducts on the base b expansion of an ordinal.
Equations
- Ordinal.CNF.rec b H0 H o = if h : o = 0 then ⋯ ▸ H0 else H o h (Ordinal.CNF.rec b H0 H (o % b ^ Ordinal.log b o))
Instances For
Alias of Ordinal.CNF.rec.
Inducts on the base b expansion of an ordinal.
Equations
Instances For
Alias of Ordinal.CNF.rec_zero.
Alias of Ordinal.CNF.rec_pos.
The Cantor normal form of an ordinal o is the list of coefficients and exponents in the
base-b expansion of o.
We special-case CNF 0 o = CNF 1 o = [(0, o)] for o ≠ 0.
CNF b (b ^ u₁ * v₁ + b ^ u₂ * v₂) = [(u₁, v₁), (u₂, v₂)]
Equations
- Ordinal.CNF b o = Ordinal.CNF.rec b [] (fun (o : Ordinal.{?u.14}) (x : o ≠ 0) (IH : List (Ordinal.{?u.14} × Ordinal.{?u.14})) => (Ordinal.log b o, o / b ^ Ordinal.log b o) :: IH) o
Instances For
Alias of Ordinal.CNF.zero_right.
Alias of Ordinal.CNF.zero_left.
Alias of Ordinal.CNF.one_left.
Alias of Ordinal.CNF.of_le_one.
Alias of Ordinal.CNF.of_lt.
Evaluating the Cantor normal form of an ordinal returns the ordinal.
Alias of Ordinal.CNF.foldr.
Evaluating the Cantor normal form of an ordinal returns the ordinal.
Every exponent in the Cantor normal form CNF b o is less or equal to log b o.
Alias of Ordinal.CNF.fst_le_log.
Every exponent in the Cantor normal form CNF b o is less or equal to log b o.
Every coefficient in a Cantor normal form is positive.
Alias of Ordinal.CNF.lt_snd.
Every coefficient in a Cantor normal form is positive.
Every coefficient in the Cantor normal form CNF b o is less than b.
Alias of Ordinal.CNF.snd_lt.
Every coefficient in the Cantor normal form CNF b o is less than b.
The exponents of the Cantor normal form are decreasing.
Alias of Ordinal.CNF.sorted.
The exponents of the Cantor normal form are decreasing.
Cantor normal form as a finsupp #
CNF.coeff b o is the finitely supported function returning the coefficient of b ^ e in the
Cantor Normal Form (CNF) of o, for each e.
Equations
- Ordinal.CNF.coeff b o = { entries := List.map Prod.toSigma (Ordinal.CNF b o), nodupKeys := ⋯ }.lookupFinsupp