doc-next-gen

Mathlib.SetTheory.Ordinal.Arithmetic

Module docstring

{"# 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 limitRecOn.

Main definitions and results

  • o₁ + o₂ is the order on the disjoint union of o₁ and o₂ obtained by declaring that every element of o₁ is smaller than every element of o₂.
  • o₁ - o₂ is the unique ordinal o such that o₂ + o = o₁, when o₂ ≤ o₁.
  • o₁ * o₂ is the lexicographic order on o₂ × o₁.
  • o₁ / o₂ is the ordinal o such that o₁ = o₂ * o + o' with o' < o₂. We also define the divisibility predicate, and a modulo operation.
  • Order.succ o = o + 1 is the successor of o.
  • pred o if the predecessor of o. If o is not a successor, we set pred o = o.

We discuss the properties of casts of natural numbers of and of ω with respect to these operations.

Some properties of the operations are also used to discuss general tools on ordinals:

  • IsLimit o: an ordinal is a limit ordinal if it is neither 0 nor a successor.
  • limitRecOn 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.
  • IsNormal: a function f : Ordinal → Ordinal satisfies IsNormal if it is strictly increasing and order-continuous, i.e., the image f o of a limit ordinal o is the sup of f a for a < o.

Various other basic arithmetic results are given in Principal.lean instead. ","### Further properties of addition on ordinals ","### The predecessor of an ordinal ","### Limit ordinals ","### Normal ordinal functions ","### Subtraction on ordinals ","### Multiplication of ordinals ","### Division on ordinals ","### Casting naturals into ordinals, compatibility with operations "}

Ordinal.lift_add theorem
(a b : Ordinal.{v}) : lift.{u} (a + b) = lift.{u} a + lift.{u} b
Full source
@[simp]
theorem lift_add (a b : OrdinalOrdinal.{v}) : lift.{u} (a + b) = lift.{u} a + lift.{u} b :=
  Quotient.inductionOn₂ a b fun ⟨_α, _r, _⟩ ⟨_β, _s, _⟩ =>
    Quotient.sound
      ⟨(RelIso.preimage Equiv.ulift _).trans
          (RelIso.sumLexCongr (RelIso.preimage Equiv.ulift _) (RelIso.preimage Equiv.ulift _)).symm⟩
Lift Preserves Ordinal Addition: $\text{lift}(a + b) = \text{lift}(a) + \text{lift}(b)$
Informal description
For any ordinals $a$ and $b$ in universe $v$, the lift of their sum $a + b$ to universe $\max(v, u)$ is equal to the sum of their lifts, i.e., $\text{lift}(a + b) = \text{lift}(a) + \text{lift}(b)$.
Ordinal.lift_succ theorem
(a : Ordinal.{v}) : lift.{u} (succ a) = succ (lift.{u} a)
Full source
@[simp]
theorem lift_succ (a : OrdinalOrdinal.{v}) : lift.{u} (succ a) = succ (lift.{u} a) := by
  rw [← add_one_eq_succ, lift_add, lift_one]
  rfl
Lift Preserves Successor: $\text{lift}(\text{succ}(a)) = \text{succ}(\text{lift}(a))$
Informal description
For any ordinal $a$ in universe $v$, the lift of its successor $\text{succ}(a)$ to universe $\max(v, u)$ is equal to the successor of its lift, i.e., $\text{lift}(\text{succ}(a)) = \text{succ}(\text{lift}(a))$.
Ordinal.instAddLeftReflectLE instance
: AddLeftReflectLE Ordinal.{u}
Full source
instance instAddLeftReflectLE :
    AddLeftReflectLE OrdinalOrdinal.{u} where
  elim c a b := by
    refine inductionOn₃ a b c fun α r _ β s _ γ t _ ⟨f⟩ ↦ ?_
    have H₁ a : f (Sum.inl a) = Sum.inl a := by
      simpa using ((InitialSeg.leAdd t r).trans f).eq (InitialSeg.leAdd t s) a
    have H₂ a : ∃ b, f (Sum.inr a) = Sum.inr b := by
      generalize hx : f (Sum.inr a) = x
      obtain x | x := x
      · rw [← H₁, f.inj] at hx
        contradiction
      · exact ⟨x, rfl⟩
    choose g hg using H₂
    refine (RelEmbedding.ofMonotone g fun _ _ h ↦ ?_).ordinal_type_le
    rwa [← @Sum.lex_inr_inr _ t _ s, ← hg, ← hg, f.map_rel_iff, Sum.lex_inr_inr]
Left Cancellation of Ordinal Addition: $a + b \leq a + c \implies b \leq c$
Informal description
For any ordinals $a$, $b$, and $c$, if $a + b \leq a + c$, then $b \leq c$.
Ordinal.instIsLeftCancelAdd instance
: IsLeftCancelAdd Ordinal
Full source
instance : IsLeftCancelAdd Ordinal where
  add_left_cancel a b c h := by simpa only [le_antisymm_iff, add_le_add_iff_left] using h
Left Cancellation Property of Ordinal Addition
Informal description
Ordinal addition is left cancellative, meaning that for any ordinals $a$, $b$, and $c$, if $a + b = a + c$, then $b = c$.
Ordinal.add_left_cancel theorem
(a) {b c : Ordinal} : a + b = a + c ↔ b = c
Full source
@[deprecated add_left_cancel_iff (since := "2024-12-11")]
protected theorem add_left_cancel (a) {b c : Ordinal} : a + b = a + c ↔ b = c :=
  add_left_cancel_iff
Left Cancellation Law for Ordinal Addition: $a + b = a + c \iff b = c$
Informal description
For any ordinals $a$, $b$, and $c$, the equality $a + b = a + c$ holds if and only if $b = c$.
Ordinal.add_le_add_iff_right theorem
{a b : Ordinal} : ∀ n : ℕ, a + n ≤ b + n ↔ a ≤ b
Full source
theorem add_le_add_iff_right {a b : Ordinal} : ∀ n : , a + n ≤ b + n ↔ a ≤ b
  | 0 => by simp
  | n + 1 => by
    simp only [natCast_succ, add_succ, add_succ, succ_le_succ_iff, add_le_add_iff_right]
Right Addition Preserves Order in Ordinals: $a + n \leq b + n \leftrightarrow a \leq b$
Informal description
For any ordinals $a$ and $b$ and any natural number $n$, the inequality $a + n \leq b + n$ holds if and only if $a \leq b$.
Ordinal.add_right_cancel theorem
{a b : Ordinal} (n : ℕ) : a + n = b + n ↔ a = b
Full source
theorem add_right_cancel {a b : Ordinal} (n : ) : a + n = b + n ↔ a = b := by
  simp only [le_antisymm_iff, add_le_add_iff_right]
Right Cancellation Law for Ordinal Addition with Natural Numbers
Informal description
For any ordinals $a$ and $b$ and any natural number $n$, the equality $a + n = b + n$ holds if and only if $a = b$.
Ordinal.left_eq_zero_of_add_eq_zero theorem
{a b : Ordinal} (h : a + b = 0) : a = 0
Full source
theorem left_eq_zero_of_add_eq_zero {a b : Ordinal} (h : a + b = 0) : a = 0 :=
  (add_eq_zero_iff.1 h).1
Left Addend Zero in Ordinal Addition
Informal description
For any ordinals $a$ and $b$, if $a + b = 0$, then $a = 0$.
Ordinal.right_eq_zero_of_add_eq_zero theorem
{a b : Ordinal} (h : a + b = 0) : b = 0
Full source
theorem right_eq_zero_of_add_eq_zero {a b : Ordinal} (h : a + b = 0) : b = 0 :=
  (add_eq_zero_iff.1 h).2
Right Addend Vanishes When Sum is Zero for Ordinals
Informal description
For any two ordinals $a$ and $b$, if $a + b = 0$, then $b = 0$.
Ordinal.pred definition
(o : Ordinal) : Ordinal
Full source
/-- The ordinal predecessor of `o` is `o'` if `o = succ o'`,
  and `o` otherwise. -/
def pred (o : Ordinal) : Ordinal :=
  if h : ∃ a, o = succ a then Classical.choose h else o
Ordinal predecessor function
Informal description
The predecessor function on ordinals maps an ordinal $o$ to its immediate predecessor if $o$ is a successor ordinal (i.e., $o = \text{succ } o'$ for some $o'$), and to $o$ itself otherwise.
Ordinal.pred_eq_iff_not_succ theorem
{o} : pred o = o ↔ ¬∃ a, o = succ a
Full source
theorem pred_eq_iff_not_succ {o} : predpred o = o ↔ ¬∃ a, o = succ a :=
  ⟨fun e ⟨a, e'⟩ => by rw [e', pred_succ] at e; exact (lt_succ a).ne e, fun h => dif_neg h⟩
Predecessor Equals Itself if and only if Not a Successor Ordinal
Informal description
For any ordinal $o$, the predecessor of $o$ equals $o$ if and only if $o$ is not a successor ordinal, i.e., $\text{pred}(o) = o \leftrightarrow \nexists a, o = \text{succ}(a)$.
Ordinal.pred_eq_iff_not_succ' theorem
{o} : pred o = o ↔ ∀ a, o ≠ succ a
Full source
theorem pred_eq_iff_not_succ' {o} : predpred o = o ↔ ∀ a, o ≠ succ a := by
  simpa using pred_eq_iff_not_succ
Predecessor Equals Itself if and only if Not a Successor Ordinal (Universal Form)
Informal description
For any ordinal $o$, the predecessor of $o$ equals $o$ if and only if $o$ is not a successor ordinal, i.e., $\text{pred}(o) = o \leftrightarrow \forall a, o \neq \text{succ}(a)$.
Ordinal.pred_lt_iff_is_succ theorem
{o} : pred o < o ↔ ∃ a, o = succ a
Full source
theorem pred_lt_iff_is_succ {o} : predpred o < o ↔ ∃ a, o = succ a :=
  Iff.trans (by simp only [le_antisymm_iff, pred_le_self, true_and, not_le])
    (iff_not_comm.1 pred_eq_iff_not_succ).symm
Predecessor Strictly Less Than Ordinal if and only if Successor Ordinal
Informal description
For any ordinal $o$, the predecessor of $o$ is strictly less than $o$ if and only if $o$ is a successor ordinal, i.e., there exists an ordinal $a$ such that $o = \text{succ}(a)$. In other words, $\text{pred}(o) < o \leftrightarrow \exists a, o = \text{succ}(a)$.
Ordinal.pred_zero theorem
: pred 0 = 0
Full source
@[simp]
theorem pred_zero : pred 0 = 0 :=
  pred_eq_iff_not_succ'.2 fun a => (succ_ne_zero a).symm
Predecessor of Zero is Zero
Informal description
The predecessor of the zero ordinal is equal to zero, i.e., $\mathrm{pred}(0) = 0$.
Ordinal.succ_pred_iff_is_succ theorem
{o} : succ (pred o) = o ↔ ∃ a, o = succ a
Full source
theorem succ_pred_iff_is_succ {o} : succsucc (pred o) = o ↔ ∃ a, o = succ a :=
  ⟨fun e => ⟨_, e.symm⟩, fun ⟨a, e⟩ => by simp only [e, pred_succ]⟩
Successor-Predecessor Equivalence for Ordinals: $\text{succ}(\text{pred}(o)) = o \leftrightarrow o$ is a successor ordinal
Informal description
For any ordinal $o$, the successor of the predecessor of $o$ equals $o$ if and only if $o$ is a successor ordinal, i.e., there exists an ordinal $a$ such that $o = \text{succ}(a)$. In other words, $\text{succ}(\text{pred}(o)) = o \leftrightarrow \exists a, o = \text{succ}(a)$.
Ordinal.succ_lt_of_not_succ theorem
{o b : Ordinal} (h : ¬∃ a, o = succ a) : succ b < o ↔ b < o
Full source
theorem succ_lt_of_not_succ {o b : Ordinal} (h : ¬∃ a, o = succ a) : succsucc b < o ↔ b < o :=
  ⟨(lt_succ b).trans, fun l => lt_of_le_of_ne (succ_le_of_lt l) fun e => h ⟨_, e.symm⟩⟩
Successor Inequality for Non-Successor Ordinals: $\text{succ}(b) < o \leftrightarrow b < o$ when $o$ is not a successor ordinal
Informal description
For ordinals $o$ and $b$, if $o$ is not a successor ordinal (i.e., there does not exist an ordinal $a$ such that $o = \text{succ}(a)$), then the successor of $b$ is strictly less than $o$ if and only if $b$ is strictly less than $o$. In other words, $\text{succ}(b) < o \leftrightarrow b < o$.
Ordinal.lt_pred theorem
{a b} : a < pred b ↔ succ a < b
Full source
theorem lt_pred {a b} : a < pred b ↔ succ a < b := by
  classical
  exact if h : ∃ a, b = succ a then by
    let ⟨c, e⟩ := h
    rw [e, pred_succ, succ_lt_succ_iff]
  else by simp only [pred, dif_neg h, succ_lt_of_not_succ h]
Predecessor Inequality: $a < \text{pred}(b) \leftrightarrow \text{succ}(a) < b$
Informal description
For any ordinals $a$ and $b$, the inequality $a < \text{pred}(b)$ holds if and only if $\text{succ}(a) < b$ holds.
Ordinal.pred_le theorem
{a b} : pred a ≤ b ↔ a ≤ succ b
Full source
theorem pred_le {a b} : predpred a ≤ b ↔ a ≤ succ b :=
  le_iff_le_iff_lt_iff_lt.2 lt_pred
Predecessor-Successor Order Relation: $\text{pred}(a) \leq b \leftrightarrow a \leq \text{succ}(b)$
Informal description
For any ordinals $a$ and $b$, the predecessor of $a$ is less than or equal to $b$ if and only if $a$ is less than or equal to the successor of $b$. In other words, $\text{pred}(a) \leq b \leftrightarrow a \leq \text{succ}(b)$.
Ordinal.lift_is_succ theorem
{o : Ordinal.{v}} : (∃ a, lift.{u} o = succ a) ↔ ∃ a, o = succ a
Full source
@[simp]
theorem lift_is_succ {o : OrdinalOrdinal.{v}} : (∃ a, lift.{u} o = succ a) ↔ ∃ a, o = succ a :=
  ⟨fun ⟨a, h⟩ =>
    let ⟨b, e⟩ := mem_range_lift_of_le <| show a ≤ lift.{u} o from le_of_lt <| h.symm ▸ lt_succ a
    ⟨b, (lift_inj.{u,v}).1 <| by rw [h, ← e, lift_succ]⟩,
    fun ⟨a, h⟩ => ⟨lift.{u} a, by simp only [h, lift_succ]⟩⟩
Lift Preserves Successor Property: $\text{lift}_{u}(o)$ is successor iff $o$ is successor
Informal description
For any ordinal $o$ in universe $v$, the lifted ordinal $\text{lift}_{u}(o)$ is a successor ordinal (i.e., $\text{lift}_{u}(o) = \text{succ}(a)$ for some ordinal $a$) if and only if $o$ itself is a successor ordinal (i.e., $o = \text{succ}(b)$ for some ordinal $b$).
Ordinal.lift_pred theorem
(o : Ordinal.{v}) : lift.{u} (pred o) = pred (lift.{u} o)
Full source
@[simp]
theorem lift_pred (o : OrdinalOrdinal.{v}) : lift.{u} (pred o) = pred (lift.{u} o) := by
  classical
  exact if h : ∃ a, o = succ a then by obtain ⟨a, e⟩ := h; simp only [e, pred_succ, lift_succ]
  else by rw [pred_eq_iff_not_succ.2 h, pred_eq_iff_not_succ.2 (mt lift_is_succ.1 h)]
Lift Preserves Predecessor: $\text{lift}(\text{pred}(o)) = \text{pred}(\text{lift}(o))$
Informal description
For any ordinal $o$ in universe $v$, the lift of its predecessor $\text{pred}(o)$ to universe $\max(v, u)$ is equal to the predecessor of its lift, i.e., $\text{lift}_{u}(\text{pred}(o)) = \text{pred}(\text{lift}_{u}(o))$.
Ordinal.IsLimit definition
(o : Ordinal) : Prop
Full source
/-- A limit ordinal is an ordinal which is not zero and not a successor.

TODO: deprecate this in favor of `Order.IsSuccLimit`. -/
def IsLimit (o : Ordinal) : Prop :=
  IsSuccLimit o
Limit ordinal
Informal description
An ordinal $o$ is called a *limit ordinal* if it is neither zero nor a successor ordinal. That is, $o$ does not have an immediate predecessor in the order of ordinals.
Ordinal.isLimit_iff theorem
{o} : IsLimit o ↔ o ≠ 0 ∧ IsSuccPrelimit o
Full source
theorem isLimit_iff {o} : IsLimitIsLimit o ↔ o ≠ 0 ∧ IsSuccPrelimit o := by
  simp [IsLimit, IsSuccLimit]
Characterization of Limit Ordinals: $o$ is limit iff $o \neq 0$ and successor pre-limit
Informal description
An ordinal $o$ is a limit ordinal if and only if $o$ is not equal to zero and $o$ is a successor pre-limit (i.e., there is no ordinal $b$ such that $b$ is covered by $o$).
Ordinal.IsLimit.isSuccPrelimit theorem
{o} (h : IsLimit o) : IsSuccPrelimit o
Full source
theorem IsLimit.isSuccPrelimit {o} (h : IsLimit o) : IsSuccPrelimit o :=
  IsSuccLimit.isSuccPrelimit h
