|
| 1 | +/- |
| 2 | +Copyright (c) 2024 Eric Wieser. All rights reserved. |
| 3 | +Released under Apache 2.0 license as described in the file LICENSE. |
| 4 | +Authors: Eric Wieser, Daniel Weber |
| 5 | +-/ |
| 6 | +import Mathlib.Data.Finsupp.Fintype |
| 7 | +import Mathlib.GroupTheory.FreeAbelianGroupFinsupp |
| 8 | +import Mathlib.RingTheory.FreeCommRing |
| 9 | +import Mathlib.SetTheory.Cardinal.Arithmetic |
| 10 | +import Mathlib.SetTheory.Cardinal.Finsupp |
| 11 | + |
| 12 | +/-! |
| 13 | +# Cardinalities of free constructions |
| 14 | +
|
| 15 | +This file shows that all the free constructions over `α` have cardinality `max #α ℵ₀`, |
| 16 | +and are thus infinite. |
| 17 | +
|
| 18 | +Combined with the ring `Fin n` for the finite cases, this lets us show that there is a `CommRing` of |
| 19 | +any cardinality. |
| 20 | +-/ |
| 21 | + |
| 22 | +universe u |
| 23 | +variable (α : Type u) |
| 24 | + |
| 25 | +section Infinite |
| 26 | + |
| 27 | +@[to_additive] |
| 28 | +instance [Nonempty α] : Infinite (FreeMonoid α) := inferInstanceAs <| Infinite (List α) |
| 29 | + |
| 30 | +@[to_additive] |
| 31 | +instance [Nonempty α] : Infinite (FreeGroup α) := by |
| 32 | + classical |
| 33 | + exact Infinite.of_surjective FreeGroup.norm FreeGroup.norm_surjective |
| 34 | + |
| 35 | +instance [Nonempty α] : Infinite (FreeAbelianGroup α) := |
| 36 | + (FreeAbelianGroup.equivFinsupp α).toEquiv.infinite_iff.2 inferInstance |
| 37 | + |
| 38 | +instance : Infinite (FreeRing α) := by unfold FreeRing; infer_instance |
| 39 | + |
| 40 | +instance : Infinite (FreeCommRing α) := by unfold FreeCommRing; infer_instance |
| 41 | + |
| 42 | +end Infinite |
| 43 | + |
| 44 | +namespace Cardinal |
| 45 | + |
| 46 | +theorem mk_abelianization_le (G : Type u) [Group G] : |
| 47 | + #(Abelianization G) ≤ #G := Cardinal.mk_le_of_surjective <| surjective_quotient_mk _ |
| 48 | + |
| 49 | +@[to_additive (attr := simp)] |
| 50 | +theorem mk_freeMonoid [Nonempty α] : #(FreeMonoid α) = max #α ℵ₀ := |
| 51 | + Cardinal.mk_list_eq_max_mk_aleph0 _ |
| 52 | + |
| 53 | +@[to_additive (attr := simp)] |
| 54 | +theorem mk_freeGroup [Nonempty α] : #(FreeGroup α) = max #α ℵ₀ := by |
| 55 | + classical |
| 56 | + apply le_antisymm |
| 57 | + · apply (mk_le_of_injective (FreeGroup.toWord_injective (α := α))).trans_eq |
| 58 | + simp [Cardinal.mk_list_eq_max_mk_aleph0] |
| 59 | + obtain hα | hα := lt_or_le #α ℵ₀ |
| 60 | + · simp only [hα.le, max_eq_right, max_eq_right_iff] |
| 61 | + exact (mul_lt_aleph0 hα (nat_lt_aleph0 2)).le |
| 62 | + · rw [max_eq_left hα, max_eq_left (hα.trans <| Cardinal.le_mul_right two_ne_zero), |
| 63 | + Cardinal.mul_eq_left hα _ (by simp)] |
| 64 | + exact (nat_lt_aleph0 2).le.trans hα |
| 65 | + · apply max_le |
| 66 | + · exact mk_le_of_injective FreeGroup.of_injective |
| 67 | + · simp |
| 68 | + |
| 69 | +@[simp] |
| 70 | +theorem mk_freeAbelianGroup [Nonempty α] : #(FreeAbelianGroup α) = max #α ℵ₀ := by |
| 71 | + rw [Cardinal.mk_congr (FreeAbelianGroup.equivFinsupp α).toEquiv] |
| 72 | + simp |
| 73 | + |
| 74 | +@[simp] |
| 75 | +theorem mk_freeRing : #(FreeRing α) = max #α ℵ₀ := by |
| 76 | + cases isEmpty_or_nonempty α <;> simp [FreeRing] |
| 77 | + |
| 78 | +@[simp] |
| 79 | +theorem mk_freeCommRing : #(FreeCommRing α) = max #α ℵ₀ := by |
| 80 | + cases isEmpty_or_nonempty α <;> simp [FreeCommRing] |
| 81 | + |
| 82 | +end Cardinal |
| 83 | + |
| 84 | +section Nonempty |
| 85 | + |
| 86 | +/-- A commutative ring can be constructed on any non-empty type. |
| 87 | +
|
| 88 | +See also `Infinite.nonempty_field`. -/ |
| 89 | +instance nonempty_commRing [Nonempty α] : Nonempty (CommRing α) := by |
| 90 | + obtain hR | hR := finite_or_infinite α |
| 91 | + · obtain ⟨x⟩ := nonempty_fintype α |
| 92 | + have : NeZero (Fintype.card α) := ⟨by inhabit α; simp⟩ |
| 93 | + classical |
| 94 | + obtain ⟨e⟩ := Fintype.truncEquivFin α |
| 95 | + exact ⟨e.commRing⟩ |
| 96 | + · have ⟨e⟩ : Nonempty (α ≃ FreeCommRing α) := by simp [← Cardinal.eq] |
| 97 | + exact ⟨e.commRing⟩ |
| 98 | + |
| 99 | +@[simp] |
| 100 | +theorem nonempty_commRing_iff : Nonempty (CommRing α) ↔ Nonempty α := |
| 101 | + ⟨Nonempty.map (·.zero), fun _ => nonempty_commRing _⟩ |
| 102 | + |
| 103 | +@[simp] |
| 104 | +theorem nonempty_ring_iff : Nonempty (Ring α) ↔ Nonempty α := |
| 105 | + ⟨Nonempty.map (·.zero), fun _ => (nonempty_commRing _).map (·.toRing)⟩ |
| 106 | + |
| 107 | +@[simp] |
| 108 | +theorem nonempty_commSemiring_iff : Nonempty (CommSemiring α) ↔ Nonempty α := |
| 109 | + ⟨Nonempty.map (·.zero), fun _ => (nonempty_commRing _).map (·.toCommSemiring)⟩ |
| 110 | + |
| 111 | +@[simp] |
| 112 | +theorem nonempty_semiring_iff : Nonempty (Semiring α) ↔ Nonempty α := |
| 113 | + ⟨Nonempty.map (·.zero), fun _ => (nonempty_commRing _).map (·.toSemiring)⟩ |
| 114 | + |
| 115 | +end Nonempty |
0 commit comments