Cardinal Numbers #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
We define cardinal numbers as a quotient of types under the equivalence relation of equinumerity.
Main definitions #
cardinal
the type of cardinal numbers (in a given universe).cardinal.mk α
or#α
is the cardinality ofα
. The notation#
lives in the localecardinal
.- Addition
c₁ + c₂
is defined bycardinal.add_def α β : #α + #β = #(α ⊕ β)
. - Multiplication
c₁ * c₂
is defined bycardinal.mul_def : #α * #β = #(α × β)
. - The order
c₁ ≤ c₂
is defined bycardinal.le_def α β : #α ≤ #β ↔ nonempty (α ↪ β)
. - Exponentiation
c₁ ^ c₂
is defined bycardinal.power_def α β : #α ^ #β = #(β → α)
. cardinal.is_limit c
means thatc
is a (weak) limit cardinal:c ≠ 0 ∧ ∀ x < c, succ x < c
.cardinal.aleph_0
orℵ₀
is the cardinality ofℕ
. This definition is universe polymorphic:cardinal.aleph_0.{u} : cardinal.{u}
(contrast withℕ : Type
, which lives in a specific universe). In some cases the universe level has to be given explicitly.cardinal.sum
is the sum of an indexed family of cardinals, i.e. the cardinality of the corresponding sigma type.cardinal.prod
is the product of an indexed family of cardinals, i.e. the cardinality of the corresponding pi type.cardinal.powerlt a b
ora ^< b
is defined as the supremum ofa ^ c
forc < b
.
Main instances #
- Cardinals form a
canonically_ordered_comm_semiring
with the aforementioned sum and product. - Cardinals form a
succ_order
. Useorder.succ c
for the smallest cardinal greater thanc
. - The less than relation on cardinals forms a well-order.
- Cardinals form a
conditionally_complete_linear_order_bot
. Bounded sets for cardinals in universeu
are precisely the sets indexed by some type in universeu
, seecardinal.bdd_above_iff_small
. One can useSup
for the cardinal supremum, andInf
for the minimum of a set of cardinals.
Main Statements #
- Cantor's theorem:
cardinal.cantor c : c < 2 ^ c
. - König's theorem:
cardinal.sum_lt_prod
Implementation notes #
- There is a type of cardinal numbers in every universe level:
cardinal.{u} : Type (u + 1)
is the quotient of types inType u
. The operationcardinal.lift
lifts cardinal numbers to a higher level. - Cardinal arithmetic specifically for infinite cardinals (like
κ * κ = κ
) is in the fileset_theory/cardinal_ordinal.lean
. - There is an instance
has_pow cardinal
, but this will only fire if Lean already knows that both the base and the exponent live in the same universe. As a workaround, you can addto a file. This notation will work even if Lean doesn't know yet that the base and the exponent live in the same universe (but no exponents in other types can be used).local infixr (name := cardinal.pow) ^ := @has_pow.pow cardinal cardinal cardinal.has_pow
References #
Tags #
cardinal number, cardinal arithmetic, cardinal exponentiation, aleph, Cantor's theorem, König's theorem, Konig's theorem
The equivalence relation on types given by equivalence (bijective correspondence) of types. Quotienting by this equivalence relation gives the cardinal numbers.
cardinal.{u}
is the type of cardinal numbers in Type u
,
defined as the quotient of Type u
by existence of an equivalence
(a bijection with explicit inverse).
Equations
Instances for cardinal
- cardinal.can_lift_cardinal_Type
- cardinal.has_le
- cardinal.partial_order
- cardinal.linear_order
- cardinal.has_zero
- cardinal.inhabited
- cardinal.has_one
- cardinal.nontrivial
- cardinal.has_add
- cardinal.has_nat_cast
- cardinal.has_mul
- cardinal.has_pow
- cardinal.comm_semiring
- cardinal.add_covariant_class
- cardinal.add_swap_covariant_class
- cardinal.canonically_ordered_comm_semiring
- cardinal.canonically_linear_ordered_add_monoid
- cardinal.canonically_ordered_add_monoid
- cardinal.linear_ordered_comm_monoid_with_zero
- cardinal.comm_monoid_with_zero
- cardinal.no_max_order
- cardinal.distrib_lattice
- cardinal.has_well_founded
- cardinal.wo
- cardinal.conditionally_complete_linear_order_bot
- cardinal.succ_order
- cardinal.char_zero
- cardinal.can_lift_cardinal_nat
The cardinal number of a type
Equations
Instances for cardinal.mk
Equations
- cardinal.can_lift_cardinal_Type = {prf := cardinal.can_lift_cardinal_Type._proof_1}
The representative of the cardinal of a type is equivalent ot the original type.
Equations
- cardinal.out_mk_equiv = cardinal.out_mk_equiv._proof_1.some
Alias of cardinal.mk_congr
.
The universe lift operation on cardinals. You can specify the universes explicitly with
lift.{u v} : cardinal.{v} → cardinal.{max v u}
Equations
- c.lift = cardinal.map ulift (λ (α β : Type v) (e : α ≃ β), equiv.ulift.trans (e.trans equiv.ulift.symm)) c
lift.{(max u v) u}
equals lift.{v u}
. Using set_option pp.universes true
will make it much
easier to understand what's happening when using this lemma.
lift.{(max v u) u}
equals lift.{v u}
. Using set_option pp.universes true
will make it much
easier to understand what's happening when using this lemma.
A cardinal lifted to a lower or equal universe equals itself.
A cardinal lifted to the same universe equals itself.
A cardinal lifted to the zero universe equals itself.
We define the order on cardinal numbers by #α ≤ #β
if and only if
there exists an embedding (injective function) from α to β.
Equations
- cardinal.has_le = {le := λ (q₁ q₂ : cardinal), quotient.lift_on₂ q₁ q₂ (λ (α β : Type u), nonempty (α ↪ β)) cardinal.has_le._proof_1}
Equations
- cardinal.partial_order = {le := has_le.le cardinal.has_le, lt := preorder.lt._default has_le.le, le_refl := cardinal.partial_order._proof_1, le_trans := cardinal.partial_order._proof_2, lt_iff_le_not_le := cardinal.partial_order._proof_3, le_antisymm := cardinal.partial_order._proof_4}
Equations
- cardinal.linear_order = {le := partial_order.le cardinal.partial_order, lt := partial_order.lt cardinal.partial_order, le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _, le_total := cardinal.linear_order._proof_1, decidable_le := classical.dec_rel has_le.le, decidable_eq := decidable_eq_of_decidable_le (classical.dec_rel has_le.le), decidable_lt := decidable_lt_of_decidable_le (classical.dec_rel has_le.le), max := max_default (λ (a b : cardinal), classical.dec_rel has_le.le a b), max_def := cardinal.linear_order._proof_2, min := min_default (λ (a b : cardinal), classical.dec_rel has_le.le a b), min_def := cardinal.linear_order._proof_3}
A variant of cardinal.lift_mk_le
with specialized universes.
Because Lean often can not realize it should use this specialization itself,
we provide this statement separately so you don't have to solve the specialization problem either.
A variant of cardinal.lift_mk_eq
with specialized universes.
Because Lean often can not realize it should use this specialization itself,
we provide this statement separately so you don't have to solve the specialization problem either.
cardinal.lift
as an order_embedding
.
Equations
- cardinal.lift_order_embedding = order_embedding.of_map_le_iff cardinal.lift cardinal.lift_order_embedding._proof_1
Equations
Equations
- cardinal.inhabited = {default := 0}
Equations
Alias of the reverse direction of cardinal.mk_le_one_iff_set_subsingleton
.
Equations
- cardinal.has_add = {add := cardinal.map₂ sum (λ (α β γ δ : Type u), equiv.sum_congr)}
Equations
Equations
- cardinal.has_mul = {mul := cardinal.map₂ prod (λ (α β γ δ : Type u), equiv.prod_congr)}
The cardinal exponential. #α ^ #β
is the cardinal of β → α
.
Equations
- cardinal.has_pow = {pow := cardinal.map₂ (λ (α β : Type u), β → α) (λ (α β γ δ : Type u) (e₁ : α ≃ β) (e₂ : γ ≃ δ), e₂.arrow_congr e₁)}
Equations
- cardinal.comm_semiring = {add := has_add.add cardinal.has_add, add_assoc := cardinal.comm_semiring._proof_1, zero := 0, zero_add := cardinal.comm_semiring._proof_2, add_zero := cardinal.comm_semiring._proof_3, nsmul := semiring.nsmul._default 0 has_add.add cardinal.comm_semiring._proof_4 cardinal.comm_semiring._proof_5, nsmul_zero' := cardinal.comm_semiring._proof_6, nsmul_succ' := cardinal.comm_semiring._proof_7, add_comm := cardinal.comm_semiring._proof_8, mul := has_mul.mul cardinal.has_mul, left_distrib := cardinal.comm_semiring._proof_9, right_distrib := cardinal.comm_semiring._proof_10, zero_mul := cardinal.comm_semiring._proof_11, mul_zero := cardinal.comm_semiring._proof_12, mul_assoc := cardinal.comm_semiring._proof_13, one := 1, one_mul := cardinal.comm_semiring._proof_14, mul_one := cardinal.comm_semiring._proof_15, nat_cast := semiring.nat_cast._default 1 has_add.add cardinal.comm_semiring._proof_16 0 cardinal.comm_semiring._proof_17 cardinal.comm_semiring._proof_18 (semiring.nsmul._default 0 has_add.add cardinal.comm_semiring._proof_4 cardinal.comm_semiring._proof_5) cardinal.comm_semiring._proof_19 cardinal.comm_semiring._proof_20, nat_cast_zero := cardinal.comm_semiring._proof_21, nat_cast_succ := cardinal.comm_semiring._proof_22, npow := λ (n : ℕ) (c : cardinal), c ^ ↑n, npow_zero' := cardinal.power_zero, npow_succ' := cardinal.comm_semiring._proof_23, mul_comm := mul_comm'}
A variant of cardinal.mk_set
expressed in terms of a set
instead of a Type
.
Equations
- cardinal.canonically_ordered_comm_semiring = {add := comm_semiring.add cardinal.comm_semiring, add_assoc := _, zero := comm_semiring.zero cardinal.comm_semiring, zero_add := _, add_zero := _, nsmul := comm_semiring.nsmul cardinal.comm_semiring, nsmul_zero' := _, nsmul_succ' := _, add_comm := _, le := partial_order.le cardinal.partial_order, lt := partial_order.lt cardinal.partial_order, le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _, add_le_add_left := cardinal.canonically_ordered_comm_semiring._proof_1, bot := 0, bot_le := cardinal.zero_le, exists_add_of_le := cardinal.canonically_ordered_comm_semiring._proof_2, le_self_add := cardinal.canonically_ordered_comm_semiring._proof_3, mul := comm_semiring.mul cardinal.comm_semiring, left_distrib := _, right_distrib := _, zero_mul := _, mul_zero := _, mul_assoc := _, one := comm_semiring.one cardinal.comm_semiring, one_mul := _, mul_one := _, nat_cast := comm_semiring.nat_cast cardinal.comm_semiring, nat_cast_zero := _, nat_cast_succ := _, npow := comm_semiring.npow cardinal.comm_semiring, npow_zero' := _, npow_succ' := _, mul_comm := _, eq_zero_or_eq_zero_of_mul_eq_zero := cardinal.canonically_ordered_comm_semiring._proof_4}
Equations
- cardinal.canonically_linear_ordered_add_monoid = {add := canonically_ordered_comm_semiring.add cardinal.canonically_ordered_comm_semiring, add_assoc := _, zero := canonically_ordered_comm_semiring.zero cardinal.canonically_ordered_comm_semiring, zero_add := _, add_zero := _, nsmul := canonically_ordered_comm_semiring.nsmul cardinal.canonically_ordered_comm_semiring, nsmul_zero' := _, nsmul_succ' := _, add_comm := _, le := canonically_ordered_comm_semiring.le cardinal.canonically_ordered_comm_semiring, lt := canonically_ordered_comm_semiring.lt cardinal.canonically_ordered_comm_semiring, le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _, add_le_add_left := _, bot := canonically_ordered_comm_semiring.bot cardinal.canonically_ordered_comm_semiring, bot_le := _, exists_add_of_le := _, le_self_add := _, le_total := _, decidable_le := linear_order.decidable_le cardinal.linear_order, decidable_eq := linear_order.decidable_eq cardinal.linear_order, decidable_lt := linear_order.decidable_lt cardinal.linear_order, max := linear_order.max cardinal.linear_order, max_def := _, min := linear_order.min cardinal.linear_order, min_def := _}
Equations
- cardinal.canonically_ordered_add_monoid = {add := canonically_ordered_comm_semiring.add cardinal.canonically_ordered_comm_semiring, add_assoc := _, zero := canonically_ordered_comm_semiring.zero cardinal.canonically_ordered_comm_semiring, zero_add := _, add_zero := _, nsmul := canonically_ordered_comm_semiring.nsmul cardinal.canonically_ordered_comm_semiring, nsmul_zero' := _, nsmul_succ' := _, add_comm := _, le := canonically_ordered_comm_semiring.le cardinal.canonically_ordered_comm_semiring, lt := canonically_ordered_comm_semiring.lt cardinal.canonically_ordered_comm_semiring, le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _, add_le_add_left := _, bot := canonically_ordered_comm_semiring.bot cardinal.canonically_ordered_comm_semiring, bot_le := _, exists_add_of_le := _, le_self_add := _}
Equations
- cardinal.linear_ordered_comm_monoid_with_zero = {le := linear_order.le cardinal.linear_order, lt := linear_order.lt cardinal.linear_order, le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _, le_total := _, decidable_le := linear_order.decidable_le cardinal.linear_order, decidable_eq := linear_order.decidable_eq cardinal.linear_order, decidable_lt := linear_order.decidable_lt cardinal.linear_order, max := linear_order.max cardinal.linear_order, max_def := _, min := linear_order.min cardinal.linear_order, min_def := _, mul := comm_semiring.mul cardinal.comm_semiring, mul_assoc := _, one := comm_semiring.one cardinal.comm_semiring, one_mul := _, mul_one := _, npow := comm_semiring.npow cardinal.comm_semiring, npow_zero' := _, npow_succ' := _, mul_comm := _, mul_le_mul_left := cardinal.linear_ordered_comm_monoid_with_zero._proof_1, zero := comm_semiring.zero cardinal.comm_semiring, zero_mul := _, mul_zero := _, zero_le_one := cardinal.linear_ordered_comm_monoid_with_zero._proof_2}
Equations
- cardinal.comm_monoid_with_zero = {mul := canonically_ordered_comm_semiring.mul cardinal.canonically_ordered_comm_semiring, mul_assoc := _, one := canonically_ordered_comm_semiring.one cardinal.canonically_ordered_comm_semiring, one_mul := _, mul_one := _, npow := canonically_ordered_comm_semiring.npow cardinal.canonically_ordered_comm_semiring, npow_zero' := _, npow_succ' := _, mul_comm := _, zero := canonically_ordered_comm_semiring.zero cardinal.canonically_ordered_comm_semiring, zero_mul := _, mul_zero := _}
Equations
Note that the successor of c
is not the same as c + 1
except in the case of finite c
.
Equations
- cardinal.succ_order = succ_order.of_succ_le_iff (λ (c : cardinal), has_Inf.Inf {c' : cardinal | c < c'}) cardinal.succ_order._proof_1
A cardinal is a limit if it is not zero or a successor cardinal. Note that ℵ₀
is a limit
cardinal by this definition, but 0
isn't.
Use is_succ_limit
if you want to include the c = 0
case.
Equations
- c.is_limit = (c ≠ 0 ∧ order.is_succ_limit c)
The indexed sum of cardinals is the cardinality of the indexed disjoint union, i.e. sigma type.
Equations
- cardinal.sum f = cardinal.mk (Σ (i : ι), quotient.out (f i))
A variant of csupr_of_empty
but with 0
on the RHS for convenience
The indexed product of cardinals is the cardinality of the Pi type (dependent product).
Equations
- cardinal.prod f = cardinal.mk (Π (i : ι), quotient.out (f i))
The lift of a supremum is the supremum of the lifts.
To prove an inequality between the lifts to a common universe of two different supremums, it suffices to show that the lift of each cardinal from the smaller supremum if bounded by the lift of some cardinal from the larger supremum.
A variant of lift_supr_le_lift_supr
with universes specialized via w = v
and w' = v'
.
This is sometimes necessary to avoid universe unification issues.
ℵ₀
is the smallest infinite cardinal.
Equations
Properties about the cast from ℕ
#
Alias of the reverse direction of cardinal.lt_aleph_0_iff_set_finite
.
Alias of the reverse direction of cardinal.le_aleph_0_iff_set_countable
.
Equations
- cardinal.can_lift_cardinal_nat = {prf := cardinal.can_lift_cardinal_nat._proof_1}
See also cardinal.nsmul_lt_aleph_0_iff_of_ne_zero
if you already have n ≠ 0
.
See also cardinal.nsmul_lt_aleph_0_iff
for a hypothesis-free version.
See also cardinal.aleph_0_le_mul_iff
.
See also cardinal.aleph_0_le_mul_iff'
.
This function sends finite cardinals to the corresponding natural, and infinite cardinals to 0.
Equations
- cardinal.to_nat = {to_fun := λ (c : cardinal), dite (c < cardinal.aleph_0) (λ (h : c < cardinal.aleph_0), classical.some _) (λ (h : ¬c < cardinal.aleph_0), 0), map_zero' := cardinal.to_nat._proof_2}
to_nat
has a right-inverse: coercion.
cardinal.to_nat
as a monoid_with_zero_hom
.
Equations
This function sends finite cardinals to the corresponding natural, and infinite cardinals
to ⊤
.
Equations
- cardinal.to_part_enat = {to_fun := λ (c : cardinal), ite (c < cardinal.aleph_0) ↑(⇑cardinal.to_nat c) ⊤, map_zero' := cardinal.to_part_enat._proof_1, map_add' := cardinal.to_part_enat._proof_2}
The cardinality of a union is at most the sum of the cardinalities of the two sets.