mathlib3 documentation

set_theory.ordinal.natural_ops

Natural operations on ordinals #

THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.

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 nat_ordinal, 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 nat_ordinal #

@[protected, instance]
@[protected, instance]
@[protected, instance]
@[protected, instance]
@[protected, instance]

The identity function between nat_ordinal and ordinal.

Equations
@[protected]
noncomputable def nat_ordinal.rec {β : nat_ordinal Sort u_2} (h : Π (a : ordinal), β (ordinal.to_nat_ordinal a)) (a : nat_ordinal) :
β a

A recursor for nat_ordinal. Use as induction x using nat_ordinal.rec.

Equations
theorem nat_ordinal.induction {p : nat_ordinal Prop} (i : nat_ordinal) (h : (j : nat_ordinal), ( (k : nat_ordinal), k < j p k) p j) :
p i

ordinal.induction but for nat_ordinal.

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

noncomputable def ordinal.nadd  :

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
noncomputable def ordinal.nmul  :

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

Natural addition #

theorem ordinal.nadd_def (a b : ordinal) :
a.nadd b = linear_order.max (a.blsub (λ (a' : ordinal) (h : a' < a), a'.nadd b)) (b.blsub (λ (b' : ordinal) (h : b' < b), a.nadd b'))
theorem ordinal.lt_nadd_iff {a b c : ordinal} :
a < b.nadd c ( (b' : ordinal) (H : b' < b), a b'.nadd c) (c' : ordinal) (H : c' < c), a b.nadd c'
theorem ordinal.nadd_le_iff {a b c : ordinal} :
b.nadd c a ( (b' : ordinal), b' < b b'.nadd c < a) (c' : ordinal), c' < c b.nadd c' < a
theorem ordinal.nadd_lt_nadd_left {b c : ordinal} (h : b < c) (a : ordinal) :
a.nadd b < a.nadd c
theorem ordinal.nadd_lt_nadd_right {b c : ordinal} (h : b < c) (a : ordinal) :
b.nadd a < c.nadd a
theorem ordinal.nadd_le_nadd_left {b c : ordinal} (h : b c) (a : ordinal) :
a.nadd b a.nadd c
theorem ordinal.nadd_le_nadd_right {b c : ordinal} (h : b c) (a : ordinal) :
b.nadd a c.nadd a
theorem ordinal.nadd_comm (a b : ordinal) :
a.nadd b = b.nadd a
theorem ordinal.blsub_nadd_of_mono (a b : ordinal) {f : Π (c : ordinal), c < a.nadd b ordinal} (hf : {i j : ordinal} (hi : i < a.nadd b) (hj : j < a.nadd b), i j f i hi f j hj) :
(a.nadd b).blsub f = linear_order.max (a.blsub (λ (a' : ordinal) (ha' : a' < a), f (a'.nadd b) _)) (b.blsub (λ (b' : ordinal) (hb' : b' < b), f (a.nadd b') _))
theorem ordinal.nadd_assoc (a b c : ordinal) :
(a.nadd b).nadd c = a.nadd (b.nadd c)
@[simp]
theorem ordinal.nadd_zero (a : ordinal) :
a.nadd 0 = a
@[simp]
theorem ordinal.zero_nadd (a : ordinal) :
0.nadd a = a
@[simp]
theorem ordinal.nadd_one (a : ordinal) :
@[simp]
theorem ordinal.one_nadd (a : ordinal) :
theorem ordinal.nadd_succ (a b : ordinal) :
theorem ordinal.succ_nadd (a b : ordinal) :
@[simp]
theorem ordinal.nadd_nat (a : ordinal) (n : ) :
a.nadd n = a + n
@[simp]
theorem ordinal.nat_nadd (a : ordinal) (n : ) :
n.nadd a = a + n
theorem ordinal.add_le_nadd (a b : ordinal) :
a + b a.nadd b
@[protected, instance]
noncomputable def nat_ordinal.has_add  :
Equations
@[protected, instance]
Equations
@[simp]
theorem ordinal.lt_of_nadd_lt_nadd_left {a b c : ordinal} :
a.nadd b < a.nadd c b < c
theorem ordinal.lt_of_nadd_lt_nadd_right {a b c : ordinal} :
b.nadd a < c.nadd a b < c
theorem ordinal.le_of_nadd_le_nadd_left {a b c : ordinal} :
a.nadd b a.nadd c b c
theorem ordinal.le_of_nadd_le_nadd_right {a b c : ordinal} :
b.nadd a c.nadd a b c
theorem ordinal.nadd_lt_nadd_iff_left (a : ordinal) {b c : ordinal} :
a.nadd b < a.nadd c b < c
theorem ordinal.nadd_lt_nadd_iff_right (a : ordinal) {b c : ordinal} :
b.nadd a < c.nadd a b < c
theorem ordinal.nadd_le_nadd_iff_left (a : ordinal) {b c : ordinal} :
a.nadd b a.nadd c b c
theorem ordinal.nadd_le_nadd_iff_right (a : ordinal) {b c : ordinal} :
b.nadd a c.nadd a b c
theorem ordinal.nadd_le_nadd {a b c d : ordinal} :
a b c d a.nadd c b.nadd d
theorem ordinal.nadd_lt_nadd {a b c d : ordinal} :
a < b c < d a.nadd c < b.nadd d
theorem ordinal.nadd_lt_nadd_of_lt_of_le {a b c d : ordinal} :
a < b c d a.nadd c < b.nadd d
theorem ordinal.nadd_lt_nadd_of_le_of_lt {a b c d : ordinal} :
a b c < d a.nadd c < b.nadd d
theorem ordinal.nadd_left_cancel {a b c : ordinal} :
a.nadd b = a.nadd c b = c
theorem ordinal.nadd_right_cancel {a b c : ordinal} :
a.nadd b = c.nadd b a = c
theorem ordinal.nadd_left_cancel_iff {a b c : ordinal} :
a.nadd b = a.nadd c b = c
theorem ordinal.nadd_right_cancel_iff {a b c : ordinal} :
b.nadd a = c.nadd a b = c
theorem ordinal.le_nadd_self {a b : ordinal} :
a b.nadd a
theorem ordinal.le_nadd_left {a b c : ordinal} (h : a c) :
a b.nadd c
theorem ordinal.le_self_nadd {a b : ordinal} :
a a.nadd b
theorem ordinal.le_nadd_right {a b c : ordinal} (h : a b) :
a b.nadd c
theorem ordinal.nadd_left_comm (a b c : ordinal) :
a.nadd (b.nadd c) = b.nadd (a.nadd c)
theorem ordinal.nadd_right_comm (a b c : ordinal) :
(a.nadd b).nadd c = (a.nadd c).nadd b

Natural multiplication #

theorem ordinal.nmul_def (a b : ordinal) :
a.nmul b = has_Inf.Inf {c : ordinal | (a' : ordinal), a' < a (b' : ordinal), b' < b (a'.nmul b).nadd (a.nmul b') < c.nadd (a'.nmul b')}
theorem ordinal.nmul_nonempty (a b : ordinal) :
{c : ordinal | (a' : ordinal), a' < a (b' : ordinal), b' < b (a'.nmul b).nadd (a.nmul b') < c.nadd (a'.nmul b')}.nonempty

The set in the definition of nmul is nonempty.

theorem ordinal.nmul_nadd_lt {a b a' b' : ordinal} (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} (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} :
c < a.nmul b (a' : ordinal) (H : a' < a) (b' : ordinal) (H : b' < b), c.nadd (a'.nmul b') (a'.nmul b).nadd (a.nmul b')
theorem ordinal.nmul_le_iff {a b c : ordinal} :
a.nmul b c (a' : ordinal), a' < a (b' : ordinal), b' < b (a'.nmul b).nadd (a.nmul b') < c.nadd (a'.nmul b')
theorem ordinal.nmul_comm (a b : ordinal) :
a.nmul b = b.nmul a
@[simp]
theorem ordinal.nmul_zero (a : ordinal) :
a.nmul 0 = 0
@[simp]
theorem ordinal.zero_nmul (a : ordinal) :
0.nmul a = 0
@[simp]
theorem ordinal.nmul_one (a : ordinal) :
a.nmul 1 = a
@[simp]
theorem ordinal.one_nmul (a : ordinal) :
1.nmul a = a
theorem ordinal.nmul_lt_nmul_of_pos_left {a b c : ordinal} (h₁ : a < b) (h₂ : 0 < c) :
c.nmul a < c.nmul b
theorem ordinal.nmul_lt_nmul_of_pos_right {a b c : ordinal} (h₁ : a < b) (h₂ : 0 < c) :
a.nmul c < b.nmul c
theorem ordinal.nmul_le_nmul_of_nonneg_left {a b c : ordinal} (h₁ : a b) (h₂ : 0 c) :
c.nmul a c.nmul b
theorem ordinal.nmul_le_nmul_of_nonneg_right {a b c : ordinal} (h₁ : a b) (h₂ : 0 c) :
a.nmul c b.nmul c
theorem ordinal.nmul_nadd (a b c : ordinal) :
a.nmul (b.nadd c) = (a.nmul b).nadd (a.nmul c)
theorem ordinal.nadd_nmul (a b c : ordinal) :
(a.nadd b).nmul c = (a.nmul c).nadd (b.nmul c)
theorem ordinal.nmul_nadd_lt₃ {a b c a' b' c' : ordinal} (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} (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} (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} (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} :
d < (a.nmul b).nmul c (a' : ordinal) (H : a' < a) (b' : ordinal) (H : b' < b) (c' : ordinal) (H : 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} :
(a.nmul b).nmul c d (a' : ordinal), a' < a (b' : ordinal), b' < b (c' : ordinal), 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} :
d < a.nmul (b.nmul c) (a' : ordinal) (H : a' < a) (b' : ordinal) (H : b' < b) (c' : ordinal) (H : 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} :
a.nmul (b.nmul c) d (a' : ordinal), a' < a (b' : ordinal), b' < b (c' : ordinal), 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.nmul_assoc (a b c : ordinal) :
(a.nmul b).nmul c = a.nmul (b.nmul c)
@[protected, instance]
noncomputable def nat_ordinal.has_mul  :
Equations
@[protected, instance]
Equations
theorem ordinal.nmul_nadd_one (a b : ordinal) :
a.nmul (b.nadd 1) = (a.nmul b).nadd a
theorem ordinal.nadd_one_nmul (a b : ordinal) :
(a.nadd 1).nmul b = (a.nmul b).nadd b
theorem ordinal.nmul_succ (a b : ordinal) :
a.nmul (order.succ b) = (a.nmul b).nadd a
theorem ordinal.succ_nmul (a b : ordinal) :
(order.succ a).nmul b = (a.nmul b).nadd b
theorem ordinal.nmul_add_one (a b : ordinal) :
a.nmul (b + 1) = (a.nmul b).nadd a
theorem ordinal.add_one_nmul (a b : ordinal) :
(a + 1).nmul b = (a.nmul b).nadd b
theorem nat_ordinal.mul_le_nmul (a b : ordinal) :
a * b a.nmul b