Ordinal arithmetic #
Ordinals have an addition (corresponding to disjoint union) that turns them into an additive monoid, and a multiplication (corresponding to the lexicographic order on the product) that turns them into a monoid. One can also define correspondingly a subtraction, a division, a successor function, a power function and a logarithm function.
We also define limit ordinals and prove the basic induction principle on ordinals separating
successor ordinals and limit ordinals, in limit_rec_on
.
Main definitions and results #
o₁ + o₂
is the order on the disjoint union ofo₁
ando₂
obtained by declaring that every element ofo₁
is smaller than every element ofo₂
.o₁ - o₂
is the unique ordinalo
such thato₂ + o = o₁
, wheno₂ ≤ o₁
.o₁ * o₂
is the lexicographic order ono₂ × o₁
.o₁ / o₂
is the ordinalo
such thato₁ = o₂ * o + o'
witho' < o₂
. We also define the divisibility predicate, and a modulo operation.succ o = o + 1
is the successor ofo
.pred o
if the predecessor ofo
. Ifo
is not a successor, we setpred o = o
.
We also define the power function and the logarithm function on ordinals, and discuss the properties
of casts of natural numbers of and of omega
with respect to these operations.
Some properties of the operations are also used to discuss general tools on ordinals:
is_limit o
: an ordinal is a limit ordinal if it is neither0
nor a successor.limit_rec_on
is the main induction principle of ordinals: if one can prove a property by induction at successor ordinals and at limit ordinals, then it holds for all ordinals.is_normal
: a functionf : ordinal → ordinal
satisfiesis_normal
if it is strictly increasing and order-continuous, i.e., the imagef o
of a limit ordinalo
is the sup off a
fora < o
.enum_ord
: enumerates an unbounded set of ordinals by the ordinals themselves.nfp f a
: the next fixed point of a functionf
on ordinals, abovea
. It behaves well for normal functions.CNF b o
is the Cantor normal form of the ordinalo
in baseb
.sup
,lsub
: the supremum / least strict upper bound of an indexed family of ordinals inType u
, as an ordinal inType u
.bsup
,blsub
: the supremum / least strict upper bound of a set of ordinals indexed by ordinals less than a given ordinalo
.
Various other basic arithmetic results are given in principal.lean
instead.
Further properties of addition on ordinals #
The zero ordinal #
The predecessor of an ordinal #
Limit ordinals #
Main induction principle of ordinals: if one can prove a property by induction at successor ordinals and at limit ordinals, then it holds for all ordinals.
Equations
- o.limit_rec_on H₁ H₂ H₃ = ordinal.wf.fix (λ (o : ordinal) (IH : Π (y : ordinal), y < o → C y), dite (o = 0) (λ (o0 : o = 0), _.mpr H₁) (λ (o0 : ¬o = 0), dite (∃ (a : ordinal), o = a.succ) (λ (h : ∃ (a : ordinal), o = a.succ), _.mpr (H₂ o.pred (IH o.pred _))) (λ (h : ¬∃ (a : ordinal), o = a.succ), H₃ o _ IH))) o
Equations
- ordinal.α.order_top o = {top := eq.rec (quot.lift (quot.indep (λ (_x : Well_order), ordinal.enum._match_1 has_lt.lt _x)) _ o).snd _ _, le_top := _}
Normal ordinal functions #
A normal ordinal function is a strictly increasing function which is
order-continuous, i.e., the image f o
of a limit ordinal o
is the sup of f a
for
a < o
.
Subtraction on ordinals #
Equations
Multiplication of ordinals #
The multiplication of ordinals o₁
and o₂
is the (well founded) lexicographic order on
o₂ × o₁
.
Equations
- ordinal.monoid = {mul := λ (a b : ordinal), quotient.lift_on₂ a b (λ (_x : Well_order), ordinal.monoid._match_2 _x) ordinal.monoid._proof_1, mul_assoc := ordinal.monoid._proof_2, one := 1, one_mul := ordinal.monoid._proof_3, mul_one := ordinal.monoid._proof_4, npow := npow_rec (mul_one_class.to_has_mul ordinal), npow_zero' := ordinal.monoid._proof_7, npow_succ' := ordinal.monoid._proof_8}
- ordinal.monoid._match_2 {α := α, r := r, wo := wo} = λ (_x : Well_order), ordinal.monoid._match_1 α r wo _x
- ordinal.monoid._match_1 α r wo {α := β, r := s, wo := wo'} = ⟦{α := β × α, r := prod.lex s r, wo := _}⟧
Division on ordinals #
Equations
Families of ordinals #
There are two kinds of indexed families that naturally arise when dealing with ordinals: those indexed by some type in the appropriate universe, and those indexed by ordinals less than another. The following API allows one to convert from one kind of family to the other.
In many cases, this makes it easy to prove claims about one kind of family via the corresponding claim on the other.
Converts a family indexed by a Type u
to one indexed by an ordinal.{u}
using a specified
well-ordering.
Equations
- ordinal.bfamily_of_family' r f = λ (a : ordinal) (ha : a < ordinal.type r), f (ordinal.enum r a ha)
Converts a family indexed by a Type u
to one indexed by an ordinal.{u}
using a well-ordering
given by the axiom of choice.
Converts a family indexed by an ordinal.{u}
to one indexed by an Type u
using a specified
well-ordering.
Equations
- ordinal.family_of_bfamily' r ho f = λ (i : ι), f (ordinal.typein r i) _
Converts a family indexed by an ordinal.{u}
to one indexed by a Type u
using a well-ordering
given by the axiom of choice.
Equations
Supremum of a family of ordinals #
The supremum of a family of ordinals
Equations
- ordinal.sup f = supr f
The range of any family of ordinals is bounded above. See also lsub_not_mem_range
.
The supremum of a family of ordinals indexed by the set of ordinals less than some
o : ordinal.{u}
. This is a special case of sup
over the family provided by
family_of_bfamily
.
Equations
- o.bsup f = ordinal.sup (o.family_of_bfamily f)
The least strict upper bound of a family of ordinals.
Equations
- ordinal.lsub f = ordinal.sup (ordinal.succ ∘ f)
The least strict upper bound of a family of ordinals indexed by the set of ordinals less than
some o : ordinal.{u}
.
This is to lsub
as bsup
is to sup
.
Minimum excluded ordinals #
The minimum excluded ordinal in a family of ordinals.
Equations
- ordinal.mex f = Inf (set.range f)ᶜ
The minimum excluded ordinal of a family of ordinals indexed by the set of ordinals less than
some o : ordinal.{u}
. This is a special case of mex
over the family provided by
family_of_bfamily
.
This is to mex
as bsup
is to sup
.
Equations
- o.bmex f = ordinal.mex (o.family_of_bfamily f)
Results about injectivity and surjectivity #
The type of ordinals in universe u
is not small.{u}
. This is the type-theoretic analog of
the Burali-Forti paradox.
Enumerating unbounded sets of ordinals with ordinals #
The equation that characterizes enum_ord
definitionally. This isn't the nicest expression to
work with, so consider using enum_ord_def
instead.
The set in enum_ord_def'
is nonempty.
A more workable definition for enum_ord
.
The set in enum_ord_def
is nonempty.
An order isomorphism between an unbounded set of ordinals and the ordinals.
Equations
- ordinal.enum_ord_order_iso hS = strict_mono.order_iso_of_surjective (λ (o : ordinal), ⟨ordinal.enum_ord S o, _⟩) _ _
A characterization of enum_ord
: it is the unique strict monotonic function with range S
.
Ordinal exponential #
Equations
Ordinal logarithm #
The Cantor normal form #
The Cantor normal form of an ordinal o
is the list of coefficients and exponents in the
base-b
expansion of o
.
CNF b (b ^ u₁ * v₁ + b ^ u₂ * v₂) = [(u₁, v₁), (u₂, v₂)]
Casting naturals into ordinals, compatibility with operations #
Properties of omega
#
Fixed points of normal functions #
The next fixed point function, the least fixed point of the normal function f
above a
.
Equations
- ordinal.nfp f a = ordinal.sup (λ (n : ℕ), f^[n] a)
Fixed point lemma for normal functions: the fixed points of a normal function are unbounded.
The derivative of a normal function f
is the sequence of fixed points of f
.
Equations
- ordinal.deriv f o = o.limit_rec_on (ordinal.nfp f 0) (λ (a IH : ordinal), ordinal.nfp f IH.succ) (λ (a : ordinal) (l : a.is_limit), a.bsup)
deriv f
is the fixed point enumerator of f
.