Limit ordinals are successor pre-limits
Informal description
For any limit ordinal $o$, the ordinal $o$ is a successor pre-limit, meaning there does not exist any ordinal $b$ such that $b$ is covered by $o$ (i.e., there is no $b$ with $b \lessdot o$).
Ordinal.IsLimit.succ_lt theorem
{o a : Ordinal} (h : IsLimit o) : a < o → succ a < o
Full source
theorem IsLimit.succ_lt {o a : Ordinal} (h : IsLimit o) : a < o → succ a < o :=
  IsSuccLimit.succ_lt h
Successor Below Limit: $\text{succ}(a) < o$ for $a < o$ and $o$ limit
Informal description
For any limit ordinal $o$ and any ordinal $a$ such that $a < o$, the successor of $a$ is also less than $o$, i.e., $\text{succ}(a) < o$.
Ordinal.isSuccPrelimit_zero theorem
: IsSuccPrelimit (0 : Ordinal)
Full source
theorem isSuccPrelimit_zero : IsSuccPrelimit (0 : Ordinal) := isSuccPrelimit_bot
Zero Ordinal is a Successor Pre-Limit
Informal description
The zero ordinal $0$ is a successor pre-limit, meaning there does not exist any ordinal $b$ such that $b$ is covered by $0$ (i.e., there is no $b$ with $b \lessdot 0$).
Ordinal.not_succ_isLimit theorem
(o) : ¬IsLimit (succ o)
Full source
theorem not_succ_isLimit (o) : ¬IsLimit (succ o) :=
  not_isSuccLimit_succ o
Successor Ordinals Are Not Limit Ordinals
Informal description
For any ordinal $o$, the successor ordinal $\text{succ}(o)$ is not a limit ordinal.
Ordinal.not_succ_of_isLimit theorem
{o} (h : IsLimit o) : ¬∃ a, o = succ a
Full source
theorem not_succ_of_isLimit {o} (h : IsLimit o) : ¬∃ a, o = succ a
  | ⟨a, e⟩ => not_succ_isLimit a (e ▸ h)
Limit Ordinals Are Not Successors
Informal description
For any limit ordinal $o$, there does not exist an ordinal $a$ such that $o$ is equal to the successor of $a$.
Ordinal.succ_lt_of_isLimit theorem
{o a : Ordinal} (h : IsLimit o) : succ a < o ↔ a < o
Full source
theorem succ_lt_of_isLimit {o a : Ordinal} (h : IsLimit o) : succsucc a < o ↔ a < o :=
  IsSuccLimit.succ_lt_iff h
Characterization of Successor Inequality for Limit Ordinals: $\text{succ}(a) < o \leftrightarrow a < o$
Informal description
Let $o$ be a limit ordinal and $a$ be any ordinal. Then the successor ordinal $\text{succ}(a)$ is less than $o$ if and only if $a$ is less than $o$.
Ordinal.le_succ_of_isLimit theorem
{o} (h : IsLimit o) {a} : o ≤ succ a ↔ o ≤ a
Full source
theorem le_succ_of_isLimit {o} (h : IsLimit o) {a} : o ≤ succ a ↔ o ≤ a :=
  le_iff_le_iff_lt_iff_lt.2 <| succ_lt_of_isLimit h
Limit Ordinal Comparison with Successor: $o \leq \text{succ}(a) \leftrightarrow o \leq a$
Informal description
For a limit ordinal $o$ and any ordinal $a$, the inequality $o \leq \text{succ}(a)$ holds if and only if $o \leq a$.
Ordinal.limit_le theorem
{o} (h : IsLimit o) {a} : o ≤ a ↔ ∀ x < o, x ≤ a
Full source
theorem limit_le {o} (h : IsLimit o) {a} : o ≤ a ↔ ∀ x < o, x ≤ a :=
  ⟨fun h _x l => l.le.trans h, fun H =>
    (le_succ_of_isLimit h).1 <| le_of_not_lt fun hn => not_lt_of_le (H _ hn) (lt_succ a)⟩
Limit Ordinal Characterization: $o \leq a \leftrightarrow \forall x < o, x \leq a$
Informal description
For a limit ordinal $o$ and any ordinal $a$, the inequality $o \leq a$ holds if and only if for every ordinal $x < o$, we have $x \leq a$.
Ordinal.lt_limit theorem
{o} (h : IsLimit o) {a} : a < o ↔ ∃ x < o, a < x
Full source
theorem lt_limit {o} (h : IsLimit o) {a} : a < o ↔ ∃ x < o, a < x := by
  -- Porting note: `bex_def` is required.
  simpa only [not_forall₂, not_le, bex_def] using not_congr (@limit_le _ h a)
Characterization of Inequality for Limit Ordinals: $a < o \leftrightarrow \exists x < o, a < x$
Informal description
For a limit ordinal $o$ and any ordinal $a$, the inequality $a < o$ holds if and only if there exists an ordinal $x < o$ such that $a < x$.
Ordinal.lift_isLimit theorem
(o : Ordinal.{v}) : IsLimit (lift.{u, v} o) ↔ IsLimit o
Full source
@[simp]
theorem lift_isLimit (o : OrdinalOrdinal.{v}) : IsLimitIsLimit (lift.{u,v} o) ↔ IsLimit o :=
  liftInitialSeg.isSuccLimit_apply_iff
Lifting Preserves Limit Ordinal Property: $\text{IsLimit}(\text{lift}_{u,v}(o)) \leftrightarrow \text{IsLimit}(o)$
Informal description
For any ordinal $o$ in universe $v$, the lifted ordinal $\text{lift}_{u,v}(o)$ in universe $\max(u,v)$ is a limit ordinal if and only if $o$ is a limit ordinal.
Ordinal.IsLimit.pos theorem
{o : Ordinal} (h : IsLimit o) : 0 < o
Full source
theorem IsLimit.pos {o : Ordinal} (h : IsLimit o) : 0 < o :=
  IsSuccLimit.bot_lt h
Limit ordinals are greater than zero
Informal description
For any limit ordinal $o$, it holds that $0 < o$.
Ordinal.IsLimit.ne_zero theorem
{o : Ordinal} (h : IsLimit o) : o ≠ 0
Full source
theorem IsLimit.ne_zero {o : Ordinal} (h : IsLimit o) : o ≠ 0 :=
  h.pos.ne'
Limit ordinals are nonzero
Informal description
For any limit ordinal $o$, it holds that $o \neq 0$.
Ordinal.IsLimit.one_lt theorem
{o : Ordinal} (h : IsLimit o) : 1 < o
Full source
theorem IsLimit.one_lt {o : Ordinal} (h : IsLimit o) : 1 < o := by
  simpa only [succ_zero] using h.succ_lt h.pos
Limit ordinals are greater than one
Informal description
For any limit ordinal $o$, it holds that $1 < o$.
Ordinal.IsLimit.nat_lt theorem
{o : Ordinal} (h : IsLimit o) : ∀ n : ℕ, (n : Ordinal) < o
Full source
theorem IsLimit.nat_lt {o : Ordinal} (h : IsLimit o) : ∀ n : , (n : Ordinal) < o
  | 0 => h.pos
  | n + 1 => h.succ_lt (IsLimit.nat_lt h n)
Natural Numbers are Below Limit Ordinals: $n < o$ for all $n \in \mathbb{N}$ when $o$ is a limit ordinal
Informal description
For any limit ordinal $o$ and any natural number $n$, the ordinal corresponding to $n$ is strictly less than $o$.
Ordinal.zero_or_succ_or_limit theorem
(o : Ordinal) : o = 0 ∨ (∃ a, o = succ a) ∨ IsLimit o
Full source
theorem zero_or_succ_or_limit (o : Ordinal) : o = 0 ∨ (∃ a, o = succ a) ∨ IsLimit o := by
  simpa [eq_comm] using isMin_or_mem_range_succ_or_isSuccLimit o
