|
| 1 | +/- |
| 2 | +Copyright (c) 2026 Joël Riou. All rights reserved. |
| 3 | +Released under Apache 2.0 license as described in the file LICENSE. |
| 4 | +Authors: Joël Riou |
| 5 | +-/ |
| 6 | +module |
| 7 | + |
| 8 | +public import Mathlib.CategoryTheory.Monoidal.Cartesian.Grp_ |
| 9 | +public import Mathlib.Algebra.Ring.Basic |
| 10 | + |
| 11 | +/-! |
| 12 | +# Ring objects in cartesian monoidal categories |
| 13 | +
|
| 14 | +If `C` is a cartesian monoidal category and `X : C`, we introduce a typeclass `RingObj X` |
| 15 | +which says that `X` is a ring object: it has a commutative additive group structure and |
| 16 | +a multiplicative monoid structure that is distributive over the additive structure. |
| 17 | +We also introduce a typeclass `CommRingObj X` which further requires that the multiplicative |
| 18 | +law is commutative. |
| 19 | +
|
| 20 | +The categories of bundled ring objects and bundled commutative ring objects are |
| 21 | +denoted `RingObjCat C` and `CommRingObjCat C` respectively. |
| 22 | +
|
| 23 | +## TODO |
| 24 | +* develop the theory of bimonoidal categories and relate this with `Rig`-objects |
| 25 | +
|
| 26 | +-/ |
| 27 | + |
| 28 | +@[expose] public section |
| 29 | + |
| 30 | +universe v u |
| 31 | + |
| 32 | +namespace CategoryTheory |
| 33 | + |
| 34 | +open MonoidalCategory CartesianMonoidalCategory |
| 35 | + |
| 36 | +variable {C : Type u} [Category.{v} C] [CartesianMonoidalCategory C] |
| 37 | + |
| 38 | +open scoped MonObj AddMonObj |
| 39 | + |
| 40 | +lemma mul_add_iff (R : C) [MonObj R] [AddMonObj R] : |
| 41 | + R ◁ σ ≫ μ = lift ((R ◁ fst _ _) ≫ μ) ((R ◁ snd _ _) ≫ μ) ≫ σ ↔ |
| 42 | + ∀ ⦃X : C⦄ (a b c : X ⟶ R), a * (b + c) = a * b + a * c := by |
| 43 | + refine ⟨fun h _ a b c ↦ ?_, fun h ↦ ?_⟩ |
| 44 | + · have := lift a (lift b c) ≫= h |
| 45 | + simp only [lift_whiskerLeft_assoc] at this |
| 46 | + simp only [Hom.add_def, Hom.mul_def, this, ← Category.assoc] |
| 47 | + cat_disch |
| 48 | + · replace h := h (fst R (R ⊗ R)) (snd _ _ ≫ fst _ _) (snd _ _ ≫ snd _ _) |
| 49 | + simp only [Hom.mul_def, Hom.add_def] at h |
| 50 | + convert h using 2 |
| 51 | + · cat_disch |
| 52 | + · ext |
| 53 | + · simp only [lift_fst] |
| 54 | + congr 1 |
| 55 | + cat_disch |
| 56 | + · simp only [lift_snd] |
| 57 | + congr 1 |
| 58 | + cat_disch |
| 59 | + |
| 60 | +lemma add_mul_iff (R : C) [MonObj R] [AddMonObj R] : |
| 61 | + σ ▷ R ≫ μ = lift (fst _ _ ▷ _ ≫ μ) (snd _ _ ▷ _ ≫ μ) ≫ σ ↔ |
| 62 | + ∀ ⦃X : C⦄ (a b c : X ⟶ R), (a + b) * c = a * c + b * c := by |
| 63 | + refine ⟨fun h _ a b c ↦ ?_, fun h ↦ ?_⟩ |
| 64 | + · have := lift (lift a b) c ≫= h |
| 65 | + simp only [lift_whiskerRight_assoc] at this |
| 66 | + simp only [Hom.add_def, Hom.mul_def, this, ← Category.assoc] |
| 67 | + cat_disch |
| 68 | + · replace h := h (fst (R ⊗ R) R ≫ fst _ _) (fst _ _ ≫ snd _ _) (snd _ _) |
| 69 | + simp only [Hom.mul_def, Hom.add_def] at h |
| 70 | + convert h using 2 |
| 71 | + · cat_disch |
| 72 | + · ext |
| 73 | + · simp only [lift_fst] |
| 74 | + congr 1 |
| 75 | + cat_disch |
| 76 | + · simp only [lift_snd] |
| 77 | + congr 1 |
| 78 | + cat_disch |
| 79 | + |
| 80 | +variable [BraidedCategory C] |
| 81 | + |
| 82 | +/-- A ring object in a cartesian monoidal category is an object that is equipped |
| 83 | +with an additive group structure and a (multiplicative) monoid structure that |
| 84 | +is left and right distributive over the additive structure. -/ |
| 85 | +class RingObj (R : C) extends AddGrpObj R, IsCommAddMonObj R, MonObj R where |
| 86 | + mul_add (R) : R ◁ σ ≫ μ = lift ((R ◁ fst _ _) ≫ μ) ((R ◁ snd _ _) ≫ μ) ≫ σ |
| 87 | + add_mul (R) : σ ▷ R ≫ μ = lift (fst _ _ ▷ _ ≫ μ) (snd _ _ ▷ _ ≫ μ) ≫ σ |
| 88 | + |
| 89 | +section |
| 90 | + |
| 91 | +variable {R : C} [RingObj R] {X : C} |
| 92 | + |
| 93 | +lemma Hom.mul_add (a b c : X ⟶ R) : a * (b + c) = a * b + a * c := by |
| 94 | + revert X a b c |
| 95 | + rw [← mul_add_iff, RingObj.mul_add R] |
| 96 | + |
| 97 | +lemma Hom.add_mul (a b c : X ⟶ R) : (a + b) * c = a * c + b * c := by |
| 98 | + revert X a b c |
| 99 | + rw [← add_mul_iff, RingObj.add_mul R] |
| 100 | + |
| 101 | +/-- If `G` is a ring object, then `Hom(X, G)` has a ring structure. -/ |
| 102 | +abbrev Hom.ring {X : C} : Ring (X ⟶ R) where |
| 103 | + left_distrib := Hom.mul_add |
| 104 | + right_distrib := Hom.add_mul |
| 105 | + mul_zero a := by simpa using mul_add a 0 0 |
| 106 | + zero_mul a := by simpa using add_mul 0 0 a |
| 107 | + |
| 108 | +scoped[CategoryTheory.RingObj] attribute [instance] Hom.ring |
| 109 | + |
| 110 | +end |
| 111 | + |
| 112 | +open scoped RingObj |
| 113 | + |
| 114 | +/-- A commutative ring object in a cartesian monoidal category is a |
| 115 | +ring object such that the multiplicative law is commutative. -/ |
| 116 | +class CommRingObj (R : C) extends RingObj R, IsCommMonObj R where |
| 117 | + |
| 118 | +/-- If `G` is a commutative ring object, then `Hom(X, G)` has a commutative ring structure. -/ |
| 119 | +abbrev Hom.commRing {R : C} {X : C} [CommRingObj R] : CommRing (X ⟶ R) where |
| 120 | + |
| 121 | +scoped[CategoryTheory.CommRingObj] attribute [instance] Hom.commRing |
| 122 | + |
| 123 | +/-- The property that a morphism between ring objects is a ring morphism. -/ |
| 124 | +class IsRingHom {R₁ R₂ : C} [AddMonObj R₁] [AddMonObj R₂] [MonObj R₁] [MonObj R₂] (f : R₁ ⟶ R₂) |
| 125 | + extends IsAddMonHom f, IsMonHom f |
| 126 | + |
| 127 | +instance IsRingHom.id (R : C) [AddMonObj R] [MonObj R] : IsRingHom (𝟙 R) where |
| 128 | + |
| 129 | +instance IsRingHom.comp {R₁ R₂ R₃ : C} |
| 130 | + [AddMonObj R₁] [AddMonObj R₂] [AddMonObj R₃] |
| 131 | + [MonObj R₁] [MonObj R₂] [MonObj R₃] |
| 132 | + (f : R₁ ⟶ R₂) (g : R₂ ⟶ R₃) [IsRingHom f] [IsRingHom g] : |
| 133 | + IsRingHom (f ≫ g) where |
| 134 | + |
| 135 | +variable (C) in |
| 136 | +/-- The category of ring objects in a cartesian monoidal category. -/ |
| 137 | +structure RingObjCat where |
| 138 | + /-- The underlying object in the ambient monoidal category -/ |
| 139 | + X : C |
| 140 | + [ringObj : RingObj X] |
| 141 | + |
| 142 | +initialize_simps_projections RingObjCat (-ringObj) |
| 143 | + |
| 144 | +namespace RingObjCat |
| 145 | + |
| 146 | +attribute [instance] ringObj |
| 147 | + |
| 148 | +/-- A morphism of ring objects. -/ |
| 149 | +@[ext] |
| 150 | +structure Hom (R₁ R₂ : RingObjCat C) where |
| 151 | + /-- The underlying morphism -/ |
| 152 | + hom : R₁.X ⟶ R₂.X |
| 153 | + [isRingHom : IsRingHom hom] |
| 154 | + |
| 155 | +attribute [instance] Hom.isRingHom |
| 156 | + |
| 157 | +@[simps] |
| 158 | +instance : Category (RingObjCat C) where |
| 159 | + Hom R₁ R₂ := Hom R₁ R₂ |
| 160 | + id X := { hom := 𝟙 _ } |
| 161 | + comp f g := { hom := f.hom ≫ g.hom } |
| 162 | + |
| 163 | +@[ext] |
| 164 | +lemma hom_ext {R₁ R₂ : RingObjCat C} {f g : R₁ ⟶ R₂} (h : f.hom = g.hom) : f = g := |
| 165 | + Hom.ext h |
| 166 | + |
| 167 | +variable (C) in |
| 168 | +/-- The forgetful functor from the category of ring objects in `C` to `C`. -/ |
| 169 | +@[simps] |
| 170 | +def forget : RingObjCat C ⥤ C where |
| 171 | + obj R := R.X |
| 172 | + map f := f.hom |
| 173 | + |
| 174 | +instance : (forget C).Faithful where |
| 175 | + |
| 176 | +variable (C) in |
| 177 | +/-- The forgetful functor from the category of ring objects in `C` |
| 178 | +to the category of monoid objects in `C`. -/ |
| 179 | +@[simps] |
| 180 | +def forget₂Mon : RingObjCat C ⥤ Mon C where |
| 181 | + obj R := .mk R.X |
| 182 | + map f := .mk f.hom |
| 183 | + |
| 184 | +variable (C) in |
| 185 | +/-- The forgetful functor from the category of ring objects in `C` |
| 186 | +to the category of additive monoid objects in `C`. -/ |
| 187 | +@[simps] |
| 188 | +def forget₂AddMon : RingObjCat C ⥤ AddMon C where |
| 189 | + obj R := .mk R.X |
| 190 | + map f := .mk f.hom |
| 191 | + |
| 192 | +end RingObjCat |
| 193 | + |
| 194 | +variable (C) in |
| 195 | +/-- The category of commutative ring objects in a cartesian monoidal category. -/ |
| 196 | +structure CommRingObjCat where |
| 197 | + /-- The underlying object in the ambient monoidal category -/ |
| 198 | + X : C |
| 199 | + [commRingObj : CommRingObj X] |
| 200 | + |
| 201 | +initialize_simps_projections CommRingObjCat (-commRingObj) |
| 202 | + |
| 203 | +namespace CommRingObjCat |
| 204 | + |
| 205 | +attribute [instance] commRingObj |
| 206 | + |
| 207 | +/-- A morphism of commutative ring objects. -/ |
| 208 | +@[ext] |
| 209 | +structure Hom (R₁ R₂ : CommRingObjCat C) where |
| 210 | + /-- The underlying morphism -/ |
| 211 | + hom : R₁.X ⟶ R₂.X |
| 212 | + [isRingHom : IsRingHom hom] |
| 213 | + |
| 214 | +attribute [instance] Hom.isRingHom |
| 215 | + |
| 216 | +@[simps] |
| 217 | +instance : Category (CommRingObjCat C) where |
| 218 | + Hom R₁ R₂ := Hom R₁ R₂ |
| 219 | + id X := { hom := 𝟙 _ } |
| 220 | + comp f g := { hom := f.hom ≫ g.hom } |
| 221 | + |
| 222 | +@[ext] |
| 223 | +lemma hom_ext {R₁ R₂ : CommRingObjCat C} {f g : R₁ ⟶ R₂} (h : f.hom = g.hom) : f = g := |
| 224 | + Hom.ext h |
| 225 | + |
| 226 | +variable (C) in |
| 227 | +/-- The forgetful functor from the category of ring objects in `C` to `C`. -/ |
| 228 | +@[simps] |
| 229 | +def forget : CommRingObjCat C ⥤ C where |
| 230 | + obj R := R.X |
| 231 | + map f := f.hom |
| 232 | + |
| 233 | +variable (C) in |
| 234 | +/-- The forgetful functor from the category of commutative ring objects |
| 235 | +to the category of ring objects. -/ |
| 236 | +@[simps] |
| 237 | +def forget₂RingObjCat : CommRingObjCat C ⥤ RingObjCat C where |
| 238 | + obj R := .mk R.X |
| 239 | + map f := { hom := f.hom } |
| 240 | + |
| 241 | +variable (C) in |
| 242 | +/-- The forgetful functor `CommRingObjCat C ⥤ RingObjCat C` is fully faithful. -/ |
| 243 | +def fullyFaithfulForget₂RingObjCat : (forget₂RingObjCat C).FullyFaithful where |
| 244 | + preimage f := { hom := f.hom, isRingHom := f.isRingHom } |
| 245 | + |
| 246 | +instance : (forget₂RingObjCat C).Faithful := |
| 247 | + (fullyFaithfulForget₂RingObjCat C).faithful |
| 248 | + |
| 249 | +instance : (forget₂RingObjCat C).Full := |
| 250 | + (fullyFaithfulForget₂RingObjCat C).full |
| 251 | + |
| 252 | +instance : (forget C).Faithful where |
| 253 | + |
| 254 | +end CommRingObjCat |
| 255 | + |
| 256 | +end CategoryTheory |
0 commit comments