# mathlib3documentation

set_theory.cardinal.ordinal

# Cardinals and ordinals #

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

Relationships between cardinals and ordinals, properties of cardinals that are proved using ordinals.

## Main definitions #

• The function cardinal.aleph' gives the cardinals listed by their ordinal index, and is the inverse of cardinal.aleph_idx. aleph' n = n, aleph' ω = ℵ₀, aleph' (ω + 1) = succ ℵ₀, etc. It is an order isomorphism between ordinals and cardinals.
• The function cardinal.aleph gives the infinite cardinals listed by their ordinal index. aleph 0 = ℵ₀, aleph 1 = succ ℵ₀ is the first uncountable cardinal, and so on.
• The function cardinal.beth enumerates the Beth cardinals. beth 0 = ℵ₀, beth (succ o) = 2 ^ beth o, and for a limit ordinal o, beth o is the supremum of beth a for a < o.

## Main Statements #

• cardinal.mul_eq_max and cardinal.add_eq_max state that the product (resp. sum) of two infinite cardinals is just their maximum. Several variations around this fact are also given.
• cardinal.mk_list_eq_mk : when α is infinite, α and list α have the same cardinality.
• simp lemmas for inequalities between bit0 a and bit1 b are registered, making simp able to prove inequalities about numeral cardinals.

## Tags #

cardinal arithmetic (for infinite cardinals)

### Aleph cardinals #

noncomputable def cardinal.aleph_idx.initial_seg  :

The aleph' index function, which gives the ordinal index of a cardinal. (The aleph' part is because unlike aleph this counts also the finite stages. So aleph_idx n = n, aleph_idx ω = ω, aleph_idx ℵ₁ = ω + 1 and so on.) In this definition, we register additionally that this function is an initial segment, i.e., it is order preserving and its range is an initial segment of the ordinals. For the basic function version, see aleph_idx. For an upgraded version stating that the range is everything, see aleph_idx.rel_iso.

Equations
noncomputable def cardinal.aleph_idx  :

The aleph' index function, which gives the ordinal index of a cardinal. (The aleph' part is because unlike aleph this counts also the finite stages. So aleph_idx n = n, aleph_idx ω = ω, aleph_idx ℵ₁ = ω + 1 and so on.) For an upgraded version stating that the range is everything, see aleph_idx.rel_iso.

Equations
@[simp]
theorem cardinal.aleph_idx_lt {a b : cardinal} :
a < b
@[simp]
theorem cardinal.aleph_idx_le {a b : cardinal} :
a b
noncomputable def cardinal.aleph_idx.rel_iso  :

The aleph' index function, which gives the ordinal index of a cardinal. (The aleph' part is because unlike aleph this counts also the finite stages. So aleph_idx n = n, aleph_idx ℵ₀ = ω, aleph_idx ℵ₁ = ω + 1 and so on.) In this version, we register additionally that this function is an order isomorphism between cardinals and ordinals. For the basic function version, see aleph_idx.

Equations
@[simp]
@[simp]
@[simp]
noncomputable def cardinal.aleph'.rel_iso  :

The aleph' function gives the cardinals listed by their ordinal index, and is the inverse of aleph_idx. aleph' n = n, aleph' ω = ω, aleph' (ω + 1) = succ ℵ₀, etc. In this version, we register additionally that this function is an order isomorphism between ordinals and cardinals. For the basic function version, see aleph'.

Equations
noncomputable def cardinal.aleph'  :

The aleph' function gives the cardinals listed by their ordinal index, and is the inverse of aleph_idx. aleph' n = n, aleph' ω = ω, aleph' (ω + 1) = succ ℵ₀, etc.

