Ordinal notation #
Constructive ordinal arithmetic for ordinals below ε₀
.
We define a type ONote
, with constructors 0 : ONote
and ONote.oadd e n a
representing
ω ^ e * n + a
.
We say that o
is in Cantor normal form - ONote.NF o
- if either o = 0
or
o = ω ^ e * n + a
with a < ω ^ e
and a
in Cantor normal form.
The type NONote
is the type of ordinals below ε₀
in Cantor normal form.
Various operations (addition, subtraction, multiplication, power function)
are defined on ONote
and NONote
.
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
.
Instances For
Notation for 0
Equations
- ONote.instZero = { zero := ONote.zero }
Notation for 1
Equations
- ONote.instOne = { one := ONote.oadd 0 1 0 }
The ordinal denoted by a notation
Equations
- ONote.zero.repr = 0
- (e.oadd n a).repr = Ordinal.omega ^ e.repr * ↑↑n + a.repr
Instances For
Print an ordinal notation
Equations
- ONote.zero.toString = "0"
- (e.oadd n ONote.zero).toString = e.toStringAux1 (↑n) e.toString
- (e.oadd n a).toString = e.toStringAux1 (↑n) e.toString ++ " + " ++ a.toString
Instances For
Print an ordinal notation
Equations
- One or more equations did not get rendered due to their size.
- ONote.repr' prec ONote.zero = Std.Format.text "0"
Instances For
Equations
- ONote.instToString = { toString := ONote.toString }
Equations
- ONote.instRepr = { reprPrec := fun (o : ONote) (prec : ℕ) => ONote.repr' prec o }
Equations
- ONote.instWellFoundedRelation = { rel := fun (x x_1 : ONote) => x < x_1, wf := ONote.instWellFoundedRelation.proof_1 }
Convert a Nat
into an ordinal
Equations
- ↑x = match x with | 0 => 0 | n.succ => ONote.oadd 0 n.succPNat 0
Instances For
Compare ordinal notations
Equations
- ONote.zero.cmp ONote.zero = Ordering.eq
- x.cmp ONote.zero = Ordering.gt
- ONote.zero.cmp x = Ordering.lt
- (e₁.oadd n₁ a₁).cmp (e₂.oadd n₂ a₂) = (e₁.cmp e₂).orElse ((cmp ↑n₁ ↑n₂).orElse (a₁.cmp a₂))
Instances For
NFBelow o b
says that o
is a normal form ordinal notation
satisfying repr o < ω ^ b
.
- zero: ∀ {b : Ordinal.{0}}, ONote.NFBelow 0 b
- oadd': ∀ {e : ONote} {n : ℕ+} {a : ONote} {eb b : Ordinal.{0}}, e.NFBelow eb → a.NFBelow e.repr → e.repr < b → (e.oadd n a).NFBelow b
Instances For
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.
- out : Exists o.NFBelow
Instances
TopBelow 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
.
Equations
- b.TopBelow x = match x with | ONote.zero => True | e.oadd a a_1 => e.cmp b = Ordering.lt
Instances For
Equations
- One or more equations did not get rendered due to their size.
Equations
- ONote.zero.decidableNF = isTrue ONote.NF.zero
- (e.oadd n a).decidableNF = let_fun this := e.decidableNF; let_fun this_1 := a.decidableNF; decidable_of_iff (e.NF ∧ a.NF ∧ e.TopBelow a) ⋯
Subtraction of ordinal notations (correct only for normal input)
Equations
- One or more equations did not get rendered due to their size.
- ONote.zero.sub x = 0
- x.sub ONote.zero = x
Instances For
scale x o
is the ordinal notation for ω ^ x * o
.
Equations
- x.scale ONote.zero = 0
- x.scale (e.oadd n a) = (x + e).oadd n (x.scale a)
Instances For
mulNat o n
is the ordinal notation for o * n
.
Equations
- x✝.mulNat x = match x✝, x with | ONote.zero, x => 0 | x, 0 => 0 | e.oadd n a, m.succ => e.oadd (n * m.succPNat) a
Instances For
Auxiliary definition to compute the ordinal notation for the ordinal
exponentiation in opow
Equations
Instances For
Given an ordinal, returns inl none
for 0
, inl (some a)
for a+1
, and
inr f
for a limit ordinal a
, where f i
is a sequence converging to a
.
Equations
- One or more equations did not get rendered due to their size.
- ONote.zero.fundamentalSequence = Sum.inl none
Instances For
The property satisfied by fundamentalSequence o
:
inl none
meanso = 0
inl (some a)
meanso = succ a
inr f
meanso
is a limit ordinal andf
is a strictly increasing sequence which converges too
Equations
- One or more equations did not get rendered due to their size.
Instances For
The fast growing hierarchy for ordinal notations < ε₀
. This is a sequence of
functions ℕ → ℕ
indexed by ordinals, with the definition:
f_0(n) = n + 1
f_(α+1)(n) = f_α^[n](n)
f_α(n) = f_(α[n])(n)
whereα
is a limit ordinal andα[i]
is the fundamental sequence converging toα
Equations
- One or more equations did not get rendered due to their size.
Instances For
We can extend the fast growing hierarchy one more step to ε₀
itself,
using ω^(ω^...^ω^0)
as the fundamental sequence converging to ε₀
(which is not an ONote
).
Extending the fast growing hierarchy beyond this requires a definition of fundamental sequence
for larger ordinals.
Equations
- ONote.fastGrowingε₀ i = ((fun (a : ONote) => a.oadd 1 0)^[i] 0).fastGrowing i
Instances For
Equations
- instDecidableEqNONote = id inferInstance
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.)
Equations
- o.repr = (↑o).repr
Instances For
Equations
- NONote.instToString = { toString := fun (x : NONote) => (↑x).toString }
Equations
- NONote.instRepr = { reprPrec := fun (x : NONote) (prec : ℕ) => ONote.repr' prec ↑x }
Equations
- NONote.instZero = { zero := ⟨0, ONote.NF.zero⟩ }
Equations
- NONote.instInhabited = { default := 0 }
Equations
- NONote.instWellFoundedRelation = { rel := fun (x x_1 : NONote) => x < x_1, wf := NONote.lt_wf }
Equations
Asserts that repr a < ω ^ repr b
. Used in NONote.recOn
Equations
- a.below b = (↑a).NFBelow b.repr
Instances For
This is a recursor-like theorem for NONote
suggesting an
inductive definition, which can't actually be defined this
way due to conflicting dependencies.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Addition of ordinal notations
Equations
- NONote.instAdd = { add := fun (x y : NONote) => NONote.mk (↑x + ↑y) }
Subtraction of ordinal notations
Equations
- NONote.instSub = { sub := fun (x y : NONote) => NONote.mk (↑x - ↑y) }
Multiplication of ordinal notations
Equations
- NONote.instMul = { mul := fun (x y : NONote) => NONote.mk (↑x * ↑y) }