Documentation

Mathlib.SetTheory.Ordinal.NaturalOps

Natural operations on ordinals #

The goal of this file is to define natural addition and multiplication on ordinals, also known as the Hessenberg sum and product, and provide a basic API. The natural addition of two ordinals a ♯ b is recursively defined as the least ordinal greater than a' ♯ b and a ♯ b' for a' < a and b' < b. The natural multiplication a ⨳ b is likewise recursively defined as the least ordinal such that a ⨳ b ♯ a' ⨳ b' is greater than a' ⨳ b ♯ a ⨳ b' for any a' < a and b' < b.

These operations form a rich algebraic structure: they're commutative, associative, preserve order, have the usual 0 and 1 from ordinals, and distribute over one another.

Moreover, these operations are the addition and multiplication of ordinals when viewed as combinatorial Games. This makes them particularly useful for game theory.

Finally, both operations admit simple, intuitive descriptions in terms of the Cantor normal form. The natural addition of two ordinals corresponds to adding their Cantor normal forms as if they were polynomials in ω. Likewise, their natural multiplication corresponds to multiplying the Cantor normal forms as polynomials.

Implementation notes #

Given the rich algebraic structure of these two operations, we choose to create a type synonym NatOrdinal, where we provide the appropriate instances. However, to avoid casting back and forth between both types, we attempt to prove and state most results on Ordinal.

Todo #

Basic casts between Ordinal and NatOrdinal #

def NatOrdinal :
Type (u_1 + 1)

A type synonym for ordinals with natural addition and multiplication.