Equations
@[simp]
@[simp]
theorem cardinal.aleph'_lt {o₁ o₂ : ordinal} :
o₁ < o₂
@[simp]
theorem cardinal.aleph'_le {o₁ o₂ : ordinal} :
o₁ o₂
@[simp]
@[simp]
@[simp]
theorem cardinal.aleph'_zero  :
@[simp]
theorem cardinal.aleph'_succ {o : ordinal} :
@[simp]
theorem cardinal.aleph'_nat (n : ) :
theorem cardinal.aleph'_le_of_limit {o : ordinal} (l : o.is_limit) {c : cardinal} :
(o' : ordinal), o' < o c
theorem cardinal.aleph'_limit {o : ordinal} (ho : o.is_limit) :
= (a : (set.Iio o)),
@[simp]
@[simp]
noncomputable def cardinal.aleph'_equiv  :

aleph' and aleph_idx form an equivalence between ordinal and cardinal

Equations
noncomputable def cardinal.aleph (o : ordinal) :

The aleph function gives the infinite cardinals listed by their ordinal index. aleph 0 = ℵ₀, aleph 1 = succ ℵ₀ is the first uncountable cardinal, and so on.

Equations
@[simp]
theorem cardinal.aleph_lt {o₁ o₂ : ordinal} :
o₁ < o₂
@[simp]
theorem cardinal.aleph_le {o₁ o₂ : ordinal} :
o₁ o₂
@[simp]
theorem cardinal.max_aleph_eq (o₁ o₂ : ordinal) :
@[simp]
theorem cardinal.aleph_succ {o : ordinal} :
@[simp]
theorem cardinal.aleph_limit {o : ordinal} (ho : o.is_limit) :
= (a : (set.Iio o)),
theorem cardinal.aleph'_pos {o : ordinal} (ho : 0 < o) :
theorem cardinal.aleph_pos (o : ordinal) :
@[simp]
theorem cardinal.aleph_to_nat (o : ordinal) :
@[simp]
@[protected, instance]
@[protected, instance]
theorem cardinal.countable_iff_lt_aleph_one {α : Type u_1} (s : set α) :
theorem cardinal.ord_card_unbounded  :
{b : ordinal | b.card.ord = b}

Ordinals that are cardinals are unbounded.

theorem cardinal.eq_aleph'_of_eq_card_ord {o : ordinal} (ho : o.card.ord = o) :
(a : ordinal), .ord = o

ord ∘ aleph' enumerates the ordinals that are cardinals.

Infinite ordinals that are cardinals are unbounded.

theorem cardinal.eq_aleph_of_eq_card_ord {o : ordinal} (ho : o.card.ord = o) (ho' : ordinal.omega o) :
(a : ordinal), .ord = o

ord ∘ aleph enumerates the infinite ordinals that are cardinals.

### Beth cardinals #

noncomputable def cardinal.beth (o : ordinal) :

Beth numbers are defined so that beth 0 = ℵ₀, beth (succ o) = 2 ^ (beth o), and when o is a limit ordinal, beth o is the supremum of beth o' for o' < o.

Assuming the generalized continuum hypothesis, which is undecidable in ZFC, beth o = aleph o for every o.

Equations
@[simp]
theorem cardinal.beth_zero  :
@[simp]
theorem cardinal.beth_succ (o : ordinal) :
=
@[simp]
theorem cardinal.beth_lt {o₁ o₂ : ordinal} :
o₁ < o₂
@[simp]
theorem cardinal.beth_le {o₁ o₂ : ordinal} :
o₁ o₂
theorem cardinal.beth_pos (o : ordinal) :

### Properties of mul#

theorem cardinal.mul_eq_self {c : cardinal} (h : cardinal.aleph_0 c) :
c * c = c

If α is an infinite type, then α × α and α have the same cardinality.

theorem cardinal.mul_eq_max {a b : cardinal} (ha : cardinal.aleph_0 a) (hb : cardinal.aleph_0 b) :
a * b =

If α and β are infinite types, then the cardinality of α × β is the maximum of the cardinalities of α and β.

@[simp]
theorem cardinal.mul_mk_eq_max {α β : Type u_1} [infinite α] [infinite β] :
=
@[simp]
theorem cardinal.aleph_mul_aleph (o₁ o₂ : ordinal) :
@[simp]
@[simp]
@[simp]
theorem cardinal.aleph_0_mul_mk_eq {α : Type u_1} [infinite α] :
@[simp]
theorem cardinal.mk_mul_aleph_0_eq {α : Type u_1} [infinite α] :
@[simp]
@[simp]
theorem cardinal.mul_lt_of_lt {a b c : cardinal} (hc : cardinal.aleph_0 c) (h1 : a < c) (h2 : b < c) :
a * b < c
theorem cardinal.mul_eq_max_of_aleph_0_le_left {a b : cardinal} (h : cardinal.aleph_0 a) (h' : b 0) :
a * b =
theorem cardinal.mul_eq_max' {a b : cardinal} (h : cardinal.aleph_0 a * b) :
a * b =
theorem cardinal.mul_le_max (a b : cardinal) :
theorem cardinal.mul_eq_left {a b : cardinal} (ha : cardinal.aleph_0 a) (hb : b a) (hb' : b 0) :
a * b = a
theorem cardinal.mul_eq_right {a b : cardinal} (hb : cardinal.aleph_0 b) (ha : a b) (ha' : a 0) :
a * b = b
theorem cardinal.le_mul_left {a b : cardinal} (h : b 0) :
a b * a
theorem cardinal.le_mul_right {a b : cardinal} (h : b 0) :
a a * b
theorem cardinal.mul_eq_left_iff {a b : cardinal} :
a * b = a b 0 b = 1 a = 0

### Properties of add#

theorem cardinal.add_eq_self {c : cardinal} (h : cardinal.aleph_0 c) :
c + c = c

If α is an infinite type, then α ⊕ α and α have the same cardinality.

theorem cardinal.add_eq_max {a b : cardinal} (ha : cardinal.aleph_0 a) :
a + b =

If α is an infinite type, then the cardinality of α ⊕ β is the maximum of the cardinalities of α and β.

theorem cardinal.add_eq_max' {a b : cardinal} (ha : cardinal.aleph_0 b) :
a + b =
@[simp]
theorem cardinal.add_mk_eq_max {α β : Type u_1} [infinite α] :
=
@[simp]
theorem cardinal.add_mk_eq_max' {α β : Type u_1} [infinite β] :
=
theorem cardinal.add_le_max (a b : cardinal) :
theorem cardinal.add_le_of_le {a b c : cardinal} (hc : cardinal.aleph_0 c) (h1 : a c) (h2 : b c) :
a + b c
theorem cardinal.add_lt_of_lt {a b c : cardinal} (hc : cardinal.aleph_0 c) (h1 : a < c) (h2 : b < c) :
a + b < c
theorem cardinal.eq_of_add_eq_of_aleph_0_le {a b c : cardinal} (h : a + b = c) (ha : a < c) (hc : cardinal.aleph_0 c) :
b = c
theorem cardinal.add_eq_left {a b : cardinal} (ha : cardinal.aleph_0 a) (hb : b a) :
a + b = a
theorem cardinal.add_eq_right {a b : cardinal} (hb : cardinal.aleph_0 b) (ha : a b) :
a + b = b
theorem cardinal.add_eq_left_iff {a b : cardinal} :
a + b = a b = 0
theorem cardinal.add_eq_right_iff {a b : cardinal} :
a + b = b a = 0
theorem cardinal.add_nat_eq {a : cardinal} (n : ) (ha : cardinal.aleph_0 a) :
a + n = a
theorem cardinal.add_one_eq {a : cardinal} (ha : cardinal.aleph_0 a) :
a + 1 = a
@[simp]
theorem cardinal.mk_add_one_eq {α : Type u_1} [infinite α] :
+ 1 =
@[protected]
theorem cardinal.eq_of_add_eq_add_left {a b c : cardinal} (h : a + b = a + c) (ha : a < cardinal.aleph_0) :
b = c
@[protected]
theorem cardinal.eq_of_add_eq_add_right {a b c : cardinal} (h : a + b = c + b) (hb : b < cardinal.aleph_0) :
a = c
@[simp]
theorem cardinal.aleph_add_aleph (o₁ o₂ : ordinal) :
theorem cardinal.add_right_inj_of_lt_aleph_0 {α β γ : cardinal} (γ₀ : γ < cardinal.aleph_0) :
α + γ = β + γ α = β
@[simp]
theorem cardinal.add_nat_inj {α β : cardinal} (n : ) :
α + n = β + n α = β
@[simp]
theorem cardinal.add_one_inj {α β : cardinal} :
α + 1 = β + 1 α = β
theorem cardinal.add_le_add_iff_of_lt_aleph_0 {α β γ : cardinal} (γ₀ : γ < cardinal.aleph_0) :
α + γ β + γ α β
@[simp]
α + n β + n α β
@[simp]
α + 1 β + 1 α β

theorem cardinal.pow_le {κ μ : cardinal} (H1 : cardinal.aleph_0 κ) (H2 : μ < cardinal.aleph_0) :
κ ^ μ κ
theorem cardinal.pow_eq {κ μ : cardinal} (H1 : cardinal.aleph_0 κ) (H2 : 1 μ) (H3 : μ < cardinal.aleph_0) :
κ ^ μ = κ
theorem cardinal.power_self_eq {c : cardinal} (h : cardinal.aleph_0 c) :
c ^ c = 2 ^ c
theorem cardinal.prod_eq_two_power {ι : Type u} [infinite ι] {c : ι cardinal} (h₁ : (i : ι), 2 c i) (h₂ : (i : ι), (c i).lift (cardinal.mk ι).lift) :
theorem cardinal.power_eq_two_power {c₁ c₂ : cardinal} (h₁ : cardinal.aleph_0 c₁) (h₂ : 2 c₂) (h₂' : c₂ c₁) :
c₂ ^ c₁ = 2 ^ c₁
theorem cardinal.nat_power_eq {c : cardinal} (h : cardinal.aleph_0 c) {n : } (hn : 2 n) :
n ^ c = 2 ^ c
theorem cardinal.power_nat_le {c : cardinal} {n : } (h : cardinal.aleph_0 c) :
c ^ n c
theorem cardinal.power_nat_eq {c : cardinal} {n : } (h1 : cardinal.aleph_0 c) (h2 : 1 n) :
c ^ n = c
theorem cardinal.power_nat_le_max {c : cardinal} {n : } :

### Computing cardinality of various types #

@[simp]
theorem cardinal.mk_list_eq_mk (α : Type u) [infinite α] :
theorem cardinal.mk_list_eq_aleph_0 (α : Type u) [countable α] [nonempty α] :
theorem cardinal.mk_list_le_max (α : Type u) :
@[simp]
theorem cardinal.mk_finset_of_infinite (α : Type u) [infinite α] :
@[simp]
theorem cardinal.mk_finsupp_lift_of_infinite (α : Type u) (β : Type v) [infinite α] [has_zero β] [nontrivial β] :
@[simp]
theorem cardinal.mk_finsupp_lift_of_infinite' (α : Type u) (β : Type v) [nonempty α] [has_zero β] [infinite β] :
theorem cardinal.mk_finsupp_of_infinite' (α β : Type u) [nonempty α] [has_zero β] [infinite β] :
theorem cardinal.mk_finsupp_nat (α : Type u) [nonempty α] :
@[simp]
@[simp]
theorem cardinal.mk_multiset_of_is_empty (α : Type u) [is_empty α] :
= 1
theorem cardinal.mk_bounded_set_le (α : Type u) (c : cardinal) :
cardinal.mk {t // c}
theorem cardinal.mk_bounded_subset_le {α : Type u} (s : set α) (c : cardinal) :
cardinal.mk {t // t s c}

### Properties of compl#

theorem cardinal.mk_compl_of_infinite {α : Type u_1} [infinite α] (s : set α) (h2 : < ) :
theorem cardinal.mk_compl_finset_of_infinite {α : Type u_1} [infinite α] (s : finset α) :
theorem cardinal.mk_compl_eq_mk_compl_infinite {α : Type u_1} [infinite α] {s t : set α} (hs : < ) (ht : < ) :
theorem cardinal.mk_compl_eq_mk_compl_finite_lift {α : Type u} {β : Type v} [finite α] {s : set α} {t : set β} (h1 : (cardinal.mk α).lift = (cardinal.mk β).lift) (h2 : (cardinal.mk s).lift = (cardinal.mk t).lift) :
theorem cardinal.mk_compl_eq_mk_compl_finite {α β : Type u} [finite α] {s : set α} {t : set β} (h1 : = ) (h : = ) :
theorem cardinal.mk_compl_eq_mk_compl_finite_same {α : Type u_1} [finite α] {s t : set α} (h : = ) :

### Extending an injection to an equiv #

theorem cardinal.extend_function {α : Type u_1} {β : Type u_2} {s : set α} (f : s β) (h : nonempty (s (set.range f))) :
(g : α β), (x : s), g x = f x
theorem cardinal.extend_function_finite {α : Type u_1} {β : Type u_2} [finite α] {s : set α} (f : s β) (h : nonempty β)) :
(g : α β), (x : s), g x = f x
theorem cardinal.extend_function_of_lt {α : Type u_1} {β : Type u_2} {s : set α} (f : s β) (hs : < ) (h : nonempty β)) :
(g : α β), (x : s), g x = f x

This section proves inequalities for bit0 and bit1, enabling simp to solve inequalities for numeral cardinals. The complexity of the resulting algorithm is not good, as in some cases simp reduces an inequality to a disjunction of two situations, depending on whether a cardinal is finite or infinite. Since the evaluation of the branches is not lazy, this is bad. It is good enough for practical situations, though.

For specific numbers, these inequalities could also be deduced from the corresponding inequalities of natural numbers using norm_cast:

example : (37 : cardinal) < 42 :=
by { norm_cast, norm_num }

theorem cardinal.bit0_ne_zero (a : cardinal) :
¬bit0 a = 0 ¬a = 0
@[simp]
theorem cardinal.bit1_ne_zero (a : cardinal) :
¬bit1 a = 0
@[simp]
theorem cardinal.zero_lt_bit0 (a : cardinal) :
0 < bit0 a 0 < a
@[simp]
theorem cardinal.zero_lt_bit1 (a : cardinal) :
0 < bit1 a
@[simp]
theorem cardinal.one_le_bit0 (a : cardinal) :
1 bit0 a 0 < a
@[simp]
theorem cardinal.one_le_bit1 (a : cardinal) :
1 bit1 a
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
theorem cardinal.bit0_le_bit0 {a b : cardinal} :
bit0 a bit0 b a b
@[simp]
theorem cardinal.bit0_le_bit1 {a b : cardinal} :
bit0 a bit1 b a b
@[simp]
theorem cardinal.bit1_le_bit1 {a b : cardinal} :
bit1 a bit1 b a b
@[simp]
theorem cardinal.bit1_le_bit0 {a b : cardinal} :
bit1 a bit0 b a < b a b
@[simp]
theorem cardinal.bit0_lt_bit0 {a b : cardinal} :
bit0 a < bit0 b a < b
@[simp]
theorem cardinal.bit1_lt_bit0 {a b : cardinal} :
bit1 a < bit0 b a < b
@[simp]
theorem cardinal.bit1_lt_bit1 {a b : cardinal} :
bit1 a < bit1 b a < b
@[simp]
theorem cardinal.bit0_lt_bit1 {a b : cardinal} :
bit0 a < bit1 b a < b a b
theorem cardinal.one_lt_two  :
1 < 2
@[simp]
theorem cardinal.one_lt_bit0 {a : cardinal} :
1 < bit0 a 0 < a
@[simp]
theorem cardinal.one_lt_bit1 (a : cardinal) :
1 < bit1 a 0 < a