Skip to content

Commit

Permalink
chore(SetTheory/Cardinal/Basic): Cardinal.IsLimitIsSuccLimit (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
vihdzp committed Sep 18, 2024
1 parent 5b61ee9 commit c5befd4
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 22 deletions.
71 changes: 59 additions & 12 deletions Mathlib/SetTheory/Cardinal/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -710,29 +710,44 @@ theorem add_one_le_succ (c : Cardinal.{u}) : c + 1 ≤ succ c := by

/-- A cardinal is a limit if it is not zero or a successor cardinal. Note that `ℵ₀` is a limit
cardinal by this definition, but `0` isn't.
TODO: deprecate this in favor of `Order.IsSuccLimit`. -/
Deprecated. Use `Order.IsSuccLimit` instead. -/
@[deprecated IsSuccLimit (since := "2024-09-17")]
def IsLimit (c : Cardinal) : Prop :=
c ≠ 0 ∧ IsSuccPrelimit c

protected theorem IsLimit.ne_zero {c} (h : IsLimit c) : c ≠ 0 :=
h.1
theorem ne_zero_of_isSuccLimit {c} (h : IsSuccLimit c) : c ≠ 0 :=
h.ne_bot

theorem isSuccPrelimit_zero : IsSuccPrelimit (0 : Cardinal) :=
isSuccPrelimit_bot

protected theorem isSuccLimit_iff {c : Cardinal} : IsSuccLimit c ↔ c ≠ 0 ∧ IsSuccPrelimit c :=
isSuccLimit_iff

section deprecated

set_option linter.deprecated false

@[deprecated IsSuccLimit.isSuccPrelimit (since := "2024-09-17")]
protected theorem IsLimit.isSuccPrelimit {c} (h : IsLimit c) : IsSuccPrelimit c :=
h.2

@[deprecated ne_zero_of_isSuccLimit (since := "2024-09-17")]
protected theorem IsLimit.ne_zero {c} (h : IsLimit c) : c ≠ 0 :=
h.1

@[deprecated IsLimit.isSuccPrelimit (since := "2024-09-05")]
alias IsLimit.isSuccLimit := IsLimit.isSuccPrelimit

@[deprecated IsSuccLimit.succ_lt (since := "2024-09-17")]
theorem IsLimit.succ_lt {x c} (h : IsLimit c) : x < c → succ x < c :=
h.isSuccPrelimit.succ_lt

theorem isSuccPrelimit_zero : IsSuccPrelimit (0 : Cardinal) :=
isSuccPrelimit_bot

@[deprecated isSuccPrelimit_zero (since := "2024-09-05")]
alias isSuccLimit_zero := isSuccPrelimit_zero

end deprecated

/-- The indexed sum of cardinals is the cardinality of the
indexed disjoint union, i.e. sigma type. -/
def sum {ι} (f : ι → Cardinal) : Cardinal :=
Expand Down Expand Up @@ -882,9 +897,19 @@ lemma exists_eq_of_iSup_eq_of_not_isSuccPrelimit
rw [iSup, csSup_of_not_bddAbove hf, csSup_empty]
exact isSuccPrelimit_bot

@[deprecated exists_eq_of_iSup_eq_of_not_isSuccPrelimit (since := "2024-09-05")]
alias exists_eq_of_iSup_eq_of_not_isSuccLimit := exists_eq_of_iSup_eq_of_not_isSuccPrelimit
lemma exists_eq_of_iSup_eq_of_not_isSuccLimit
{ι : Type u} [hι : Nonempty ι] (f : ι → Cardinal.{v}) (hf : BddAbove (range f))
{c : Cardinal.{v}} (hc : ¬ IsSuccLimit c)
(h : ⨆ i, f i = c) : ∃ i, f i = c := by
rw [Cardinal.isSuccLimit_iff] at hc
refine (not_and_or.mp hc).elim (fun e ↦ ⟨hι.some, ?_⟩)
(Cardinal.exists_eq_of_iSup_eq_of_not_isSuccPrelimit.{u, v} f c · h)
cases not_not.mp e
rw [← le_zero_iff] at h ⊢
exact (le_ciSup hf _).trans h

set_option linter.deprecated false in
@[deprecated exists_eq_of_iSup_eq_of_not_isSuccLimit (since := "2024-09-17")]
lemma exists_eq_of_iSup_eq_of_not_isLimit
{ι : Type u} [hι : Nonempty ι] (f : ι → Cardinal.{v}) (hf : BddAbove (range f))
(ω : Cardinal.{v}) (hω : ¬ ω.IsLimit)
Expand Down Expand Up @@ -1354,24 +1379,46 @@ theorem isSuccPrelimit_aleph0 : IsSuccPrelimit ℵ₀ :=
rw [← nat_succ]
apply nat_lt_aleph0

@[deprecated isSuccPrelimit_aleph0 (since := "2024-09-05")]
alias isSuccLimit_aleph0 := isSuccPrelimit_aleph0
theorem isSuccLimit_aleph0 : IsSuccLimit ℵ₀ := by
rw [Cardinal.isSuccLimit_iff]
exact ⟨aleph0_ne_zero, isSuccPrelimit_aleph0⟩

lemma not_isSuccLimit_natCast : (n : ℕ) → ¬ IsSuccLimit (n : Cardinal.{u})
| 0, e => e.1 isMin_bot
| Nat.succ n, e => Order.not_isSuccPrelimit_succ _ (nat_succ n ▸ e.2)

theorem not_isSuccLimit_of_lt_aleph0 {c : Cardinal} (h : c < ℵ₀) : ¬ IsSuccLimit c := by
obtain ⟨n, rfl⟩ := lt_aleph0.1 h
exact not_isSuccLimit_natCast n

theorem aleph0_le_of_isSuccLimit {c : Cardinal} (h : IsSuccLimit c) : ℵ₀ ≤ c := by
contrapose! h
exact not_isSuccLimit_of_lt_aleph0 h

section deprecated

set_option linter.deprecated false

@[deprecated isSuccLimit_aleph0 (since := "2024-09-17")]
theorem isLimit_aleph0 : IsLimit ℵ₀ :=
⟨aleph0_ne_zero, isSuccPrelimit_aleph0⟩

@[deprecated not_isSuccLimit_natCast (since := "2024-09-17")]
lemma not_isLimit_natCast : (n : ℕ) → ¬ IsLimit (n : Cardinal.{u})
| 0, e => e.1 rfl
| Nat.succ n, e => Order.not_isSuccPrelimit_succ _ (nat_succ n ▸ e.2)

@[deprecated aleph0_le_of_isSuccLimit (since := "2024-09-17")]
theorem IsLimit.aleph0_le {c : Cardinal} (h : IsLimit c) : ℵ₀ ≤ c := by
by_contra! h'
rcases lt_aleph0.1 h' with ⟨n, rfl⟩
exact not_isLimit_natCast n h

end deprecated

lemma exists_eq_natCast_of_iSup_eq {ι : Type u} [Nonempty ι] (f : ι → Cardinal.{v})
(hf : BddAbove (range f)) (n : ℕ) (h : ⨆ i, f i = n) : ∃ i, f i = n :=
exists_eq_of_iSup_eq_of_not_isLimit.{u, v} f hf _ (not_isLimit_natCast n) h
exists_eq_of_iSup_eq_of_not_isSuccLimit.{u, v} f hf (not_isSuccLimit_natCast n) h

@[simp]
theorem range_natCast : range ((↑) : ℕ → Cardinal) = Iio ℵ₀ :=
Expand Down
17 changes: 12 additions & 5 deletions Mathlib/SetTheory/Cardinal/Cofinality.lean
Original file line number Diff line number Diff line change
Expand Up @@ -806,12 +806,19 @@ theorem isStrongLimit_aleph0 : IsStrongLimit ℵ₀ :=
rcases lt_aleph0.1 hx with ⟨n, rfl⟩
exact mod_cast nat_lt_aleph0 (2 ^ n)⟩

protected theorem IsStrongLimit.isSuccLimit {c} (H : IsStrongLimit c) : IsSuccLimit c := by
rw [Cardinal.isSuccLimit_iff]
exact ⟨H.ne_zero, isSuccPrelimit_of_succ_lt fun x h =>
(succ_le_of_lt <| cantor x).trans_lt (H.two_power_lt h)⟩

protected theorem IsStrongLimit.isSuccPrelimit {c} (H : IsStrongLimit c) : IsSuccPrelimit c :=
isSuccPrelimit_of_succ_lt fun x h => (succ_le_of_lt <| cantor x).trans_lt (H.two_power_lt h)
H.isSuccLimit.isSuccPrelimit

@[deprecated IsStrongLimit.isSuccPrelimit (since := "2024-09-05")]
alias IsStrongLimit.isSuccLimit := IsStrongLimit.isSuccPrelimit
theorem IsStrongLimit.aleph0_le {c} (H : IsStrongLimit c) : ℵ₀ ≤ c :=
aleph0_le_of_isSuccLimit H.isSuccLimit

set_option linter.deprecated false in
@[deprecated IsStrongLimit.isSuccLimit (since := "2024-09-17")]
theorem IsStrongLimit.isLimit {c} (H : IsStrongLimit c) : IsLimit c :=
⟨H.ne_zero, H.isSuccPrelimit⟩

Expand All @@ -836,7 +843,7 @@ theorem mk_bounded_subset {α : Type*} (h : ∀ x < #α, (2^x) < #α) {r : α
rintro ⟨s, hs⟩
exact (not_unbounded_iff s).2 hs (unbounded_of_isEmpty s)
have h' : IsStrongLimit #α := ⟨ha, h⟩
have ha := h'.isLimit.aleph0_le
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]
Expand Down Expand Up @@ -871,7 +878,7 @@ theorem mk_subset_mk_lt_cof {α : Type*} (h : ∀ x < #α, (2^x) < #α) :
exact lt_cof_type hs
· refine @mk_le_of_injective α _ (fun x => Subtype.mk {x} ?_) ?_
· rw [mk_singleton]
exact one_lt_aleph0.trans_le (aleph0_le_cof.2 (ord_isLimit h'.isLimit.aleph0_le))
exact one_lt_aleph0.trans_le (aleph0_le_cof.2 (ord_isLimit h'.aleph0_le))
· intro a b hab
simpa [singleton_eq_singleton_iff] using hab

Expand Down
10 changes: 5 additions & 5 deletions Mathlib/SetTheory/Cardinal/Ordinal.lean
Original file line number Diff line number Diff line change
Expand Up @@ -783,8 +783,8 @@ protected theorem ciSup_add (hf : BddAbove (range f)) (c : Cardinal.{v}) :
refine le_antisymm ?_ (ciSup_le' this)
have bdd : BddAbove (range (f · + c)) := ⟨_, forall_mem_range.mpr this⟩
obtain hs | hs := lt_or_le (⨆ i, f i) ℵ₀
· obtain ⟨i, hi⟩ := exists_eq_of_iSup_eq_of_not_isLimit
f hf _ (fun h ↦ hs.not_le h.aleph0_le) rfl
· obtain ⟨i, hi⟩ := exists_eq_of_iSup_eq_of_not_isSuccLimit
f hf (not_isSuccLimit_of_lt_aleph0 hs) rfl
exact hi ▸ le_ciSup bdd i
rw [add_eq_max hs, max_le_iff]
exact ⟨ciSup_mono bdd fun i ↦ self_le_add_right _ c,
Expand Down Expand Up @@ -812,8 +812,8 @@ protected theorem ciSup_mul (c : Cardinal.{v}) : (⨆ i, f i) * c = ⨆ i, f i *
refine le_antisymm ?_ (ciSup_le' this)
have bdd : BddAbove (range (f · * c)) := ⟨_, forall_mem_range.mpr this⟩
obtain hs | hs := lt_or_le (⨆ i, f i) ℵ₀
· obtain ⟨i, hi⟩ := exists_eq_of_iSup_eq_of_not_isLimit
f hf _ (fun h ↦ hs.not_le h.aleph0_le) rfl
· obtain ⟨i, hi⟩ := exists_eq_of_iSup_eq_of_not_isSuccLimit
f hf (not_isSuccLimit_of_lt_aleph0 hs) rfl
exact hi ▸ le_ciSup bdd i
rw [mul_eq_max_of_aleph0_le_left hs h0, max_le_iff]
obtain ⟨i, hi⟩ := exists_lt_of_lt_ciSup' (one_lt_aleph0.trans_le hs)
Expand Down Expand Up @@ -852,7 +852,7 @@ theorem add_nat_inj {α β : Cardinal} (n : ℕ) : α + n = β + n ↔ α = β :
theorem add_one_inj {α β : Cardinal} : α + 1 = β + 1 ↔ α = β :=
add_right_inj_of_lt_aleph0 one_lt_aleph0

theorem add_le_add_iff_of_lt_aleph0 {α β γ : Cardinal} (γ₀ : γ < Cardinal.aleph0) :
theorem add_le_add_iff_of_lt_aleph0 {α β γ : Cardinal} (γ₀ : γ < ℵ₀) :
α + γ ≤ β + γ ↔ α ≤ β := by
refine ⟨fun h => ?_, fun h => add_le_add_right h γ⟩
contrapose h
Expand Down

0 comments on commit c5befd4

Please sign in to comment.