Classification of Ordinals: Zero, Successor, or Limit
Informal description
For any ordinal $o$, exactly one of the following holds: 1. $o = 0$, or 2. There exists an ordinal $a$ such that $o = \mathrm{succ}(a)$, or 3. $o$ is a limit ordinal (i.e., $o$ is neither zero nor a successor ordinal).
Ordinal.isLimit_of_not_succ_of_ne_zero theorem
{o : Ordinal} (h : ¬∃ a, o = succ a) (h' : o ≠ 0) : IsLimit o
Full source
theorem isLimit_of_not_succ_of_ne_zero {o : Ordinal} (h : ¬∃ a, o = succ a) (h' : o ≠ 0) :
    IsLimit o := ((zero_or_succ_or_limit o).resolve_left h').resolve_left h
Characterization of Limit Ordinals: Non-Zero and Non-Successor Implies Limit
Informal description
For any ordinal $o$, if $o$ is neither zero nor a successor ordinal (i.e., there does not exist an ordinal $a$ such that $o = \mathrm{succ}(a)$), then $o$ is a limit ordinal.
Ordinal.IsLimit.sSup_Iio theorem
{o : Ordinal} (h : IsLimit o) : sSup (Iio o) = o
Full source
theorem IsLimit.sSup_Iio {o : Ordinal} (h : IsLimit o) : sSup (Iio o) = o := by
  apply (csSup_le' (fun a ha ↦ le_of_lt ha)).antisymm
  apply le_of_forall_lt
  intro a ha
  exact (lt_succ a).trans_le (le_csSup bddAbove_Iio (h.succ_lt ha))
Supremum of Predecessors of a Limit Ordinal Equals the Ordinal
Informal description
For any limit ordinal $o$, the supremum of the set of all ordinals less than $o$ is equal to $o$ itself, i.e., $\sup \{a \mid a < o\} = o$.
Ordinal.IsLimit.iSup_Iio theorem
{o : Ordinal} (h : IsLimit o) : ⨆ a : Iio o, a.1 = o
Full source
theorem IsLimit.iSup_Iio {o : Ordinal} (h : IsLimit o) : ⨆ a : Iio o, a.1 = o := by
  rw [← sSup_eq_iSup', h.sSup_Iio]
Supremum of Predecessors of a Limit Ordinal Equals the Ordinal
Informal description
For any limit ordinal $o$, the supremum of all ordinals less than $o$ is equal to $o$, i.e., \[ \bigsqcup_{a < o} a = o. \]
Ordinal.limitRecOn definition
{motive : Ordinal → Sort*} (o : Ordinal) (zero : motive 0) (succ : ∀ o, motive o → motive (succ o)) (isLimit : ∀ o, IsLimit o → (∀ o' < o, motive o') → motive o) : motive o
Full source
/-- 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. -/
@[elab_as_elim]
def limitRecOn {motive : Ordinal → Sort*} (o : Ordinal)
    (zero : motive 0) (succ : ∀ o, motive o → motive (succ o))
    (isLimit : ∀ o, IsLimit o → (∀ o' < o, motive o') → motive o) : motive o := by
  refine SuccOrder.limitRecOn o (fun a ha ↦ ?_) (fun a _ ↦ succ a) isLimit
  convert zero
  simpa using ha
Transfinite induction on ordinals
Informal description
The principle of transfinite induction on ordinals, which allows proving a property `motive` for all ordinals by: 1. Proving it for the zero ordinal (`zero : motive 0`) 2. Proving it for successor ordinals assuming it holds for the predecessor (`succ : ∀ o, motive o → motive (succ o)`) 3. Proving it for limit ordinals assuming it holds for all smaller ordinals (`isLimit : ∀ o, IsLimit o → (∀ o' < o, motive o') → motive o`)
Ordinal.limitRecOn_zero theorem
{motive} (H₁ H₂ H₃) : @limitRecOn motive 0 H₁ H₂ H₃ = H₁
Full source
@[simp]
theorem limitRecOn_zero {motive} (H₁ H₂ H₃) : @limitRecOn motive 0 H₁ H₂ H₃ = H₁ :=
  SuccOrder.limitRecOn_isMin _ _ _ isMin_bot
Transfinite Recursion at Zero: $\text{limitRecOn}\ 0 = H_1$
Informal description
For any property `motive` defined on ordinals, the transfinite recursion `limitRecOn` evaluated at the zero ordinal `0` with base case `H₁`, successor case `H₂`, and limit case `H₃` simplifies to `H₁`. That is, $\text{limitRecOn}\ 0\ H_1\ H_2\ H_3 = H_1$.
Ordinal.limitRecOn_succ theorem
{motive} (o H₁ H₂ H₃) : @limitRecOn motive (succ o) H₁ H₂ H₃ = H₂ o (@limitRecOn motive o H₁ H₂ H₃)
Full source
@[simp]
theorem limitRecOn_succ {motive} (o H₁ H₂ H₃) :
    @limitRecOn motive (succ o) H₁ H₂ H₃ = H₂ o (@limitRecOn motive o H₁ H₂ H₃) :=
  SuccOrder.limitRecOn_succ ..
Transfinite Recursion at Successor Ordinals: $\text{limitRecOn}(\text{succ}(o)) = H_2(o, \text{limitRecOn}(o))$
Informal description
For any property `motive` defined on ordinals, the transfinite recursion `limitRecOn` evaluated at the successor ordinal `succ o` with base case `H₁`, successor case `H₂`, and limit case `H₃` simplifies to `H₂ o (limitRecOn o H₁ H₂ H₃)`. In other words, the recursive definition at a successor ordinal `succ o` is given by applying the successor case `H₂` to the predecessor `o` and the recursive result at `o`.
Ordinal.limitRecOn_limit theorem
{motive} (o H₁ H₂ H₃ h) : @limitRecOn motive o H₁ H₂ H₃ = H₃ o h fun x _h => @limitRecOn motive x H₁ H₂ H₃
Full source
@[simp]
theorem limitRecOn_limit {motive} (o H₁ H₂ H₃ h) :
    @limitRecOn motive o H₁ H₂ H₃ = H₃ o h fun x _h => @limitRecOn motive x H₁ H₂ H₃ :=
  SuccOrder.limitRecOn_of_isSuccLimit ..
Transfinite Recursion at Limit Ordinals
Informal description
Let $o$ be a limit ordinal and let `motive` be a property on ordinals. Suppose we have: 1. A proof `H₁` of `motive 0` (base case for zero) 2. A proof `H₂` that for any ordinal $o'$, `motive o'` implies `motive (succ o')` (successor case) 3. A proof `H₃` that for any limit ordinal $o''$ and any family of proofs that `motive o'''` holds for all $o''' < o''$, we have `motive o''` (limit case) Then the transfinite recursion `limitRecOn` applied to $o$ with these cases equals the application of the limit case `H₃` to $o$, its limit property `h`, and the recursive application of `limitRecOn` to all smaller ordinals.
Ordinal.boundedLimitRecOn definition
{l : Ordinal} (lLim : l.IsLimit) {motive : Iio l → Sort*} (o : Iio l) (zero : motive ⟨0, lLim.pos⟩) (succ : (o : Iio l) → motive o → motive ⟨succ o, lLim.succ_lt o.2⟩) (isLimit : (o : Iio l) → IsLimit o → (Π o' < o, motive o') → motive o) : motive o
Full source
/-- Bounded recursion on ordinals. Similar to `limitRecOn`, with the assumption `o < l`
  added to all cases. The final term's domain is the ordinals below `l`. -/
@[elab_as_elim]
def boundedLimitRecOn {l : Ordinal} (lLim : l.IsLimit) {motive : Iio l → Sort*} (o : Iio l)
    (zero : motive ⟨0, lLim.pos⟩)
    (succ : (o : Iio l) → motive o → motive ⟨succ o, lLim.succ_lt o.2⟩)
    (isLimit : (o : Iio l) → IsLimit o → (Π o' < o, motive o') → motive o) : motive o :=
  limitRecOn (motive := fun p ↦ (h : p < l) → motive ⟨p, h⟩) o.1 (fun _ ↦ zero)
    (fun o ih h ↦ succ ⟨o, _⟩ <| ih <| (lt_succ o).trans h)
    (fun _o ho ih _ ↦ isLimit _ ho fun _o' h ↦ ih _ h _) o.2
Bounded transfinite recursion on ordinals below a limit
Informal description
Given a limit ordinal $l$ and a property `motive` defined on ordinals less than $l$, the function `boundedLimitRecOn` allows proving `motive o` for all $o < l$ by: 1. Proving it for the zero ordinal (`zero : motive 0`) 2. Proving it for successor ordinals $o + 1$ assuming it holds for $o$ (`succ : ∀ o < l, motive o → motive (o + 1)`) 3. Proving it for limit ordinals $o < l$ assuming it holds for all smaller ordinals (`isLimit : ∀ o < l, IsLimit o → (∀ o' < o, motive o') → motive o`)
Ordinal.boundedLimitRec_zero theorem
{l} (lLim : l.IsLimit) {motive} (H₁ H₂ H₃) : @boundedLimitRecOn l lLim motive ⟨0, lLim.pos⟩ H₁ H₂ H₃ = H₁
Full source
@[simp]
theorem boundedLimitRec_zero {l} (lLim : l.IsLimit) {motive} (H₁ H₂ H₃) :
    @boundedLimitRecOn l lLim motive ⟨0, lLim.pos⟩ H₁ H₂ H₃ = H₁ := by
  rw [boundedLimitRecOn, limitRecOn_zero]
Bounded Transfinite Recursion at Zero: $\text{boundedLimitRecOn}\ 0 = H_1$
Informal description
For any limit ordinal $l$ and any property `motive` defined on ordinals less than $l$, the bounded transfinite recursion evaluated at the zero ordinal $\langle 0, l_{\text{Lim.pos}}\rangle$ (where $0 < l$ by the limit property) with base case $H_1$, successor case $H_2$, and limit case $H_3$ simplifies to $H_1$. That is, $$\text{boundedLimitRecOn}\ l\ l_{\text{Lim}}\ \text{motive}\ \langle 0, l_{\text{Lim.pos}}\rangle\ H_1\ H_2\ H_3 = H_1.$$
Ordinal.boundedLimitRec_succ theorem
{l} (lLim : l.IsLimit) {motive} (o H₁ H₂ H₃) : @boundedLimitRecOn l lLim motive ⟨succ o.1, lLim.succ_lt o.2⟩ H₁ H₂ H₃ = H₂ o (@boundedLimitRecOn l lLim motive o H₁ H₂ H₃)
Full source
@[simp]
theorem boundedLimitRec_succ {l} (lLim : l.IsLimit) {motive} (o H₁ H₂ H₃) :
    @boundedLimitRecOn l lLim motive ⟨succ o.1, lLim.succ_lt o.2⟩ H₁ H₂ H₃ = H₂ o
    (@boundedLimitRecOn l lLim motive o H₁ H₂ H₃) := by
  rw [boundedLimitRecOn, limitRecOn_succ]
  rfl
Bounded Transfinite Recursion at Successor Ordinals: $\text{boundedLimitRecOn}(\text{succ}(o)) = H_2(o, \text{boundedLimitRecOn}(o))$
Informal description
Let $l$ be a limit ordinal, and let `motive` be a property defined on ordinals less than $l$. Suppose we have: 1. A proof `H₁` of `motive 0` (base case for zero) 2. A proof `H₂` that for any ordinal $o < l$, `motive o` implies `motive (succ o)` (successor case) 3. A proof `H₃` that for any limit ordinal $o < l$ and any family of proofs that `motive o'` holds for all $o' < o$, we have `motive o` (limit case) Then for any ordinal $o < l$, the bounded transfinite recursion `boundedLimitRecOn` applied to the successor ordinal $\langle \text{succ}(o), l_{\text{Lim.succ\_lt}}(o.2) \rangle$ equals the application of the successor case `H₂` to $o$ and the recursive application of `boundedLimitRecOn` to $o$.
Ordinal.boundedLimitRec_limit theorem
{l} (lLim : l.IsLimit) {motive} (o H₁ H₂ H₃ oLim) : @boundedLimitRecOn l lLim motive o H₁ H₂ H₃ = H₃ o oLim (fun x _ ↦ @boundedLimitRecOn l lLim motive x H₁ H₂ H₃)
Full source
theorem boundedLimitRec_limit {l} (lLim : l.IsLimit) {motive} (o H₁ H₂ H₃ oLim) :
    @boundedLimitRecOn l lLim motive o H₁ H₂ H₃ = H₃ o oLim (fun x _ ↦
    @boundedLimitRecOn l lLim motive x H₁ H₂ H₃) := by
  rw [boundedLimitRecOn, limitRecOn_limit]
  rfl
Bounded Transfinite Recursion at Limit Ordinals: `boundedLimitRecOn o = H₃ o oLim (λx _ ↦ boundedLimitRecOn x)`
Informal description
Let $l$ be a limit ordinal, and let `motive` be a property defined on ordinals less than $l$. Suppose we have: 1. A proof `H₁` of `motive 0` (base case for zero) 2. A proof `H₂` that for any ordinal $o < l$, `motive o` implies `motive (succ o)` (successor case) 3. A proof `H₃` that for any limit ordinal $o < l$ and any family of proofs that `motive o'` holds for all $o' < o$, we have `motive o` (limit case) Then for any limit ordinal $o < l$ with proof `oLim` of `IsLimit o`, the bounded transfinite recursion `boundedLimitRecOn` applied to $o$ equals the application of the limit case `H₃` to $o$, its limit property `oLim`, and the recursive application of `boundedLimitRecOn` to all smaller ordinals.
Ordinal.orderTopToTypeSucc instance
(o : Ordinal) : OrderTop (succ o).toType
Full source
instance orderTopToTypeSucc (o : Ordinal) : OrderTop (succ o).toType :=
  @OrderTop.mk _ _ (Top.mk _) le_enum_succ
Successor Ordinal's Canonical Type has a Top Element
Informal description
For any ordinal $o$, the canonical type associated with the successor ordinal $\mathrm{succ}(o)$ has a greatest element with respect to its linear order structure.
Ordinal.enum_succ_eq_top theorem
{o : Ordinal} : enum (α := (succ o).toType) (· < ·) ⟨o, type_toType _ ▸ lt_succ o⟩ = ⊤
Full source
theorem enum_succ_eq_top {o : Ordinal} :
    enum (α := (succ o).toType) (· < ·) ⟨o, type_toType _ ▸ lt_succ o⟩ =  :=
  rfl
Enumeration of Successor Ordinal's Top Element
Informal description
For any ordinal $o$, the enumeration of the element corresponding to $o$ in the canonical type of the successor ordinal $\mathrm{succ}(o)$ (with respect to its well-order) is equal to the top element of that type.
Ordinal.has_succ_of_type_succ_lt theorem
{α} {r : α → α → Prop} [wo : IsWellOrder α r] (h : ∀ a < type r, succ a < type r) (x : α) : ∃ y, r x y
Full source
theorem has_succ_of_type_succ_lt {α} {r : α → α → Prop} [wo : IsWellOrder α r]
    (h : ∀ a < type r, succ a < type r) (x : α) : ∃ y, r x y := by
  use enum r ⟨succ (typein r x), h _ (typein_lt_type r x)⟩
  convert enum_lt_enum.mpr _
  · rw [enum_typein]
  · rw [Subtype.mk_lt_mk, lt_succ_iff]
Existence of Greater Element in Well-Orders Closed Under Successors
Informal description
Let $\alpha$ be a type with a well-order relation $r$, and suppose that for every ordinal $a$ less than the order type of $r$, the successor of $a$ is also less than the order type of $r$. Then for every element $x \in \alpha$, there exists an element $y \in \alpha$ such that $r(x, y)$ holds. In other words, if the order type of $r$ is closed under successors for all ordinals below it, then the well-order $r$ has no maximal element.
Ordinal.toType_noMax_of_succ_lt theorem
{o : Ordinal} (ho : ∀ a < o, succ a < o) : NoMaxOrder o.toType
Full source
theorem toType_noMax_of_succ_lt {o : Ordinal} (ho : ∀ a < o, succ a < o) : NoMaxOrder o.toType :=
  ⟨has_succ_of_type_succ_lt (type_toType _ ▸ ho)⟩
No Maximal Element in Canonical Type of Limit-Closed Ordinals
Informal description
For any ordinal $o$, if for every ordinal $a < o$ the successor $\mathrm{succ}(a)$ is also less than $o$, then the canonical type associated with $o$ (via `Ordinal.toType`) has no maximal element with respect to its order relation.
Ordinal.bounded_singleton theorem
{r : α → α → Prop} [IsWellOrder α r] (hr : (type r).IsLimit) (x) : Bounded r { x }
Full source
theorem bounded_singleton {r : α → α → Prop} [IsWellOrder α r] (hr : (type r).IsLimit) (x) :
    Bounded r {x} := by
  refine ⟨enum r ⟨succ (typein r x), hr.succ_lt (typein_lt_type r x)⟩, ?_⟩
  intro b hb
  rw [mem_singleton_iff.1 hb]
  nth_rw 1 [← enum_typein r x]
  rw [@enum_lt_enum _ r, Subtype.mk_lt_mk]
  apply lt_succ
Singleton Sets are Bounded in Well-Orders with Limit Order Type
Informal description
For any well-order relation $r$ on a type $\alpha$ such that the order type of $r$ is a limit ordinal, and for any element $x \in \alpha$, the singleton set $\{x\}$ is bounded with respect to $r$.
Ordinal.typein_ordinal theorem
(o : Ordinal.{u}) : @typein Ordinal (· < ·) _ o = Ordinal.lift.{u + 1} o
Full source
@[simp]
theorem typein_ordinal (o : OrdinalOrdinal.{u}) :
    @typein Ordinal (· < ·) _ o = Ordinal.lift.{u + 1} o := by
  refine Quotient.inductionOn o ?_
  rintro ⟨α, r, wo⟩; apply Quotient.sound
  constructor; refine ((RelIso.preimage Equiv.ulift r).trans (enum r).symm).symm
Order Type of Initial Segment Equals Universe-Lifted Ordinal
Informal description
For any ordinal $o$, the order type of the initial segment of ordinals less than $o$ (with respect to the standard order $<$) is equal to the universe-lifted ordinal $o$, i.e., $\text{typein}(<, o) = \text{lift}_{u+1}(o)$.
Ordinal.mk_Iio_ordinal theorem
(o : Ordinal.{u}) : #(Iio o) = Cardinal.lift.{u + 1} o.card
Full source
theorem mk_Iio_ordinal (o : OrdinalOrdinal.{u}) :
    #(Iio o) = Cardinal.lift.{u + 1} o.card := by
  rw [lift_card, ← typein_ordinal]
  rfl
Cardinality of Initial Segment of Ordinals: $\#(\{x \mid x < o\}) = \text{lift}(\text{card}(o))$
Informal description
For any ordinal $o$, the cardinality of the set of ordinals less than $o$ (denoted $\{x \mid x < o\}$) is equal to the universe-lifted cardinality of $o$, i.e., $\#(\{x \mid x < o\}) = \text{lift}_{u+1}(\text{card}(o))$.
Ordinal.IsNormal definition
(f : Ordinal → Ordinal) : Prop
Full source
/-- 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`. -/
def IsNormal (f : OrdinalOrdinal) : Prop :=
  (∀ o, f o < f (succ o)) ∧ ∀ o, IsLimit o → ∀ a, f o ≤ a ↔ ∀ b < o, f b ≤ a
Normal ordinal function
Informal description
A function $f$ from ordinals to ordinals is called *normal* if it satisfies two conditions: 1. It is strictly increasing: for every ordinal $o$, $f(o) < f(\text{succ } o)$. 2. It is order-continuous: for every limit ordinal $o$, the value $f(o)$ is the supremum of all $f(b)$ for $b < o$. That is, for any ordinal $a$, $f(o) \leq a$ if and only if $f(b) \leq a$ for all $b < o$.
Ordinal.IsNormal.limit_le theorem
{f} (H : IsNormal f) : ∀ {o}, IsLimit o → ∀ {a}, f o ≤ a ↔ ∀ b < o, f b ≤ a
Full source
theorem IsNormal.limit_le {f} (H : IsNormal f) :
    ∀ {o}, IsLimit o → ∀ {a}, f o ≤ a ↔ ∀ b < o, f b ≤ a :=
  @H.2
Limit Ordinal Property for Normal Functions: $f(o) \leq a \leftrightarrow \forall b < o, f(b) \leq a$
Informal description
For any normal ordinal function $f$ and any limit ordinal $o$, the inequality $f(o) \leq a$ holds if and only if $f(b) \leq a$ for all $b < o$.
Ordinal.IsNormal.limit_lt theorem
{f} (H : IsNormal f) {o} (h : IsLimit o) {a} : a < f o ↔ ∃ b < o, a < f b
Full source
theorem IsNormal.limit_lt {f} (H : IsNormal f) {o} (h : IsLimit o) {a} :
    a < f o ↔ ∃ b < o, a < f b :=
  not_iff_not.1 <| by simpa only [exists_prop, not_exists, not_and, not_lt] using H.2 _ h a
Characterization of Inequality for Normal Functions at Limit Ordinals: $a < f(o) \leftrightarrow \exists b < o, a < f(b)$
Informal description
Let $f$ be a normal ordinal function and $o$ be a limit ordinal. For any ordinal $a$, we have $a < f(o)$ if and only if there exists an ordinal $b < o$ such that $a < f(b)$.
Ordinal.IsNormal.strictMono theorem
{f} (H : IsNormal f) : StrictMono f
Full source
theorem IsNormal.strictMono {f} (H : IsNormal f) : StrictMono f := fun a b =>
  limitRecOn b (Not.elim (not_lt_of_le <| Ordinal.zero_le _))
    (fun _b IH h =>
      (lt_or_eq_of_le (le_of_lt_succ h)).elim (fun h => (IH h).trans (H.1 _)) fun e => e ▸ H.1 _)
    fun _b l _IH h => lt_of_lt_of_le (H.1 a) ((H.2 _ l _).1 le_rfl _ (l.succ_lt h))
Normal ordinal functions are strictly increasing
Informal description
If $f$ is a normal ordinal function, then $f$ is strictly increasing. That is, for any ordinals $a$ and $b$, if $a < b$ then $f(a) < f(b)$.
Ordinal.IsNormal.monotone theorem
{f} (H : IsNormal f) : Monotone f
Full source
theorem IsNormal.monotone {f} (H : IsNormal f) : Monotone f :=
  H.strictMono.monotone
Normal ordinal functions are monotone
Informal description
If $f$ is a normal ordinal function, then $f$ is monotone. That is, for any ordinals $a$ and $b$, if $a \leq b$ then $f(a) \leq f(b)$.
Ordinal.isNormal_iff_strictMono_limit theorem
(f : Ordinal → Ordinal) : IsNormal f ↔ StrictMono f ∧ ∀ o, IsLimit o → ∀ a, (∀ b < o, f b ≤ a) → f o ≤ a
Full source
theorem isNormal_iff_strictMono_limit (f : OrdinalOrdinal) :
    IsNormalIsNormal f ↔ StrictMono f ∧ ∀ o, IsLimit o → ∀ a, (∀ b < o, f b ≤ a) → f o ≤ a :=
  ⟨fun hf => ⟨hf.strictMono, fun a ha c => (hf.2 a ha c).2⟩, fun ⟨hs, hl⟩ =>
    ⟨fun a => hs (lt_succ a), fun a ha c =>
      ⟨fun hac _b hba => ((hs hba).trans_le hac).le, hl a ha c⟩⟩⟩
Characterization of Normal Ordinal Functions: Strictly Increasing and Limit-Preserving
Informal description
A function $f \colon \mathrm{Ordinal} \to \mathrm{Ordinal}$ is normal if and only if it is strictly increasing and for every limit ordinal $o$ and every ordinal $a$, if $f(b) \leq a$ for all $b < o$, then $f(o) \leq a$.
Ordinal.IsNormal.lt_iff theorem
{f} (H : IsNormal f) {a b} : f a < f b ↔ a < b
Full source
theorem IsNormal.lt_iff {f} (H : IsNormal f) {a b} : f a < f b ↔ a < b :=
  StrictMono.lt_iff_lt <| H.strictMono
Normal functions preserve strict order: $f(a) < f(b) \leftrightarrow a < b$
Informal description
For any normal ordinal function $f$ and ordinals $a$ and $b$, the inequality $f(a) < f(b)$ holds if and only if $a < b$.
Ordinal.IsNormal.le_iff theorem
{f} (H : IsNormal f) {a b} : f a ≤ f b ↔ a ≤ b
Full source
theorem IsNormal.le_iff {f} (H : IsNormal f) {a b} : f a ≤ f b ↔ a ≤ b :=
  le_iff_le_iff_lt_iff_lt.2 H.lt_iff
Normal functions preserve order: $f(a) \leq f(b) \leftrightarrow a \leq b$
Informal description
For any normal ordinal function $f$ and ordinals $a$ and $b$, the inequality $f(a) \leq f(b)$ holds if and only if $a \leq b$.
Ordinal.IsNormal.inj theorem
{f} (H : IsNormal f) {a b} : f a = f b ↔ a = b
Full source
theorem IsNormal.inj {f} (H : IsNormal f) {a b} : f a = f b ↔ a = b := by
  simp only [le_antisymm_iff, H.le_iff]
Normal ordinal functions are injective: $f(a) = f(b) \leftrightarrow a = b$
Informal description
For any normal ordinal function $f$ and ordinals $a$ and $b$, we have $f(a) = f(b)$ if and only if $a = b$.
Ordinal.IsNormal.id_le theorem
{f} (H : IsNormal f) : id ≤ f
Full source
theorem IsNormal.id_le {f} (H : IsNormal f) : id ≤ f :=
  H.strictMono.id_le
Identity is Pointwise Below Normal Ordinal Functions
Informal description
For any normal ordinal function $f$, the identity function is pointwise less than or equal to $f$, i.e., for every ordinal $a$, we have $a \leq f(a)$.
Ordinal.IsNormal.le_apply theorem
{f} (H : IsNormal f) {a} : a ≤ f a
Full source
theorem IsNormal.le_apply {f} (H : IsNormal f) {a} : a ≤ f a :=
  H.strictMono.le_apply
Normal ordinal functions dominate the identity
Informal description
For any normal ordinal function $f$ and any ordinal $a$, we have $a \leq f(a)$.
Ordinal.IsNormal.le_iff_eq theorem
{f} (H : IsNormal f) {a} : f a ≤ a ↔ f a = a
Full source
theorem IsNormal.le_iff_eq {f} (H : IsNormal f) {a} : f a ≤ a ↔ f a = a :=
  H.le_apply.le_iff_eq
Fixed Point Characterization for Normal Ordinal Functions: $f(a) \leq a \leftrightarrow f(a) = a$
Informal description
For any normal ordinal function $f$ and any ordinal $a$, the inequality $f(a) \leq a$ holds if and only if $f(a) = a$.
Ordinal.IsNormal.le_set theorem
{f o} (H : IsNormal f) (p : Set Ordinal) (p0 : p.Nonempty) (b) (H₂ : ∀ o, b ≤ o ↔ ∀ a ∈ p, a ≤ o) : f b ≤ o ↔ ∀ a ∈ p, f a ≤ o
Full source
theorem IsNormal.le_set {f o} (H : IsNormal f) (p : Set Ordinal) (p0 : p.Nonempty) (b)
    (H₂ : ∀ o, b ≤ o ↔ ∀ a ∈ p, a ≤ o) : f b ≤ o ↔ ∀ a ∈ p, f a ≤ o :=
  ⟨fun h _ pa => (H.le_iff.2 ((H₂ _).1 le_rfl _ pa)).trans h, fun h => by
    induction b using limitRecOn with
    | zero =>
      obtain ⟨x, px⟩ := p0
      have := Ordinal.le_zero.1 ((H₂ _).1 (Ordinal.zero_le _) _ px)
      rw [this] at px
      exact h _ px
    | succ S _ =>
      rcases not_forall₂.1 (mt (H₂ S).2 <| (lt_succ S).not_le) with ⟨a, h₁, h₂⟩
      exact (H.le_iff.2 <| succ_le_of_lt <| not_le.1 h₂).trans (h _ h₁)
    | isLimit S L _ =>
      refine (H.2 _ L _).2 fun a h' => ?_
      rcases not_forall₂.1 (mt (H₂ a).2 h'.not_le) with ⟨b, h₁, h₂⟩
      exact (H.le_iff.2 <| (not_le.1 h₂).le).trans (h _ h₁)⟩
Normal Function Inequality for Suprema: $f(\sup p) \leq o \leftrightarrow \forall a \in p, f(a) \leq o$
Informal description
Let $f$ be a normal ordinal function, $p$ be a nonempty set of ordinals, and $b$ be an ordinal such that for every ordinal $o$, $b \leq o$ if and only if for all $a \in p$, $a \leq o$. Then for any ordinal $o$, the inequality $f(b) \leq o$ holds if and only if for all $a \in p$, $f(a) \leq o$.
Ordinal.IsNormal.le_set' theorem
{f o} (H : IsNormal f) (p : Set α) (p0 : p.Nonempty) (g : α → Ordinal) (b) (H₂ : ∀ o, b ≤ o ↔ ∀ a ∈ p, g a ≤ o) : f b ≤ o ↔ ∀ a ∈ p, f (g a) ≤ o
Full source
theorem IsNormal.le_set' {f o} (H : IsNormal f) (p : Set α) (p0 : p.Nonempty) (g : α → Ordinal) (b)
    (H₂ : ∀ o, b ≤ o ↔ ∀ a ∈ p, g a ≤ o) : f b ≤ o ↔ ∀ a ∈ p, f (g a) ≤ o := by
  simpa [H₂] using H.le_set (g '' p) (p0.image g) b
Normal Function Inequality for Suprema with General Index Set: $f(\sup g(p)) \leq o \leftrightarrow \forall a \in p, f(g(a)) \leq o$
Informal description
Let $f$ be a normal ordinal function, $p$ be a nonempty set of elements of type $\alpha$, and $g : \alpha \to \text{Ordinal}$ be a function. Suppose $b$ is an ordinal such that for every ordinal $o$, $b \leq o$ if and only if for all $a \in p$, $g(a) \leq o$. Then for any ordinal $o$, the inequality $f(b) \leq o$ holds if and only if for all $a \in p$, $f(g(a)) \leq o$.
Ordinal.IsNormal.refl theorem
: IsNormal id
Full source
theorem IsNormal.refl : IsNormal id :=
  ⟨lt_succ, fun _o l _a => Ordinal.limit_le l⟩
Identity Function is Normal on Ordinals
Informal description
The identity function on ordinals is normal, meaning it is strictly increasing and order-continuous. That is, for any ordinals $a$ and $b$: 1. If $a < b$, then $a < b$ (strictly increasing). 2. For any limit ordinal $o$, the identity function satisfies $\text{id}(o) = \sup_{a < o} \text{id}(a)$ (order-continuous).
Ordinal.IsNormal.trans theorem
{f g} (H₁ : IsNormal f) (H₂ : IsNormal g) : IsNormal (f ∘ g)
Full source
theorem IsNormal.trans {f g} (H₁ : IsNormal f) (H₂ : IsNormal g) : IsNormal (f ∘ g) :=
  ⟨fun _x => H₁.lt_iff.2 (H₂.1 _), fun o l _a =>
    H₁.le_set' (· < o) ⟨0, l.pos⟩ g _ fun _c => H₂.2 _ l _⟩
Composition of Normal Ordinal Functions is Normal
Informal description
If $f$ and $g$ are normal ordinal functions, then their composition $f \circ g$ is also a normal ordinal function. That is: 1. $f \circ g$ is strictly increasing: for any ordinals $a < b$, we have $(f \circ g)(a) < (f \circ g)(b)$. 2. $f \circ g$ is order-continuous: for any limit ordinal $o$, $(f \circ g)(o) = \sup_{a < o} (f \circ g)(a)$.
Ordinal.IsNormal.isLimit theorem
{f} (H : IsNormal f) {o} (ho : IsLimit o) : IsLimit (f o)
Full source
theorem IsNormal.isLimit {f} (H : IsNormal f) {o} (ho : IsLimit o) : IsLimit (f o) := by
  rw [isLimit_iff, isSuccPrelimit_iff_succ_lt]
  use (H.lt_iff.2 ho.pos).ne_bot
  intro a ha
  obtain ⟨b, hb, hab⟩ := (H.limit_lt ho).1 ha
  rw [← succ_le_iff] at hab
  apply hab.trans_lt
  rwa [H.lt_iff]
Normal functions preserve limit ordinals: $f(o)$ is limit when $o$ is limit
Informal description
Let $f$ be a normal ordinal function and $o$ be a limit ordinal. Then the image $f(o)$ is also a limit ordinal.
Ordinal.add_le_of_limit theorem
{a b c : Ordinal} (h : IsLimit b) : a + b ≤ c ↔ ∀ b' < b, a + b' ≤ c
Full source
theorem add_le_of_limit {a b c : Ordinal} (h : IsLimit b) :
    a + b ≤ c ↔ ∀ b' < b, a + b' ≤ c :=
  ⟨fun h _ l => (add_le_add_left l.le _).trans h, fun H =>
    le_of_not_lt <| by
      -- Porting note: `induction` tactics are required because of the parser bug.
      induction a using inductionOn with
      | H α r =>
        induction b using inductionOn with
        | H β s =>
          intro l
          suffices ∀ x : β, Sum.Lex r s (Sum.inr x) (enum _ ⟨_, l⟩) by
            -- Porting note: `revert` & `intro` is required because `cases'` doesn't replace
            --               `enum _ _ l` in `this`.
            revert this; rcases enum _ ⟨_, l⟩ with x | x <;> intro this
            · cases this (enum s ⟨0, h.pos⟩)
            · exact irrefl _ (this _)
          intro x
          rw [← typein_lt_typein (Sum.Lex r s), typein_enum]
          have := H _ (h.succ_lt (typein_lt_type s x))
          rw [add_succ, succ_le_iff] at this
          refine
            (RelEmbedding.ofMonotone (fun a => ?_) fun a b => ?_).ordinal_type_le.trans_lt this
          · rcases a with ⟨a | b, h⟩
            · exact Sum.inl a
            · exact Sum.inr ⟨b, by cases h; assumption⟩
          · rcases a with ⟨a | a, h₁⟩ <;> rcases b with ⟨b | b, h₂⟩ <;> cases h₁ <;> cases h₂ <;>
              rintro ⟨⟩ <;> constructor <;> assumption⟩
Limit Ordinal Addition Inequality: $a + b \leq c$ for $b$ limit iff $a + b' \leq c$ for all $b' < b$
Informal description
For ordinals $a$, $b$, and $c$, if $b$ is a limit ordinal, then the sum $a + b$ is less than or equal to $c$ if and only if for every ordinal $b' < b$, the sum $a + b'$ is less than or equal to $c$.
Ordinal.isNormal_add_right theorem
(a : Ordinal) : IsNormal (a + ·)
Full source
theorem isNormal_add_right (a : Ordinal) : IsNormal (a + ·) :=
  ⟨fun b => (add_lt_add_iff_left a).2 (lt_succ b), fun _b l _c => add_le_of_limit l⟩
Right Addition is a Normal Ordinal Function
Informal description
For any ordinal $a$, the function $f(b) = a + b$ is a normal ordinal function. That is: 1. $f$ is strictly increasing: for any ordinals $b_1 < b_2$, we have $a + b_1 < a + b_2$. 2. $f$ is order-continuous: for any limit ordinal $b$, the value $a + b$ is the supremum of all $a + b'$ for $b' < b$.
Ordinal.isLimit_add theorem
(a) {b} : IsLimit b → IsLimit (a + b)
Full source
theorem isLimit_add (a) {b} : IsLimit b → IsLimit (a + b) :=
  (isNormal_add_right a).isLimit
Sum with Limit Ordinal is Limit
Informal description
For any ordinal $a$ and any limit ordinal $b$, the sum $a + b$ is also a limit ordinal.
Ordinal.sub instance
: Sub Ordinal
Full source
/-- `a - b` is the unique ordinal satisfying `b + (a - b) = a` when `b ≤ a`. -/
instance sub : Sub Ordinal :=
  ⟨fun a b => sInf { o | a ≤ b + o }⟩
Subtraction of Ordinals
Informal description
For any two ordinals $a$ and $b$ with $b \leq a$, the subtraction $a - b$ is the unique ordinal satisfying $b + (a - b) = a$.
Ordinal.le_add_sub theorem
(a b : Ordinal) : a ≤ b + (a - b)
Full source
theorem le_add_sub (a b : Ordinal) : a ≤ b + (a - b) :=
  csInf_mem sub_nonempty
Inequality Relating Ordinal Addition and Subtraction
Informal description
For any two ordinals $a$ and $b$, the ordinal $a$ is less than or equal to the sum of $b$ and the difference $(a - b)$, i.e., $a \leq b + (a - b)$.
Ordinal.lt_sub theorem
{a b c : Ordinal} : a < b - c ↔ c + a < b
Full source
theorem lt_sub {a b c : Ordinal} : a < b - c ↔ c + a < b :=
  lt_iff_lt_of_le_iff_le sub_le
Ordinal Subtraction Inequality: $a < b - c \leftrightarrow c + a < b$
Informal description
For any ordinals $a$, $b$, and $c$, the inequality $a < b - c$ holds if and only if $c + a < b$.
Ordinal.add_sub_cancel theorem
(a b : Ordinal) : a + b - a = b
Full source
theorem add_sub_cancel (a b : Ordinal) : a + b - a = b :=
  le_antisymm (sub_le.2 <| le_rfl) ((add_le_add_iff_left a).1 <| le_add_sub _ _)
Cancellation Law for Ordinal Addition and Subtraction: $(a + b) - a = b$
Informal description
For any ordinals $a$ and $b$, the difference $(a + b) - a$ equals $b$.
Ordinal.sub_eq_of_add_eq theorem
{a b c : Ordinal} (h : a + b = c) : c - a = b
Full source
theorem sub_eq_of_add_eq {a b c : Ordinal} (h : a + b = c) : c - a = b :=
  h ▸ add_sub_cancel _ _
Subtraction from Sum: $c - a = b$ when $a + b = c$
Informal description
For any ordinals $a$, $b$, and $c$ such that $a + b = c$, the difference $c - a$ equals $b$.
Ordinal.sub_le_self theorem
(a b : Ordinal) : a - b ≤ a
Full source
theorem sub_le_self (a b : Ordinal) : a - b ≤ a :=
  sub_le.2 <| le_add_left _ _
Subtraction is Non-Increasing: $a - b \leq a$
Informal description
For any ordinals $a$ and $b$, the difference $a - b$ is less than or equal to $a$.
Ordinal.add_sub_cancel_of_le theorem
{a b : Ordinal} (h : b ≤ a) : b + (a - b) = a
Full source
protected theorem add_sub_cancel_of_le {a b : Ordinal} (h : b ≤ a) : b + (a - b) = a :=
  (le_add_sub a b).antisymm'
    (by
      rcases zero_or_succ_or_limit (a - b) with (e | ⟨c, e⟩ | l)
      · simp only [e, add_zero, h]
      · rw [e, add_succ, succ_le_iff, ← lt_sub, e]
        exact lt_succ c
      · exact (add_le_of_limit l).2 fun c l => (lt_sub.1 l).le)
Cancellation Law for Ordinal Addition and Subtraction: $b + (a - b) = a$ when $b \leq a$
Informal description
For any ordinals $a$ and $b$ with $b \leq a$, the sum of $b$ and the difference $(a - b)$ equals $a$, i.e., $b + (a - b) = a$.
Ordinal.le_sub_of_le theorem
{a b c : Ordinal} (h : b ≤ a) : c ≤ a - b ↔ b + c ≤ a
Full source
theorem le_sub_of_le {a b c : Ordinal} (h : b ≤ a) : c ≤ a - b ↔ b + c ≤ a := by
  rw [← add_le_add_iff_left b, Ordinal.add_sub_cancel_of_le h]
Characterization of Ordinal Subtraction via Addition: $c \leq a - b \leftrightarrow b + c \leq a$ when $b \leq a$
Informal description
For any ordinals $a$, $b$, and $c$ with $b \leq a$, the inequality $c \leq a - b$ holds if and only if $b + c \leq a$.
Ordinal.sub_lt_of_le theorem
{a b c : Ordinal} (h : b ≤ a) : a - b < c ↔ a < b + c
Full source
theorem sub_lt_of_le {a b c : Ordinal} (h : b ≤ a) : a - b < c ↔ a < b + c :=
  lt_iff_lt_of_le_iff_le (le_sub_of_le h)
Characterization of Ordinal Subtraction via Addition: $a - b < c \leftrightarrow a < b + c$ when $b \leq a$
Informal description
For any ordinals $a$, $b$, and $c$ with $b \leq a$, the inequality $a - b < c$ holds if and only if $a < b + c$.
Ordinal.sub_zero theorem
(a : Ordinal) : a - 0 = a
Full source
@[simp]
theorem sub_zero (a : Ordinal) : a - 0 = a := by simpa only [zero_add] using add_sub_cancel 0 a
Subtraction of Zero from an Ordinal: $a - 0 = a$
Informal description
For any ordinal $a$, the subtraction $a - 0$ equals $a$.
Ordinal.zero_sub theorem
(a : Ordinal) : 0 - a = 0
Full source
@[simp]
theorem zero_sub (a : Ordinal) : 0 - a = 0 := by rw [← Ordinal.le_zero]; apply sub_le_self
Subtraction from Zero Ordinal Yields Zero: $0 - a = 0$
Informal description
For any ordinal $a$, the difference $0 - a$ is equal to $0$.
Ordinal.sub_self theorem
(a : Ordinal) : a - a = 0
Full source
@[simp]
theorem sub_self (a : Ordinal) : a - a = 0 := by simpa only [add_zero] using add_sub_cancel a 0
Self-Subtraction of Ordinals Yields Zero: $a - a = 0$
Informal description
For any ordinal $a$, the difference $a - a$ equals zero.
Ordinal.sub_sub theorem
(a b c : Ordinal) : a - b - c = a - (b + c)
Full source
theorem sub_sub (a b c : Ordinal) : a - b - c = a - (b + c) :=
  eq_of_forall_ge_iff fun d => by rw [sub_le, sub_le, sub_le, add_assoc]
Subtraction Associativity for Ordinals: $(a - b) - c = a - (b + c)$
Informal description
For any ordinals $a$, $b$, and $c$, the subtraction operation satisfies $(a - b) - c = a - (b + c)$.
Ordinal.add_sub_add_cancel theorem
(a b c : Ordinal) : a + b - (a + c) = b - c
Full source
@[simp]
theorem add_sub_add_cancel (a b c : Ordinal) : a + b - (a + c) = b - c := by
  rw [← sub_sub, add_sub_cancel]
Cancellation Law for Ordinal Addition and Subtraction: $(a + b) - (a + c) = b - c$
Informal description
For any ordinals $a$, $b$, and $c$, the difference $(a + b) - (a + c)$ equals $b - c$.
Ordinal.le_sub_of_add_le theorem
{a b c : Ordinal} (h : b + c ≤ a) : c ≤ a - b
Full source
theorem le_sub_of_add_le {a b c : Ordinal} (h : b + c ≤ a) : c ≤ a - b := by
  rw [← add_le_add_iff_left b]
  exact h.trans (le_add_sub a b)
Subtraction Lower Bound from Addition Inequality
Informal description
For any ordinals $a$, $b$, and $c$, if $b + c \leq a$, then $c \leq a - b$.
Ordinal.sub_lt_of_lt_add theorem
{a b c : Ordinal} (h : a < b + c) (hc : 0 < c) : a - b < c
Full source
theorem sub_lt_of_lt_add {a b c : Ordinal} (h : a < b + c) (hc : 0 < c) : a - b < c := by
  obtain hab | hba := lt_or_le a b
  · rwa [Ordinal.sub_eq_zero_iff_le.2 hab.le]
  · rwa [sub_lt_of_le hba]
Subtraction Bound from Addition Inequality: $a < b + c \to a - b < c$ when $c > 0$
Informal description
For any ordinals $a$, $b$, and $c$, if $a < b + c$ and $0 < c$, then $a - b < c$.
Ordinal.lt_add_iff theorem
{a b c : Ordinal} (hc : c ≠ 0) : a < b + c ↔ ∃ d < c, a ≤ b + d
Full source
theorem lt_add_iff {a b c : Ordinal} (hc : c ≠ 0) : a < b + c ↔ ∃ d < c, a ≤ b + d := by
  use fun h ↦ ⟨_, sub_lt_of_lt_add h hc.bot_lt, le_add_sub a b⟩
  rintro ⟨d, hd, ha⟩
  exact ha.trans_lt (add_lt_add_left hd b)
Characterization of $a < b + c$ for nonzero $c$ in ordinals
Informal description
For any ordinals $a$, $b$, and $c$ with $c \neq 0$, the inequality $a < b + c$ holds if and only if there exists an ordinal $d < c$ such that $a \leq b + d$.
Ordinal.add_le_iff theorem
{a b c : Ordinal} (hb : b ≠ 0) : a + b ≤ c ↔ ∀ d < b, a + d < c
Full source
theorem add_le_iff {a b c : Ordinal} (hb : b ≠ 0) : a + b ≤ c ↔ ∀ d < b, a + d < c := by
  simpa using (lt_add_iff hb).not
Characterization of $a + b \leq c$ for nonzero $b$ in ordinals
Informal description
For any ordinals $a$, $b$, and $c$ with $b \neq 0$, the inequality $a + b \leq c$ holds if and only if for every ordinal $d < b$, we have $a + d < c$.
Ordinal.add_le_of_forall_add_lt theorem
{a b c : Ordinal} (hb : 0 < b) (h : ∀ d < b, a + d < c) : a + b ≤ c
Full source
@[deprecated add_le_iff (since := "2024-12-08")]
theorem add_le_of_forall_add_lt {a b c : Ordinal} (hb : 0 < b) (h : ∀ d < b, a + d < c) :
    a + b ≤ c :=
  (add_le_iff hb.ne').2 h
Addition Inequality for Ordinals: $a + b \leq c$ under Uniform Upper Bound on Sums $a + d$ for $d < b$
Informal description
For any ordinals $a$, $b$, and $c$, if $0 < b$ and for every ordinal $d < b$ we have $a + d < c$, then $a + b \leq c$.
Ordinal.isLimit_sub theorem
{a b} (ha : IsLimit a) (h : b < a) : IsLimit (a - b)
Full source
theorem isLimit_sub {a b} (ha : IsLimit a) (h : b < a) : IsLimit (a - b) := by
  rw [isLimit_iff, Ordinal.sub_ne_zero_iff_lt, isSuccPrelimit_iff_succ_lt]
  refine ⟨h, fun c hc ↦ ?_⟩
  rw [lt_sub] at hc ⊢
  rw [add_succ]
  exact ha.succ_lt hc
Subtraction Preserves Limit Ordinals: $a - b$ is limit when $a$ is limit and $b < a$
Informal description
For any ordinals $a$ and $b$, if $a$ is a limit ordinal and $b < a$, then the difference $a - b$ is also a limit ordinal.
Ordinal.monoid instance
: Monoid Ordinal.{u}
Full source
/-- The multiplication of ordinals `o₁` and `o₂` is the (well founded) lexicographic order on
`o₂ × o₁`. -/
instance monoid : Monoid OrdinalOrdinal.{u} where
  mul a b :=
    Quotient.liftOn₂ a b
      (fun ⟨α, r, _⟩ ⟨β, s, _⟩ => ⟦⟨β × α, Prod.Lex s r, inferInstance⟩⟧ :
        WellOrderWellOrderOrdinal)
      fun ⟨_, _, _⟩ _ _ _ ⟨f⟩ ⟨g⟩ => Quot.sound ⟨RelIso.prodLexCongr g f⟩
  one := 1
  mul_assoc a b c :=
    Quotient.inductionOn₃ a b c fun ⟨α, r, _⟩ ⟨β, s, _⟩ ⟨γ, t, _⟩ =>
      Eq.symm <|
        Quotient.sound
          ⟨⟨prodAssoc _ _ _, @fun a b => by
              rcases a with ⟨⟨a₁, a₂⟩, a₃⟩
              rcases b with ⟨⟨b₁, b₂⟩, b₃⟩
              simp [Prod.lex_def, and_or_left, or_assoc, and_assoc]⟩⟩
  mul_one a :=
    inductionOn a fun α r _ =>
      Quotient.sound
        ⟨⟨punitProd _, @fun a b => by
            rcases a with ⟨⟨⟨⟩⟩, a⟩; rcases b with ⟨⟨⟨⟩⟩, b⟩
            simp only [Prod.lex_def, EmptyRelation, false_or]
            simp only [eq_self_iff_true, true_and]
            rfl⟩⟩
  one_mul a :=
    inductionOn a fun α r _ =>
      Quotient.sound
        ⟨⟨prodPUnit _, @fun a b => by
            rcases a with ⟨a, ⟨⟨⟩⟩⟩; rcases b with ⟨b, ⟨⟨⟩⟩⟩
            simp only [Prod.lex_def, EmptyRelation, and_false, or_false]
            rfl⟩⟩
Ordinals Form a Monoid under Lexicographic Product
Informal description
The ordinals form a monoid under multiplication, where the product of two ordinals $o_1$ and $o_2$ is defined as the lexicographic order on $o_2 \times o_1$. The multiplication is associative and has the ordinal $1$ as its identity element.
Ordinal.type_prod_lex theorem
{α β : Type u} (r : α → α → Prop) (s : β → β → Prop) [IsWellOrder α r] [IsWellOrder β s] : type (Prod.Lex s r) = type r * type s
Full source
@[simp]
theorem type_prod_lex {α β : Type u} (r : α → α → Prop) (s : β → β → Prop) [IsWellOrder α r]
    [IsWellOrder β s] : type (Prod.Lex s r) = type r * type s :=
  rfl
Order Type of Lexicographic Product Equals Product of Order Types
Informal description
For any types $\alpha$ and $\beta$ with well-order relations $r$ and $s$ respectively, the order type of the lexicographic product relation $\mathrm{Prod.Lex}\,s\,r$ on $\alpha \times \beta$ is equal to the product of the order types of $r$ and $s$, i.e., $\mathrm{type}(\mathrm{Prod.Lex}\,s\,r) = \mathrm{type}(r) \cdot \mathrm{type}(s)$.
Ordinal.monoidWithZero instance
: MonoidWithZero Ordinal
Full source
instance monoidWithZero : MonoidWithZero Ordinal :=
  { Ordinal.monoid with
    zero := 0
    mul_zero := fun _a => mul_eq_zero'.2 <| Or.inr rfl
    zero_mul := fun _a => mul_eq_zero'.2 <| Or.inl rfl }
Ordinals Form a Monoid with Zero under Multiplication
Informal description
The ordinals form a monoid with zero under multiplication, where the product of two ordinals $o_1$ and $o_2$ is defined as the lexicographic order on $o_2 \times o_1$. The multiplication is associative, has the ordinal $1$ as its identity element, and the ordinal $0$ as its absorbing element (i.e., $0 * o = o * 0 = 0$ for any ordinal $o$).
Ordinal.noZeroDivisors instance
: NoZeroDivisors Ordinal
Full source
instance noZeroDivisors : NoZeroDivisors Ordinal :=
  ⟨fun {_ _} => mul_eq_zero'.1⟩
Ordinals Have No Zero Divisors
Informal description
The ordinal numbers have no zero divisors, meaning that for any two ordinals $a$ and $b$, if $a \cdot b = 0$, then either $a = 0$ or $b = 0$.
Ordinal.lift_mul theorem
(a b : Ordinal.{v}) : lift.{u} (a * b) = lift.{u} a * lift.{u} b
Full source
@[simp]
theorem lift_mul (a b : OrdinalOrdinal.{v}) : lift.{u} (a * b) = lift.{u} a * lift.{u} b :=
  Quotient.inductionOn₂ a b fun ⟨_α, _r, _⟩ ⟨_β, _s, _⟩ =>
    Quotient.sound
      ⟨(RelIso.preimage Equiv.ulift _).trans
          (RelIso.prodLexCongr (RelIso.preimage Equiv.ulift _)
              (RelIso.preimage Equiv.ulift _)).symm⟩
Lift Preservation of Ordinal Multiplication
Informal description
For any two ordinals $a$ and $b$ in universe $v$, the lift of their product to universe $\max(v, u)$ equals the product of their lifts, i.e., $\text{lift}(a \cdot b) = \text{lift}(a) \cdot \text{lift}(b)$.
Ordinal.card_mul theorem
(a b) : card (a * b) = card a * card b
Full source
@[simp]
theorem card_mul (a b) : card (a * b) = card a * card b :=
  Quotient.inductionOn₂ a b fun ⟨α, _r, _⟩ ⟨β, _s, _⟩ => mul_comm  
Cardinality of Ordinal Multiplication: $\text{card}(a \cdot b) = \text{card}(a) \cdot \text{card}(b)$
Informal description
For any two ordinals $a$ and $b$, the cardinality of their product $a \cdot b$ equals the product of their cardinalities, i.e., $\text{card}(a \cdot b) = \text{card}(a) \cdot \text{card}(b)$.
Ordinal.leftDistribClass instance
: LeftDistribClass Ordinal.{u}
Full source
instance leftDistribClass : LeftDistribClass OrdinalOrdinal.{u} :=
  ⟨fun a b c =>
    Quotient.inductionOn₃ a b c fun ⟨α, r, _⟩ ⟨β, s, _⟩ ⟨γ, t, _⟩ =>
      Quotient.sound
        ⟨⟨sumProdDistrib _ _ _, by
          rintro ⟨a₁ | a₁, a₂⟩ ⟨b₁ | b₁, b₂⟩ <;>
            simp only [Prod.lex_def, Sum.lex_inl_inl, Sum.Lex.sep, Sum.lex_inr_inl, Sum.lex_inr_inr,
              sumProdDistrib_apply_left, sumProdDistrib_apply_right, reduceCtorEq] <;>
            -- Porting note: `Sum.inr.inj_iff` is required.
            simp only [Sum.inl.inj_iff, Sum.inr.inj_iff, true_or, false_and, false_or]⟩⟩⟩
Left Distributivity of Ordinal Multiplication over Addition
Informal description
Ordinal multiplication is left-distributive over addition. That is, for any ordinals $a$, $b$, and $c$, we have $a \cdot (b + c) = a \cdot b + a \cdot c$.
Ordinal.mul_succ theorem
(a b : Ordinal) : a * succ b = a * b + a
Full source
theorem mul_succ (a b : Ordinal) : a * succ b = a * b + a :=
  mul_add_one a b
Distributivity of Multiplication over Successor in Ordinals: $a \cdot \text{succ}(b) = a \cdot b + a$
Informal description
For any ordinals $a$ and $b$, the product of $a$ with the successor of $b$ equals the sum of $a \cdot b$ and $a$, i.e., $a \cdot \text{succ}(b) = a \cdot b + a$.
Ordinal.mulLeftMono instance
: MulLeftMono Ordinal.{u}
Full source
instance mulLeftMono : MulLeftMono OrdinalOrdinal.{u} :=
  ⟨fun c a b =>
    Quotient.inductionOn₃ a b c fun ⟨α, r, _⟩ ⟨β, s, _⟩ ⟨γ, t, _⟩ ⟨f⟩ => by
      refine
        (RelEmbedding.ofMonotone (fun a : α × γ => (f a.1, a.2)) fun a b h => ?_).ordinal_type_le
      obtain ⟨-, -, h'⟩ | ⟨-, h'⟩ := h
      · exact Prod.Lex.left _ _ (f.toRelEmbedding.map_rel_iff.2 h')
      · exact Prod.Lex.right _ h'⟩
Left Multiplication by an Ordinal is Monotone
Informal description
For any ordinals $a$, $b$, and $c$, if $b \leq c$ then $a \cdot b \leq a \cdot c$. In other words, multiplication on the left by a fixed ordinal $a$ is a monotone operation.
Ordinal.mulRightMono instance
: MulRightMono Ordinal.{u}
Full source
instance mulRightMono : MulRightMono OrdinalOrdinal.{u} :=
  ⟨fun c a b =>
    Quotient.inductionOn₃ a b c fun ⟨α, r, _⟩ ⟨β, s, _⟩ ⟨γ, t, _⟩ ⟨f⟩ => by
      refine
        (RelEmbedding.ofMonotone (fun a : γ × α => (a.1, f a.2)) fun a b h => ?_).ordinal_type_le
      obtain ⟨-, -, h'⟩ | ⟨-, h'⟩ := h
      · exact Prod.Lex.left _ _ h'
      · exact Prod.Lex.right _ (f.toRelEmbedding.map_rel_iff.2 h')⟩
Right Multiplication by Ordinals is Monotone
Informal description
For any ordinal $a$, the function $a \mapsto b \cdot a$ is monotone (order-preserving) with respect to the ordinal order. That is, for ordinals $a_1, a_2$, if $a_1 \leq a_2$ then $b \cdot a_1 \leq b \cdot a_2$ for any ordinal $b$.
Ordinal.le_mul_left theorem
(a : Ordinal) {b : Ordinal} (hb : 0 < b) : a ≤ a * b
Full source
theorem le_mul_left (a : Ordinal) {b : Ordinal} (hb : 0 < b) : a ≤ a * b := by
  convert mul_le_mul_left' (one_le_iff_pos.2 hb) a
  rw [mul_one a]
Left Multiplication by Positive Ordinal is Non-Decreasing
Informal description
For any ordinal $a$ and any positive ordinal $b$ (i.e., $0 < b$), we have $a \leq a \cdot b$.
Ordinal.le_mul_right theorem
(a : Ordinal) {b : Ordinal} (hb : 0 < b) : a ≤ b * a
Full source
theorem le_mul_right (a : Ordinal) {b : Ordinal} (hb : 0 < b) : a ≤ b * a := by
  convert mul_le_mul_right' (one_le_iff_pos.2 hb) a
  rw [one_mul a]
Right Multiplication by Positive Ordinal is Non-Decreasing
Informal description
For any ordinal $a$ and any positive ordinal $b$ (i.e., $0 < b$), we have $a \leq b \cdot a$, where $\cdot$ denotes ordinal multiplication.
Ordinal.mul_le_of_limit theorem
{a b c : Ordinal} (h : IsLimit b) : a * b ≤ c ↔ ∀ b' < b, a * b' ≤ c
Full source
theorem mul_le_of_limit {a b c : Ordinal} (h : IsLimit b) : a * b ≤ c ↔ ∀ b' < b, a * b' ≤ c :=
  ⟨fun h _ l => (mul_le_mul_left' l.le _).trans h, fun H =>
    -- Porting note: `induction` tactics are required because of the parser bug.
    le_of_not_lt <| by
      induction a using inductionOn with
      | H α r =>
        induction b using inductionOn with
        | H β s =>
          exact mul_le_of_limit_aux h H⟩
Limit Ordinal Multiplication Inequality: $a \cdot b \leq c \leftrightarrow \forall b' < b, a \cdot b' \leq c$
Informal description
For ordinals $a$, $b$, and $c$, if $b$ is a limit ordinal, then the product $a \cdot b$ is less than or equal to $c$ if and only if for every ordinal $b'$ less than $b$, the product $a \cdot b'$ is less than or equal to $c$.
Ordinal.isNormal_mul_right theorem
{a : Ordinal} (h : 0 < a) : IsNormal (a * ·)
Full source
theorem isNormal_mul_right {a : Ordinal} (h : 0 < a) : IsNormal (a * ·) :=
  -- Porting note (https://github.com/leanprover-community/mathlib4/issues/12129): additional beta reduction needed
  ⟨fun b => by
      beta_reduce
      rw [mul_succ]
      simpa only [add_zero] using (add_lt_add_iff_left (a * b)).2 h,
    fun _ l _ => mul_le_of_limit l⟩
Right Multiplication by Nonzero Ordinal is Normal
Informal description
For any ordinal $a > 0$, the right multiplication function $\lambda b, a \cdot b$ is a normal function. That is: 1. It is strictly increasing: for all ordinals $b_1 < b_2$, we have $a \cdot b_1 < a \cdot b_2$. 2. It is order-continuous: for any limit ordinal $b$, the value $a \cdot b$ is the supremum of all $a \cdot b'$ for $b' < b$.
Ordinal.lt_mul_of_limit theorem
{a b c : Ordinal} (h : IsLimit c) : a < b * c ↔ ∃ c' < c, a < b * c'
Full source
theorem lt_mul_of_limit {a b c : Ordinal} (h : IsLimit c) : a < b * c ↔ ∃ c' < c, a < b * c' := by
  -- Porting note: `bex_def` is required.
  simpa only [not_forall₂, not_le, bex_def] using not_congr (@mul_le_of_limit b c a h)
Inequality for Multiplication with Limit Ordinal: $a < b \cdot c \leftrightarrow \exists c' < c, a < b \cdot c'$
Informal description
For ordinals $a$, $b$, and $c$, if $c$ is a limit ordinal, then $a < b \cdot c$ if and only if there exists an ordinal $c' < c$ such that $a < b \cdot c'$.
Ordinal.mul_lt_mul_iff_left theorem
{a b c : Ordinal} (a0 : 0 < a) : a * b < a * c ↔ b < c
Full source
theorem mul_lt_mul_iff_left {a b c : Ordinal} (a0 : 0 < a) : a * b < a * c ↔ b < c :=
  (isNormal_mul_right a0).lt_iff
Left Multiplication Preserves Strict Order for Nonzero Ordinals: $a \cdot b < a \cdot c \leftrightarrow b < c$ when $a > 0$
Informal description
For ordinals $a$, $b$, and $c$ with $a > 0$, the inequality $a \cdot b < a \cdot c$ holds if and only if $b < c$.
Ordinal.mul_le_mul_iff_left theorem
{a b c : Ordinal} (a0 : 0 < a) : a * b ≤ a * c ↔ b ≤ c
Full source
theorem mul_le_mul_iff_left {a b c : Ordinal} (a0 : 0 < a) : a * b ≤ a * c ↔ b ≤ c :=
  (isNormal_mul_right a0).le_iff
Left Multiplication by Positive Ordinal Preserves Order: $a \cdot b \leq a \cdot c \leftrightarrow b \leq c$
Informal description
For ordinals $a$, $b$, and $c$ with $0 < a$, the inequality $a \cdot b \leq a \cdot c$ holds if and only if $b \leq c$.
Ordinal.mul_lt_mul_of_pos_left theorem
{a b c : Ordinal} (h : a < b) (c0 : 0 < c) : c * a < c * b
Full source
theorem mul_lt_mul_of_pos_left {a b c : Ordinal} (h : a < b) (c0 : 0 < c) : c * a < c * b :=
  (mul_lt_mul_iff_left c0).2 h
Left Multiplication by Positive Ordinal Preserves Strict Order: $c \cdot a < c \cdot b$ when $a < b$ and $c > 0$
Informal description
For any ordinals $a$, $b$, and $c$ such that $a < b$ and $0 < c$, it holds that $c \cdot a < c \cdot b$.
Ordinal.mul_pos theorem
{a b : Ordinal} (h₁ : 0 < a) (h₂ : 0 < b) : 0 < a * b
Full source
theorem mul_pos {a b : Ordinal} (h₁ : 0 < a) (h₂ : 0 < b) : 0 < a * b := by
  simpa only [mul_zero] using mul_lt_mul_of_pos_left h₂ h₁
Product of Positive Ordinals is Positive: $0 < a \cdot b$ when $0 < a$ and $0 < b$
Informal description
For any two ordinals $a$ and $b$ such that $0 < a$ and $0 < b$, their product satisfies $0 < a \cdot b$.
Ordinal.mul_ne_zero theorem
{a b : Ordinal} : a ≠ 0 → b ≠ 0 → a * b ≠ 0
Full source
theorem mul_ne_zero {a b : Ordinal} : a ≠ 0b ≠ 0a * b ≠ 0 := by
  simpa only [Ordinal.pos_iff_ne_zero] using mul_pos
Nonzero Ordinals Have Nonzero Product
Informal description
For any ordinals $a$ and $b$, if $a \neq 0$ and $b \neq 0$, then their product satisfies $a \cdot b \neq 0$.
Ordinal.le_of_mul_le_mul_left theorem
{a b c : Ordinal} (h : c * a ≤ c * b) (h0 : 0 < c) : a ≤ b
Full source
theorem le_of_mul_le_mul_left {a b c : Ordinal} (h : c * a ≤ c * b) (h0 : 0 < c) : a ≤ b :=
  le_imp_le_of_lt_imp_lt (fun h' => mul_lt_mul_of_pos_left h' h0) h
Left Multiplication by Positive Ordinal Preserves Order: $a \leq b$ when $c \cdot a \leq c \cdot b$ and $c > 0$
Informal description
For any ordinals $a$, $b$, and $c$ such that $c \cdot a \leq c \cdot b$ and $0 < c$, it follows that $a \leq b$.
Ordinal.mul_right_inj theorem
{a b c : Ordinal} (a0 : 0 < a) : a * b = a * c ↔ b = c
Full source
theorem mul_right_inj {a b c : Ordinal} (a0 : 0 < a) : a * b = a * c ↔ b = c :=
  (isNormal_mul_right a0).inj
Right Cancellation Law for Ordinal Multiplication: $a \cdot b = a \cdot c \leftrightarrow b = c$ when $a > 0$
Informal description
For any ordinals $a$, $b$, and $c$ with $a > 0$, the equality $a \cdot b = a \cdot c$ holds if and only if $b = c$.
Ordinal.isLimit_mul theorem
{a b : Ordinal} (a0 : 0 < a) : IsLimit b → IsLimit (a * b)
Full source
theorem isLimit_mul {a b : Ordinal} (a0 : 0 < a) : IsLimit b → IsLimit (a * b) :=
  (isNormal_mul_right a0).isLimit
Product with Nonzero Ordinal Preserves Limit Ordinals: $a \cdot b$ is limit when $a > 0$ and $b$ is limit
Informal description
For any ordinals $a$ and $b$ with $a > 0$, if $b$ is a limit ordinal, then the product $a \cdot b$ is also a limit ordinal.
Ordinal.isLimit_mul_left theorem
{a b : Ordinal} (l : IsLimit a) (b0 : 0 < b) : IsLimit (a * b)
Full source
theorem isLimit_mul_left {a b : Ordinal} (l : IsLimit a) (b0 : 0 < b) : IsLimit (a * b) := by
  rcases zero_or_succ_or_limit b with (rfl | ⟨b, rfl⟩ | lb)
  · exact b0.false.elim
  · rw [mul_succ]
    exact isLimit_add _ l
  · exact isLimit_mul l.pos lb
Left Multiplication by Positive Ordinal Preserves Limit Property: $a \cdot b$ is limit when $a$ is limit and $b > 0$
Informal description
For any ordinals $a$ and $b$, if $a$ is a limit ordinal and $b > 0$, then the product $a \cdot b$ is also a limit ordinal.
Ordinal.smul_eq_mul theorem
: ∀ (n : ℕ) (a : Ordinal), n • a = a * n
Full source
theorem smul_eq_mul : ∀ (n : ) (a : Ordinal), n • a = a * n
  | 0, a => by rw [zero_nsmul, Nat.cast_zero, mul_zero]
  | n + 1, a => by rw [succ_nsmul, Nat.cast_add, mul_add, Nat.cast_one, mul_one, smul_eq_mul n]
Scalar Multiplication Equals Ordinal Multiplication: $n \cdot a = a \cdot n$
Informal description
For any natural number $n$ and any ordinal $a$, the scalar multiplication $n \cdot a$ is equal to the ordinal multiplication $a \cdot n$.
Ordinal.add_mul_succ theorem
{a b : Ordinal} (c) (ba : b + a = a) : (a + b) * succ c = a * succ c + b
Full source
theorem add_mul_succ {a b : Ordinal} (c) (ba : b + a = a) : (a + b) * succ c = a * succ c + b := by
  induction c using limitRecOn with
  | zero => simp only [succ_zero, mul_one]
  | succ c IH =>
    rw [mul_succ, IH, ← add_assoc, add_assoc _ b, ba, ← mul_succ]
  | isLimit c l IH =>
    rw [mul_succ, add_mul_limit_aux ba l IH, mul_succ, add_assoc]
Distributive Law for Ordinal Addition and Successor Multiplication: $(a + b) \cdot \text{succ}(c) = a \cdot \text{succ}(c) + b$ when $b + a = a$
Informal description
For any ordinals $a$, $b$, and $c$, if $b + a = a$, then $(a + b) \cdot \text{succ}(c) = a \cdot \text{succ}(c) + b$.
Ordinal.add_mul_limit theorem
{a b c : Ordinal} (ba : b + a = a) (l : IsLimit c) : (a + b) * c = a * c
Full source
theorem add_mul_limit {a b c : Ordinal} (ba : b + a = a) (l : IsLimit c) : (a + b) * c = a * c :=
  add_mul_limit_aux ba l fun c' _ => add_mul_succ c' ba
Distributive Law for Ordinal Addition and Limit Multiplication: $(a + b) \cdot c = a \cdot c$ when $b + a = a$ and $c$ is a limit ordinal
Informal description
For any ordinals $a$, $b$, and $c$, if $b + a = a$ and $c$ is a limit ordinal, then $(a + b) \cdot c = a \cdot c$.
Ordinal.div instance
: Div Ordinal
Full source
/-- `a / b` is the unique ordinal `o` satisfying `a = b * o + o'` with `o' < b`. -/
instance div : Div Ordinal :=
  ⟨fun a b => if b = 0 then 0 else sInf { o | a < b * succ o }⟩
Division of Ordinals
Informal description
For any two ordinals $a$ and $b$, the division $a / b$ is defined as the unique ordinal $o$ such that $a = b \cdot o + o'$ with $o' < b$.
Ordinal.div_zero theorem
(a : Ordinal) : a / 0 = 0
Full source
@[simp]
theorem div_zero (a : Ordinal) : a / 0 = 0 :=
  dif_pos rfl
Division by Zero Ordinal Yields Zero: $a / 0 = 0$
Informal description
For any ordinal $a$, the division of $a$ by the zero ordinal $0$ is equal to $0$, i.e., $a / 0 = 0$.
Ordinal.lt_mul_succ_div theorem
(a) {b : Ordinal} (h : b ≠ 0) : a < b * succ (a / b)
Full source
theorem lt_mul_succ_div (a) {b : Ordinal} (h : b ≠ 0) : a < b * succ (a / b) := by
  rw [div_def a h]; exact csInf_mem (div_nonempty h)
Inequality Relating Ordinal Division and Successor Multiplication: $a < b \cdot \mathrm{succ}(a / b)$
Informal description
For any ordinals $a$ and $b$ with $b \neq 0$, we have $a < b \cdot \mathrm{succ}(a / b)$, where $\mathrm{succ}$ denotes the successor function and $a / b$ is the ordinal division of $a$ by $b$.
Ordinal.lt_mul_div_add theorem
(a) {b : Ordinal} (h : b ≠ 0) : a < b * (a / b) + b
Full source
theorem lt_mul_div_add (a) {b : Ordinal} (h : b ≠ 0) : a < b * (a / b) + b := by
  simpa only [mul_succ] using lt_mul_succ_div a h
Inequality Relating Ordinal Division and Multiplication: $a < b \cdot (a / b) + b$
Informal description
For any ordinals $a$ and $b$ with $b \neq 0$, we have $a < b \cdot (a / b) + b$, where $a / b$ denotes the ordinal division of $a$ by $b$.
Ordinal.div_le theorem
{a b c : Ordinal} (b0 : b ≠ 0) : a / b ≤ c ↔ a < b * succ c
Full source
theorem div_le {a b c : Ordinal} (b0 : b ≠ 0) : a / b ≤ c ↔ a < b * succ c :=
  ⟨fun h => (lt_mul_succ_div a b0).trans_le (mul_le_mul_left' (succ_le_succ_iff.2 h) _), fun h => by
    rw [div_def a b0]; exact csInf_le' h⟩
Ordinal Division Inequality: $a / b \leq c \leftrightarrow a < b \cdot \mathrm{succ}(c)$
Informal description
For any ordinals $a$, $b$, and $c$ with $b \neq 0$, the division $a / b$ is less than or equal to $c$ if and only if $a$ is strictly less than $b$ multiplied by the successor of $c$, i.e., $a / b \leq c \leftrightarrow a < b \cdot \mathrm{succ}(c)$.
Ordinal.lt_div theorem
{a b c : Ordinal} (h : c ≠ 0) : a < b / c ↔ c * succ a ≤ b
Full source
theorem lt_div {a b c : Ordinal} (h : c ≠ 0) : a < b / c ↔ c * succ a ≤ b := by
  rw [← not_le, div_le h, not_lt]
Inequality Relating Ordinal Division and Successor Multiplication: $a < b / c \leftrightarrow c \cdot \mathrm{succ}(a) \leq b$
Informal description
For any ordinals $a$, $b$, and $c$ with $c \neq 0$, we have $a < b / c$ if and only if $c \cdot \mathrm{succ}(a) \leq b$.
Ordinal.div_pos theorem
{b c : Ordinal} (h : c ≠ 0) : 0 < b / c ↔ c ≤ b
Full source
theorem div_pos {b c : Ordinal} (h : c ≠ 0) : 0 < b / c ↔ c ≤ b := by simp [lt_div h]
Positivity of Ordinal Division: $0 < b / c \leftrightarrow c \leq b$
Informal description
For any ordinals $b$ and $c$ with $c \neq 0$, the division $b / c$ is positive if and only if $c \leq b$, i.e., $0 < b / c \leftrightarrow c \leq b$.
Ordinal.le_div theorem
{a b c : Ordinal} (c0 : c ≠ 0) : a ≤ b / c ↔ c * a ≤ b
Full source
theorem le_div {a b c : Ordinal} (c0 : c ≠ 0) : a ≤ b / c ↔ c * a ≤ b := by
  induction a using limitRecOn with
  | zero => simp only [mul_zero, Ordinal.zero_le]
  | succ _ _ => rw [succ_le_iff, lt_div c0]
  | isLimit _ h₁ h₂ =>
    revert h₁ h₂
    simp +contextual only [mul_le_of_limit, limit_le, forall_true_iff]
Characterization of Ordinal Division: $a \leq b / c \leftrightarrow c \cdot a \leq b$
Informal description
For any ordinals $a$, $b$, and $c$ with $c \neq 0$, we have $a \leq b / c$ if and only if $c \cdot a \leq b$.
Ordinal.div_lt theorem
{a b c : Ordinal} (b0 : b ≠ 0) : a / b < c ↔ a < b * c
Full source
theorem div_lt {a b c : Ordinal} (b0 : b ≠ 0) : a / b < c ↔ a < b * c :=
  lt_iff_lt_of_le_iff_le <| le_div b0
Strict Inequality Characterization of Ordinal Division: $a / b < c \leftrightarrow a < b \cdot c$
Informal description
For any ordinals $a$, $b$, and $c$ with $b \neq 0$, the division $a / b$ is strictly less than $c$ if and only if $a$ is strictly less than $b \cdot c$, i.e., $a / b < c \leftrightarrow a < b \cdot c$.
Ordinal.div_le_of_le_mul theorem
{a b c : Ordinal} (h : a ≤ b * c) : a / b ≤ c
Full source
theorem div_le_of_le_mul {a b c : Ordinal} (h : a ≤ b * c) : a / b ≤ c :=
  if b0 : b = 0 then by simp only [b0, div_zero, Ordinal.zero_le]
  else
    (div_le b0).2 <| h.trans_lt <| mul_lt_mul_of_pos_left (lt_succ c) (Ordinal.pos_iff_ne_zero.2 b0)
Division Bound from Multiplication: $a \leq b \cdot c$ implies $a / b \leq c$
Informal description
For any ordinals $a$, $b$, and $c$, if $a \leq b \cdot c$, then the division $a / b$ is less than or equal to $c$.
Ordinal.mul_lt_of_lt_div theorem
{a b c : Ordinal} : a < b / c → c * a < b
Full source
theorem mul_lt_of_lt_div {a b c : Ordinal} : a < b / c → c * a < b :=
  lt_imp_lt_of_le_imp_le div_le_of_le_mul
Multiplication Reversal under Ordinal Division: $a < b/c \Rightarrow c \cdot a < b$
Informal description
For any ordinals $a$, $b$, and $c$, if $a < b / c$, then $c \cdot a < b$.
Ordinal.zero_div theorem
(a : Ordinal) : 0 / a = 0
Full source
@[simp]
theorem zero_div (a : Ordinal) : 0 / a = 0 :=
  Ordinal.le_zero.1 <| div_le_of_le_mul <| Ordinal.zero_le _
Division of Zero Ordinal: $0 / a = 0$
Informal description
For any ordinal $a$, the division of the zero ordinal by $a$ is equal to the zero ordinal, i.e., $0 / a = 0$.
Ordinal.div_le_left theorem
{a b : Ordinal} (h : a ≤ b) (c : Ordinal) : a / c ≤ b / c
Full source
theorem div_le_left {a b : Ordinal} (h : a ≤ b) (c : Ordinal) : a / c ≤ b / c := by
  obtain rfl | hc := eq_or_ne c 0
  · rw [div_zero, div_zero]
  · rw [le_div hc]
    exact (mul_div_le a c).trans h
Monotonicity of Ordinal Division: $a \leq b \Rightarrow a/c \leq b/c$
Informal description
For any ordinals $a$, $b$, and $c$, if $a \leq b$, then $a / c \leq b / c$.
Ordinal.mul_add_div theorem
(a) {b : Ordinal} (b0 : b ≠ 0) (c) : (b * a + c) / b = a + c / b
Full source
theorem mul_add_div (a) {b : Ordinal} (b0 : b ≠ 0) (c) : (b * a + c) / b = a + c / b := by
  apply le_antisymm
  · apply (div_le b0).2
    rw [mul_succ, mul_add, add_assoc, add_lt_add_iff_left]
    apply lt_mul_div_add _ b0
  · rw [le_div b0, mul_add, add_le_add_iff_left]
    apply mul_div_le
Distributive Law for Ordinal Division: $(b \cdot a + c)/b = a + c/b$
Informal description
For any ordinals $a$, $b$ (with $b \neq 0$), and $c$, the division $(b \cdot a + c) / b$ equals $a + (c / b)$.
Ordinal.mul_div_cancel theorem
(a) {b : Ordinal} (b0 : b ≠ 0) : b * a / b = a
Full source
@[simp]
theorem mul_div_cancel (a) {b : Ordinal} (b0 : b ≠ 0) : b * a / b = a := by
  simpa only [add_zero, zero_div] using mul_add_div a b0 0
Cancellation Law for Ordinal Division: $(b \cdot a)/b = a$ when $b \neq 0$
Informal description
For any ordinals $a$ and $b$ with $b \neq 0$, the division $(b \cdot a) / b$ equals $a$.
Ordinal.mul_add_div_mul theorem
{a c : Ordinal} (hc : c < a) (b d : Ordinal) : (a * b + c) / (a * d) = b / d
Full source
theorem mul_add_div_mul {a c : Ordinal} (hc : c < a) (b d : Ordinal) :
    (a * b + c) / (a * d) = b / d := by
  have ha : a ≠ 0 := ((Ordinal.zero_le c).trans_lt hc).ne'
  obtain rfl | hd := eq_or_ne d 0
  · rw [mul_zero, div_zero, div_zero]
  · have H := mul_ne_zero ha hd
    apply le_antisymm
    · rw [← lt_succ_iff, div_lt H, mul_assoc]
      · apply (add_lt_add_left hc _).trans_le
        rw [← mul_succ]
        apply mul_le_mul_left'
        rw [succ_le_iff]
        exact lt_mul_succ_div b hd
    · rw [le_div H, mul_assoc]
      exact (mul_le_mul_left' (mul_div_le b d) a).trans (le_add_right _ c)
Division of Linear Combination: $(a \cdot b + c) / (a \cdot d) = b / d$ when $c < a$
Informal description
For ordinals $a, b, c, d$ with $c < a$, the division $(a \cdot b + c) / (a \cdot d)$ equals $b / d$.
Ordinal.mul_div_mul_cancel theorem
{a : Ordinal} (ha : a ≠ 0) (b c) : a * b / (a * c) = b / c
Full source
theorem mul_div_mul_cancel {a : Ordinal} (ha : a ≠ 0) (b c) : a * b / (a * c) = b / c := by
  convert mul_add_div_mul (Ordinal.pos_iff_ne_zero.2 ha) b c using 1
  rw [add_zero]
Cancellation Law for Ordinal Division: $(a \cdot b)/(a \cdot c) = b/c$ when $a \neq 0$
Informal description
For any nonzero ordinal $a$ and any ordinals $b$ and $c$, the division $(a \cdot b) / (a \cdot c)$ equals $b / c$.
Ordinal.div_one theorem
(a : Ordinal) : a / 1 = a
Full source
@[simp]
theorem div_one (a : Ordinal) : a / 1 = a := by
  simpa only [one_mul] using mul_div_cancel a Ordinal.one_ne_zero
Division by One: $a / 1 = a$ for any ordinal $a$
Informal description
For any ordinal $a$, the division $a / 1$ equals $a$.
Ordinal.div_self theorem
{a : Ordinal} (h : a ≠ 0) : a / a = 1
Full source
@[simp]
theorem div_self {a : Ordinal} (h : a ≠ 0) : a / a = 1 := by
  simpa only [mul_one] using mul_div_cancel 1 h
Self-Division of Nonzero Ordinals: $a / a = 1$
Informal description
For any nonzero ordinal $a$, the division of $a$ by itself equals $1$, i.e., $a / a = 1$.
Ordinal.mul_sub theorem
(a b c : Ordinal) : a * (b - c) = a * b - a * c
Full source
theorem mul_sub (a b c : Ordinal) : a * (b - c) = a * b - a * c :=
  if a0 : a = 0 then by simp only [a0, zero_mul, sub_self]
  else
    eq_of_forall_ge_iff fun d => by rw [sub_le, ← le_div a0, sub_le, ← le_div a0, mul_add_div _ a0]
Distributivity of Multiplication over Subtraction for Ordinals: $a \cdot (b - c) = a \cdot b - a \cdot c$
Informal description
For any ordinals $a$, $b$, and $c$, the product of $a$ with the difference $b - c$ is equal to the difference of the products $a \cdot b$ and $a \cdot c$, i.e., $a \cdot (b - c) = a \cdot b - a \cdot c$.
Ordinal.isLimit_add_iff theorem
{a b} : IsLimit (a + b) ↔ IsLimit b ∨ b = 0 ∧ IsLimit a
Full source
theorem isLimit_add_iff {a b} : IsLimitIsLimit (a + b) ↔ IsLimit b ∨ b = 0 ∧ IsLimit a := by
  constructor <;> intro h
  · by_cases h' : b = 0
    · rw [h', add_zero] at h
      right
      exact ⟨h', h⟩
    left
    rw [← add_sub_cancel a b]
    apply isLimit_sub h
    suffices a + 0 < a + b by simpa only [add_zero] using this
    rwa [add_lt_add_iff_left, Ordinal.pos_iff_ne_zero]
  rcases h with (h | ⟨rfl, h⟩)
  · exact isLimit_add a h
  · simpa only [add_zero]
Characterization of Limit Ordinals in Addition: $a + b$ is limit iff $b$ is limit or ($b=0$ and $a$ is limit)
Informal description
For any ordinals $a$ and $b$, the sum $a + b$ is a limit ordinal if and only if either $b$ is a limit ordinal, or $b = 0$ and $a$ is a limit ordinal.
Ordinal.dvd_add_iff theorem
: ∀ {a b c : Ordinal}, a ∣ b → (a ∣ b + c ↔ a ∣ c)
Full source
theorem dvd_add_iff : ∀ {a b c : Ordinal}, a ∣ b → (a ∣ b + ca ∣ b + c ↔ a ∣ c)
  | a, _, c, ⟨b, rfl⟩ =>
    ⟨fun ⟨d, e⟩ => ⟨d - b, by rw [mul_sub, ← e, add_sub_cancel]⟩, fun ⟨d, e⟩ => by
      rw [e, ← mul_add]
      apply dvd_mul_right⟩
Divisibility Condition for Ordinal Addition: $a \mid b \to (a \mid b + c \leftrightarrow a \mid c)$
Informal description
For any ordinals $a$, $b$, and $c$, if $a$ divides $b$, then $a$ divides $b + c$ if and only if $a$ divides $c$.
Ordinal.div_mul_cancel theorem
: ∀ {a b : Ordinal}, a ≠ 0 → a ∣ b → a * (b / a) = b
Full source
theorem div_mul_cancel : ∀ {a b : Ordinal}, a ≠ 0a ∣ b → a * (b / a) = b
  | a, _, a0, ⟨b, rfl⟩ => by rw [mul_div_cancel _ a0]
Cancellation Law for Ordinal Division: $a \cdot (b / a) = b$ when $a \neq 0$ and $a \mid b$
Informal description
For any nonzero ordinal $a$ and any ordinal $b$ divisible by $a$, the product $a \cdot (b / a)$ equals $b$.
Ordinal.le_of_dvd theorem
: ∀ {a b : Ordinal}, b ≠ 0 → a ∣ b → a ≤ b
Full source
theorem le_of_dvd : ∀ {a b : Ordinal}, b ≠ 0a ∣ b → a ≤ b
  -- Porting note: `⟨b, rfl⟩ => by` → `⟨b, e⟩ => by subst e`
  | a, _, b0, ⟨b, e⟩ => by
    subst e
    -- Porting note: `Ne` is required.
    simpa only [mul_one] using
      mul_le_mul_left'
        (one_le_iff_ne_zero.2 fun h : b = 0 => by
          simp only [h, mul_zero, Ne, not_true_eq_false] at b0) a
Divisibility Implies Order Relation in Ordinals
Informal description
For any ordinals $a$ and $b$, if $b$ is nonzero and $a$ divides $b$, then $a$ is less than or equal to $b$.
Ordinal.dvd_antisymm theorem
{a b : Ordinal} (h₁ : a ∣ b) (h₂ : b ∣ a) : a = b
Full source
theorem dvd_antisymm {a b : Ordinal} (h₁ : a ∣ b) (h₂ : b ∣ a) : a = b :=
  if a0 : a = 0 then by subst a; exact (eq_zero_of_zero_dvd h₁).symm
  else
    if b0 : b = 0 then by subst b; exact eq_zero_of_zero_dvd h₂
    else (le_of_dvd b0 h₁).antisymm (le_of_dvd a0 h₂)
Antisymmetry of Divisibility for Ordinals
Informal description
For any ordinals $a$ and $b$, if $a$ divides $b$ and $b$ divides $a$, then $a = b$.
Ordinal.isAntisymm instance
: IsAntisymm Ordinal (· ∣ ·)
Full source
instance isAntisymm : IsAntisymm Ordinal (· ∣ ·) :=
  ⟨@dvd_antisymm⟩
Antisymmetry of Ordinal Divisibility
Informal description
The divisibility relation `(· ∣ ·)` on ordinals is antisymmetric, meaning that for any ordinals $a$ and $b$, if $a$ divides $b$ and $b$ divides $a$, then $a = b$.
Ordinal.mod instance
: Mod Ordinal
Full source
/-- `a % b` is the unique ordinal `o'` satisfying
  `a = b * o + o'` with `o' < b`. -/
instance mod : Mod Ordinal :=
  ⟨fun a b => a - b * (a / b)⟩
Modulo Operation on Ordinals
Informal description
For any two ordinals $a$ and $b$, the modulo operation $a \% b$ is the unique ordinal $o'$ satisfying $a = b \cdot o + o'$ with $o' < b$, where $o$ is the quotient $a / b$.
Ordinal.mod_def theorem
(a b : Ordinal) : a % b = a - b * (a / b)
Full source
theorem mod_def (a b : Ordinal) : a % b = a - b * (a / b) :=
  rfl
Definition of Ordinal Modulo Operation: $a \% b = a - b \cdot (a / b)$
Informal description
For any two ordinals $a$ and $b$, the modulo operation satisfies $a \% b = a - b \cdot (a / b)$, where $a / b$ is the ordinal division of $a$ by $b$.
Ordinal.mod_le theorem
(a b : Ordinal) : a % b ≤ a
Full source
theorem mod_le (a b : Ordinal) : a % b ≤ a :=
  sub_le_self a _
Remainder is Non-Increasing: $a \% b \leq a$
Informal description
For any ordinals $a$ and $b$, the remainder $a \% b$ is less than or equal to $a$.
Ordinal.mod_zero theorem
(a : Ordinal) : a % 0 = a
Full source
@[simp]
theorem mod_zero (a : Ordinal) : a % 0 = a := by simp only [mod_def, div_zero, zero_mul, sub_zero]
Modulo by Zero Yields Original Ordinal: $a \% 0 = a$
Informal description
For any ordinal $a$, the modulo operation with zero yields $a \% 0 = a$.
Ordinal.mod_eq_of_lt theorem
{a b : Ordinal} (h : a < b) : a % b = a
Full source
theorem mod_eq_of_lt {a b : Ordinal} (h : a < b) : a % b = a := by
  simp only [mod_def, div_eq_zero_of_lt h, mul_zero, sub_zero]
Modulo Identity for Small Ordinals: $a < b \Rightarrow a \% b = a$
Informal description
For any ordinals $a$ and $b$ such that $a < b$, the modulo operation satisfies $a \% b = a$.
Ordinal.zero_mod theorem
(b : Ordinal) : 0 % b = 0
Full source
@[simp]
theorem zero_mod (b : Ordinal) : 0 % b = 0 := by simp only [mod_def, zero_div, mul_zero, sub_self]
Modulo of Zero Ordinal: $0 \% b = 0$
Informal description
For any ordinal $b$, the modulo operation satisfies $0 \% b = 0$.
Ordinal.div_add_mod theorem
(a b : Ordinal) : b * (a / b) + a % b = a
Full source
theorem div_add_mod (a b : Ordinal) : b * (a / b) + a % b = a :=
  Ordinal.add_sub_cancel_of_le <| mul_div_le _ _
Ordinal Division-Modulo Identity: $b \cdot (a / b) + (a \% b) = a$
Informal description
For any ordinals $a$ and $b$, the following equality holds: \[ b \cdot (a / b) + (a \% b) = a \] where $a / b$ is the ordinal division of $a$ by $b$ and $a \% b$ is the ordinal modulo operation.
Ordinal.mod_lt theorem
(a) {b : Ordinal} (h : b ≠ 0) : a % b < b
Full source
theorem mod_lt (a) {b : Ordinal} (h : b ≠ 0) : a % b < b :=
  (add_lt_add_iff_left (b * (a / b))).1 <| by rw [div_add_mod]; exact lt_mul_div_add a h
Remainder Bound in Ordinal Division: $a \% b < b$
Informal description
For any ordinals $a$ and $b$ with $b \neq 0$, the remainder $a \% b$ satisfies $a \% b < b$.
Ordinal.mod_one theorem
(a : Ordinal) : a % 1 = 0
Full source
@[simp]
theorem mod_one (a : Ordinal) : a % 1 = 0 := by simp only [mod_def, div_one, one_mul, sub_self]
Remainder Modulo One is Zero for Ordinals: $a \% 1 = 0$
Informal description
For any ordinal $a$, the remainder of $a$ modulo $1$ is $0$, i.e., $a \% 1 = 0$.
Ordinal.mod_eq_zero_of_dvd theorem
{a b : Ordinal} (H : b ∣ a) : a % b = 0
Full source
theorem mod_eq_zero_of_dvd {a b : Ordinal} (H : b ∣ a) : a % b = 0 := by
  rcases H with ⟨c, rfl⟩
  rcases eq_or_ne b 0 with (rfl | hb)
  · simp
  · simp [mod_def, hb]
Divisibility implies zero remainder: $b \mid a \Rightarrow a \% b = 0$
Informal description
For any ordinals $a$ and $b$, if $b$ divides $a$ (denoted $b \mid a$), then the remainder of $a$ divided by $b$ is zero, i.e., $a \% b = 0$.
Ordinal.mul_add_mod_self theorem
(x y z : Ordinal) : (x * y + z) % x = z % x
Full source
@[simp]
theorem mul_add_mod_self (x y z : Ordinal) : (x * y + z) % x = z % x := by
  rcases eq_or_ne x 0 with rfl | hx
  · simp
  · rwa [mod_def, mul_add_div, mul_add, ← sub_sub, add_sub_cancel, mod_def]
Modulo Identity: $(x \cdot y + z) \% x = z \% x$
Informal description
For any ordinals $x$, $y$, and $z$, the modulo operation satisfies $(x \cdot y + z) \% x = z \% x$.
Ordinal.mul_mod theorem
(x y : Ordinal) : x * y % x = 0
Full source
@[simp]
theorem mul_mod (x y : Ordinal) : x * y % x = 0 := by
  simpa using mul_add_mod_self x y 0
Modulo Identity: $x \cdot y \% x = 0$
Informal description
For any ordinals $x$ and $y$, the modulo operation satisfies $x \cdot y \% x = 0$.
Ordinal.mul_add_mod_mul theorem
{w x : Ordinal} (hw : w < x) (y z : Ordinal) : (x * y + w) % (x * z) = x * (y % z) + w
Full source
theorem mul_add_mod_mul {w x : Ordinal} (hw : w < x) (y z : Ordinal) :
    (x * y + w) % (x * z) = x * (y % z) + w := by
  rw [mod_def, mul_add_div_mul hw]
  apply sub_eq_of_add_eq
  rw [← add_assoc, mul_assoc, ← mul_add, div_add_mod]
Modulo Identity: $(x \cdot y + w) \% (x \cdot z) = x \cdot (y \% z) + w$ when $w < x$
Informal description
For ordinals $w, x, y, z$ with $w < x$, the modulo operation satisfies \[ (x \cdot y + w) \% (x \cdot z) = x \cdot (y \% z) + w. \]
Ordinal.mul_mod_mul theorem
(x y z : Ordinal) : (x * y) % (x * z) = x * (y % z)
Full source
theorem mul_mod_mul (x y z : Ordinal) : (x * y) % (x * z) = x * (y % z) := by
  obtain rfl | hx := Ordinal.eq_zero_or_pos x
  · simp
  · convert mul_add_mod_mul hx y z using 1 <;>
    rw [add_zero]
Modulo Identity: $(x \cdot y) \% (x \cdot z) = x \cdot (y \% z)$
Informal description
For any ordinals $x$, $y$, and $z$, the modulo operation satisfies \[ (x \cdot y) \% (x \cdot z) = x \cdot (y \% z). \]
Ordinal.mod_mod_of_dvd theorem
(a : Ordinal) {b c : Ordinal} (h : c ∣ b) : a % b % c = a % c
Full source
theorem mod_mod_of_dvd (a : Ordinal) {b c : Ordinal} (h : c ∣ b) : a % b % c = a % c := by
  nth_rw 2 [← div_add_mod a b]
  rcases h with ⟨d, rfl⟩
  rw [mul_assoc, mul_add_mod_self]
Modulo Reduction under Divisibility: $(a \% b) \% c = a \% c$ when $c \mid b$
Informal description
For any ordinals $a$, $b$, and $c$ such that $c$ divides $b$, the modulo operation satisfies $(a \% b) \% c = a \% c$.
Ordinal.mod_mod theorem
(a b : Ordinal) : a % b % b = a % b
Full source
@[simp]
theorem mod_mod (a b : Ordinal) : a % b % b = a % b :=
  mod_mod_of_dvd a dvd_rfl
Idempotence of modulo operation on ordinals: $(a \% b) \% b = a \% b$
Informal description
For any ordinals $a$ and $b$, the modulo operation satisfies $(a \% b) \% b = a \% b$.
Ordinal.one_add_natCast theorem
(m : ℕ) : 1 + (m : Ordinal) = succ m
Full source
@[simp]
theorem one_add_natCast (m : ) : 1 + (m : Ordinal) = succ m := by
  rw [← Nat.cast_one, ← Nat.cast_add, add_comm]
  rfl
Successor Ordinal as One Plus Natural Number Cast: $1 + m = \text{succ}(m)$
Informal description
For any natural number $m$, the sum of the ordinal $1$ and the ordinal cast of $m$ is equal to the successor ordinal of $m$, i.e., $1 + m = \text{succ}(m)$.
Ordinal.one_add_ofNat theorem
(m : ℕ) [m.AtLeastTwo] : 1 + (ofNat(m) : Ordinal) = Order.succ (OfNat.ofNat m : Ordinal)
Full source
@[simp]
theorem one_add_ofNat (m : ) [m.AtLeastTwo] :
    1 + (ofNat(m) : Ordinal) = Order.succ (OfNat.ofNat m : Ordinal) :=
  one_add_natCast m
Successor of Natural Number Cast in Ordinals: $1 + m = \text{succ}(m)$ for $m \geq 2$
Informal description
For any natural number $m \geq 2$, the sum of the ordinal $1$ and the ordinal cast of $m$ is equal to the successor ordinal of $m$, i.e., $1 + m = \text{succ}(m)$.
Ordinal.natCast_mul theorem
(m : ℕ) : ∀ n : ℕ, ((m * n : ℕ) : Ordinal) = m * n
Full source
@[simp, norm_cast]
theorem natCast_mul (m : ) : ∀ n : , ((m * n : ) : Ordinal) = m * n
  | 0 => by simp
  | n + 1 => by rw [Nat.mul_succ, Nat.cast_add, natCast_mul m n, Nat.cast_succ, mul_add_one]
Preservation of Multiplication under Natural Number to Ordinal Cast: $(m \cdot n) = m \cdot n$
Informal description
For any natural numbers $m$ and $n$, the ordinal obtained by casting the product $m \cdot n$ is equal to the product of the ordinals obtained by casting $m$ and $n$ individually, i.e., $(m \cdot n) = m \cdot n$ where the left-hand side is the natural number product and the right-hand side is the ordinal product.
Ordinal.natCast_sub theorem
(m n : ℕ) : ((m - n : ℕ) : Ordinal) = m - n
Full source
@[simp, norm_cast]
theorem natCast_sub (m n : ) : ((m - n : ) : Ordinal) = m - n := by
  rcases le_total m n with h | h
  · rw [tsub_eq_zero_iff_le.2 h, Ordinal.sub_eq_zero_iff_le.2 (Nat.cast_le.2 h), Nat.cast_zero]
  · rw [← add_left_cancel_iff (a := ↑n), ← Nat.cast_add, add_tsub_cancel_of_le h,
      Ordinal.add_sub_cancel_of_le (Nat.cast_le.2 h)]
Preservation of Subtraction under Natural Number to Ordinal Cast: $(m - n) = m - n$
Informal description
For any natural numbers $m$ and $n$, the ordinal obtained by casting the difference $m - n$ is equal to the difference of the ordinals obtained by casting $m$ and $n$ individually, i.e., $(m - n) = m - n$ where the left-hand side is the natural number difference and the right-hand side is the ordinal difference.
Ordinal.natCast_div theorem
(m n : ℕ) : ((m / n : ℕ) : Ordinal) = m / n
Full source
@[simp, norm_cast]
theorem natCast_div (m n : ) : ((m / n : ) : Ordinal) = m / n := by
  rcases eq_or_ne n 0 with (rfl | hn)
  · simp
  · have hn' : (n : Ordinal) ≠ 0 := Nat.cast_ne_zero.2 hn
    apply le_antisymm
    · rw [le_div hn', ← natCast_mul, Nat.cast_le, mul_comm]
      apply Nat.div_mul_le_self
    · rw [div_le hn', ← add_one_eq_succ, ← Nat.cast_succ, ← natCast_mul, Nat.cast_lt, mul_comm,
        ← Nat.div_lt_iff_lt_mul (Nat.pos_of_ne_zero hn)]
      apply Nat.lt_succ_self
Preservation of Division under Natural Number to Ordinal Cast: $(m / n) = m / n$
Informal description
For any natural numbers $m$ and $n$, the ordinal obtained by casting the quotient $m / n$ (natural number division) is equal to the ordinal division of the cast values, i.e., $(m / n) = m / n$ where the left-hand side is the natural number division and the right-hand side is the ordinal division.
Ordinal.natCast_mod theorem
(m n : ℕ) : ((m % n : ℕ) : Ordinal) = m % n
Full source
@[simp, norm_cast]
theorem natCast_mod (m n : ) : ((m % n : ) : Ordinal) = m % n := by
  rw [← add_left_cancel_iff, div_add_mod, ← natCast_div, ← natCast_mul, ← Nat.cast_add,
    Nat.div_add_mod]
Preservation of Modulo Operation under Natural Number to Ordinal Cast: $(m \% n) = m \% n$
Informal description
For any natural numbers $m$ and $n$, the ordinal obtained by casting the remainder $m \% n$ (natural number modulo operation) is equal to the ordinal modulo operation of the cast values, i.e., $(m \% n) = m \% n$ where the left-hand side is the natural number remainder and the right-hand side is the ordinal remainder.
Ordinal.lift_natCast theorem
: ∀ n : ℕ, lift.{u, v} n = n
Full source
@[simp]
theorem lift_natCast : ∀ n : , lift.{u, v} n = n
  | 0 => by simp
  | n + 1 => by simp [lift_natCast n]
Lift of Natural Number as Ordinal is Identity: $\text{lift}(n) = n$
Informal description
For any natural number $n$, the lift of $n$ (as an ordinal) to any higher universe is equal to $n$ itself, i.e., $\text{lift}(n) = n$.
Ordinal.lift_ofNat theorem
(n : ℕ) [n.AtLeastTwo] : lift.{u, v} ofNat(n) = OfNat.ofNat n
Full source
@[simp]
theorem lift_ofNat (n : ) [n.AtLeastTwo] :
    lift.{u, v} ofNat(n) = OfNat.ofNat n :=
  lift_natCast n
Lift of Natural Number (≥2) as Ordinal is Identity: $\text{lift}(n) = n$ for $n \geq 2$
Informal description
For any natural number $n \geq 2$, the lift of $n$ (as an ordinal) to any higher universe is equal to $n$ itself, i.e., $\text{lift}(n) = n$.
Ordinal.nat_lt_omega0 theorem
(n : ℕ) : ↑n < ω
Full source
theorem nat_lt_omega0 (n : ) : ↑n < ω :=
  lt_omega0.2 ⟨_, rfl⟩
Natural numbers as ordinals are less than $\omega$
Informal description
For any natural number $n$, the ordinal corresponding to $n$ is strictly less than the first infinite ordinal $\omega$. That is, $n < \omega$.
Ordinal.omega0_pos theorem
: 0 < ω
Full source
theorem omega0_pos : 0 < ω :=
  nat_lt_omega0 0
Positivity of the First Infinite Ordinal: $0 < \omega$
Informal description
The first infinite ordinal $\omega$ is strictly greater than the zero ordinal, i.e., $0 < \omega$.
Ordinal.omega0_ne_zero theorem
: ω ≠ 0
Full source
theorem omega0_ne_zero : ωω ≠ 0 :=
  omega0_pos.ne'
Nonzero Property of $\omega$: $\omega \neq 0$
Informal description
The first infinite ordinal $\omega$ is not equal to the zero ordinal, i.e., $\omega \neq 0$.
Ordinal.one_lt_omega0 theorem
: 1 < ω
Full source
theorem one_lt_omega0 : 1 < ω := by simpa only [Nat.cast_one] using nat_lt_omega0 1
$1 < \omega$ in ordinals
Informal description
The ordinal number $1$ is strictly less than the first infinite ordinal $\omega$.
Ordinal.omega0_le theorem
{o : Ordinal} : ω ≤ o ↔ ∀ n : ℕ, ↑n ≤ o
Full source
theorem omega0_le {o : Ordinal} : ωω ≤ o ↔ ∀ n : ℕ, ↑n ≤ o :=
  ⟨fun h n => (nat_lt_omega0 _).le.trans h, fun H =>
    le_of_forall_lt fun a h => by
      let ⟨n, e⟩ := lt_omega0.1 h
      rw [e, ← succ_le_iff]; exact H (n + 1)⟩
Characterization of $\omega \leq o$ via natural number bounds
Informal description
For any ordinal $o$, the first infinite ordinal $\omega$ is less than or equal to $o$ if and only if for every natural number $n$, the ordinal corresponding to $n$ is less than or equal to $o$. In symbols: \[ \omega \leq o \leftrightarrow \forall n \in \mathbb{N}, n \leq o. \]
Ordinal.nat_lt_limit theorem
{o} (h : IsLimit o) : ∀ n : ℕ, ↑n < o
Full source
theorem nat_lt_limit {o} (h : IsLimit o) : ∀ n : , ↑n < o
  | 0 => h.pos
  | n + 1 => h.succ_lt (nat_lt_limit h n)
Natural numbers are less than any limit ordinal
Informal description
For any limit ordinal $o$ and any natural number $n$, the ordinal corresponding to $n$ is strictly less than $o$, i.e., $n < o$.
Ordinal.omega0_le_of_isLimit theorem
{o} (h : IsLimit o) : ω ≤ o
Full source
theorem omega0_le_of_isLimit {o} (h : IsLimit o) : ω ≤ o :=
  omega0_le.2 fun n => le_of_lt <| nat_lt_limit h n
$\omega$ is bounded by any limit ordinal
Informal description
For any limit ordinal $o$, the first infinite ordinal $\omega$ is less than or equal to $o$.
Ordinal.natCast_add_omega0 theorem
(n : ℕ) : n + ω = ω
Full source
theorem natCast_add_omega0 (n : ) : n + ω = ω := by
  refine le_antisymm (le_of_forall_lt fun a ha ↦ ?_) (le_add_left _ _)
  obtain ⟨b, hb', hb⟩ := (lt_add_iff omega0_ne_zero).1 ha
  obtain ⟨m, rfl⟩ := lt_omega0.1 hb'
  apply hb.trans_lt
  exact_mod_cast nat_lt_omega0 (n + m)
Natural Number Addition with Omega: $n + \omega = \omega$
Informal description
For any natural number $n$, the sum of the ordinal corresponding to $n$ and the first infinite ordinal $\omega$ is equal to $\omega$, i.e., $n + \omega = \omega$.
Ordinal.one_add_omega0 theorem
: 1 + ω = ω
Full source
theorem one_add_omega0 : 1 + ω = ω :=
  mod_cast natCast_add_omega0 1
Ordinal Identity: $1 + \omega = \omega$
Informal description
The sum of the ordinal $1$ and the first infinite ordinal $\omega$ is equal to $\omega$, i.e., $1 + \omega = \omega$.
Ordinal.add_omega0 theorem
{a : Ordinal} (h : a < ω) : a + ω = ω
Full source
theorem add_omega0 {a : Ordinal} (h : a < ω) : a + ω = ω := by
  obtain ⟨n, rfl⟩ := lt_omega0.1 h
  exact natCast_add_omega0 n
Ordinal addition identity: $a + \omega = \omega$ for $a < \omega$
Informal description
For any ordinal $a$ such that $a < \omega$, the sum $a + \omega$ is equal to $\omega$.
Ordinal.natCast_add_of_omega0_le theorem
{o} (h : ω ≤ o) (n : ℕ) : n + o = o
Full source
@[simp]
theorem natCast_add_of_omega0_le {o} (h : ω ≤ o) (n : ) : n + o = o := by
  rw [← Ordinal.add_sub_cancel_of_le h, ← add_assoc, natCast_add_omega0]
Natural Number Addition with Infinite Ordinals: $n + o = o$ when $\omega \leq o$
Informal description
For any natural number $n$ and any ordinal $o$ such that $\omega \leq o$, the sum $n + o$ is equal to $o$.
Ordinal.one_add_of_omega0_le theorem
{o} (h : ω ≤ o) : 1 + o = o
Full source
@[simp]
theorem one_add_of_omega0_le {o} (h : ω ≤ o) : 1 + o = o :=
  mod_cast natCast_add_of_omega0_le h 1
Ordinal addition identity: $1 + o = o$ for $\omega \leq o$
Informal description
For any ordinal $o$ such that $\omega \leq o$, the sum of the ordinal $1$ and $o$ is equal to $o$, i.e., $1 + o = o$.
Ordinal.isLimit_iff_omega0_dvd theorem
{a : Ordinal} : IsLimit a ↔ a ≠ 0 ∧ ω ∣ a
Full source
theorem isLimit_iff_omega0_dvd {a : Ordinal} : IsLimitIsLimit a ↔ a ≠ 0 ∧ ω ∣ a := by
  refine ⟨fun l => ⟨l.ne_zero, ⟨a / ω, le_antisymm ?_ (mul_div_le _ _)⟩⟩, fun h => ?_⟩
  · refine (limit_le l).2 fun x hx => le_of_lt ?_
    rw [← div_lt omega0_ne_zero, ← succ_le_iff, le_div omega0_ne_zero, mul_succ,
      add_le_of_limit isLimit_omega0]
    intro b hb
    rcases lt_omega0.1 hb with ⟨n, rfl⟩
    exact
      (add_le_add_right (mul_div_le _ _) _).trans
        (lt_sub.1 <| nat_lt_limit (isLimit_sub l hx) _).le
  · rcases h with ⟨a0, b, rfl⟩
    refine isLimit_mul_left isLimit_omega0 (Ordinal.pos_iff_ne_zero.2 <| mt ?_ a0)
    intro e
    simp only [e, mul_zero]
Characterization of limit ordinals: $a$ is limit iff $a \neq 0$ and $\omega$ divides $a$
Informal description
An ordinal $a$ is a limit ordinal if and only if $a$ is nonzero and divisible by $\omega$ (i.e., there exists an ordinal $c$ such that $a = \omega \cdot c$).
Ordinal.natCast_mod_omega0 theorem
(n : ℕ) : n % ω = n
Full source
@[simp]
theorem natCast_mod_omega0 (n : ) : n % ω = n :=
  mod_eq_of_lt (nat_lt_omega0 n)
Modulo Identity for Natural Numbers and $\omega$: $n \% \omega = n$
Informal description
For any natural number $n$, the modulo operation of $n$ with the first infinite ordinal $\omega$ satisfies $n \% \omega = n$.
Cardinal.isLimit_ord theorem
{c} (co : ℵ₀ ≤ c) : (ord c).IsLimit
Full source
theorem isLimit_ord {c} (co : ℵ₀ ≤ c) : (ord c).IsLimit := by
  rw [isLimit_iff, isSuccPrelimit_iff_succ_lt]
  refine ⟨fun h => aleph0_ne_zero ?_, fun a => lt_imp_lt_of_le_imp_le fun h => ?_⟩
  · rw [← Ordinal.le_zero, ord_le] at h
    simpa only [card_zero, nonpos_iff_eq_zero] using co.trans h
  · rw [ord_le] at h ⊢
    rwa [← @add_one_of_aleph0_le (card a), ← card_succ]
    rw [← ord_le, ← le_succ_of_isLimit, ord_le]
    · exact co.trans h
    · rw [ord_aleph0]
      exact Ordinal.isLimit_omega0
Limit Ordinal Property of $\mathrm{ord}(c)$ for Infinite Cardinals $c \geq \aleph_0$
Informal description
For any cardinal number $c$ such that $\aleph_0 \leq c$, the smallest ordinal $\mathrm{ord}(c)$ with cardinality $c$ is a limit ordinal.
Cardinal.noMaxOrder theorem
{c} (h : ℵ₀ ≤ c) : NoMaxOrder c.ord.toType
Full source
theorem noMaxOrder {c} (h : ℵ₀ ≤ c) : NoMaxOrder c.ord.toType :=
  toType_noMax_of_succ_lt fun _ ↦ (isLimit_ord h).succ_lt
No Maximal Element in $\mathrm{ord}(c)$ for Infinite Cardinals $c \geq \aleph_0$
Informal description
For any cardinal number $c$ such that $\aleph_0 \leq c$, the canonical type associated with the ordinal $\mathrm{ord}(c)$ (the smallest ordinal with cardinality $c$) has no maximal element with respect to its order relation.