Skip to content

Commit 8a4bcbd

Browse files
vihdzpBergschaf
authored andcommitted
feat: cofinal subset of regular cardinal is isomorphic to it (leanprover-community#38362)
In set theory, one often identifies a cardinal `c` with its initial ordinal `c.ord`, and said ordinal with the lower set `Iio c.ord`. This is particularly pervasive in the theory of club and stationary subsets, where one often sees the hypothesis "let κ be a regular cardinal" in lieu of the more precise wording: that `κ` is an (infinite) well-order, whose order type equals the initial ordinal of its cardinality. We define a typeclass `IsRegularCardinalOrder` for this assumption. The benefit of using it is that our results won't apply only to `Iio c.ord` for regular `c`, but also to concrete types such as `Nat`, `Cardinal`, or `Ordinal`. As a proof of concept, we define `Order.enum`, a generalization of both `Nat.nth` and `Ordinal.enumOrd`. A future PR will deprecate the latter.
1 parent 6758963 commit 8a4bcbd

5 files changed

Lines changed: 127 additions & 11 deletions

File tree

Mathlib.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7008,6 +7008,7 @@ public import Mathlib.SetTheory.Cardinal.Arithmetic
70087008
public import Mathlib.SetTheory.Cardinal.Basic
70097009
public import Mathlib.SetTheory.Cardinal.Cofinality.Basic
70107010
public import Mathlib.SetTheory.Cardinal.Cofinality.Club
7011+
public import Mathlib.SetTheory.Cardinal.Cofinality.Enum
70117012
public import Mathlib.SetTheory.Cardinal.Cofinality.Ordinal
70127013
public import Mathlib.SetTheory.Cardinal.Continuum
70137014
public import Mathlib.SetTheory.Cardinal.CountableCover

Mathlib/Order/BoundedOrder/Basic.lean

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,14 @@ end Pi
317317

318318
section Subsingleton
319319

320+
/-- A type with a single element is a bounded order. -/
321+
@[implicit_reducible]
322+
def BoundedOrder.ofUnique (α : Type*) [Preorder α] [Unique α] : BoundedOrder α where
323+
bot := default
324+
top := default
325+
le_top := by simp
326+
bot_le := by simp
327+
320328
variable [PartialOrder α] [BoundedOrder α]
321329

322330
@[to_dual]

Mathlib/SetTheory/Cardinal/Aleph.lean

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Authors: Johannes Hölzl, Mario Carneiro, Floris van Doorn, Violeta Hernández P
66
module
77

88
public import Mathlib.Algebra.Order.Monoid.Basic
9+
public import Mathlib.SetTheory.Cardinal.Cofinality.Enum
910
public import Mathlib.SetTheory.Cardinal.ToNat
1011
public import Mathlib.SetTheory.Cardinal.ENat
1112
public import Mathlib.SetTheory.Ordinal.Enum
@@ -310,6 +311,11 @@ theorem _root_.Ordinal.type_lt_cardinal : typeLT Cardinal = Ordinal.univ.{u, u +
310311
theorem mk_cardinal : #Cardinal = univ.{u, u + 1} := by
311312
simpa only [card_type, card_univ] using congr_arg card type_lt_cardinal
312313

314+
theorem _root_.Order.cof_cardinal : Order.cof Cardinal.{u} = Cardinal.univ.{u, u + 1} := by
315+
simpa using preAleph.cof_congr.symm
316+
317+
instance : IsRegularCardinalOrder Cardinal := ⟨by simp [Order.cof_cardinal]⟩
318+
313319
theorem preAleph_lt_preAleph {o₁ o₂ : Ordinal} : preAleph o₁ < preAleph o₂ ↔ o₁ < o₂ :=
314320
preAleph.lt_iff_lt
315321

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
/-
2+
Copyright (c) 2026 Violeta Hernández Palacios. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Violeta Hernández Palacios
5+
-/
6+
module
7+
8+
public import Mathlib.SetTheory.Cardinal.Cofinality.Basic
9+
public import Mathlib.SetTheory.Ordinal.Family
10+
public import Mathlib.SetTheory.Ordinal.Univ
11+
12+
/-!
13+
# Enumerating a cofinal set
14+
15+
We define a typeclass `IsRegularCardinalOrder` for well-ordered types, whose order type equals (the
16+
initial ordinal of) their cofinality. This notion does not appear in the literature, but intends to
17+
generalize the properties of intervals `Iio c.ord`, wherever `c` is a regular cardinal. Other
18+
instances of this typeclass include `ℕ`, `Ordinal`, and `Cardinal`.
19+
20+
If `s` is a cofinal subset of a regular cardinal order `α`, there exists a unique order isomorphism
21+
`α ≃o s`, which we call `Order.enum`. When `α = Ordinal`, this is referred to as the enumerator
22+
function of the set. Note that if `α = ℕ`, then this definition matches `Nat.nth`.
23+
24+
## TODO
25+
26+
- Deprecate `Ordinal.enumOrd` in favor of `Order.enum`.
27+
- Prove that `Order.enum` on the naturals coincides with `Nat.nth`.
28+
-/
29+
30+
public section
31+
32+
universe u
33+
34+
open Cardinal Order Ordinal Set
35+
36+
variable {α : Type*}
37+
38+
/-- A typeclass which expresses that the order type of a well-order equals (the initial ordinal of)
39+
its cofinality.
40+
41+
If `α` is infinite, this implies that `α` is order isomorphic to `Iio c.ord` for some regular
42+
cardinal `c`. In the informal literature, one often says that `α` is a regular cardinal, by abuse
43+
of notation. -/
44+
class IsRegularCardinalOrder (α : Type*) [LinearOrder α] [WellFoundedLT α] where
45+
type_lt_le_ord_cof : typeLT α ≤ (cof α).ord
46+
47+
instance : IsRegularCardinalOrder ℕ := ⟨by simp⟩
48+
49+
instance (priority := low) [LinearOrder α] [WellFoundedLT α] [Subsingleton α] :
50+
IsRegularCardinalOrder α where
51+
type_lt_le_ord_cof := by
52+
cases isEmpty_or_nonempty α
53+
· simpa
54+
· cases nonempty_unique α
55+
have := BoundedOrder.ofUnique α
56+
simp
57+
58+
instance : IsRegularCardinalOrder Ordinal where
59+
type_lt_le_ord_cof := by
60+
rw [type_lt_ordinal, ← ord_univ, ord_le_ord, le_cof_iff]
61+
intro s hs
62+
contrapose! hs
63+
rw [← Cardinal.lift_id (#s), ← small_iff_lift_mk_lt_univ] at hs
64+
rw [not_isCofinal_iff_bddAbove]
65+
exact Ordinal.bddAbove_of_small
66+
67+
namespace Order
68+
variable [LinearOrder α] [WellFoundedLT α] [IsRegularCardinalOrder α]
69+
70+
theorem ord_cof_eq_type_lt : (cof α).ord = typeLT α := by
71+
apply IsRegularCardinalOrder.type_lt_le_ord_cof.antisymm'
72+
rw [ord_le, card_type]
73+
exact cof_le_cardinalMk α
74+
75+
@[simp]
76+
theorem cof_eq_cardinalMk : cof α = #α := by
77+
rw [← card_type LT.lt, ← ord_cof_eq_type_lt, card_ord]
78+
79+
@[simp]
80+
theorem _root_.Cardinal.ord_cardinalMk : ord #α = typeLT α := by
81+
rw [← ord_cof_eq_type_lt, cof_eq_cardinalMk]
82+
83+
theorem cof_ordinal : cof Ordinal.{u} = Cardinal.univ.{u, u + 1} := by
84+
simp
85+
86+
theorem type_eq_of_isCofinal {s : Set α} (hs : IsCofinal s) : typeLT s = typeLT α := by
87+
apply (RelEmbedding.ofMonotone Subtype.val (by simp)).ordinal_type_le.antisymm
88+
rw [← ord_cardinalMk, ord_le, card_type, ← cof_eq_cardinalMk]
89+
exact cof_le hs
90+
91+
/-- Enumerate the elements of a cofinal subset of `α` by `α` itself. This is a generalization of
92+
`Nat.nth`. -/
93+
noncomputable def enum (s : Set α) (hs : IsCofinal s) : α ≃o s :=
94+
.ofRelIsoLT (type_eq.1 (type_eq_of_isCofinal hs).symm).some
95+
96+
theorem enum_le_of_forall_lt {a o : α} {s : Set α} {hs : IsCofinal s} (ho : o ∈ s)
97+
(H : ∀ b < a, enum s hs b < o) : enum s hs a ≤ o := by
98+
rw [← Subtype.coe_mk o ho, Subtype.coe_le_coe, ← OrderIso.le_symm_apply]
99+
apply le_of_forall_lt
100+
simpa [OrderIso.lt_symm_apply]
101+
102+
theorem enum_succ_le_of_lt [SuccOrder α] {a o : α} {s : Set α} {hs : IsCofinal s} (ha : o ∈ s)
103+
(H : enum s hs a < o) : enum s hs (succ a) ≤ o := by
104+
refine enum_le_of_forall_lt ha fun b hb ↦ H.trans_le' ?_
105+
simpa using le_of_lt_succ hb
106+
107+
@[simp]
108+
theorem enum_univ (x : α) : enum univ .univ x = ⟨x, mem_univ x⟩ := by
109+
rw [← Subsingleton.allEq OrderIso.Set.univ.symm (enum univ .univ)]
110+
rfl
111+
112+
end Order

Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -558,17 +558,6 @@ theorem cof_univ : cof univ.{u, v} = Cardinal.univ.{u, v} := by
558558
← not_bddAbove_iff_isCofinal]
559559
exact fun s hs ↦ mk_le_of_injective (enumOrdOrderIso s hs).injective
560560

561-
@[simp]
562-
theorem _root_.Order.cof_ordinal : Order.cof Ordinal.{u} = Cardinal.univ.{u, u + 1} := by
563-
have := (OrderIso.ofRelIsoLT liftPrincipalSeg.subrelIso.{u, u + 1}).lift_cof_congr
564-
rw [Cardinal.lift_id'.{_, u + 2}] at this
565-
change Order.cof (Iio univ) = _ at this
566-
rwa [cof_Iio, ← lift_cof, Cardinal.lift_inj, cof_univ, eq_comm] at this
567-
568-
@[simp]
569-
theorem _root_.Order.cof_cardinal : Order.cof Cardinal.{u} = Cardinal.univ.{u, u + 1} := by
570-
rw [← preAleph.cof_congr, cof_ordinal]
571-
572561
end Ordinal
573562

574563
namespace Cardinal

0 commit comments

Comments
 (0)