From 5920dc0d176e25db6b2d61afbf4c2e2a97dd395c Mon Sep 17 00:00:00 2001 From: vihdzp Date: Sun, 5 Apr 2026 11:04:58 -0600 Subject: [PATCH 01/93] more lemmas --- Mathlib/Order/DirSupClosed.lean | 75 +++++++++++++++++++++++++++++---- 1 file changed, 67 insertions(+), 8 deletions(-) diff --git a/Mathlib/Order/DirSupClosed.lean b/Mathlib/Order/DirSupClosed.lean index 803eeec2c4672a..30d56cec3faf4c 100644 --- a/Mathlib/Order/DirSupClosed.lean +++ b/Mathlib/Order/DirSupClosed.lean @@ -5,6 +5,7 @@ Authors: Christopher Hoskin, Violeta Hernández Palacios -/ module +public import Mathlib.Order.Antisymmetrization public import Mathlib.Order.CompleteLattice.Defs public import Mathlib.Order.UpperLower.Basic @@ -157,24 +158,82 @@ lemma DirSupInaccOn.union (hs : DirSupInaccOn D s) (ht : DirSupInaccOn D t) : lemma DirSupInacc.union (hs : DirSupInacc s) (ht : DirSupInacc t) : DirSupInacc (s ∪ t) := by simpa using hs.dirSupInaccOn.union ht.dirSupInaccOn (D := .univ) +lemma IsUpperSet.dirSupClosedOn (hs : IsUpperSet s) : DirSupClosedOn D s := + fun _d _ hds ⟨_b, hb⟩ _ _a ha ↦ hs (ha.1 hb) <| hds hb + lemma IsUpperSet.dirSupClosed (hs : IsUpperSet s) : DirSupClosed s := - fun _d hds ⟨_b, hb⟩ _ _a ha ↦ hs (ha.1 hb) <| hds hb + by simpa using hs.dirSupClosedOn (D := univ) + +lemma IsLowerSet.dirSupInaccOn (hs : IsLowerSet s) : DirSupInaccOn D s := + hs.compl.dirSupClosedOn.of_compl + +lemma IsLowerSet.dirSupInacc (hs : IsLowerSet s) : DirSupInacc s := + hs.compl.dirSupClosed.of_compl + +theorem isLUB_congr_of_antisymmRel {a b : α} (h : AntisymmRel (· ≤ ·) a b) : + IsLUB s a ↔ IsLUB s b := by + simp [isLUB_iff_le_iff, h.le_congr_left] + +private theorem DirSupClosed.mem_imp_of_antisymmRel (hs : DirSupClosed s) {a b : α} + (h : AntisymmRel (· ≤ ·) a b) (ha : a ∈ s) : b ∈ s := by + apply hs (singleton_subset_iff.2 ha) ⟨a, rfl⟩ (directedOn_singleton Std.Refl.refl a) + rw [← isLUB_congr_of_antisymmRel h] + exact isLUB_singleton + +theorem DirSupClosed.mem_iff_of_antisymmRel (hs : DirSupClosed s) {a b : α} + (h : AntisymmRel (· ≤ ·) a b) : a ∈ s ↔ b ∈ s := + ⟨hs.mem_imp_of_antisymmRel h, hs.mem_imp_of_antisymmRel h.symm⟩ + +theorem DirSupInacc.mem_iff_of_antisymmRel (hs : DirSupInacc s) {a b : α} + (h : AntisymmRel (· ≤ ·) a b) : a ∈ s ↔ b ∈ s := by + simpa [not_iff_not] using hs.compl.mem_iff_of_antisymmRel h + +lemma dirSupClosedOn_Iic (a : α) : DirSupClosedOn D (Iic a) := + fun _d _ h _ _ _a ha ↦ (isLUB_le_iff ha).2 h -lemma IsLowerSet.dirSupInacc (hs : IsLowerSet s) : DirSupInacc s := hs.compl.dirSupClosed.of_compl +lemma dirSupClosed_Iic (a : α) : DirSupClosed (Iic a) := by + simpa using dirSupClosedOn_Iic a (D := .univ) -lemma dirSupClosed_Iic (a : α) : DirSupClosed (Iic a) := fun _d h _ _ _a ha ↦ (isLUB_le_iff ha).2 h +lemma dirSupInaccOn_Iic (a : α) : DirSupInaccOn D (Iic a) := + (isLowerSet_Iic a).dirSupInaccOn + +lemma dirSupInacc_Iic (a : α) : DirSupInacc (Iic a) := by + simpa using dirSupInaccOn_Iic a (D := .univ) end Preorder +namespace PartialOrder +variable [PartialOrder α] + +theorem dirSupClosedOn_singleton (a : α) : DirSupClosedOn D {a} := by + intro d hD hdu hd₀ hd₁ b hb + rw [subset_singleton_iff_eq] at hdu + obtain rfl | rfl := hdu + · simp at hd₀ + · exact hb.unique isLUB_singleton + +theorem dirSupClosed_singleton (a : α) : DirSupClosed {a} := by + simpa using dirSupClosedOn_singleton a (D := .univ) + +end PartialOrder + section CompleteLattice -variable [CompleteLattice α] {s : Set α} +variable [CompleteLattice α] + +lemma dirSupClosedOn_iff_forall_sSup : DirSupClosedOn D s ↔ + ∀ ⦃d⦄, d ∈ D → d ⊆ s → d.Nonempty → DirectedOn (· ≤ ·) d → sSup d ∈ s := by + simp [DirSupClosedOn, isLUB_iff_sSup_eq] + +lemma dirSupInaccOn_iff_forall_sSup : DirSupInaccOn D s ↔ + ∀ ⦃d⦄, d ∈ D → d.Nonempty → DirectedOn (· ≤ ·) d → sSup d ∈ s → (d ∩ s).Nonempty := by + simp [DirSupInaccOn, isLUB_iff_sSup_eq] -lemma dirSupClosed_iff_forall_sSup : - DirSupClosed s ↔ ∀ ⦃d⦄, d ⊆ s → d.Nonempty → DirectedOn (· ≤ ·) d → sSup d ∈ s := by +lemma dirSupClosed_iff_forall_sSup : DirSupClosed s ↔ + ∀ ⦃d⦄, d ⊆ s → d.Nonempty → DirectedOn (· ≤ ·) d → sSup d ∈ s := by simp [DirSupClosed, isLUB_iff_sSup_eq] -lemma dirSupInacc_iff_forall_sSup : - DirSupInacc s ↔ ∀ ⦃d⦄, d.Nonempty → DirectedOn (· ≤ ·) d → sSup d ∈ s → (d ∩ s).Nonempty := by +lemma dirSupInacc_iff_forall_sSup : DirSupInacc s ↔ + ∀ ⦃d⦄, d.Nonempty → DirectedOn (· ≤ ·) d → sSup d ∈ s → (d ∩ s).Nonempty := by simp [DirSupInacc, isLUB_iff_sSup_eq] end CompleteLattice From d95fb2dcde005034b56dd8a9ac8da916f47000ae Mon Sep 17 00:00:00 2001 From: vihdzp Date: Sun, 5 Apr 2026 14:29:29 -0600 Subject: [PATCH 02/93] start --- Mathlib/SetTheory/Ordinal/Club.lean | 80 +++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 Mathlib/SetTheory/Ordinal/Club.lean diff --git a/Mathlib/SetTheory/Ordinal/Club.lean b/Mathlib/SetTheory/Ordinal/Club.lean new file mode 100644 index 00000000000000..8c140b9677110d --- /dev/null +++ b/Mathlib/SetTheory/Ordinal/Club.lean @@ -0,0 +1,80 @@ +/- +Copyright (c) 2026 Violeta Hernández Palacios. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Violeta Hernández Palacios +-/ +module + +public import Mathlib.SetTheory.Cardinal.Cofinality +public import Mathlib.SetTheory.Ordinal.Family +public import Mathlib.Order.DirSupClosed + +/-! +# Club sets + +A subset of a well-ordered type `α` is called a club set when it is closed in the order topology and +cofinal. If `α` has no maximum, then an equivalent condition is that `α` is closed and unbounded; +hence the name. + +## Implementation notes + +To avoid importing topology, we spell out the closure property using `DirSupClosed`. For any type +equipped with the Scott-Hausdorff topology (which includes well-orders with the order topology), +`DirSupClosed s` and `IsClosed s` are equivalent predicates. +-/ + +@[expose] public section + +universe u + +open Cardinal + +structure IsClub {α : Type*} [LinearOrder α] (s : Set α) where + dirSupClosed : DirSupClosed s + isCofinal : IsCofinal s + +variable {α : Type*} {s t : Set α} {x : α} [LinearOrder α] + +-- This is in another PR. +private theorem DirSupClosed.union (hs : DirSupClosed s) (ht : DirSupClosed t) : + DirSupClosed (s ∪ t) := + sorry + +@[simp] +private theorem DirSupClosed.of_isEmpty [IsEmpty α] (s : Set α) : DirSupClosed s := + fun _ _ ⟨a, _⟩ ↦ isEmptyElim a + +@[simp] +theorem IsClub.of_isEmpty [IsEmpty α] (s : Set α) : IsClub s := + ⟨.of_isEmpty s, .of_isEmpty s⟩ + +theorem IsClub.univ : IsClub (.univ (α := α)) := + ⟨.univ, .univ⟩ + +theorem IsClub.union (hs : IsClub s) (ht : IsClub t) : IsClub (s ∪ t) := + ⟨.union hs.dirSupClosed ht.dirSupClosed, hs.isCofinal.mono Set.subset_union_left⟩ + +theorem IsClub.isLUB_mem (hs : IsClub s) (ht : t ⊆ s) (ht₀ : t.Nonempty) (hx : IsLUB t x) : x ∈ s := + hs.dirSupClosed ht ht₀ (Std.Total.directedOn _) hx + +theorem IsClub.csSup_mem {α} [ConditionallyCompleteLinearOrder α] {s t : Set α} + (hs : IsClub s) (ht : t ⊆ s) (ht₀ : t.Nonempty) (ht₁ : BddAbove t) : sSup t ∈ s := + hs.isLUB_mem ht ht₀ (isLUB_csSup ht₀ ht₁) + +variable [WellFoundedLT α] + +theorem IsClub.sInter {s : Set (Set α)} (hα : ℵ₀ < Order.cof α) (hsα : #s < Order.cof α) + (hs : ∀ x ∈ s, IsClub x) : IsClub (⋂₀ s) := by + cases isEmpty_or_nonempty α; · simp + have := WellFoundedLT.toOrderBot α + let := WellFoundedLT.conditionallyCompleteLinearOrderBot α + refine ⟨.sInter fun x hx ↦ (hs x hx).dirSupClosed, fun a ↦ ?_⟩ + choose f hf using fun x : s ↦ (hs _ x.2).isCofinal + let g : ℕ → α := Nat.rec a fun _ IH ↦ sSup (.range (f · IH)) + sorry + +namespace Ordinal + +protected theorem isClub_sInter {s : Set (Set Ordinal)} [Small.{u} s] (hs : ∀ x ∈ s, IsClub x) : + IsClub (⋂₀ s) := by + refine .sInter ?_ ?_ hs <;> simp From dadb29973575bdb079a49a8a2b784171a0a3937a Mon Sep 17 00:00:00 2001 From: vihdzp Date: Sun, 5 Apr 2026 14:38:21 -0600 Subject: [PATCH 03/93] finish --- Mathlib/SetTheory/Cardinal/Cofinality.lean | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Mathlib/SetTheory/Cardinal/Cofinality.lean b/Mathlib/SetTheory/Cardinal/Cofinality.lean index 372d7903291aad..95609eef1e6a3a 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality.lean @@ -725,6 +725,17 @@ theorem cof_univ : cof univ.{u, v} = Cardinal.univ.{u, v} := by ← not_bddAbove_iff_isCofinal] exact fun s hs ↦ mk_le_of_injective (enumOrdOrderIso s hs).injective +@[simp] +theorem _root_.Order.cof_ordinal : Order.cof Ordinal.{u} = Cardinal.univ.{u, u + 1} := by + have := (OrderIso.ofRelIsoLT liftPrincipalSeg.subrelIso.{u, u + 1}).lift_cof_congr + rw [Cardinal.lift_id'.{_, u + 2}] at this + change Order.cof (Iio univ) = _ at this + rwa [cof_Iio, ← lift_cof, Cardinal.lift_inj, cof_univ, eq_comm] at this + +@[simp] +theorem _root_.Order.cof_cardinal : Order.cof Cardinal.{u} = Cardinal.univ.{u, u + 1} := by + rw [← preAleph.cof_congr, cof_ordinal] + end Ordinal namespace Cardinal From fc7d23cf9e6056969518a4e75272c8226eed70c5 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Sun, 5 Apr 2026 16:09:53 -0600 Subject: [PATCH 04/93] clubstep --- Mathlib.lean | 1 + Mathlib/Order/DirSupClosed.lean | 16 ++++++ Mathlib/Order/IsNormal.lean | 12 +++++ Mathlib/SetTheory/Ordinal/Basic.lean | 1 + Mathlib/SetTheory/Ordinal/Club.lean | 80 ---------------------------- 5 files changed, 30 insertions(+), 80 deletions(-) delete mode 100644 Mathlib/SetTheory/Ordinal/Club.lean diff --git a/Mathlib.lean b/Mathlib.lean index c21c7fbff44e6e..bc8fbcb0d07dc3 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -5753,6 +5753,7 @@ public import Mathlib.Order.Category.Semilat public import Mathlib.Order.Circular public import Mathlib.Order.Circular.ZMod public import Mathlib.Order.Closure +public import Mathlib.Order.Club public import Mathlib.Order.Cofinal public import Mathlib.Order.CompactlyGenerated.Basic public import Mathlib.Order.CompactlyGenerated.Intervals diff --git a/Mathlib/Order/DirSupClosed.lean b/Mathlib/Order/DirSupClosed.lean index 803eeec2c4672a..afbbbd91e5771c 100644 --- a/Mathlib/Order/DirSupClosed.lean +++ b/Mathlib/Order/DirSupClosed.lean @@ -62,6 +62,22 @@ def DirSupInacc (s : Set α) : Prop := @[simp] lemma DirSupClosed.dirSupClosedOn : DirSupClosed s → DirSupClosedOn D s := @fun h _ _ ↦ @h _ @[simp] lemma DirSupInacc.dirSupInaccOn : DirSupInacc s → DirSupInaccOn D s := @fun h _ _ ↦ @h _ +@[simp] +theorem DirSupClosed.of_isEmpty [IsEmpty α] (s : Set α) : DirSupClosed s := + fun _ _ ⟨a, _⟩ ↦ isEmptyElim a + +@[simp] +theorem DirSupClosedOn.of_isEmpty [IsEmpty α] (s : Set α) : DirSupClosedOn D s := by + simp + +@[simp] +theorem DirSupInacc.of_isEmpty [IsEmpty α] (s : Set α) : DirSupInacc s := + fun _ ⟨a, _⟩ ↦ isEmptyElim a + +@[simp] +theorem DirSupInaccOn.of_isEmpty [IsEmpty α] (s : Set α) : DirSupInaccOn D s := by + simp + @[gcongr] lemma DirSupClosedOn.mono (hD : D₁ ⊆ D₂) (hf : DirSupClosedOn D₂ s) : DirSupClosedOn D₁ s := fun _ a ↦ hf (hD a) diff --git a/Mathlib/Order/IsNormal.lean b/Mathlib/Order/IsNormal.lean index 8e22e8dfd26a91..3438ef95ec78f7 100644 --- a/Mathlib/Order/IsNormal.lean +++ b/Mathlib/Order/IsNormal.lean @@ -5,6 +5,7 @@ Authors: Violeta Hernández Palacios -/ module +public import Mathlib.Dynamics.FixedPoints.Basic public import Mathlib.Order.SuccPred.CompleteLinearOrder public import Mathlib.Order.SuccPred.InitialSeg @@ -130,6 +131,17 @@ theorem map_iSup {ι} [Nonempty ι] {g : ι → α} (hf : IsNormal f) (hg : BddA ext simp +theorem iSup_iterate_mem_fixedPoints [WellFoundedLT α] {f : α → α} (a : α) (hf : IsNormal f) + (hf' : BddAbove (.range fun n ↦ f^[n] a)) : ⨆ n, f^[n] a ∈ f.fixedPoints := by + rw [f.mem_fixedPoints_iff, hf.map_iSup hf'] + apply le_antisymm <;> refine ciSup_le fun n ↦ ?_ + · rw [← f.iterate_succ_apply'] + exact le_ciSup hf' _ + · apply hf.strictMono.le_apply.trans + apply (le_ciSup (hf'.mono _) n) + simp_rw [← f.iterate_succ_apply'] + grind + theorem preimage_Iic (hf : IsNormal f) {x : β} (h₁ : (f ⁻¹' Iic x).Nonempty) (h₂ : BddAbove (f ⁻¹' Iic x)) : f ⁻¹' Iic x = Iic (sSup (f ⁻¹' Iic x)) := by diff --git a/Mathlib/SetTheory/Ordinal/Basic.lean b/Mathlib/SetTheory/Ordinal/Basic.lean index 7133072b432cb0..93d13cac260484 100644 --- a/Mathlib/SetTheory/Ordinal/Basic.lean +++ b/Mathlib/SetTheory/Ordinal/Basic.lean @@ -1317,6 +1317,7 @@ theorem lift_lt_univ' (c : Cardinal) : lift.{max (u + 1) v, u} c < univ.{u, v} : rw [lift_lift, lift_univ, univ_umax.{u, v}] at this exact this +@[simp] theorem aleph0_lt_univ : ℵ₀ < univ.{u, v} := by simpa using lift_lt_univ' ℵ₀ diff --git a/Mathlib/SetTheory/Ordinal/Club.lean b/Mathlib/SetTheory/Ordinal/Club.lean deleted file mode 100644 index 8c140b9677110d..00000000000000 --- a/Mathlib/SetTheory/Ordinal/Club.lean +++ /dev/null @@ -1,80 +0,0 @@ -/- -Copyright (c) 2026 Violeta Hernández Palacios. All rights reserved. -Released under Apache 2.0 license as described in the file LICENSE. -Authors: Violeta Hernández Palacios --/ -module - -public import Mathlib.SetTheory.Cardinal.Cofinality -public import Mathlib.SetTheory.Ordinal.Family -public import Mathlib.Order.DirSupClosed - -/-! -# Club sets - -A subset of a well-ordered type `α` is called a club set when it is closed in the order topology and -cofinal. If `α` has no maximum, then an equivalent condition is that `α` is closed and unbounded; -hence the name. - -## Implementation notes - -To avoid importing topology, we spell out the closure property using `DirSupClosed`. For any type -equipped with the Scott-Hausdorff topology (which includes well-orders with the order topology), -`DirSupClosed s` and `IsClosed s` are equivalent predicates. --/ - -@[expose] public section - -universe u - -open Cardinal - -structure IsClub {α : Type*} [LinearOrder α] (s : Set α) where - dirSupClosed : DirSupClosed s - isCofinal : IsCofinal s - -variable {α : Type*} {s t : Set α} {x : α} [LinearOrder α] - --- This is in another PR. -private theorem DirSupClosed.union (hs : DirSupClosed s) (ht : DirSupClosed t) : - DirSupClosed (s ∪ t) := - sorry - -@[simp] -private theorem DirSupClosed.of_isEmpty [IsEmpty α] (s : Set α) : DirSupClosed s := - fun _ _ ⟨a, _⟩ ↦ isEmptyElim a - -@[simp] -theorem IsClub.of_isEmpty [IsEmpty α] (s : Set α) : IsClub s := - ⟨.of_isEmpty s, .of_isEmpty s⟩ - -theorem IsClub.univ : IsClub (.univ (α := α)) := - ⟨.univ, .univ⟩ - -theorem IsClub.union (hs : IsClub s) (ht : IsClub t) : IsClub (s ∪ t) := - ⟨.union hs.dirSupClosed ht.dirSupClosed, hs.isCofinal.mono Set.subset_union_left⟩ - -theorem IsClub.isLUB_mem (hs : IsClub s) (ht : t ⊆ s) (ht₀ : t.Nonempty) (hx : IsLUB t x) : x ∈ s := - hs.dirSupClosed ht ht₀ (Std.Total.directedOn _) hx - -theorem IsClub.csSup_mem {α} [ConditionallyCompleteLinearOrder α] {s t : Set α} - (hs : IsClub s) (ht : t ⊆ s) (ht₀ : t.Nonempty) (ht₁ : BddAbove t) : sSup t ∈ s := - hs.isLUB_mem ht ht₀ (isLUB_csSup ht₀ ht₁) - -variable [WellFoundedLT α] - -theorem IsClub.sInter {s : Set (Set α)} (hα : ℵ₀ < Order.cof α) (hsα : #s < Order.cof α) - (hs : ∀ x ∈ s, IsClub x) : IsClub (⋂₀ s) := by - cases isEmpty_or_nonempty α; · simp - have := WellFoundedLT.toOrderBot α - let := WellFoundedLT.conditionallyCompleteLinearOrderBot α - refine ⟨.sInter fun x hx ↦ (hs x hx).dirSupClosed, fun a ↦ ?_⟩ - choose f hf using fun x : s ↦ (hs _ x.2).isCofinal - let g : ℕ → α := Nat.rec a fun _ IH ↦ sSup (.range (f · IH)) - sorry - -namespace Ordinal - -protected theorem isClub_sInter {s : Set (Set Ordinal)} [Small.{u} s] (hs : ∀ x ∈ s, IsClub x) : - IsClub (⋂₀ s) := by - refine .sInter ?_ ?_ hs <;> simp From d3c8814d589b0e9b781ae820782cd09d656d93b6 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Sun, 5 Apr 2026 16:10:04 -0600 Subject: [PATCH 05/93] fix --- Mathlib/Order/Club.lean | 104 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 Mathlib/Order/Club.lean diff --git a/Mathlib/Order/Club.lean b/Mathlib/Order/Club.lean new file mode 100644 index 00000000000000..6105c15d661bb8 --- /dev/null +++ b/Mathlib/Order/Club.lean @@ -0,0 +1,104 @@ +/- +Copyright (c) 2026 Violeta Hernández Palacios. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Violeta Hernández Palacios +-/ +module + +public import Mathlib.SetTheory.Cardinal.Cofinality +public import Mathlib.Order.DirSupClosed + +/-! +# Club sets + +A subset of a well-ordered type `α` is called a club set when it is closed in the order topology and +cofinal. If `α` has no maximum, then an equivalent condition is that `α` is closed and unbounded; +hence the name. + +## Implementation notes + +To avoid importing topology in the ordinals, we spell out the closure property using `DirSupClosed`. +For any type equipped with the Scott-Hausdorff topology (which includes well-orders with the order +topology), `DirSupClosed s` and `IsClosed s` are equivalent predicates. +-/ + +@[expose] public section + +universe u v + +open Cardinal + +/-- A club set is closed under suprema and cofinal. -/ +structure IsClub {α : Type*} [LinearOrder α] (s : Set α) where + /-- Club sets are closed under suprema. If `α` is a well-order with the order topology, this + condition is equivalent to `IsClosed s`. -/ + dirSupClosed : DirSupClosed s + /-- Club sets are cofinal. If `α` has no maximum, this condition is equivalent to `¬ BddAbove s`. + See `not_bddAbove_iff_isCofinal`. -/ + isCofinal : IsCofinal s + +variable {α : Type v} {s t : Set α} {x : α} [LinearOrder α] + +@[simp] +theorem IsClub.of_isEmpty [IsEmpty α] (s : Set α) : IsClub s := + ⟨.of_isEmpty s, .of_isEmpty s⟩ + +@[simp] +theorem IsClub.univ : IsClub (.univ (α := α)) := + ⟨.univ, .univ⟩ + +-- Depends on #37304. +proof_wanted IsClub.union (hs : IsClub s) (ht : IsClub t) : IsClub (s ∪ t) + +theorem IsClub.isLUB_mem (hs : IsClub s) (ht : t ⊆ s) (ht₀ : t.Nonempty) (hx : IsLUB t x) : x ∈ s := + hs.dirSupClosed ht ht₀ (Std.Total.directedOn _) hx + +theorem IsClub.csSup_mem {α} [ConditionallyCompleteLinearOrder α] {s t : Set α} + (hs : IsClub s) (ht : t ⊆ s) (ht₀ : t.Nonempty) (ht₁ : BddAbove t) : sSup t ∈ s := + hs.isLUB_mem ht ht₀ (isLUB_csSup ht₀ ht₁) + +variable [WellFoundedLT α] + +attribute [local instance] + WellFoundedLT.toOrderBot WellFoundedLT.conditionallyCompleteLinearOrderBot + +theorem IsClub.sInter {s : Set (Set α)} (hα : ℵ₀ < Order.cof α) (hsα : #s < Order.cof α) + (hs : ∀ x ∈ s, IsClub x) : IsClub (⋂₀ s) := by + cases isEmpty_or_nonempty α; · simp + refine ⟨.sInter fun x hx ↦ (hs x hx).dirSupClosed, fun a ↦ ?_⟩ + choose f hf using fun x : s ↦ (hs _ x.2).isCofinal + let g : ℕ → α := Nat.rec a fun _ IH ↦ sSup (.range (f · IH)) + have hg : BddAbove (.range g) := by + refine .of_not_isCofinal fun hg ↦ (Order.cof_le hg).not_gt (hα.trans_le' ?_) + simpa using mk_range_le_lift (f := g) + refine ⟨_, fun t ht ↦ ?_, le_csSup hg ⟨0, rfl⟩⟩ + apply (hs t ht).isLUB_mem (t := .range fun n ↦ f ⟨t, ht⟩ (g n)) _ (Set.range_nonempty _) + · refine ⟨?_, fun b hb ↦ csSup_le' ?_⟩ <;> rintro _ ⟨n, rfl⟩ + · apply (le_csSup (.of_not_isCofinal _) _).trans (le_csSup hg ⟨n + 1, rfl⟩) + · exact fun hg' ↦ (Order.cof_le hg').not_gt (mk_range_le.trans_lt hsα) + · use ⟨t, ht⟩ + · exact (hf ⟨t, ht⟩ _).2.trans <| hb ⟨_, rfl⟩ + · grind + +theorem IsClub.iInter {ι : Type u} {f : ι → Set α} (hα : ℵ₀ < Order.cof α) + (hι : Cardinal.lift.{v} #ι < Cardinal.lift.{u} (Order.cof α)) (hf : ∀ i, IsClub (f i)) : + IsClub (⋂ i, f i) := by + rw [← Set.sInter_range] + refine IsClub.sInter hα ?_ (by simpa) + rw [← Cardinal.lift_lt] + exact mk_range_le_lift.trans_lt hι + +theorem IsClub.inter {s t : Set α} (hα : ℵ₀ < Order.cof α) (hs : IsClub s) (ht : IsClub t) : + IsClub (s ∩ t) := by + rw [← Set.sInter_pair] + exact IsClub.sInter hα (hα.trans_le' <| by simp) (by simp [hs, ht]) + +theorem Order.IsNormal.isClub_fixedPoints {f : α → α} + (hα : ℵ₀ < Order.cof α) (hf : Order.IsNormal f) : IsClub f.fixedPoints := by + cases isEmpty_or_nonempty α; · simp + refine ⟨fun s hs hs₀ _ a ha ↦ (hf.map_isLUB ha hs₀).unique ?_, fun a ↦ ?_⟩ + · rwa [Set.image_congr hs, Set.image_id'] + · suffices BddAbove (.range fun n ↦ f^[n] a) from + ⟨_, hf.iSup_iterate_mem_fixedPoints a this, le_csSup this ⟨0, rfl⟩⟩ + refine .of_not_isCofinal fun h ↦ (Order.cof_le h).not_gt (hα.trans_le' ?_) + simpa using mk_range_le_lift (f := fun n : ℕ ↦ f^[n] a) From 658640cbc0a3c65bc5c5413eca79921c425509c8 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Sun, 5 Apr 2026 16:43:05 -0600 Subject: [PATCH 06/93] add of_isEmpty lemmas --- Mathlib/Order/DirSupClosed.lean | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Mathlib/Order/DirSupClosed.lean b/Mathlib/Order/DirSupClosed.lean index 30d56cec3faf4c..f2df8480827d93 100644 --- a/Mathlib/Order/DirSupClosed.lean +++ b/Mathlib/Order/DirSupClosed.lean @@ -63,6 +63,15 @@ def DirSupInacc (s : Set α) : Prop := @[simp] lemma DirSupClosed.dirSupClosedOn : DirSupClosed s → DirSupClosedOn D s := @fun h _ _ ↦ @h _ @[simp] lemma DirSupInacc.dirSupInaccOn : DirSupInacc s → DirSupInaccOn D s := @fun h _ _ ↦ @h _ +@[simp] theorem DirSupClosed.of_isEmpty [IsEmpty α] (s : Set α) : DirSupClosed s := + fun _ _ ⟨a, _⟩ ↦ isEmptyElim a + +@[simp] theorem DirSupInacc.of_isEmpty [IsEmpty α] (s : Set α) : DirSupInacc s := + fun _ ⟨a, _⟩ ↦ isEmptyElim a + +@[simp] theorem DirSupClosedOn.of_isEmpty [IsEmpty α] (s : Set α) : DirSupClosedOn D s := by simp +@[simp] theorem DirSupInaccOn.of_isEmpty [IsEmpty α] (s : Set α) : DirSupInaccOn D s := by simp + @[gcongr] lemma DirSupClosedOn.mono (hD : D₁ ⊆ D₂) (hf : DirSupClosedOn D₂ s) : DirSupClosedOn D₁ s := fun _ a ↦ hf (hD a) From a7d780094107055ebaa75d192bf40d351c690cd4 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Sun, 5 Apr 2026 16:51:06 -0600 Subject: [PATCH 07/93] simp can prove this --- Mathlib/Order/DirSupClosed.lean | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Mathlib/Order/DirSupClosed.lean b/Mathlib/Order/DirSupClosed.lean index f2df8480827d93..2b1cd15f7f450d 100644 --- a/Mathlib/Order/DirSupClosed.lean +++ b/Mathlib/Order/DirSupClosed.lean @@ -69,8 +69,8 @@ def DirSupInacc (s : Set α) : Prop := @[simp] theorem DirSupInacc.of_isEmpty [IsEmpty α] (s : Set α) : DirSupInacc s := fun _ ⟨a, _⟩ ↦ isEmptyElim a -@[simp] theorem DirSupClosedOn.of_isEmpty [IsEmpty α] (s : Set α) : DirSupClosedOn D s := by simp -@[simp] theorem DirSupInaccOn.of_isEmpty [IsEmpty α] (s : Set α) : DirSupInaccOn D s := by simp +theorem DirSupClosedOn.of_isEmpty [IsEmpty α] (s : Set α) : DirSupClosedOn D s := by simp +theorem DirSupInaccOn.of_isEmpty [IsEmpty α] (s : Set α) : DirSupInaccOn D s := by simp @[gcongr] lemma DirSupClosedOn.mono (hD : D₁ ⊆ D₂) (hf : DirSupClosedOn D₂ s) : DirSupClosedOn D₁ s := From c41672242f617acc776e21ae230dddea3395cf2b Mon Sep 17 00:00:00 2001 From: vihdzp Date: Sun, 5 Apr 2026 21:50:37 -0600 Subject: [PATCH 08/93] fodor --- Mathlib/Order/Club.lean | 123 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 118 insertions(+), 5 deletions(-) diff --git a/Mathlib/Order/Club.lean b/Mathlib/Order/Club.lean index 6105c15d661bb8..5a7fd55353bf3c 100644 --- a/Mathlib/Order/Club.lean +++ b/Mathlib/Order/Club.lean @@ -9,11 +9,13 @@ public import Mathlib.SetTheory.Cardinal.Cofinality public import Mathlib.Order.DirSupClosed /-! -# Club sets +# Club sets and stationary sets -A subset of a well-ordered type `α` is called a club set when it is closed in the order topology and -cofinal. If `α` has no maximum, then an equivalent condition is that `α` is closed and unbounded; -hence the name. +A subset of a well-ordered type `α` is called a **club set** when it is closed in the order topology +and cofinal. If `α` has no maximum, then an equivalent condition is that `α` is closed and +unbounded; hence the name. + +A set is called **stationary** when it intersects all club sets. ## Implementation notes @@ -26,7 +28,9 @@ topology), `DirSupClosed s` and `IsClosed s` are equivalent predicates. universe u v -open Cardinal +open Cardinal Ordinal + +/-! ### Club sets -/ /-- A club set is closed under suprema and cofinal. -/ structure IsClub {α : Type*} [LinearOrder α] (s : Set α) where @@ -47,6 +51,9 @@ theorem IsClub.of_isEmpty [IsEmpty α] (s : Set α) : IsClub s := theorem IsClub.univ : IsClub (.univ (α := α)) := ⟨.univ, .univ⟩ +theorem isClub_empty_iff : IsClub (α := α) ∅ ↔ IsEmpty α := + ⟨fun h ↦ isCofinal_empty_iff.1 h.isCofinal, fun _ ↦ IsClub.of_isEmpty _⟩ + -- Depends on #37304. proof_wanted IsClub.union (hs : IsClub s) (ht : IsClub t) : IsClub (s ∪ t) @@ -57,6 +64,12 @@ theorem IsClub.csSup_mem {α} [ConditionallyCompleteLinearOrder α] {s t : Set (hs : IsClub s) (ht : t ⊆ s) (ht₀ : t.Nonempty) (ht₁ : BddAbove t) : sSup t ∈ s := hs.isLUB_mem ht ht₀ (isLUB_csSup ht₀ ht₁) +theorem IsClub.ciSup_mem {α} [ConditionallyCompleteLinearOrder α] {ι} {f : ι → α} [Nonempty ι] + {s : Set α} (hs : IsClub s) (ht : .range f ⊆ s) (ht' : BddAbove (.range f)) : ⨆ i, f i ∈ s := + hs.csSup_mem ht (Set.range_nonempty _) ht' + +section WellFoundedLT + variable [WellFoundedLT α] attribute [local instance] @@ -93,6 +106,56 @@ theorem IsClub.inter {s t : Set α} (hα : ℵ₀ < Order.cof α) (hs : IsClub s rw [← Set.sInter_pair] exact IsClub.sInter hα (hα.trans_le' <| by simp) (by simp [hs, ht]) +attribute [-simp] Function.iterate_succ in +/-- Club sets are closed under diagonal intersections. -/ +theorem IsClub.diag {f : α → Set α} (hα' : ℵ₀ < Order.cof α) (hα : typeLT α ≤ (Order.cof α).ord) + (hf : ∀ a, IsClub (f a)) : IsClub {a | ∀ b < a, a ∈ f b} where + dirSupClosed t ht ht₀ _ a ha b hb := by + obtain ⟨c, hc, hbc, -⟩ := ha.exists_between hb + apply (hf b).isLUB_mem _ ⟨c, _⟩ (ha.inter_Ici_of_mem hc) <;> grind + isCofinal a := by + have : Nonempty α := ⟨a⟩ + have := (noTopOrder_iff_noMaxOrder α).1 <| Order.one_lt_cof_iff.1 (one_lt_aleph0.trans hα') + replace hα : (Order.cof α).ord = typeLT α := by + apply hα.antisymm' + rw [ord_le] + exact Order.cof_le_cardinalMk α + have hα'' : Order.cof α = #α := by simpa using congrArg card hα + have (b : α) : ∃ c ∈ ⋂₀ (f '' Set.Iio b), b < c := by + obtain ⟨b', hb'⟩ := exists_gt b + have ⟨c, hc, hbc⟩ := + (IsClub.sInter (s := f '' Set.Iio b) hα' (mk_image_le.trans_lt ?_) ?_).isCofinal b' + · exact ⟨c, hc, hb'.trans_le hbc⟩ + · rw [hα''] + apply mk_Iio_lt + rw [← hα, hα''] + · simp [hf] + choose g hg using this + have hgm : StrictMono fun n ↦ g^[n] a := by + apply strictMono_of_lt_add_one fun n _ ↦ ?_ + rw [← n.succ_eq_add_one, g.iterate_succ_apply'] + exact (hg _).2 + have hg' : IsLUB (.range fun n ↦ g^[n] a) (⨆ n, g^[n] a) := by + refine isLUB_ciSup (.of_not_isCofinal fun h ↦ ?_) + apply (Order.cof_le h).not_gt (hα'.trans_le' _) + simpa using mk_range_le_lift (f := fun n ↦ g^[n] a) + refine ⟨⨆ n, g^[n] a, fun b hb ↦ ?_, hg'.1 ⟨0, rfl⟩⟩ + obtain ⟨_, ⟨n, rfl⟩, hb, hn⟩ := hg'.exists_between hb + apply (hf b).isLUB_mem _ _ (hg'.inter_Ici_of_mem ⟨n + 1, rfl⟩) + · rintro _ ⟨⟨m, rfl⟩, hm⟩ + simp_rw [Set.sInter_image, Set.mem_iInter] at hg + have := (hg (g^[n] a)).1 b hb + cases m with + | zero => + rw [← hm.antisymm (hgm.monotone (zero_le _))] + simpa [← Function.iterate_succ_apply'] using this + | succ m => + dsimp + rw [g.iterate_succ_apply'] + simp_rw [Set.mem_Ici, hgm.le_iff_le, Nat.succ_le_succ_iff] at hm + exact (hg _).1 _ (hb.trans_le <| hgm.monotone hm) + · use g^[n + 1] a; simp + theorem Order.IsNormal.isClub_fixedPoints {f : α → α} (hα : ℵ₀ < Order.cof α) (hf : Order.IsNormal f) : IsClub f.fixedPoints := by cases isEmpty_or_nonempty α; · simp @@ -102,3 +165,53 @@ theorem Order.IsNormal.isClub_fixedPoints {f : α → α} ⟨_, hf.iSup_iterate_mem_fixedPoints a this, le_csSup this ⟨0, rfl⟩⟩ refine .of_not_isCofinal fun h ↦ (Order.cof_le h).not_gt (hα.trans_le' ?_) simpa using mk_range_le_lift (f := fun n : ℕ ↦ f^[n] a) + +end WellFoundedLT + +/-! ### Stationary sets -/ + +/-- A set is called stationary when it intersects all club sets. -/ +def IsStationary (s : Set α) : Prop := + ∀ ⦃t⦄, IsClub t → (s ∩ t).Nonempty + +@[gcongr] +theorem IsStationary.mono (hs : IsStationary s) (h : s ⊆ t) : IsStationary t := + fun _u hu ↦ (hs hu).mono (Set.inter_subset_inter_left _ h) + +theorem IsStationary.nonempty (hs : IsStationary s) : s.Nonempty := by + simpa using hs .univ + +theorem isStationary_univ_iff : IsStationary (.univ (α := α)) ↔ Nonempty α := by + simp_rw [IsStationary, Set.univ_inter, ← not_imp_not (b := IsClub _), + Set.not_nonempty_iff_eq_empty, forall_eq, isClub_empty_iff, not_isEmpty_iff] + +@[simp] +theorem IsStationary.univ [Nonempty α] : IsStationary (.univ (α := α)) := + isStationary_univ_iff.2 ‹_› + +theorem IsStationary.of_not_isCofinal_compl (hs : ¬ IsCofinal (sᶜ)) : IsStationary s := by + rw [not_isCofinal_iff] at hs + intro t ht + obtain ⟨a, ha⟩ := hs + obtain ⟨b, hb, hb'⟩ := ht.isCofinal a + refine ⟨b, ?_, hb⟩ + contrapose! ha + exact ⟨b, ha, hb'⟩ + +proof_wanted isStationary_iff_not_isCofinal_compl (hα : Order.cof α ≤ ℵ₀) : + IsStationary s ↔ ¬ IsCofinal (sᶜ) + +/-- **Fodor's lemma:** if `α` has the order type of a regular cardinal, `s` is a stationary set, and +`f : s → α` is a regressive function, there exists some stationary subset of `s` which is constant +on `f`. -/ +theorem exists_isStationary_preimage_singleton [WellFoundedLT α] {f : s → α} + (hα' : ℵ₀ < Order.cof α) (hα : typeLT α ≤ (Order.cof α).ord) + (hs : IsStationary s) (hf : ∀ x : s, f x < x) : + ∃ a, IsStationary (Subtype.val '' (f ⁻¹' {a})) := by + unfold IsStationary + by_contra! + choose g hg using this + simp_rw [Set.eq_empty_iff_forall_notMem] at hg + obtain ⟨a, hs, ha⟩ := hs <| .diag hα' hα fun a ↦ (hg a).1 + apply (hg (f ⟨a, hs⟩)).2 a + simpa using ⟨hs, ha _ (hf ⟨a, hs⟩)⟩ From 88dbbf2a0088c4c247c2422a36055375770ab298 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Sun, 5 Apr 2026 21:52:04 -0600 Subject: [PATCH 09/93] alt name --- Mathlib/Order/Club.lean | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Mathlib/Order/Club.lean b/Mathlib/Order/Club.lean index 5a7fd55353bf3c..3673a6a0438d54 100644 --- a/Mathlib/Order/Club.lean +++ b/Mathlib/Order/Club.lean @@ -201,9 +201,9 @@ theorem IsStationary.of_not_isCofinal_compl (hs : ¬ IsCofinal (sᶜ)) : IsStati proof_wanted isStationary_iff_not_isCofinal_compl (hα : Order.cof α ≤ ℵ₀) : IsStationary s ↔ ¬ IsCofinal (sᶜ) -/-- **Fodor's lemma:** if `α` has the order type of a regular cardinal, `s` is a stationary set, and -`f : s → α` is a regressive function, there exists some stationary subset of `s` which is constant -on `f`. -/ +/-- **Fodor's lemma,** or the **pressing down lemma:** if `α` has the order type of a regular +cardinal, `s` is a stationary set, and `f : s → α` is a regressive function, there exists some +stationary subset of `s` which is constant on `f`. -/ theorem exists_isStationary_preimage_singleton [WellFoundedLT α] {f : s → α} (hα' : ℵ₀ < Order.cof α) (hα : typeLT α ≤ (Order.cof α).ord) (hs : IsStationary s) (hf : ∀ x : s, f x < x) : From 12f44abe75b1773d6014201e758facaf0d6a8fff Mon Sep 17 00:00:00 2001 From: vihdzp Date: Sun, 5 Apr 2026 23:31:09 -0600 Subject: [PATCH 10/93] golf --- Mathlib/Order/Club.lean | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Mathlib/Order/Club.lean b/Mathlib/Order/Club.lean index 3673a6a0438d54..e10e31e2a62457 100644 --- a/Mathlib/Order/Club.lean +++ b/Mathlib/Order/Club.lean @@ -143,21 +143,19 @@ theorem IsClub.diag {f : α → Set α} (hα' : ℵ₀ < Order.cof α) (hα : ty obtain ⟨_, ⟨n, rfl⟩, hb, hn⟩ := hg'.exists_between hb apply (hf b).isLUB_mem _ _ (hg'.inter_Ici_of_mem ⟨n + 1, rfl⟩) · rintro _ ⟨⟨m, rfl⟩, hm⟩ - simp_rw [Set.sInter_image, Set.mem_iInter] at hg - have := (hg (g^[n] a)).1 b hb + rw [Set.mem_Ici, hgm.le_iff_le, Nat.add_one_le_iff] at hm cases m with - | zero => - rw [← hm.antisymm (hgm.monotone (zero_le _))] - simpa [← Function.iterate_succ_apply'] using this + | zero => contradiction | succ m => dsimp rw [g.iterate_succ_apply'] - simp_rw [Set.mem_Ici, hgm.le_iff_le, Nat.succ_le_succ_iff] at hm + rw [Nat.lt_add_one_iff] at hm + simp_rw [Set.sInter_image, Set.mem_iInter] at hg exact (hg _).1 _ (hb.trans_le <| hgm.monotone hm) · use g^[n + 1] a; simp -theorem Order.IsNormal.isClub_fixedPoints {f : α → α} - (hα : ℵ₀ < Order.cof α) (hf : Order.IsNormal f) : IsClub f.fixedPoints := by +theorem Order.IsNormal.isClub_fixedPoints {f : α → α} (hα : ℵ₀ < cof α) (hf : IsNormal f) : + IsClub f.fixedPoints := by cases isEmpty_or_nonempty α; · simp refine ⟨fun s hs hs₀ _ a ha ↦ (hf.map_isLUB ha hs₀).unique ?_, fun a ↦ ?_⟩ · rwa [Set.image_congr hs, Set.image_id'] From cbd1de3dbc45c48339364a4662fad555dba73dc1 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Tue, 21 Apr 2026 19:53:07 -0600 Subject: [PATCH 11/93] move --- Mathlib.lean | 2 +- Mathlib/Order/Club.lean | 104 ---------------------------------------- 2 files changed, 1 insertion(+), 105 deletions(-) delete mode 100644 Mathlib/Order/Club.lean diff --git a/Mathlib.lean b/Mathlib.lean index bc8fbcb0d07dc3..58e6c9ab49a20e 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -5753,7 +5753,6 @@ public import Mathlib.Order.Category.Semilat public import Mathlib.Order.Circular public import Mathlib.Order.Circular.ZMod public import Mathlib.Order.Closure -public import Mathlib.Order.Club public import Mathlib.Order.Cofinal public import Mathlib.Order.CompactlyGenerated.Basic public import Mathlib.Order.CompactlyGenerated.Intervals @@ -6846,6 +6845,7 @@ public import Mathlib.RingTheory.ZariskisMainTheorem public import Mathlib.SetTheory.Cardinal.Aleph public import Mathlib.SetTheory.Cardinal.Arithmetic public import Mathlib.SetTheory.Cardinal.Basic +public import Mathlib.SetTheory.Cardinal.Club public import Mathlib.SetTheory.Cardinal.Cofinality public import Mathlib.SetTheory.Cardinal.Continuum public import Mathlib.SetTheory.Cardinal.CountableCover diff --git a/Mathlib/Order/Club.lean b/Mathlib/Order/Club.lean deleted file mode 100644 index 6105c15d661bb8..00000000000000 --- a/Mathlib/Order/Club.lean +++ /dev/null @@ -1,104 +0,0 @@ -/- -Copyright (c) 2026 Violeta Hernández Palacios. All rights reserved. -Released under Apache 2.0 license as described in the file LICENSE. -Authors: Violeta Hernández Palacios --/ -module - -public import Mathlib.SetTheory.Cardinal.Cofinality -public import Mathlib.Order.DirSupClosed - -/-! -# Club sets - -A subset of a well-ordered type `α` is called a club set when it is closed in the order topology and -cofinal. If `α` has no maximum, then an equivalent condition is that `α` is closed and unbounded; -hence the name. - -## Implementation notes - -To avoid importing topology in the ordinals, we spell out the closure property using `DirSupClosed`. -For any type equipped with the Scott-Hausdorff topology (which includes well-orders with the order -topology), `DirSupClosed s` and `IsClosed s` are equivalent predicates. --/ - -@[expose] public section - -universe u v - -open Cardinal - -/-- A club set is closed under suprema and cofinal. -/ -structure IsClub {α : Type*} [LinearOrder α] (s : Set α) where - /-- Club sets are closed under suprema. If `α` is a well-order with the order topology, this - condition is equivalent to `IsClosed s`. -/ - dirSupClosed : DirSupClosed s - /-- Club sets are cofinal. If `α` has no maximum, this condition is equivalent to `¬ BddAbove s`. - See `not_bddAbove_iff_isCofinal`. -/ - isCofinal : IsCofinal s - -variable {α : Type v} {s t : Set α} {x : α} [LinearOrder α] - -@[simp] -theorem IsClub.of_isEmpty [IsEmpty α] (s : Set α) : IsClub s := - ⟨.of_isEmpty s, .of_isEmpty s⟩ - -@[simp] -theorem IsClub.univ : IsClub (.univ (α := α)) := - ⟨.univ, .univ⟩ - --- Depends on #37304. -proof_wanted IsClub.union (hs : IsClub s) (ht : IsClub t) : IsClub (s ∪ t) - -theorem IsClub.isLUB_mem (hs : IsClub s) (ht : t ⊆ s) (ht₀ : t.Nonempty) (hx : IsLUB t x) : x ∈ s := - hs.dirSupClosed ht ht₀ (Std.Total.directedOn _) hx - -theorem IsClub.csSup_mem {α} [ConditionallyCompleteLinearOrder α] {s t : Set α} - (hs : IsClub s) (ht : t ⊆ s) (ht₀ : t.Nonempty) (ht₁ : BddAbove t) : sSup t ∈ s := - hs.isLUB_mem ht ht₀ (isLUB_csSup ht₀ ht₁) - -variable [WellFoundedLT α] - -attribute [local instance] - WellFoundedLT.toOrderBot WellFoundedLT.conditionallyCompleteLinearOrderBot - -theorem IsClub.sInter {s : Set (Set α)} (hα : ℵ₀ < Order.cof α) (hsα : #s < Order.cof α) - (hs : ∀ x ∈ s, IsClub x) : IsClub (⋂₀ s) := by - cases isEmpty_or_nonempty α; · simp - refine ⟨.sInter fun x hx ↦ (hs x hx).dirSupClosed, fun a ↦ ?_⟩ - choose f hf using fun x : s ↦ (hs _ x.2).isCofinal - let g : ℕ → α := Nat.rec a fun _ IH ↦ sSup (.range (f · IH)) - have hg : BddAbove (.range g) := by - refine .of_not_isCofinal fun hg ↦ (Order.cof_le hg).not_gt (hα.trans_le' ?_) - simpa using mk_range_le_lift (f := g) - refine ⟨_, fun t ht ↦ ?_, le_csSup hg ⟨0, rfl⟩⟩ - apply (hs t ht).isLUB_mem (t := .range fun n ↦ f ⟨t, ht⟩ (g n)) _ (Set.range_nonempty _) - · refine ⟨?_, fun b hb ↦ csSup_le' ?_⟩ <;> rintro _ ⟨n, rfl⟩ - · apply (le_csSup (.of_not_isCofinal _) _).trans (le_csSup hg ⟨n + 1, rfl⟩) - · exact fun hg' ↦ (Order.cof_le hg').not_gt (mk_range_le.trans_lt hsα) - · use ⟨t, ht⟩ - · exact (hf ⟨t, ht⟩ _).2.trans <| hb ⟨_, rfl⟩ - · grind - -theorem IsClub.iInter {ι : Type u} {f : ι → Set α} (hα : ℵ₀ < Order.cof α) - (hι : Cardinal.lift.{v} #ι < Cardinal.lift.{u} (Order.cof α)) (hf : ∀ i, IsClub (f i)) : - IsClub (⋂ i, f i) := by - rw [← Set.sInter_range] - refine IsClub.sInter hα ?_ (by simpa) - rw [← Cardinal.lift_lt] - exact mk_range_le_lift.trans_lt hι - -theorem IsClub.inter {s t : Set α} (hα : ℵ₀ < Order.cof α) (hs : IsClub s) (ht : IsClub t) : - IsClub (s ∩ t) := by - rw [← Set.sInter_pair] - exact IsClub.sInter hα (hα.trans_le' <| by simp) (by simp [hs, ht]) - -theorem Order.IsNormal.isClub_fixedPoints {f : α → α} - (hα : ℵ₀ < Order.cof α) (hf : Order.IsNormal f) : IsClub f.fixedPoints := by - cases isEmpty_or_nonempty α; · simp - refine ⟨fun s hs hs₀ _ a ha ↦ (hf.map_isLUB ha hs₀).unique ?_, fun a ↦ ?_⟩ - · rwa [Set.image_congr hs, Set.image_id'] - · suffices BddAbove (.range fun n ↦ f^[n] a) from - ⟨_, hf.iSup_iterate_mem_fixedPoints a this, le_csSup this ⟨0, rfl⟩⟩ - refine .of_not_isCofinal fun h ↦ (Order.cof_le h).not_gt (hα.trans_le' ?_) - simpa using mk_range_le_lift (f := fun n : ℕ ↦ f^[n] a) From 07729e23489b831b6192ea8812a9b62424df6da7 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Tue, 21 Apr 2026 19:56:38 -0600 Subject: [PATCH 12/93] fix --- Mathlib/SetTheory/Cardinal/Club.lean | 104 +++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 Mathlib/SetTheory/Cardinal/Club.lean diff --git a/Mathlib/SetTheory/Cardinal/Club.lean b/Mathlib/SetTheory/Cardinal/Club.lean new file mode 100644 index 00000000000000..6105c15d661bb8 --- /dev/null +++ b/Mathlib/SetTheory/Cardinal/Club.lean @@ -0,0 +1,104 @@ +/- +Copyright (c) 2026 Violeta Hernández Palacios. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Violeta Hernández Palacios +-/ +module + +public import Mathlib.SetTheory.Cardinal.Cofinality +public import Mathlib.Order.DirSupClosed + +/-! +# Club sets + +A subset of a well-ordered type `α` is called a club set when it is closed in the order topology and +cofinal. If `α` has no maximum, then an equivalent condition is that `α` is closed and unbounded; +hence the name. + +## Implementation notes + +To avoid importing topology in the ordinals, we spell out the closure property using `DirSupClosed`. +For any type equipped with the Scott-Hausdorff topology (which includes well-orders with the order +topology), `DirSupClosed s` and `IsClosed s` are equivalent predicates. +-/ + +@[expose] public section + +universe u v + +open Cardinal + +/-- A club set is closed under suprema and cofinal. -/ +structure IsClub {α : Type*} [LinearOrder α] (s : Set α) where + /-- Club sets are closed under suprema. If `α` is a well-order with the order topology, this + condition is equivalent to `IsClosed s`. -/ + dirSupClosed : DirSupClosed s + /-- Club sets are cofinal. If `α` has no maximum, this condition is equivalent to `¬ BddAbove s`. + See `not_bddAbove_iff_isCofinal`. -/ + isCofinal : IsCofinal s + +variable {α : Type v} {s t : Set α} {x : α} [LinearOrder α] + +@[simp] +theorem IsClub.of_isEmpty [IsEmpty α] (s : Set α) : IsClub s := + ⟨.of_isEmpty s, .of_isEmpty s⟩ + +@[simp] +theorem IsClub.univ : IsClub (.univ (α := α)) := + ⟨.univ, .univ⟩ + +-- Depends on #37304. +proof_wanted IsClub.union (hs : IsClub s) (ht : IsClub t) : IsClub (s ∪ t) + +theorem IsClub.isLUB_mem (hs : IsClub s) (ht : t ⊆ s) (ht₀ : t.Nonempty) (hx : IsLUB t x) : x ∈ s := + hs.dirSupClosed ht ht₀ (Std.Total.directedOn _) hx + +theorem IsClub.csSup_mem {α} [ConditionallyCompleteLinearOrder α] {s t : Set α} + (hs : IsClub s) (ht : t ⊆ s) (ht₀ : t.Nonempty) (ht₁ : BddAbove t) : sSup t ∈ s := + hs.isLUB_mem ht ht₀ (isLUB_csSup ht₀ ht₁) + +variable [WellFoundedLT α] + +attribute [local instance] + WellFoundedLT.toOrderBot WellFoundedLT.conditionallyCompleteLinearOrderBot + +theorem IsClub.sInter {s : Set (Set α)} (hα : ℵ₀ < Order.cof α) (hsα : #s < Order.cof α) + (hs : ∀ x ∈ s, IsClub x) : IsClub (⋂₀ s) := by + cases isEmpty_or_nonempty α; · simp + refine ⟨.sInter fun x hx ↦ (hs x hx).dirSupClosed, fun a ↦ ?_⟩ + choose f hf using fun x : s ↦ (hs _ x.2).isCofinal + let g : ℕ → α := Nat.rec a fun _ IH ↦ sSup (.range (f · IH)) + have hg : BddAbove (.range g) := by + refine .of_not_isCofinal fun hg ↦ (Order.cof_le hg).not_gt (hα.trans_le' ?_) + simpa using mk_range_le_lift (f := g) + refine ⟨_, fun t ht ↦ ?_, le_csSup hg ⟨0, rfl⟩⟩ + apply (hs t ht).isLUB_mem (t := .range fun n ↦ f ⟨t, ht⟩ (g n)) _ (Set.range_nonempty _) + · refine ⟨?_, fun b hb ↦ csSup_le' ?_⟩ <;> rintro _ ⟨n, rfl⟩ + · apply (le_csSup (.of_not_isCofinal _) _).trans (le_csSup hg ⟨n + 1, rfl⟩) + · exact fun hg' ↦ (Order.cof_le hg').not_gt (mk_range_le.trans_lt hsα) + · use ⟨t, ht⟩ + · exact (hf ⟨t, ht⟩ _).2.trans <| hb ⟨_, rfl⟩ + · grind + +theorem IsClub.iInter {ι : Type u} {f : ι → Set α} (hα : ℵ₀ < Order.cof α) + (hι : Cardinal.lift.{v} #ι < Cardinal.lift.{u} (Order.cof α)) (hf : ∀ i, IsClub (f i)) : + IsClub (⋂ i, f i) := by + rw [← Set.sInter_range] + refine IsClub.sInter hα ?_ (by simpa) + rw [← Cardinal.lift_lt] + exact mk_range_le_lift.trans_lt hι + +theorem IsClub.inter {s t : Set α} (hα : ℵ₀ < Order.cof α) (hs : IsClub s) (ht : IsClub t) : + IsClub (s ∩ t) := by + rw [← Set.sInter_pair] + exact IsClub.sInter hα (hα.trans_le' <| by simp) (by simp [hs, ht]) + +theorem Order.IsNormal.isClub_fixedPoints {f : α → α} + (hα : ℵ₀ < Order.cof α) (hf : Order.IsNormal f) : IsClub f.fixedPoints := by + cases isEmpty_or_nonempty α; · simp + refine ⟨fun s hs hs₀ _ a ha ↦ (hf.map_isLUB ha hs₀).unique ?_, fun a ↦ ?_⟩ + · rwa [Set.image_congr hs, Set.image_id'] + · suffices BddAbove (.range fun n ↦ f^[n] a) from + ⟨_, hf.iSup_iterate_mem_fixedPoints a this, le_csSup this ⟨0, rfl⟩⟩ + refine .of_not_isCofinal fun h ↦ (Order.cof_le h).not_gt (hα.trans_le' ?_) + simpa using mk_range_le_lift (f := fun n : ℕ ↦ f^[n] a) From 0bc5c75bff7036108cbedeb4fd1e57b04ca683e6 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Tue, 21 Apr 2026 19:58:29 -0600 Subject: [PATCH 13/93] rev --- Mathlib/Order/DirSupClosed.lean | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/Mathlib/Order/DirSupClosed.lean b/Mathlib/Order/DirSupClosed.lean index c1a8e079817582..e66a9411c869f3 100644 --- a/Mathlib/Order/DirSupClosed.lean +++ b/Mathlib/Order/DirSupClosed.lean @@ -167,31 +167,8 @@ lemma DirSupInaccOn.union (hs : DirSupInaccOn D s) (ht : DirSupInaccOn D t) : lemma DirSupInacc.union (hs : DirSupInacc s) (ht : DirSupInacc t) : DirSupInacc (s ∪ t) := by simpa using hs.dirSupInaccOn.union ht.dirSupInaccOn (D := .univ) -lemma IsUpperSet.dirSupClosedOn (hs : IsUpperSet s) : DirSupClosedOn D s := - fun _d _ hds ⟨_b, hb⟩ _ _a ha ↦ hs (ha.1 hb) <| hds hb - lemma IsUpperSet.dirSupClosed (hs : IsUpperSet s) : DirSupClosed s := - by simpa using hs.dirSupClosedOn (D := univ) - -lemma IsLowerSet.dirSupInaccOn (hs : IsLowerSet s) : DirSupInaccOn D s := - hs.compl.dirSupClosedOn.of_compl - -lemma IsLowerSet.dirSupInacc (hs : IsLowerSet s) : DirSupInacc s := - hs.compl.dirSupClosed.of_compl - -theorem isLUB_congr_of_antisymmRel {a b : α} (h : AntisymmRel (· ≤ ·) a b) : - IsLUB s a ↔ IsLUB s b := by - simp [isLUB_iff_le_iff, h.le_congr_left] - -private theorem DirSupClosed.mem_imp_of_antisymmRel (hs : DirSupClosed s) {a b : α} - (h : AntisymmRel (· ≤ ·) a b) (ha : a ∈ s) : b ∈ s := by - apply hs (singleton_subset_iff.2 ha) ⟨a, rfl⟩ (directedOn_singleton Std.Refl.refl a) - rw [← isLUB_congr_of_antisymmRel h] - exact isLUB_singleton - -theorem DirSupClosed.mem_iff_of_antisymmRel (hs : DirSupClosed s) {a b : α} - (h : AntisymmRel (· ≤ ·) a b) : a ∈ s ↔ b ∈ s := - ⟨hs.mem_imp_of_antisymmRel h, hs.mem_imp_of_antisymmRel h.symm⟩ + fun _d hds ⟨_b, hb⟩ _ _a ha ↦ hs (ha.1 hb) <| hds hb lemma IsUpperSet.dirSupClosedOn (hs : IsUpperSet s) : DirSupClosedOn D s := hs.dirSupClosed.dirSupClosedOn From 6c6ea022324f1a3040f493512502f31b5361dd60 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Tue, 21 Apr 2026 20:49:15 -0600 Subject: [PATCH 14/93] generalize thms --- Mathlib/SetTheory/Cardinal/Club.lean | 41 +++++++++++++++++++--- Mathlib/SetTheory/Cardinal/Cofinality.lean | 4 +++ 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/Mathlib/SetTheory/Cardinal/Club.lean b/Mathlib/SetTheory/Cardinal/Club.lean index 6105c15d661bb8..228c8f6b8d547e 100644 --- a/Mathlib/SetTheory/Cardinal/Club.lean +++ b/Mathlib/SetTheory/Cardinal/Club.lean @@ -57,14 +57,41 @@ theorem IsClub.csSup_mem {α} [ConditionallyCompleteLinearOrder α] {s t : Set (hs : IsClub s) (ht : t ⊆ s) (ht₀ : t.Nonempty) (ht₁ : BddAbove t) : sSup t ∈ s := hs.isLUB_mem ht ht₀ (isLUB_csSup ht₀ ht₁) +theorem IsClub.sInter_of_orderTop {s : Set (Set α)} [OrderTop α] + (hs : ∀ x ∈ s, IsClub x) : IsClub (⋂₀ s) := by + refine ⟨.sInter fun x hx ↦ (hs x hx).dirSupClosed, ?_⟩ + rw [isCofinal_iff_top_mem, Set.mem_sInter] + exact fun x hx ↦ (hs x hx).isCofinal.top_mem + +theorem IsClub.iInter_of_orderTop {ι : Type*} {f : ι → Set α} [OrderTop α] + (hs : ∀ i, IsClub (f i)) : IsClub (⋂ i, f i) := by + rw [← Set.sInter_range] + exact .sInter_of_orderTop (by simpa) + +theorem IsClub.sInter_of_cof_le_one {s : Set (Set α)} (hα : Order.cof α ≤ 1) + (hs : ∀ x ∈ s, IsClub x) : IsClub (⋂₀ s) := by + cases isEmpty_or_nonempty α; · simp + cases topOrderOrNoTopOrder α + · exact .sInter_of_orderTop hs + · cases (Order.one_lt_cof.trans_le hα).false + +theorem IsClub.iInter_of_cof_le_one {ι : Type*} {f : ι → Set α} (hα : Order.cof α ≤ 1) + (hs : ∀ i, IsClub (f i)) : IsClub (⋂ i, f i) := by + rw [← Set.sInter_range] + exact .sInter_of_cof_le_one hα (by simpa) + +section WellFoundedLT + variable [WellFoundedLT α] attribute [local instance] WellFoundedLT.toOrderBot WellFoundedLT.conditionallyCompleteLinearOrderBot -theorem IsClub.sInter {s : Set (Set α)} (hα : ℵ₀ < Order.cof α) (hsα : #s < Order.cof α) +theorem IsClub.sInter {s : Set (Set α)} (hα : Order.cof α ≠ ℵ₀) (hsα : #s < Order.cof α) (hs : ∀ x ∈ s, IsClub x) : IsClub (⋂₀ s) := by cases isEmpty_or_nonempty α; · simp + obtain hα | hα := hα.lt_or_gt + · exact .sInter_of_cof_le_one (Order.cof_lt_aleph0_iff.1 hα) hs refine ⟨.sInter fun x hx ↦ (hs x hx).dirSupClosed, fun a ↦ ?_⟩ choose f hf using fun x : s ↦ (hs _ x.2).isCofinal let g : ℕ → α := Nat.rec a fun _ IH ↦ sSup (.range (f · IH)) @@ -80,7 +107,7 @@ theorem IsClub.sInter {s : Set (Set α)} (hα : ℵ₀ < Order.cof α) (hsα : # · exact (hf ⟨t, ht⟩ _).2.trans <| hb ⟨_, rfl⟩ · grind -theorem IsClub.iInter {ι : Type u} {f : ι → Set α} (hα : ℵ₀ < Order.cof α) +theorem IsClub.iInter {ι : Type u} {f : ι → Set α} (hα : Order.cof α ≠ ℵ₀) (hι : Cardinal.lift.{v} #ι < Cardinal.lift.{u} (Order.cof α)) (hf : ∀ i, IsClub (f i)) : IsClub (⋂ i, f i) := by rw [← Set.sInter_range] @@ -88,10 +115,14 @@ theorem IsClub.iInter {ι : Type u} {f : ι → Set α} (hα : ℵ₀ < Order.co rw [← Cardinal.lift_lt] exact mk_range_le_lift.trans_lt hι -theorem IsClub.inter {s t : Set α} (hα : ℵ₀ < Order.cof α) (hs : IsClub s) (ht : IsClub t) : +theorem IsClub.inter {s t : Set α} (hα : Order.cof α ≠ ℵ₀) (hs : IsClub s) (ht : IsClub t) : IsClub (s ∩ t) := by rw [← Set.sInter_pair] - exact IsClub.sInter hα (hα.trans_le' <| by simp) (by simp [hs, ht]) + have H : ∀ x ∈ ({s, t} : Set _), IsClub x := by simpa [hs] + obtain hα | hα' := hα.lt_or_gt + · rw [Order.cof_lt_aleph0_iff] at hα + exact .sInter_of_cof_le_one hα H + · exact .sInter hα (hα'.trans_le' <| by simp) H theorem Order.IsNormal.isClub_fixedPoints {f : α → α} (hα : ℵ₀ < Order.cof α) (hf : Order.IsNormal f) : IsClub f.fixedPoints := by @@ -102,3 +133,5 @@ theorem Order.IsNormal.isClub_fixedPoints {f : α → α} ⟨_, hf.iSup_iterate_mem_fixedPoints a this, le_csSup this ⟨0, rfl⟩⟩ refine .of_not_isCofinal fun h ↦ (Order.cof_le h).not_gt (hα.trans_le' ?_) simpa using mk_range_le_lift (f := fun n : ℕ ↦ f^[n] a) + +end WellFoundedLT diff --git a/Mathlib/SetTheory/Cardinal/Cofinality.lean b/Mathlib/SetTheory/Cardinal/Cofinality.lean index d071036b42ae89..2e99c56be80df5 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality.lean @@ -163,6 +163,10 @@ theorem cof_lt_aleph0_iff : Order.cof α < ℵ₀ ↔ Order.cof α ≤ 1 := by theorem aleph0_le_cof_iff : ℵ₀ ≤ Order.cof α ↔ 1 < Order.cof α := by simp [← not_lt] +@[simp] +theorem aleph0_le_cof [Nonempty α] [NoMaxOrder α] : ℵ₀ ≤ cof α := by + rw [aleph0_le_cof_iff]; exact one_lt_cof + @[simp] theorem cof_eq_aleph0 [NoMaxOrder α] [Nonempty α] [Countable α] : cof α = ℵ₀ := ((cof_le_cardinalMk _).trans mk_le_aleph0).antisymm (by simp) From aa246e3a0e9949cce41d573e98612c36e17df395 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Tue, 21 Apr 2026 20:49:43 -0600 Subject: [PATCH 15/93] golf --- Mathlib/SetTheory/Cardinal/Club.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/SetTheory/Cardinal/Club.lean b/Mathlib/SetTheory/Cardinal/Club.lean index 228c8f6b8d547e..5bd943500135ec 100644 --- a/Mathlib/SetTheory/Cardinal/Club.lean +++ b/Mathlib/SetTheory/Cardinal/Club.lean @@ -73,7 +73,7 @@ theorem IsClub.sInter_of_cof_le_one {s : Set (Set α)} (hα : Order.cof α ≤ 1 cases isEmpty_or_nonempty α; · simp cases topOrderOrNoTopOrder α · exact .sInter_of_orderTop hs - · cases (Order.one_lt_cof.trans_le hα).false + · cases Order.one_lt_cof.not_ge hα theorem IsClub.iInter_of_cof_le_one {ι : Type*} {f : ι → Set α} (hα : Order.cof α ≤ 1) (hs : ∀ i, IsClub (f i)) : IsClub (⋂ i, f i) := by From de6f64833e95f7f1fe6591a6e56a24d111585c45 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Tue, 21 Apr 2026 21:53:20 -0600 Subject: [PATCH 16/93] fix --- Mathlib/SetTheory/Cardinal/Cofinality.lean | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Mathlib/SetTheory/Cardinal/Cofinality.lean b/Mathlib/SetTheory/Cardinal/Cofinality.lean index 2e99c56be80df5..1440b43042421d 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality.lean @@ -163,9 +163,8 @@ theorem cof_lt_aleph0_iff : Order.cof α < ℵ₀ ↔ Order.cof α ≤ 1 := by theorem aleph0_le_cof_iff : ℵ₀ ≤ Order.cof α ↔ 1 < Order.cof α := by simp [← not_lt] -@[simp] theorem aleph0_le_cof [Nonempty α] [NoMaxOrder α] : ℵ₀ ≤ cof α := by - rw [aleph0_le_cof_iff]; exact one_lt_cof + simp @[simp] theorem cof_eq_aleph0 [NoMaxOrder α] [Nonempty α] [Countable α] : cof α = ℵ₀ := From ead304bfe592d4de8fc3191c19ae7fa13c0b3764 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Tue, 21 Apr 2026 22:00:17 -0600 Subject: [PATCH 17/93] fix --- Mathlib/SetTheory/Cardinal/Cofinality.lean | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Mathlib/SetTheory/Cardinal/Cofinality.lean b/Mathlib/SetTheory/Cardinal/Cofinality.lean index 2e99c56be80df5..1440b43042421d 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality.lean @@ -163,9 +163,8 @@ theorem cof_lt_aleph0_iff : Order.cof α < ℵ₀ ↔ Order.cof α ≤ 1 := by theorem aleph0_le_cof_iff : ℵ₀ ≤ Order.cof α ↔ 1 < Order.cof α := by simp [← not_lt] -@[simp] theorem aleph0_le_cof [Nonempty α] [NoMaxOrder α] : ℵ₀ ≤ cof α := by - rw [aleph0_le_cof_iff]; exact one_lt_cof + simp @[simp] theorem cof_eq_aleph0 [NoMaxOrder α] [Nonempty α] [Countable α] : cof α = ℵ₀ := From 00434009141c84743b7b0992b0cd1f54243dc218 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Wed, 22 Apr 2026 01:32:53 -0600 Subject: [PATCH 18/93] changes --- Mathlib.lean | 2 + .../Presentable/IsCardinalFiltered.lean | 2 +- Mathlib/LinearAlgebra/Dimension/Finite.lean | 2 +- Mathlib/Order/BoundedOrder/Basic.lean | 8 + Mathlib/Order/Filter/Cocardinal.lean | 2 +- Mathlib/SetTheory/Cardinal/Aleph.lean | 6 + Mathlib/SetTheory/Cardinal/Cofinality.lean | 827 +----------------- Mathlib/SetTheory/Cardinal/Regular.lean | 2 +- Mathlib/SetTheory/Ordinal/Basic.lean | 2 +- Mathlib/SetTheory/Ordinal/Enum.lean | 70 +- .../Ordinal/FundamentalSequence.lean | 2 +- 11 files changed, 93 insertions(+), 832 deletions(-) diff --git a/Mathlib.lean b/Mathlib.lean index 4c2d2eba135003..51fc639f3b7b2f 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -6890,6 +6890,8 @@ public import Mathlib.SetTheory.Cardinal.Aleph public import Mathlib.SetTheory.Cardinal.Arithmetic public import Mathlib.SetTheory.Cardinal.Basic public import Mathlib.SetTheory.Cardinal.Cofinality +public import Mathlib.SetTheory.Cardinal.Cofinality.Defs +public import Mathlib.SetTheory.Cardinal.Cofinality.Ordinal public import Mathlib.SetTheory.Cardinal.Continuum public import Mathlib.SetTheory.Cardinal.CountableCover public import Mathlib.SetTheory.Cardinal.Defs diff --git a/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean b/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean index 0f4a06aa09291c..1bf553db88813f 100644 --- a/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean +++ b/Mathlib/CategoryTheory/Presentable/IsCardinalFiltered.lean @@ -8,7 +8,7 @@ module public import Mathlib.CategoryTheory.Filtered.Final public import Mathlib.CategoryTheory.Limits.Shapes.WideEqualizers public import Mathlib.CategoryTheory.Comma.CardinalArrow -public import Mathlib.SetTheory.Cardinal.Cofinality +public import Mathlib.SetTheory.Cardinal.Cofinality.Ordinal public import Mathlib.SetTheory.Cardinal.HasCardinalLT public import Mathlib.SetTheory.Cardinal.Arithmetic diff --git a/Mathlib/LinearAlgebra/Dimension/Finite.lean b/Mathlib/LinearAlgebra/Dimension/Finite.lean index fd04e5a7ed10d8..0ffa7cd3a87e2c 100644 --- a/Mathlib/LinearAlgebra/Dimension/Finite.lean +++ b/Mathlib/LinearAlgebra/Dimension/Finite.lean @@ -9,7 +9,7 @@ public import Mathlib.LinearAlgebra.Dimension.Constructions public import Mathlib.LinearAlgebra.Dimension.StrongRankCondition public import Mathlib.LinearAlgebra.Dimension.Subsingleton public import Mathlib.LinearAlgebra.FreeModule.Finite.Basic -public import Mathlib.SetTheory.Cardinal.Cofinality +public import Mathlib.SetTheory.Cardinal.Cofinality.Ordinal /-! # Conditions for rank to be finite diff --git a/Mathlib/Order/BoundedOrder/Basic.lean b/Mathlib/Order/BoundedOrder/Basic.lean index a4ef0b62357b2d..2f7431b0e28a87 100644 --- a/Mathlib/Order/BoundedOrder/Basic.lean +++ b/Mathlib/Order/BoundedOrder/Basic.lean @@ -313,6 +313,14 @@ end Pi section Subsingleton +/-- A type with a single element is a bounded order. -/ +@[implicit_reducible] +def BoundedOrder.ofUnique (α : Type*) [Preorder α] [Unique α] : BoundedOrder α where + bot := default + top := default + le_top := by simp + bot_le := by simp + variable [PartialOrder α] [BoundedOrder α] @[to_dual] diff --git a/Mathlib/Order/Filter/Cocardinal.lean b/Mathlib/Order/Filter/Cocardinal.lean index abb0f750c12bfb..c783b9c7c598e6 100644 --- a/Mathlib/Order/Filter/Cocardinal.lean +++ b/Mathlib/Order/Filter/Cocardinal.lean @@ -9,7 +9,7 @@ public import Mathlib.Order.Filter.Cofinite public import Mathlib.Order.Filter.CountableInter public import Mathlib.Order.Filter.CardinalInter public import Mathlib.SetTheory.Cardinal.Arithmetic -public import Mathlib.SetTheory.Cardinal.Cofinality +public import Mathlib.SetTheory.Cardinal.Cofinality.Ordinal /-! # The cocardinal filter diff --git a/Mathlib/SetTheory/Cardinal/Aleph.lean b/Mathlib/SetTheory/Cardinal/Aleph.lean index 4e6160239a1757..427c3430d69709 100644 --- a/Mathlib/SetTheory/Cardinal/Aleph.lean +++ b/Mathlib/SetTheory/Cardinal/Aleph.lean @@ -302,6 +302,12 @@ theorem _root_.Ordinal.type_lt_cardinal : typeLT Cardinal = Ordinal.univ.{u, u + theorem mk_cardinal : #Cardinal = univ.{u, u + 1} := by simpa only [card_type, card_univ] using congr_arg card type_lt_cardinal +@[simp] +theorem _root_.Order.cof_cardinal : Order.cof Cardinal.{u} = Cardinal.univ.{u, u + 1} := by + rw [← preAleph.cof_congr, Order.cof_ordinal] + +instance : IsRegularCardinalOrder Cardinal := ⟨by simp⟩ + theorem preAleph_lt_preAleph {o₁ o₂ : Ordinal} : preAleph o₁ < preAleph o₂ ↔ o₁ < o₂ := preAleph.lt_iff_lt diff --git a/Mathlib/SetTheory/Cardinal/Cofinality.lean b/Mathlib/SetTheory/Cardinal/Cofinality.lean index d071036b42ae89..5ebd227c4d66f6 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality.lean @@ -5,829 +5,6 @@ Authors: Mario Carneiro, Floris van Doorn, Violeta Hernández Palacios -/ module -public import Mathlib.Order.Cofinal -public import Mathlib.SetTheory.Cardinal.Arithmetic -public import Mathlib.SetTheory.Ordinal.FixedPoint +public import Mathlib.SetTheory.Cardinal.Cofinality.Ordinal -/-! -# Cofinality - -This file contains the definition of cofinality of an order and an ordinal number. - -## Main Definitions - -* `Order.cof α` is the cofinality of a preorder. This is the smallest cardinality of a cofinal - subset. -* `Ordinal.cof o` is the cofinality of the ordinal `o` when viewed as a linear order. - -## Main Statements - -* `Cardinal.lt_power_cof_ord`: A consequence of König's theorem stating that `c < c ^ c.ord.cof` for - `c ≥ ℵ₀`. - -## Implementation Notes - -* The cofinality is defined for ordinals. - If `c` is a cardinal number, its cofinality is `c.ord.cof`. --/ - -public noncomputable section - -open Function Cardinal Set Order -open scoped Ordinal - -universe u v w - -variable {α γ : Type u} {β : Type v} - -/-! ### Cofinality of orders -/ - -namespace Order -section Preorder -variable [Preorder α] - -variable (α) in -/-- The cofinality of a preorder is the smallest cardinality of a cofinal subset. -/ -def cof : Cardinal := - ⨅ s : {s : Set α // IsCofinal s}, #s - -theorem cof_le {s : Set α} (h : IsCofinal s) : cof α ≤ #s := - ciInf_le' (ι := {s : Set α // IsCofinal s}) _ ⟨s, h⟩ - -theorem le_lift_cof_iff {c : Cardinal.{max u v}} : - c ≤ lift.{v} (cof α) ↔ ∀ s : Set α, IsCofinal s → c ≤ lift.{v} #s := by - rw [cof, lift_iInf, le_ciInf_iff'] - simp - -theorem le_cof_iff {c : Cardinal} : c ≤ cof α ↔ ∀ s : Set α, IsCofinal s → c ≤ #s := by - simpa using @le_lift_cof_iff.{u, u} α _ c - -@[deprecated (since := "2026-02-18")] alias le_cof := le_cof_iff - -variable (α) in -theorem 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⟩ - -variable (α) in -theorem cof_le_cardinalMk : cof α ≤ #α := - cof_le .univ |>.trans_eq mk_univ - -theorem cof_eq_zero_iff : cof α = 0 ↔ IsEmpty α := by - refine ⟨fun _ ↦ ?_, fun _ ↦ by simp [cof]⟩ - obtain ⟨s, hs, hs'⟩ := cof_eq α - simp_all [mk_eq_zero_iff, isCofinal_empty_iff] - -@[simp] -theorem cof_eq_zero [h : IsEmpty α] : cof α = 0 := - cof_eq_zero_iff.2 h - -theorem cof_ne_zero_iff : cof α ≠ 0 ↔ Nonempty α := by - simpa using cof_eq_zero_iff.not - -@[simp] -theorem cof_ne_zero [h : Nonempty α] : cof α ≠ 0 := - cof_ne_zero_iff.2 h - -theorem cof_eq_one_iff : cof α = 1 ↔ ∃ x : α, IsTop x := by - refine ⟨fun h ↦ ?_, fun ⟨t, ht⟩ ↦ ?_⟩ - · obtain ⟨s, hs, hs'⟩ := cof_eq α - rw [h, mk_set_eq_one_iff] at hs' - obtain ⟨t, rfl⟩ := hs' - use t - rwa [isCofinal_singleton_iff] at hs - · apply le_antisymm - · apply (cof_le (s := {t}) _).trans_eq (mk_singleton _) - rwa [isCofinal_singleton_iff] - · rw [Cardinal.one_le_iff_ne_zero, cof_ne_zero_iff] - use t - -@[simp] -theorem cof_eq_one [OrderTop α] : cof α = 1 := - cof_eq_one_iff.2 ⟨⊤, isTop_top⟩ - -theorem cof_ne_one_iff : cof α ≠ 1 ↔ NoTopOrder α := by - rw [← not_iff_not, not_not, noTopOrder_iff, cof_eq_one_iff] - simp - -@[simp] -theorem cof_ne_one [h : NoTopOrder α] : cof α ≠ 1 := - cof_ne_one_iff.2 h - -theorem cof_le_one_iff [Nonempty α] : cof α ≤ 1 ↔ ∃ x : α, IsTop x := by - rw [le_iff_lt_or_eq, Cardinal.lt_one_iff, cof_eq_one_iff] - simp - -theorem one_lt_cof_iff [Nonempty α] : 1 < cof α ↔ NoTopOrder α := by - rw [← not_iff_not, not_lt, noTopOrder_iff, cof_le_one_iff] - simp - -@[simp] -theorem one_lt_cof [Nonempty α] [h : NoTopOrder α] : 1 < cof α := - one_lt_cof_iff.2 h - -end Preorder - -section LinearOrder -variable [LinearOrder α] [LinearOrder β] [LinearOrder γ] - -theorem lift_cof_congr_of_strictMono {f : α → β} (hf : StrictMono f) (hf' : IsCofinal (range f)) : - lift.{v} (cof α) = lift.{u} (cof β) := by - apply le_antisymm <;> rw [le_lift_cof_iff] <;> intro s hs - · have H (x : s) : ∃ y : α, x ≤ f y := by simpa using hf' x - choose g hg using H - refine (lift_le.2 <| cof_le (s := range g) fun a ↦ ?_).trans mk_range_le_lift - obtain ⟨_, ⟨b, rfl⟩, hb⟩ := hf' (f a) - obtain ⟨c, hc, hc'⟩ := hs (f b) - refine ⟨_, Set.mem_range_self ⟨c, hc⟩, ?_⟩ - rw [← hf.le_iff_le] - exact hb.trans (hc'.trans (hg ⟨c, hc⟩)) - · exact (lift_le.2 <| cof_le (hs.image hf.monotone hf')).trans mk_image_le_lift - -theorem cof_congr_of_strictMono {f : α → γ} (hf : StrictMono f) (hf' : IsCofinal (range f)) : - cof α = cof γ := by - simpa using lift_cof_congr_of_strictMono hf hf' - -@[simp] -theorem cof_lt_aleph0_iff : Order.cof α < ℵ₀ ↔ Order.cof α ≤ 1 := by - refine ⟨fun h ↦ ?_, (lt_of_le_of_lt · one_lt_aleph0)⟩ - obtain ⟨s, hs, hs'⟩ := Order.cof_eq α - have hf : s.Finite := by - rw [Set.Finite, ← mk_lt_aleph0_iff] - exact hs'.trans_lt h - obtain ⟨t, ht, ht'⟩ := hf.exists_subsingleton_isCofinal hs - apply (cof_le ht').trans - simpa - -@[simp] -theorem aleph0_le_cof_iff : ℵ₀ ≤ Order.cof α ↔ 1 < Order.cof α := by - simp [← not_lt] - -@[simp] -theorem cof_eq_aleph0 [NoMaxOrder α] [Nonempty α] [Countable α] : cof α = ℵ₀ := - ((cof_le_cardinalMk _).trans mk_le_aleph0).antisymm (by simp) - -theorem cof_nat : cof ℕ = ℵ₀ := by simp -theorem cof_int : cof ℤ = ℵ₀ := by simp - -end LinearOrder -end Order - -section Congr -variable [Preorder α] [Preorder β] [Preorder γ] - -theorem GaloisConnection.cof_le_lift {f : β → α} {g : α → β} (h : GaloisConnection f g) : - Cardinal.lift.{u} (Order.cof β) ≤ Cardinal.lift.{v} (Order.cof α) := by - rw [le_lift_cof_iff] - exact fun s hs ↦ (lift_le.2 <| cof_le (h.map_isCofinal hs)).trans mk_image_le_lift - -theorem GaloisConnection.cof_le {f : γ → α} {g : α → γ} (h : GaloisConnection f g) : - Order.cof γ ≤ Order.cof α := by - simpa using h.cof_le_lift - -theorem OrderIso.lift_cof_congr (f : α ≃o β) : - Cardinal.lift.{v} (Order.cof α) = Cardinal.lift.{u} (Order.cof β) := - f.to_galoisConnection.cof_le_lift.antisymm (f.symm.to_galoisConnection.cof_le_lift) - -@[deprecated (since := "2026-03-20")] alias OrderIso.lift_cof_eq := OrderIso.lift_cof_congr - -theorem OrderIso.cof_congr (f : α ≃o γ) : Order.cof α = Order.cof γ := by - simpa using f.lift_cof_congr - -@[deprecated (since := "2026-03-20")] alias OrderIso.cof_eq := OrderIso.cof_congr - -@[deprecated (since := "2026-02-18")] alias RelIso.cof_eq_lift := OrderIso.lift_cof_congr -@[deprecated (since := "2026-02-18")] alias RelIso.cof_eq := OrderIso.cof_congr - -end Congr - -/-- If the union of `s` is cofinal and `s` is smaller than the cofinality, then `s` has a cofinal -member. -/ -theorem isCofinal_of_isCofinal_sUnion {α : Type*} [LinearOrder α] {s : Set (Set α)} - (h₁ : IsCofinal (⋃₀ s)) (h₂ : #s < Order.cof α) : ∃ x ∈ s, IsCofinal x := by - contrapose! h₂ - simp_rw [not_isCofinal_iff] at h₂ - choose f hf using h₂ - refine (cof_le (s := range fun x ↦ f x.1 x.2) fun a ↦ ?_).trans mk_range_le - obtain ⟨b, ⟨t, ht, hb⟩, hab⟩ := h₁ a - simpa using ⟨t, ht, hab.trans (hf t ht b hb).le⟩ - -/-- If the union of the `ι`-indexed family `s` is cofinal and `ι` is smaller than the cofinality, -then `s` has a cofinal member. -/ -theorem isCofinal_of_isCofinal_iUnion {α : Type*} {ι} [LinearOrder α] {s : ι → Set α} - (h₁ : IsCofinal (⋃ i, s i)) (h₂ : #ι < Order.cof α) : ∃ i, IsCofinal (s i) := by - rw [← sUnion_range] at h₁ - obtain ⟨_, ⟨i, rfl⟩, h⟩ := isCofinal_of_isCofinal_sUnion h₁ (mk_range_le.trans_lt h₂) - exact ⟨i, h⟩ - -/-! ### Cofinality of ordinals -/ - --- TODO: generalize to `OrderType` -namespace Ordinal - -/-- The cofinality on an ordinal is the `Order.cof` of any isomorphic linear order. - -In particular, `cof 0 = 0` and `cof (succ o) = 1`. -/ -def cof (o : Ordinal.{u}) : Cardinal.{u} := - o.liftOnWellOrder (fun α _ _ ↦ Order.cof α) fun _ _ _ _ _ _ h ↦ - let ⟨f⟩ := type_eq.1 h - (OrderIso.ofRelIsoLT f).cof_congr - -@[simp] -theorem cof_type (α : Type*) [LinearOrder α] [WellFoundedLT α] : - (typeLT α).cof = Order.cof α := - liftOnWellOrder_type .. - -@[deprecated (since := "2026-02-18")] alias cof_type_lt := cof_type - -@[simp] -theorem cof_toType (o : Ordinal) : Order.cof o.ToType = o.cof := by - conv_rhs => rw [← type_toType o, cof_type] - -@[deprecated (since := "2026-02-18")] alias cof_eq_cof_toType := cof_toType -@[deprecated (since := "2026-02-18")] alias le_cof_type := le_cof_iff -@[deprecated (since := "2026-02-18")] alias cof_type_le := cof_le -@[deprecated (since := "2026-02-18")] alias lt_cof_type := cof_le -@[deprecated (since := "2026-02-18")] alias cof_eq := Order.cof_eq - -@[simp] -theorem lift_cof (o : Ordinal.{u}) : Cardinal.lift.{v} (cof o) = cof (Ordinal.lift.{v} o) := by - cases o using inductionOnWellOrder with | type α - rw [cof_type, ← type_lt_ulift, cof_type, ← Cardinal.lift_id'.{u, v} (Order.cof (ULift _)), - ← Cardinal.lift_umax, ← ULift.orderIso.lift_cof_congr] - -theorem _root_.Order.cof_Iio [LinearOrder α] [WellFoundedLT α] (x : α) : - Order.cof (Iio x) = cof (typein (α := α) (· < ·) x) := - (cof_type _).symm - -@[simp] -theorem cof_Iio (o : Ordinal.{u}) : Order.cof (Iio o) = cof (lift.{u + 1} o) := by - rw [Order.cof_Iio, typein_ordinal] - -theorem cof_le_card (o : Ordinal) : cof o ≤ card o := by - simpa using cof_le_cardinalMk o.ToType - -theorem cof_ord_le (c : Cardinal) : c.ord.cof ≤ c := by - simpa using cof_le_card c.ord - -theorem ord_cof_le (o : Ordinal) : o.cof.ord ≤ o := - (ord_le_ord.2 (cof_le_card o)).trans (ord_card_le o) - -@[simp] -theorem cof_eq_zero {o} : cof o = 0 ↔ o = 0 := by - rw [← cof_toType, cof_eq_zero_iff, isEmpty_toType_iff] - -@[deprecated cof_eq_zero (since := "2026-02-18")] -theorem cof_ne_zero {o} : cof o ≠ 0 ↔ o ≠ 0 := - cof_eq_zero.not - -@[simp] -theorem cof_pos {o} : 0 < cof o ↔ 0 < o := by - simp [pos_iff_ne_zero] - -@[simp] -theorem cof_zero : cof 0 = 0 := - cof_eq_zero.2 rfl - -theorem cof_eq_one_iff {o} : cof o = 1 ↔ o ∈ range succ := by - cases o using inductionOnWellOrder with | type α - rw [cof_type, Order.cof_eq_one_iff, type_lt_mem_range_succ_iff] - simp_rw [isTop_iff_isMax] - -theorem cof_add_one (o) : cof (o + 1) = 1 := - cof_eq_one_iff.2 (mem_range_self o) - -@[simp] -theorem cof_one : cof 1 = 1 := by - simpa using cof_add_one 0 - --- TODO: deprecate in favor of `cof_add_one` -theorem cof_succ (o) : cof (succ o) = 1 := - cof_add_one o - -theorem one_lt_cof_iff {o : Ordinal} : 1 < cof o ↔ IsSuccLimit o := by - rw [← not_iff_not, not_lt, Cardinal.le_one_iff, isSuccLimit_iff, - not_and_or, not_ne_iff, not_isSuccPrelimit_iff', cof_eq_zero, cof_eq_one_iff] - -@[simp] -theorem cof_lt_aleph0_iff {o : Ordinal} : cof o < ℵ₀ ↔ cof o ≤ 1 := by - simpa using Order.cof_lt_aleph0_iff (α := o.ToType) - -@[simp] -theorem aleph0_le_cof_iff {o : Ordinal} : ℵ₀ ≤ cof o ↔ 1 < cof o := by - simp [← not_lt] - -@[deprecated one_lt_cof_iff (since := "2026-03-22")] -theorem aleph0_le_cof {o} : ℵ₀ ≤ cof o ↔ IsSuccLimit o := by - rw [aleph0_le_cof_iff, one_lt_cof_iff] - -/-- A countable limit ordinal has cofinality `ℵ₀`. -/ -theorem cof_eq_aleph0_of_isSuccLimit {o : Ordinal} (ho : IsSuccLimit o) (ho' : o < ω₁) : - cof o = ℵ₀ := by - apply ((cof_le_card _).trans _).antisymm - · rwa [aleph0_le_cof_iff, one_lt_cof_iff] - · rwa [card_le_iff, succ_aleph0, ord_aleph] - -@[simp] -theorem cof_omega0 : cof ω = ℵ₀ := - cof_eq_aleph0_of_isSuccLimit isSuccLimit_omega0 omega0_lt_omega_one - -@[deprecated (since := "2026-02-18")] alias cof_eq_one_iff_is_succ := cof_eq_one_iff - -theorem ord_cof_eq (α : Type*) [LinearOrder α] [WellFoundedLT α] : - ∃ s : Set α, IsCofinal s ∧ typeLT s = (Order.cof α).ord := by - obtain ⟨s, hs, hs'⟩ := Order.cof_eq α - obtain ⟨r, hr, hr'⟩ := exists_ord_eq s - have ht := hs.trans (isCofinal_setOf_imp_lt r) - refine ⟨_, ht, (ord_le.2 (cof_le ht)).antisymm' ?_⟩ - rw [← hs', hr', type_le_iff'] - refine ⟨.ofMonotone (fun x ↦ ⟨x.1, ?_⟩) fun x y hxy ↦ ?_⟩ - · grind - · apply (trichotomous_of r _ _).resolve_right - rintro (_ | hxy') - · simp_all [Subtype.coe_inj] - · obtain ⟨x, z, hz, rfl⟩ := x - exact (hz _ hxy').asymm hxy - -@[simp] -theorem _root_.Order.cof_ord_cof (α : Type*) [LinearOrder α] [WellFoundedLT α] : - (Order.cof α).ord.cof = Order.cof α := by - obtain ⟨s, hs, hs'⟩ := 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) - -@[simp] -theorem cof_ord_cof (o : Ordinal) : o.cof.ord.cof = o.cof := by - simpa using Order.cof_ord_cof o.ToType - -@[deprecated (since := "2026-03-21")] alias cof_cof := cof_ord_cof - -/-! ### Cofinalities and suprema -/ - -section LinearOrder -variable [LinearOrder β] [LinearOrder γ] - -theorem lift_cof_iSup_add_one [Small.{u} β] {f : β → Ordinal} (hf : StrictMono f) : - Cardinal.lift.{v} (cof (⨆ i, f i + 1)) = Cardinal.lift.{u} (Order.cof β) := by - have : StrictMono (β := Iio (⨆ i, f i + 1)) (fun i ↦ ⟨f i, ?_⟩) := fun x y h ↦ hf h - · have := lift_cof_congr_of_strictMono this ?_ - · rw [← Cardinal.lift_inj.{_, max (u + 1) v}, Cardinal.lift_lift.{_, _, v}, - Cardinal.lift_umax.{_, u + 1}, Cardinal.lift_umax.{_, u + 1}, this] - simp - · intro ⟨b, hb⟩ - rw [mem_Iio, Ordinal.lt_iSup_add_one_iff] at hb - obtain ⟨i, hi⟩ := hb - exact ⟨_, Set.mem_range_self i, hi⟩ - · rw [mem_Iio] - exact (lt_add_one _).trans_le <| le_ciSup bddAbove_of_small _ - -theorem cof_iSup_add_one {f : γ → Ordinal} (hf : StrictMono f) : - cof (⨆ i, f i + 1) = Order.cof γ := by - simpa using lift_cof_iSup_add_one hf - -theorem lift_cof_iSup [Small.{u} β] [NoMaxOrder β] {f : β → Ordinal} (hf : StrictMono f) : - Cardinal.lift.{v} (cof (⨆ i, f i)) = Cardinal.lift.{u} (Order.cof β) := by - rw [← iSup_add_one hf, lift_cof_iSup_add_one hf] - -theorem cof_iSup [NoMaxOrder γ] {f : γ → Ordinal} (hf : StrictMono f) : - cof (⨆ i, f i) = Order.cof γ := by - simpa using lift_cof_iSup hf - -end LinearOrder - -theorem cof_iSup_Iio_add_one {a} {f : Iio a → Ordinal} (hf : StrictMono f) : - cof (⨆ i, f i + 1) = cof a := by - simpa [← lift_cof] using lift_cof_iSup_add_one hf - -theorem cof_iSup_Iio {a} {f : Iio a → Ordinal} (hf : StrictMono f) (ha : IsSuccPrelimit a) : - cof (⨆ i, f i) = cof a := by - rw [← iSup_Iio_add_one hf ha, cof_iSup_Iio_add_one hf] - -theorem cof_map_of_isNormal {f} (hf : IsNormal f) {a} (ha : IsSuccLimit a) : cof (f a) = cof a := by - rw [hf.apply_of_isSuccLimit ha, cof_iSup_Iio _ ha.isSuccPrelimit] - exact hf.strictMono.comp <| Subtype.strictMono_coe _ - -@[deprecated (since := "2026-03-19")] -alias cof_eq_of_isNormal := cof_map_of_isNormal - -@[deprecated (since := "2025-12-25")] -alias IsNormal.cof_eq := cof_eq_of_isNormal - -theorem le_cof_map_of_isNormal {f} (hf : IsNormal f) (a) : cof a ≤ cof (f a) := by - rcases zero_or_succ_or_isSuccLimit a with (rfl | ⟨b, rfl⟩ | ha) - · rw [cof_zero] - exact zero_le _ - · rw [cof_succ, Cardinal.one_le_iff_ne_zero, cof_eq_zero.ne, ← pos_iff_ne_zero] - exact (zero_le (f b)).trans_lt (hf.strictMono (lt_succ b)) - · rw [cof_map_of_isNormal hf ha] - -@[deprecated (since := "2026-03-19")] -alias cof_le_of_isNormal := le_cof_map_of_isNormal - -@[deprecated (since := "2025-12-25")] -alias IsNormal.cof_le := le_cof_map_of_isNormal - -theorem sSup_add_one_lt_of_lt_cof {s : Set Ordinal.{u}} {a : Ordinal.{u}} - (ha : #s < (lift.{u + 1} a).cof) (hs : ∀ i ∈ s, i < a) : sSup ((· + 1) '' s) < a := by - let f := OrderIso.ofRelIsoLT (enum (α := s) (· < ·)) - have : Small.{u} (Iio (typeLT s)) := by - refine small_of_injective (β := Iio a) (f := fun x ↦ ⟨f x, hs _ (f x).2⟩) fun _ ↦ ?_ - simp [Subtype.val_inj] - have : range (fun i ↦ (f i).1 + 1) = (· + 1) '' s := by - convert range_comp (· + 1) (fun i ↦ (f i).1) - rw [range_comp', f.range_eq] - simp - rw [← this, sSup_range] - apply lt_of_le_of_ne - · simp [hs] - · rintro rfl - rw [← lift_cof, ← Cardinal.lift_lt.{_, u + 2}, Cardinal.lift_lift, - lift_cof_iSup_add_one fun _ ↦ by simp, cof_Iio, ← lift_cof, cof_type, - Cardinal.lift_lift, Cardinal.lift_lt] at ha - exact ha.not_ge (cof_le_cardinalMk _) - -theorem sSup_lt_of_lt_cof {s : Set Ordinal.{u}} {a : Ordinal.{u}} - (ha : #s < (lift.{u + 1} a).cof) (hs : ∀ i ∈ s, i < a) : sSup s < a := - (sSup_le_sSup_add_one s).trans_lt (sSup_add_one_lt_of_lt_cof ha hs) - -theorem lift_iSup_add_one_lt_of_lt_cof {f : β → Ordinal.{u}} {a : Ordinal.{u}} - (ha : Cardinal.lift.{u} #β < (lift.{v} a).cof) (hf : ∀ i, f i < a) : ⨆ i, f i + 1 < a := by - rw [iSup, range_comp' (· + 1)] - apply sSup_add_one_lt_of_lt_cof _ (by simpa) - rw [← Cardinal.lift_lt.{_, v}] - apply mk_range_le_lift.trans_lt - rw [← Cardinal.lift_lt.{_, u + 1}] at ha - simpa [← lift_cof] using ha - -theorem iSup_add_one_lt_of_lt_cof {f : α → Ordinal.{u}} {a : Ordinal.{u}} - (ha : #α < a.cof) (hf : ∀ i, f i < a) : ⨆ i, f i + 1 < a := by - rw [← Cardinal.lift_lt.{_, u}, lift_cof] at ha - simpa using lift_iSup_add_one_lt_of_lt_cof ha hf - -theorem lift_iSup_lt_of_lt_cof {f : β → Ordinal.{u}} {a : Ordinal.{u}} - (ha : Cardinal.lift.{u} #β < (lift.{v} a).cof) (hf : ∀ i, f i < a) : ⨆ i, f i < a := - (iSup_le_iSup_add_one f).trans_lt (lift_iSup_add_one_lt_of_lt_cof ha hf) - -theorem iSup_lt_of_lt_cof {f : α → Ordinal.{u}} {a : Ordinal.{u}} - (ha : #α < a.cof) (hf : ∀ i, f i < a) : ⨆ i, f i < a := by - rw [← Cardinal.lift_lt.{_, u}, lift_cof] at ha - simpa using lift_iSup_lt_of_lt_cof ha hf - -theorem cof_lift_iSup_add_one_le [Small.{u} β] (f : β → Ordinal.{u}) : - cof (lift.{v} (⨆ i, f i + 1)) ≤ Cardinal.lift.{u} (#β) := by - by_contra! hf - exact (lift_iSup_add_one_lt_of_lt_cof hf <| Ordinal.lt_iSup_add_one _).false - -theorem cof_iSup_add_one_le (f : α → Ordinal.{u}) : cof (⨆ i, f i + 1) ≤ #α := by - simpa using cof_lift_iSup_add_one_le f - -theorem _root_.Cardinal.sSup_lt_of_lt_cof_ord {s : Set Cardinal.{u}} {a : Cardinal.{u}} - (ha : #s < (Cardinal.lift.{u + 1} a).ord.cof) (hs : ∀ i ∈ s, i < a) : sSup s < a := by - rw [← ord_lt_ord, sSup_ord] - apply Ordinal.sSup_lt_of_lt_cof - · simpa [mk_image_eq ord_injective] - · simpa - -theorem _root_.Cardinal.lift_iSup_lt_of_lt_cof_ord {f : β → Cardinal.{u}} {a : Cardinal.{u}} - (ha : Cardinal.lift.{u} #β < a.lift.ord.cof) (hf : ∀ i, f i < a) : ⨆ i, f i < a := by - rw [← ord_lt_ord, iSup_ord] - apply Ordinal.lift_iSup_lt_of_lt_cof <;> simpa - -theorem _root_.Cardinal.iSup_lt_of_lt_cof_ord {f : α → Cardinal.{u}} {a : Cardinal.{u}} - (ha : #α < a.ord.cof) (hf : ∀ i, f i < a) : ⨆ i, f i < a := by - rw [← ord_lt_ord, iSup_ord] - apply Ordinal.iSup_lt_of_lt_cof <;> simpa - -set_option linter.deprecated false in -/-- The set in the `lsub` characterization of `cof` is nonempty. -/ -@[deprecated "to build an increasing function with limit o, use the fundamental sequence API." -(since := "2026-03-27")] -theorem cof_lsub_def_nonempty (o) : - { a : Cardinal | ∃ (ι : _) (f : ι → Ordinal), lsub.{u, u} f = o ∧ #ι = a }.Nonempty := - ⟨_, ⟨_, _, lsub_typein o, mk_toType o⟩⟩ - -set_option linter.deprecated false in -@[deprecated "to build an increasing function with limit o, use the fundamental sequence API." -(since := "2026-03-27")] -theorem cof_eq_sInf_lsub (o : Ordinal.{u}) : cof o = - sInf { a : Cardinal | ∃ (ι : Type u) (f : ι → Ordinal), lsub.{u, u} f = o ∧ #ι = a } := by - refine le_antisymm (le_csInf (cof_lsub_def_nonempty o) ?_) (csInf_le' ?_) - · rintro a ⟨ι, f, hf, rfl⟩ - rw [← hf] - exact cof_iSup_add_one_le f - · rcases Order.cof_eq (α := o.ToType) with ⟨S, hS, hS'⟩ - let f : S → Ordinal := fun s => typein LT.lt s.val - refine ⟨S, f, le_antisymm (lsub_le fun i => typein_lt_self (o := o) i) - (le_of_forall_lt fun a ha => ?_), by rwa [cof_toType] at hS'⟩ - rw [← type_toType o] at ha - rcases hS (enum (· < ·) ⟨a, ha⟩) with ⟨b, hb, hb'⟩ - rw [← not_lt, ← typein_le_typein, typein_enum] at hb' - exact hb'.trans_lt (lt_lsub.{u, u} f ⟨b, hb⟩) - -set_option linter.deprecated false in -@[deprecated "to build an increasing function with limit o, use the fundamental sequence API." -(since := "2026-03-27")] -theorem exists_lsub_cof (o : Ordinal) : - ∃ (ι : _) (f : ι → Ordinal), lsub.{u, u} f = o ∧ #ι = cof o := by - rw [cof_eq_sInf_lsub] - exact csInf_mem (cof_lsub_def_nonempty o) - -set_option linter.deprecated false in -@[deprecated cof_iSup_add_one_le (since := "2026-03-22")] -theorem cof_lsub_le {ι} (f : ι → Ordinal) : cof (lsub.{u, u} f) ≤ #ι := - cof_iSup_add_one_le f - -set_option linter.deprecated false in -@[deprecated cof_lift_iSup_add_one_le (since := "2026-03-22")] -theorem cof_lsub_le_lift {ι} (f : ι → Ordinal) : - cof (lsub.{u, v} f) ≤ Cardinal.lift.{v, u} #ι := by - rw [← lift_id'.{u} (lsub f), ← Cardinal.lift_umax.{u, v}] - exact cof_lift_iSup_add_one_le _ - -set_option linter.deprecated false in -@[deprecated le_cof_iff (since := "2026-03-21")] -theorem le_cof_iff_lsub {o : Ordinal} {a : Cardinal} : - a ≤ cof o ↔ ∀ {ι} (f : ι → Ordinal), lsub.{u, u} f = o → a ≤ #ι := by - rw [cof_eq_sInf_lsub] - exact - (le_csInf_iff'' (cof_lsub_def_nonempty o)).trans - ⟨fun H ι f hf => H _ ⟨ι, f, hf, rfl⟩, fun H b ⟨ι, f, hf, hb⟩ => by - rw [← hb] - exact H _ hf⟩ - -set_option linter.deprecated false in -@[deprecated lift_iSup_add_one_lt_of_lt_cof (since := "2026-03-22")] -theorem lsub_lt_ord_lift {ι} {f : ι → Ordinal} {c : Ordinal} - (hι : Cardinal.lift.{v, u} #ι < c.cof) - (hf : ∀ i, f i < c) : lsub.{u, v} f < c := by - apply lift_iSup_add_one_lt_of_lt_cof _ hf - rwa [Cardinal.lift_umax, c.lift_id'] - -set_option linter.deprecated false in -@[deprecated iSup_add_one_lt_of_lt_cof (since := "2026-03-22")] -theorem lsub_lt_ord {ι} {f : ι → Ordinal} {c : Ordinal} (hι : #ι < c.cof) : - (∀ i, f i < c) → lsub.{u, u} f < c := - iSup_add_one_lt_of_lt_cof hι - -@[deprecated lift_iSup_lt_of_lt_cof (since := "2026-03-22")] -theorem cof_iSup_le_lift {ι} {f : ι → Ordinal} (H : ∀ i, f i < iSup f) : - cof (iSup f) ≤ Cardinal.lift.{v, u} #ι := by - by_contra! hf - apply (lift_iSup_lt_of_lt_cof _ H).false - rwa [Cardinal.lift_umax, lift_id'] - -@[deprecated iSup_lt_of_lt_cof (since := "2026-03-22")] -theorem cof_iSup_le {ι} {f : ι → Ordinal} (H : ∀ i, f i < iSup f) : - cof (iSup f) ≤ #ι := by - by_contra! hf - exact (iSup_lt_of_lt_cof hf H).false - -@[deprecated lift_iSup_lt_of_lt_cof (since := "2026-03-22")] -theorem iSup_lt_ord_lift {ι} {f : ι → Ordinal} {c : Ordinal} (hι : Cardinal.lift.{v, u} #ι < c.cof) - (hf : ∀ i, f i < c) : iSup f < c := by - apply lift_iSup_lt_of_lt_cof _ hf - rwa [Cardinal.lift_umax, lift_id'] - -@[deprecated (since := "2026-03-22")] -alias iSup_lt_ord := iSup_lt_of_lt_cof - -@[deprecated lift_iSup_lt_of_lt_cof (since := "2026-03-22")] -theorem iSup_lt_lift {ι} {f : ι → Cardinal} {c : Cardinal} - (hι : Cardinal.lift.{v, u} #ι < c.ord.cof) - (hf : ∀ i, f i < c) : iSup f < c := by - apply lift_iSup_lt_of_lt_cof_ord _ hf - rwa [Cardinal.lift_umax, c.lift_id'] - -@[deprecated (since := "2026-03-22")] -alias iSup_lt := Cardinal.iSup_lt_of_lt_cof_ord - -theorem nfpFamily_lt_ord_lift {ι} {f : ι → Ordinal → Ordinal} {c} (hc : ℵ₀ < cof c) - (hc' : Cardinal.lift.{v, u} #ι < cof c) (hf : ∀ (i), ∀ b < c, f i b < c) {a} (ha : a < c) : - nfpFamily f a < c := by - refine lift_iSup_lt_of_lt_cof ?_ (fun l ↦ ?_) - · rw [Cardinal.lift_umax, c.lift_id'] - apply (Cardinal.lift_le.2 (mk_list_le_max _)).trans_lt - rw [Cardinal.lift_max] - apply max_lt <;> simpa - · induction l with - | nil => exact ha - | cons i l H => exact hf _ _ H - -theorem nfpFamily_lt_ord {ι} {f : ι → Ordinal → Ordinal} {c} (hc : ℵ₀ < cof c) (hc' : #ι < cof c) - (hf : ∀ (i), ∀ b < c, f i b < c) {a} : a < c → nfpFamily.{u, u} f a < c := - nfpFamily_lt_ord_lift hc (by rwa [(#ι).lift_id]) hf - -theorem nfp_lt_ord {f : Ordinal → Ordinal} {c} (hc : ℵ₀ < cof c) (hf : ∀ i < c, f i < c) {a} : - a < c → nfp f a < c := - nfpFamily_lt_ord_lift hc (by simpa using Cardinal.one_lt_aleph0.trans hc) fun _ => hf - -set_option linter.deprecated false in -@[deprecated exists_lsub_cof (since := "2026-03-21")] -theorem exists_blsub_cof (o : Ordinal) : - ∃ f : ∀ a < (cof o).ord, Ordinal, blsub.{u, u} _ f = o := by - rcases exists_lsub_cof o with ⟨ι, f, hf, hι⟩ - rcases Cardinal.exists_ord_eq ι with ⟨r, hr, hι'⟩ - rw [← @blsub_eq_lsub' ι r hr] at hf - rw [← hι, hι'] - exact ⟨_, hf⟩ - -set_option linter.deprecated false in -@[deprecated le_cof_iff (since := "2026-03-21")] -theorem le_cof_iff_blsub {b : Ordinal} {a : Cardinal} : - a ≤ cof b ↔ ∀ {o} (f : ∀ a < o, Ordinal), blsub.{u, u} o f = b → a ≤ o.card := - le_cof_iff_lsub.trans - ⟨fun H o f hf => by simpa using H _ hf, fun H ι f hf => by - rcases Cardinal.exists_ord_eq ι with ⟨r, hr, hι'⟩ - rw [← @blsub_eq_lsub' ι r hr] at hf - simpa using H _ hf⟩ - -set_option linter.deprecated false in -@[deprecated cof_lift_iSup_add_one_le (since := "2026-03-22")] -theorem cof_blsub_le_lift {o} (f : ∀ a < o, Ordinal) : - cof (blsub.{u, v} o f) ≤ Cardinal.lift.{v, u} o.card := by - rw [← mk_toType o] - exact cof_lsub_le_lift _ - -set_option linter.deprecated false in -@[deprecated cof_iSup_add_one_le (since := "2026-03-22")] -theorem cof_blsub_le {o} (f : ∀ a < o, Ordinal) : cof (blsub.{u, u} o f) ≤ o.card := by - rw [← o.card.lift_id] - exact cof_blsub_le_lift f - -set_option linter.deprecated false in -@[deprecated lift_iSup_add_one_lt_of_lt_cof (since := "2026-03-22")] -theorem blsub_lt_ord_lift {o : Ordinal.{u}} {f : ∀ a < o, Ordinal} {c : Ordinal} - (ho : Cardinal.lift.{v, u} o.card < c.cof) (hf : ∀ i hi, f i hi < c) : blsub.{u, v} o f < c := - lt_of_le_of_ne (blsub_le hf) fun h => - ho.not_ge (by simpa [← iSup_ord, hf, h] using cof_blsub_le_lift.{u, v} f) - -set_option linter.deprecated false in -@[deprecated iSup_add_one_lt_of_lt_cof (since := "2026-03-22")] -theorem blsub_lt_ord {o : Ordinal} {f : ∀ a < o, Ordinal} {c : Ordinal} (ho : o.card < c.cof) - (hf : ∀ i hi, f i hi < c) : blsub.{u, u} o f < c := - blsub_lt_ord_lift (by rwa [o.card.lift_id]) hf - -set_option linter.deprecated false in -@[deprecated lift_iSup_lt_of_lt_cof (since := "2026-03-22")] -theorem cof_bsup_le_lift {o : Ordinal} {f : ∀ a < o, Ordinal} (H : ∀ i h, f i h < bsup.{u, v} o f) : - cof (bsup.{u, v} o f) ≤ Cardinal.lift.{v, u} o.card := by - rw [← bsup_eq_blsub_iff_lt_bsup.{u, v}] at H - rw [H] - exact cof_blsub_le_lift.{u, v} f - -set_option linter.deprecated false in -@[deprecated iSup_lt_of_lt_cof (since := "2026-03-22")] -theorem cof_bsup_le {o : Ordinal} {f : ∀ a < o, Ordinal} : - (∀ i h, f i h < bsup.{u, u} o f) → cof (bsup.{u, u} o f) ≤ o.card := by - rw [← o.card.lift_id] - exact cof_bsup_le_lift - -set_option linter.deprecated false in -@[deprecated lift_iSup_lt_of_lt_cof (since := "2026-03-22")] -theorem bsup_lt_ord_lift {o : Ordinal} {f : ∀ a < o, Ordinal} {c : Ordinal} - (ho : Cardinal.lift.{v, u} o.card < c.cof) (hf : ∀ i hi, f i hi < c) : bsup.{u, v} o f < c := - (bsup_le_blsub f).trans_lt (blsub_lt_ord_lift ho hf) - -set_option linter.deprecated false in -@[deprecated iSup_lt_of_lt_cof (since := "2026-03-22")] -theorem bsup_lt_ord {o : Ordinal} {f : ∀ a < o, Ordinal} {c : Ordinal} (ho : o.card < c.cof) : - (∀ i hi, f i hi < c) → bsup.{u, u} o f < c := - bsup_lt_ord_lift (by rwa [o.card.lift_id]) - -/-! ### Cofinality arithmetic -/ - -@[simp] -theorem cof_add (a : Ordinal) {b : Ordinal} (hb : b ≠ 0) : cof (a + b) = cof b := by - rcases zero_or_succ_or_isSuccLimit b with (rfl | ⟨c, rfl⟩ | hb) - · contradiction - · rw [succ_eq_add_one, ← add_assoc, cof_add_one, cof_add_one] - · exact cof_map_of_isNormal (isNormal_add_right a) hb - -@[simp] -theorem cof_mul {a b : Ordinal} (ha : a ≠ 0) (hb : IsSuccPrelimit b) : cof (a * b) = cof b := by - by_cases hb' : IsMin b - · simp [hb'.eq_bot] - · exact cof_map_of_isNormal (isNormal_mul_right ha.pos) ⟨hb', hb⟩ - -@[simp] -theorem cof_preOmega {o : Ordinal} (ho : IsSuccPrelimit o) : (preOmega o).cof = o.cof := by - by_cases h : IsMin o - · simp [h.eq_bot] - · exact cof_map_of_isNormal isNormal_preOmega ⟨h, ho⟩ - -@[simp] -theorem cof_omega {o : Ordinal} (ho : IsSuccLimit o) : (ω_ o).cof = o.cof := - cof_map_of_isNormal isNormal_omega ho - --- TODO: deprecate in favor of `Order.cof_eq` -theorem cof_eq' (r : α → α → Prop) [H : IsWellOrder α r] (h : IsSuccLimit (type r)) : - ∃ S : Set α, (∀ a, ∃ b ∈ S, r a b) ∧ #S = cof (type r) := by - classical - let := linearOrderOfSTO r - have : WellFoundedLT α := H.toIsWellFounded - have : NoMaxOrder α := isSuccPrelimit_type_lt_iff.1 h.isSuccPrelimit - obtain ⟨s, hs, hs'⟩ := Order.cof_eq α - refine ⟨s, ?_, hs'⟩ - rwa [← not_bddAbove_iff_isCofinal, not_bddAbove_iff] at hs - -@[simp] -theorem cof_univ : cof univ.{u, v} = Cardinal.univ.{u, v} := by - apply (cof_le_card _).antisymm - simp_rw [univ, ← lift_cof, ← lift_card, Cardinal.lift_le, cof_type, card_type, le_cof_iff, - ← not_bddAbove_iff_isCofinal] - exact fun s hs ↦ mk_le_of_injective (enumOrdOrderIso s hs).injective - -end Ordinal - -namespace Cardinal -open Ordinal - -/-! ### Results on sets -/ - --- TODO: re-state this for a bundled well-order -theorem mk_bounded_subset {α : Type*} (h : ∀ x < #α, 2 ^ x < #α) {r : α → α → Prop} - [IsWellOrder α r] (hr : (#α).ord = type r) : #{ s : Set α // Bounded r s } = #α := by - rcases eq_or_ne #α 0 with (ha | ha) - · rw [ha] - haveI := mk_eq_zero_iff.1 ha - rw [mk_eq_zero_iff] - constructor - rintro ⟨s, hs⟩ - exact (not_unbounded_iff s).2 hs (unbounded_of_isEmpty s) - have h' : IsStrongLimit #α := ⟨ha, @h⟩ - have ha := h'.aleph0_le - apply le_antisymm - · have : { s : Set α | Bounded r s } = ⋃ i, 𝒫 { j | r j i } := setOf_exists _ - rw [← coe_setOf, this] - refine mk_iUnion_le_sum_mk.trans ((sum_le_mk_mul_iSup (fun i => #(𝒫 { j | r j i }))).trans - ((mul_le_max_of_aleph0_le_left ha).trans ?_)) - rw [max_eq_left] - apply ciSup_le' _ - intro i - rw [mk_powerset] - exact (h'.two_power_lt (card_typein_lt _ hr)).le - · refine @mk_le_of_injective α _ (fun x => Subtype.mk {x} ?_) ?_ - · apply bounded_singleton - rw [← hr] - apply isSuccLimit_ord ha - · intro a b hab - simpa [singleton_eq_singleton_iff] using hab - -theorem mk_subset_mk_lt_cof {α : Type*} (h : ∀ x < #α, 2 ^ x < #α) : - #{ s : Set α // #s < cof (#α).ord } = #α := by - rcases eq_or_ne #α 0 with (ha | ha) - · simp [ha] - have h' : IsStrongLimit #α := ⟨ha, @h⟩ - rcases exists_ord_eq α with ⟨r, wo, hr⟩ - classical - letI := linearOrderOfSTO r - apply le_antisymm - · conv_rhs => rw [← mk_bounded_subset h hr] - apply mk_subtype_le_of_subset - intro s hs - rw [hr] at hs - contrapose! hs - rw [not_bounded_iff] at hs - apply cof_le - simp_rw [IsCofinal, ← not_lt] - exact hs - · refine @mk_le_of_injective α _ (fun x => Subtype.mk {x} ?_) ?_ - · rw [mk_singleton, one_lt_cof_iff] - exact isSuccLimit_ord h'.aleph0_le - · intro a b hab - simpa [singleton_eq_singleton_iff] using hab - -@[deprecated (since := "2026-02-25")] -alias unbounded_of_unbounded_sUnion := isCofinal_of_isCofinal_sUnion -@[deprecated (since := "2026-02-25")] -alias unbounded_of_unbounded_iUnion := isCofinal_of_isCofinal_iUnion - -/-! ### Consequences of König's lemma -/ - -theorem lt_power_cof_ord {c : Cardinal} (hc : ℵ₀ ≤ c) : c < c ^ c.ord.cof := by - induction c using Cardinal.inductionOn with | mk α - obtain ⟨_, _, hα⟩ := exists_ord_eq_type_lt α - have : NoMaxOrder α := by - rw [← isSuccPrelimit_type_lt_iff, ← hα] - exact (isSuccLimit_ord hc).isSuccPrelimit - obtain ⟨s, hs, hs'⟩ := ord_cof_eq α - rw [hα, cof_type, ← card_ord (Order.cof _), ← hs', card_type, ← prod_const'] - refine (mk_iUnion_le_sum_mk.trans' ?_).trans_lt (sum_lt_prod _ _ fun i ↦ mk_Iio_lt i.1 hα) - rw [← mk_univ, ← isCofinal_iff_iUnion_Iio_eq_univ.1 hs, iUnion_coe_set] - -@[deprecated (since := "2026-03-30")] -alias lt_power_cof := lt_power_cof_ord - -theorem lt_cof_ord_power {a b : Cardinal} (ha : ℵ₀ ≤ a) (hb : 1 < b) : a < (b ^ a).ord.cof := by - apply lt_imp_lt_of_le_imp_le (power_le_power_left <| power_ne_zero a hb.ne_bot) - rw [← power_mul, mul_eq_self ha] - exact lt_power_cof_ord (ha.trans <| (cantor' _ hb).le) - -@[deprecated (since := "2026-03-30")] -alias lt_cof_power := lt_cof_ord_power - -end Cardinal +deprecated_module (since := "2026-04-22") diff --git a/Mathlib/SetTheory/Cardinal/Regular.lean b/Mathlib/SetTheory/Cardinal/Regular.lean index 8bf08d188a489a..c156ac9093ff8b 100644 --- a/Mathlib/SetTheory/Cardinal/Regular.lean +++ b/Mathlib/SetTheory/Cardinal/Regular.lean @@ -5,7 +5,7 @@ Authors: Mario Carneiro, Floris van Doorn, Violeta Hernández Palacios -/ module -public import Mathlib.SetTheory.Cardinal.Cofinality +public import Mathlib.SetTheory.Cardinal.Cofinality.Ordinal public import Mathlib.SetTheory.Ordinal.FixedPoint /-! diff --git a/Mathlib/SetTheory/Ordinal/Basic.lean b/Mathlib/SetTheory/Ordinal/Basic.lean index 327d83ba1c07d4..ab51a219137faf 100644 --- a/Mathlib/SetTheory/Ordinal/Basic.lean +++ b/Mathlib/SetTheory/Ordinal/Basic.lean @@ -189,11 +189,11 @@ theorem type_pEmpty : type (@emptyRelation PEmpty) = 0 := theorem type_empty : type (@emptyRelation Empty) = 0 := type_eq_zero_of_empty _ +@[simp] 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 -@[simp] theorem type_eq_one_iff_unique [IsWellOrder α r] : type r = 1 ↔ Nonempty (Unique α) := ⟨fun h ↦ let ⟨s⟩ := type_eq.1 h; ⟨s.toEquiv.unique⟩, fun ⟨_⟩ ↦ type_eq_one_of_unique r⟩ diff --git a/Mathlib/SetTheory/Ordinal/Enum.lean b/Mathlib/SetTheory/Ordinal/Enum.lean index e1235d74f92012..7aeed462c24f17 100644 --- a/Mathlib/SetTheory/Ordinal/Enum.lean +++ b/Mathlib/SetTheory/Ordinal/Enum.lean @@ -5,7 +5,9 @@ Authors: Violeta Hernández Palacios -/ module +public import Mathlib.SetTheory.Cardinal.Cofinality.Basic public import Mathlib.SetTheory.Ordinal.Family +public import Mathlib.SetTheory.Ordinal.Univ /-! # Enumerating sets of ordinals by ordinals @@ -24,7 +26,73 @@ This can be thought of as an ordinal analog of `Nat.nth`. universe u -open Order Set +open Cardinal Order Ordinal Set + +variable {α : Type*} + +/-- A typeclass which expresses that the order type of a well-order equals (the initial ordinal of) +its cofinality. + +If `α` is infinite, this implies that `α` is order isomorphic to `Iio c.ord` for some regular +cardinal `c`. In the informal literature, one often says that `α` is a regular cardinal, by abuse +of notation. -/ +class IsRegularCardinalOrder (α : Type*) [LinearOrder α] [WellFoundedLT α] where + type_le_ord_cof : typeLT α ≤ (cof α).ord + +instance : IsRegularCardinalOrder ℕ := ⟨by simp⟩ + +instance (priority := low) [LinearOrder α] [WellFoundedLT α] [Subsingleton α] : + IsRegularCardinalOrder α where + type_le_ord_cof := by + cases isEmpty_or_nonempty α + · simpa + · cases nonempty_unique α + have := BoundedOrder.ofUnique α + simp + +instance : IsRegularCardinalOrder Ordinal where + type_le_ord_cof := by + rw [type_lt_ordinal, ← ord_univ, ord_le_ord, le_cof_iff] + intro s hs + contrapose! hs + rw [← Cardinal.lift_id (#s), ← small_iff_lift_mk_lt_univ] at hs + rw [not_isCofinal_iff_bddAbove] + exact Ordinal.bddAbove_of_small + +namespace Order +variable [LinearOrder α] [WellFoundedLT α] [IsRegularCardinalOrder α] + +theorem ord_cof_eq_type_lt : (cof α).ord = typeLT α := by + apply IsRegularCardinalOrder.type_le_ord_cof.antisymm' + rw [ord_le, card_type] + exact cof_le_cardinalMk α + +@[simp] +theorem cof_eq_card : cof α = #α := by + rw [← card_type LT.lt, ← ord_cof_eq_type_lt, card_ord] + +@[simp] +theorem ord_cardinalMk : ord (#α) = typeLT α := by + rw [← ord_cof_eq_type_lt, cof_eq_card] + +@[simp] +theorem cof_ordinal : cof Ordinal.{u} = Cardinal.univ.{u, u + 1} := by + simp [← Cardinal.univ_id] + +theorem ordinalType_eq_of_isCofinal {s : Set α} (hs : IsCofinal s) : typeLT s = typeLT α := by + apply (RelEmbedding.ofMonotone Subtype.val (by simp)).ordinal_type_le.antisymm + rw [← ord_cardinalMk, ord_le, card_type, ← cof_eq_card] + exact cof_le hs + +/-- Enumerate the elements of a cofinal subset of `α` by `α` itself. This is a generalization of +`Nat.nth`. -/ +@[no_expose] +noncomputable def enum (s : Set α) (hs : IsCofinal s) : α ≃o s := + .ofRelIsoLT (type_eq.1 (ordinalType_eq_of_isCofinal hs).symm).some + +end Order + +-- TODO: Everything below can be subsumed by `Order.enum`. namespace Ordinal diff --git a/Mathlib/SetTheory/Ordinal/FundamentalSequence.lean b/Mathlib/SetTheory/Ordinal/FundamentalSequence.lean index f76ca692f41917..dac122e01df111 100644 --- a/Mathlib/SetTheory/Ordinal/FundamentalSequence.lean +++ b/Mathlib/SetTheory/Ordinal/FundamentalSequence.lean @@ -5,7 +5,7 @@ Authors: Violeta Hernández Palacios, Mario Carneiro -/ module -public import Mathlib.SetTheory.Cardinal.Cofinality +public import Mathlib.SetTheory.Cardinal.Cofinality.Ordinal /-! # Fundamental sequences From 64d2e45594d6c650de12c2bc94fff7da7ca697bc Mon Sep 17 00:00:00 2001 From: vihdzp Date: Wed, 22 Apr 2026 01:33:16 -0600 Subject: [PATCH 19/93] fix --- .../SetTheory/Cardinal/Cofinality/Basic.lean | 203 ++++++ .../Cardinal/Cofinality/Ordinal.lean | 650 ++++++++++++++++++ 2 files changed, 853 insertions(+) create mode 100644 Mathlib/SetTheory/Cardinal/Cofinality/Basic.lean create mode 100644 Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Basic.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Basic.lean new file mode 100644 index 00000000000000..24354d7b0d5e8a --- /dev/null +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Basic.lean @@ -0,0 +1,203 @@ +/- +Copyright (c) 2017 Mario Carneiro. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Mario Carneiro, Floris van Doorn, Violeta Hernández Palacios +-/ +module + +public import Mathlib.Order.Cofinal +public import Mathlib.SetTheory.Cardinal.Basic + +/-! +# Cofinality + +This file contains the definition of the cofinality `Order.cof α` of an order. This is the smallest +cardinality of a cofinal subset. +-/ + +public noncomputable section + +open Function Cardinal Set Order + +universe u v w + +variable {α γ : Type u} {β : Type v} + +/-! ### Cofinality of orders -/ + +namespace Order +section Preorder +variable [Preorder α] + +variable (α) in +/-- The cofinality of a preorder is the smallest cardinality of a cofinal subset. -/ +def cof : Cardinal := + ⨅ s : {s : Set α // IsCofinal s}, #s + +theorem cof_le {s : Set α} (h : IsCofinal s) : cof α ≤ #s := + ciInf_le' (ι := {s : Set α // IsCofinal s}) _ ⟨s, h⟩ + +theorem le_lift_cof_iff {c : Cardinal.{max u v}} : + c ≤ lift.{v} (cof α) ↔ ∀ s : Set α, IsCofinal s → c ≤ lift.{v} #s := by + rw [cof, lift_iInf, le_ciInf_iff'] + simp + +theorem le_cof_iff {c : Cardinal} : c ≤ cof α ↔ ∀ s : Set α, IsCofinal s → c ≤ #s := by + simpa using @le_lift_cof_iff.{u, u} α _ c + +@[deprecated (since := "2026-02-18")] alias le_cof := le_cof_iff + +variable (α) in +theorem 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⟩ + +variable (α) in +theorem cof_le_cardinalMk : cof α ≤ #α := + cof_le .univ |>.trans_eq mk_univ + +theorem cof_eq_zero_iff : cof α = 0 ↔ IsEmpty α := by + refine ⟨fun _ ↦ ?_, fun _ ↦ by simp [cof]⟩ + obtain ⟨s, hs, hs'⟩ := cof_eq α + simp_all [mk_eq_zero_iff, isCofinal_empty_iff] + +@[simp] +theorem cof_eq_zero [h : IsEmpty α] : cof α = 0 := + cof_eq_zero_iff.2 h + +theorem cof_ne_zero_iff : cof α ≠ 0 ↔ Nonempty α := by + simpa using cof_eq_zero_iff.not + +@[simp] +theorem cof_ne_zero [h : Nonempty α] : cof α ≠ 0 := + cof_ne_zero_iff.2 h + +theorem cof_eq_one_iff : cof α = 1 ↔ ∃ x : α, IsTop x := by + refine ⟨fun h ↦ ?_, fun ⟨t, ht⟩ ↦ ?_⟩ + · obtain ⟨s, hs, hs'⟩ := cof_eq α + rw [h, mk_set_eq_one_iff] at hs' + obtain ⟨t, rfl⟩ := hs' + use t + rwa [isCofinal_singleton_iff] at hs + · apply le_antisymm + · apply (cof_le (s := {t}) _).trans_eq (mk_singleton _) + rwa [isCofinal_singleton_iff] + · rw [Cardinal.one_le_iff_ne_zero, cof_ne_zero_iff] + use t + +@[simp] +theorem cof_eq_one [OrderTop α] : cof α = 1 := + cof_eq_one_iff.2 ⟨⊤, isTop_top⟩ + +theorem cof_ne_one_iff : cof α ≠ 1 ↔ NoTopOrder α := by + rw [← not_iff_not, not_not, noTopOrder_iff, cof_eq_one_iff] + simp + +@[simp] +theorem cof_ne_one [h : NoTopOrder α] : cof α ≠ 1 := + cof_ne_one_iff.2 h + +theorem cof_le_one_iff [Nonempty α] : cof α ≤ 1 ↔ ∃ x : α, IsTop x := by + rw [le_iff_lt_or_eq, Cardinal.lt_one_iff, cof_eq_one_iff] + simp + +theorem one_lt_cof_iff [Nonempty α] : 1 < cof α ↔ NoTopOrder α := by + rw [← not_iff_not, not_lt, noTopOrder_iff, cof_le_one_iff] + simp + +@[simp] +theorem one_lt_cof [Nonempty α] [h : NoTopOrder α] : 1 < cof α := + one_lt_cof_iff.2 h + +end Preorder + +section LinearOrder +variable [LinearOrder α] [LinearOrder β] [LinearOrder γ] + +theorem lift_cof_congr_of_strictMono {f : α → β} (hf : StrictMono f) (hf' : IsCofinal (range f)) : + lift.{v} (cof α) = lift.{u} (cof β) := by + apply le_antisymm <;> rw [le_lift_cof_iff] <;> intro s hs + · have H (x : s) : ∃ y : α, x ≤ f y := by simpa using hf' x + choose g hg using H + refine (lift_le.2 <| cof_le (s := range g) fun a ↦ ?_).trans mk_range_le_lift + obtain ⟨_, ⟨b, rfl⟩, hb⟩ := hf' (f a) + obtain ⟨c, hc, hc'⟩ := hs (f b) + refine ⟨_, Set.mem_range_self ⟨c, hc⟩, ?_⟩ + rw [← hf.le_iff_le] + exact hb.trans (hc'.trans (hg ⟨c, hc⟩)) + · exact (lift_le.2 <| cof_le (hs.image hf.monotone hf')).trans mk_image_le_lift + +theorem cof_congr_of_strictMono {f : α → γ} (hf : StrictMono f) (hf' : IsCofinal (range f)) : + cof α = cof γ := by + simpa using lift_cof_congr_of_strictMono hf hf' + +@[simp] +theorem cof_lt_aleph0_iff : Order.cof α < ℵ₀ ↔ Order.cof α ≤ 1 := by + refine ⟨fun h ↦ ?_, (lt_of_le_of_lt · one_lt_aleph0)⟩ + obtain ⟨s, hs, hs'⟩ := Order.cof_eq α + have hf : s.Finite := by + rw [Set.Finite, ← mk_lt_aleph0_iff] + exact hs'.trans_lt h + obtain ⟨t, ht, ht'⟩ := hf.exists_subsingleton_isCofinal hs + apply (cof_le ht').trans + simpa + +@[simp] +theorem aleph0_le_cof_iff : ℵ₀ ≤ Order.cof α ↔ 1 < Order.cof α := by + simp [← not_lt] + +@[simp] +theorem cof_eq_aleph0 [NoMaxOrder α] [Nonempty α] [Countable α] : cof α = ℵ₀ := + ((cof_le_cardinalMk _).trans mk_le_aleph0).antisymm (by simp) + +theorem cof_nat : cof ℕ = ℵ₀ := by simp + +end LinearOrder +end Order + +section Congr +variable [Preorder α] [Preorder β] [Preorder γ] + +theorem GaloisConnection.cof_le_lift {f : β → α} {g : α → β} (h : GaloisConnection f g) : + Cardinal.lift.{u} (Order.cof β) ≤ Cardinal.lift.{v} (Order.cof α) := by + rw [le_lift_cof_iff] + exact fun s hs ↦ (lift_le.2 <| cof_le (h.map_isCofinal hs)).trans mk_image_le_lift + +theorem GaloisConnection.cof_le {f : γ → α} {g : α → γ} (h : GaloisConnection f g) : + Order.cof γ ≤ Order.cof α := by + simpa using h.cof_le_lift + +theorem OrderIso.lift_cof_congr (f : α ≃o β) : + Cardinal.lift.{v} (Order.cof α) = Cardinal.lift.{u} (Order.cof β) := + f.to_galoisConnection.cof_le_lift.antisymm (f.symm.to_galoisConnection.cof_le_lift) + +@[deprecated (since := "2026-03-20")] alias OrderIso.lift_cof_eq := OrderIso.lift_cof_congr + +theorem OrderIso.cof_congr (f : α ≃o γ) : Order.cof α = Order.cof γ := by + simpa using f.lift_cof_congr + +@[deprecated (since := "2026-03-20")] alias OrderIso.cof_eq := OrderIso.cof_congr + +@[deprecated (since := "2026-02-18")] alias RelIso.cof_eq_lift := OrderIso.lift_cof_congr +@[deprecated (since := "2026-02-18")] alias RelIso.cof_eq := OrderIso.cof_congr + +end Congr + +/-- If the union of `s` is cofinal and `s` is smaller than the cofinality, then `s` has a cofinal +member. -/ +theorem isCofinal_of_isCofinal_sUnion {α : Type*} [LinearOrder α] {s : Set (Set α)} + (h₁ : IsCofinal (⋃₀ s)) (h₂ : #s < Order.cof α) : ∃ x ∈ s, IsCofinal x := by + contrapose! h₂ + simp_rw [not_isCofinal_iff] at h₂ + choose f hf using h₂ + refine (cof_le (s := range fun x ↦ f x.1 x.2) fun a ↦ ?_).trans mk_range_le + obtain ⟨b, ⟨t, ht, hb⟩, hab⟩ := h₁ a + simpa using ⟨t, ht, hab.trans (hf t ht b hb).le⟩ + +/-- If the union of the `ι`-indexed family `s` is cofinal and `ι` is smaller than the cofinality, +then `s` has a cofinal member. -/ +theorem isCofinal_of_isCofinal_iUnion {α : Type*} {ι} [LinearOrder α] {s : ι → Set α} + (h₁ : IsCofinal (⋃ i, s i)) (h₂ : #ι < Order.cof α) : ∃ i, IsCofinal (s i) := by + rw [← sUnion_range] at h₁ + obtain ⟨_, ⟨i, rfl⟩, h⟩ := isCofinal_of_isCofinal_sUnion h₁ (mk_range_le.trans_lt h₂) + exact ⟨i, h⟩ diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean new file mode 100644 index 00000000000000..945124203401fb --- /dev/null +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean @@ -0,0 +1,650 @@ +/- +Copyright (c) 2017 Mario Carneiro. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Mario Carneiro, Floris van Doorn, Violeta Hernández Palacios +-/ +module + +public import Mathlib.SetTheory.Cardinal.Arithmetic +public import Mathlib.SetTheory.Cardinal.Cofinality.Basic +public import Mathlib.SetTheory.Ordinal.FixedPoint + +/-! +# Cofinality of an ordinal + +This file contains the definition of the cofinality `Ordinal.cof o` of an ordinal. This is the +cofinality of the ordinal `o` when viewed as a linear order. + +## Main statements + +* `Cardinal.lt_power_cof_ord`: A consequence of König's theorem stating that `c < c ^ c.ord.cof` for + `c ≥ ℵ₀`. + +## Implementation notes + +* We do not separately define the cofinality of a cardinal. If `c` is a cardinal number, you can + write its cofinality as `c.ord.cof`. +-/ + +public noncomputable section + +open Function Cardinal Set Order +open scoped Ordinal + +universe u v w + +variable {α γ : Type u} {β : Type v} + +theorem Order.cof_int : cof ℤ = ℵ₀ := by simp + +/-! ### Cofinality of ordinals -/ + +-- TODO: generalize to `OrderType` +namespace Ordinal + +/-- The cofinality on an ordinal is the `Order.cof` of any isomorphic linear order. + +In particular, `cof 0 = 0` and `cof (succ o) = 1`. -/ +def cof (o : Ordinal.{u}) : Cardinal.{u} := + o.liftOnWellOrder (fun α _ _ ↦ Order.cof α) fun _ _ _ _ _ _ h ↦ + let ⟨f⟩ := type_eq.1 h + (OrderIso.ofRelIsoLT f).cof_congr + +@[simp] +theorem cof_type (α : Type*) [LinearOrder α] [WellFoundedLT α] : + (typeLT α).cof = Order.cof α := + liftOnWellOrder_type .. + +@[deprecated (since := "2026-02-18")] alias cof_type_lt := cof_type + +@[simp] +theorem cof_toType (o : Ordinal) : Order.cof o.ToType = o.cof := by + conv_rhs => rw [← type_toType o, cof_type] + +@[deprecated (since := "2026-02-18")] alias cof_eq_cof_toType := cof_toType +@[deprecated (since := "2026-02-18")] alias le_cof_type := le_cof_iff +@[deprecated (since := "2026-02-18")] alias cof_type_le := cof_le +@[deprecated (since := "2026-02-18")] alias lt_cof_type := cof_le +@[deprecated (since := "2026-02-18")] alias cof_eq := Order.cof_eq + +@[simp] +theorem lift_cof (o : Ordinal.{u}) : Cardinal.lift.{v} (cof o) = cof (Ordinal.lift.{v} o) := by + cases o using inductionOnWellOrder with | type α + rw [cof_type, ← type_lt_ulift, cof_type, ← Cardinal.lift_id'.{u, v} (Order.cof (ULift _)), + ← Cardinal.lift_umax, ← ULift.orderIso.lift_cof_congr] + +theorem _root_.Order.cof_Iio [LinearOrder α] [WellFoundedLT α] (x : α) : + Order.cof (Iio x) = cof (typein (α := α) (· < ·) x) := + (cof_type _).symm + +@[simp] +theorem cof_Iio (o : Ordinal.{u}) : Order.cof (Iio o) = cof (lift.{u + 1} o) := by + rw [Order.cof_Iio, typein_ordinal] + +theorem cof_le_card (o : Ordinal) : cof o ≤ card o := by + simpa using cof_le_cardinalMk o.ToType + +theorem cof_ord_le (c : Cardinal) : c.ord.cof ≤ c := by + simpa using cof_le_card c.ord + +theorem ord_cof_le (o : Ordinal) : o.cof.ord ≤ o := + (ord_le_ord.2 (cof_le_card o)).trans (ord_card_le o) + +@[simp] +theorem cof_eq_zero {o} : cof o = 0 ↔ o = 0 := by + rw [← cof_toType, cof_eq_zero_iff, isEmpty_toType_iff] + +@[deprecated cof_eq_zero (since := "2026-02-18")] +theorem cof_ne_zero {o} : cof o ≠ 0 ↔ o ≠ 0 := + cof_eq_zero.not + +@[simp] +theorem cof_pos {o} : 0 < cof o ↔ 0 < o := by + simp [pos_iff_ne_zero] + +@[simp] +theorem cof_zero : cof 0 = 0 := + cof_eq_zero.2 rfl + +theorem cof_eq_one_iff {o} : cof o = 1 ↔ o ∈ range succ := by + cases o using inductionOnWellOrder with | type α + rw [cof_type, Order.cof_eq_one_iff, type_lt_mem_range_succ_iff] + simp_rw [isTop_iff_isMax] + +theorem cof_add_one (o) : cof (o + 1) = 1 := + cof_eq_one_iff.2 (mem_range_self o) + +@[simp] +theorem cof_one : cof 1 = 1 := by + simpa using cof_add_one 0 + +-- TODO: deprecate in favor of `cof_add_one` +theorem cof_succ (o) : cof (succ o) = 1 := + cof_add_one o + +theorem one_lt_cof_iff {o : Ordinal} : 1 < cof o ↔ IsSuccLimit o := by + rw [← not_iff_not, not_lt, Cardinal.le_one_iff, isSuccLimit_iff, + not_and_or, not_ne_iff, not_isSuccPrelimit_iff', cof_eq_zero, cof_eq_one_iff] + +@[simp] +theorem cof_lt_aleph0_iff {o : Ordinal} : cof o < ℵ₀ ↔ cof o ≤ 1 := by + simpa using Order.cof_lt_aleph0_iff (α := o.ToType) + +@[simp] +theorem aleph0_le_cof_iff {o : Ordinal} : ℵ₀ ≤ cof o ↔ 1 < cof o := by + simp [← not_lt] + +@[deprecated one_lt_cof_iff (since := "2026-03-22")] +theorem aleph0_le_cof {o} : ℵ₀ ≤ cof o ↔ IsSuccLimit o := by + rw [aleph0_le_cof_iff, one_lt_cof_iff] + +/-- A countable limit ordinal has cofinality `ℵ₀`. -/ +theorem cof_eq_aleph0_of_isSuccLimit {o : Ordinal} (ho : IsSuccLimit o) (ho' : o < ω₁) : + cof o = ℵ₀ := by + apply ((cof_le_card _).trans _).antisymm + · rwa [aleph0_le_cof_iff, one_lt_cof_iff] + · rwa [card_le_iff, succ_aleph0, ord_aleph] + +@[simp] +theorem cof_omega0 : cof ω = ℵ₀ := + cof_eq_aleph0_of_isSuccLimit isSuccLimit_omega0 omega0_lt_omega_one + +@[deprecated (since := "2026-02-18")] alias cof_eq_one_iff_is_succ := cof_eq_one_iff + +theorem ord_cof_eq (α : Type*) [LinearOrder α] [WellFoundedLT α] : + ∃ s : Set α, IsCofinal s ∧ typeLT s = (Order.cof α).ord := by + obtain ⟨s, hs, hs'⟩ := Order.cof_eq α + obtain ⟨r, hr, hr'⟩ := exists_ord_eq s + have ht := hs.trans (isCofinal_setOf_imp_lt r) + refine ⟨_, ht, (ord_le.2 (cof_le ht)).antisymm' ?_⟩ + rw [← hs', hr', type_le_iff'] + refine ⟨.ofMonotone (fun x ↦ ⟨x.1, ?_⟩) fun x y hxy ↦ ?_⟩ + · grind + · apply (trichotomous_of r _ _).resolve_right + rintro (_ | hxy') + · simp_all [Subtype.coe_inj] + · obtain ⟨x, z, hz, rfl⟩ := x + exact (hz _ hxy').asymm hxy + +@[simp] +theorem _root_.Order.cof_ord_cof (α : Type*) [LinearOrder α] [WellFoundedLT α] : + (Order.cof α).ord.cof = Order.cof α := by + obtain ⟨s, hs, hs'⟩ := 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) + +@[simp] +theorem cof_ord_cof (o : Ordinal) : o.cof.ord.cof = o.cof := by + simpa using Order.cof_ord_cof o.ToType + +@[deprecated (since := "2026-03-21")] alias cof_cof := cof_ord_cof + +/-! ### Cofinalities and suprema -/ + +section LinearOrder +variable [LinearOrder β] [LinearOrder γ] + +theorem lift_cof_iSup_add_one [Small.{u} β] {f : β → Ordinal} (hf : StrictMono f) : + Cardinal.lift.{v} (cof (⨆ i, f i + 1)) = Cardinal.lift.{u} (Order.cof β) := by + have : StrictMono (β := Iio (⨆ i, f i + 1)) (fun i ↦ ⟨f i, ?_⟩) := fun x y h ↦ hf h + · have := lift_cof_congr_of_strictMono this ?_ + · rw [← Cardinal.lift_inj.{_, max (u + 1) v}, Cardinal.lift_lift.{_, _, v}, + Cardinal.lift_umax.{_, u + 1}, Cardinal.lift_umax.{_, u + 1}, this] + simp + · intro ⟨b, hb⟩ + rw [mem_Iio, Ordinal.lt_iSup_add_one_iff] at hb + obtain ⟨i, hi⟩ := hb + exact ⟨_, Set.mem_range_self i, hi⟩ + · rw [mem_Iio] + exact (lt_add_one _).trans_le <| le_ciSup bddAbove_of_small _ + +theorem cof_iSup_add_one {f : γ → Ordinal} (hf : StrictMono f) : + cof (⨆ i, f i + 1) = Order.cof γ := by + simpa using lift_cof_iSup_add_one hf + +theorem lift_cof_iSup [Small.{u} β] [NoMaxOrder β] {f : β → Ordinal} (hf : StrictMono f) : + Cardinal.lift.{v} (cof (⨆ i, f i)) = Cardinal.lift.{u} (Order.cof β) := by + rw [← iSup_add_one hf, lift_cof_iSup_add_one hf] + +theorem cof_iSup [NoMaxOrder γ] {f : γ → Ordinal} (hf : StrictMono f) : + cof (⨆ i, f i) = Order.cof γ := by + simpa using lift_cof_iSup hf + +end LinearOrder + +theorem cof_iSup_Iio_add_one {a} {f : Iio a → Ordinal} (hf : StrictMono f) : + cof (⨆ i, f i + 1) = cof a := by + simpa [← lift_cof] using lift_cof_iSup_add_one hf + +theorem cof_iSup_Iio {a} {f : Iio a → Ordinal} (hf : StrictMono f) (ha : IsSuccPrelimit a) : + cof (⨆ i, f i) = cof a := by + rw [← iSup_Iio_add_one hf ha, cof_iSup_Iio_add_one hf] + +theorem cof_map_of_isNormal {f} (hf : IsNormal f) {a} (ha : IsSuccLimit a) : cof (f a) = cof a := by + rw [hf.apply_of_isSuccLimit ha, cof_iSup_Iio _ ha.isSuccPrelimit] + exact hf.strictMono.comp <| Subtype.strictMono_coe _ + +@[deprecated (since := "2026-03-19")] +alias cof_eq_of_isNormal := cof_map_of_isNormal + +@[deprecated (since := "2025-12-25")] +alias IsNormal.cof_eq := cof_eq_of_isNormal + +theorem le_cof_map_of_isNormal {f} (hf : IsNormal f) (a) : cof a ≤ cof (f a) := by + rcases zero_or_succ_or_isSuccLimit a with (rfl | ⟨b, rfl⟩ | ha) + · rw [cof_zero] + exact zero_le _ + · rw [cof_succ, Cardinal.one_le_iff_ne_zero, cof_eq_zero.ne, ← pos_iff_ne_zero] + exact (zero_le (f b)).trans_lt (hf.strictMono (lt_succ b)) + · rw [cof_map_of_isNormal hf ha] + +@[deprecated (since := "2026-03-19")] +alias cof_le_of_isNormal := le_cof_map_of_isNormal + +@[deprecated (since := "2025-12-25")] +alias IsNormal.cof_le := le_cof_map_of_isNormal + +theorem sSup_add_one_lt_of_lt_cof {s : Set Ordinal.{u}} {a : Ordinal.{u}} + (ha : #s < (lift.{u + 1} a).cof) (hs : ∀ i ∈ s, i < a) : sSup ((· + 1) '' s) < a := by + let f := OrderIso.ofRelIsoLT (enum (α := s) (· < ·)) + have : Small.{u} (Iio (typeLT s)) := by + refine small_of_injective (β := Iio a) (f := fun x ↦ ⟨f x, hs _ (f x).2⟩) fun _ ↦ ?_ + simp [Subtype.val_inj] + have : range (fun i ↦ (f i).1 + 1) = (· + 1) '' s := by + convert range_comp (· + 1) (fun i ↦ (f i).1) + rw [range_comp', f.range_eq] + simp + rw [← this, sSup_range] + apply lt_of_le_of_ne + · simp [hs] + · rintro rfl + rw [← lift_cof, ← Cardinal.lift_lt.{_, u + 2}, Cardinal.lift_lift, + lift_cof_iSup_add_one fun _ ↦ by simp, cof_Iio, ← lift_cof, cof_type, + Cardinal.lift_lift, Cardinal.lift_lt] at ha + exact ha.not_ge (cof_le_cardinalMk _) + +theorem sSup_lt_of_lt_cof {s : Set Ordinal.{u}} {a : Ordinal.{u}} + (ha : #s < (lift.{u + 1} a).cof) (hs : ∀ i ∈ s, i < a) : sSup s < a := + (sSup_le_sSup_add_one s).trans_lt (sSup_add_one_lt_of_lt_cof ha hs) + +theorem lift_iSup_add_one_lt_of_lt_cof {f : β → Ordinal.{u}} {a : Ordinal.{u}} + (ha : Cardinal.lift.{u} #β < (lift.{v} a).cof) (hf : ∀ i, f i < a) : ⨆ i, f i + 1 < a := by + rw [iSup, range_comp' (· + 1)] + apply sSup_add_one_lt_of_lt_cof _ (by simpa) + rw [← Cardinal.lift_lt.{_, v}] + apply mk_range_le_lift.trans_lt + rw [← Cardinal.lift_lt.{_, u + 1}] at ha + simpa [← lift_cof] using ha + +theorem iSup_add_one_lt_of_lt_cof {f : α → Ordinal.{u}} {a : Ordinal.{u}} + (ha : #α < a.cof) (hf : ∀ i, f i < a) : ⨆ i, f i + 1 < a := by + rw [← Cardinal.lift_lt.{_, u}, lift_cof] at ha + simpa using lift_iSup_add_one_lt_of_lt_cof ha hf + +theorem lift_iSup_lt_of_lt_cof {f : β → Ordinal.{u}} {a : Ordinal.{u}} + (ha : Cardinal.lift.{u} #β < (lift.{v} a).cof) (hf : ∀ i, f i < a) : ⨆ i, f i < a := + (iSup_le_iSup_add_one f).trans_lt (lift_iSup_add_one_lt_of_lt_cof ha hf) + +theorem iSup_lt_of_lt_cof {f : α → Ordinal.{u}} {a : Ordinal.{u}} + (ha : #α < a.cof) (hf : ∀ i, f i < a) : ⨆ i, f i < a := by + rw [← Cardinal.lift_lt.{_, u}, lift_cof] at ha + simpa using lift_iSup_lt_of_lt_cof ha hf + +theorem cof_lift_iSup_add_one_le [Small.{u} β] (f : β → Ordinal.{u}) : + cof (lift.{v} (⨆ i, f i + 1)) ≤ Cardinal.lift.{u} (#β) := by + by_contra! hf + exact (lift_iSup_add_one_lt_of_lt_cof hf <| Ordinal.lt_iSup_add_one _).false + +theorem cof_iSup_add_one_le (f : α → Ordinal.{u}) : cof (⨆ i, f i + 1) ≤ #α := by + simpa using cof_lift_iSup_add_one_le f + +theorem _root_.Cardinal.sSup_lt_of_lt_cof_ord {s : Set Cardinal.{u}} {a : Cardinal.{u}} + (ha : #s < (Cardinal.lift.{u + 1} a).ord.cof) (hs : ∀ i ∈ s, i < a) : sSup s < a := by + rw [← ord_lt_ord, sSup_ord] + apply Ordinal.sSup_lt_of_lt_cof + · simpa [mk_image_eq ord_injective] + · simpa + +theorem _root_.Cardinal.lift_iSup_lt_of_lt_cof_ord {f : β → Cardinal.{u}} {a : Cardinal.{u}} + (ha : Cardinal.lift.{u} #β < a.lift.ord.cof) (hf : ∀ i, f i < a) : ⨆ i, f i < a := by + rw [← ord_lt_ord, iSup_ord] + apply Ordinal.lift_iSup_lt_of_lt_cof <;> simpa + +theorem _root_.Cardinal.iSup_lt_of_lt_cof_ord {f : α → Cardinal.{u}} {a : Cardinal.{u}} + (ha : #α < a.ord.cof) (hf : ∀ i, f i < a) : ⨆ i, f i < a := by + rw [← ord_lt_ord, iSup_ord] + apply Ordinal.iSup_lt_of_lt_cof <;> simpa + +set_option linter.deprecated false in +/-- The set in the `lsub` characterization of `cof` is nonempty. -/ +@[deprecated "to build an increasing function with limit o, use the fundamental sequence API." +(since := "2026-03-27")] +theorem cof_lsub_def_nonempty (o) : + { a : Cardinal | ∃ (ι : _) (f : ι → Ordinal), lsub.{u, u} f = o ∧ #ι = a }.Nonempty := + ⟨_, ⟨_, _, lsub_typein o, mk_toType o⟩⟩ + +set_option linter.deprecated false in +@[deprecated "to build an increasing function with limit o, use the fundamental sequence API." +(since := "2026-03-27")] +theorem cof_eq_sInf_lsub (o : Ordinal.{u}) : cof o = + sInf { a : Cardinal | ∃ (ι : Type u) (f : ι → Ordinal), lsub.{u, u} f = o ∧ #ι = a } := by + refine le_antisymm (le_csInf (cof_lsub_def_nonempty o) ?_) (csInf_le' ?_) + · rintro a ⟨ι, f, hf, rfl⟩ + rw [← hf] + exact cof_iSup_add_one_le f + · rcases Order.cof_eq (α := o.ToType) with ⟨S, hS, hS'⟩ + let f : S → Ordinal := fun s => typein LT.lt s.val + refine ⟨S, f, le_antisymm (lsub_le fun i => typein_lt_self (o := o) i) + (le_of_forall_lt fun a ha => ?_), by rwa [cof_toType] at hS'⟩ + rw [← type_toType o] at ha + rcases hS (enum (· < ·) ⟨a, ha⟩) with ⟨b, hb, hb'⟩ + rw [← not_lt, ← typein_le_typein, typein_enum] at hb' + exact hb'.trans_lt (lt_lsub.{u, u} f ⟨b, hb⟩) + +set_option linter.deprecated false in +@[deprecated "to build an increasing function with limit o, use the fundamental sequence API." +(since := "2026-03-27")] +theorem exists_lsub_cof (o : Ordinal) : + ∃ (ι : _) (f : ι → Ordinal), lsub.{u, u} f = o ∧ #ι = cof o := by + rw [cof_eq_sInf_lsub] + exact csInf_mem (cof_lsub_def_nonempty o) + +set_option linter.deprecated false in +@[deprecated cof_iSup_add_one_le (since := "2026-03-22")] +theorem cof_lsub_le {ι} (f : ι → Ordinal) : cof (lsub.{u, u} f) ≤ #ι := + cof_iSup_add_one_le f + +set_option linter.deprecated false in +@[deprecated cof_lift_iSup_add_one_le (since := "2026-03-22")] +theorem cof_lsub_le_lift {ι} (f : ι → Ordinal) : + cof (lsub.{u, v} f) ≤ Cardinal.lift.{v, u} #ι := by + rw [← lift_id'.{u} (lsub f), ← Cardinal.lift_umax.{u, v}] + exact cof_lift_iSup_add_one_le _ + +set_option linter.deprecated false in +@[deprecated le_cof_iff (since := "2026-03-21")] +theorem le_cof_iff_lsub {o : Ordinal} {a : Cardinal} : + a ≤ cof o ↔ ∀ {ι} (f : ι → Ordinal), lsub.{u, u} f = o → a ≤ #ι := by + rw [cof_eq_sInf_lsub] + exact + (le_csInf_iff'' (cof_lsub_def_nonempty o)).trans + ⟨fun H ι f hf => H _ ⟨ι, f, hf, rfl⟩, fun H b ⟨ι, f, hf, hb⟩ => by + rw [← hb] + exact H _ hf⟩ + +set_option linter.deprecated false in +@[deprecated lift_iSup_add_one_lt_of_lt_cof (since := "2026-03-22")] +theorem lsub_lt_ord_lift {ι} {f : ι → Ordinal} {c : Ordinal} + (hι : Cardinal.lift.{v, u} #ι < c.cof) + (hf : ∀ i, f i < c) : lsub.{u, v} f < c := by + apply lift_iSup_add_one_lt_of_lt_cof _ hf + rwa [Cardinal.lift_umax, c.lift_id'] + +set_option linter.deprecated false in +@[deprecated iSup_add_one_lt_of_lt_cof (since := "2026-03-22")] +theorem lsub_lt_ord {ι} {f : ι → Ordinal} {c : Ordinal} (hι : #ι < c.cof) : + (∀ i, f i < c) → lsub.{u, u} f < c := + iSup_add_one_lt_of_lt_cof hι + +@[deprecated lift_iSup_lt_of_lt_cof (since := "2026-03-22")] +theorem cof_iSup_le_lift {ι} {f : ι → Ordinal} (H : ∀ i, f i < iSup f) : + cof (iSup f) ≤ Cardinal.lift.{v, u} #ι := by + by_contra! hf + apply (lift_iSup_lt_of_lt_cof _ H).false + rwa [Cardinal.lift_umax, lift_id'] + +@[deprecated iSup_lt_of_lt_cof (since := "2026-03-22")] +theorem cof_iSup_le {ι} {f : ι → Ordinal} (H : ∀ i, f i < iSup f) : + cof (iSup f) ≤ #ι := by + by_contra! hf + exact (iSup_lt_of_lt_cof hf H).false + +@[deprecated lift_iSup_lt_of_lt_cof (since := "2026-03-22")] +theorem iSup_lt_ord_lift {ι} {f : ι → Ordinal} {c : Ordinal} (hι : Cardinal.lift.{v, u} #ι < c.cof) + (hf : ∀ i, f i < c) : iSup f < c := by + apply lift_iSup_lt_of_lt_cof _ hf + rwa [Cardinal.lift_umax, lift_id'] + +@[deprecated (since := "2026-03-22")] +alias iSup_lt_ord := iSup_lt_of_lt_cof + +@[deprecated lift_iSup_lt_of_lt_cof (since := "2026-03-22")] +theorem iSup_lt_lift {ι} {f : ι → Cardinal} {c : Cardinal} + (hι : Cardinal.lift.{v, u} #ι < c.ord.cof) + (hf : ∀ i, f i < c) : iSup f < c := by + apply lift_iSup_lt_of_lt_cof_ord _ hf + rwa [Cardinal.lift_umax, c.lift_id'] + +@[deprecated (since := "2026-03-22")] +alias iSup_lt := Cardinal.iSup_lt_of_lt_cof_ord + +theorem nfpFamily_lt_ord_lift {ι} {f : ι → Ordinal → Ordinal} {c} (hc : ℵ₀ < cof c) + (hc' : Cardinal.lift.{v, u} #ι < cof c) (hf : ∀ (i), ∀ b < c, f i b < c) {a} (ha : a < c) : + nfpFamily f a < c := by + refine lift_iSup_lt_of_lt_cof ?_ (fun l ↦ ?_) + · rw [Cardinal.lift_umax, c.lift_id'] + apply (Cardinal.lift_le.2 (mk_list_le_max _)).trans_lt + rw [Cardinal.lift_max] + apply max_lt <;> simpa + · induction l with + | nil => exact ha + | cons i l H => exact hf _ _ H + +theorem nfpFamily_lt_ord {ι} {f : ι → Ordinal → Ordinal} {c} (hc : ℵ₀ < cof c) (hc' : #ι < cof c) + (hf : ∀ (i), ∀ b < c, f i b < c) {a} : a < c → nfpFamily.{u, u} f a < c := + nfpFamily_lt_ord_lift hc (by rwa [(#ι).lift_id]) hf + +theorem nfp_lt_ord {f : Ordinal → Ordinal} {c} (hc : ℵ₀ < cof c) (hf : ∀ i < c, f i < c) {a} : + a < c → nfp f a < c := + nfpFamily_lt_ord_lift hc (by simpa using Cardinal.one_lt_aleph0.trans hc) fun _ => hf + +set_option linter.deprecated false in +@[deprecated exists_lsub_cof (since := "2026-03-21")] +theorem exists_blsub_cof (o : Ordinal) : + ∃ f : ∀ a < (cof o).ord, Ordinal, blsub.{u, u} _ f = o := by + rcases exists_lsub_cof o with ⟨ι, f, hf, hι⟩ + rcases Cardinal.exists_ord_eq ι with ⟨r, hr, hι'⟩ + rw [← @blsub_eq_lsub' ι r hr] at hf + rw [← hι, hι'] + exact ⟨_, hf⟩ + +set_option linter.deprecated false in +@[deprecated le_cof_iff (since := "2026-03-21")] +theorem le_cof_iff_blsub {b : Ordinal} {a : Cardinal} : + a ≤ cof b ↔ ∀ {o} (f : ∀ a < o, Ordinal), blsub.{u, u} o f = b → a ≤ o.card := + le_cof_iff_lsub.trans + ⟨fun H o f hf => by simpa using H _ hf, fun H ι f hf => by + rcases Cardinal.exists_ord_eq ι with ⟨r, hr, hι'⟩ + rw [← @blsub_eq_lsub' ι r hr] at hf + simpa using H _ hf⟩ + +set_option linter.deprecated false in +@[deprecated cof_lift_iSup_add_one_le (since := "2026-03-22")] +theorem cof_blsub_le_lift {o} (f : ∀ a < o, Ordinal) : + cof (blsub.{u, v} o f) ≤ Cardinal.lift.{v, u} o.card := by + rw [← mk_toType o] + exact cof_lsub_le_lift _ + +set_option linter.deprecated false in +@[deprecated cof_iSup_add_one_le (since := "2026-03-22")] +theorem cof_blsub_le {o} (f : ∀ a < o, Ordinal) : cof (blsub.{u, u} o f) ≤ o.card := by + rw [← o.card.lift_id] + exact cof_blsub_le_lift f + +set_option linter.deprecated false in +@[deprecated lift_iSup_add_one_lt_of_lt_cof (since := "2026-03-22")] +theorem blsub_lt_ord_lift {o : Ordinal.{u}} {f : ∀ a < o, Ordinal} {c : Ordinal} + (ho : Cardinal.lift.{v, u} o.card < c.cof) (hf : ∀ i hi, f i hi < c) : blsub.{u, v} o f < c := + lt_of_le_of_ne (blsub_le hf) fun h => + ho.not_ge (by simpa [← iSup_ord, hf, h] using cof_blsub_le_lift.{u, v} f) + +set_option linter.deprecated false in +@[deprecated iSup_add_one_lt_of_lt_cof (since := "2026-03-22")] +theorem blsub_lt_ord {o : Ordinal} {f : ∀ a < o, Ordinal} {c : Ordinal} (ho : o.card < c.cof) + (hf : ∀ i hi, f i hi < c) : blsub.{u, u} o f < c := + blsub_lt_ord_lift (by rwa [o.card.lift_id]) hf + +set_option linter.deprecated false in +@[deprecated lift_iSup_lt_of_lt_cof (since := "2026-03-22")] +theorem cof_bsup_le_lift {o : Ordinal} {f : ∀ a < o, Ordinal} (H : ∀ i h, f i h < bsup.{u, v} o f) : + cof (bsup.{u, v} o f) ≤ Cardinal.lift.{v, u} o.card := by + rw [← bsup_eq_blsub_iff_lt_bsup.{u, v}] at H + rw [H] + exact cof_blsub_le_lift.{u, v} f + +set_option linter.deprecated false in +@[deprecated iSup_lt_of_lt_cof (since := "2026-03-22")] +theorem cof_bsup_le {o : Ordinal} {f : ∀ a < o, Ordinal} : + (∀ i h, f i h < bsup.{u, u} o f) → cof (bsup.{u, u} o f) ≤ o.card := by + rw [← o.card.lift_id] + exact cof_bsup_le_lift + +set_option linter.deprecated false in +@[deprecated lift_iSup_lt_of_lt_cof (since := "2026-03-22")] +theorem bsup_lt_ord_lift {o : Ordinal} {f : ∀ a < o, Ordinal} {c : Ordinal} + (ho : Cardinal.lift.{v, u} o.card < c.cof) (hf : ∀ i hi, f i hi < c) : bsup.{u, v} o f < c := + (bsup_le_blsub f).trans_lt (blsub_lt_ord_lift ho hf) + +set_option linter.deprecated false in +@[deprecated iSup_lt_of_lt_cof (since := "2026-03-22")] +theorem bsup_lt_ord {o : Ordinal} {f : ∀ a < o, Ordinal} {c : Ordinal} (ho : o.card < c.cof) : + (∀ i hi, f i hi < c) → bsup.{u, u} o f < c := + bsup_lt_ord_lift (by rwa [o.card.lift_id]) + +/-! ### Cofinality arithmetic -/ + +@[simp] +theorem cof_add (a : Ordinal) {b : Ordinal} (hb : b ≠ 0) : cof (a + b) = cof b := by + rcases zero_or_succ_or_isSuccLimit b with (rfl | ⟨c, rfl⟩ | hb) + · contradiction + · rw [succ_eq_add_one, ← add_assoc, cof_add_one, cof_add_one] + · exact cof_map_of_isNormal (isNormal_add_right a) hb + +@[simp] +theorem cof_mul {a b : Ordinal} (ha : a ≠ 0) (hb : IsSuccPrelimit b) : cof (a * b) = cof b := by + by_cases hb' : IsMin b + · simp [hb'.eq_bot] + · exact cof_map_of_isNormal (isNormal_mul_right ha.pos) ⟨hb', hb⟩ + +@[simp] +theorem cof_preOmega {o : Ordinal} (ho : IsSuccPrelimit o) : (preOmega o).cof = o.cof := by + by_cases h : IsMin o + · simp [h.eq_bot] + · exact cof_map_of_isNormal isNormal_preOmega ⟨h, ho⟩ + +@[simp] +theorem cof_omega {o : Ordinal} (ho : IsSuccLimit o) : (ω_ o).cof = o.cof := + cof_map_of_isNormal isNormal_omega ho + +-- TODO: deprecate in favor of `Order.cof_eq` +theorem cof_eq' (r : α → α → Prop) [H : IsWellOrder α r] (h : IsSuccLimit (type r)) : + ∃ S : Set α, (∀ a, ∃ b ∈ S, r a b) ∧ #S = cof (type r) := by + classical + let := linearOrderOfSTO r + have : WellFoundedLT α := H.toIsWellFounded + have : NoMaxOrder α := isSuccPrelimit_type_lt_iff.1 h.isSuccPrelimit + obtain ⟨s, hs, hs'⟩ := Order.cof_eq α + refine ⟨s, ?_, hs'⟩ + rwa [← not_bddAbove_iff_isCofinal, not_bddAbove_iff] at hs + +@[simp] +theorem cof_univ : cof univ.{u, v} = Cardinal.univ.{u, v} := by + apply (cof_le_card _).antisymm + simp_rw [univ, ← lift_cof, ← lift_card, Cardinal.lift_le, cof_type, card_type, le_cof_iff, + ← not_bddAbove_iff_isCofinal] + exact fun s hs ↦ mk_le_of_injective (enumOrdOrderIso s hs).injective + +end Ordinal + +namespace Cardinal +open Ordinal + +/-! ### Results on sets -/ + +-- TODO: re-state this for a bundled well-order +theorem mk_bounded_subset {α : Type*} (h : ∀ x < #α, 2 ^ x < #α) {r : α → α → Prop} + [IsWellOrder α r] (hr : (#α).ord = type r) : #{ s : Set α // Bounded r s } = #α := by + rcases eq_or_ne #α 0 with (ha | ha) + · rw [ha] + haveI := mk_eq_zero_iff.1 ha + rw [mk_eq_zero_iff] + constructor + rintro ⟨s, hs⟩ + exact (not_unbounded_iff s).2 hs (unbounded_of_isEmpty s) + have h' : IsStrongLimit #α := ⟨ha, @h⟩ + have ha := h'.aleph0_le + apply le_antisymm + · have : { s : Set α | Bounded r s } = ⋃ i, 𝒫 { j | r j i } := setOf_exists _ + rw [← coe_setOf, this] + refine mk_iUnion_le_sum_mk.trans ((sum_le_mk_mul_iSup (fun i => #(𝒫 { j | r j i }))).trans + ((mul_le_max_of_aleph0_le_left ha).trans ?_)) + rw [max_eq_left] + apply ciSup_le' _ + intro i + rw [mk_powerset] + exact (h'.two_power_lt (card_typein_lt _ hr)).le + · refine @mk_le_of_injective α _ (fun x => Subtype.mk {x} ?_) ?_ + · apply bounded_singleton + rw [← hr] + apply isSuccLimit_ord ha + · intro a b hab + simpa [singleton_eq_singleton_iff] using hab + +theorem mk_subset_mk_lt_cof {α : Type*} (h : ∀ x < #α, 2 ^ x < #α) : + #{ s : Set α // #s < cof (#α).ord } = #α := by + rcases eq_or_ne #α 0 with (ha | ha) + · simp [ha] + have h' : IsStrongLimit #α := ⟨ha, @h⟩ + rcases exists_ord_eq α with ⟨r, wo, hr⟩ + classical + letI := linearOrderOfSTO r + apply le_antisymm + · conv_rhs => rw [← mk_bounded_subset h hr] + apply mk_subtype_le_of_subset + intro s hs + rw [hr] at hs + contrapose! hs + rw [not_bounded_iff] at hs + apply cof_le + simp_rw [IsCofinal, ← not_lt] + exact hs + · refine @mk_le_of_injective α _ (fun x => Subtype.mk {x} ?_) ?_ + · rw [mk_singleton, one_lt_cof_iff] + exact isSuccLimit_ord h'.aleph0_le + · intro a b hab + simpa [singleton_eq_singleton_iff] using hab + +@[deprecated (since := "2026-02-25")] +alias unbounded_of_unbounded_sUnion := isCofinal_of_isCofinal_sUnion +@[deprecated (since := "2026-02-25")] +alias unbounded_of_unbounded_iUnion := isCofinal_of_isCofinal_iUnion + +/-! ### Consequences of König's lemma -/ + +theorem lt_power_cof_ord {c : Cardinal} (hc : ℵ₀ ≤ c) : c < c ^ c.ord.cof := by + induction c using Cardinal.inductionOn with | mk α + obtain ⟨_, _, hα⟩ := exists_ord_eq_type_lt α + have : NoMaxOrder α := by + rw [← isSuccPrelimit_type_lt_iff, ← hα] + exact (isSuccLimit_ord hc).isSuccPrelimit + obtain ⟨s, hs, hs'⟩ := ord_cof_eq α + rw [hα, cof_type, ← card_ord (Order.cof _), ← hs', card_type, ← prod_const'] + refine (mk_iUnion_le_sum_mk.trans' ?_).trans_lt (sum_lt_prod _ _ fun i ↦ mk_Iio_lt i.1 hα) + rw [← mk_univ, ← isCofinal_iff_iUnion_Iio_eq_univ.1 hs, iUnion_coe_set] + +@[deprecated (since := "2026-03-30")] +alias lt_power_cof := lt_power_cof_ord + +theorem lt_cof_ord_power {a b : Cardinal} (ha : ℵ₀ ≤ a) (hb : 1 < b) : a < (b ^ a).ord.cof := by + apply lt_imp_lt_of_le_imp_le (power_le_power_left <| power_ne_zero a hb.ne_bot) + rw [← power_mul, mul_eq_self ha] + exact lt_power_cof_ord (ha.trans <| (cantor' _ hb).le) + +@[deprecated (since := "2026-03-30")] +alias lt_cof_power := lt_cof_ord_power + +end Cardinal From bb06cc9b6657c2eb0c50d7834595f929d49a02ea Mon Sep 17 00:00:00 2001 From: vihdzp Date: Wed, 22 Apr 2026 01:37:00 -0600 Subject: [PATCH 20/93] move --- Mathlib/SetTheory/Ordinal/Enum.lean | 70 +---------------------------- 1 file changed, 1 insertion(+), 69 deletions(-) diff --git a/Mathlib/SetTheory/Ordinal/Enum.lean b/Mathlib/SetTheory/Ordinal/Enum.lean index 7aeed462c24f17..e1235d74f92012 100644 --- a/Mathlib/SetTheory/Ordinal/Enum.lean +++ b/Mathlib/SetTheory/Ordinal/Enum.lean @@ -5,9 +5,7 @@ Authors: Violeta Hernández Palacios -/ module -public import Mathlib.SetTheory.Cardinal.Cofinality.Basic public import Mathlib.SetTheory.Ordinal.Family -public import Mathlib.SetTheory.Ordinal.Univ /-! # Enumerating sets of ordinals by ordinals @@ -26,73 +24,7 @@ This can be thought of as an ordinal analog of `Nat.nth`. universe u -open Cardinal Order Ordinal Set - -variable {α : Type*} - -/-- A typeclass which expresses that the order type of a well-order equals (the initial ordinal of) -its cofinality. - -If `α` is infinite, this implies that `α` is order isomorphic to `Iio c.ord` for some regular -cardinal `c`. In the informal literature, one often says that `α` is a regular cardinal, by abuse -of notation. -/ -class IsRegularCardinalOrder (α : Type*) [LinearOrder α] [WellFoundedLT α] where - type_le_ord_cof : typeLT α ≤ (cof α).ord - -instance : IsRegularCardinalOrder ℕ := ⟨by simp⟩ - -instance (priority := low) [LinearOrder α] [WellFoundedLT α] [Subsingleton α] : - IsRegularCardinalOrder α where - type_le_ord_cof := by - cases isEmpty_or_nonempty α - · simpa - · cases nonempty_unique α - have := BoundedOrder.ofUnique α - simp - -instance : IsRegularCardinalOrder Ordinal where - type_le_ord_cof := by - rw [type_lt_ordinal, ← ord_univ, ord_le_ord, le_cof_iff] - intro s hs - contrapose! hs - rw [← Cardinal.lift_id (#s), ← small_iff_lift_mk_lt_univ] at hs - rw [not_isCofinal_iff_bddAbove] - exact Ordinal.bddAbove_of_small - -namespace Order -variable [LinearOrder α] [WellFoundedLT α] [IsRegularCardinalOrder α] - -theorem ord_cof_eq_type_lt : (cof α).ord = typeLT α := by - apply IsRegularCardinalOrder.type_le_ord_cof.antisymm' - rw [ord_le, card_type] - exact cof_le_cardinalMk α - -@[simp] -theorem cof_eq_card : cof α = #α := by - rw [← card_type LT.lt, ← ord_cof_eq_type_lt, card_ord] - -@[simp] -theorem ord_cardinalMk : ord (#α) = typeLT α := by - rw [← ord_cof_eq_type_lt, cof_eq_card] - -@[simp] -theorem cof_ordinal : cof Ordinal.{u} = Cardinal.univ.{u, u + 1} := by - simp [← Cardinal.univ_id] - -theorem ordinalType_eq_of_isCofinal {s : Set α} (hs : IsCofinal s) : typeLT s = typeLT α := by - apply (RelEmbedding.ofMonotone Subtype.val (by simp)).ordinal_type_le.antisymm - rw [← ord_cardinalMk, ord_le, card_type, ← cof_eq_card] - exact cof_le hs - -/-- Enumerate the elements of a cofinal subset of `α` by `α` itself. This is a generalization of -`Nat.nth`. -/ -@[no_expose] -noncomputable def enum (s : Set α) (hs : IsCofinal s) : α ≃o s := - .ofRelIsoLT (type_eq.1 (ordinalType_eq_of_isCofinal hs).symm).some - -end Order - --- TODO: Everything below can be subsumed by `Order.enum`. +open Order Set namespace Ordinal From 55929747c1e0d2522c5750fb3115a569db762baf Mon Sep 17 00:00:00 2001 From: vihdzp Date: Wed, 22 Apr 2026 01:37:24 -0600 Subject: [PATCH 21/93] this too --- Mathlib/SetTheory/Cardinal/Aleph.lean | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Mathlib/SetTheory/Cardinal/Aleph.lean b/Mathlib/SetTheory/Cardinal/Aleph.lean index 427c3430d69709..4e6160239a1757 100644 --- a/Mathlib/SetTheory/Cardinal/Aleph.lean +++ b/Mathlib/SetTheory/Cardinal/Aleph.lean @@ -302,12 +302,6 @@ theorem _root_.Ordinal.type_lt_cardinal : typeLT Cardinal = Ordinal.univ.{u, u + theorem mk_cardinal : #Cardinal = univ.{u, u + 1} := by simpa only [card_type, card_univ] using congr_arg card type_lt_cardinal -@[simp] -theorem _root_.Order.cof_cardinal : Order.cof Cardinal.{u} = Cardinal.univ.{u, u + 1} := by - rw [← preAleph.cof_congr, Order.cof_ordinal] - -instance : IsRegularCardinalOrder Cardinal := ⟨by simp⟩ - theorem preAleph_lt_preAleph {o₁ o₂ : Ordinal} : preAleph o₁ < preAleph o₂ ↔ o₁ < o₂ := preAleph.lt_iff_lt From abfc3cbb5847ab145fa60c8e670ba3ea070fdd5c Mon Sep 17 00:00:00 2001 From: vihdzp Date: Wed, 22 Apr 2026 01:38:57 -0600 Subject: [PATCH 22/93] fix --- Mathlib.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib.lean b/Mathlib.lean index 51fc639f3b7b2f..6828beca53fb78 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -6890,7 +6890,7 @@ public import Mathlib.SetTheory.Cardinal.Aleph public import Mathlib.SetTheory.Cardinal.Arithmetic public import Mathlib.SetTheory.Cardinal.Basic public import Mathlib.SetTheory.Cardinal.Cofinality -public import Mathlib.SetTheory.Cardinal.Cofinality.Defs +public import Mathlib.SetTheory.Cardinal.Cofinality.Basic public import Mathlib.SetTheory.Cardinal.Cofinality.Ordinal public import Mathlib.SetTheory.Cardinal.Continuum public import Mathlib.SetTheory.Cardinal.CountableCover From 47abd1a05b617f5ea06f1af897749139b7efd6bb Mon Sep 17 00:00:00 2001 From: vihdzp Date: Wed, 22 Apr 2026 01:39:06 -0600 Subject: [PATCH 23/93] here too --- Mathlib.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib.lean b/Mathlib.lean index 51fc639f3b7b2f..6828beca53fb78 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -6890,7 +6890,7 @@ public import Mathlib.SetTheory.Cardinal.Aleph public import Mathlib.SetTheory.Cardinal.Arithmetic public import Mathlib.SetTheory.Cardinal.Basic public import Mathlib.SetTheory.Cardinal.Cofinality -public import Mathlib.SetTheory.Cardinal.Cofinality.Defs +public import Mathlib.SetTheory.Cardinal.Cofinality.Basic public import Mathlib.SetTheory.Cardinal.Cofinality.Ordinal public import Mathlib.SetTheory.Cardinal.Continuum public import Mathlib.SetTheory.Cardinal.CountableCover From df7f90a1c75fd85fc1429cc1da17126f85d72df9 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Wed, 22 Apr 2026 01:48:38 -0600 Subject: [PATCH 24/93] only move --- Mathlib/Order/BoundedOrder/Basic.lean | 8 -------- Mathlib/SetTheory/Ordinal/Basic.lean | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/Mathlib/Order/BoundedOrder/Basic.lean b/Mathlib/Order/BoundedOrder/Basic.lean index 2f7431b0e28a87..a4ef0b62357b2d 100644 --- a/Mathlib/Order/BoundedOrder/Basic.lean +++ b/Mathlib/Order/BoundedOrder/Basic.lean @@ -313,14 +313,6 @@ end Pi section Subsingleton -/-- A type with a single element is a bounded order. -/ -@[implicit_reducible] -def BoundedOrder.ofUnique (α : Type*) [Preorder α] [Unique α] : BoundedOrder α where - bot := default - top := default - le_top := by simp - bot_le := by simp - variable [PartialOrder α] [BoundedOrder α] @[to_dual] diff --git a/Mathlib/SetTheory/Ordinal/Basic.lean b/Mathlib/SetTheory/Ordinal/Basic.lean index ab51a219137faf..327d83ba1c07d4 100644 --- a/Mathlib/SetTheory/Ordinal/Basic.lean +++ b/Mathlib/SetTheory/Ordinal/Basic.lean @@ -189,11 +189,11 @@ theorem type_pEmpty : type (@emptyRelation PEmpty) = 0 := theorem type_empty : type (@emptyRelation Empty) = 0 := type_eq_zero_of_empty _ -@[simp] 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 +@[simp] theorem type_eq_one_iff_unique [IsWellOrder α r] : type r = 1 ↔ Nonempty (Unique α) := ⟨fun h ↦ let ⟨s⟩ := type_eq.1 h; ⟨s.toEquiv.unique⟩, fun ⟨_⟩ ↦ type_eq_one_of_unique r⟩ From a13dc42f3b981c8aa1c354831e897e70be325da1 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Wed, 22 Apr 2026 02:25:40 -0600 Subject: [PATCH 25/93] add documentation --- Mathlib/SetTheory/Ordinal/Enum.lean | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/Mathlib/SetTheory/Ordinal/Enum.lean b/Mathlib/SetTheory/Ordinal/Enum.lean index 7aeed462c24f17..73b118d6da66db 100644 --- a/Mathlib/SetTheory/Ordinal/Enum.lean +++ b/Mathlib/SetTheory/Ordinal/Enum.lean @@ -10,16 +10,16 @@ public import Mathlib.SetTheory.Ordinal.Family public import Mathlib.SetTheory.Ordinal.Univ /-! -# Enumerating sets of ordinals by ordinals +# Enumerating a cofinal set -The ordinals have the peculiar property that every subset bounded above is a small type, while -themselves not being small. As a consequence of this, every unbounded subset of `Ordinal` is order -isomorphic to `Ordinal`. +We define a typeclass `IsRegularCardinalOrder` for well-ordered types, whose order type equals (the +initial ordinal of) their cofinality. This notion does not appear in the literature, but intends to +generalize the properties of intervals `Iio c.ord`, wherever `c` is a regular cardinal. Other +instances of this typeclass include `ℕ`, `Ordinal`, and `Cardinal`. -We define this correspondence as `enumOrd`, and use it to then define an order isomorphism -`enumOrdOrderIso`. - -This can be thought of as an ordinal analog of `Nat.nth`. +If `s` is a cofinal subset of a regular cardinal order `α`, there exists a unique order isomorphism +`α ≃o s`, which we call `Order.enum`. When `α = Ordinal`, this is often called the enumerator +function of the set. Note that if `α = ℕ`, then this definition matches `Nat.nth`. -/ @[expose] public section @@ -90,6 +90,12 @@ theorem ordinalType_eq_of_isCofinal {s : Set α} (hs : IsCofinal s) : typeLT s = noncomputable def enum (s : Set α) (hs : IsCofinal s) : α ≃o s := .ofRelIsoLT (type_eq.1 (ordinalType_eq_of_isCofinal hs).symm).some +theorem enum_le_of_forall_lt {a o : α} {s : Set α} {hs : IsCofinal s} (ha : a ∈ s) + (H : ∀ b < o, enum s hs b < a) : enum s hs o ≤ a := by + rw [← Subtype.coe_mk a ha, Subtype.coe_le_coe, ← OrderIso.le_symm_apply] + apply le_of_forall_lt + simpa [OrderIso.lt_symm_apply] + end Order -- TODO: Everything below can be subsumed by `Order.enum`. From f15b782a100142e0c624381f754137383b09145d Mon Sep 17 00:00:00 2001 From: vihdzp Date: Wed, 22 Apr 2026 02:34:56 -0600 Subject: [PATCH 26/93] fix --- Mathlib/SetTheory/Ordinal/Enum.lean | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Mathlib/SetTheory/Ordinal/Enum.lean b/Mathlib/SetTheory/Ordinal/Enum.lean index 73b118d6da66db..7743d315e25c6e 100644 --- a/Mathlib/SetTheory/Ordinal/Enum.lean +++ b/Mathlib/SetTheory/Ordinal/Enum.lean @@ -90,12 +90,22 @@ theorem ordinalType_eq_of_isCofinal {s : Set α} (hs : IsCofinal s) : typeLT s = noncomputable def enum (s : Set α) (hs : IsCofinal s) : α ≃o s := .ofRelIsoLT (type_eq.1 (ordinalType_eq_of_isCofinal hs).symm).some -theorem enum_le_of_forall_lt {a o : α} {s : Set α} {hs : IsCofinal s} (ha : a ∈ s) - (H : ∀ b < o, enum s hs b < a) : enum s hs o ≤ a := by - rw [← Subtype.coe_mk a ha, Subtype.coe_le_coe, ← OrderIso.le_symm_apply] +theorem enum_le_of_forall_lt {a o : α} {s : Set α} {hs : IsCofinal s} (ho : o ∈ s) + (H : ∀ b < a, enum s hs b < o) : enum s hs a ≤ o := by + rw [← Subtype.coe_mk o ho, Subtype.coe_le_coe, ← OrderIso.le_symm_apply] apply le_of_forall_lt simpa [OrderIso.lt_symm_apply] +theorem enum_succ_le_of_lt [SuccOrder α] {a o : α} {s : Set α} {hs : IsCofinal s} (ha : o ∈ s) + (H : enum s hs a < o) : enum s hs (succ a) ≤ o := by + refine enum_le_of_forall_lt ha fun b hb ↦ H.trans_le' ?_ + simpa using le_of_lt_succ hb + +@[simp] +theorem enum_univ (x : α) : enum univ .univ x = ⟨x, mem_univ x⟩ := by + rw [← Subsingleton.allEq OrderIso.Set.univ.symm (enum univ .univ)] + rfl + end Order -- TODO: Everything below can be subsumed by `Order.enum`. From 10b533912770f3e0bac9dda43b26b73985ef8731 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Wed, 22 Apr 2026 02:41:48 -0600 Subject: [PATCH 27/93] finish --- Mathlib/SetTheory/Ordinal/Enum.lean | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Mathlib/SetTheory/Ordinal/Enum.lean b/Mathlib/SetTheory/Ordinal/Enum.lean index 7743d315e25c6e..2617e4d0040249 100644 --- a/Mathlib/SetTheory/Ordinal/Enum.lean +++ b/Mathlib/SetTheory/Ordinal/Enum.lean @@ -22,7 +22,7 @@ If `s` is a cofinal subset of a regular cardinal order `α`, there exists a uniq function of the set. Note that if `α = ℕ`, then this definition matches `Nat.nth`. -/ -@[expose] public section +public section universe u @@ -86,7 +86,6 @@ theorem ordinalType_eq_of_isCofinal {s : Set α} (hs : IsCofinal s) : typeLT s = /-- Enumerate the elements of a cofinal subset of `α` by `α` itself. This is a generalization of `Nat.nth`. -/ -@[no_expose] noncomputable def enum (s : Set α) (hs : IsCofinal s) : α ≃o s := .ofRelIsoLT (type_eq.1 (ordinalType_eq_of_isCofinal hs).symm).some @@ -118,7 +117,6 @@ variable {o a b : Ordinal.{u}} The definition is an implementation detail; this function is entirely characterized by being an order isomorphism. See `enumOrdOrderIso`. -/ -@[no_expose] noncomputable def enumOrd (s : Set Ordinal.{u}) (o : Ordinal.{u}) : Ordinal.{u} := sInf (s ∩ { b | ∀ c, c < o → enumOrd s c < b }) termination_by o @@ -234,6 +232,7 @@ theorem enumOrd_univ : enumOrd Set.univ = id := by @[simp] lemma enumOrd_zero : enumOrd s 0 = sInf s := by rw [enumOrd]; simp /-- An order isomorphism between an unbounded set of ordinals and the ordinals. -/ +@[expose] noncomputable def enumOrdOrderIso (s : Set Ordinal) (hs : ¬ BddAbove s) : Ordinal ≃o s := StrictMono.orderIsoOfSurjective (fun o => ⟨_, enumOrd_mem hs o⟩) (enumOrd_strictMono hs) fun s => let ⟨a, ha⟩ := enumOrd_surjective hs s.prop From 7856e26f4238680977cbf1ca17fd6d8ecc667d2e Mon Sep 17 00:00:00 2001 From: vihdzp Date: Wed, 22 Apr 2026 02:42:22 -0600 Subject: [PATCH 28/93] better diff? --- Mathlib.lean | 1 - Mathlib/SetTheory/Cardinal/Cofinality.lean | 10 ---------- 2 files changed, 11 deletions(-) delete mode 100644 Mathlib/SetTheory/Cardinal/Cofinality.lean diff --git a/Mathlib.lean b/Mathlib.lean index 6828beca53fb78..0789807d8a77fb 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -6889,7 +6889,6 @@ public import Mathlib.RingTheory.ZariskisMainTheorem public import Mathlib.SetTheory.Cardinal.Aleph public import Mathlib.SetTheory.Cardinal.Arithmetic public import Mathlib.SetTheory.Cardinal.Basic -public import Mathlib.SetTheory.Cardinal.Cofinality public import Mathlib.SetTheory.Cardinal.Cofinality.Basic public import Mathlib.SetTheory.Cardinal.Cofinality.Ordinal public import Mathlib.SetTheory.Cardinal.Continuum diff --git a/Mathlib/SetTheory/Cardinal/Cofinality.lean b/Mathlib/SetTheory/Cardinal/Cofinality.lean deleted file mode 100644 index 5ebd227c4d66f6..00000000000000 --- a/Mathlib/SetTheory/Cardinal/Cofinality.lean +++ /dev/null @@ -1,10 +0,0 @@ -/- -Copyright (c) 2017 Mario Carneiro. All rights reserved. -Released under Apache 2.0 license as described in the file LICENSE. -Authors: Mario Carneiro, Floris van Doorn, Violeta Hernández Palacios --/ -module - -public import Mathlib.SetTheory.Cardinal.Cofinality.Ordinal - -deprecated_module (since := "2026-04-22") From 10eb4686b5c3cb22fcfd4d5b342664557f84b267 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Wed, 22 Apr 2026 02:43:10 -0600 Subject: [PATCH 29/93] of an order --- Mathlib/SetTheory/Cardinal/Cofinality/Basic.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Basic.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Basic.lean index 24354d7b0d5e8a..020b1a98d7f2f0 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Basic.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Basic.lean @@ -9,7 +9,7 @@ public import Mathlib.Order.Cofinal public import Mathlib.SetTheory.Cardinal.Basic /-! -# Cofinality +# Cofinality of an order This file contains the definition of the cofinality `Order.cof α` of an order. This is the smallest cardinality of a cofinal subset. From 847bef0d49bc3ad2d217deab34dc534b724a46b5 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Wed, 22 Apr 2026 02:44:37 -0600 Subject: [PATCH 30/93] fix --- Mathlib.lean | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Mathlib.lean b/Mathlib.lean index 6935a94cb4b1aa..0789807d8a77fb 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -6889,10 +6889,6 @@ public import Mathlib.RingTheory.ZariskisMainTheorem public import Mathlib.SetTheory.Cardinal.Aleph public import Mathlib.SetTheory.Cardinal.Arithmetic public import Mathlib.SetTheory.Cardinal.Basic -<<<<<<< HEAD -public import Mathlib.SetTheory.Cardinal.Cofinality -======= ->>>>>>> move public import Mathlib.SetTheory.Cardinal.Cofinality.Basic public import Mathlib.SetTheory.Cardinal.Cofinality.Ordinal public import Mathlib.SetTheory.Cardinal.Continuum From 36d3d7a4f858d8efa7c9c50c7ff38d9282e87879 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Wed, 22 Apr 2026 02:46:06 -0600 Subject: [PATCH 31/93] rephrase --- Mathlib/SetTheory/Ordinal/Enum.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/SetTheory/Ordinal/Enum.lean b/Mathlib/SetTheory/Ordinal/Enum.lean index 6ec8682e56d0ba..debd9d44a674a7 100644 --- a/Mathlib/SetTheory/Ordinal/Enum.lean +++ b/Mathlib/SetTheory/Ordinal/Enum.lean @@ -16,7 +16,7 @@ generalize the properties of intervals `Iio c.ord`, wherever `c` is a regular ca instances of this typeclass include `ℕ`, `Ordinal`, and `Cardinal`. If `s` is a cofinal subset of a regular cardinal order `α`, there exists a unique order isomorphism -`α ≃o s`, which we call `Order.enum`. When `α = Ordinal`, this is often called the enumerator +`α ≃o s`, which we call `Order.enum`. When `α = Ordinal`, this is referred to as the enumerator function of the set. Note that if `α = ℕ`, then this definition matches `Nat.nth`. -/ From 7d39b7ee77bb8edf14045e9ce317f45138e5dd77 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Wed, 22 Apr 2026 02:50:34 -0600 Subject: [PATCH 32/93] fix yet again --- Mathlib/Order/BoundedOrder/Basic.lean | 8 ++++++++ Mathlib/SetTheory/Ordinal/Enum.lean | 2 ++ 2 files changed, 10 insertions(+) diff --git a/Mathlib/Order/BoundedOrder/Basic.lean b/Mathlib/Order/BoundedOrder/Basic.lean index a4ef0b62357b2d..2f7431b0e28a87 100644 --- a/Mathlib/Order/BoundedOrder/Basic.lean +++ b/Mathlib/Order/BoundedOrder/Basic.lean @@ -313,6 +313,14 @@ end Pi section Subsingleton +/-- A type with a single element is a bounded order. -/ +@[implicit_reducible] +def BoundedOrder.ofUnique (α : Type*) [Preorder α] [Unique α] : BoundedOrder α where + bot := default + top := default + le_top := by simp + bot_le := by simp + variable [PartialOrder α] [BoundedOrder α] @[to_dual] diff --git a/Mathlib/SetTheory/Ordinal/Enum.lean b/Mathlib/SetTheory/Ordinal/Enum.lean index debd9d44a674a7..3f3862c304eabf 100644 --- a/Mathlib/SetTheory/Ordinal/Enum.lean +++ b/Mathlib/SetTheory/Ordinal/Enum.lean @@ -5,7 +5,9 @@ Authors: Violeta Hernández Palacios -/ module +public import Mathlib.SetTheory.Cardinal.Cofinality.Basic public import Mathlib.SetTheory.Ordinal.Family +public import Mathlib.SetTheory.Ordinal.Univ /-! # Enumerating a cofinal set From d25eb9ef93d2a146d9b2fe835f5abe06795bcf52 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Wed, 22 Apr 2026 02:54:58 -0600 Subject: [PATCH 33/93] new file --- Mathlib.lean | 1 + .../SetTheory/Cardinal/Cofinality/Enum.lean | 113 ++++++++++++++++++ Mathlib/SetTheory/Ordinal/Enum.lean | 105 ++-------------- 3 files changed, 125 insertions(+), 94 deletions(-) create mode 100644 Mathlib/SetTheory/Cardinal/Cofinality/Enum.lean diff --git a/Mathlib.lean b/Mathlib.lean index 0789807d8a77fb..20f45a0d048203 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -6890,6 +6890,7 @@ public import Mathlib.SetTheory.Cardinal.Aleph public import Mathlib.SetTheory.Cardinal.Arithmetic public import Mathlib.SetTheory.Cardinal.Basic public import Mathlib.SetTheory.Cardinal.Cofinality.Basic +public import Mathlib.SetTheory.Cardinal.Cofinality.Enum public import Mathlib.SetTheory.Cardinal.Cofinality.Ordinal public import Mathlib.SetTheory.Cardinal.Continuum public import Mathlib.SetTheory.Cardinal.CountableCover diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Enum.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Enum.lean new file mode 100644 index 00000000000000..b63964edfa7e86 --- /dev/null +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Enum.lean @@ -0,0 +1,113 @@ +/- +Copyright (c) 2026 Violeta Hernández Palacios. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Violeta Hernández Palacios +-/ +module + +public import Mathlib.SetTheory.Cardinal.Cofinality.Basic +public import Mathlib.SetTheory.Ordinal.Family +public import Mathlib.SetTheory.Ordinal.Univ + +/-! +# Enumerating a cofinal set + +We define a typeclass `IsRegularCardinalOrder` for well-ordered types, whose order type equals (the +initial ordinal of) their cofinality. This notion does not appear in the literature, but intends to +generalize the properties of intervals `Iio c.ord`, wherever `c` is a regular cardinal. Other +instances of this typeclass include `ℕ`, `Ordinal`, and `Cardinal`. + +If `s` is a cofinal subset of a regular cardinal order `α`, there exists a unique order isomorphism +`α ≃o s`, which we call `Order.enum`. When `α = Ordinal`, this is referred to as the enumerator +function of the set. Note that if `α = ℕ`, then this definition matches `Nat.nth`. + +## Todo + +- Deprecate `Ordinal.enumOrd` in favor of `Order.enum`. +- Prove that `Order.enum` on the naturals coincides with `Nat.nth`. +-/ + +public section + +universe u + +open Cardinal Order Ordinal Set + +variable {α : Type*} + +/-- A typeclass which expresses that the order type of a well-order equals (the initial ordinal of) +its cofinality. + +If `α` is infinite, this implies that `α` is order isomorphic to `Iio c.ord` for some regular +cardinal `c`. In the informal literature, one often says that `α` is a regular cardinal, by abuse +of notation. -/ +class IsRegularCardinalOrder (α : Type*) [LinearOrder α] [WellFoundedLT α] where + type_le_ord_cof : typeLT α ≤ (cof α).ord + +instance : IsRegularCardinalOrder ℕ := ⟨by simp⟩ + +instance (priority := low) [LinearOrder α] [WellFoundedLT α] [Subsingleton α] : + IsRegularCardinalOrder α where + type_le_ord_cof := by + cases isEmpty_or_nonempty α + · simpa + · cases nonempty_unique α + have := BoundedOrder.ofUnique α + simp + +instance : IsRegularCardinalOrder Ordinal where + type_le_ord_cof := by + rw [type_lt_ordinal, ← ord_univ, ord_le_ord, le_cof_iff] + intro s hs + contrapose! hs + rw [← Cardinal.lift_id (#s), ← small_iff_lift_mk_lt_univ] at hs + rw [not_isCofinal_iff_bddAbove] + exact Ordinal.bddAbove_of_small + +namespace Order +variable [LinearOrder α] [WellFoundedLT α] [IsRegularCardinalOrder α] + +theorem ord_cof_eq_type_lt : (cof α).ord = typeLT α := by + apply IsRegularCardinalOrder.type_le_ord_cof.antisymm' + rw [ord_le, card_type] + exact cof_le_cardinalMk α + +@[simp] +theorem cof_eq_card : cof α = #α := by + rw [← card_type LT.lt, ← ord_cof_eq_type_lt, card_ord] + +@[simp] +theorem ord_cardinalMk : ord (#α) = typeLT α := by + rw [← ord_cof_eq_type_lt, cof_eq_card] + +@[simp] +theorem cof_ordinal : cof Ordinal.{u} = Cardinal.univ.{u, u + 1} := by + simp [← Cardinal.univ_id] + +theorem ordinalType_eq_of_isCofinal {s : Set α} (hs : IsCofinal s) : typeLT s = typeLT α := by + apply (RelEmbedding.ofMonotone Subtype.val (by simp)).ordinal_type_le.antisymm + rw [← ord_cardinalMk, ord_le, card_type, ← cof_eq_card] + exact cof_le hs + +/-- Enumerate the elements of a cofinal subset of `α` by `α` itself. This is a generalization of +`Nat.nth`. -/ +noncomputable def enum (s : Set α) (hs : IsCofinal s) : α ≃o s := + .ofRelIsoLT (type_eq.1 (ordinalType_eq_of_isCofinal hs).symm).some + +theorem enum_le_of_forall_lt {a o : α} {s : Set α} {hs : IsCofinal s} (ho : o ∈ s) + (H : ∀ b < a, enum s hs b < o) : enum s hs a ≤ o := by + rw [← Subtype.coe_mk o ho, Subtype.coe_le_coe, ← OrderIso.le_symm_apply] + apply le_of_forall_lt + simpa [OrderIso.lt_symm_apply] + +theorem enum_succ_le_of_lt [SuccOrder α] {a o : α} {s : Set α} {hs : IsCofinal s} (ha : o ∈ s) + (H : enum s hs a < o) : enum s hs (succ a) ≤ o := by + refine enum_le_of_forall_lt ha fun b hb ↦ H.trans_le' ?_ + simpa using le_of_lt_succ hb + +@[simp] +theorem enum_univ (x : α) : enum univ .univ x = ⟨x, mem_univ x⟩ := by + rw [← Subsingleton.allEq OrderIso.Set.univ.symm (enum univ .univ)] + rfl + +end Order diff --git a/Mathlib/SetTheory/Ordinal/Enum.lean b/Mathlib/SetTheory/Ordinal/Enum.lean index 3f3862c304eabf..e1235d74f92012 100644 --- a/Mathlib/SetTheory/Ordinal/Enum.lean +++ b/Mathlib/SetTheory/Ordinal/Enum.lean @@ -5,109 +5,26 @@ Authors: Violeta Hernández Palacios -/ module -public import Mathlib.SetTheory.Cardinal.Cofinality.Basic public import Mathlib.SetTheory.Ordinal.Family -public import Mathlib.SetTheory.Ordinal.Univ /-! -# Enumerating a cofinal set +# Enumerating sets of ordinals by ordinals -We define a typeclass `IsRegularCardinalOrder` for well-ordered types, whose order type equals (the -initial ordinal of) their cofinality. This notion does not appear in the literature, but intends to -generalize the properties of intervals `Iio c.ord`, wherever `c` is a regular cardinal. Other -instances of this typeclass include `ℕ`, `Ordinal`, and `Cardinal`. +The ordinals have the peculiar property that every subset bounded above is a small type, while +themselves not being small. As a consequence of this, every unbounded subset of `Ordinal` is order +isomorphic to `Ordinal`. -If `s` is a cofinal subset of a regular cardinal order `α`, there exists a unique order isomorphism -`α ≃o s`, which we call `Order.enum`. When `α = Ordinal`, this is referred to as the enumerator -function of the set. Note that if `α = ℕ`, then this definition matches `Nat.nth`. +We define this correspondence as `enumOrd`, and use it to then define an order isomorphism +`enumOrdOrderIso`. + +This can be thought of as an ordinal analog of `Nat.nth`. -/ -public section +@[expose] public section universe u -open Cardinal Order Ordinal Set - -variable {α : Type*} - -/-- A typeclass which expresses that the order type of a well-order equals (the initial ordinal of) -its cofinality. - -If `α` is infinite, this implies that `α` is order isomorphic to `Iio c.ord` for some regular -cardinal `c`. In the informal literature, one often says that `α` is a regular cardinal, by abuse -of notation. -/ -class IsRegularCardinalOrder (α : Type*) [LinearOrder α] [WellFoundedLT α] where - type_le_ord_cof : typeLT α ≤ (cof α).ord - -instance : IsRegularCardinalOrder ℕ := ⟨by simp⟩ - -instance (priority := low) [LinearOrder α] [WellFoundedLT α] [Subsingleton α] : - IsRegularCardinalOrder α where - type_le_ord_cof := by - cases isEmpty_or_nonempty α - · simpa - · cases nonempty_unique α - have := BoundedOrder.ofUnique α - simp - -instance : IsRegularCardinalOrder Ordinal where - type_le_ord_cof := by - rw [type_lt_ordinal, ← ord_univ, ord_le_ord, le_cof_iff] - intro s hs - contrapose! hs - rw [← Cardinal.lift_id (#s), ← small_iff_lift_mk_lt_univ] at hs - rw [not_isCofinal_iff_bddAbove] - exact Ordinal.bddAbove_of_small - -namespace Order -variable [LinearOrder α] [WellFoundedLT α] [IsRegularCardinalOrder α] - -theorem ord_cof_eq_type_lt : (cof α).ord = typeLT α := by - apply IsRegularCardinalOrder.type_le_ord_cof.antisymm' - rw [ord_le, card_type] - exact cof_le_cardinalMk α - -@[simp] -theorem cof_eq_card : cof α = #α := by - rw [← card_type LT.lt, ← ord_cof_eq_type_lt, card_ord] - -@[simp] -theorem ord_cardinalMk : ord (#α) = typeLT α := by - rw [← ord_cof_eq_type_lt, cof_eq_card] - -@[simp] -theorem cof_ordinal : cof Ordinal.{u} = Cardinal.univ.{u, u + 1} := by - simp [← Cardinal.univ_id] - -theorem ordinalType_eq_of_isCofinal {s : Set α} (hs : IsCofinal s) : typeLT s = typeLT α := by - apply (RelEmbedding.ofMonotone Subtype.val (by simp)).ordinal_type_le.antisymm - rw [← ord_cardinalMk, ord_le, card_type, ← cof_eq_card] - exact cof_le hs - -/-- Enumerate the elements of a cofinal subset of `α` by `α` itself. This is a generalization of -`Nat.nth`. -/ -noncomputable def enum (s : Set α) (hs : IsCofinal s) : α ≃o s := - .ofRelIsoLT (type_eq.1 (ordinalType_eq_of_isCofinal hs).symm).some - -theorem enum_le_of_forall_lt {a o : α} {s : Set α} {hs : IsCofinal s} (ho : o ∈ s) - (H : ∀ b < a, enum s hs b < o) : enum s hs a ≤ o := by - rw [← Subtype.coe_mk o ho, Subtype.coe_le_coe, ← OrderIso.le_symm_apply] - apply le_of_forall_lt - simpa [OrderIso.lt_symm_apply] - -theorem enum_succ_le_of_lt [SuccOrder α] {a o : α} {s : Set α} {hs : IsCofinal s} (ha : o ∈ s) - (H : enum s hs a < o) : enum s hs (succ a) ≤ o := by - refine enum_le_of_forall_lt ha fun b hb ↦ H.trans_le' ?_ - simpa using le_of_lt_succ hb - -@[simp] -theorem enum_univ (x : α) : enum univ .univ x = ⟨x, mem_univ x⟩ := by - rw [← Subsingleton.allEq OrderIso.Set.univ.symm (enum univ .univ)] - rfl - -end Order - --- TODO: Everything below can be subsumed by `Order.enum`. +open Order Set namespace Ordinal @@ -117,6 +34,7 @@ variable {o a b : Ordinal.{u}} The definition is an implementation detail; this function is entirely characterized by being an order isomorphism. See `enumOrdOrderIso`. -/ +@[no_expose] noncomputable def enumOrd (s : Set Ordinal.{u}) (o : Ordinal.{u}) : Ordinal.{u} := sInf (s ∩ { b | ∀ c, c < o → enumOrd s c < b }) termination_by o @@ -232,7 +150,6 @@ theorem enumOrd_univ : enumOrd Set.univ = id := by @[simp] lemma enumOrd_zero : enumOrd s 0 = sInf s := by rw [enumOrd]; simp /-- An order isomorphism between an unbounded set of ordinals and the ordinals. -/ -@[expose] noncomputable def enumOrdOrderIso (s : Set Ordinal) (hs : ¬ BddAbove s) : Ordinal ≃o s := StrictMono.orderIsoOfSurjective (fun o => ⟨_, enumOrd_mem hs o⟩) (enumOrd_strictMono hs) fun s => let ⟨a, ha⟩ := enumOrd_surjective hs s.prop From 55025a71fdbf89b7e714aa9afb5c1cb5b2e4a818 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Wed, 22 Apr 2026 04:54:31 -0600 Subject: [PATCH 34/93] fix --- Mathlib/SetTheory/Cardinal/Cofinality/Enum.lean | 1 - 1 file changed, 1 deletion(-) diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Enum.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Enum.lean index b63964edfa7e86..46d7456e28ae77 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Enum.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Enum.lean @@ -80,7 +80,6 @@ theorem cof_eq_card : cof α = #α := by theorem ord_cardinalMk : ord (#α) = typeLT α := by rw [← ord_cof_eq_type_lt, cof_eq_card] -@[simp] theorem cof_ordinal : cof Ordinal.{u} = Cardinal.univ.{u, u + 1} := by simp [← Cardinal.univ_id] From d472d5c45f05217cd243a09966c6e30faa3ebd01 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Wed, 22 Apr 2026 06:27:03 -0600 Subject: [PATCH 35/93] fix large import --- Mathlib/Order/IsNormal.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/Order/IsNormal.lean b/Mathlib/Order/IsNormal.lean index 3438ef95ec78f7..d9c59cae54ea1c 100644 --- a/Mathlib/Order/IsNormal.lean +++ b/Mathlib/Order/IsNormal.lean @@ -5,7 +5,7 @@ Authors: Violeta Hernández Palacios -/ module -public import Mathlib.Dynamics.FixedPoints.Basic +public import Mathlib.Dynamics.FixedPoints.Defs public import Mathlib.Order.SuccPred.CompleteLinearOrder public import Mathlib.Order.SuccPred.InitialSeg From 5400b16f7532c151d8431edeeb5e3b0871f763ea Mon Sep 17 00:00:00 2001 From: vihdzp Date: Fri, 24 Apr 2026 01:45:30 -0600 Subject: [PATCH 36/93] generalize result --- Mathlib/SetTheory/Cardinal/Club.lean | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Mathlib/SetTheory/Cardinal/Club.lean b/Mathlib/SetTheory/Cardinal/Club.lean index 5bd943500135ec..500dd6bc3c7819 100644 --- a/Mathlib/SetTheory/Cardinal/Club.lean +++ b/Mathlib/SetTheory/Cardinal/Club.lean @@ -125,13 +125,18 @@ theorem IsClub.inter {s t : Set α} (hα : Order.cof α ≠ ℵ₀) (hs : IsClub · exact .sInter hα (hα'.trans_le' <| by simp) H theorem Order.IsNormal.isClub_fixedPoints {f : α → α} - (hα : ℵ₀ < Order.cof α) (hf : Order.IsNormal f) : IsClub f.fixedPoints := by + (hα : Order.cof α ≠ ℵ₀) (hf : Order.IsNormal f) : IsClub f.fixedPoints := by cases isEmpty_or_nonempty α; · simp refine ⟨fun s hs hs₀ _ a ha ↦ (hf.map_isLUB ha hs₀).unique ?_, fun a ↦ ?_⟩ · rwa [Set.image_congr hs, Set.image_id'] - · suffices BddAbove (.range fun n ↦ f^[n] a) from - ⟨_, hf.iSup_iterate_mem_fixedPoints a this, le_csSup this ⟨0, rfl⟩⟩ - refine .of_not_isCofinal fun h ↦ (Order.cof_le h).not_gt (hα.trans_le' ?_) - simpa using mk_range_le_lift (f := fun n : ℕ ↦ f^[n] a) + · cases topOrderOrNoTopOrder α with + | inl => use ⊤; simpa using hf.strictMono.id_le ⊤ + | inr h => + rw [noTopOrder_iff_noMaxOrder] at h + suffices BddAbove (.range fun n ↦ f^[n] a) from + ⟨_, hf.iSup_iterate_mem_fixedPoints a this, le_csSup this ⟨0, rfl⟩⟩ + refine .of_not_isCofinal fun h ↦ (Order.cof_le h).not_gt + ((Order.aleph0_le_cof.lt_of_ne' hα).trans_le' ?_) + simpa using mk_range_le_lift (f := fun n : ℕ ↦ f^[n] a) end WellFoundedLT From 5a446de062832fe4b1d129594cbc646985d7b159 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Fri, 24 Apr 2026 01:48:05 -0600 Subject: [PATCH 37/93] namespace open --- Mathlib/SetTheory/Cardinal/Club.lean | 32 ++++++++++++++-------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Mathlib/SetTheory/Cardinal/Club.lean b/Mathlib/SetTheory/Cardinal/Club.lean index 500dd6bc3c7819..6fccbee9b20d10 100644 --- a/Mathlib/SetTheory/Cardinal/Club.lean +++ b/Mathlib/SetTheory/Cardinal/Club.lean @@ -26,7 +26,7 @@ topology), `DirSupClosed s` and `IsClosed s` are equivalent predicates. universe u v -open Cardinal +open Cardinal Order /-- A club set is closed under suprema and cofinal. -/ structure IsClub {α : Type*} [LinearOrder α] (s : Set α) where @@ -68,14 +68,14 @@ theorem IsClub.iInter_of_orderTop {ι : Type*} {f : ι → Set α} [OrderTop α] rw [← Set.sInter_range] exact .sInter_of_orderTop (by simpa) -theorem IsClub.sInter_of_cof_le_one {s : Set (Set α)} (hα : Order.cof α ≤ 1) +theorem IsClub.sInter_of_cof_le_one {s : Set (Set α)} (hα : cof α ≤ 1) (hs : ∀ x ∈ s, IsClub x) : IsClub (⋂₀ s) := by cases isEmpty_or_nonempty α; · simp cases topOrderOrNoTopOrder α · exact .sInter_of_orderTop hs - · cases Order.one_lt_cof.not_ge hα + · cases one_lt_cof.not_ge hα -theorem IsClub.iInter_of_cof_le_one {ι : Type*} {f : ι → Set α} (hα : Order.cof α ≤ 1) +theorem IsClub.iInter_of_cof_le_one {ι : Type*} {f : ι → Set α} (hα : cof α ≤ 1) (hs : ∀ i, IsClub (f i)) : IsClub (⋂ i, f i) := by rw [← Set.sInter_range] exact .sInter_of_cof_le_one hα (by simpa) @@ -87,45 +87,45 @@ variable [WellFoundedLT α] attribute [local instance] WellFoundedLT.toOrderBot WellFoundedLT.conditionallyCompleteLinearOrderBot -theorem IsClub.sInter {s : Set (Set α)} (hα : Order.cof α ≠ ℵ₀) (hsα : #s < Order.cof α) +theorem IsClub.sInter {s : Set (Set α)} (hα : cof α ≠ ℵ₀) (hsα : #s < cof α) (hs : ∀ x ∈ s, IsClub x) : IsClub (⋂₀ s) := by cases isEmpty_or_nonempty α; · simp obtain hα | hα := hα.lt_or_gt - · exact .sInter_of_cof_le_one (Order.cof_lt_aleph0_iff.1 hα) hs + · exact .sInter_of_cof_le_one (cof_lt_aleph0_iff.1 hα) hs refine ⟨.sInter fun x hx ↦ (hs x hx).dirSupClosed, fun a ↦ ?_⟩ choose f hf using fun x : s ↦ (hs _ x.2).isCofinal let g : ℕ → α := Nat.rec a fun _ IH ↦ sSup (.range (f · IH)) have hg : BddAbove (.range g) := by - refine .of_not_isCofinal fun hg ↦ (Order.cof_le hg).not_gt (hα.trans_le' ?_) + refine .of_not_isCofinal fun hg ↦ (cof_le hg).not_gt (hα.trans_le' ?_) simpa using mk_range_le_lift (f := g) refine ⟨_, fun t ht ↦ ?_, le_csSup hg ⟨0, rfl⟩⟩ apply (hs t ht).isLUB_mem (t := .range fun n ↦ f ⟨t, ht⟩ (g n)) _ (Set.range_nonempty _) · refine ⟨?_, fun b hb ↦ csSup_le' ?_⟩ <;> rintro _ ⟨n, rfl⟩ · apply (le_csSup (.of_not_isCofinal _) _).trans (le_csSup hg ⟨n + 1, rfl⟩) - · exact fun hg' ↦ (Order.cof_le hg').not_gt (mk_range_le.trans_lt hsα) + · exact fun hg' ↦ (cof_le hg').not_gt (mk_range_le.trans_lt hsα) · use ⟨t, ht⟩ · exact (hf ⟨t, ht⟩ _).2.trans <| hb ⟨_, rfl⟩ · grind -theorem IsClub.iInter {ι : Type u} {f : ι → Set α} (hα : Order.cof α ≠ ℵ₀) - (hι : Cardinal.lift.{v} #ι < Cardinal.lift.{u} (Order.cof α)) (hf : ∀ i, IsClub (f i)) : +theorem IsClub.iInter {ι : Type u} {f : ι → Set α} (hα : cof α ≠ ℵ₀) + (hι : Cardinal.lift.{v} #ι < Cardinal.lift.{u} (cof α)) (hf : ∀ i, IsClub (f i)) : IsClub (⋂ i, f i) := by rw [← Set.sInter_range] refine IsClub.sInter hα ?_ (by simpa) rw [← Cardinal.lift_lt] exact mk_range_le_lift.trans_lt hι -theorem IsClub.inter {s t : Set α} (hα : Order.cof α ≠ ℵ₀) (hs : IsClub s) (ht : IsClub t) : +theorem IsClub.inter {s t : Set α} (hα : cof α ≠ ℵ₀) (hs : IsClub s) (ht : IsClub t) : IsClub (s ∩ t) := by rw [← Set.sInter_pair] have H : ∀ x ∈ ({s, t} : Set _), IsClub x := by simpa [hs] obtain hα | hα' := hα.lt_or_gt - · rw [Order.cof_lt_aleph0_iff] at hα + · rw [cof_lt_aleph0_iff] at hα exact .sInter_of_cof_le_one hα H · exact .sInter hα (hα'.trans_le' <| by simp) H -theorem Order.IsNormal.isClub_fixedPoints {f : α → α} - (hα : Order.cof α ≠ ℵ₀) (hf : Order.IsNormal f) : IsClub f.fixedPoints := by +theorem IsNormal.isClub_fixedPoints {f : α → α} (hα : cof α ≠ ℵ₀) (hf : IsNormal f) : + IsClub f.fixedPoints := by cases isEmpty_or_nonempty α; · simp refine ⟨fun s hs hs₀ _ a ha ↦ (hf.map_isLUB ha hs₀).unique ?_, fun a ↦ ?_⟩ · rwa [Set.image_congr hs, Set.image_id'] @@ -135,8 +135,8 @@ theorem Order.IsNormal.isClub_fixedPoints {f : α → α} rw [noTopOrder_iff_noMaxOrder] at h suffices BddAbove (.range fun n ↦ f^[n] a) from ⟨_, hf.iSup_iterate_mem_fixedPoints a this, le_csSup this ⟨0, rfl⟩⟩ - refine .of_not_isCofinal fun h ↦ (Order.cof_le h).not_gt - ((Order.aleph0_le_cof.lt_of_ne' hα).trans_le' ?_) + refine .of_not_isCofinal fun h ↦ (cof_le h).not_gt + ((aleph0_le_cof.lt_of_ne' hα).trans_le' ?_) simpa using mk_range_le_lift (f := fun n : ℕ ↦ f^[n] a) end WellFoundedLT From f1b46ac8e7b3d529a0260a9398881d3b93f7ca34 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Fri, 24 Apr 2026 01:48:52 -0600 Subject: [PATCH 38/93] fix --- Mathlib/SetTheory/Cardinal/Club.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/SetTheory/Cardinal/Club.lean b/Mathlib/SetTheory/Cardinal/Club.lean index 6fccbee9b20d10..92f8e938aa9ca9 100644 --- a/Mathlib/SetTheory/Cardinal/Club.lean +++ b/Mathlib/SetTheory/Cardinal/Club.lean @@ -124,7 +124,7 @@ theorem IsClub.inter {s t : Set α} (hα : cof α ≠ ℵ₀) (hs : IsClub s) (h exact .sInter_of_cof_le_one hα H · exact .sInter hα (hα'.trans_le' <| by simp) H -theorem IsNormal.isClub_fixedPoints {f : α → α} (hα : cof α ≠ ℵ₀) (hf : IsNormal f) : +theorem Order.IsNormal.isClub_fixedPoints {f : α → α} (hα : cof α ≠ ℵ₀) (hf : IsNormal f) : IsClub f.fixedPoints := by cases isEmpty_or_nonempty α; · simp refine ⟨fun s hs hs₀ _ a ha ↦ (hf.map_isLUB ha hs₀).unique ?_, fun a ↦ ?_⟩ From 08b5953a4fd3a3a1ec57f94605c378432dd83090 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Fri, 1 May 2026 07:52:01 -0600 Subject: [PATCH 39/93] link correct PR --- Mathlib/SetTheory/Cardinal/Club.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/SetTheory/Cardinal/Club.lean b/Mathlib/SetTheory/Cardinal/Club.lean index 92f8e938aa9ca9..c330ec1ff10097 100644 --- a/Mathlib/SetTheory/Cardinal/Club.lean +++ b/Mathlib/SetTheory/Cardinal/Club.lean @@ -47,7 +47,7 @@ theorem IsClub.of_isEmpty [IsEmpty α] (s : Set α) : IsClub s := theorem IsClub.univ : IsClub (.univ (α := α)) := ⟨.univ, .univ⟩ --- Depends on #37304. +-- Depends on #38807. proof_wanted IsClub.union (hs : IsClub s) (ht : IsClub t) : IsClub (s ∪ t) theorem IsClub.isLUB_mem (hs : IsClub s) (ht : t ⊆ s) (ht₀ : t.Nonempty) (hx : IsLUB t x) : x ∈ s := From d680ddf6c53ecb45076dc4458025dc6173f4f080 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Sat, 9 May 2026 23:30:04 -0600 Subject: [PATCH 40/93] add instance for cardinal --- Mathlib/SetTheory/Cardinal/Aleph.lean | 7 +++++++ Mathlib/SetTheory/Cardinal/Cofinality/Enum.lean | 1 + 2 files changed, 8 insertions(+) diff --git a/Mathlib/SetTheory/Cardinal/Aleph.lean b/Mathlib/SetTheory/Cardinal/Aleph.lean index ebbf3a7b6d7c04..6a4038c543bc66 100644 --- a/Mathlib/SetTheory/Cardinal/Aleph.lean +++ b/Mathlib/SetTheory/Cardinal/Aleph.lean @@ -6,6 +6,7 @@ Authors: Johannes Hölzl, Mario Carneiro, Floris van Doorn, Violeta Hernández P module public import Mathlib.Algebra.Order.Monoid.Basic +public import Mathlib.SetTheory.Cardinal.Cofinality.Enum public import Mathlib.SetTheory.Cardinal.ToNat public import Mathlib.SetTheory.Cardinal.ENat public import Mathlib.SetTheory.Ordinal.Enum @@ -302,6 +303,12 @@ theorem _root_.Ordinal.type_lt_cardinal : typeLT Cardinal = Ordinal.univ.{u, u + theorem mk_cardinal : #Cardinal = univ.{u, u + 1} := by simpa only [card_type, card_univ] using congr_arg card type_lt_cardinal +@[simp] +theorem _root_.Order.cof_cardinal : Order.cof Cardinal.{u} = Cardinal.univ.{u, u + 1} := by + simpa [← Cardinal.univ_id] using preAleph.cof_congr.symm + +instance : IsRegularCardinalOrder Cardinal := ⟨by simp⟩ + theorem preAleph_lt_preAleph {o₁ o₂ : Ordinal} : preAleph o₁ < preAleph o₂ ↔ o₁ < o₂ := preAleph.lt_iff_lt diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Enum.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Enum.lean index 46d7456e28ae77..b63964edfa7e86 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Enum.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Enum.lean @@ -80,6 +80,7 @@ theorem cof_eq_card : cof α = #α := by theorem ord_cardinalMk : ord (#α) = typeLT α := by rw [← ord_cof_eq_type_lt, cof_eq_card] +@[simp] theorem cof_ordinal : cof Ordinal.{u} = Cardinal.univ.{u, u + 1} := by simp [← Cardinal.univ_id] From 1d0cb0fc6c6db0ec7cf162da9fbde00a02245aa7 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Sun, 10 May 2026 00:56:28 -0600 Subject: [PATCH 41/93] fix --- Mathlib/SetTheory/Cardinal/Cofinality/Enum.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Enum.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Enum.lean index b63964edfa7e86..41c9aa94beb8c9 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Enum.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Enum.lean @@ -77,7 +77,7 @@ theorem cof_eq_card : cof α = #α := by rw [← card_type LT.lt, ← ord_cof_eq_type_lt, card_ord] @[simp] -theorem ord_cardinalMk : ord (#α) = typeLT α := by +theorem _root_.Cardinal.ord_cardinalMk : ord (#α) = typeLT α := by rw [← ord_cof_eq_type_lt, cof_eq_card] @[simp] From 48509f65baa9f5311be415b3d08763f2d1c73888 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Sun, 10 May 2026 01:33:46 -0600 Subject: [PATCH 42/93] fix lint --- Mathlib/SetTheory/Cardinal/Aleph.lean | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Mathlib/SetTheory/Cardinal/Aleph.lean b/Mathlib/SetTheory/Cardinal/Aleph.lean index 6a4038c543bc66..a4fbc602b1c5ad 100644 --- a/Mathlib/SetTheory/Cardinal/Aleph.lean +++ b/Mathlib/SetTheory/Cardinal/Aleph.lean @@ -303,11 +303,10 @@ theorem _root_.Ordinal.type_lt_cardinal : typeLT Cardinal = Ordinal.univ.{u, u + theorem mk_cardinal : #Cardinal = univ.{u, u + 1} := by simpa only [card_type, card_univ] using congr_arg card type_lt_cardinal -@[simp] theorem _root_.Order.cof_cardinal : Order.cof Cardinal.{u} = Cardinal.univ.{u, u + 1} := by simpa [← Cardinal.univ_id] using preAleph.cof_congr.symm -instance : IsRegularCardinalOrder Cardinal := ⟨by simp⟩ +instance : IsRegularCardinalOrder Cardinal := ⟨by simp [Order.cof_cardinal]⟩ theorem preAleph_lt_preAleph {o₁ o₂ : Ordinal} : preAleph o₁ < preAleph o₂ ↔ o₁ < o₂ := preAleph.lt_iff_lt From bfcb9c54b284c70db563bcce18be19da2ad5a2f8 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Sun, 10 May 2026 13:29:22 -0600 Subject: [PATCH 43/93] merge --- Mathlib/SetTheory/Cardinal/Aleph.lean | 2 +- Mathlib/SetTheory/Cardinal/Cofinality/Enum.lean | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Mathlib/SetTheory/Cardinal/Aleph.lean b/Mathlib/SetTheory/Cardinal/Aleph.lean index a4fbc602b1c5ad..d1203805c6309c 100644 --- a/Mathlib/SetTheory/Cardinal/Aleph.lean +++ b/Mathlib/SetTheory/Cardinal/Aleph.lean @@ -304,7 +304,7 @@ theorem mk_cardinal : #Cardinal = univ.{u, u + 1} := by simpa only [card_type, card_univ] using congr_arg card type_lt_cardinal theorem _root_.Order.cof_cardinal : Order.cof Cardinal.{u} = Cardinal.univ.{u, u + 1} := by - simpa [← Cardinal.univ_id] using preAleph.cof_congr.symm + simpa using preAleph.cof_congr.symm instance : IsRegularCardinalOrder Cardinal := ⟨by simp [Order.cof_cardinal]⟩ diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Enum.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Enum.lean index 41c9aa94beb8c9..d2315b47b8edc5 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Enum.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Enum.lean @@ -80,9 +80,8 @@ theorem cof_eq_card : cof α = #α := by theorem _root_.Cardinal.ord_cardinalMk : ord (#α) = typeLT α := by rw [← ord_cof_eq_type_lt, cof_eq_card] -@[simp] theorem cof_ordinal : cof Ordinal.{u} = Cardinal.univ.{u, u + 1} := by - simp [← Cardinal.univ_id] + simp theorem ordinalType_eq_of_isCofinal {s : Set α} (hs : IsCofinal s) : typeLT s = typeLT α := by apply (RelEmbedding.ofMonotone Subtype.val (by simp)).ordinal_type_le.antisymm From 44e2cb5ca00b7437c0085862fc41055ab3f00a3c Mon Sep 17 00:00:00 2001 From: vihdzp Date: Sun, 10 May 2026 15:10:35 -0600 Subject: [PATCH 44/93] union --- .../SetTheory/Cardinal/Cofinality/Club.lean | 142 ++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 Mathlib/SetTheory/Cardinal/Cofinality/Club.lean diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean new file mode 100644 index 00000000000000..8ac9c5f1a782ff --- /dev/null +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean @@ -0,0 +1,142 @@ +/- +Copyright (c) 2026 Violeta Hernández Palacios. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Violeta Hernández Palacios +-/ +module + +public import Mathlib.SetTheory.Cardinal.Cofinality.Basic +public import Mathlib.Order.DirSupClosed + +/-! +# Club sets + +A subset of a well-ordered type `α` is called a club set when it is closed in the order topology and +cofinal. If `α` has no maximum, then an equivalent condition is that `α` is closed and unbounded; +hence the name. + +## Implementation notes + +To avoid importing topology in the ordinals, we spell out the closure property using `DirSupClosed`. +For any type equipped with the Scott-Hausdorff topology (which includes well-orders with the order +topology), `DirSupClosed s` and `IsClosed s` are equivalent predicates. +-/ + +@[expose] public section + +universe u v + +open Cardinal Order + +/-- A club set is closed under suprema and cofinal. -/ +structure IsClub {α : Type*} [LinearOrder α] (s : Set α) where + /-- Club sets are closed under suprema. If `α` is a well-order with the order topology, this + condition is equivalent to `IsClosed s`. -/ + dirSupClosed : DirSupClosed s + /-- Club sets are cofinal. If `α` has no maximum, this condition is equivalent to `¬ BddAbove s`. + See `not_bddAbove_iff_isCofinal`. -/ + isCofinal : IsCofinal s + +variable {α : Type v} {s t : Set α} {x : α} [LinearOrder α] + +@[simp] +theorem IsClub.of_isEmpty [IsEmpty α] (s : Set α) : IsClub s := + ⟨.of_isEmpty s, .of_isEmpty s⟩ + +@[simp] +theorem IsClub.univ : IsClub (.univ (α := α)) := + ⟨.univ, .univ⟩ + +theorem IsClub.union (hs : IsClub s) (ht : IsClub t) : IsClub (s ∪ t) := + ⟨hs.dirSupClosed.union ht.dirSupClosed, hs.isCofinal.mono Set.subset_union_left⟩ + +theorem IsClub.isLUB_mem (hs : IsClub s) (ht : t ⊆ s) (ht₀ : t.Nonempty) (hx : IsLUB t x) : x ∈ s := + hs.dirSupClosed ht ht₀ (Std.Total.directedOn _) hx + +theorem IsClub.csSup_mem {α} [ConditionallyCompleteLinearOrder α] {s t : Set α} + (hs : IsClub s) (ht : t ⊆ s) (ht₀ : t.Nonempty) (ht₁ : BddAbove t) : sSup t ∈ s := + hs.isLUB_mem ht ht₀ (isLUB_csSup ht₀ ht₁) + +theorem IsClub.sInter_of_orderTop {s : Set (Set α)} [OrderTop α] + (hs : ∀ x ∈ s, IsClub x) : IsClub (⋂₀ s) := by + refine ⟨.sInter fun x hx ↦ (hs x hx).dirSupClosed, ?_⟩ + rw [isCofinal_iff_top_mem, Set.mem_sInter] + exact fun x hx ↦ (hs x hx).isCofinal.top_mem + +theorem IsClub.iInter_of_orderTop {ι : Type*} {f : ι → Set α} [OrderTop α] + (hs : ∀ i, IsClub (f i)) : IsClub (⋂ i, f i) := by + rw [← Set.sInter_range] + exact .sInter_of_orderTop (by simpa) + +theorem IsClub.sInter_of_cof_le_one {s : Set (Set α)} (hα : cof α ≤ 1) + (hs : ∀ x ∈ s, IsClub x) : IsClub (⋂₀ s) := by + cases isEmpty_or_nonempty α; · simp + cases topOrderOrNoTopOrder α + · exact .sInter_of_orderTop hs + · cases one_lt_cof.not_ge hα + +theorem IsClub.iInter_of_cof_le_one {ι : Type*} {f : ι → Set α} (hα : cof α ≤ 1) + (hs : ∀ i, IsClub (f i)) : IsClub (⋂ i, f i) := by + rw [← Set.sInter_range] + exact .sInter_of_cof_le_one hα (by simpa) + +section WellFoundedLT + +variable [WellFoundedLT α] + +attribute [local instance] + WellFoundedLT.toOrderBot WellFoundedLT.conditionallyCompleteLinearOrderBot + +theorem IsClub.sInter {s : Set (Set α)} (hα : cof α ≠ ℵ₀) (hsα : #s < cof α) + (hs : ∀ x ∈ s, IsClub x) : IsClub (⋂₀ s) := by + cases isEmpty_or_nonempty α; · simp + obtain hα | hα := hα.lt_or_gt + · exact .sInter_of_cof_le_one (cof_lt_aleph0_iff.1 hα) hs + refine ⟨.sInter fun x hx ↦ (hs x hx).dirSupClosed, fun a ↦ ?_⟩ + choose f hf using fun x : s ↦ (hs _ x.2).isCofinal + let g : ℕ → α := Nat.rec a fun _ IH ↦ sSup (.range (f · IH)) + have hg : BddAbove (.range g) := by + refine .of_not_isCofinal fun hg ↦ (cof_le hg).not_gt (hα.trans_le' ?_) + simpa using mk_range_le_lift (f := g) + refine ⟨_, fun t ht ↦ ?_, le_csSup hg ⟨0, rfl⟩⟩ + apply (hs t ht).isLUB_mem (t := .range fun n ↦ f ⟨t, ht⟩ (g n)) _ (Set.range_nonempty _) + · refine ⟨?_, fun b hb ↦ csSup_le' ?_⟩ <;> rintro _ ⟨n, rfl⟩ + · apply (le_csSup (.of_not_isCofinal _) _).trans (le_csSup hg ⟨n + 1, rfl⟩) + · exact fun hg' ↦ (cof_le hg').not_gt (mk_range_le.trans_lt hsα) + · use ⟨t, ht⟩ + · exact (hf ⟨t, ht⟩ _).2.trans <| hb ⟨_, rfl⟩ + · grind + +theorem IsClub.iInter {ι : Type u} {f : ι → Set α} (hα : cof α ≠ ℵ₀) + (hι : Cardinal.lift.{v} #ι < Cardinal.lift.{u} (cof α)) (hf : ∀ i, IsClub (f i)) : + IsClub (⋂ i, f i) := by + rw [← Set.sInter_range] + refine IsClub.sInter hα ?_ (by simpa) + rw [← Cardinal.lift_lt] + exact mk_range_le_lift.trans_lt hι + +theorem IsClub.inter {s t : Set α} (hα : cof α ≠ ℵ₀) (hs : IsClub s) (ht : IsClub t) : + IsClub (s ∩ t) := by + rw [← Set.sInter_pair] + have H : ∀ x ∈ ({s, t} : Set _), IsClub x := by simpa [hs] + obtain hα | hα' := hα.lt_or_gt + · rw [cof_lt_aleph0_iff] at hα + exact .sInter_of_cof_le_one hα H + · exact .sInter hα (hα'.trans_le' <| by simp) H + +theorem Order.IsNormal.isClub_fixedPoints {f : α → α} (hα : cof α ≠ ℵ₀) (hf : IsNormal f) : + IsClub f.fixedPoints := by + cases isEmpty_or_nonempty α; · simp + refine ⟨fun s hs hs₀ _ a ha ↦ (hf.map_isLUB ha hs₀).unique ?_, fun a ↦ ?_⟩ + · rwa [Set.image_congr hs, Set.image_id'] + · cases topOrderOrNoTopOrder α with + | inl => use ⊤; simpa using hf.strictMono.id_le ⊤ + | inr h => + rw [noTopOrder_iff_noMaxOrder] at h + suffices BddAbove (.range fun n ↦ f^[n] a) from + ⟨_, hf.iSup_iterate_mem_fixedPoints a this, le_csSup this ⟨0, rfl⟩⟩ + refine .of_not_isCofinal fun h ↦ (cof_le h).not_gt + ((aleph0_le_cof.lt_of_ne' hα).trans_le' ?_) + simpa using mk_range_le_lift (f := fun n : ℕ ↦ f^[n] a) + +end WellFoundedLT From d65b49e66fdcc60a7cec01ab0449c38d4dbf734e Mon Sep 17 00:00:00 2001 From: vihdzp Date: Sun, 10 May 2026 15:11:02 -0600 Subject: [PATCH 45/93] order imports --- Mathlib/SetTheory/Cardinal/Cofinality/Club.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean index 8ac9c5f1a782ff..6d60bfab4026bd 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean @@ -5,8 +5,8 @@ Authors: Violeta Hernández Palacios -/ module -public import Mathlib.SetTheory.Cardinal.Cofinality.Basic public import Mathlib.Order.DirSupClosed +public import Mathlib.SetTheory.Cardinal.Cofinality.Basic /-! # Club sets From f594449e5f9dd64c77d212143d108d4cbd9c2ab4 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Sun, 10 May 2026 15:12:50 -0600 Subject: [PATCH 46/93] fix import --- Mathlib/SetTheory/Cardinal/Cofinality/Club.lean | 1 + 1 file changed, 1 insertion(+) diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean index 6d60bfab4026bd..2479d4120733e9 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean @@ -6,6 +6,7 @@ Authors: Violeta Hernández Palacios module public import Mathlib.Order.DirSupClosed +public import Mathlib.Order.IsNormal public import Mathlib.SetTheory.Cardinal.Cofinality.Basic /-! From 8ba3699ced5fcf3e2c4a14d1cf755baf7677f9f7 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Sun, 10 May 2026 15:25:39 -0600 Subject: [PATCH 47/93] fix name --- Mathlib/SetTheory/Cardinal/Cofinality/Enum.lean | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Enum.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Enum.lean index d2315b47b8edc5..b9e55e283b70fb 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Enum.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Enum.lean @@ -73,19 +73,19 @@ theorem ord_cof_eq_type_lt : (cof α).ord = typeLT α := by exact cof_le_cardinalMk α @[simp] -theorem cof_eq_card : cof α = #α := by +theorem cof_eq_cardinalMk : cof α = #α := by rw [← card_type LT.lt, ← ord_cof_eq_type_lt, card_ord] @[simp] theorem _root_.Cardinal.ord_cardinalMk : ord (#α) = typeLT α := by - rw [← ord_cof_eq_type_lt, cof_eq_card] + rw [← ord_cof_eq_type_lt, cof_eq_cardinalMk] theorem cof_ordinal : cof Ordinal.{u} = Cardinal.univ.{u, u + 1} := by simp theorem ordinalType_eq_of_isCofinal {s : Set α} (hs : IsCofinal s) : typeLT s = typeLT α := by apply (RelEmbedding.ofMonotone Subtype.val (by simp)).ordinal_type_le.antisymm - rw [← ord_cardinalMk, ord_le, card_type, ← cof_eq_card] + rw [← ord_cardinalMk, ord_le, card_type, ← cof_eq_cardinalMk] exact cof_le hs /-- Enumerate the elements of a cofinal subset of `α` by `α` itself. This is a generalization of From a46ea2c4aafe0a9dc706eda2aade542d175447b2 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Sun, 10 May 2026 15:34:45 -0600 Subject: [PATCH 48/93] non-dependent version --- .../SetTheory/Cardinal/Cofinality/Club.lean | 26 ++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean index d04877fc403a4f..c09c486a23228f 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean @@ -147,15 +147,12 @@ theorem IsClub.diag [IsRegularCardinalOrder α] {f : α → Set α} (hα : ℵ isCofinal a := by have : Nonempty α := ⟨a⟩ have := (noTopOrder_iff_noMaxOrder α).1 <| Order.one_lt_cof_iff.1 (one_lt_aleph0.trans hα) - have hα' : Order.cof α = #α := Order.cof_eq_cardinalMk have (b : α) : ∃ c ∈ ⋂₀ (f '' Set.Iio b), b < c := by obtain ⟨b', hb'⟩ := exists_gt b have ⟨c, hc, hbc⟩ := (IsClub.sInter (s := f '' Set.Iio b) hα.ne' (mk_image_le.trans_lt ?_) ?_).isCofinal b' · exact ⟨c, hc, hb'.trans_le hbc⟩ - · rw [hα'] - apply mk_Iio_lt - rw [← hα, hα'] + · simpa using mk_Iio_lt b · simp [hf] choose g hg using this have hgm : StrictMono fun n ↦ g^[n] a := by @@ -164,7 +161,7 @@ theorem IsClub.diag [IsRegularCardinalOrder α] {f : α → Set α} (hα : ℵ exact (hg _).2 have hg' : IsLUB (.range fun n ↦ g^[n] a) (⨆ n, g^[n] a) := by refine isLUB_ciSup (.of_not_isCofinal fun h ↦ ?_) - apply (Order.cof_le h).not_gt (hα'.trans_le' _) + apply (Order.cof_le h).not_gt (hα.trans_le' _) simpa using mk_range_le_lift (f := fun n ↦ g^[n] a) refine ⟨⨆ n, g^[n] a, fun b hb ↦ ?_, hg'.1 ⟨0, rfl⟩⟩ obtain ⟨_, ⟨n, rfl⟩, hb, hn⟩ := hg'.exists_between hb @@ -212,8 +209,8 @@ theorem IsStationary.nonempty (hs : IsStationary s) : s.Nonempty := by simpa using hs .univ theorem isStationary_univ_iff : IsStationary (.univ (α := α)) ↔ Nonempty α := by - simp_rw [IsStationary, Set.univ_inter, ← not_imp_not (b := IsClub _), - Set.not_nonempty_iff_eq_empty, forall_eq, isClub_empty_iff, not_isEmpty_iff] + simp [IsStationary, ← not_imp_not (b := IsClub _), + Set.not_nonempty_iff_eq_empty, isClub_empty_iff] @[simp] theorem IsStationary.univ [Nonempty α] : IsStationary (.univ (α := α)) := @@ -231,17 +228,16 @@ theorem IsStationary.of_not_isCofinal_compl (hs : ¬ IsCofinal (sᶜ)) : IsStati proof_wanted isStationary_iff_not_isCofinal_compl (hα : Order.cof α ≤ ℵ₀) : IsStationary s ↔ ¬ IsCofinal (sᶜ) -/-- **Fodor's lemma,** or the **pressing down lemma:** if `α` has the order type of a regular -cardinal, `s` is a stationary set, and `f : s → α` is a regressive function, there exists some -stationary subset of `s` which is constant on `f`. -/ +/-- **Fodor's lemma**, or the **pressing down lemma**: if `α` has the order type of a regular +cardinal, `s` is a stationary set, and `f : α → α` is a regressive function on `s`, there exists +some stationary subset of `s` which is constant on `f`. -/ theorem exists_isStationary_preimage_singleton - [WellFoundedLT α] [IsRegularCardinalOrder α] {f : s → α} (hα : ℵ₀ < Order.cof α) - (hs : IsStationary s) (hf : ∀ x : s, f x < x) : - ∃ a, IsStationary (Subtype.val '' (f ⁻¹' {a})) := by + [WellFoundedLT α] [IsRegularCardinalOrder α] {f : α → α} (hα : ℵ₀ < Order.cof α) + (hs : IsStationary s) (hf : ∀ x ∈ s, f x < x) : ∃ a, IsStationary (s ∩ f ⁻¹' {a}) := by unfold IsStationary by_contra! choose g hg using this simp_rw [Set.eq_empty_iff_forall_notMem] at hg obtain ⟨a, hs, ha⟩ := hs <| .diag hα fun a ↦ (hg a).1 - apply (hg (f ⟨a, hs⟩)).2 a - simpa using ⟨hs, ha _ (hf ⟨a, hs⟩)⟩ + apply (hg (f a)).2 a + grind From 9381344c427dbd98baffa2a76b820ef76b8e858e Mon Sep 17 00:00:00 2001 From: vihdzp Date: Sun, 10 May 2026 15:37:52 -0600 Subject: [PATCH 49/93] golf --- Mathlib/SetTheory/Cardinal/Cofinality/Club.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean index 2479d4120733e9..98ecd168ec3db0 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean @@ -45,7 +45,7 @@ theorem IsClub.of_isEmpty [IsEmpty α] (s : Set α) : IsClub s := ⟨.of_isEmpty s, .of_isEmpty s⟩ @[simp] -theorem IsClub.univ : IsClub (.univ (α := α)) := +theorem IsClub.univ : IsClub (α := α) .univ := ⟨.univ, .univ⟩ theorem IsClub.union (hs : IsClub s) (ht : IsClub t) : IsClub (s ∪ t) := From 5229c352b58d4fd75fad4768f1bf308e4e6db86f Mon Sep 17 00:00:00 2001 From: vihdzp Date: Wed, 13 May 2026 04:17:43 -0600 Subject: [PATCH 50/93] implicit --- Mathlib/Order/Cofinal.lean | 4 ++-- Mathlib/Order/DirSupClosed.lean | 8 ++++---- Mathlib/SetTheory/Cardinal/Cofinality/Club.lean | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Mathlib/Order/Cofinal.lean b/Mathlib/Order/Cofinal.lean index 9bf81301cea08a..0e8b480d90627f 100644 --- a/Mathlib/Order/Cofinal.lean +++ b/Mathlib/Order/Cofinal.lean @@ -34,11 +34,11 @@ variable {α β : Type*} section LE variable [LE α] -theorem IsCofinal.of_isEmpty [IsEmpty α] (s : Set α) : IsCofinal s := +theorem IsCofinal.of_isEmpty [IsEmpty α] {s : Set α} : IsCofinal s := fun a ↦ isEmptyElim a theorem isCofinal_empty_iff : IsCofinal (∅ : Set α) ↔ IsEmpty α := by - refine ⟨fun h ↦ ⟨fun a ↦ ?_⟩, fun h ↦ .of_isEmpty _⟩ + refine ⟨fun h ↦ ⟨fun a ↦ ?_⟩, fun h ↦ .of_isEmpty⟩ simpa using h a @[simp] diff --git a/Mathlib/Order/DirSupClosed.lean b/Mathlib/Order/DirSupClosed.lean index 55a1f0824831de..ead09bf1ac225a 100644 --- a/Mathlib/Order/DirSupClosed.lean +++ b/Mathlib/Order/DirSupClosed.lean @@ -63,14 +63,14 @@ def DirSupInacc (s : Set α) : Prop := @[simp] lemma DirSupClosed.dirSupClosedOn : DirSupClosed s → DirSupClosedOn D s := @fun h _ _ ↦ @h _ @[simp] lemma DirSupInacc.dirSupInaccOn : DirSupInacc s → DirSupInaccOn D s := @fun h _ _ ↦ @h _ -@[simp] theorem DirSupClosed.of_isEmpty [IsEmpty α] (s : Set α) : DirSupClosed s := +@[simp] theorem DirSupClosed.of_isEmpty [IsEmpty α] {s : Set α} : DirSupClosed s := fun _ _ ⟨a, _⟩ ↦ isEmptyElim a -@[simp] theorem DirSupInacc.of_isEmpty [IsEmpty α] (s : Set α) : DirSupInacc s := +@[simp] theorem DirSupInacc.of_isEmpty [IsEmpty α] {s : Set α} : DirSupInacc s := fun _ ⟨a, _⟩ ↦ isEmptyElim a -theorem DirSupClosedOn.of_isEmpty [IsEmpty α] (s : Set α) : DirSupClosedOn D s := by simp -theorem DirSupInaccOn.of_isEmpty [IsEmpty α] (s : Set α) : DirSupInaccOn D s := by simp +theorem DirSupClosedOn.of_isEmpty [IsEmpty α] {s : Set α} : DirSupClosedOn D s := by simp +theorem DirSupInaccOn.of_isEmpty [IsEmpty α] {s : Set α} : DirSupInaccOn D s := by simp @[gcongr] lemma DirSupClosedOn.mono (hD : D₁ ⊆ D₂) (hf : DirSupClosedOn D₂ s) : DirSupClosedOn D₁ s := diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean index 98ecd168ec3db0..0b8222270ecde8 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean @@ -23,7 +23,7 @@ For any type equipped with the Scott-Hausdorff topology (which includes well-ord topology), `DirSupClosed s` and `IsClosed s` are equivalent predicates. -/ -@[expose] public section +public section universe u v @@ -41,8 +41,8 @@ structure IsClub {α : Type*} [LinearOrder α] (s : Set α) where variable {α : Type v} {s t : Set α} {x : α} [LinearOrder α] @[simp] -theorem IsClub.of_isEmpty [IsEmpty α] (s : Set α) : IsClub s := - ⟨.of_isEmpty s, .of_isEmpty s⟩ +theorem IsClub.of_isEmpty [IsEmpty α] {s : Set α} : IsClub s := + ⟨.of_isEmpty, .of_isEmpty⟩ @[simp] theorem IsClub.univ : IsClub (α := α) .univ := From 9b0ec71b56f3ccf4a5528ffa1f0491df04dddca7 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Wed, 13 May 2026 04:39:40 -0600 Subject: [PATCH 51/93] additions --- Mathlib/SetTheory/Cardinal/Cofinality/Club.lean | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean index 0b8222270ecde8..58671ac506a2db 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean @@ -52,7 +52,7 @@ theorem IsClub.union (hs : IsClub s) (ht : IsClub t) : IsClub (s ∪ t) := ⟨hs.dirSupClosed.union ht.dirSupClosed, hs.isCofinal.mono Set.subset_union_left⟩ theorem IsClub.isLUB_mem (hs : IsClub s) (ht : t ⊆ s) (ht₀ : t.Nonempty) (hx : IsLUB t x) : x ∈ s := - hs.dirSupClosed ht ht₀ (Std.Total.directedOn _) hx + hs.dirSupClosed ht ht₀ (.of_linearOrder _) hx theorem IsClub.csSup_mem {α} [ConditionallyCompleteLinearOrder α] {s t : Set α} (hs : IsClub s) (ht : t ⊆ s) (ht₀ : t.Nonempty) (ht₁ : BddAbove t) : sSup t ∈ s := @@ -125,6 +125,9 @@ theorem IsClub.inter {s t : Set α} (hα : cof α ≠ ℵ₀) (hs : IsClub s) (h exact .sInter_of_cof_le_one hα H · exact .sInter hα (hα'.trans_le' <| by simp) H +theorem Order.IsNormal.isClub_range {f : α → α} (hf : IsNormal f) : IsClub (.range f) := + ⟨hf.dirSupClosed_range, fun x ↦ ⟨_, ⟨x, rfl⟩, hf.strictMono.le_apply⟩⟩ + theorem Order.IsNormal.isClub_fixedPoints {f : α → α} (hα : cof α ≠ ℵ₀) (hf : IsNormal f) : IsClub f.fixedPoints := by cases isEmpty_or_nonempty α; · simp From 740c16af535979f0bd31ada4c146c835ba0932c8 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Thu, 14 May 2026 02:33:09 -0600 Subject: [PATCH 52/93] fix --- Mathlib/SetTheory/Ordinal/FixedPoint.lean | 18 ++++++++++++------ .../SetTheory/Ordinal/FundamentalSequence.lean | 2 +- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Mathlib/SetTheory/Ordinal/FixedPoint.lean b/Mathlib/SetTheory/Ordinal/FixedPoint.lean index 80b66dc0a5aec2..ce2db50a1c1c51 100644 --- a/Mathlib/SetTheory/Ordinal/FixedPoint.lean +++ b/Mathlib/SetTheory/Ordinal/FixedPoint.lean @@ -340,6 +340,7 @@ def deriv (f : Ordinal → Ordinal) : Ordinal → Ordinal := theorem deriv_eq_derivFamily (f : Ordinal → Ordinal) : deriv f = derivFamily fun _ : Unit => f := rfl +-- TODO: rename to `deriv_zero` once the name is available @[simp] theorem deriv_zero_right (f) : deriv f 0 = nfp f 0 := derivFamily_zero _ @@ -361,6 +362,7 @@ theorem isNormal_deriv (f) : IsNormal (deriv f) := theorem deriv_strictMono (f) : StrictMono (deriv f) := derivFamily_strictMono _ +@[deprecated "do not depend on the junk values of `nfp`" (since := "2026-05-13")] theorem deriv_eq_id_of_nfp_eq_id (h : nfp f = id) : deriv f = id := ((isNormal_deriv _).ext_iff .id).2 (by simp [h]) @@ -396,6 +398,7 @@ theorem deriv_eq_enumOrd (H : IsNormal f) : deriv f = enumOrd (Function.fixedPoi convert derivFamily_eq_enumOrd fun _ : Unit => H exact (Set.iInter_const _).symm +@[deprecated "do not depend on the junk values of `nfp`" (since := "2026-05-13")] theorem nfp_zero_left (a) : nfp 0 a = a := by rw [← iSup_iterate_eq_nfp] apply (Ordinal.iSup_le ?_).antisymm (Ordinal.le_iSup _ 0) @@ -405,15 +408,19 @@ theorem nfp_zero_left (a) : nfp 0 a = a := by · rw [Function.iterate_succ'] simp -@[simp] +set_option linter.deprecated false in +@[deprecated "do not depend on the junk values of `nfp`" (since := "2026-05-13")] theorem nfp_zero : nfp 0 = id := by ext exact nfp_zero_left _ -@[simp] +set_option linter.deprecated false in +@[deprecated "do not depend on the junk values of `deriv`" (since := "2026-05-13")] theorem deriv_zero : deriv 0 = id := deriv_eq_id_of_nfp_eq_id nfp_zero +set_option linter.deprecated false in +@[deprecated "do not depend on the junk values of `deriv`" (since := "2026-05-13")] theorem deriv_zero_left (a) : deriv 0 a = a := by rw [deriv_zero, id_eq] @@ -468,10 +475,9 @@ theorem nfp_mul_zero (a : Ordinal) : nfp (a * ·) 0 = 0 := by theorem nfp_mul_eq_opow_omega0 {a b : Ordinal} (hb : 0 < b) (hba : b ≤ a ^ ω) : nfp (a * ·) b = a ^ ω := by - rcases eq_zero_or_pos a with ha | ha - · rw [ha, zero_opow omega0_ne_zero] at hba ⊢ - simp_rw [nonpos_iff_eq_zero.1 hba, zero_mul] - exact nfp_zero_left 0 + rcases eq_zero_or_pos a with rfl | ha + · rw [zero_opow omega0_ne_zero] at hba + cases hba.not_gt hb apply le_antisymm · apply nfp_le_fp (isNormal_mul_right ha).monotone hba rw [← opow_one_add, one_add_omega0] diff --git a/Mathlib/SetTheory/Ordinal/FundamentalSequence.lean b/Mathlib/SetTheory/Ordinal/FundamentalSequence.lean index 18d98a4fb95d8a..c2247285cf7f62 100644 --- a/Mathlib/SetTheory/Ordinal/FundamentalSequence.lean +++ b/Mathlib/SetTheory/Ordinal/FundamentalSequence.lean @@ -75,7 +75,7 @@ protected theorem id (ho : o ≤ o.cof.ord) : IsFundamentalSeq (o := o) id where protected theorem zero (f : Iio 0 → Iio 0) : IsFundamentalSeq f where strictMono _ := by simp le_ord_cof := by simp - isCofinal_range := .of_isEmpty _ + isCofinal_range := .of_isEmpty /-- The length one sequence `(o)` is a fundamental sequence for `o + 1`. -/ protected theorem add_one (o : Ordinal) : From 57d79cffd1e397a063143421b09383026c146e4c Mon Sep 17 00:00:00 2001 From: vihdzp Date: Wed, 20 May 2026 23:50:32 -0600 Subject: [PATCH 53/93] fix --- .../SetTheory/Cardinal/Cofinality/Club.lean | 39 ++++++++++--------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean index 58671ac506a2db..7aa88a68cc09b1 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean @@ -38,46 +38,48 @@ structure IsClub {α : Type*} [LinearOrder α] (s : Set α) where See `not_bddAbove_iff_isCofinal`. -/ isCofinal : IsCofinal s +namespace IsClub + variable {α : Type v} {s t : Set α} {x : α} [LinearOrder α] @[simp] -theorem IsClub.of_isEmpty [IsEmpty α] {s : Set α} : IsClub s := +theorem of_isEmpty [IsEmpty α] {s : Set α} : IsClub s := ⟨.of_isEmpty, .of_isEmpty⟩ @[simp] -theorem IsClub.univ : IsClub (α := α) .univ := +protected theorem univ : IsClub (α := α) .univ := ⟨.univ, .univ⟩ -theorem IsClub.union (hs : IsClub s) (ht : IsClub t) : IsClub (s ∪ t) := +protected theorem union (hs : IsClub s) (ht : IsClub t) : IsClub (s ∪ t) := ⟨hs.dirSupClosed.union ht.dirSupClosed, hs.isCofinal.mono Set.subset_union_left⟩ -theorem IsClub.isLUB_mem (hs : IsClub s) (ht : t ⊆ s) (ht₀ : t.Nonempty) (hx : IsLUB t x) : x ∈ s := +theorem isLUB_mem (hs : IsClub s) (ht : t ⊆ s) (ht₀ : t.Nonempty) (hx : IsLUB t x) : x ∈ s := hs.dirSupClosed ht ht₀ (.of_linearOrder _) hx -theorem IsClub.csSup_mem {α} [ConditionallyCompleteLinearOrder α] {s t : Set α} +theorem csSup_mem {α} [ConditionallyCompleteLinearOrder α] {s t : Set α} (hs : IsClub s) (ht : t ⊆ s) (ht₀ : t.Nonempty) (ht₁ : BddAbove t) : sSup t ∈ s := hs.isLUB_mem ht ht₀ (isLUB_csSup ht₀ ht₁) -theorem IsClub.sInter_of_orderTop {s : Set (Set α)} [OrderTop α] - (hs : ∀ x ∈ s, IsClub x) : IsClub (⋂₀ s) := by +theorem sInter_of_orderTop {s : Set (Set α)} [OrderTop α] (hs : ∀ x ∈ s, IsClub x) : + IsClub (⋂₀ s) := by refine ⟨.sInter fun x hx ↦ (hs x hx).dirSupClosed, ?_⟩ rw [isCofinal_iff_top_mem, Set.mem_sInter] exact fun x hx ↦ (hs x hx).isCofinal.top_mem -theorem IsClub.iInter_of_orderTop {ι : Type*} {f : ι → Set α} [OrderTop α] - (hs : ∀ i, IsClub (f i)) : IsClub (⋂ i, f i) := by +theorem iInter_of_orderTop {ι : Type*} {f : ι → Set α} [OrderTop α] (hs : ∀ i, IsClub (f i)) : + IsClub (⋂ i, f i) := by rw [← Set.sInter_range] exact .sInter_of_orderTop (by simpa) -theorem IsClub.sInter_of_cof_le_one {s : Set (Set α)} (hα : cof α ≤ 1) - (hs : ∀ x ∈ s, IsClub x) : IsClub (⋂₀ s) := by +theorem sInter_of_cof_le_one {s : Set (Set α)} (hα : cof α ≤ 1) (hs : ∀ x ∈ s, IsClub x) : + IsClub (⋂₀ s) := by cases isEmpty_or_nonempty α; · simp cases topOrderOrNoTopOrder α · exact .sInter_of_orderTop hs · cases one_lt_cof.not_ge hα -theorem IsClub.iInter_of_cof_le_one {ι : Type*} {f : ι → Set α} (hα : cof α ≤ 1) - (hs : ∀ i, IsClub (f i)) : IsClub (⋂ i, f i) := by +theorem iInter_of_cof_le_one {ι : Type*} {f : ι → Set α} (hα : cof α ≤ 1) (hs : ∀ i, IsClub (f i)) : + IsClub (⋂ i, f i) := by rw [← Set.sInter_range] exact .sInter_of_cof_le_one hα (by simpa) @@ -88,7 +90,7 @@ variable [WellFoundedLT α] attribute [local instance] WellFoundedLT.toOrderBot WellFoundedLT.conditionallyCompleteLinearOrderBot -theorem IsClub.sInter {s : Set (Set α)} (hα : cof α ≠ ℵ₀) (hsα : #s < cof α) +protected theorem sInter {s : Set (Set α)} (hα : cof α ≠ ℵ₀) (hsα : #s < cof α) (hs : ∀ x ∈ s, IsClub x) : IsClub (⋂₀ s) := by cases isEmpty_or_nonempty α; · simp obtain hα | hα := hα.lt_or_gt @@ -108,7 +110,7 @@ theorem IsClub.sInter {s : Set (Set α)} (hα : cof α ≠ ℵ₀) (hsα : #s < · exact (hf ⟨t, ht⟩ _).2.trans <| hb ⟨_, rfl⟩ · grind -theorem IsClub.iInter {ι : Type u} {f : ι → Set α} (hα : cof α ≠ ℵ₀) +protected theorem iInter {ι : Type u} {f : ι → Set α} (hα : cof α ≠ ℵ₀) (hι : Cardinal.lift.{v} #ι < Cardinal.lift.{u} (cof α)) (hf : ∀ i, IsClub (f i)) : IsClub (⋂ i, f i) := by rw [← Set.sInter_range] @@ -116,7 +118,7 @@ theorem IsClub.iInter {ι : Type u} {f : ι → Set α} (hα : cof α ≠ ℵ₀ rw [← Cardinal.lift_lt] exact mk_range_le_lift.trans_lt hι -theorem IsClub.inter {s t : Set α} (hα : cof α ≠ ℵ₀) (hs : IsClub s) (ht : IsClub t) : +protected theorem inter {s t : Set α} (hα : cof α ≠ ℵ₀) (hs : IsClub s) (ht : IsClub t) : IsClub (s ∩ t) := by rw [← Set.sInter_pair] have H : ∀ x ∈ ({s, t} : Set _), IsClub x := by simpa [hs] @@ -125,10 +127,10 @@ theorem IsClub.inter {s t : Set α} (hα : cof α ≠ ℵ₀) (hs : IsClub s) (h exact .sInter_of_cof_le_one hα H · exact .sInter hα (hα'.trans_le' <| by simp) H -theorem Order.IsNormal.isClub_range {f : α → α} (hf : IsNormal f) : IsClub (.range f) := +theorem _root_.Order.IsNormal.isClub_range {f : α → α} (hf : IsNormal f) : IsClub (.range f) := ⟨hf.dirSupClosed_range, fun x ↦ ⟨_, ⟨x, rfl⟩, hf.strictMono.le_apply⟩⟩ -theorem Order.IsNormal.isClub_fixedPoints {f : α → α} (hα : cof α ≠ ℵ₀) (hf : IsNormal f) : +theorem _root_.Order.IsNormal.isClub_fixedPoints {f : α → α} (hα : cof α ≠ ℵ₀) (hf : IsNormal f) : IsClub f.fixedPoints := by cases isEmpty_or_nonempty α; · simp refine ⟨fun s hs hs₀ _ a ha ↦ (hf.map_isLUB ha hs₀).unique ?_, fun a ↦ ?_⟩ @@ -144,3 +146,4 @@ theorem Order.IsNormal.isClub_fixedPoints {f : α → α} (hα : cof α ≠ ℵ simpa using mk_range_le_lift (f := fun n : ℕ ↦ f^[n] a) end WellFoundedLT +end IsClub From 9e1d76207e3ca5135cb181279dbabe3dd96d9ca5 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Thu, 21 May 2026 06:49:08 -0600 Subject: [PATCH 54/93] fix --- Mathlib/SetTheory/Cardinal/Cofinality/Enum.lean | 5 ----- Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean | 11 ----------- Mathlib/SetTheory/Ordinal/Basic.lean | 2 +- 3 files changed, 1 insertion(+), 17 deletions(-) diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Enum.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Enum.lean index bea8189850be03..b9e55e283b70fb 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Enum.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Enum.lean @@ -88,11 +88,6 @@ theorem ordinalType_eq_of_isCofinal {s : Set α} (hs : IsCofinal s) : typeLT s = rw [← ord_cardinalMk, ord_le, card_type, ← cof_eq_cardinalMk] exact cof_le hs -/-- See `Cardinal.mk_Iio_lt` for a more general version. -/ -@[simp] -theorem _root_.Cardinal.mk_Iio_lt' (i : α) : #(Iio i) < #α := - mk_Iio_lt i (by simp) - /-- Enumerate the elements of a cofinal subset of `α` by `α` itself. This is a generalization of `Nat.nth`. -/ noncomputable def enum (s : Set α) (hs : IsCofinal s) : α ≃o s := diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean index a3fbe3edf236a9..3bb5d313071f28 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean @@ -558,17 +558,6 @@ theorem cof_univ : cof univ.{u, v} = Cardinal.univ.{u, v} := by ← not_bddAbove_iff_isCofinal] exact fun s hs ↦ mk_le_of_injective (enumOrdOrderIso s hs).injective -@[simp] -theorem _root_.Order.cof_ordinal : Order.cof Ordinal.{u} = Cardinal.univ.{u, u + 1} := by - have := (OrderIso.ofRelIsoLT liftPrincipalSeg.subrelIso.{u, u + 1}).lift_cof_congr - rw [Cardinal.lift_id'.{_, u + 2}] at this - change Order.cof (Iio univ) = _ at this - rwa [cof_Iio, ← lift_cof, Cardinal.lift_inj, cof_univ, eq_comm] at this - -@[simp] -theorem _root_.Order.cof_cardinal : Order.cof Cardinal.{u} = Cardinal.univ.{u, u + 1} := by - rw [← preAleph.cof_congr, cof_ordinal] - end Ordinal namespace Cardinal diff --git a/Mathlib/SetTheory/Ordinal/Basic.lean b/Mathlib/SetTheory/Ordinal/Basic.lean index c4f01a597b1fd2..7da8fd44cd36c3 100644 --- a/Mathlib/SetTheory/Ordinal/Basic.lean +++ b/Mathlib/SetTheory/Ordinal/Basic.lean @@ -1185,7 +1185,7 @@ theorem card_typein_lt {r : α → α → Prop} [IsWellOrder α r] (x : α) (h : rw [← lt_ord, h] apply typein_lt_type -/-- See `Cardinal.mk_Iio_lt'` for a weaker version which infers a proof of `h`. -/ +@[simp] theorem mk_Iio_lt [LinearOrder α] [WellFoundedLT α] (i : α) (h : ord #α = typeLT α) : #(Iio i) < #α := card_typein_lt (r := LT.lt) i h From c8521e441de7306935c2c92c3e49ef08de43e937 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Fri, 22 May 2026 12:49:22 -0600 Subject: [PATCH 55/93] more --- Mathlib/SetTheory/Cardinal/Cofinality/Club.lean | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean index 4eb0f1e6857e55..4bdd698022aef1 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean @@ -225,6 +225,12 @@ theorem isStationary_univ_iff : IsStationary (.univ (α := α)) ↔ Nonempty α theorem IsStationary.univ [Nonempty α] : IsStationary (.univ (α := α)) := isStationary_univ_iff.2 ‹_› +theorem IsClub.isStationary [WellFoundedLT α] (hα : ℵ₀ < cof α) (hs : IsClub s) : + IsStationary s := by + have := hα.ne_zero + rw [cof_ne_zero_iff] at this + exact fun t ht ↦ (hs.inter hα.ne' ht).nonempty + theorem IsStationary.of_not_isCofinal_compl (hs : ¬ IsCofinal (sᶜ)) : IsStationary s := by intro t ht obtain ⟨a, ha⟩ := not_isCofinal_iff.1 hs From 4f77cf988b5315b50d3385d6327c760e7c7c4bf5 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Fri, 22 May 2026 12:49:37 -0600 Subject: [PATCH 56/93] more --- Mathlib/Order/Cofinal.lean | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Mathlib/Order/Cofinal.lean b/Mathlib/Order/Cofinal.lean index 0e8b480d90627f..c3376807934a07 100644 --- a/Mathlib/Order/Cofinal.lean +++ b/Mathlib/Order/Cofinal.lean @@ -53,6 +53,11 @@ theorem IsCofinal.mono {s t : Set α} (h : s ⊆ t) (hs : IsCofinal s) : IsCofin obtain ⟨b, hb, hb'⟩ := hs a exact ⟨b, h hb, hb'⟩ +theorem IsCofinal.nonempty [Nonempty α] {s : Set α} (h : IsCofinal s) : s.Nonempty := by + inhabit α + obtain ⟨x, hx, _⟩ := h default + exact ⟨x, hx⟩ + end LE section Preorder From 89367827f204e92f59bd869d6b16a5e83d34f2bf Mon Sep 17 00:00:00 2001 From: vihdzp Date: Fri, 22 May 2026 13:02:22 -0600 Subject: [PATCH 57/93] changes --- Mathlib/SetTheory/Cardinal/Cofinality/Club.lean | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean index 4bdd698022aef1..7c615ba79a5790 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean @@ -55,6 +55,9 @@ theorem of_isEmpty [IsEmpty α] {s : Set α} : IsClub s := protected theorem univ : IsClub (α := α) .univ := ⟨.univ, .univ⟩ +protected theorem nonempty [Nonempty α] (hs : IsClub s) : s.Nonempty := + hs.isCofinal.nonempty + theorem _root_.isClub_empty_iff : IsClub (α := α) ∅ ↔ IsEmpty α := ⟨fun h ↦ isCofinal_empty_iff.1 h.isCofinal, fun _ ↦ .of_isEmpty⟩ From b4866a383e625ec84a55341bdc11118a2803553e Mon Sep 17 00:00:00 2001 From: vihdzp Date: Fri, 22 May 2026 14:20:54 -0600 Subject: [PATCH 58/93] ideal --- Mathlib/SetTheory/Cardinal/Cofinality/Club.lean | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean index 7c615ba79a5790..38141ed3ee8f21 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean @@ -228,12 +228,26 @@ theorem isStationary_univ_iff : IsStationary (.univ (α := α)) ↔ Nonempty α theorem IsStationary.univ [Nonempty α] : IsStationary (.univ (α := α)) := isStationary_univ_iff.2 ‹_› +@[simp] +theorem not_isStationary_empty : ¬ IsStationary (∅ : Set α) := by + intro h + simpa using h .univ + theorem IsClub.isStationary [WellFoundedLT α] (hα : ℵ₀ < cof α) (hs : IsClub s) : IsStationary s := by have := hα.ne_zero rw [cof_ne_zero_iff] at this exact fun t ht ↦ (hs.inter hα.ne' ht).nonempty +/-- Non-stationary sets form an ideal. -/ +theorem not_isStationary_union [WellFoundedLT α] (hα : cof α ≠ ℵ₀) + (hs : ¬ IsStationary s) (ht : ¬ IsStationary t) : ¬ IsStationary (s ∪ t) := by + simp_rw [IsStationary, not_forall, Set.not_nonempty_iff_eq_empty] at * + obtain ⟨u, hu, hsu⟩ := hs + obtain ⟨v, hv, htv⟩ := ht + refine ⟨_, hu.inter hα hv, ?_⟩ + grind + theorem IsStationary.of_not_isCofinal_compl (hs : ¬ IsCofinal (sᶜ)) : IsStationary s := by intro t ht obtain ⟨a, ha⟩ := not_isCofinal_iff.1 hs From 4810229c1795ab26663e1a5c80de53ad562e9640 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Fri, 22 May 2026 14:24:22 -0600 Subject: [PATCH 59/93] start --- .../SetTheory/Cardinal/Cofinality/Club.lean | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean index 58671ac506a2db..8b28e08548d621 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean @@ -144,3 +144,54 @@ theorem Order.IsNormal.isClub_fixedPoints {f : α → α} (hα : cof α ≠ ℵ simpa using mk_range_le_lift (f := fun n : ℕ ↦ f^[n] a) end WellFoundedLT + +/-! ### Stationary sets -/ + +/-- A set is called stationary when it intersects all club sets. -/ +@[expose] +def IsStationary (s : Set α) : Prop := + ∀ ⦃t⦄, IsClub t → (s ∩ t).Nonempty + +@[gcongr] +theorem IsStationary.mono (hs : IsStationary s) (h : s ⊆ t) : IsStationary t := + fun _u hu ↦ (hs hu).mono (Set.inter_subset_inter_left _ h) + +theorem IsStationary.nonempty (hs : IsStationary s) : s.Nonempty := by + simpa using hs .univ + +theorem isStationary_univ_iff : IsStationary (.univ (α := α)) ↔ Nonempty α := by + simp [IsStationary, ← not_imp_not (b := IsClub _), Set.not_nonempty_iff_eq_empty, + isClub_empty_iff] + +@[simp] +theorem IsStationary.univ [Nonempty α] : IsStationary (.univ (α := α)) := + isStationary_univ_iff.2 ‹_› + +@[simp] +theorem not_isStationary_empty : ¬ IsStationary (∅ : Set α) := by + intro h + simpa using h .univ + +theorem IsClub.isStationary [Nonempty α] [WellFoundedLT α] (hα : cof α ≠ ℵ₀) (hs : IsClub s) : + IsStationary s := + fun t ht ↦ (hs.inter hα ht).nonempty + +/-- Non-stationary sets form an ideal. -/ +theorem not_isStationary_union [WellFoundedLT α] (hα : cof α ≠ ℵ₀) + (hs : ¬ IsStationary s) (ht : ¬ IsStationary t) : ¬ IsStationary (s ∪ t) := by + simp_rw [IsStationary, not_forall, Set.not_nonempty_iff_eq_empty] at hs ht ⊢ + obtain ⟨u, hu, hsu⟩ := hs + obtain ⟨v, hv, htv⟩ := ht + refine ⟨_, hu.inter hα hv, ?_⟩ + grind + +theorem IsStationary.of_not_isCofinal_compl (hs : ¬ IsCofinal (sᶜ)) : IsStationary s := by + intro t ht + obtain ⟨a, ha⟩ := not_isCofinal_iff.1 hs + obtain ⟨b, hb, hb'⟩ := ht.isCofinal a + refine ⟨b, ?_, hb⟩ + contrapose! ha + exact ⟨b, ha, hb'⟩ + +proof_wanted isStationary_iff_not_isCofinal_compl (hα : cof α ≤ ℵ₀) : + IsStationary s ↔ ¬ IsCofinal (sᶜ) From 41a7add19d3b1932309f458e628105609419806c Mon Sep 17 00:00:00 2001 From: vihdzp Date: Fri, 22 May 2026 14:25:14 -0600 Subject: [PATCH 60/93] more --- Mathlib/SetTheory/Cardinal/Cofinality/Club.lean | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean index 8b28e08548d621..3382aa467ac76a 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean @@ -48,6 +48,12 @@ theorem IsClub.of_isEmpty [IsEmpty α] {s : Set α} : IsClub s := theorem IsClub.univ : IsClub (α := α) .univ := ⟨.univ, .univ⟩ +protected theorem IsClub.nonempty [Nonempty α] (hs : IsClub s) : s.Nonempty := + hs.isCofinal.nonempty + +theorem _root_.isClub_empty_iff : IsClub (α := α) ∅ ↔ IsEmpty α := + ⟨fun h ↦ isCofinal_empty_iff.1 h.isCofinal, fun _ ↦ .of_isEmpty⟩ + theorem IsClub.union (hs : IsClub s) (ht : IsClub t) : IsClub (s ∪ t) := ⟨hs.dirSupClosed.union ht.dirSupClosed, hs.isCofinal.mono Set.subset_union_left⟩ From ee445e07229f3f814acbddc7e4638daf32aa6af1 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Fri, 22 May 2026 14:26:13 -0600 Subject: [PATCH 61/93] more --- Mathlib/Order/Cofinal.lean | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Mathlib/Order/Cofinal.lean b/Mathlib/Order/Cofinal.lean index 0e8b480d90627f..c3376807934a07 100644 --- a/Mathlib/Order/Cofinal.lean +++ b/Mathlib/Order/Cofinal.lean @@ -53,6 +53,11 @@ theorem IsCofinal.mono {s t : Set α} (h : s ⊆ t) (hs : IsCofinal s) : IsCofin obtain ⟨b, hb, hb'⟩ := hs a exact ⟨b, h hb, hb'⟩ +theorem IsCofinal.nonempty [Nonempty α] {s : Set α} (h : IsCofinal s) : s.Nonempty := by + inhabit α + obtain ⟨x, hx, _⟩ := h default + exact ⟨x, hx⟩ + end LE section Preorder From a8dd5605e1e9890b2f675c54842e9f8c96b05fd8 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Fri, 22 May 2026 16:07:01 -0600 Subject: [PATCH 62/93] a lot --- Mathlib/Data/Fintype/Order.lean | 8 ++++++ Mathlib/Order/DirSupClosed.lean | 26 ++++++++++++++++++- .../SetTheory/Cardinal/Cofinality/Basic.lean | 3 +++ .../SetTheory/Cardinal/Cofinality/Club.lean | 25 +++++++++++------- .../Cardinal/Cofinality/Ordinal.lean | 23 ++++++++++++++-- Mathlib/SetTheory/Ordinal/Basic.lean | 4 +++ 6 files changed, 77 insertions(+), 12 deletions(-) diff --git a/Mathlib/Data/Fintype/Order.lean b/Mathlib/Data/Fintype/Order.lean index e4a5f7b738f08f..b02781ca86ac7d 100644 --- a/Mathlib/Data/Fintype/Order.lean +++ b/Mathlib/Data/Fintype/Order.lean @@ -195,6 +195,14 @@ lemma Directed.finite_le {ι κ : Sort*} [Nonempty ι] [Finite κ] {f : ι → simpa using (hf.comp_of_surjective PLift.down_surjective).finite_set_le (Set.finite_range (PLift.up ∘ g)) +theorem DirectedOn.finite_le {s : Set α} (hs₀ : s.Nonempty) (D : DirectedOn r s) + (hs : s.Finite) : ∃ z ∈ s, ∀ i ∈ s, r i z := by + have := hs₀.to_subtype + have := hs.to_subtype + obtain ⟨⟨z, hzs⟩, hz⟩ := D.directed_val.finite_le id + use z, hzs + simpa using hz + variable [Nonempty α] [Preorder α] theorem Finite.exists_le [IsDirectedOrder α] (f : β → α) : ∃ M, ∀ i, f i ≤ M := diff --git a/Mathlib/Order/DirSupClosed.lean b/Mathlib/Order/DirSupClosed.lean index ead09bf1ac225a..e6401757f06c46 100644 --- a/Mathlib/Order/DirSupClosed.lean +++ b/Mathlib/Order/DirSupClosed.lean @@ -5,11 +5,12 @@ Authors: Christopher Hoskin, Violeta Hernández Palacios -/ module +public import Mathlib.Data.Fintype.Order public import Mathlib.Order.Antisymmetrization public import Mathlib.Order.CompleteLattice.Defs public import Mathlib.Order.UpperLower.Basic -import Mathlib.Data.Set.Lattice +import Mathlib.Data.Nat.Lattice /-! # Sets closed under directed suprema @@ -300,6 +301,29 @@ theorem dirSupClosed_singleton (a : α) : DirSupClosed {a} := by theorem dirSupClosedOn_singleton (a : α) : DirSupClosedOn D {a} := (dirSupClosed_singleton a).dirSupClosedOn +theorem DirSupClosed.of_finite (hs : s.Finite) : DirSupClosed s := by + intro t ht ht₀ ht₁ a ha + obtain ⟨b, hbt, hb⟩ := ht₁.finite_le ht₀ (hs.subset ht) + exact ht <| ha.unique ⟨hb, fun x hx ↦ hx hbt⟩ ▸ hbt + +theorem dirSupClosed_range_nat {f : ℕ → α} (hf : Monotone f) (hf' : IsCofinal (.range f)) : + DirSupClosed (range f) := by + intro s hs hs₀ hs₁ a ha + obtain ⟨_, ⟨n, rfl⟩, han⟩ := hf' a + obtain rfl | han := han.eq_or_lt + · simp + have hfb : BddAbove (f ⁻¹' s) := by + refine ⟨n, fun m hm ↦ ?_⟩ + by_contra! hnm + exact (ha.1 hm).not_gt (han.trans_le (hf hnm.le)) + refine ⟨sSup (f ⁻¹' s), IsLUB.unique ⟨?_, ?_⟩ ha⟩ <;> intro x hx + · obtain ⟨m, rfl⟩ := hs hx + exact hf (le_csSup hfb hx) + · apply hx (Nat.sSup_mem _ hfb) + obtain ⟨x, hx⟩ := hs₀ + obtain ⟨m, rfl⟩ := hs hx + exact ⟨m, hx⟩ + end PartialOrder section LinearOrder diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Basic.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Basic.lean index ff288badfea0f4..54a8ed9659b53f 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Basic.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Basic.lean @@ -131,6 +131,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 : Order.cof α < ℵ₀ ↔ Order.cof α ≤ 1 := by refine ⟨fun h ↦ ?_, (lt_of_le_of_lt · one_lt_aleph0)⟩ diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean index 3382aa467ac76a..7749083bbce226 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean @@ -5,9 +5,7 @@ Authors: Violeta Hernández Palacios -/ module -public import Mathlib.Order.DirSupClosed -public import Mathlib.Order.IsNormal -public import Mathlib.SetTheory.Cardinal.Cofinality.Basic +public import Mathlib.SetTheory.Cardinal.Cofinality.Ordinal /-! # Club sets @@ -27,7 +25,7 @@ public section universe u v -open Cardinal Order +open Cardinal Order Ordinal /-- A club set is closed under suprema and cofinal. -/ structure IsClub {α : Type*} [LinearOrder α] (s : Set α) where @@ -51,7 +49,7 @@ theorem IsClub.univ : IsClub (α := α) .univ := protected theorem IsClub.nonempty [Nonempty α] (hs : IsClub s) : s.Nonempty := hs.isCofinal.nonempty -theorem _root_.isClub_empty_iff : IsClub (α := α) ∅ ↔ IsEmpty α := +theorem isClub_empty_iff : IsClub (α := α) ∅ ↔ IsEmpty α := ⟨fun h ↦ isCofinal_empty_iff.1 h.isCofinal, fun _ ↦ .of_isEmpty⟩ theorem IsClub.union (hs : IsClub s) (ht : IsClub t) : IsClub (s ∪ t) := @@ -127,7 +125,7 @@ theorem IsClub.inter {s t : Set α} (hα : cof α ≠ ℵ₀) (hs : IsClub s) (h rw [← Set.sInter_pair] have H : ∀ x ∈ ({s, t} : Set _), IsClub x := by simpa [hs] obtain hα | hα' := hα.lt_or_gt - · rw [cof_lt_aleph0_iff] at hα + · rw [Order.cof_lt_aleph0_iff] at hα exact .sInter_of_cof_le_one hα H · exact .sInter hα (hα'.trans_le' <| by simp) H @@ -180,7 +178,7 @@ theorem not_isStationary_empty : ¬ IsStationary (∅ : Set α) := by theorem IsClub.isStationary [Nonempty α] [WellFoundedLT α] (hα : cof α ≠ ℵ₀) (hs : IsClub s) : IsStationary s := - fun t ht ↦ (hs.inter hα ht).nonempty + fun _ ht ↦ (hs.inter hα ht).nonempty /-- Non-stationary sets form an ideal. -/ theorem not_isStationary_union [WellFoundedLT α] (hα : cof α ≠ ℵ₀) @@ -191,6 +189,11 @@ theorem not_isStationary_union [WellFoundedLT α] (hα : cof α ≠ ℵ₀) refine ⟨_, hu.inter hα hv, ?_⟩ grind +theorem dirSupClosed_of_type_le_omega0 [WellFoundedLT α] {s : Set α} (hs : typeLT s ≤ ω) : + DirSupClosed s := by + + sorry + theorem IsStationary.of_not_isCofinal_compl (hs : ¬ IsCofinal (sᶜ)) : IsStationary s := by intro t ht obtain ⟨a, ha⟩ := not_isCofinal_iff.1 hs @@ -199,5 +202,9 @@ theorem IsStationary.of_not_isCofinal_compl (hs : ¬ IsCofinal (sᶜ)) : IsStati contrapose! ha exact ⟨b, ha, hb'⟩ -proof_wanted isStationary_iff_not_isCofinal_compl (hα : cof α ≤ ℵ₀) : - IsStationary s ↔ ¬ IsCofinal (sᶜ) +theorem isStationary_iff_not_isCofinal_compl [WellFoundedLT α] (hα : cof α ≤ ℵ₀) : + IsStationary s ↔ ¬ IsCofinal (sᶜ) where + mp hs h := by + obtain ⟨t, ht, ht', htα⟩ := Ordinal.ord_cof_eq_of_isCofinal h + sorry + mpr := .of_not_isCofinal_compl diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean index a3fbe3edf236a9..1321006be9bd45 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean @@ -151,7 +151,8 @@ theorem cof_omega0 : cof ω = ℵ₀ := @[deprecated (since := "2026-02-18")] alias cof_eq_one_iff_is_succ := cof_eq_one_iff -theorem ord_cof_eq (α : Type*) [LinearOrder α] [WellFoundedLT α] : +variable (α) in +theorem ord_cof_eq [LinearOrder α] [WellFoundedLT α] : ∃ s : Set α, IsCofinal s ∧ typeLT s = (Order.cof α).ord := by obtain ⟨s, hs, hs'⟩ := Order.cof_eq α obtain ⟨r, hr, hr'⟩ := exists_ord_eq s @@ -166,8 +167,18 @@ theorem ord_cof_eq (α : Type*) [LinearOrder α] [WellFoundedLT α] : · obtain ⟨x, z, hz, rfl⟩ := x exact (hz _ hxy').asymm hxy +theorem 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'⟩ := 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.ordinal_type_eq.symm + +variable (α) in @[simp] -theorem _root_.Order.cof_ord_cof (α : Type*) [LinearOrder α] [WellFoundedLT α] : +theorem _root_.Order.cof_ord_cof [LinearOrder α] [WellFoundedLT α] : (Order.cof α).ord.cof = Order.cof α := by obtain ⟨s, hs, hs'⟩ := ord_cof_eq α rw [← hs', cof_type] @@ -183,6 +194,14 @@ theorem cof_ord_cof (o : Ordinal) : o.cof.ord.cof = o.cof := by @[deprecated (since := "2026-03-21")] alias cof_cof := cof_ord_cof +theorem dirSupClosed_of_type_le_omega0 [LinearOrder α] [WellFoundedLT α] + {s : Set α} (hs : IsCofinal s) (hs' : typeLT s ≤ ω) : DirSupClosed s := by + obtain rfl | hs₀ := s.eq_empty_or_nonempty + · simp + let f (n : ℕ) : α := if hn : n < typeLT s then enum (· < · : s → _) ⟨n, hn⟩ + sorry + +#exit /-! ### Cofinalities and suprema -/ section LinearOrder diff --git a/Mathlib/SetTheory/Ordinal/Basic.lean b/Mathlib/SetTheory/Ordinal/Basic.lean index e21f2a6560ab15..ad1fb9785be7bd 100644 --- a/Mathlib/SetTheory/Ordinal/Basic.lean +++ b/Mathlib/SetTheory/Ordinal/Basic.lean @@ -169,6 +169,10 @@ theorem _root_.RelIso.ordinal_type_eq {α β} {r : α → α → Prop} {s : β [IsWellOrder β s] (h : r ≃r s) : type r = type s := type_eq.2 ⟨h⟩ +theorem _root_.OrderIso.ordinal_type_eq {α β} [LinearOrder α] [LinearOrder β] + [WellFoundedLT α] [WellFoundedLT β] (h : α ≃o β) : typeLT α = typeLT β := + h.toRelIsoLT.ordinal_type_eq + theorem type_eq_zero_of_empty (r) [IsWellOrder α r] [IsEmpty α] : type r = 0 := (RelIso.relIsoOfIsEmpty r _).ordinal_type_eq From f5ca261aedb794d5a60e34734fdd9137c8313620 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Fri, 22 May 2026 16:07:27 -0600 Subject: [PATCH 63/93] finish --- Mathlib/Data/Fintype/Order.lean | 8 ++++++++ Mathlib/Order/DirSupClosed.lean | 26 +++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/Mathlib/Data/Fintype/Order.lean b/Mathlib/Data/Fintype/Order.lean index e4a5f7b738f08f..b02781ca86ac7d 100644 --- a/Mathlib/Data/Fintype/Order.lean +++ b/Mathlib/Data/Fintype/Order.lean @@ -195,6 +195,14 @@ lemma Directed.finite_le {ι κ : Sort*} [Nonempty ι] [Finite κ] {f : ι → simpa using (hf.comp_of_surjective PLift.down_surjective).finite_set_le (Set.finite_range (PLift.up ∘ g)) +theorem DirectedOn.finite_le {s : Set α} (hs₀ : s.Nonempty) (D : DirectedOn r s) + (hs : s.Finite) : ∃ z ∈ s, ∀ i ∈ s, r i z := by + have := hs₀.to_subtype + have := hs.to_subtype + obtain ⟨⟨z, hzs⟩, hz⟩ := D.directed_val.finite_le id + use z, hzs + simpa using hz + variable [Nonempty α] [Preorder α] theorem Finite.exists_le [IsDirectedOrder α] (f : β → α) : ∃ M, ∀ i, f i ≤ M := diff --git a/Mathlib/Order/DirSupClosed.lean b/Mathlib/Order/DirSupClosed.lean index ead09bf1ac225a..e6401757f06c46 100644 --- a/Mathlib/Order/DirSupClosed.lean +++ b/Mathlib/Order/DirSupClosed.lean @@ -5,11 +5,12 @@ Authors: Christopher Hoskin, Violeta Hernández Palacios -/ module +public import Mathlib.Data.Fintype.Order public import Mathlib.Order.Antisymmetrization public import Mathlib.Order.CompleteLattice.Defs public import Mathlib.Order.UpperLower.Basic -import Mathlib.Data.Set.Lattice +import Mathlib.Data.Nat.Lattice /-! # Sets closed under directed suprema @@ -300,6 +301,29 @@ theorem dirSupClosed_singleton (a : α) : DirSupClosed {a} := by theorem dirSupClosedOn_singleton (a : α) : DirSupClosedOn D {a} := (dirSupClosed_singleton a).dirSupClosedOn +theorem DirSupClosed.of_finite (hs : s.Finite) : DirSupClosed s := by + intro t ht ht₀ ht₁ a ha + obtain ⟨b, hbt, hb⟩ := ht₁.finite_le ht₀ (hs.subset ht) + exact ht <| ha.unique ⟨hb, fun x hx ↦ hx hbt⟩ ▸ hbt + +theorem dirSupClosed_range_nat {f : ℕ → α} (hf : Monotone f) (hf' : IsCofinal (.range f)) : + DirSupClosed (range f) := by + intro s hs hs₀ hs₁ a ha + obtain ⟨_, ⟨n, rfl⟩, han⟩ := hf' a + obtain rfl | han := han.eq_or_lt + · simp + have hfb : BddAbove (f ⁻¹' s) := by + refine ⟨n, fun m hm ↦ ?_⟩ + by_contra! hnm + exact (ha.1 hm).not_gt (han.trans_le (hf hnm.le)) + refine ⟨sSup (f ⁻¹' s), IsLUB.unique ⟨?_, ?_⟩ ha⟩ <;> intro x hx + · obtain ⟨m, rfl⟩ := hs hx + exact hf (le_csSup hfb hx) + · apply hx (Nat.sSup_mem _ hfb) + obtain ⟨x, hx⟩ := hs₀ + obtain ⟨m, rfl⟩ := hs hx + exact ⟨m, hx⟩ + end PartialOrder section LinearOrder From a33cc54cf220965eff573053e427d79346eeea79 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Fri, 22 May 2026 16:20:17 -0600 Subject: [PATCH 64/93] add result --- Mathlib/Order/DirSupClosed.lean | 4 ++-- .../Cardinal/Cofinality/Ordinal.lean | 21 +++++++++++++++++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Mathlib/Order/DirSupClosed.lean b/Mathlib/Order/DirSupClosed.lean index e6401757f06c46..c24c1b613fbea0 100644 --- a/Mathlib/Order/DirSupClosed.lean +++ b/Mathlib/Order/DirSupClosed.lean @@ -289,7 +289,7 @@ lemma dirSupInaccOn_Iic (a : α) : DirSupInaccOn D (Iic a) := end Preorder -namespace PartialOrder +section PartialOrder variable [PartialOrder α] theorem dirSupClosed_singleton (a : α) : DirSupClosed {a} := by @@ -301,7 +301,7 @@ theorem dirSupClosed_singleton (a : α) : DirSupClosed {a} := by theorem dirSupClosedOn_singleton (a : α) : DirSupClosedOn D {a} := (dirSupClosed_singleton a).dirSupClosedOn -theorem DirSupClosed.of_finite (hs : s.Finite) : DirSupClosed s := by +theorem Set.Finite.dirSupClosed (hs : s.Finite) : DirSupClosed s := by intro t ht ht₀ ht₁ a ha obtain ⟨b, hbt, hb⟩ := ht₁.finite_le ht₀ (hs.subset ht) exact ht <| ha.unique ⟨hb, fun x hx ↦ hx hbt⟩ ▸ hbt diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean index a3fbe3edf236a9..655f71e40708ac 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean @@ -151,7 +151,8 @@ theorem cof_omega0 : cof ω = ℵ₀ := @[deprecated (since := "2026-02-18")] alias cof_eq_one_iff_is_succ := cof_eq_one_iff -theorem ord_cof_eq (α : Type*) [LinearOrder α] [WellFoundedLT α] : +variable (α) in +theorem ord_cof_eq [LinearOrder α] [WellFoundedLT α] : ∃ s : Set α, IsCofinal s ∧ typeLT s = (Order.cof α).ord := by obtain ⟨s, hs, hs'⟩ := Order.cof_eq α obtain ⟨r, hr, hr'⟩ := exists_ord_eq s @@ -166,8 +167,9 @@ theorem ord_cof_eq (α : Type*) [LinearOrder α] [WellFoundedLT α] : · obtain ⟨x, z, hz, rfl⟩ := x exact (hz _ hxy').asymm hxy +variable (α) in @[simp] -theorem _root_.Order.cof_ord_cof (α : Type*) [LinearOrder α] [WellFoundedLT α] : +theorem _root_.Order.cof_ord_cof [LinearOrder α] [WellFoundedLT α] : (Order.cof α).ord.cof = Order.cof α := by obtain ⟨s, hs, hs'⟩ := ord_cof_eq α rw [← hs', cof_type] @@ -183,6 +185,21 @@ theorem cof_ord_cof (o : Ordinal) : o.cof.ord.cof = o.cof := by @[deprecated (since := "2026-03-21")] alias cof_cof := cof_ord_cof +theorem dirSupClosed_of_type_le_omega0 [LinearOrder α] [WellFoundedLT α] + {s : Set α} (hs : IsCofinal s) (hω : typeLT s ≤ ω) : DirSupClosed s := by + obtain hω | hω := hω.lt_or_eq + · obtain ⟨n, hn⟩ := lt_omega0.1 hω + apply_fun card at hn + apply Finite.dirSupClosed + rw [Set.Finite, ← mk_lt_aleph0_iff] + simp_all + · let e : ℕ ≃o s := by + rw [omega0, ← lift_id (type _), lift_type_eq] at hω + exact OrderIso.ofRelIsoLT hω.some.symm + have hfs : .range (Subtype.val ∘ e) = s := by simp + rw [← hfs] at hs ⊢ + exact dirSupClosed_range_nat ((Subtype.mono_coe _).comp e.monotone) hs + /-! ### Cofinalities and suprema -/ section LinearOrder From eb59dc0669993f9a7119a917464acda98564dbc4 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Fri, 22 May 2026 16:37:30 -0600 Subject: [PATCH 65/93] reduce imports --- Mathlib/Order/DirSupClosed.lean | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/Mathlib/Order/DirSupClosed.lean b/Mathlib/Order/DirSupClosed.lean index c24c1b613fbea0..1aa3cb5712e9e8 100644 --- a/Mathlib/Order/DirSupClosed.lean +++ b/Mathlib/Order/DirSupClosed.lean @@ -5,7 +5,7 @@ Authors: Christopher Hoskin, Violeta Hernández Palacios -/ module -public import Mathlib.Data.Fintype.Order +public import Mathlib.Data.Set.Finite.Basic public import Mathlib.Order.Antisymmetrization public import Mathlib.Order.CompleteLattice.Defs public import Mathlib.Order.UpperLower.Basic @@ -292,19 +292,25 @@ end Preorder section PartialOrder variable [PartialOrder α] -theorem dirSupClosed_singleton (a : α) : DirSupClosed {a} := by +theorem DirSupClosed.singleton (a : α) : DirSupClosed {a} := by intro d hda hdn _ b hb rw [hdn.subset_singleton_iff] at hda subst hda exact mem_singleton_of_eq (hb.unique isLUB_singleton) -theorem dirSupClosedOn_singleton (a : α) : DirSupClosedOn D {a} := - (dirSupClosed_singleton a).dirSupClosedOn +@[deprecated (since := "2026-05-22")] alias dirSupClosed_singleton := DirSupClosed.singleton + +theorem DirSupClosedOn.singleton (a : α) : DirSupClosedOn D {a} := + (DirSupClosed.singleton a).dirSupClosedOn + +@[deprecated (since := "2026-05-22")] alias dirSupClosedOn_singleton := DirSupClosedOn.singleton theorem Set.Finite.dirSupClosed (hs : s.Finite) : DirSupClosed s := by - intro t ht ht₀ ht₁ a ha - obtain ⟨b, hbt, hb⟩ := ht₁.finite_le ht₀ (hs.subset ht) - exact ht <| ha.unique ⟨hb, fun x hx ↦ hx hbt⟩ ▸ hbt + induction s, hs using Set.Finite.induction_on with + | empty => exact .empty + | insert has _ hs₁ => + rw [Set.insert_eq] + exact (DirSupClosed.singleton _).union hs₁ theorem dirSupClosed_range_nat {f : ℕ → α} (hf : Monotone f) (hf' : IsCofinal (.range f)) : DirSupClosed (range f) := by From c727a02114dcf4901dcbf43b90fc5453c32951b6 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Fri, 22 May 2026 16:51:08 -0600 Subject: [PATCH 66/93] split --- Mathlib.lean | 3 +- Mathlib/Order/DirSupClosed.lean | 376 ------------------ Mathlib/Order/IsNormal.lean | 2 +- .../SetTheory/Cardinal/Cofinality/Club.lean | 2 +- .../Cardinal/Cofinality/Ordinal.lean | 2 + Mathlib/Topology/Order/ScottTopology.lean | 2 +- 6 files changed, 7 insertions(+), 380 deletions(-) delete mode 100644 Mathlib/Order/DirSupClosed.lean diff --git a/Mathlib.lean b/Mathlib.lean index 8b73416360a46f..9e4050acb47e1a 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -5914,7 +5914,8 @@ public import Mathlib.Order.Cover public import Mathlib.Order.Defs.LinearOrder public import Mathlib.Order.Defs.PartialOrder public import Mathlib.Order.Defs.Unbundled -public import Mathlib.Order.DirSupClosed +public import Mathlib.Order.DirSupClosed.Basic +public import Mathlib.Order.DirSupClosed.Finite public import Mathlib.Order.Directed public import Mathlib.Order.DirectedInverseSystem public import Mathlib.Order.Disjoint diff --git a/Mathlib/Order/DirSupClosed.lean b/Mathlib/Order/DirSupClosed.lean deleted file mode 100644 index 1aa3cb5712e9e8..00000000000000 --- a/Mathlib/Order/DirSupClosed.lean +++ /dev/null @@ -1,376 +0,0 @@ -/- -Copyright (c) 2023 Christopher Hoskin. All rights reserved. -Released under Apache 2.0 license as described in the file LICENSE. -Authors: Christopher Hoskin, Violeta Hernández Palacios --/ -module - -public import Mathlib.Data.Set.Finite.Basic -public import Mathlib.Order.Antisymmetrization -public import Mathlib.Order.CompleteLattice.Defs -public import Mathlib.Order.UpperLower.Basic - -import Mathlib.Data.Nat.Lattice - -/-! -# Sets closed under directed suprema - -We say that a set `s` is closed under directed suprema whenever it contains all least upper bounds -for nonempty, directed subsets. Conversely, a set `s` is inaccessible by directed suprema whenever -its complement is closed under directed suprema. Equivalently, if the least upper bound of a -nonempty directed set `t` is contained in `s`, then `t` and `s` must have nonempty intersection. - -## Main definitions - -- `DirSupClosed`: sets closed under directed suprema. -- `DirSupInacc`: sets inaccessible by directed suprema. --/ - -@[expose] public section - -variable {α : Type*} {s t : Set α} {D D₁ D₂ : Set (Set α)} - -open Set - -section Preorder -variable [Preorder α] - -/-- A predicate for a set which is closed under directed suprema of nonempty sets. -This is the complement of a `DirSupInaccOn` set. -/ -def DirSupClosedOn (D : Set (Set α)) (s : Set α) : Prop := - ∀ ⦃d⦄, d ∈ D → d ⊆ s → d.Nonempty → DirectedOn (· ≤ ·) d → ∀ ⦃a⦄, IsLUB d a → a ∈ s - -/-- A predicate for a set which is inaccessible by directed suprema of nonempty sets in `D`. -This is the complement of a `DirSupClosedOn` set. -/ -def DirSupInaccOn (D : Set (Set α)) (s : Set α) : Prop := - ∀ ⦃d⦄, d ∈ D → d.Nonempty → DirectedOn (· ≤ ·) d → ∀ ⦃a⦄, IsLUB d a → a ∈ s → (d ∩ s).Nonempty - -/-- A predicate for a set which is closed under directed suprema of nonempty sets. -This is the complement of a `DirSupInacc` set. -/ -def DirSupClosed (s : Set α) : Prop := - ∀ ⦃d⦄, d ⊆ s → d.Nonempty → DirectedOn (· ≤ ·) d → ∀ ⦃a⦄, IsLUB d a → a ∈ s - -/-- A predicate for a set which is inaccessible by directed suprema of nonempty sets. -This is the complement of a `DirSupClosed` set. -/ -def DirSupInacc (s : Set α) : Prop := - ∀ ⦃d⦄, d.Nonempty → DirectedOn (· ≤ ·) d → ∀ ⦃a⦄, IsLUB d a → a ∈ s → (d ∩ s).Nonempty - -@[simp] lemma dirSupClosedOn_univ : DirSupClosedOn univ s ↔ DirSupClosed s := by - simp [DirSupClosedOn, DirSupClosed] - -@[simp] lemma dirSupInaccOn_univ : DirSupInaccOn univ s ↔ DirSupInacc s := by - simp [DirSupInaccOn, DirSupInacc] - -@[simp] lemma DirSupClosed.dirSupClosedOn : DirSupClosed s → DirSupClosedOn D s := @fun h _ _ ↦ @h _ -@[simp] lemma DirSupInacc.dirSupInaccOn : DirSupInacc s → DirSupInaccOn D s := @fun h _ _ ↦ @h _ - -@[simp] theorem DirSupClosed.of_isEmpty [IsEmpty α] {s : Set α} : DirSupClosed s := - fun _ _ ⟨a, _⟩ ↦ isEmptyElim a - -@[simp] theorem DirSupInacc.of_isEmpty [IsEmpty α] {s : Set α} : DirSupInacc s := - fun _ ⟨a, _⟩ ↦ isEmptyElim a - -theorem DirSupClosedOn.of_isEmpty [IsEmpty α] {s : Set α} : DirSupClosedOn D s := by simp -theorem DirSupInaccOn.of_isEmpty [IsEmpty α] {s : Set α} : DirSupInaccOn D s := by simp - -@[gcongr] -lemma DirSupClosedOn.mono (hD : D₁ ⊆ D₂) (hf : DirSupClosedOn D₂ s) : DirSupClosedOn D₁ s := - fun _ a ↦ hf (hD a) - -@[gcongr] -lemma DirSupInaccOn.mono (hD : D₁ ⊆ D₂) (hf : DirSupInaccOn D₂ s) : DirSupInaccOn D₁ s := - fun _ a ↦ hf (hD a) - -@[simp] -lemma dirSupClosedOn_compl : DirSupClosedOn D sᶜ ↔ DirSupInaccOn D s := by - simp_rw [DirSupClosedOn, DirSupInaccOn, ← not_disjoint_iff_nonempty_inter] - grind - -@[simp] -lemma dirSupClosed_compl : DirSupClosed sᶜ ↔ DirSupInacc s := by - rw [← dirSupClosedOn_univ, dirSupClosedOn_compl, dirSupInaccOn_univ] - -@[simp] -lemma dirSupInaccOn_compl : DirSupInaccOn D sᶜ ↔ DirSupClosedOn D s := by - rw [← dirSupClosedOn_compl, compl_compl] - -@[simp] -lemma dirSupInacc_compl : DirSupInacc sᶜ ↔ DirSupClosed s := by - rw [← dirSupClosed_compl, compl_compl] - -alias ⟨DirSupInaccOn.of_compl, DirSupInaccOn.compl⟩ := dirSupClosedOn_compl -alias ⟨DirSupClosedOn.of_compl, DirSupClosedOn.compl⟩ := dirSupInaccOn_compl -alias ⟨DirSupInacc.of_compl, DirSupInacc.compl⟩ := dirSupClosed_compl -alias ⟨DirSupClosed.of_compl, DirSupClosed.compl⟩ := dirSupInacc_compl - -@[simp] theorem DirSupClosed.empty : DirSupClosed (∅ : Set α) := by simp [DirSupClosed] -@[simp] theorem DirSupInacc.empty : DirSupInacc (∅ : Set α) := by simp [DirSupInacc] -theorem DirSupClosedOn.empty : DirSupClosedOn D ∅ := by simp -theorem DirSupInaccOn.empty : DirSupInaccOn D ∅ := by simp - -@[simp] theorem DirSupClosed.univ : DirSupClosed (univ : Set α) := by simp [DirSupClosed] -@[simp] theorem DirSupInacc.univ : DirSupInacc (univ : Set α) := by simp [← compl_empty] -theorem DirSupClosedOn.univ : DirSupClosedOn D univ := by simp -theorem DirSupInaccOn.univ : DirSupInaccOn D univ := by simp - -theorem DirSupClosedOn.sInter {s : Set (Set α)} (hs : ∀ x ∈ s, DirSupClosedOn D x) : - DirSupClosedOn D (⋂₀ s) := - fun _d hD hds hd hd' _a ha t ht ↦ hs t ht hD (hds.trans fun _x hx ↦ hx _ ht) hd hd' ha - -theorem DirSupClosed.sInter {s : Set (Set α)} (hs : ∀ x ∈ s, DirSupClosed x) : - DirSupClosed (⋂₀ s) := by - simpa using DirSupClosedOn.sInter fun x hx ↦ (hs x hx).dirSupClosedOn (D := .univ) - -theorem DirSupInaccOn.sUnion {s : Set (Set α)} (hs : ∀ x ∈ s, DirSupInaccOn D x) : - DirSupInaccOn D (⋃₀ s) := by - rw [← dirSupClosedOn_compl, Set.compl_sUnion] - apply DirSupClosedOn.sInter - rintro x ⟨x, hx, rfl⟩ - exact (hs x hx).compl - -theorem DirSupInacc.sUnion {s : Set (Set α)} (hs : ∀ x ∈ s, DirSupInacc x) : - DirSupInacc (⋃₀ s) := by - simpa using DirSupInaccOn.sUnion fun x hx ↦ (hs x hx).dirSupInaccOn (D := .univ) - -theorem DirSupClosedOn.iInter {ι} {f : ι → Set α} (hs : ∀ i, DirSupClosedOn D (f i)) : - DirSupClosedOn D (⋂ i, f i) := by - rw [← sInter_range f] - exact DirSupClosedOn.sInter (by simpa) - -theorem DirSupClosed.iInter {ι} {f : ι → Set α} (hs : ∀ i, DirSupClosed (f i)) : - DirSupClosed (⋂ i, f i) := by - rw [← sInter_range f] - exact DirSupClosed.sInter (by simpa) - -theorem DirSupInaccOn.iUnion {ι} {f : ι → Set α} (hs : ∀ i, DirSupInaccOn D (f i)) : - DirSupInaccOn D (⋃ i, f i) := by - rw [← sUnion_range f] - exact DirSupInaccOn.sUnion (by simpa) - -theorem DirSupInacc.iUnion {ι} {f : ι → Set α} (hs : ∀ i, DirSupInacc (f i)) : - DirSupInacc (⋃ i, f i) := by - rw [← sUnion_range f] - exact DirSupInacc.sUnion (by simpa) - -lemma DirSupClosedOn.inter (hs : DirSupClosedOn D s) (ht : DirSupClosedOn D t) : - DirSupClosedOn D (s ∩ t) := by - rw [← sInter_pair] - refine .sInter ?_ - simpa [hs] - -lemma DirSupClosed.inter (hs : DirSupClosed s) (ht : DirSupClosed t) : DirSupClosed (s ∩ t) := by - simpa using hs.dirSupClosedOn.inter ht.dirSupClosedOn (D := .univ) - -lemma DirSupInaccOn.union (hs : DirSupInaccOn D s) (ht : DirSupInaccOn D t) : - DirSupInaccOn D (s ∪ t) := by - rw [← dirSupClosedOn_compl, compl_union]; exact hs.compl.inter ht.compl - -lemma DirSupInacc.union (hs : DirSupInacc s) (ht : DirSupInacc t) : DirSupInacc (s ∪ t) := by - simpa using hs.dirSupInaccOn.union ht.dirSupInaccOn (D := .univ) - -theorem DirSupClosedOn.union (hDL : IsLowerSet D) - (hs : DirSupClosedOn D s) (ht : DirSupClosedOn D t) : DirSupClosedOn D (s ∪ t) := by - intro d hD hdu hd₀ hd₁ a ha - have hdst : d ∩ s ∪ d ∩ t = d := by grind - rw [← hdst] at hd₀ hd₁ - wlog h : DirectedOn (· ≤ ·) (d ∩ s) ∧ (d ∩ s).Nonempty - · rw [union_comm] at hdu hd₀ hd₁ hdst ⊢ - exact this hDL ht hs hD hdu hd₀ hd₁ ha hdst <| - (directedOn_or_directedOn_of_union' hd₀ hd₁).resolve_right h - obtain ⟨hds, hn⟩ := h - by_cases had : a ∈ lowerBounds (upperBounds (d ∩ s)) - · exact .inl <| hs (hDL inter_subset_left hD) inter_subset_right hn hds - ⟨fun b hb ↦ ha.1 hb.1, had⟩ - · simp only [lowerBounds, mem_setOf_eq, not_forall] at had - obtain ⟨b, hb, hb'⟩ := had - have key : {x ∈ d | ¬ x ≤ b} ⊆ d ∩ t := fun a ⟨had, hab⟩ ↦ - ⟨had, (hdu had).resolve_left fun has ↦ hab <| hb ⟨had, has⟩⟩ - obtain ⟨w, hw⟩ : {x ∈ d | ¬ x ≤ b}.Nonempty := by - contrapose! hb' - apply ha.2 - aesop - refine Or.inr <| ht (hDL inter_subset_left hD) (key.trans inter_subset_right) - ⟨w, hw⟩ (fun x hx y hy ↦ ?_) ?_ - · obtain ⟨z, hz, hz'⟩ := hd₁ _ (.inr (key hx)) _ (.inr (key hy)) - exact ⟨z, ⟨⟨hdst ▸ hz, mt hz'.1.trans hx.2⟩, hz'⟩⟩ - · refine ⟨fun x hx ↦ ha.1 hx.1, fun x hx ↦ ha.2 fun y hy ↦ ?_⟩ - by_cases hyb : y ≤ b - · obtain ⟨z, hz, hxz, hyz⟩ := hd₁ _ (hdst ▸ hy) _ (.inr (key hw)) - exact hxz.trans (hx ⟨hdst ▸ hz, fun hzb ↦ hw.2 (hyz.trans hzb)⟩) - exact hx ⟨hy, hyb⟩ - -theorem DirSupInaccOn.inter (hDL : IsLowerSet D) - (hs : DirSupInaccOn D s) (ht : DirSupInaccOn D t) : DirSupInaccOn D (s ∩ t) := by - rw [← dirSupClosedOn_compl, compl_inter]; exact hs.compl.union hDL ht.compl - -theorem DirSupClosed.union (hs : DirSupClosed s) (ht : DirSupClosed t) : DirSupClosed (s ∪ t) := by - simpa using hs.dirSupClosedOn.union isLowerSet_univ ht.dirSupClosedOn - -theorem DirSupInacc.inter (hs : DirSupInacc s) (ht : DirSupInacc t) : DirSupInacc (s ∩ t) := by - simpa using hs.dirSupInaccOn.inter isLowerSet_univ ht.dirSupInaccOn - -theorem DirSupInaccOn.of_inter_subset - (h : ∀ ⦃d : Set α⦄, d ∈ D → d.Nonempty → DirectedOn (· ≤ ·) d → - ∀ ⦃a : α⦄, IsLUB d a → a ∈ s → ∃ b ∈ d, Ici b ∩ d ⊆ s) : DirSupInaccOn D s := by - intro d hd₀ hd₁ hd₂ a hda hd₃ - obtain ⟨b, hbd, hb⟩ := h hd₀ hd₁ hd₂ hda hd₃ - exact ⟨b, hbd, hb ⟨le_rfl, hbd⟩⟩ - -theorem DirSupInacc.of_inter_subset - (h : ∀ ⦃d : Set α⦄, d.Nonempty → DirectedOn (· ≤ ·) d → - ∀ ⦃a : α⦄, IsLUB d a → a ∈ s → ∃ b ∈ d, Ici b ∩ d ⊆ s) : DirSupInacc s := - dirSupInaccOn_univ.1 (.of_inter_subset (by simpa)) - -/-- The condition `(d ∩ s).Nonempty` in `DirSupInaccOn` can be replaced with the stronger -`∃ b ∈ d, Ici b ∩ d ⊆ s` (under mild assumptions on `D`). -/ -theorem dirSupInaccOn_iff_inter_subset (hDL : IsLowerSet D) : - DirSupInaccOn D s ↔ ∀ ⦃d : Set α⦄, d ∈ D → d.Nonempty → DirectedOn (· ≤ ·) d → - ∀ ⦃a : α⦄, IsLUB d a → a ∈ s → ∃ b ∈ d, Ici b ∩ d ⊆ s where - mpr := .of_inter_subset - mp h t hD ht₀ ht₁ a ha has := by - by_contra! H - have H : ∀ b : t, ∃ c, b.1 ≤ c ∧ c ∈ t ∧ c ∉ s := by simpa [not_subset, and_assoc] using H - choose f hf using H - have := ht₀.to_subtype - have hft : range f ⊆ t := by grind - apply (h (hDL hft hD) (range_nonempty f) _ _ has).ne_empty - · aesop - · intro a ha b hb - obtain ⟨c, hc, _, _⟩ := ht₁ _ (hft ha) _ (hft hb) - have := hf ⟨c, hc⟩ - grind - · exact ⟨upperBounds_mono_set hft ha.1, - fun b hb ↦ ha.2 fun c hc ↦ (hf ⟨c, hc⟩).1.trans (hb <| by simp)⟩ - -/-- The condition `(d ∩ s).Nonempty` in `DirSupInacc` can be replaced with the stronger -`∃ b ∈ d, Ici b ∩ d ⊆ s`. -/ -theorem dirSupInacc_iff_inter_subset : - DirSupInacc s ↔ ∀ ⦃d : Set α⦄, d.Nonempty → DirectedOn (· ≤ ·) d → - ∀ ⦃a : α⦄, IsLUB d a → a ∈ s → ∃ b ∈ d, Ici b ∩ d ⊆ s := by - simpa using dirSupInaccOn_iff_inter_subset isLowerSet_univ - -lemma IsUpperSet.dirSupClosed (hs : IsUpperSet s) : DirSupClosed s := - fun _d hds ⟨_b, hb⟩ _ _a ha ↦ hs (ha.1 hb) <| hds hb - -lemma IsUpperSet.dirSupClosedOn (hs : IsUpperSet s) : DirSupClosedOn D s := - hs.dirSupClosed.dirSupClosedOn - -lemma IsLowerSet.dirSupInacc (hs : IsLowerSet s) : DirSupInacc s := - .of_compl hs.compl.dirSupClosed - -lemma IsLowerSet.dirSupInaccOn (hs : IsLowerSet s) : DirSupInaccOn D s := - .of_compl hs.compl.dirSupClosedOn - -theorem DirSupClosed.mem_imp_of_antisymmRel (hs : DirSupClosed s) {a b : α} - (h : AntisymmRel (· ≤ ·) a b) (ha : a ∈ s) : b ∈ s := by - apply hs (singleton_subset_iff.2 ha) ⟨a, rfl⟩ (directedOn_singleton a) - rw [← isLUB_congr_of_antisymmRel h] - exact isLUB_singleton - -theorem DirSupClosed.mem_iff_of_antisymmRel (hs : DirSupClosed s) {a b : α} - (h : AntisymmRel (· ≤ ·) a b) : a ∈ s ↔ b ∈ s := - ⟨hs.mem_imp_of_antisymmRel h, hs.mem_imp_of_antisymmRel h.symm⟩ - -theorem DirSupInacc.mem_iff_of_antisymmRel (hs : DirSupInacc s) {a b : α} - (h : AntisymmRel (· ≤ ·) a b) : a ∈ s ↔ b ∈ s := by - simpa [not_iff_not] using hs.compl.mem_iff_of_antisymmRel h - -lemma dirSupClosed_Iic (a : α) : DirSupClosed (Iic a) := - fun _d h _ _ _a ha ↦ (isLUB_le_iff ha).2 h - -lemma dirSupClosedOn_Iic (a : α) : DirSupClosedOn D (Iic a) := - (dirSupClosed_Iic a).dirSupClosedOn - -lemma dirSupInacc_Iic (a : α) : DirSupInacc (Iic a) := - (isLowerSet_Iic a).dirSupInacc - -lemma dirSupInaccOn_Iic (a : α) : DirSupInaccOn D (Iic a) := - (isLowerSet_Iic a).dirSupInaccOn - -end Preorder - -section PartialOrder -variable [PartialOrder α] - -theorem DirSupClosed.singleton (a : α) : DirSupClosed {a} := by - intro d hda hdn _ b hb - rw [hdn.subset_singleton_iff] at hda - subst hda - exact mem_singleton_of_eq (hb.unique isLUB_singleton) - -@[deprecated (since := "2026-05-22")] alias dirSupClosed_singleton := DirSupClosed.singleton - -theorem DirSupClosedOn.singleton (a : α) : DirSupClosedOn D {a} := - (DirSupClosed.singleton a).dirSupClosedOn - -@[deprecated (since := "2026-05-22")] alias dirSupClosedOn_singleton := DirSupClosedOn.singleton - -theorem Set.Finite.dirSupClosed (hs : s.Finite) : DirSupClosed s := by - induction s, hs using Set.Finite.induction_on with - | empty => exact .empty - | insert has _ hs₁ => - rw [Set.insert_eq] - exact (DirSupClosed.singleton _).union hs₁ - -theorem dirSupClosed_range_nat {f : ℕ → α} (hf : Monotone f) (hf' : IsCofinal (.range f)) : - DirSupClosed (range f) := by - intro s hs hs₀ hs₁ a ha - obtain ⟨_, ⟨n, rfl⟩, han⟩ := hf' a - obtain rfl | han := han.eq_or_lt - · simp - have hfb : BddAbove (f ⁻¹' s) := by - refine ⟨n, fun m hm ↦ ?_⟩ - by_contra! hnm - exact (ha.1 hm).not_gt (han.trans_le (hf hnm.le)) - refine ⟨sSup (f ⁻¹' s), IsLUB.unique ⟨?_, ?_⟩ ha⟩ <;> intro x hx - · obtain ⟨m, rfl⟩ := hs hx - exact hf (le_csSup hfb hx) - · apply hx (Nat.sSup_mem _ hfb) - obtain ⟨x, hx⟩ := hs₀ - obtain ⟨m, rfl⟩ := hs hx - exact ⟨m, hx⟩ - -end PartialOrder - -section LinearOrder -variable [LinearOrder α] - -theorem dirSupClosedOn_iff_of_linearOrder : - DirSupClosedOn D s ↔ ∀ ⦃d⦄, d ∈ D → d ⊆ s → d.Nonempty → ∀ ⦃a⦄, IsLUB d a → a ∈ s := by - simp [DirSupClosedOn] - -theorem dirSupClosed_iff_of_linearOrder : - DirSupClosed s ↔ ∀ ⦃d⦄, d ⊆ s → d.Nonempty → ∀ ⦃a⦄, IsLUB d a → a ∈ s := by - simp [DirSupClosed] - -theorem dirSupInaccOn_iff_of_linearOrder : - DirSupInaccOn D s ↔ - ∀ ⦃d⦄, d ∈ D → d.Nonempty → ∀ ⦃a⦄, IsLUB d a → a ∈ s → (d ∩ s).Nonempty := by - simp [DirSupInaccOn] - -theorem dirSupInacc_iff_of_linearOrder : - DirSupInacc s ↔ ∀ ⦃d⦄, d.Nonempty → ∀ ⦃a⦄, IsLUB d a → a ∈ s → (d ∩ s).Nonempty := by - simp [DirSupInacc] - -end LinearOrder - -section CompleteLattice -variable [CompleteLattice α] - -lemma dirSupClosedOn_iff_forall_sSup : DirSupClosedOn D s ↔ - ∀ ⦃d⦄, d ∈ D → d ⊆ s → d.Nonempty → DirectedOn (· ≤ ·) d → sSup d ∈ s := by - simp [DirSupClosedOn, isLUB_iff_sSup_eq] - -lemma dirSupInaccOn_iff_forall_sSup : DirSupInaccOn D s ↔ - ∀ ⦃d⦄, d ∈ D → d.Nonempty → DirectedOn (· ≤ ·) d → sSup d ∈ s → (d ∩ s).Nonempty := by - simp [DirSupInaccOn, isLUB_iff_sSup_eq] - -lemma dirSupClosed_iff_forall_sSup : DirSupClosed s ↔ - ∀ ⦃d⦄, d ⊆ s → d.Nonempty → DirectedOn (· ≤ ·) d → sSup d ∈ s := by - simp [DirSupClosed, isLUB_iff_sSup_eq] - -lemma dirSupInacc_iff_forall_sSup : DirSupInacc s ↔ - ∀ ⦃d⦄, d.Nonempty → DirectedOn (· ≤ ·) d → sSup d ∈ s → (d ∩ s).Nonempty := by - simp [DirSupInacc, isLUB_iff_sSup_eq] - -end CompleteLattice diff --git a/Mathlib/Order/IsNormal.lean b/Mathlib/Order/IsNormal.lean index df523f0f92b52c..ab3270cd436568 100644 --- a/Mathlib/Order/IsNormal.lean +++ b/Mathlib/Order/IsNormal.lean @@ -6,7 +6,7 @@ Authors: Violeta Hernández Palacios module public import Mathlib.Dynamics.FixedPoints.Defs -public import Mathlib.Order.DirSupClosed +public import Mathlib.Order.DirSupClosed.Basic public import Mathlib.Order.SuccPred.CompleteLinearOrder public import Mathlib.Order.SuccPred.InitialSeg diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean index 58671ac506a2db..bb72fb8f966a10 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean @@ -5,7 +5,7 @@ Authors: Violeta Hernández Palacios -/ module -public import Mathlib.Order.DirSupClosed +public import Mathlib.Order.DirSupClosed.Basic public import Mathlib.Order.IsNormal public import Mathlib.SetTheory.Cardinal.Cofinality.Basic diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean index 655f71e40708ac..426f4876135e0f 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean @@ -9,6 +9,8 @@ public import Mathlib.SetTheory.Cardinal.Arithmetic public import Mathlib.SetTheory.Cardinal.Cofinality.Basic public import Mathlib.SetTheory.Ordinal.FixedPoint +import Mathlib.Order.DirSupClosed.Finite + /-! # Cofinality of an ordinal diff --git a/Mathlib/Topology/Order/ScottTopology.lean b/Mathlib/Topology/Order/ScottTopology.lean index 8e996159cb0c82..1e1d522fd229f0 100644 --- a/Mathlib/Topology/Order/ScottTopology.lean +++ b/Mathlib/Topology/Order/ScottTopology.lean @@ -5,7 +5,7 @@ Authors: Christopher Hoskin -/ module -public import Mathlib.Order.DirSupClosed +public import Mathlib.Order.DirSupClosed.Basic public import Mathlib.Order.ScottContinuity public import Mathlib.Topology.Order.UpperLowerSetTopology From 8d9e99f2266a5c846fd06e99c746d6ffee6e6c6e Mon Sep 17 00:00:00 2001 From: vihdzp Date: Fri, 22 May 2026 16:51:13 -0600 Subject: [PATCH 67/93] split --- Mathlib/Order/DirSupClosed/Basic.lean | 350 +++++++++++++++++++++++++ Mathlib/Order/DirSupClosed/Finite.lean | 44 ++++ 2 files changed, 394 insertions(+) create mode 100644 Mathlib/Order/DirSupClosed/Basic.lean create mode 100644 Mathlib/Order/DirSupClosed/Finite.lean diff --git a/Mathlib/Order/DirSupClosed/Basic.lean b/Mathlib/Order/DirSupClosed/Basic.lean new file mode 100644 index 00000000000000..9816253c8526c3 --- /dev/null +++ b/Mathlib/Order/DirSupClosed/Basic.lean @@ -0,0 +1,350 @@ +/- +Copyright (c) 2023 Christopher Hoskin. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Christopher Hoskin, Violeta Hernández Palacios +-/ +module + +public import Mathlib.Order.Antisymmetrization +public import Mathlib.Order.CompleteLattice.Defs +public import Mathlib.Order.UpperLower.Basic + +import Mathlib.Data.Set.Lattice + +/-! +# Sets closed under directed suprema + +We say that a set `s` is closed under directed suprema whenever it contains all least upper bounds +for nonempty, directed subsets. Conversely, a set `s` is inaccessible by directed suprema whenever +its complement is closed under directed suprema. Equivalently, if the least upper bound of a +nonempty directed set `t` is contained in `s`, then `t` and `s` must have nonempty intersection. + +## Main definitions + +- `DirSupClosed`: sets closed under directed suprema. +- `DirSupInacc`: sets inaccessible by directed suprema. +-/ + +@[expose] public section + +variable {α : Type*} {s t : Set α} {D D₁ D₂ : Set (Set α)} + +open Set + +section Preorder +variable [Preorder α] + +/-- A predicate for a set which is closed under directed suprema of nonempty sets. +This is the complement of a `DirSupInaccOn` set. -/ +def DirSupClosedOn (D : Set (Set α)) (s : Set α) : Prop := + ∀ ⦃d⦄, d ∈ D → d ⊆ s → d.Nonempty → DirectedOn (· ≤ ·) d → ∀ ⦃a⦄, IsLUB d a → a ∈ s + +/-- A predicate for a set which is inaccessible by directed suprema of nonempty sets in `D`. +This is the complement of a `DirSupClosedOn` set. -/ +def DirSupInaccOn (D : Set (Set α)) (s : Set α) : Prop := + ∀ ⦃d⦄, d ∈ D → d.Nonempty → DirectedOn (· ≤ ·) d → ∀ ⦃a⦄, IsLUB d a → a ∈ s → (d ∩ s).Nonempty + +/-- A predicate for a set which is closed under directed suprema of nonempty sets. +This is the complement of a `DirSupInacc` set. -/ +def DirSupClosed (s : Set α) : Prop := + ∀ ⦃d⦄, d ⊆ s → d.Nonempty → DirectedOn (· ≤ ·) d → ∀ ⦃a⦄, IsLUB d a → a ∈ s + +/-- A predicate for a set which is inaccessible by directed suprema of nonempty sets. +This is the complement of a `DirSupClosed` set. -/ +def DirSupInacc (s : Set α) : Prop := + ∀ ⦃d⦄, d.Nonempty → DirectedOn (· ≤ ·) d → ∀ ⦃a⦄, IsLUB d a → a ∈ s → (d ∩ s).Nonempty + +@[simp] lemma dirSupClosedOn_univ : DirSupClosedOn univ s ↔ DirSupClosed s := by + simp [DirSupClosedOn, DirSupClosed] + +@[simp] lemma dirSupInaccOn_univ : DirSupInaccOn univ s ↔ DirSupInacc s := by + simp [DirSupInaccOn, DirSupInacc] + +@[simp] lemma DirSupClosed.dirSupClosedOn : DirSupClosed s → DirSupClosedOn D s := @fun h _ _ ↦ @h _ +@[simp] lemma DirSupInacc.dirSupInaccOn : DirSupInacc s → DirSupInaccOn D s := @fun h _ _ ↦ @h _ + +@[simp] theorem DirSupClosed.of_isEmpty [IsEmpty α] {s : Set α} : DirSupClosed s := + fun _ _ ⟨a, _⟩ ↦ isEmptyElim a + +@[simp] theorem DirSupInacc.of_isEmpty [IsEmpty α] {s : Set α} : DirSupInacc s := + fun _ ⟨a, _⟩ ↦ isEmptyElim a + +theorem DirSupClosedOn.of_isEmpty [IsEmpty α] {s : Set α} : DirSupClosedOn D s := by simp +theorem DirSupInaccOn.of_isEmpty [IsEmpty α] {s : Set α} : DirSupInaccOn D s := by simp + +@[gcongr] +lemma DirSupClosedOn.mono (hD : D₁ ⊆ D₂) (hf : DirSupClosedOn D₂ s) : DirSupClosedOn D₁ s := + fun _ a ↦ hf (hD a) + +@[gcongr] +lemma DirSupInaccOn.mono (hD : D₁ ⊆ D₂) (hf : DirSupInaccOn D₂ s) : DirSupInaccOn D₁ s := + fun _ a ↦ hf (hD a) + +@[simp] +lemma dirSupClosedOn_compl : DirSupClosedOn D sᶜ ↔ DirSupInaccOn D s := by + simp_rw [DirSupClosedOn, DirSupInaccOn, ← not_disjoint_iff_nonempty_inter] + grind + +@[simp] +lemma dirSupClosed_compl : DirSupClosed sᶜ ↔ DirSupInacc s := by + rw [← dirSupClosedOn_univ, dirSupClosedOn_compl, dirSupInaccOn_univ] + +@[simp] +lemma dirSupInaccOn_compl : DirSupInaccOn D sᶜ ↔ DirSupClosedOn D s := by + rw [← dirSupClosedOn_compl, compl_compl] + +@[simp] +lemma dirSupInacc_compl : DirSupInacc sᶜ ↔ DirSupClosed s := by + rw [← dirSupClosed_compl, compl_compl] + +alias ⟨DirSupInaccOn.of_compl, DirSupInaccOn.compl⟩ := dirSupClosedOn_compl +alias ⟨DirSupClosedOn.of_compl, DirSupClosedOn.compl⟩ := dirSupInaccOn_compl +alias ⟨DirSupInacc.of_compl, DirSupInacc.compl⟩ := dirSupClosed_compl +alias ⟨DirSupClosed.of_compl, DirSupClosed.compl⟩ := dirSupInacc_compl + +@[simp] theorem DirSupClosed.empty : DirSupClosed (∅ : Set α) := by simp [DirSupClosed] +@[simp] theorem DirSupInacc.empty : DirSupInacc (∅ : Set α) := by simp [DirSupInacc] +theorem DirSupClosedOn.empty : DirSupClosedOn D ∅ := by simp +theorem DirSupInaccOn.empty : DirSupInaccOn D ∅ := by simp + +@[simp] theorem DirSupClosed.univ : DirSupClosed (univ : Set α) := by simp [DirSupClosed] +@[simp] theorem DirSupInacc.univ : DirSupInacc (univ : Set α) := by simp [← compl_empty] +theorem DirSupClosedOn.univ : DirSupClosedOn D univ := by simp +theorem DirSupInaccOn.univ : DirSupInaccOn D univ := by simp + +theorem DirSupClosedOn.sInter {s : Set (Set α)} (hs : ∀ x ∈ s, DirSupClosedOn D x) : + DirSupClosedOn D (⋂₀ s) := + fun _d hD hds hd hd' _a ha t ht ↦ hs t ht hD (hds.trans fun _x hx ↦ hx _ ht) hd hd' ha + +theorem DirSupClosed.sInter {s : Set (Set α)} (hs : ∀ x ∈ s, DirSupClosed x) : + DirSupClosed (⋂₀ s) := by + simpa using DirSupClosedOn.sInter fun x hx ↦ (hs x hx).dirSupClosedOn (D := .univ) + +theorem DirSupInaccOn.sUnion {s : Set (Set α)} (hs : ∀ x ∈ s, DirSupInaccOn D x) : + DirSupInaccOn D (⋃₀ s) := by + rw [← dirSupClosedOn_compl, Set.compl_sUnion] + apply DirSupClosedOn.sInter + rintro x ⟨x, hx, rfl⟩ + exact (hs x hx).compl + +theorem DirSupInacc.sUnion {s : Set (Set α)} (hs : ∀ x ∈ s, DirSupInacc x) : + DirSupInacc (⋃₀ s) := by + simpa using DirSupInaccOn.sUnion fun x hx ↦ (hs x hx).dirSupInaccOn (D := .univ) + +theorem DirSupClosedOn.iInter {ι} {f : ι → Set α} (hs : ∀ i, DirSupClosedOn D (f i)) : + DirSupClosedOn D (⋂ i, f i) := by + rw [← sInter_range f] + exact DirSupClosedOn.sInter (by simpa) + +theorem DirSupClosed.iInter {ι} {f : ι → Set α} (hs : ∀ i, DirSupClosed (f i)) : + DirSupClosed (⋂ i, f i) := by + rw [← sInter_range f] + exact DirSupClosed.sInter (by simpa) + +theorem DirSupInaccOn.iUnion {ι} {f : ι → Set α} (hs : ∀ i, DirSupInaccOn D (f i)) : + DirSupInaccOn D (⋃ i, f i) := by + rw [← sUnion_range f] + exact DirSupInaccOn.sUnion (by simpa) + +theorem DirSupInacc.iUnion {ι} {f : ι → Set α} (hs : ∀ i, DirSupInacc (f i)) : + DirSupInacc (⋃ i, f i) := by + rw [← sUnion_range f] + exact DirSupInacc.sUnion (by simpa) + +lemma DirSupClosedOn.inter (hs : DirSupClosedOn D s) (ht : DirSupClosedOn D t) : + DirSupClosedOn D (s ∩ t) := by + rw [← sInter_pair] + refine .sInter ?_ + simpa [hs] + +lemma DirSupClosed.inter (hs : DirSupClosed s) (ht : DirSupClosed t) : DirSupClosed (s ∩ t) := by + simpa using hs.dirSupClosedOn.inter ht.dirSupClosedOn (D := .univ) + +lemma DirSupInaccOn.union (hs : DirSupInaccOn D s) (ht : DirSupInaccOn D t) : + DirSupInaccOn D (s ∪ t) := by + rw [← dirSupClosedOn_compl, compl_union]; exact hs.compl.inter ht.compl + +lemma DirSupInacc.union (hs : DirSupInacc s) (ht : DirSupInacc t) : DirSupInacc (s ∪ t) := by + simpa using hs.dirSupInaccOn.union ht.dirSupInaccOn (D := .univ) + +theorem DirSupClosedOn.union (hDL : IsLowerSet D) + (hs : DirSupClosedOn D s) (ht : DirSupClosedOn D t) : DirSupClosedOn D (s ∪ t) := by + intro d hD hdu hd₀ hd₁ a ha + have hdst : d ∩ s ∪ d ∩ t = d := by grind + rw [← hdst] at hd₀ hd₁ + wlog h : DirectedOn (· ≤ ·) (d ∩ s) ∧ (d ∩ s).Nonempty + · rw [union_comm] at hdu hd₀ hd₁ hdst ⊢ + exact this hDL ht hs hD hdu hd₀ hd₁ ha hdst <| + (directedOn_or_directedOn_of_union' hd₀ hd₁).resolve_right h + obtain ⟨hds, hn⟩ := h + by_cases had : a ∈ lowerBounds (upperBounds (d ∩ s)) + · exact .inl <| hs (hDL inter_subset_left hD) inter_subset_right hn hds + ⟨fun b hb ↦ ha.1 hb.1, had⟩ + · simp only [lowerBounds, mem_setOf_eq, not_forall] at had + obtain ⟨b, hb, hb'⟩ := had + have key : {x ∈ d | ¬ x ≤ b} ⊆ d ∩ t := fun a ⟨had, hab⟩ ↦ + ⟨had, (hdu had).resolve_left fun has ↦ hab <| hb ⟨had, has⟩⟩ + obtain ⟨w, hw⟩ : {x ∈ d | ¬ x ≤ b}.Nonempty := by + contrapose! hb' + apply ha.2 + aesop + refine Or.inr <| ht (hDL inter_subset_left hD) (key.trans inter_subset_right) + ⟨w, hw⟩ (fun x hx y hy ↦ ?_) ?_ + · obtain ⟨z, hz, hz'⟩ := hd₁ _ (.inr (key hx)) _ (.inr (key hy)) + exact ⟨z, ⟨⟨hdst ▸ hz, mt hz'.1.trans hx.2⟩, hz'⟩⟩ + · refine ⟨fun x hx ↦ ha.1 hx.1, fun x hx ↦ ha.2 fun y hy ↦ ?_⟩ + by_cases hyb : y ≤ b + · obtain ⟨z, hz, hxz, hyz⟩ := hd₁ _ (hdst ▸ hy) _ (.inr (key hw)) + exact hxz.trans (hx ⟨hdst ▸ hz, fun hzb ↦ hw.2 (hyz.trans hzb)⟩) + exact hx ⟨hy, hyb⟩ + +theorem DirSupInaccOn.inter (hDL : IsLowerSet D) + (hs : DirSupInaccOn D s) (ht : DirSupInaccOn D t) : DirSupInaccOn D (s ∩ t) := by + rw [← dirSupClosedOn_compl, compl_inter]; exact hs.compl.union hDL ht.compl + +theorem DirSupClosed.union (hs : DirSupClosed s) (ht : DirSupClosed t) : DirSupClosed (s ∪ t) := by + simpa using hs.dirSupClosedOn.union isLowerSet_univ ht.dirSupClosedOn + +theorem DirSupInacc.inter (hs : DirSupInacc s) (ht : DirSupInacc t) : DirSupInacc (s ∩ t) := by + simpa using hs.dirSupInaccOn.inter isLowerSet_univ ht.dirSupInaccOn + +theorem DirSupInaccOn.of_inter_subset + (h : ∀ ⦃d : Set α⦄, d ∈ D → d.Nonempty → DirectedOn (· ≤ ·) d → + ∀ ⦃a : α⦄, IsLUB d a → a ∈ s → ∃ b ∈ d, Ici b ∩ d ⊆ s) : DirSupInaccOn D s := by + intro d hd₀ hd₁ hd₂ a hda hd₃ + obtain ⟨b, hbd, hb⟩ := h hd₀ hd₁ hd₂ hda hd₃ + exact ⟨b, hbd, hb ⟨le_rfl, hbd⟩⟩ + +theorem DirSupInacc.of_inter_subset + (h : ∀ ⦃d : Set α⦄, d.Nonempty → DirectedOn (· ≤ ·) d → + ∀ ⦃a : α⦄, IsLUB d a → a ∈ s → ∃ b ∈ d, Ici b ∩ d ⊆ s) : DirSupInacc s := + dirSupInaccOn_univ.1 (.of_inter_subset (by simpa)) + +/-- The condition `(d ∩ s).Nonempty` in `DirSupInaccOn` can be replaced with the stronger +`∃ b ∈ d, Ici b ∩ d ⊆ s` (under mild assumptions on `D`). -/ +theorem dirSupInaccOn_iff_inter_subset (hDL : IsLowerSet D) : + DirSupInaccOn D s ↔ ∀ ⦃d : Set α⦄, d ∈ D → d.Nonempty → DirectedOn (· ≤ ·) d → + ∀ ⦃a : α⦄, IsLUB d a → a ∈ s → ∃ b ∈ d, Ici b ∩ d ⊆ s where + mpr := .of_inter_subset + mp h t hD ht₀ ht₁ a ha has := by + by_contra! H + have H : ∀ b : t, ∃ c, b.1 ≤ c ∧ c ∈ t ∧ c ∉ s := by simpa [not_subset, and_assoc] using H + choose f hf using H + have := ht₀.to_subtype + have hft : range f ⊆ t := by grind + apply (h (hDL hft hD) (range_nonempty f) _ _ has).ne_empty + · aesop + · intro a ha b hb + obtain ⟨c, hc, _, _⟩ := ht₁ _ (hft ha) _ (hft hb) + have := hf ⟨c, hc⟩ + grind + · exact ⟨upperBounds_mono_set hft ha.1, + fun b hb ↦ ha.2 fun c hc ↦ (hf ⟨c, hc⟩).1.trans (hb <| by simp)⟩ + +/-- The condition `(d ∩ s).Nonempty` in `DirSupInacc` can be replaced with the stronger +`∃ b ∈ d, Ici b ∩ d ⊆ s`. -/ +theorem dirSupInacc_iff_inter_subset : + DirSupInacc s ↔ ∀ ⦃d : Set α⦄, d.Nonempty → DirectedOn (· ≤ ·) d → + ∀ ⦃a : α⦄, IsLUB d a → a ∈ s → ∃ b ∈ d, Ici b ∩ d ⊆ s := by + simpa using dirSupInaccOn_iff_inter_subset isLowerSet_univ + +lemma IsUpperSet.dirSupClosed (hs : IsUpperSet s) : DirSupClosed s := + fun _d hds ⟨_b, hb⟩ _ _a ha ↦ hs (ha.1 hb) <| hds hb + +lemma IsUpperSet.dirSupClosedOn (hs : IsUpperSet s) : DirSupClosedOn D s := + hs.dirSupClosed.dirSupClosedOn + +lemma IsLowerSet.dirSupInacc (hs : IsLowerSet s) : DirSupInacc s := + .of_compl hs.compl.dirSupClosed + +lemma IsLowerSet.dirSupInaccOn (hs : IsLowerSet s) : DirSupInaccOn D s := + .of_compl hs.compl.dirSupClosedOn + +theorem DirSupClosed.mem_imp_of_antisymmRel (hs : DirSupClosed s) {a b : α} + (h : AntisymmRel (· ≤ ·) a b) (ha : a ∈ s) : b ∈ s := by + apply hs (singleton_subset_iff.2 ha) ⟨a, rfl⟩ (directedOn_singleton a) + rw [← isLUB_congr_of_antisymmRel h] + exact isLUB_singleton + +theorem DirSupClosed.mem_iff_of_antisymmRel (hs : DirSupClosed s) {a b : α} + (h : AntisymmRel (· ≤ ·) a b) : a ∈ s ↔ b ∈ s := + ⟨hs.mem_imp_of_antisymmRel h, hs.mem_imp_of_antisymmRel h.symm⟩ + +theorem DirSupInacc.mem_iff_of_antisymmRel (hs : DirSupInacc s) {a b : α} + (h : AntisymmRel (· ≤ ·) a b) : a ∈ s ↔ b ∈ s := by + simpa [not_iff_not] using hs.compl.mem_iff_of_antisymmRel h + +lemma dirSupClosed_Iic (a : α) : DirSupClosed (Iic a) := + fun _d h _ _ _a ha ↦ (isLUB_le_iff ha).2 h + +lemma dirSupClosedOn_Iic (a : α) : DirSupClosedOn D (Iic a) := + (dirSupClosed_Iic a).dirSupClosedOn + +lemma dirSupInacc_Iic (a : α) : DirSupInacc (Iic a) := + (isLowerSet_Iic a).dirSupInacc + +lemma dirSupInaccOn_Iic (a : α) : DirSupInaccOn D (Iic a) := + (isLowerSet_Iic a).dirSupInaccOn + +end Preorder + +section PartialOrder +variable [PartialOrder α] + +theorem DirSupClosed.singleton (a : α) : DirSupClosed {a} := by + intro d hda hdn _ b hb + rw [hdn.subset_singleton_iff] at hda + subst hda + exact mem_singleton_of_eq (hb.unique isLUB_singleton) + +@[deprecated (since := "2026-05-22")] alias dirSupClosed_singleton := DirSupClosed.singleton + +theorem DirSupClosedOn.singleton (a : α) : DirSupClosedOn D {a} := + (DirSupClosed.singleton a).dirSupClosedOn + +@[deprecated (since := "2026-05-22")] alias dirSupClosedOn_singleton := DirSupClosedOn.singleton + +end PartialOrder + +section LinearOrder +variable [LinearOrder α] + +theorem dirSupClosedOn_iff_of_linearOrder : + DirSupClosedOn D s ↔ ∀ ⦃d⦄, d ∈ D → d ⊆ s → d.Nonempty → ∀ ⦃a⦄, IsLUB d a → a ∈ s := by + simp [DirSupClosedOn] + +theorem dirSupClosed_iff_of_linearOrder : + DirSupClosed s ↔ ∀ ⦃d⦄, d ⊆ s → d.Nonempty → ∀ ⦃a⦄, IsLUB d a → a ∈ s := by + simp [DirSupClosed] + +theorem dirSupInaccOn_iff_of_linearOrder : + DirSupInaccOn D s ↔ + ∀ ⦃d⦄, d ∈ D → d.Nonempty → ∀ ⦃a⦄, IsLUB d a → a ∈ s → (d ∩ s).Nonempty := by + simp [DirSupInaccOn] + +theorem dirSupInacc_iff_of_linearOrder : + DirSupInacc s ↔ ∀ ⦃d⦄, d.Nonempty → ∀ ⦃a⦄, IsLUB d a → a ∈ s → (d ∩ s).Nonempty := by + simp [DirSupInacc] + +end LinearOrder + +section CompleteLattice +variable [CompleteLattice α] + +lemma dirSupClosedOn_iff_forall_sSup : DirSupClosedOn D s ↔ + ∀ ⦃d⦄, d ∈ D → d ⊆ s → d.Nonempty → DirectedOn (· ≤ ·) d → sSup d ∈ s := by + simp [DirSupClosedOn, isLUB_iff_sSup_eq] + +lemma dirSupInaccOn_iff_forall_sSup : DirSupInaccOn D s ↔ + ∀ ⦃d⦄, d ∈ D → d.Nonempty → DirectedOn (· ≤ ·) d → sSup d ∈ s → (d ∩ s).Nonempty := by + simp [DirSupInaccOn, isLUB_iff_sSup_eq] + +lemma dirSupClosed_iff_forall_sSup : DirSupClosed s ↔ + ∀ ⦃d⦄, d ⊆ s → d.Nonempty → DirectedOn (· ≤ ·) d → sSup d ∈ s := by + simp [DirSupClosed, isLUB_iff_sSup_eq] + +lemma dirSupInacc_iff_forall_sSup : DirSupInacc s ↔ + ∀ ⦃d⦄, d.Nonempty → DirectedOn (· ≤ ·) d → sSup d ∈ s → (d ∩ s).Nonempty := by + simp [DirSupInacc, isLUB_iff_sSup_eq] + +end CompleteLattice diff --git a/Mathlib/Order/DirSupClosed/Finite.lean b/Mathlib/Order/DirSupClosed/Finite.lean new file mode 100644 index 00000000000000..94661c1032c5c9 --- /dev/null +++ b/Mathlib/Order/DirSupClosed/Finite.lean @@ -0,0 +1,44 @@ +/- +Copyright (c) 2026 Violeta Hernández Palacios. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Violeta Hernández Palacios +-/ +module + +public import Mathlib.Data.Set.Finite.Basic +public import Mathlib.Order.DirSupClosed.Basic + +import Mathlib.Data.Nat.Lattice + +/-! +# Finite sets are closed under suprema +-/ + +public section + +variable {α : Type*} [PartialOrder α] + +theorem Set.Finite.dirSupClosed {s : Set α} (hs : s.Finite) : DirSupClosed s := by + induction s, hs using Set.Finite.induction_on with + | empty => exact .empty + | insert has _ hs₁ => + rw [Set.insert_eq] + exact (DirSupClosed.singleton _).union hs₁ + +theorem dirSupClosed_range_nat {f : ℕ → α} (hf : Monotone f) (hf' : IsCofinal (.range f)) : + DirSupClosed (.range f) := by + intro s hs hs₀ hs₁ a ha + obtain ⟨_, ⟨n, rfl⟩, han⟩ := hf' a + obtain rfl | han := han.eq_or_lt + · simp + have hfb : BddAbove (f ⁻¹' s) := by + refine ⟨n, fun m hm ↦ ?_⟩ + by_contra! hnm + exact (ha.1 hm).not_gt (han.trans_le (hf hnm.le)) + refine ⟨sSup (f ⁻¹' s), IsLUB.unique ⟨?_, ?_⟩ ha⟩ <;> intro x hx + · obtain ⟨m, rfl⟩ := hs hx + exact hf (le_csSup hfb hx) + · apply hx (Nat.sSup_mem _ hfb) + obtain ⟨x, hx⟩ := hs₀ + obtain ⟨m, rfl⟩ := hs hx + exact ⟨m, hx⟩ From 84e1e9b0a2e9ff793918881001573e83c70be1cd Mon Sep 17 00:00:00 2001 From: vihdzp Date: Fri, 22 May 2026 16:51:44 -0600 Subject: [PATCH 68/93] golf --- Mathlib/Order/DirSupClosed/Finite.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/Order/DirSupClosed/Finite.lean b/Mathlib/Order/DirSupClosed/Finite.lean index 94661c1032c5c9..84a2fb4650b209 100644 --- a/Mathlib/Order/DirSupClosed/Finite.lean +++ b/Mathlib/Order/DirSupClosed/Finite.lean @@ -19,7 +19,7 @@ public section variable {α : Type*} [PartialOrder α] theorem Set.Finite.dirSupClosed {s : Set α} (hs : s.Finite) : DirSupClosed s := by - induction s, hs using Set.Finite.induction_on with + induction s, hs using induction_on with | empty => exact .empty | insert has _ hs₁ => rw [Set.insert_eq] From 1e4865ec2e580c137d7b86d8702d780abbc3cac8 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Fri, 22 May 2026 16:53:29 -0600 Subject: [PATCH 69/93] have --- Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean index 426f4876135e0f..7a0d660c34b13b 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean @@ -195,7 +195,7 @@ theorem dirSupClosed_of_type_le_omega0 [LinearOrder α] [WellFoundedLT α] apply Finite.dirSupClosed rw [Set.Finite, ← mk_lt_aleph0_iff] simp_all - · let e : ℕ ≃o s := by + · have e : ℕ ≃o s := by rw [omega0, ← lift_id (type _), lift_type_eq] at hω exact OrderIso.ofRelIsoLT hω.some.symm have hfs : .range (Subtype.val ∘ e) = s := by simp From 2e5e8eae7f96a039c73a973b7063a37c449b7248 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Fri, 22 May 2026 17:02:14 -0600 Subject: [PATCH 70/93] fix --- Mathlib/SetTheory/Cardinal/Cofinality/Club.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean index 74e0a72d3d8950..67e58d6efb7e58 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean @@ -148,7 +148,7 @@ protected theorem diag [IsRegularCardinalOrder α] {f : α → Set α} (hα : co apply (hf b).isLUB_mem _ ⟨c, _⟩ (ha.inter_Ici_of_mem hc) <;> grind isCofinal a := by obtain hα | hα := hα.lt_or_gt - · rw [cof_lt_aleph0_iff, cof_eq_cardinalMk, le_one_iff_subsingleton] at hα + · rw [Order.cof_lt_aleph0_iff, cof_eq_cardinalMk, le_one_iff_subsingleton] at hα use a simp have : Nonempty α := ⟨a⟩ From 415ba668c090f080bf55d3449e7fb2423f44b1a7 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Fri, 22 May 2026 17:04:09 -0600 Subject: [PATCH 71/93] start --- .../SetTheory/Cardinal/Cofinality/Club.lean | 72 +++++++++++++++++-- 1 file changed, 67 insertions(+), 5 deletions(-) diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean index 58671ac506a2db..e2efa682bbd307 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean @@ -5,9 +5,7 @@ Authors: Violeta Hernández Palacios -/ module -public import Mathlib.Order.DirSupClosed -public import Mathlib.Order.IsNormal -public import Mathlib.SetTheory.Cardinal.Cofinality.Basic +public import Mathlib.SetTheory.Cardinal.Cofinality.Ordinal /-! # Club sets @@ -27,7 +25,7 @@ public section universe u v -open Cardinal Order +open Cardinal Order Ordinal /-- A club set is closed under suprema and cofinal. -/ structure IsClub {α : Type*} [LinearOrder α] (s : Set α) where @@ -48,6 +46,12 @@ theorem IsClub.of_isEmpty [IsEmpty α] {s : Set α} : IsClub s := theorem IsClub.univ : IsClub (α := α) .univ := ⟨.univ, .univ⟩ +protected theorem IsClub.nonempty [Nonempty α] (hs : IsClub s) : s.Nonempty := + hs.isCofinal.nonempty + +theorem isClub_empty_iff : IsClub (α := α) ∅ ↔ IsEmpty α := + ⟨fun h ↦ isCofinal_empty_iff.1 h.isCofinal, fun _ ↦ .of_isEmpty⟩ + theorem IsClub.union (hs : IsClub s) (ht : IsClub t) : IsClub (s ∪ t) := ⟨hs.dirSupClosed.union ht.dirSupClosed, hs.isCofinal.mono Set.subset_union_left⟩ @@ -121,7 +125,7 @@ theorem IsClub.inter {s t : Set α} (hα : cof α ≠ ℵ₀) (hs : IsClub s) (h rw [← Set.sInter_pair] have H : ∀ x ∈ ({s, t} : Set _), IsClub x := by simpa [hs] obtain hα | hα' := hα.lt_or_gt - · rw [cof_lt_aleph0_iff] at hα + · rw [Order.cof_lt_aleph0_iff] at hα exact .sInter_of_cof_le_one hα H · exact .sInter hα (hα'.trans_le' <| by simp) H @@ -144,3 +148,61 @@ theorem Order.IsNormal.isClub_fixedPoints {f : α → α} (hα : cof α ≠ ℵ simpa using mk_range_le_lift (f := fun n : ℕ ↦ f^[n] a) end WellFoundedLT + +/-! ### Stationary sets -/ + +/-- A set is called stationary when it intersects all club sets. -/ +@[expose] +def IsStationary (s : Set α) : Prop := + ∀ ⦃t⦄, IsClub t → (s ∩ t).Nonempty + +@[gcongr] +theorem IsStationary.mono (hs : IsStationary s) (h : s ⊆ t) : IsStationary t := + fun _u hu ↦ (hs hu).mono (Set.inter_subset_inter_left _ h) + +theorem IsStationary.nonempty (hs : IsStationary s) : s.Nonempty := by + simpa using hs .univ + +theorem isStationary_univ_iff : IsStationary (.univ (α := α)) ↔ Nonempty α := by + simp [IsStationary, ← not_imp_not (b := IsClub _), Set.not_nonempty_iff_eq_empty, + isClub_empty_iff] + +@[simp] +theorem IsStationary.univ [Nonempty α] : IsStationary (.univ (α := α)) := + isStationary_univ_iff.2 ‹_› + +@[simp] +theorem not_isStationary_empty : ¬ IsStationary (∅ : Set α) := by + intro h + simpa using h .univ + +theorem IsClub.isStationary [Nonempty α] [WellFoundedLT α] (hα : cof α ≠ ℵ₀) (hs : IsClub s) : + IsStationary s := + fun _ ht ↦ (hs.inter hα ht).nonempty + +/-- Non-stationary sets form an ideal. -/ +theorem not_isStationary_union [WellFoundedLT α] (hα : cof α ≠ ℵ₀) + (hs : ¬ IsStationary s) (ht : ¬ IsStationary t) : ¬ IsStationary (s ∪ t) := by + simp_rw [IsStationary, not_forall, Set.not_nonempty_iff_eq_empty] at hs ht ⊢ + obtain ⟨u, hu, hsu⟩ := hs + obtain ⟨v, hv, htv⟩ := ht + refine ⟨_, hu.inter hα hv, ?_⟩ + grind + +theorem IsStationary.of_not_isCofinal_compl (hs : ¬ IsCofinal (sᶜ)) : IsStationary s := by + intro t ht + obtain ⟨a, ha⟩ := not_isCofinal_iff.1 hs + obtain ⟨b, hb, hb'⟩ := ht.isCofinal a + refine ⟨b, ?_, hb⟩ + contrapose! ha + exact ⟨b, ha, hb'⟩ + +theorem isStationary_iff_not_isCofinal_compl [WellFoundedLT α] (hα : cof α ≤ ℵ₀) : + IsStationary s ↔ ¬ IsCofinal (sᶜ) where + mp hs h := by + obtain ⟨t, hts, ht, htα⟩ := ord_cof_eq_of_isCofinal h + have ht' := dirSupClosed_of_type_le_omega0 ht (htα.trans_le ?_) + · cases hs ⟨ht', ht⟩ + grind + · simpa using ord_mono hα + mpr := .of_not_isCofinal_compl From 87bba65094778fb7829004ee2a8ad9699f57ba94 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Fri, 22 May 2026 17:04:49 -0600 Subject: [PATCH 72/93] more --- Mathlib/SetTheory/Cardinal/Cofinality/Club.lean | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean index e2efa682bbd307..47f388e40aa2e0 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean @@ -5,7 +5,9 @@ Authors: Violeta Hernández Palacios -/ module -public import Mathlib.SetTheory.Cardinal.Cofinality.Ordinal +public import Mathlib.Order.DirSupClosed +public import Mathlib.Order.IsNormal +public import Mathlib.SetTheory.Cardinal.Cofinality.Basic /-! # Club sets @@ -196,13 +198,3 @@ theorem IsStationary.of_not_isCofinal_compl (hs : ¬ IsCofinal (sᶜ)) : IsStati refine ⟨b, ?_, hb⟩ contrapose! ha exact ⟨b, ha, hb'⟩ - -theorem isStationary_iff_not_isCofinal_compl [WellFoundedLT α] (hα : cof α ≤ ℵ₀) : - IsStationary s ↔ ¬ IsCofinal (sᶜ) where - mp hs h := by - obtain ⟨t, hts, ht, htα⟩ := ord_cof_eq_of_isCofinal h - have ht' := dirSupClosed_of_type_le_omega0 ht (htα.trans_le ?_) - · cases hs ⟨ht', ht⟩ - grind - · simpa using ord_mono hα - mpr := .of_not_isCofinal_compl From 9acee7fc5b99e59e4d556893dc45bcb25fc284c5 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Fri, 22 May 2026 17:05:57 -0600 Subject: [PATCH 73/93] finish --- Mathlib/Order/Cofinal.lean | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Mathlib/Order/Cofinal.lean b/Mathlib/Order/Cofinal.lean index 0e8b480d90627f..c3376807934a07 100644 --- a/Mathlib/Order/Cofinal.lean +++ b/Mathlib/Order/Cofinal.lean @@ -53,6 +53,11 @@ theorem IsCofinal.mono {s t : Set α} (h : s ⊆ t) (hs : IsCofinal s) : IsCofin obtain ⟨b, hb, hb'⟩ := hs a exact ⟨b, h hb, hb'⟩ +theorem IsCofinal.nonempty [Nonempty α] {s : Set α} (h : IsCofinal s) : s.Nonempty := by + inhabit α + obtain ⟨x, hx, _⟩ := h default + exact ⟨x, hx⟩ + end LE section Preorder From 3b0502624208438bb33eb9545091532c00ccc29a Mon Sep 17 00:00:00 2001 From: vihdzp Date: Fri, 22 May 2026 17:08:13 -0600 Subject: [PATCH 74/93] not using yet --- Mathlib/SetTheory/Cardinal/Cofinality/Club.lean | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean index 47f388e40aa2e0..7f0853c8a6de9c 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean @@ -12,9 +12,11 @@ public import Mathlib.SetTheory.Cardinal.Cofinality.Basic /-! # Club sets -A subset of a well-ordered type `α` is called a club set when it is closed in the order topology and -cofinal. If `α` has no maximum, then an equivalent condition is that `α` is closed and unbounded; -hence the name. +A subset of a well-ordered type `α` is called a **club set** when it is closed in the order topology +and cofinal. If `α` has no maximum, then an equivalent condition is that `α` is closed and +unbounded; hence the name. + +A **stationary set** is a set which intersects all club sets. ## Implementation notes @@ -27,7 +29,7 @@ public section universe u v -open Cardinal Order Ordinal +open Cardinal Order /-- A club set is closed under suprema and cofinal. -/ structure IsClub {α : Type*} [LinearOrder α] (s : Set α) where From e65606777d5e5db4559d1afab424a33056c2d235 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Fri, 22 May 2026 17:13:55 -0600 Subject: [PATCH 75/93] revert --- Mathlib/SetTheory/Cardinal/Cofinality/Club.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean index 7f0853c8a6de9c..e79f563803963e 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean @@ -129,7 +129,7 @@ theorem IsClub.inter {s t : Set α} (hα : cof α ≠ ℵ₀) (hs : IsClub s) (h rw [← Set.sInter_pair] have H : ∀ x ∈ ({s, t} : Set _), IsClub x := by simpa [hs] obtain hα | hα' := hα.lt_or_gt - · rw [Order.cof_lt_aleph0_iff] at hα + · rw [cof_lt_aleph0_iff] at hα exact .sInter_of_cof_le_one hα H · exact .sInter hα (hα'.trans_le' <| by simp) H From 122721a4f654f3cfdfa4c528ef81c39ef2e13b7d Mon Sep 17 00:00:00 2001 From: vihdzp Date: Fri, 22 May 2026 18:34:43 -0600 Subject: [PATCH 76/93] more theorems --- .../SetTheory/Cardinal/Cofinality/Club.lean | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean index e79f563803963e..80da32bb7c0097 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean @@ -184,7 +184,24 @@ theorem IsClub.isStationary [Nonempty α] [WellFoundedLT α] (hα : cof α ≠ IsStationary s := fun _ ht ↦ (hs.inter hα ht).nonempty -/-- Non-stationary sets form an ideal. -/ +theorem not_isStationary_sUnion [WellFoundedLT α] {s : Set (Set α)} (hα : cof α ≠ ℵ₀) + (hsα : #s < cof α) (hs : ∀ x ∈ s, ¬ IsStationary x) : ¬ IsStationary (⋃₀ s) := by + simp_rw [IsStationary, not_forall, Set.not_nonempty_iff_eq_empty, + ← Set.disjoint_iff_inter_eq_empty] at hs ⊢ + choose f hf hf' using hs + refine ⟨⋂ x : s, f _ x.2, ?_, ?_⟩ + · apply IsClub.iInter hα <;> simpa + · rw [Set.disjoint_sUnion_left] + exact fun x hx ↦ (hf' _ hx).mono_right <| Set.iInter_subset (fun x : s ↦ f x.1 x.2) ⟨x, hx⟩ + +theorem not_isStationary_iUnion [WellFoundedLT α] {ι : Type u} {f : ι → Set α} (hα : cof α ≠ ℵ₀) + (hι : Cardinal.lift.{v} #ι < Cardinal.lift.{u} (cof α)) (hf : ∀ i, ¬ IsStationary (f i)) : + ¬ IsStationary (⋃ i, f i) := by + rw [← Set.sUnion_range] + refine not_isStationary_sUnion hα ?_ (by simpa) + rw [← Cardinal.lift_lt] + exact mk_range_le_lift.trans_lt hι + theorem not_isStationary_union [WellFoundedLT α] (hα : cof α ≠ ℵ₀) (hs : ¬ IsStationary s) (ht : ¬ IsStationary t) : ¬ IsStationary (s ∪ t) := by simp_rw [IsStationary, not_forall, Set.not_nonempty_iff_eq_empty] at hs ht ⊢ From 8de73c077cd23727f2b974d3c224577adc9fab80 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Sat, 23 May 2026 04:11:22 -0600 Subject: [PATCH 77/93] spacing --- Mathlib/SetTheory/Cardinal/Cofinality/Club.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean index 80da32bb7c0097..db6c52e9379076 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean @@ -210,7 +210,7 @@ theorem not_isStationary_union [WellFoundedLT α] (hα : cof α ≠ ℵ₀) refine ⟨_, hu.inter hα hv, ?_⟩ grind -theorem IsStationary.of_not_isCofinal_compl (hs : ¬ IsCofinal (sᶜ)) : IsStationary s := by +theorem IsStationary.of_not_isCofinal_compl (hs : ¬ IsCofinal sᶜ) : IsStationary s := by intro t ht obtain ⟨a, ha⟩ := not_isCofinal_iff.1 hs obtain ⟨b, hb, hb'⟩ := ht.isCofinal a From 5b7dd80eb1c757c1a8f38d6a09abdf3c3006cb31 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Sat, 23 May 2026 04:46:16 -0600 Subject: [PATCH 78/93] generalize --- .../SetTheory/Cardinal/Cofinality/Club.lean | 99 ++++++++++--------- 1 file changed, 53 insertions(+), 46 deletions(-) diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean index db6c52e9379076..cae16cb792cac6 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean @@ -29,7 +29,7 @@ public section universe u v -open Cardinal Order +open Cardinal Order Set /-- A club set is closed under suprema and cofinal. -/ structure IsClub {α : Type*} [LinearOrder α] (s : Set α) where @@ -57,7 +57,7 @@ theorem isClub_empty_iff : IsClub (α := α) ∅ ↔ IsEmpty α := ⟨fun h ↦ isCofinal_empty_iff.1 h.isCofinal, fun _ ↦ .of_isEmpty⟩ theorem IsClub.union (hs : IsClub s) (ht : IsClub t) : IsClub (s ∪ t) := - ⟨hs.dirSupClosed.union ht.dirSupClosed, hs.isCofinal.mono Set.subset_union_left⟩ + ⟨hs.dirSupClosed.union ht.dirSupClosed, hs.isCofinal.mono subset_union_left⟩ theorem IsClub.isLUB_mem (hs : IsClub s) (ht : t ⊆ s) (ht₀ : t.Nonempty) (hx : IsLUB t x) : x ∈ s := hs.dirSupClosed ht ht₀ (.of_linearOrder _) hx @@ -69,12 +69,12 @@ theorem IsClub.csSup_mem {α} [ConditionallyCompleteLinearOrder α] {s t : Set theorem IsClub.sInter_of_orderTop {s : Set (Set α)} [OrderTop α] (hs : ∀ x ∈ s, IsClub x) : IsClub (⋂₀ s) := by refine ⟨.sInter fun x hx ↦ (hs x hx).dirSupClosed, ?_⟩ - rw [isCofinal_iff_top_mem, Set.mem_sInter] + rw [isCofinal_iff_top_mem, mem_sInter] exact fun x hx ↦ (hs x hx).isCofinal.top_mem theorem IsClub.iInter_of_orderTop {ι : Type*} {f : ι → Set α} [OrderTop α] (hs : ∀ i, IsClub (f i)) : IsClub (⋂ i, f i) := by - rw [← Set.sInter_range] + rw [← sInter_range] exact .sInter_of_orderTop (by simpa) theorem IsClub.sInter_of_cof_le_one {s : Set (Set α)} (hα : cof α ≤ 1) @@ -86,11 +86,10 @@ theorem IsClub.sInter_of_cof_le_one {s : Set (Set α)} (hα : cof α ≤ 1) theorem IsClub.iInter_of_cof_le_one {ι : Type*} {f : ι → Set α} (hα : cof α ≤ 1) (hs : ∀ i, IsClub (f i)) : IsClub (⋂ i, f i) := by - rw [← Set.sInter_range] + rw [← sInter_range] exact .sInter_of_cof_le_one hα (by simpa) section WellFoundedLT - variable [WellFoundedLT α] attribute [local instance] @@ -108,7 +107,7 @@ theorem IsClub.sInter {s : Set (Set α)} (hα : cof α ≠ ℵ₀) (hsα : #s < refine .of_not_isCofinal fun hg ↦ (cof_le hg).not_gt (hα.trans_le' ?_) simpa using mk_range_le_lift (f := g) refine ⟨_, fun t ht ↦ ?_, le_csSup hg ⟨0, rfl⟩⟩ - apply (hs t ht).isLUB_mem (t := .range fun n ↦ f ⟨t, ht⟩ (g n)) _ (Set.range_nonempty _) + apply (hs t ht).isLUB_mem (t := .range fun n ↦ f ⟨t, ht⟩ (g n)) _ (range_nonempty _) · refine ⟨?_, fun b hb ↦ csSup_le' ?_⟩ <;> rintro _ ⟨n, rfl⟩ · apply (le_csSup (.of_not_isCofinal _) _).trans (le_csSup hg ⟨n + 1, rfl⟩) · exact fun hg' ↦ (cof_le hg').not_gt (mk_range_le.trans_lt hsα) @@ -117,16 +116,14 @@ theorem IsClub.sInter {s : Set (Set α)} (hα : cof α ≠ ℵ₀) (hsα : #s < · grind theorem IsClub.iInter {ι : Type u} {f : ι → Set α} (hα : cof α ≠ ℵ₀) - (hι : Cardinal.lift.{v} #ι < Cardinal.lift.{u} (cof α)) (hf : ∀ i, IsClub (f i)) : - IsClub (⋂ i, f i) := by - rw [← Set.sInter_range] + (hι : lift.{v} #ι < lift.{u} (cof α)) (hf : ∀ i, IsClub (f i)) : IsClub (⋂ i, f i) := by + rw [← sInter_range] refine IsClub.sInter hα ?_ (by simpa) rw [← Cardinal.lift_lt] exact mk_range_le_lift.trans_lt hι -theorem IsClub.inter {s t : Set α} (hα : cof α ≠ ℵ₀) (hs : IsClub s) (ht : IsClub t) : - IsClub (s ∩ t) := by - rw [← Set.sInter_pair] +theorem IsClub.inter (hα : cof α ≠ ℵ₀) (hs : IsClub s) (ht : IsClub t) : IsClub (s ∩ t) := by + rw [← sInter_pair] have H : ∀ x ∈ ({s, t} : Set _), IsClub x := by simpa [hs] obtain hα | hα' := hα.lt_or_gt · rw [cof_lt_aleph0_iff] at hα @@ -140,7 +137,7 @@ theorem Order.IsNormal.isClub_fixedPoints {f : α → α} (hα : cof α ≠ ℵ IsClub f.fixedPoints := by cases isEmpty_or_nonempty α; · simp refine ⟨fun s hs hs₀ _ a ha ↦ (hf.map_isLUB ha hs₀).unique ?_, fun a ↦ ?_⟩ - · rwa [Set.image_congr hs, Set.image_id'] + · rwa [image_congr hs, image_id'] · cases topOrderOrNoTopOrder α with | inl => use ⊤; simpa using hf.strictMono.id_le ⊤ | inr h => @@ -160,15 +157,18 @@ end WellFoundedLT def IsStationary (s : Set α) : Prop := ∀ ⦃t⦄, IsClub t → (s ∩ t).Nonempty +theorem not_isStationary_iff : ¬ IsStationary s ↔ ∃ t, IsClub t ∧ Disjoint s t := by + simp [IsStationary, disjoint_iff, not_nonempty_iff_eq_empty] + @[gcongr] theorem IsStationary.mono (hs : IsStationary s) (h : s ⊆ t) : IsStationary t := - fun _u hu ↦ (hs hu).mono (Set.inter_subset_inter_left _ h) + fun _u hu ↦ (hs hu).mono (inter_subset_inter_left _ h) theorem IsStationary.nonempty (hs : IsStationary s) : s.Nonempty := by simpa using hs .univ theorem isStationary_univ_iff : IsStationary (.univ (α := α)) ↔ Nonempty α := by - simp [IsStationary, ← not_imp_not (b := IsClub _), Set.not_nonempty_iff_eq_empty, + simp [IsStationary, ← not_imp_not (b := IsClub _), not_nonempty_iff_eq_empty, isClub_empty_iff] @[simp] @@ -180,36 +180,6 @@ theorem not_isStationary_empty : ¬ IsStationary (∅ : Set α) := by intro h simpa using h .univ -theorem IsClub.isStationary [Nonempty α] [WellFoundedLT α] (hα : cof α ≠ ℵ₀) (hs : IsClub s) : - IsStationary s := - fun _ ht ↦ (hs.inter hα ht).nonempty - -theorem not_isStationary_sUnion [WellFoundedLT α] {s : Set (Set α)} (hα : cof α ≠ ℵ₀) - (hsα : #s < cof α) (hs : ∀ x ∈ s, ¬ IsStationary x) : ¬ IsStationary (⋃₀ s) := by - simp_rw [IsStationary, not_forall, Set.not_nonempty_iff_eq_empty, - ← Set.disjoint_iff_inter_eq_empty] at hs ⊢ - choose f hf hf' using hs - refine ⟨⋂ x : s, f _ x.2, ?_, ?_⟩ - · apply IsClub.iInter hα <;> simpa - · rw [Set.disjoint_sUnion_left] - exact fun x hx ↦ (hf' _ hx).mono_right <| Set.iInter_subset (fun x : s ↦ f x.1 x.2) ⟨x, hx⟩ - -theorem not_isStationary_iUnion [WellFoundedLT α] {ι : Type u} {f : ι → Set α} (hα : cof α ≠ ℵ₀) - (hι : Cardinal.lift.{v} #ι < Cardinal.lift.{u} (cof α)) (hf : ∀ i, ¬ IsStationary (f i)) : - ¬ IsStationary (⋃ i, f i) := by - rw [← Set.sUnion_range] - refine not_isStationary_sUnion hα ?_ (by simpa) - rw [← Cardinal.lift_lt] - exact mk_range_le_lift.trans_lt hι - -theorem not_isStationary_union [WellFoundedLT α] (hα : cof α ≠ ℵ₀) - (hs : ¬ IsStationary s) (ht : ¬ IsStationary t) : ¬ IsStationary (s ∪ t) := by - simp_rw [IsStationary, not_forall, Set.not_nonempty_iff_eq_empty] at hs ht ⊢ - obtain ⟨u, hu, hsu⟩ := hs - obtain ⟨v, hv, htv⟩ := ht - refine ⟨_, hu.inter hα hv, ?_⟩ - grind - theorem IsStationary.of_not_isCofinal_compl (hs : ¬ IsCofinal sᶜ) : IsStationary s := by intro t ht obtain ⟨a, ha⟩ := not_isCofinal_iff.1 hs @@ -217,3 +187,40 @@ theorem IsStationary.of_not_isCofinal_compl (hs : ¬ IsCofinal sᶜ) : IsStation refine ⟨b, ?_, hb⟩ contrapose! ha exact ⟨b, ha, hb'⟩ + +section WellFoundedLT +variable [WellFoundedLT α] + +theorem IsClub.isStationary [Nonempty α] (hα : cof α ≠ ℵ₀) (hs : IsClub s) : IsStationary s := + fun _ ht ↦ (hs.inter hα ht).nonempty + +theorem isStationary_sUnion_iff {s : Set (Set α)} (hα : cof α ≠ ℵ₀) (hsα : #s < cof α) : + IsStationary (⋃₀ s) ↔ ∃ x ∈ s, IsStationary x where + mp h := by + contrapose! h + simp_rw [not_isStationary_iff] at h ⊢ + choose f hf hxf using h + refine ⟨⋂ x : s, f _ x.2, ?_, ?_⟩ + · apply IsClub.iInter hα <;> simpa + · rw [disjoint_sUnion_left] + exact fun x hx ↦ (hxf _ hx).mono_right (iInter_subset _ ⟨x, hx⟩) + mpr := fun ⟨x, hxs, hx⟩ ↦ hx.mono (subset_sUnion_of_mem hxs) + +theorem isStationary_iUnion_iff {ι : Type u} {f : ι → Set α} (hα : cof α ≠ ℵ₀) + (hι : lift.{v} #ι < lift.{u} (cof α)) : IsStationary (⋃ i, f i) ↔ ∃ i, IsStationary (f i) := by + rw [← sUnion_range, isStationary_sUnion_iff hα] + · simp + · rw [← Cardinal.lift_lt] + exact mk_range_le_lift.trans_lt hι + +theorem isStationary_union_iff (hα : cof α ≠ ℵ₀) : + IsStationary (s ∪ t) ↔ IsStationary s ∨ IsStationary t where + mp h := by + contrapose! h + simp_rw [not_isStationary_iff, disjoint_iff_inter_eq_empty] at h ⊢ + obtain ⟨⟨u, hu, hsu⟩, ⟨v, hv, hsv⟩⟩ := h + refine ⟨_, hu.inter hα hv, ?_⟩ + grind + mpr h := h.elim (.mono · subset_union_left) (.mono · subset_union_right) + +end WellFoundedLT From 33bf92127674b9c40035497dcb6438a2faafcde6 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Sat, 23 May 2026 05:07:10 -0600 Subject: [PATCH 79/93] evenmore --- .../SetTheory/Cardinal/Cofinality/Club.lean | 70 +++++++++++++++---- 1 file changed, 56 insertions(+), 14 deletions(-) diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean index cae16cb792cac6..615c9e0b74f7c7 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean @@ -122,13 +122,22 @@ theorem IsClub.iInter {ι : Type u} {f : ι → Set α} (hα : cof α ≠ ℵ₀ rw [← Cardinal.lift_lt] exact mk_range_le_lift.trans_lt hι +theorem IsClub.sInter_countable {s : Set (Set α)} (hα : cof α ≠ ℵ₀) (hsα : s.Countable) + (hs : ∀ x ∈ s, IsClub x) : IsClub (⋂₀ s) := by + obtain hα | hα := hα.lt_or_gt + · apply IsClub.sInter_of_cof_le_one _ hs + rwa [← cof_lt_aleph0_iff] + · apply IsClub.sInter hα.ne' (hα.trans_le' _) hs + rwa [le_aleph0_iff_set_countable] + +theorem IsClub.iInter_countable {ι : Type*} {f : ι → Set α} [Countable ι] (hα : cof α ≠ ℵ₀) + (hf : ∀ i, IsClub (f i)) : IsClub (⋂ i, f i) := by + rw [← sInter_range] + apply IsClub.sInter_countable hα (countable_range f) + simpa + theorem IsClub.inter (hα : cof α ≠ ℵ₀) (hs : IsClub s) (ht : IsClub t) : IsClub (s ∩ t) := by - rw [← sInter_pair] - have H : ∀ x ∈ ({s, t} : Set _), IsClub x := by simpa [hs] - obtain hα | hα' := hα.lt_or_gt - · rw [cof_lt_aleph0_iff] at hα - exact .sInter_of_cof_le_one hα H - · exact .sInter hα (hα'.trans_le' <| by simp) H + simpa [hs, ht] using IsClub.sInter_countable (s := {s, t}) hα theorem Order.IsNormal.isClub_range {f : α → α} (hf : IsNormal f) : IsClub (.range f) := ⟨hf.dirSupClosed_range, fun x ↦ ⟨_, ⟨x, rfl⟩, hf.strictMono.le_apply⟩⟩ @@ -188,6 +197,32 @@ theorem IsStationary.of_not_isCofinal_compl (hs : ¬ IsCofinal sᶜ) : IsStation contrapose! ha exact ⟨b, ha, hb'⟩ +theorem isStationary_sUnion_iff_of_cof_le_one {s : Set (Set α)} (hα : cof α ≤ 1) : + IsStationary (⋃₀ s) ↔ ∃ x ∈ s, IsStationary x where + mp h := by + contrapose! h + simp_rw [not_isStationary_iff] at h ⊢ + choose f hf hxf using h + refine ⟨⋂ x : s, f _ x.2, ?_, ?_⟩ + · apply IsClub.iInter_of_cof_le_one hα + simpa + · rw [disjoint_sUnion_left] + exact fun x hx ↦ (hxf _ hx).mono_right (iInter_subset _ ⟨x, hx⟩) + mpr := fun ⟨x, hxs, hx⟩ ↦ hx.mono (subset_sUnion_of_mem hxs) + +theorem isStationary_iUnion_iff_of_cof_le_one {ι : Type u} {f : ι → Set α} (hα : cof α ≤ 1) : + IsStationary (⋃ i, f i) ↔ ∃ i, IsStationary (f i) := by + rw [← sUnion_range, isStationary_sUnion_iff_of_cof_le_one hα] + simp + +theorem isStationary_sUnion_iff_of_orderTop [OrderTop α] {s : Set (Set α)} : + IsStationary (⋃₀ s) ↔ ∃ x ∈ s, IsStationary x := + isStationary_sUnion_iff_of_cof_le_one (by simp) + +theorem isStationary_iUnion_iff_of_orderTop [OrderTop α] {ι : Type u} {f : ι → Set α} : + IsStationary (⋃ i, f i) ↔ ∃ i, IsStationary (f i) := + isStationary_iUnion_iff_of_cof_le_one (by simp) + section WellFoundedLT variable [WellFoundedLT α] @@ -213,14 +248,21 @@ theorem isStationary_iUnion_iff {ι : Type u} {f : ι → Set α} (hα : cof α · rw [← Cardinal.lift_lt] exact mk_range_le_lift.trans_lt hι +theorem isStationary_sUnion_countable_iff {s : Set (Set α)} (hα : cof α ≠ ℵ₀) (hsα : s.Countable) : + IsStationary (⋃₀ s) ↔ ∃ x ∈ s, IsStationary x := by + obtain hα | hα := hα.lt_or_gt + · apply isStationary_sUnion_iff_of_cof_le_one + rwa [← cof_lt_aleph0_iff] + · apply isStationary_sUnion_iff hα.ne' (hα.trans_le' _) + rwa [le_aleph0_iff_set_countable] + +theorem isStationary_iUnion_countable_iff {ι : Type*} {f : ι → Set α} [Countable ι] + (hα : cof α ≠ ℵ₀) : IsStationary (⋃ i, f i) ↔ ∃ i, IsStationary (f i) := by + rw [← sUnion_range, isStationary_sUnion_countable_iff hα (countable_range f)] + simp + theorem isStationary_union_iff (hα : cof α ≠ ℵ₀) : - IsStationary (s ∪ t) ↔ IsStationary s ∨ IsStationary t where - mp h := by - contrapose! h - simp_rw [not_isStationary_iff, disjoint_iff_inter_eq_empty] at h ⊢ - obtain ⟨⟨u, hu, hsu⟩, ⟨v, hv, hsv⟩⟩ := h - refine ⟨_, hu.inter hα hv, ?_⟩ - grind - mpr h := h.elim (.mono · subset_union_left) (.mono · subset_union_right) + IsStationary (s ∪ t) ↔ IsStationary s ∨ IsStationary t := by + simpa using isStationary_sUnion_countable_iff (s := {s, t}) hα end WellFoundedLT From 1d05495effc75175fce73cdd6b7971f2afb591b2 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Sat, 23 May 2026 11:01:15 -0600 Subject: [PATCH 80/93] suggestion --- Mathlib/SetTheory/Cardinal/Cofinality/Club.lean | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean index 615c9e0b74f7c7..4d1e4f8ffde824 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean @@ -248,21 +248,21 @@ theorem isStationary_iUnion_iff {ι : Type u} {f : ι → Set α} (hα : cof α · rw [← Cardinal.lift_lt] exact mk_range_le_lift.trans_lt hι -theorem isStationary_sUnion_countable_iff {s : Set (Set α)} (hα : cof α ≠ ℵ₀) (hsα : s.Countable) : - IsStationary (⋃₀ s) ↔ ∃ x ∈ s, IsStationary x := by +theorem isStationary_sUnion_iff_of_countable {s : Set (Set α)} (hα : cof α ≠ ℵ₀) + (hsα : s.Countable) : IsStationary (⋃₀ s) ↔ ∃ x ∈ s, IsStationary x := by obtain hα | hα := hα.lt_or_gt · apply isStationary_sUnion_iff_of_cof_le_one rwa [← cof_lt_aleph0_iff] · apply isStationary_sUnion_iff hα.ne' (hα.trans_le' _) rwa [le_aleph0_iff_set_countable] -theorem isStationary_iUnion_countable_iff {ι : Type*} {f : ι → Set α} [Countable ι] +theorem isStationary_iUnion_iff_of_countable {ι : Type*} {f : ι → Set α} [Countable ι] (hα : cof α ≠ ℵ₀) : IsStationary (⋃ i, f i) ↔ ∃ i, IsStationary (f i) := by - rw [← sUnion_range, isStationary_sUnion_countable_iff hα (countable_range f)] + rw [← sUnion_range, isStationary_sUnion_iff_of_countable hα (countable_range f)] simp theorem isStationary_union_iff (hα : cof α ≠ ℵ₀) : IsStationary (s ∪ t) ↔ IsStationary s ∨ IsStationary t := by - simpa using isStationary_sUnion_countable_iff (s := {s, t}) hα + simpa using isStationary_sUnion_iff_of_countable (s := {s, t}) hα end WellFoundedLT From e7cb9beabc449709a28cc581f7c7fa06e9a1ccca Mon Sep 17 00:00:00 2001 From: vihdzp Date: Sat, 23 May 2026 22:14:17 -0600 Subject: [PATCH 81/93] suggestions --- Mathlib/Order/Interval/Set/Basic.lean | 2 +- Mathlib/SetTheory/Cardinal/Cofinality/Club.lean | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Mathlib/Order/Interval/Set/Basic.lean b/Mathlib/Order/Interval/Set/Basic.lean index 98c6874023d414..46ee9677bc7590 100644 --- a/Mathlib/Order/Interval/Set/Basic.lean +++ b/Mathlib/Order/Interval/Set/Basic.lean @@ -468,7 +468,7 @@ variable [PartialOrder α] {a b c : α} @[simp] theorem Icc_self (a : α) : Icc a a = {a} := - Set.ext <| by simp [Icc, le_antisymm_iff, and_comm] + ext <| by simp [Icc, le_antisymm_iff, and_comm] instance instIccUnique : Unique (Icc a a) where default := ⟨a, by simp⟩ diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean index 4d1e4f8ffde824..3277cf7ee435e3 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean @@ -181,7 +181,7 @@ theorem isStationary_univ_iff : IsStationary (.univ (α := α)) ↔ Nonempty α isClub_empty_iff] @[simp] -theorem IsStationary.univ [Nonempty α] : IsStationary (.univ (α := α)) := +protected theorem IsStationary.univ [Nonempty α] : IsStationary (.univ (α := α)) := isStationary_univ_iff.2 ‹_› @[simp] @@ -189,6 +189,10 @@ theorem not_isStationary_empty : ¬ IsStationary (∅ : Set α) := by intro h simpa using h .univ +@[simp] +theorem not_isStationary_of_isEmpty [IsEmpty α] : ¬ IsStationary s := + s.eq_empty_of_isEmpty ▸ not_isStationary_empty + theorem IsStationary.of_not_isCofinal_compl (hs : ¬ IsCofinal sᶜ) : IsStationary s := by intro t ht obtain ⟨a, ha⟩ := not_isCofinal_iff.1 hs From 0746b296573530eec00be82684c0f206a5eef488 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Sun, 24 May 2026 07:42:10 -0600 Subject: [PATCH 82/93] suggestion --- Mathlib/SetTheory/Cardinal/Cofinality/Club.lean | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean index 3277cf7ee435e3..e2426c09d236f5 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean @@ -122,7 +122,7 @@ theorem IsClub.iInter {ι : Type u} {f : ι → Set α} (hα : cof α ≠ ℵ₀ rw [← Cardinal.lift_lt] exact mk_range_le_lift.trans_lt hι -theorem IsClub.sInter_countable {s : Set (Set α)} (hα : cof α ≠ ℵ₀) (hsα : s.Countable) +theorem IsClub.sInter_of_countable {s : Set (Set α)} (hα : cof α ≠ ℵ₀) (hsα : s.Countable) (hs : ∀ x ∈ s, IsClub x) : IsClub (⋂₀ s) := by obtain hα | hα := hα.lt_or_gt · apply IsClub.sInter_of_cof_le_one _ hs @@ -130,14 +130,14 @@ theorem IsClub.sInter_countable {s : Set (Set α)} (hα : cof α ≠ ℵ₀) (hs · apply IsClub.sInter hα.ne' (hα.trans_le' _) hs rwa [le_aleph0_iff_set_countable] -theorem IsClub.iInter_countable {ι : Type*} {f : ι → Set α} [Countable ι] (hα : cof α ≠ ℵ₀) +theorem IsClub.iInter_of_countable {ι : Type*} {f : ι → Set α} [Countable ι] (hα : cof α ≠ ℵ₀) (hf : ∀ i, IsClub (f i)) : IsClub (⋂ i, f i) := by rw [← sInter_range] - apply IsClub.sInter_countable hα (countable_range f) + apply IsClub.sInter_of_countable hα (countable_range f) simpa theorem IsClub.inter (hα : cof α ≠ ℵ₀) (hs : IsClub s) (ht : IsClub t) : IsClub (s ∩ t) := by - simpa [hs, ht] using IsClub.sInter_countable (s := {s, t}) hα + simpa [hs, ht] using IsClub.sInter_of_countable (s := {s, t}) hα theorem Order.IsNormal.isClub_range {f : α → α} (hf : IsNormal f) : IsClub (.range f) := ⟨hf.dirSupClosed_range, fun x ↦ ⟨_, ⟨x, rfl⟩, hf.strictMono.le_apply⟩⟩ From a7301dcc03f8359ccd9197fc60ed12ee1311293b Mon Sep 17 00:00:00 2001 From: vihdzp Date: Sun, 24 May 2026 09:10:46 -0600 Subject: [PATCH 83/93] why is this here --- Mathlib/Order/Interval/Set/Basic.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/Order/Interval/Set/Basic.lean b/Mathlib/Order/Interval/Set/Basic.lean index 0c4ffd2e45c6cb..fb6b4ec90b2c7c 100644 --- a/Mathlib/Order/Interval/Set/Basic.lean +++ b/Mathlib/Order/Interval/Set/Basic.lean @@ -472,7 +472,7 @@ variable [PartialOrder α] {a b c : α} @[simp] theorem Icc_self (a : α) : Icc a a = {a} := - ext <| by simp [Icc, le_antisymm_iff, and_comm] + Set.ext <| by simp [Icc, le_antisymm_iff, and_comm] instance instIccUnique : Unique (Icc a a) where default := ⟨a, by simp⟩ From 4dceff8188cf2c4cd39c71098063c902dd83ae2a Mon Sep 17 00:00:00 2001 From: vihdzp Date: Sun, 24 May 2026 12:03:03 -0600 Subject: [PATCH 84/93] merge --- Mathlib/SetTheory/Cardinal/Cofinality/Club.lean | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean index f2cdee79f922b5..11db8bf85b17c1 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean @@ -45,8 +45,6 @@ structure IsClub {α : Type*} [LinearOrder α] (s : Set α) where namespace IsClub -namespace IsClub - @[simp] theorem of_isEmpty [IsEmpty α] {s : Set α} : IsClub s := ⟨.of_isEmpty, .of_isEmpty⟩ @@ -337,9 +335,9 @@ theorem isStationary_union_iff (hα : cof α ≠ ℵ₀) : /-- **Fodor's lemma**, or the **pressing down lemma**: if `α` has the order type of a regular cardinal, `s` is a stationary set, and `f : α → α` is a regressive function on `s`, there exists some stationary subset of `s` which is constant on `f`. -/ -theorem exists_isStationary_preimage_singleton - [WellFoundedLT α] [IsRegularCardinalOrder α] {f : α → α} (hα : cof α ≠ ℵ₀) - (hs : IsStationary s) (hf : ∀ x ∈ s, f x < x) : ∃ a, IsStationary (s ∩ f ⁻¹' {a}) := by +theorem exists_isStationary_preimage_singleton [IsRegularCardinalOrder α] {f : α → α} + (hα : cof α ≠ ℵ₀) (hs : IsStationary s) (hf : ∀ x ∈ s, f x < x) : + ∃ a, IsStationary (s ∩ f ⁻¹' {a}) := by unfold IsStationary by_contra! choose g hg using this From 7564dfc0e63d0b6d1668a4174302ddde72cb062f Mon Sep 17 00:00:00 2001 From: vihdzp Date: Wed, 27 May 2026 13:39:57 -0600 Subject: [PATCH 85/93] merge --- Mathlib/Order/DirSupClosed.lean | 350 ++++++++++++++++++++++++++++++++ 1 file changed, 350 insertions(+) create mode 100644 Mathlib/Order/DirSupClosed.lean diff --git a/Mathlib/Order/DirSupClosed.lean b/Mathlib/Order/DirSupClosed.lean new file mode 100644 index 00000000000000..9816253c8526c3 --- /dev/null +++ b/Mathlib/Order/DirSupClosed.lean @@ -0,0 +1,350 @@ +/- +Copyright (c) 2023 Christopher Hoskin. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Christopher Hoskin, Violeta Hernández Palacios +-/ +module + +public import Mathlib.Order.Antisymmetrization +public import Mathlib.Order.CompleteLattice.Defs +public import Mathlib.Order.UpperLower.Basic + +import Mathlib.Data.Set.Lattice + +/-! +# Sets closed under directed suprema + +We say that a set `s` is closed under directed suprema whenever it contains all least upper bounds +for nonempty, directed subsets. Conversely, a set `s` is inaccessible by directed suprema whenever +its complement is closed under directed suprema. Equivalently, if the least upper bound of a +nonempty directed set `t` is contained in `s`, then `t` and `s` must have nonempty intersection. + +## Main definitions + +- `DirSupClosed`: sets closed under directed suprema. +- `DirSupInacc`: sets inaccessible by directed suprema. +-/ + +@[expose] public section + +variable {α : Type*} {s t : Set α} {D D₁ D₂ : Set (Set α)} + +open Set + +section Preorder +variable [Preorder α] + +/-- A predicate for a set which is closed under directed suprema of nonempty sets. +This is the complement of a `DirSupInaccOn` set. -/ +def DirSupClosedOn (D : Set (Set α)) (s : Set α) : Prop := + ∀ ⦃d⦄, d ∈ D → d ⊆ s → d.Nonempty → DirectedOn (· ≤ ·) d → ∀ ⦃a⦄, IsLUB d a → a ∈ s + +/-- A predicate for a set which is inaccessible by directed suprema of nonempty sets in `D`. +This is the complement of a `DirSupClosedOn` set. -/ +def DirSupInaccOn (D : Set (Set α)) (s : Set α) : Prop := + ∀ ⦃d⦄, d ∈ D → d.Nonempty → DirectedOn (· ≤ ·) d → ∀ ⦃a⦄, IsLUB d a → a ∈ s → (d ∩ s).Nonempty + +/-- A predicate for a set which is closed under directed suprema of nonempty sets. +This is the complement of a `DirSupInacc` set. -/ +def DirSupClosed (s : Set α) : Prop := + ∀ ⦃d⦄, d ⊆ s → d.Nonempty → DirectedOn (· ≤ ·) d → ∀ ⦃a⦄, IsLUB d a → a ∈ s + +/-- A predicate for a set which is inaccessible by directed suprema of nonempty sets. +This is the complement of a `DirSupClosed` set. -/ +def DirSupInacc (s : Set α) : Prop := + ∀ ⦃d⦄, d.Nonempty → DirectedOn (· ≤ ·) d → ∀ ⦃a⦄, IsLUB d a → a ∈ s → (d ∩ s).Nonempty + +@[simp] lemma dirSupClosedOn_univ : DirSupClosedOn univ s ↔ DirSupClosed s := by + simp [DirSupClosedOn, DirSupClosed] + +@[simp] lemma dirSupInaccOn_univ : DirSupInaccOn univ s ↔ DirSupInacc s := by + simp [DirSupInaccOn, DirSupInacc] + +@[simp] lemma DirSupClosed.dirSupClosedOn : DirSupClosed s → DirSupClosedOn D s := @fun h _ _ ↦ @h _ +@[simp] lemma DirSupInacc.dirSupInaccOn : DirSupInacc s → DirSupInaccOn D s := @fun h _ _ ↦ @h _ + +@[simp] theorem DirSupClosed.of_isEmpty [IsEmpty α] {s : Set α} : DirSupClosed s := + fun _ _ ⟨a, _⟩ ↦ isEmptyElim a + +@[simp] theorem DirSupInacc.of_isEmpty [IsEmpty α] {s : Set α} : DirSupInacc s := + fun _ ⟨a, _⟩ ↦ isEmptyElim a + +theorem DirSupClosedOn.of_isEmpty [IsEmpty α] {s : Set α} : DirSupClosedOn D s := by simp +theorem DirSupInaccOn.of_isEmpty [IsEmpty α] {s : Set α} : DirSupInaccOn D s := by simp + +@[gcongr] +lemma DirSupClosedOn.mono (hD : D₁ ⊆ D₂) (hf : DirSupClosedOn D₂ s) : DirSupClosedOn D₁ s := + fun _ a ↦ hf (hD a) + +@[gcongr] +lemma DirSupInaccOn.mono (hD : D₁ ⊆ D₂) (hf : DirSupInaccOn D₂ s) : DirSupInaccOn D₁ s := + fun _ a ↦ hf (hD a) + +@[simp] +lemma dirSupClosedOn_compl : DirSupClosedOn D sᶜ ↔ DirSupInaccOn D s := by + simp_rw [DirSupClosedOn, DirSupInaccOn, ← not_disjoint_iff_nonempty_inter] + grind + +@[simp] +lemma dirSupClosed_compl : DirSupClosed sᶜ ↔ DirSupInacc s := by + rw [← dirSupClosedOn_univ, dirSupClosedOn_compl, dirSupInaccOn_univ] + +@[simp] +lemma dirSupInaccOn_compl : DirSupInaccOn D sᶜ ↔ DirSupClosedOn D s := by + rw [← dirSupClosedOn_compl, compl_compl] + +@[simp] +lemma dirSupInacc_compl : DirSupInacc sᶜ ↔ DirSupClosed s := by + rw [← dirSupClosed_compl, compl_compl] + +alias ⟨DirSupInaccOn.of_compl, DirSupInaccOn.compl⟩ := dirSupClosedOn_compl +alias ⟨DirSupClosedOn.of_compl, DirSupClosedOn.compl⟩ := dirSupInaccOn_compl +alias ⟨DirSupInacc.of_compl, DirSupInacc.compl⟩ := dirSupClosed_compl +alias ⟨DirSupClosed.of_compl, DirSupClosed.compl⟩ := dirSupInacc_compl + +@[simp] theorem DirSupClosed.empty : DirSupClosed (∅ : Set α) := by simp [DirSupClosed] +@[simp] theorem DirSupInacc.empty : DirSupInacc (∅ : Set α) := by simp [DirSupInacc] +theorem DirSupClosedOn.empty : DirSupClosedOn D ∅ := by simp +theorem DirSupInaccOn.empty : DirSupInaccOn D ∅ := by simp + +@[simp] theorem DirSupClosed.univ : DirSupClosed (univ : Set α) := by simp [DirSupClosed] +@[simp] theorem DirSupInacc.univ : DirSupInacc (univ : Set α) := by simp [← compl_empty] +theorem DirSupClosedOn.univ : DirSupClosedOn D univ := by simp +theorem DirSupInaccOn.univ : DirSupInaccOn D univ := by simp + +theorem DirSupClosedOn.sInter {s : Set (Set α)} (hs : ∀ x ∈ s, DirSupClosedOn D x) : + DirSupClosedOn D (⋂₀ s) := + fun _d hD hds hd hd' _a ha t ht ↦ hs t ht hD (hds.trans fun _x hx ↦ hx _ ht) hd hd' ha + +theorem DirSupClosed.sInter {s : Set (Set α)} (hs : ∀ x ∈ s, DirSupClosed x) : + DirSupClosed (⋂₀ s) := by + simpa using DirSupClosedOn.sInter fun x hx ↦ (hs x hx).dirSupClosedOn (D := .univ) + +theorem DirSupInaccOn.sUnion {s : Set (Set α)} (hs : ∀ x ∈ s, DirSupInaccOn D x) : + DirSupInaccOn D (⋃₀ s) := by + rw [← dirSupClosedOn_compl, Set.compl_sUnion] + apply DirSupClosedOn.sInter + rintro x ⟨x, hx, rfl⟩ + exact (hs x hx).compl + +theorem DirSupInacc.sUnion {s : Set (Set α)} (hs : ∀ x ∈ s, DirSupInacc x) : + DirSupInacc (⋃₀ s) := by + simpa using DirSupInaccOn.sUnion fun x hx ↦ (hs x hx).dirSupInaccOn (D := .univ) + +theorem DirSupClosedOn.iInter {ι} {f : ι → Set α} (hs : ∀ i, DirSupClosedOn D (f i)) : + DirSupClosedOn D (⋂ i, f i) := by + rw [← sInter_range f] + exact DirSupClosedOn.sInter (by simpa) + +theorem DirSupClosed.iInter {ι} {f : ι → Set α} (hs : ∀ i, DirSupClosed (f i)) : + DirSupClosed (⋂ i, f i) := by + rw [← sInter_range f] + exact DirSupClosed.sInter (by simpa) + +theorem DirSupInaccOn.iUnion {ι} {f : ι → Set α} (hs : ∀ i, DirSupInaccOn D (f i)) : + DirSupInaccOn D (⋃ i, f i) := by + rw [← sUnion_range f] + exact DirSupInaccOn.sUnion (by simpa) + +theorem DirSupInacc.iUnion {ι} {f : ι → Set α} (hs : ∀ i, DirSupInacc (f i)) : + DirSupInacc (⋃ i, f i) := by + rw [← sUnion_range f] + exact DirSupInacc.sUnion (by simpa) + +lemma DirSupClosedOn.inter (hs : DirSupClosedOn D s) (ht : DirSupClosedOn D t) : + DirSupClosedOn D (s ∩ t) := by + rw [← sInter_pair] + refine .sInter ?_ + simpa [hs] + +lemma DirSupClosed.inter (hs : DirSupClosed s) (ht : DirSupClosed t) : DirSupClosed (s ∩ t) := by + simpa using hs.dirSupClosedOn.inter ht.dirSupClosedOn (D := .univ) + +lemma DirSupInaccOn.union (hs : DirSupInaccOn D s) (ht : DirSupInaccOn D t) : + DirSupInaccOn D (s ∪ t) := by + rw [← dirSupClosedOn_compl, compl_union]; exact hs.compl.inter ht.compl + +lemma DirSupInacc.union (hs : DirSupInacc s) (ht : DirSupInacc t) : DirSupInacc (s ∪ t) := by + simpa using hs.dirSupInaccOn.union ht.dirSupInaccOn (D := .univ) + +theorem DirSupClosedOn.union (hDL : IsLowerSet D) + (hs : DirSupClosedOn D s) (ht : DirSupClosedOn D t) : DirSupClosedOn D (s ∪ t) := by + intro d hD hdu hd₀ hd₁ a ha + have hdst : d ∩ s ∪ d ∩ t = d := by grind + rw [← hdst] at hd₀ hd₁ + wlog h : DirectedOn (· ≤ ·) (d ∩ s) ∧ (d ∩ s).Nonempty + · rw [union_comm] at hdu hd₀ hd₁ hdst ⊢ + exact this hDL ht hs hD hdu hd₀ hd₁ ha hdst <| + (directedOn_or_directedOn_of_union' hd₀ hd₁).resolve_right h + obtain ⟨hds, hn⟩ := h + by_cases had : a ∈ lowerBounds (upperBounds (d ∩ s)) + · exact .inl <| hs (hDL inter_subset_left hD) inter_subset_right hn hds + ⟨fun b hb ↦ ha.1 hb.1, had⟩ + · simp only [lowerBounds, mem_setOf_eq, not_forall] at had + obtain ⟨b, hb, hb'⟩ := had + have key : {x ∈ d | ¬ x ≤ b} ⊆ d ∩ t := fun a ⟨had, hab⟩ ↦ + ⟨had, (hdu had).resolve_left fun has ↦ hab <| hb ⟨had, has⟩⟩ + obtain ⟨w, hw⟩ : {x ∈ d | ¬ x ≤ b}.Nonempty := by + contrapose! hb' + apply ha.2 + aesop + refine Or.inr <| ht (hDL inter_subset_left hD) (key.trans inter_subset_right) + ⟨w, hw⟩ (fun x hx y hy ↦ ?_) ?_ + · obtain ⟨z, hz, hz'⟩ := hd₁ _ (.inr (key hx)) _ (.inr (key hy)) + exact ⟨z, ⟨⟨hdst ▸ hz, mt hz'.1.trans hx.2⟩, hz'⟩⟩ + · refine ⟨fun x hx ↦ ha.1 hx.1, fun x hx ↦ ha.2 fun y hy ↦ ?_⟩ + by_cases hyb : y ≤ b + · obtain ⟨z, hz, hxz, hyz⟩ := hd₁ _ (hdst ▸ hy) _ (.inr (key hw)) + exact hxz.trans (hx ⟨hdst ▸ hz, fun hzb ↦ hw.2 (hyz.trans hzb)⟩) + exact hx ⟨hy, hyb⟩ + +theorem DirSupInaccOn.inter (hDL : IsLowerSet D) + (hs : DirSupInaccOn D s) (ht : DirSupInaccOn D t) : DirSupInaccOn D (s ∩ t) := by + rw [← dirSupClosedOn_compl, compl_inter]; exact hs.compl.union hDL ht.compl + +theorem DirSupClosed.union (hs : DirSupClosed s) (ht : DirSupClosed t) : DirSupClosed (s ∪ t) := by + simpa using hs.dirSupClosedOn.union isLowerSet_univ ht.dirSupClosedOn + +theorem DirSupInacc.inter (hs : DirSupInacc s) (ht : DirSupInacc t) : DirSupInacc (s ∩ t) := by + simpa using hs.dirSupInaccOn.inter isLowerSet_univ ht.dirSupInaccOn + +theorem DirSupInaccOn.of_inter_subset + (h : ∀ ⦃d : Set α⦄, d ∈ D → d.Nonempty → DirectedOn (· ≤ ·) d → + ∀ ⦃a : α⦄, IsLUB d a → a ∈ s → ∃ b ∈ d, Ici b ∩ d ⊆ s) : DirSupInaccOn D s := by + intro d hd₀ hd₁ hd₂ a hda hd₃ + obtain ⟨b, hbd, hb⟩ := h hd₀ hd₁ hd₂ hda hd₃ + exact ⟨b, hbd, hb ⟨le_rfl, hbd⟩⟩ + +theorem DirSupInacc.of_inter_subset + (h : ∀ ⦃d : Set α⦄, d.Nonempty → DirectedOn (· ≤ ·) d → + ∀ ⦃a : α⦄, IsLUB d a → a ∈ s → ∃ b ∈ d, Ici b ∩ d ⊆ s) : DirSupInacc s := + dirSupInaccOn_univ.1 (.of_inter_subset (by simpa)) + +/-- The condition `(d ∩ s).Nonempty` in `DirSupInaccOn` can be replaced with the stronger +`∃ b ∈ d, Ici b ∩ d ⊆ s` (under mild assumptions on `D`). -/ +theorem dirSupInaccOn_iff_inter_subset (hDL : IsLowerSet D) : + DirSupInaccOn D s ↔ ∀ ⦃d : Set α⦄, d ∈ D → d.Nonempty → DirectedOn (· ≤ ·) d → + ∀ ⦃a : α⦄, IsLUB d a → a ∈ s → ∃ b ∈ d, Ici b ∩ d ⊆ s where + mpr := .of_inter_subset + mp h t hD ht₀ ht₁ a ha has := by + by_contra! H + have H : ∀ b : t, ∃ c, b.1 ≤ c ∧ c ∈ t ∧ c ∉ s := by simpa [not_subset, and_assoc] using H + choose f hf using H + have := ht₀.to_subtype + have hft : range f ⊆ t := by grind + apply (h (hDL hft hD) (range_nonempty f) _ _ has).ne_empty + · aesop + · intro a ha b hb + obtain ⟨c, hc, _, _⟩ := ht₁ _ (hft ha) _ (hft hb) + have := hf ⟨c, hc⟩ + grind + · exact ⟨upperBounds_mono_set hft ha.1, + fun b hb ↦ ha.2 fun c hc ↦ (hf ⟨c, hc⟩).1.trans (hb <| by simp)⟩ + +/-- The condition `(d ∩ s).Nonempty` in `DirSupInacc` can be replaced with the stronger +`∃ b ∈ d, Ici b ∩ d ⊆ s`. -/ +theorem dirSupInacc_iff_inter_subset : + DirSupInacc s ↔ ∀ ⦃d : Set α⦄, d.Nonempty → DirectedOn (· ≤ ·) d → + ∀ ⦃a : α⦄, IsLUB d a → a ∈ s → ∃ b ∈ d, Ici b ∩ d ⊆ s := by + simpa using dirSupInaccOn_iff_inter_subset isLowerSet_univ + +lemma IsUpperSet.dirSupClosed (hs : IsUpperSet s) : DirSupClosed s := + fun _d hds ⟨_b, hb⟩ _ _a ha ↦ hs (ha.1 hb) <| hds hb + +lemma IsUpperSet.dirSupClosedOn (hs : IsUpperSet s) : DirSupClosedOn D s := + hs.dirSupClosed.dirSupClosedOn + +lemma IsLowerSet.dirSupInacc (hs : IsLowerSet s) : DirSupInacc s := + .of_compl hs.compl.dirSupClosed + +lemma IsLowerSet.dirSupInaccOn (hs : IsLowerSet s) : DirSupInaccOn D s := + .of_compl hs.compl.dirSupClosedOn + +theorem DirSupClosed.mem_imp_of_antisymmRel (hs : DirSupClosed s) {a b : α} + (h : AntisymmRel (· ≤ ·) a b) (ha : a ∈ s) : b ∈ s := by + apply hs (singleton_subset_iff.2 ha) ⟨a, rfl⟩ (directedOn_singleton a) + rw [← isLUB_congr_of_antisymmRel h] + exact isLUB_singleton + +theorem DirSupClosed.mem_iff_of_antisymmRel (hs : DirSupClosed s) {a b : α} + (h : AntisymmRel (· ≤ ·) a b) : a ∈ s ↔ b ∈ s := + ⟨hs.mem_imp_of_antisymmRel h, hs.mem_imp_of_antisymmRel h.symm⟩ + +theorem DirSupInacc.mem_iff_of_antisymmRel (hs : DirSupInacc s) {a b : α} + (h : AntisymmRel (· ≤ ·) a b) : a ∈ s ↔ b ∈ s := by + simpa [not_iff_not] using hs.compl.mem_iff_of_antisymmRel h + +lemma dirSupClosed_Iic (a : α) : DirSupClosed (Iic a) := + fun _d h _ _ _a ha ↦ (isLUB_le_iff ha).2 h + +lemma dirSupClosedOn_Iic (a : α) : DirSupClosedOn D (Iic a) := + (dirSupClosed_Iic a).dirSupClosedOn + +lemma dirSupInacc_Iic (a : α) : DirSupInacc (Iic a) := + (isLowerSet_Iic a).dirSupInacc + +lemma dirSupInaccOn_Iic (a : α) : DirSupInaccOn D (Iic a) := + (isLowerSet_Iic a).dirSupInaccOn + +end Preorder + +section PartialOrder +variable [PartialOrder α] + +theorem DirSupClosed.singleton (a : α) : DirSupClosed {a} := by + intro d hda hdn _ b hb + rw [hdn.subset_singleton_iff] at hda + subst hda + exact mem_singleton_of_eq (hb.unique isLUB_singleton) + +@[deprecated (since := "2026-05-22")] alias dirSupClosed_singleton := DirSupClosed.singleton + +theorem DirSupClosedOn.singleton (a : α) : DirSupClosedOn D {a} := + (DirSupClosed.singleton a).dirSupClosedOn + +@[deprecated (since := "2026-05-22")] alias dirSupClosedOn_singleton := DirSupClosedOn.singleton + +end PartialOrder + +section LinearOrder +variable [LinearOrder α] + +theorem dirSupClosedOn_iff_of_linearOrder : + DirSupClosedOn D s ↔ ∀ ⦃d⦄, d ∈ D → d ⊆ s → d.Nonempty → ∀ ⦃a⦄, IsLUB d a → a ∈ s := by + simp [DirSupClosedOn] + +theorem dirSupClosed_iff_of_linearOrder : + DirSupClosed s ↔ ∀ ⦃d⦄, d ⊆ s → d.Nonempty → ∀ ⦃a⦄, IsLUB d a → a ∈ s := by + simp [DirSupClosed] + +theorem dirSupInaccOn_iff_of_linearOrder : + DirSupInaccOn D s ↔ + ∀ ⦃d⦄, d ∈ D → d.Nonempty → ∀ ⦃a⦄, IsLUB d a → a ∈ s → (d ∩ s).Nonempty := by + simp [DirSupInaccOn] + +theorem dirSupInacc_iff_of_linearOrder : + DirSupInacc s ↔ ∀ ⦃d⦄, d.Nonempty → ∀ ⦃a⦄, IsLUB d a → a ∈ s → (d ∩ s).Nonempty := by + simp [DirSupInacc] + +end LinearOrder + +section CompleteLattice +variable [CompleteLattice α] + +lemma dirSupClosedOn_iff_forall_sSup : DirSupClosedOn D s ↔ + ∀ ⦃d⦄, d ∈ D → d ⊆ s → d.Nonempty → DirectedOn (· ≤ ·) d → sSup d ∈ s := by + simp [DirSupClosedOn, isLUB_iff_sSup_eq] + +lemma dirSupInaccOn_iff_forall_sSup : DirSupInaccOn D s ↔ + ∀ ⦃d⦄, d ∈ D → d.Nonempty → DirectedOn (· ≤ ·) d → sSup d ∈ s → (d ∩ s).Nonempty := by + simp [DirSupInaccOn, isLUB_iff_sSup_eq] + +lemma dirSupClosed_iff_forall_sSup : DirSupClosed s ↔ + ∀ ⦃d⦄, d ⊆ s → d.Nonempty → DirectedOn (· ≤ ·) d → sSup d ∈ s := by + simp [DirSupClosed, isLUB_iff_sSup_eq] + +lemma dirSupInacc_iff_forall_sSup : DirSupInacc s ↔ + ∀ ⦃d⦄, d.Nonempty → DirectedOn (· ≤ ·) d → sSup d ∈ s → (d ∩ s).Nonempty := by + simp [DirSupInacc, isLUB_iff_sSup_eq] + +end CompleteLattice From 614e0eb076aabef8944151cc8b00cdf33bd6b222 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Wed, 27 May 2026 15:53:40 -0600 Subject: [PATCH 86/93] fix --- Mathlib/Order/DirSupClosed.lean | 10 +++------- Mathlib/SetTheory/Cardinal/Cofinality/Basic.lean | 3 --- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/Mathlib/Order/DirSupClosed.lean b/Mathlib/Order/DirSupClosed.lean index 9816253c8526c3..b7387615ef9c46 100644 --- a/Mathlib/Order/DirSupClosed.lean +++ b/Mathlib/Order/DirSupClosed.lean @@ -291,18 +291,14 @@ end Preorder section PartialOrder variable [PartialOrder α] -theorem DirSupClosed.singleton (a : α) : DirSupClosed {a} := by +theorem dirSupClosed_singleton (a : α) : DirSupClosed {a} := by intro d hda hdn _ b hb rw [hdn.subset_singleton_iff] at hda subst hda exact mem_singleton_of_eq (hb.unique isLUB_singleton) -@[deprecated (since := "2026-05-22")] alias dirSupClosed_singleton := DirSupClosed.singleton - -theorem DirSupClosedOn.singleton (a : α) : DirSupClosedOn D {a} := - (DirSupClosed.singleton a).dirSupClosedOn - -@[deprecated (since := "2026-05-22")] alias dirSupClosedOn_singleton := DirSupClosedOn.singleton +theorem dirSupClosedOn_singleton (a : α) : DirSupClosedOn D {a} := + (dirSupClosed_singleton a).dirSupClosedOn end PartialOrder diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Basic.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Basic.lean index 54a8ed9659b53f..ff288badfea0f4 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Basic.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Basic.lean @@ -131,9 +131,6 @@ 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 : Order.cof α < ℵ₀ ↔ Order.cof α ≤ 1 := by refine ⟨fun h ↦ ?_, (lt_of_le_of_lt · one_lt_aleph0)⟩ From 1efd839d9af5276dc9c64c2f610db21d0778ac54 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Wed, 27 May 2026 15:57:28 -0600 Subject: [PATCH 87/93] fi --- Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean | 1 + 1 file changed, 1 insertion(+) diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean index e7acdad354bbe6..91aa876065031e 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean @@ -169,6 +169,7 @@ theorem exists_ord_cof_eq [LinearOrder α] [WellFoundedLT α] : @[deprecated (since := "2026-05-25")] alias ord_cof_eq := exists_ord_cof_eq +variable (α) in @[simp] theorem _root_.Order.cof_ord_cof [LinearOrder α] [WellFoundedLT α] : (Order.cof α).ord.cof = Order.cof α := by From 0976e02b3019a8db41d573c8d55e1cbca6158d15 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Wed, 27 May 2026 15:59:02 -0600 Subject: [PATCH 88/93] revert --- Mathlib/Order/DirSupClosed.lean | 2 +- Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Mathlib/Order/DirSupClosed.lean b/Mathlib/Order/DirSupClosed.lean index b7387615ef9c46..ead09bf1ac225a 100644 --- a/Mathlib/Order/DirSupClosed.lean +++ b/Mathlib/Order/DirSupClosed.lean @@ -288,7 +288,7 @@ lemma dirSupInaccOn_Iic (a : α) : DirSupInaccOn D (Iic a) := end Preorder -section PartialOrder +namespace PartialOrder variable [PartialOrder α] theorem dirSupClosed_singleton (a : α) : DirSupClosed {a} := by diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean index 91aa876065031e..19beb23372c63a 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Ordinal.lean @@ -151,8 +151,7 @@ theorem cof_omega0 : cof ω = ℵ₀ := @[deprecated (since := "2026-02-18")] alias cof_eq_one_iff_is_succ := cof_eq_one_iff -variable (α) in -theorem exists_ord_cof_eq [LinearOrder α] [WellFoundedLT α] : +theorem exists_ord_cof_eq (α : Type*) [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 @@ -169,9 +168,8 @@ theorem exists_ord_cof_eq [LinearOrder α] [WellFoundedLT α] : @[deprecated (since := "2026-05-25")] alias ord_cof_eq := exists_ord_cof_eq -variable (α) in @[simp] -theorem _root_.Order.cof_ord_cof [LinearOrder α] [WellFoundedLT α] : +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] From 19e586a5366ec4e61cb2cac0d29370052402a5dc Mon Sep 17 00:00:00 2001 From: vihdzp Date: Wed, 27 May 2026 16:01:00 -0600 Subject: [PATCH 89/93] minimize --- Mathlib/SetTheory/Ordinal/Basic.lean | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Mathlib/SetTheory/Ordinal/Basic.lean b/Mathlib/SetTheory/Ordinal/Basic.lean index 5cb0595d065873..d1576e5b9b62fd 100644 --- a/Mathlib/SetTheory/Ordinal/Basic.lean +++ b/Mathlib/SetTheory/Ordinal/Basic.lean @@ -169,10 +169,6 @@ theorem _root_.RelIso.ordinal_type_eq {α β} {r : α → α → Prop} {s : β [IsWellOrder β s] (h : r ≃r s) : type r = type s := type_eq.2 ⟨h⟩ -theorem _root_.OrderIso.ordinal_type_eq {α β} [LinearOrder α] [LinearOrder β] - [WellFoundedLT α] [WellFoundedLT β] (h : α ≃o β) : typeLT α = typeLT β := - h.toRelIsoLT.ordinal_type_eq - theorem type_eq_zero_of_empty (r) [IsWellOrder α r] [IsEmpty α] : type r = 0 := (RelIso.relIsoOfIsEmpty r _).ordinal_type_eq From b6aff06cdf6202583981802b02b00f34d773b7f3 Mon Sep 17 00:00:00 2001 From: vihdzp Date: Sun, 21 Jun 2026 18:45:45 -0600 Subject: [PATCH 90/93] fix merge --- Mathlib/SetTheory/Cardinal/Cofinality/Club.lean | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean index 5f6e98e7cc29c4..25262111667598 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean @@ -134,7 +134,7 @@ theorem sInter_of_countable {s : Set (Set α)} (hα : cof α ≠ ℵ₀) (hsα : (hs : ∀ x ∈ s, IsClub x) : IsClub (⋂₀ s) := by obtain hα | hα := hα.lt_or_gt · apply IsClub.sInter_of_cof_le_one _ hs - rwa [← cof_lt_aleph0_iff] + rwa [← Order.cof_lt_aleph0_iff] · apply IsClub.sInter hα.ne' (hα.trans_le' _) hs rwa [le_aleph0_iff_set_countable] @@ -241,10 +241,6 @@ theorem not_isStationary_empty : ¬ IsStationary (∅ : Set α) := by intro h simpa using h .univ -theorem IsClub.isStationary [Nonempty α] [WellFoundedLT α] (hα : cof α ≠ ℵ₀) (hs : IsClub s) : - IsStationary s := - fun _ ht ↦ (hs.inter hα ht).nonempty - @[simp] theorem not_isStationary_of_isEmpty [IsEmpty α] : ¬ IsStationary s := s.eq_empty_of_isEmpty ▸ not_isStationary_empty @@ -312,7 +308,7 @@ theorem isStationary_sUnion_iff_of_countable {s : Set (Set α)} (hα : cof α (hsα : s.Countable) : IsStationary (⋃₀ s) ↔ ∃ x ∈ s, IsStationary x := by obtain hα | hα := hα.lt_or_gt · apply isStationary_sUnion_iff_of_cof_le_one - rwa [← cof_lt_aleph0_iff] + rwa [← Order.cof_lt_aleph0_iff] · apply isStationary_sUnion_iff hα.ne' (hα.trans_le' _) rwa [le_aleph0_iff_set_countable] From b82840f006907bfef5e9d2a128c6874e759b796b Mon Sep 17 00:00:00 2001 From: vihdzp Date: Sun, 21 Jun 2026 18:46:19 -0600 Subject: [PATCH 91/93] style --- Mathlib/SetTheory/Cardinal/Cofinality/Club.lean | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean index 25262111667598..c29cf6f8d27311 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean @@ -188,7 +188,8 @@ protected theorem diag [IsRegularCardinalOrder α] {f : α → Set α} (hα : co rw [Nat.lt_add_one_iff] at hm simp_rw [Set.sInter_image, Set.mem_iInter] at hg exact (hg _).1 _ (hb.trans_le <| hgm.monotone hm) - · use g^[n + 1] a; simp [- Function.iterate_succ] + · use g^[n + 1] a + simp [- Function.iterate_succ] theorem _root_.Order.IsNormal.isClub_range {f : α → α} (hf : IsNormal f) : IsClub (.range f) := ⟨hf.dirSupClosed_range, fun x ↦ ⟨_, ⟨x, rfl⟩, hf.strictMono.le_apply⟩⟩ From 7c639dcede726fbf213e64642adaaf4f8a63a198 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Violeta=20Hern=C3=A1ndez=20Palacios?= Date: Mon, 22 Jun 2026 08:59:45 -0600 Subject: [PATCH 92/93] wikidata MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Yaël Dillies --- Mathlib/SetTheory/Cardinal/Cofinality/Club.lean | 1 + 1 file changed, 1 insertion(+) diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean index c29cf6f8d27311..41ee7ebc49ed81 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean @@ -325,6 +325,7 @@ theorem isStationary_union_iff (hα : cof α ≠ ℵ₀) : /-- **Fodor's lemma**, or the **pressing down lemma**: if `α` has the order type of a regular cardinal, `s` is a stationary set, and `f : α → α` is a regressive function on `s`, there exists some stationary subset of `s` which is constant on `f`. -/ +@[wikidata Q1119050] theorem exists_isStationary_preimage_singleton [IsRegularCardinalOrder α] {f : α → α} (hα : cof α ≠ ℵ₀) (hs : IsStationary s) (hf : ∀ x ∈ s, f x < x) : ∃ a, IsStationary (s ∩ f ⁻¹' {a}) := by From 8319de3ea32a10428dc696ad458affd8eb66e2b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Violeta=20Hern=C3=A1ndez=20Palacios?= Date: Mon, 22 Jun 2026 09:00:04 -0600 Subject: [PATCH 93/93] Update wording MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Yaël Dillies --- Mathlib/SetTheory/Cardinal/Cofinality/Club.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean index 41ee7ebc49ed81..8ebcec01c01991 100644 --- a/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean +++ b/Mathlib/SetTheory/Cardinal/Cofinality/Club.lean @@ -324,7 +324,7 @@ theorem isStationary_union_iff (hα : cof α ≠ ℵ₀) : /-- **Fodor's lemma**, or the **pressing down lemma**: if `α` has the order type of a regular cardinal, `s` is a stationary set, and `f : α → α` is a regressive function on `s`, there exists -some stationary subset of `s` which is constant on `f`. -/ +some stationary subset of `s` on which `f` is constant. -/ @[wikidata Q1119050] theorem exists_isStationary_preimage_singleton [IsRegularCardinalOrder α] {f : α → α} (hα : cof α ≠ ℵ₀) (hs : IsStationary s) (hf : ∀ x ∈ s, f x < x) :