diff --git a/Mathlib/SetTheory/Cardinal/Arithmetic.lean b/Mathlib/SetTheory/Cardinal/Arithmetic.lean index f395995bfa4c9f..011413e30fd534 100644 --- a/Mathlib/SetTheory/Cardinal/Arithmetic.lean +++ b/Mathlib/SetTheory/Cardinal/Arithmetic.lean @@ -664,19 +664,31 @@ theorem mk_list_eq_mk (α : Type u) [Infinite α] : #(List α) = #α := theorem mk_list_eq_aleph0 (α : Type u) [Countable α] [Nonempty α] : #(List α) = ℵ₀ := mk_le_aleph0.antisymm (aleph0_le_mk _) -theorem mk_list_eq_max_mk_aleph0 (α : Type u) [Nonempty α] : #(List α) = max #α ℵ₀ := by +theorem mk_list_eq_max (α : Type u) [Nonempty α] : #(List α) = max ℵ₀ #α := by cases finite_or_infinite α - · rw [mk_list_eq_aleph0, eq_comm, max_eq_right] + · rw [mk_list_eq_aleph0, eq_comm, max_eq_left] exact mk_le_aleph0 - · rw [mk_list_eq_mk, eq_comm, max_eq_left] + · rw [mk_list_eq_mk, eq_comm, max_eq_right] exact aleph0_le_mk α +-- TODO: standardize whether we write `max ℵ₀ x` or `max x ℵ₀`. +theorem mk_list_eq_max_mk_aleph0 (α : Type u) [Nonempty α] : #(List α) = max #α ℵ₀ := by + rw [mk_list_eq_max, max_comm] + +theorem sum_pow_eq_max_aleph0 {x : Cardinal} (h : x ≠ 0) : sum (fun n ↦ x ^ n) = max ℵ₀ x := by + have := nonempty_out h + conv_lhs => rw [← x.mk_out, ← mk_list_eq_sum_pow, mk_list_eq_max, mk_out] + theorem mk_list_le_max (α : Type u) : #(List α) ≤ max ℵ₀ #α := by cases finite_or_infinite α · exact mk_le_aleph0.trans (le_max_left _ _) · rw [mk_list_eq_mk] apply le_max_right +theorem sum_pow_le_max_aleph0 (x : Cardinal) : sum (fun n ↦ x ^ n) ≤ max ℵ₀ x := by + rw [← x.mk_out, ← mk_list_eq_sum_pow] + exact mk_list_le_max _ + @[simp] theorem mk_finset_of_infinite (α : Type u) [Infinite α] : #(Finset α) = #α := by classical diff --git a/Mathlib/SetTheory/Cardinal/Basic.lean b/Mathlib/SetTheory/Cardinal/Basic.lean index cdf23d93409345..18c0460d367de7 100644 --- a/Mathlib/SetTheory/Cardinal/Basic.lean +++ b/Mathlib/SetTheory/Cardinal/Basic.lean @@ -615,10 +615,13 @@ theorem mk_singleton {α : Type u} (x : α) : #({x} : Set α) = 1 := theorem mk_vector (α : Type u) (n : ℕ) : #(List.Vector α n) = #α ^ n := (mk_congr (Equiv.vectorEquivFin α n)).trans <| by simp -theorem mk_list_eq_sum_pow (α : Type u) : #(List α) = sum fun n : ℕ => #α ^ n := +theorem mk_list_eq_sum_pow (α : Type u) : #(List α) = sum fun n ↦ #α ^ n := calc #(List α) = #(Σ n, List.Vector α n) := mk_congr (Equiv.sigmaFiberEquiv List.length).symm - _ = sum fun n : ℕ => #α ^ n := by simp + _ = sum fun n ↦ #α ^ n := by simp + +theorem sum_zero_pow : sum (fun n ↦ (0 : Cardinal) ^ n) = 1 := by + rw [← mk_eq_zero (α := PEmpty), ← mk_list_eq_sum_pow, mk_eq_one] theorem mk_quot_le {α : Type u} {r : α → α → Prop} : #(Quot r) ≤ #α := mk_le_of_surjective Quot.exists_rep diff --git a/Mathlib/SetTheory/Cardinal/Defs.lean b/Mathlib/SetTheory/Cardinal/Defs.lean index d192b5ad747c23..21f56a50ca7443 100644 --- a/Mathlib/SetTheory/Cardinal/Defs.lean +++ b/Mathlib/SetTheory/Cardinal/Defs.lean @@ -229,6 +229,9 @@ theorem mk_ne_zero_iff {α : Type u} : #α ≠ 0 ↔ Nonempty α := theorem mk_ne_zero (α : Type u) [Nonempty α] : #α ≠ 0 := mk_ne_zero_iff.2 ‹_› +theorem nonempty_out {x : Cardinal} (h : x ≠ 0) : Nonempty x.out := by + rwa [← mk_ne_zero_iff, mk_out] + instance : One Cardinal.{u} := -- `PUnit` might be more canonical, but this is convenient for defeq with natCast ⟨lift #(Fin 1)⟩