Equations
Instances For
    @[match_pattern]

    The identity function between Ordinal and NatOrdinal.

    Equations
    Instances For
      @[match_pattern]

      The identity function between NatOrdinal and Ordinal.

      Equations
      Instances For
        theorem NatOrdinal.lt_wf :
        WellFounded fun (x1 x2 : NatOrdinal) => x1 < x2
        def NatOrdinal.rec {β : NatOrdinalSort u_1} (h : (a : Ordinal.{u_2}) → β (Ordinal.toNatOrdinal a)) (a : NatOrdinal) :
        β a

        A recursor for NatOrdinal. Use as induction x.

        Equations
        Instances For
          theorem NatOrdinal.induction {p : NatOrdinalProp} (i : NatOrdinal) :
          (∀ (j : NatOrdinal), (∀ k < j, p k)p j)p i

          Ordinal.induction but for NatOrdinal.

          We place the definitions of nadd and nmul before actually developing their API, as this guarantees we only need to open the NaturalOps locale once.

          @[irreducible]
          noncomputable def Ordinal.nadd (a b : Ordinal.{u}) :

          Natural addition on ordinals a ♯ b, also known as the Hessenberg sum, is recursively defined as the least ordinal greater than a' ♯ b and a ♯ b' for all a' < a and b' < b. In contrast to normal ordinal addition, it is commutative.

          Natural addition can equivalently be characterized as the ordinal resulting from adding up corresponding coefficients in the Cantor normal forms of a and b.

          Equations
          Instances For

            Natural addition on ordinals a ♯ b, also known as the Hessenberg sum, is recursively defined as the least ordinal greater than a' ♯ b and a ♯ b' for all a' < a and b' < b. In contrast to normal ordinal addition, it is commutative.

            Natural addition can equivalently be characterized as the ordinal resulting from adding up corresponding coefficients in the Cantor normal forms of a and b.

            Equations
            Instances For
              @[irreducible]
              noncomputable def Ordinal.nmul (a b : Ordinal.{u}) :

              Natural multiplication on ordinals a ⨳ b, also known as the Hessenberg product, is recursively defined as the least ordinal such that a ⨳ b ♯ a' ⨳ b' is greater than a' ⨳ b ♯ a ⨳ b' for all a' < a and b < b'. In contrast to normal ordinal multiplication, it is commutative and distributive (over natural addition).

              Natural multiplication can equivalently be characterized as the ordinal resulting from multiplying the Cantor normal forms of a and b as if they were polynomials in ω. Addition of exponents is done via natural addition.

              Equations
              • a.nmul b = sInf {c : Ordinal.{?u.3} | a' < a, b' < b, (a'.nmul b).nadd (a.nmul b') < c.nadd (a'.nmul b')}
              Instances For

                Natural multiplication on ordinals a ⨳ b, also known as the Hessenberg product, is recursively defined as the least ordinal such that a ⨳ b ♯ a' ⨳ b' is greater than a' ⨳ b ♯ a ⨳ b' for all a' < a and b < b'. In contrast to normal ordinal multiplication, it is commutative and distributive (over natural addition).

                Natural multiplication can equivalently be characterized as the ordinal resulting from multiplying the Cantor normal forms of a and b as if they were polynomials in ω. Addition of exponents is done via natural addition.

                Equations
                Instances For

                  Natural addition #

                  theorem Ordinal.nadd_def (a b : Ordinal.{u}) :
                  a.nadd b = (a.blsub fun (a' : Ordinal.{u}) (x : a' < a) => a'.nadd b) b.blsub fun (b' : Ordinal.{u}) (x : b' < b) => a.nadd b'
                  theorem Ordinal.lt_nadd_iff {a b c : Ordinal.{u}} :
                  a < b.nadd c (∃ b' < b, a b'.nadd c) c' < c, a b.nadd c'
                  theorem Ordinal.nadd_le_iff {a b c : Ordinal.{u}} :
                  b.nadd c a (∀ b' < b, b'.nadd c < a) c' < c, b.nadd c' < a
                  theorem Ordinal.nadd_lt_nadd_left {b c : Ordinal.{u}} (h : b < c) (a : Ordinal.{u}) :
                  a.nadd b < a.nadd c
                  theorem Ordinal.nadd_lt_nadd_right {b c : Ordinal.{u}} (h : b < c) (a : Ordinal.{u}) :
                  b.nadd a < c.nadd a
                  theorem Ordinal.nadd_le_nadd_left {b c : Ordinal.{u}} (h : b c) (a : Ordinal.{u}) :
                  a.nadd b a.nadd c
                  theorem Ordinal.nadd_le_nadd_right {b c : Ordinal.{u}} (h : b c) (a : Ordinal.{u}) :
                  b.nadd a c.nadd a
                  @[irreducible]
                  theorem Ordinal.nadd_comm (a b : Ordinal.{u_1}) :
                  a.nadd b = b.nadd a
                  theorem Ordinal.blsub_nadd_of_mono (a b : Ordinal.{u}) {f : (c : Ordinal.{u}) → c < a.nadd bOrdinal.{max u v} } (hf : ∀ {i j : Ordinal.{u}} (hi : i < a.nadd b) (hj : j < a.nadd b), i jf i hi f j hj) :
                  (a.nadd b).blsub f = (a.blsub fun (a' : Ordinal.{u}) (ha' : a' < a) => f (a'.nadd b) ) b.blsub fun (b' : Ordinal.{u}) (hb' : b' < b) => f (a.nadd b')
                  @[irreducible]
                  theorem Ordinal.nadd_assoc (a b c : Ordinal.{u_1}) :
                  (a.nadd b).nadd c = a.nadd (b.nadd c)
                  @[simp]
                  theorem Ordinal.nadd_zero (a : Ordinal.{u}) :
                  a.nadd 0 = a
                  @[simp]
                  @[simp]
                  theorem Ordinal.nadd_one (a : Ordinal.{u}) :
                  a.nadd 1 = Order.succ a
                  theorem Ordinal.nadd_succ (a b : Ordinal.{u}) :
                  a.nadd (Order.succ b) = Order.succ (a.nadd b)
                  theorem Ordinal.succ_nadd (a b : Ordinal.{u}) :
                  (Order.succ a).nadd b = Order.succ (a.nadd b)
                  @[simp]
                  theorem Ordinal.nadd_nat (a : Ordinal.{u}) (n : ) :
                  a.nadd n = a + n
                  @[simp]
                  theorem Ordinal.nat_nadd (a : Ordinal.{u}) (n : ) :
                  (↑n).nadd a = a + n
                  theorem Ordinal.add_le_nadd (a b : Ordinal.{u}) :
                  a + b a.nadd b
                  @[deprecated Order.succ_eq_add_one]
                  theorem Ordinal.lt_of_nadd_lt_nadd_left {a b c : Ordinal.{u_1}} :
                  a.nadd b < a.nadd cb < c
                  theorem Ordinal.lt_of_nadd_lt_nadd_right {a b c : Ordinal.{u_1}} :
                  b.nadd a < c.nadd ab < c
                  theorem Ordinal.le_of_nadd_le_nadd_left {a b c : Ordinal.{u_1}} :
                  a.nadd b a.nadd cb c
                  theorem Ordinal.le_of_nadd_le_nadd_right {a b c : Ordinal.{u_1}} :
                  b.nadd a c.nadd ab c
                  theorem Ordinal.nadd_lt_nadd_iff_left (a : Ordinal.{u_1}) {b c : Ordinal.{u_1}} :
                  a.nadd b < a.nadd c b < c
                  theorem Ordinal.nadd_lt_nadd_iff_right (a : Ordinal.{u_1}) {b c : Ordinal.{u_1}} :
                  b.nadd a < c.nadd a b < c
                  theorem Ordinal.nadd_le_nadd_iff_left (a : Ordinal.{u_1}) {b c : Ordinal.{u_1}} :
                  a.nadd b a.nadd c b c
                  theorem Ordinal.nadd_le_nadd_iff_right (a : Ordinal.{u_1}) {b c : Ordinal.{u_1}} :
                  b.nadd a c.nadd a b c
                  theorem Ordinal.nadd_le_nadd {a b c d : Ordinal.{u_1}} :
                  a bc da.nadd c b.nadd d
                  theorem Ordinal.nadd_lt_nadd {a b c d : Ordinal.{u_1}} :
                  a < bc < da.nadd c < b.nadd d
                  theorem Ordinal.nadd_lt_nadd_of_lt_of_le {a b c d : Ordinal.{u_1}} :
                  a < bc da.nadd c < b.nadd d
                  theorem Ordinal.nadd_lt_nadd_of_le_of_lt {a b c d : Ordinal.{u_1}} :
                  a bc < da.nadd c < b.nadd d
                  theorem Ordinal.nadd_left_cancel {a b c : Ordinal.{u_1}} :
                  a.nadd b = a.nadd cb = c
                  theorem Ordinal.nadd_right_cancel {a b c : Ordinal.{u_1}} :
                  a.nadd b = c.nadd ba = c
                  theorem Ordinal.nadd_left_cancel_iff {a b c : Ordinal.{u_1}} :
                  a.nadd b = a.nadd c b = c
                  theorem Ordinal.nadd_right_cancel_iff {a b c : Ordinal.{u_1}} :
                  b.nadd a = c.nadd a b = c
                  theorem Ordinal.le_nadd_self {a b : Ordinal.{u_1}} :
                  a b.nadd a
                  theorem Ordinal.le_nadd_left {a b c : Ordinal.{u_1}} (h : a c) :
                  a b.nadd c
                  theorem Ordinal.le_self_nadd {a b : Ordinal.{u_1}} :
                  a a.nadd b
                  theorem Ordinal.le_nadd_right {a b c : Ordinal.{u_1}} (h : a b) :
                  a b.nadd c
                  theorem Ordinal.nadd_left_comm (a b c : Ordinal.{u_1}) :
                  a.nadd (b.nadd c) = b.nadd (a.nadd c)
                  theorem Ordinal.nadd_right_comm (a b c : Ordinal.{u_1}) :
                  (a.nadd b).nadd c = (a.nadd c).nadd b

                  Natural multiplication #

                  theorem Ordinal.nmul_def (a b : Ordinal.{u_1}) :
                  a.nmul b = sInf {c : Ordinal.{u_1} | a' < a, b' < b, (a'.nmul b).nadd (a.nmul b') < c.nadd (a'.nmul b')}
                  theorem Ordinal.nmul_nadd_lt {a b a' b' : Ordinal.{u}} (ha : a' < a) (hb : b' < b) :
                  (a'.nmul b).nadd (a.nmul b') < (a.nmul b).nadd (a'.nmul b')
                  theorem Ordinal.nmul_nadd_le {a b a' b' : Ordinal.{u}} (ha : a' a) (hb : b' b) :
                  (a'.nmul b).nadd (a.nmul b') (a.nmul b).nadd (a'.nmul b')
                  theorem Ordinal.lt_nmul_iff {a b c : Ordinal.{u}} :
                  c < a.nmul b a' < a, b' < b, c.nadd (a'.nmul b') (a'.nmul b).nadd (a.nmul b')
                  theorem Ordinal.nmul_le_iff {a b c : Ordinal.{u}} :
                  a.nmul b c a' < a, b' < b, (a'.nmul b).nadd (a.nmul b') < c.nadd (a'.nmul b')
                  @[irreducible]
                  theorem Ordinal.nmul_comm (a b : Ordinal.{u_1}) :
                  a.nmul b = b.nmul a
                  @[simp]
                  theorem Ordinal.nmul_zero (a : Ordinal.{u_1}) :
                  a.nmul 0 = 0
                  @[simp, irreducible]
                  theorem Ordinal.nmul_one (a : Ordinal.{u_1}) :
                  a.nmul 1 = a
                  @[simp]
                  theorem Ordinal.nmul_lt_nmul_of_pos_left {a b c : Ordinal.{u}} (h₁ : a < b) (h₂ : 0 < c) :
                  c.nmul a < c.nmul b
                  theorem Ordinal.nmul_lt_nmul_of_pos_right {a b c : Ordinal.{u}} (h₁ : a < b) (h₂ : 0 < c) :
                  a.nmul c < b.nmul c
                  theorem Ordinal.nmul_le_nmul_left {a b : Ordinal.{u}} (h : a b) (c : Ordinal.{u}) :
                  c.nmul a c.nmul b
                  @[deprecated Ordinal.nmul_le_nmul_left]
                  theorem Ordinal.nmul_le_nmul_of_nonneg_left {a b : Ordinal.{u}} (h : a b) (c : Ordinal.{u}) :
                  c.nmul a c.nmul b

                  Alias of Ordinal.nmul_le_nmul_left.

                  theorem Ordinal.nmul_le_nmul_right {a b : Ordinal.{u}} (h : a b) (c : Ordinal.{u}) :
                  a.nmul c b.nmul c
                  @[deprecated Ordinal.nmul_le_nmul_left]
                  theorem Ordinal.nmul_le_nmul_of_nonneg_right {a b : Ordinal.{u}} (h : a b) (c : Ordinal.{u}) :
                  a.nmul c b.nmul c

                  Alias of Ordinal.nmul_le_nmul_right.

                  @[irreducible]
                  theorem Ordinal.nmul_nadd (a b c : Ordinal.{u_1}) :
                  a.nmul (b.nadd c) = (a.nmul b).nadd (a.nmul c)
                  theorem Ordinal.nadd_nmul (a b c : Ordinal.{u_1}) :
                  (a.nadd b).nmul c = (a.nmul c).nadd (b.nmul c)
                  theorem Ordinal.nmul_nadd_lt₃ {a b c a' b' c' : Ordinal.{u}} (ha : a' < a) (hb : b' < b) (hc : c' < c) :
                  ((((a'.nmul b).nmul c).nadd ((a.nmul b').nmul c)).nadd ((a.nmul b).nmul c')).nadd ((a'.nmul b').nmul c') < ((((a.nmul b).nmul c).nadd ((a'.nmul b').nmul c)).nadd ((a'.nmul b).nmul c')).nadd ((a.nmul b').nmul c')
                  theorem Ordinal.nmul_nadd_le₃ {a b c a' b' c' : Ordinal.{u}} (ha : a' a) (hb : b' b) (hc : c' c) :
                  ((((a'.nmul b).nmul c).nadd ((a.nmul b').nmul c)).nadd ((a.nmul b).nmul c')).nadd ((a'.nmul b').nmul c') ((((a.nmul b).nmul c).nadd ((a'.nmul b').nmul c)).nadd ((a'.nmul b).nmul c')).nadd ((a.nmul b').nmul c')
                  theorem Ordinal.nmul_nadd_lt₃' {a b c a' b' c' : Ordinal.{u}} (ha : a' < a) (hb : b' < b) (hc : c' < c) :
                  (((a'.nmul (b.nmul c)).nadd (a.nmul (b'.nmul c))).nadd (a.nmul (b.nmul c'))).nadd (a'.nmul (b'.nmul c')) < (((a.nmul (b.nmul c)).nadd (a'.nmul (b'.nmul c))).nadd (a'.nmul (b.nmul c'))).nadd (a.nmul (b'.nmul c'))
                  theorem Ordinal.nmul_nadd_le₃' {a b c a' b' c' : Ordinal.{u}} (ha : a' a) (hb : b' b) (hc : c' c) :
                  (((a'.nmul (b.nmul c)).nadd (a.nmul (b'.nmul c))).nadd (a.nmul (b.nmul c'))).nadd (a'.nmul (b'.nmul c')) (((a.nmul (b.nmul c)).nadd (a'.nmul (b'.nmul c))).nadd (a'.nmul (b.nmul c'))).nadd (a.nmul (b'.nmul c'))
                  theorem Ordinal.lt_nmul_iff₃ {a b c d : Ordinal.{u}} :
                  d < (a.nmul b).nmul c a' < a, b' < b, c' < c, ((d.nadd ((a'.nmul b').nmul c)).nadd ((a'.nmul b).nmul c')).nadd ((a.nmul b').nmul c') ((((a'.nmul b).nmul c).nadd ((a.nmul b').nmul c)).nadd ((a.nmul b).nmul c')).nadd ((a'.nmul b').nmul c')
                  theorem Ordinal.nmul_le_iff₃ {a b c d : Ordinal.{u}} :
                  (a.nmul b).nmul c d a' < a, b' < b, c' < c, ((((a'.nmul b).nmul c).nadd ((a.nmul b').nmul c)).nadd ((a.nmul b).nmul c')).nadd ((a'.nmul b').nmul c') < ((d.nadd ((a'.nmul b').nmul c)).nadd ((a'.nmul b).nmul c')).nadd ((a.nmul b').nmul c')
                  theorem Ordinal.lt_nmul_iff₃' {a b c d : Ordinal.{u}} :
                  d < a.nmul (b.nmul c) a' < a, b' < b, c' < c, ((d.nadd (a'.nmul (b'.nmul c))).nadd (a'.nmul (b.nmul c'))).nadd (a.nmul (b'.nmul c')) (((a'.nmul (b.nmul c)).nadd (a.nmul (b'.nmul c))).nadd (a.nmul (b.nmul c'))).nadd (a'.nmul (b'.nmul c'))
                  theorem Ordinal.nmul_le_iff₃' {a b c d : Ordinal.{u}} :
                  a.nmul (b.nmul c) d a' < a, b' < b, c' < c, (((a'.nmul (b.nmul c)).nadd (a.nmul (b'.nmul c))).nadd (a.nmul (b.nmul c'))).nadd (a'.nmul (b'.nmul c')) < ((d.nadd (a'.nmul (b'.nmul c))).nadd (a'.nmul (b.nmul c'))).nadd (a.nmul (b'.nmul c'))
                  @[irreducible]
                  theorem Ordinal.nmul_assoc (a b c : Ordinal.{u_1}) :
                  (a.nmul b).nmul c = a.nmul (b.nmul c)
                  theorem Ordinal.nmul_nadd_one (a b : Ordinal.{u_1}) :
                  a.nmul (b.nadd 1) = (a.nmul b).nadd a
                  theorem Ordinal.nadd_one_nmul (a b : Ordinal.{u_1}) :
                  (a.nadd 1).nmul b = (a.nmul b).nadd b
                  theorem Ordinal.nmul_succ (a b : Ordinal.{u_1}) :
                  a.nmul (Order.succ b) = (a.nmul b).nadd a
                  theorem Ordinal.succ_nmul (a b : Ordinal.{u_1}) :
                  (Order.succ a).nmul b = (a.nmul b).nadd b
                  theorem Ordinal.nmul_add_one (a b : Ordinal.{u_1}) :
                  a.nmul (b + 1) = (a.nmul b).nadd a
                  theorem Ordinal.add_one_nmul (a b : Ordinal.{u_1}) :
                  (a + 1).nmul b = (a.nmul b).nadd b
                  theorem Ordinal.mul_le_nmul (a b : Ordinal.{u}) :
                  a * b a.nmul b
                  @[deprecated Ordinal.mul_le_nmul]
                  theorem NatOrdinal.mul_le_nmul (a b : Ordinal.{u}) :
                  a * b a.nmul b

                  Alias of Ordinal.mul_le_nmul.