Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Mathlib/SetTheory/Cardinal/Aleph.lean
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ theorem ord_preAleph (o : Ordinal) : (preAleph o).ord = preOmega o := by

@[simp]
theorem _root_.Ordinal.type_lt_cardinal : typeLT Cardinal = Ordinal.univ.{u, u + 1} := by
simpa using preAleph.symm.toRelIsoLT.ordinal_type_eq
simpa using preAleph.symm.ordinalType_congr

@[deprecated (since := "2026-03-20")] alias type_cardinal := type_lt_cardinal

Expand Down
4 changes: 4 additions & 0 deletions Mathlib/SetTheory/Cardinal/Cofinality/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ theorem le_cof_iff {c : Cardinal} : c ≤ cof α ↔ ∀ s : Set α, IsCofinal s
@[deprecated (since := "2026-02-18")] alias le_cof := le_cof_iff

variable (α) in
/-- Every well-order has a cofinal subset of cardinal `cof α`. -/
theorem exists_cof_eq : ∃ s : Set α, IsCofinal s ∧ #s = cof α := by
obtain ⟨s, hs⟩ := ciInf_mem fun s : {s : Set α // IsCofinal s} ↦ #s
exact ⟨s.1, s.2, hs⟩
Expand Down Expand Up @@ -133,6 +134,9 @@ theorem cof_congr_of_strictMono {f : α → γ} (hf : StrictMono f) (hf' : IsCof
cof α = cof γ := by
simpa using lift_cof_congr_of_strictMono hf hf'

theorem cof_eq_of_isCofinal {s : Set α} (hs : IsCofinal s) : cof s = cof α :=
cof_congr_of_strictMono (Subtype.strictMono_coe _) (by simpa)

@[simp]
theorem cof_lt_aleph0_iff : cof α < ℵ₀ ↔ cof α ≤ 1 := by
refine ⟨fun h ↦ ?_, (lt_of_le_of_lt · one_lt_aleph0)⟩
Expand Down
21 changes: 14 additions & 7 deletions Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@ theorem cof_omega0 : cof ω = ℵ₀ :=

@[deprecated (since := "2026-02-18")] alias cof_eq_one_iff_is_succ := cof_eq_one_iff

theorem exists_ord_cof_eq (α : Type*) [LinearOrder α] [WellFoundedLT α] :
variable (α) in
/-- Every well-order has a cofinal subset of order type `(cof α).ord`. -/
theorem exists_ord_cof_eq [LinearOrder α] [WellFoundedLT α] :
∃ s : Set α, IsCofinal s ∧ typeLT s = (Order.cof α).ord := by
obtain ⟨s, hs, hs'⟩ := exists_cof_eq α
obtain ⟨r, hr, hr'⟩ := exists_ord_eq s
Expand All @@ -168,16 +170,21 @@ theorem exists_ord_cof_eq (α : Type*) [LinearOrder α] [WellFoundedLT α] :

@[deprecated (since := "2026-05-25")] alias ord_cof_eq := exists_ord_cof_eq

/-- Every cofinal set has a cofinal subset of order type `(cof α).ord`. -/
theorem exists_ord_cof_eq_of_isCofinal [LinearOrder α] [WellFoundedLT α]
{s : Set α} (hs : IsCofinal s) : ∃ t ⊆ s, IsCofinal t ∧ typeLT t = (Order.cof α).ord := by
obtain ⟨t, ht, ht'⟩ := exists_ord_cof_eq s
rw [cof_eq_of_isCofinal hs] at ht'
refine ⟨t, ?_, hs.trans ht, ?_⟩
· simp
· rw [← ht']
exact ((Subtype.strictMono_coe _).strictMonoOn _).orderIso.ordinalType_congr.symm

@[simp]
theorem _root_.Order.cof_ord_cof (α : Type*) [LinearOrder α] [WellFoundedLT α] :
(Order.cof α).ord.cof = Order.cof α := by
obtain ⟨s, hs, hs'⟩ := exists_ord_cof_eq α
rw [← hs', cof_type]
apply le_antisymm
· rw [← card_ord (Order.cof α), ← hs', card_type]
exact cof_le_cardinalMk s
· rw [le_cof_iff]
exact fun t ht ↦ (cof_le (hs.trans ht)).trans_eq (mk_image_eq Subtype.val_injective)
rw [← hs', cof_type, cof_eq_of_isCofinal hs]

@[simp]
theorem cof_ord_cof (o : Ordinal) : o.cof.ord.cof = o.cof := by
Expand Down
31 changes: 19 additions & 12 deletions Mathlib/SetTheory/Ordinal/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,19 @@ theorem type_eq {α β} {r : α → α → Prop} {s : β → β → Prop} [IsWel
type r = type s ↔ Nonempty (r ≃r s) :=
Quotient.eq'

theorem _root_.RelIso.ordinal_type_eq {α β} {r : α → α → Prop} {s : β → β → Prop} [IsWellOrder α r]
[IsWellOrder β s] (h : r ≃r s) : type r = type s :=
theorem _root_.RelIso.ordinalType_congr {α β} {r : α → α → Prop} {s : β → β → Prop}
[IsWellOrder α r] [IsWellOrder β s] (h : r ≃r s) : type r = type s :=
type_eq.2 ⟨h⟩

@[deprecated (since := "2026-05-25")]
alias _root_.RelIso.ordinal_type_eq := RelIso.ordinalType_congr

theorem _root_.OrderIso.ordinalType_congr {α β} [LinearOrder α] [LinearOrder β]
[WellFoundedLT α] [WellFoundedLT β] (h : α ≃o β) : typeLT α = typeLT β :=
h.toRelIsoLT.ordinalType_congr

theorem type_eq_zero_of_empty (r) [IsWellOrder α r] [IsEmpty α] : type r = 0 :=
(RelIso.relIsoOfIsEmpty r _).ordinal_type_eq
(RelIso.relIsoOfIsEmpty r _).ordinalType_congr

@[simp]
theorem type_eq_zero_iff_isEmpty [IsWellOrder α r] : type r = 0 ↔ IsEmpty α := by
Expand All @@ -191,7 +198,7 @@ theorem type_empty : type (@emptyRelation Empty) = 0 :=

theorem type_eq_one_of_unique (r) [IsWellOrder α r] [Nonempty α] [Subsingleton α] : type r = 1 := by
cases nonempty_unique α
exact (RelIso.ofUniqueOfIrrefl r _).ordinal_type_eq
exact (RelIso.ofUniqueOfIrrefl r _).ordinalType_congr

@[simp]
theorem type_eq_one_iff_unique [IsWellOrder α r] : type r = 1 ↔ Nonempty (Unique α) :=
Expand Down Expand Up @@ -410,7 +417,7 @@ def typein (r : α → α → Prop) [IsWellOrder α r] : @PrincipalSeg α Ordina
exact (PrincipalSeg.ofElement _ _).ordinal_type_lt
· refine inductionOn a ?_
rintro β s wo ⟨g⟩
exact ⟨_, g.subrelIso.ordinal_type_eq
exact ⟨_, g.subrelIso.ordinalType_congr

@[simp]
theorem type_subrel (r : α → α → Prop) [IsWellOrder α r] (a : α) :
Expand All @@ -431,7 +438,7 @@ theorem typein_lt_self {o : Ordinal} (i : o.ToType) : typein (α := o.ToType) (
@[simp]
theorem typein_top {α β} {r : α → α → Prop} {s : β → β → Prop}
[IsWellOrder α r] [IsWellOrder β s] (f : r ≺i s) : typein s f.top = type r :=
f.subrelIso.ordinal_type_eq
f.subrelIso.ordinalType_congr

@[simp]
theorem typein_lt_typein (r : α → α → Prop) [IsWellOrder α r] {a b : α} :
Expand Down Expand Up @@ -659,12 +666,12 @@ theorem type_lt_ulift [LinearOrder α] [WellFoundedLT α] :
theorem _root_.RelIso.ordinal_lift_type_eq {r : α → α → Prop} {s : β → β → Prop}
[IsWellOrder α r] [IsWellOrder β s] (f : r ≃r s) : lift.{v} (type r) = lift.{u} (type s) :=
((RelIso.preimage Equiv.ulift r).trans <|
f.trans (RelIso.preimage Equiv.ulift s).symm).ordinal_type_eq
f.trans (RelIso.preimage Equiv.ulift s).symm).ordinalType_congr

@[simp]
theorem type_preimage {α β : Type u} (r : α → α → Prop) [IsWellOrder α r] (f : β ≃ α) :
type (f ⁻¹'o r) = type r :=
(RelIso.preimage f r).ordinal_type_eq
(RelIso.preimage f r).ordinalType_congr

@[simp]
theorem type_lift_preimage (r : α → α → Prop) [IsWellOrder α r]
Expand Down Expand Up @@ -830,11 +837,11 @@ the addition, together with properties of the other operations, are proved in
every element of `o₁` is smaller than every element of `o₂`. -/
instance add : Add Ordinal.{u} :=
⟨fun o₁ o₂ => Quotient.liftOn₂ o₁ o₂ (fun ⟨_, r, _⟩ ⟨_, s, _⟩ => type (Sum.Lex r s))
fun _ _ _ _ ⟨f⟩ ⟨g⟩ => (RelIso.sumLexCongr f g).ordinal_type_eq
fun _ _ _ _ ⟨f⟩ ⟨g⟩ => (RelIso.sumLexCongr f g).ordinalType_congr

instance addMonoidWithOne : AddMonoidWithOne Ordinal.{u} where
zero_add o := inductionOn o fun α _ _ => (RelIso.emptySumLex _ _).ordinal_type_eq
add_zero o := inductionOn o fun α _ _ => (RelIso.sumLexEmpty _ _).ordinal_type_eq
zero_add o := inductionOn o fun α _ _ => (RelIso.emptySumLex _ _).ordinalType_congr
add_zero o := inductionOn o fun α _ _ => (RelIso.sumLexEmpty _ _).ordinalType_congr
add_assoc o₁ o₂ o₃ :=
Quotient.inductionOn₃ o₁ o₂ o₃ fun _ _ _ ↦ Quot.sound ⟨⟨sumAssoc .., by simp⟩⟩
nsmul := nsmulRec
Expand Down Expand Up @@ -876,7 +883,7 @@ instance existsAddOfLE : ExistsAddOfLE Ordinal where
exists_add_of_le {a b} := by
refine inductionOn₂ a b fun α r _ β s _ ⟨f⟩ ↦ ?_
obtain ⟨γ, t, _, ⟨g⟩⟩ := f.exists_sum_relIso
exact ⟨type t, g.ordinal_type_eq.symm⟩
exact ⟨type t, g.ordinalType_congr.symm⟩

instance canonicallyOrderedAdd : CanonicallyOrderedAdd Ordinal where
le_add_self a b := by simpa using add_le_add_left bot_le a
Expand Down
Loading