Skip to content

Commit 512e3e5

Browse files
committed
chore: rename private mk to of for some bundled categories (#31622)
In a few places we can replace `private mk` by `of` and save some lines. Whilst searching for this I also replaced a few non-private `mk` with `of` where possible.
1 parent f230ebb commit 512e3e5

File tree

20 files changed

+55
-101
lines changed

20 files changed

+55
-101
lines changed

Mathlib/Algebra/Category/BoolRing.lean

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ open CategoryTheory Order
2424

2525
/-- The category of Boolean rings. -/
2626
structure BoolRing where
27-
private mk ::
27+
/-- Construct a bundled `BoolRing` from a `BooleanRing`. -/
28+
of ::
2829
/-- The underlying type. -/
2930
carrier : Type u
3031
[booleanRing : BooleanRing carrier]
@@ -40,10 +41,6 @@ attribute [coe] carrier
4041

4142
attribute [instance] booleanRing
4243

43-
/-- Construct a bundled `BoolRing` from a `BooleanRing`. -/
44-
abbrev of (α : Type*) [BooleanRing α] : BoolRing :=
45-
⟨α⟩
46-
4744
theorem coe_of (α : Type*) [BooleanRing α] : ↥(of α) = α :=
4845
rfl
4946

Mathlib/Algebra/Category/GrpWithZero.lean

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ open CategoryTheory
2121

2222
/-- The category of groups with zero. -/
2323
structure GrpWithZero where
24+
/-- Construct a bundled `GrpWithZero` from a `GroupWithZero`. -/
25+
of ::
2426
/-- The underlying group with zero. -/
2527
carrier : Type*
2628
[str : GroupWithZero carrier]
@@ -32,10 +34,6 @@ namespace GrpWithZero
3234
instance : CoeSort GrpWithZero Type* :=
3335
⟨carrier⟩
3436

35-
/-- Construct a bundled `GrpWithZero` from a `GroupWithZero`. -/
36-
abbrev of (α : Type*) [GroupWithZero α] : GrpWithZero where
37-
carrier := α
38-
3937
instance : Inhabited GrpWithZero :=
4038
⟨of (WithZero PUnit)⟩
4139

Mathlib/Algebra/Category/HopfAlgCat/Basic.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ variable (R : Type u) [CommRing R]
2424

2525
/-- The category of `R`-Hopf algebras. -/
2626
structure HopfAlgCat where
27+
private mk ::
2728
/-- The underlying type. -/
2829
carrier : Type v
2930
[instRing : Ring carrier]

Mathlib/Algebra/Category/Ring/Basic.lean

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ open CategoryTheory
2626

2727
/-- The category of semirings. -/
2828
structure SemiRingCat where
29-
private mk ::
29+
/-- The object in the category of semirings associated to a type equipped with the appropriate
30+
typeclasses. -/
31+
of ::
3032
/-- The underlying type. -/
3133
carrier : Type u
3234
[semiring : Semiring carrier]
@@ -42,11 +44,6 @@ instance : CoeSort (SemiRingCat) (Type u) :=
4244

4345
attribute [coe] SemiRingCat.carrier
4446

45-
/-- The object in the category of R-algebras associated to a type equipped with the appropriate
46-
typeclasses. This is the preferred way to construct a term of `SemiRingCat`. -/
47-
abbrev of (R : Type u) [Semiring R] : SemiRingCat :=
48-
⟨R⟩
49-
5047
lemma coe_of (R : Type u) [Semiring R] : (of R : Type u) = R :=
5148
rfl
5249

@@ -176,7 +173,9 @@ end SemiRingCat
176173

177174
/-- The category of rings. -/
178175
structure RingCat where
179-
private mk ::
176+
/-- The object in the category of rings associated to a type equipped with the appropriate
177+
typeclasses. -/
178+
of ::
180179
/-- The underlying type. -/
181180
carrier : Type u
182181
[ring : Ring carrier]
@@ -192,11 +191,6 @@ instance : CoeSort (RingCat) (Type u) :=
192191

193192
attribute [coe] RingCat.carrier
194193

195-
/-- The object in the category of R-algebras associated to a type equipped with the appropriate
196-
typeclasses. This is the preferred way to construct a term of `RingCat`. -/
197-
abbrev of (R : Type u) [Ring R] : RingCat :=
198-
⟨R⟩
199-
200194
lemma coe_of (R : Type u) [Ring R] : (of R : Type u) = R :=
201195
rfl
202196

@@ -338,7 +332,9 @@ end RingCat
338332

339333
/-- The category of commutative semirings. -/
340334
structure CommSemiRingCat where
341-
private mk ::
335+
/-- The object in the category of commutative semirings associated to a type equipped with the
336+
appropriate typeclasses. -/
337+
of ::
342338
/-- The underlying type. -/
343339
carrier : Type u
344340
[commSemiring : CommSemiring carrier]
@@ -354,11 +350,6 @@ instance : CoeSort (CommSemiRingCat) (Type u) :=
354350

355351
attribute [coe] CommSemiRingCat.carrier
356352

357-
/-- The object in the category of R-algebras associated to a type equipped with the appropriate
358-
typeclasses. This is the preferred way to construct a term of `CommSemiRingCat`. -/
359-
abbrev of (R : Type u) [CommSemiring R] : CommSemiRingCat :=
360-
⟨R⟩
361-
362353
lemma coe_of (R : Type u) [CommSemiring R] : (of R : Type u) = R :=
363354
rfl
364355

@@ -499,7 +490,9 @@ end CommSemiRingCat
499490

500491
/-- The category of commutative rings. -/
501492
structure CommRingCat where
502-
private mk ::
493+
/-- The object in the category of commutative rings associated to a type equipped with the
494+
appropriate typeclasses. -/
495+
of ::
503496
/-- The underlying type. -/
504497
carrier : Type u
505498
[commRing : CommRing carrier]
@@ -515,11 +508,6 @@ instance : CoeSort (CommRingCat) (Type u) :=
515508

516509
attribute [coe] CommRingCat.carrier
517510

518-
/-- The object in the category of R-algebras associated to a type equipped with the appropriate
519-
typeclasses. This is the preferred way to construct a term of `CommRingCat`. -/
520-
abbrev of (R : Type u) [CommRing R] : CommRingCat :=
521-
⟨R⟩
522-
523511
lemma coe_of (R : Type u) [CommRing R] : (of R : Type u) = R :=
524512
rfl
525513

Mathlib/Analysis/Normed/Group/SemiNormedGrp.lean

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ open CategoryTheory
2424

2525
/-- The category of seminormed abelian groups and bounded group homomorphisms. -/
2626
structure SemiNormedGrp : Type (u + 1) where
27+
/-- Construct a bundled `SemiNormedGrp` from the underlying type and typeclass. -/
28+
of ::
2729
/-- The underlying seminormed abelian group. -/
2830
carrier : Type u
2931
[str : SeminormedAddCommGroup carrier]
@@ -35,10 +37,6 @@ namespace SemiNormedGrp
3537
instance : CoeSort SemiNormedGrp Type* where
3638
coe X := X.carrier
3739

38-
/-- Construct a bundled `SemiNormedGrp` from the underlying type and typeclass. -/
39-
abbrev of (M : Type u) [SeminormedAddCommGroup M] : SemiNormedGrp where
40-
carrier := M
41-
4240
/-- The type of morphisms in `SemiNormedGrp` -/
4341
@[ext]
4442
structure Hom (M N : SemiNormedGrp.{u}) where
@@ -209,6 +207,8 @@ end SemiNormedGrp
209207
which we shall equip with the category structure consisting only of the norm non-increasing maps.
210208
-/
211209
structure SemiNormedGrp₁ : Type (u + 1) where
210+
/-- Construct a bundled `SemiNormedGrp₁` from the underlying type and typeclass. -/
211+
of ::
212212
/-- The underlying seminormed abelian group. -/
213213
carrier : Type u
214214
[str : SeminormedAddCommGroup carrier]
@@ -220,10 +220,6 @@ namespace SemiNormedGrp₁
220220
instance : CoeSort SemiNormedGrp₁ Type* where
221221
coe X := X.carrier
222222

223-
/-- Construct a bundled `SemiNormedGrp₁` from the underlying type and typeclass. -/
224-
abbrev of (M : Type u) [SeminormedAddCommGroup M] : SemiNormedGrp₁ where
225-
carrier := M
226-
227223
/-- The type of morphisms in `SemiNormedGrp₁` -/
228224
@[ext]
229225
structure Hom (M N : SemiNormedGrp₁.{u}) where

Mathlib/CategoryTheory/FintypeCat.lean

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ open CategoryTheory
2525

2626
/-- The category of finite types. -/
2727
structure FintypeCat where
28+
/-- Construct a bundled `FintypeCat` from the underlying type and typeclass. -/
29+
of ::
2830
/-- The underlying type. -/
2931
carrier : Type*
3032
[str : Fintype carrier]
@@ -36,10 +38,6 @@ namespace FintypeCat
3638
instance instCoeSort : CoeSort FintypeCat Type* :=
3739
⟨carrier⟩
3840

39-
/-- Construct a bundled `FintypeCat` from the underlying type and typeclass. -/
40-
abbrev of (X : Type*) [Fintype X] : FintypeCat where
41-
carrier := X
42-
4341
instance : Inhabited FintypeCat :=
4442
⟨of PEmpty⟩
4543

Mathlib/MeasureTheory/Category/MeasCat.lean

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ universe u v
3737

3838
/-- The category of measurable spaces and measurable functions. -/
3939
structure MeasCat : Type (u + 1) where
40+
/-- Construct a bundled `MeasCat` from the underlying type and the typeclass. -/
41+
of ::
4042
/-- The underlying measurable space. -/
4143
carrier : Type u
4244
[str : MeasurableSpace carrier]
@@ -48,10 +50,6 @@ namespace MeasCat
4850
instance : CoeSort MeasCat Type* :=
4951
⟨carrier⟩
5052

51-
/-- Construct a bundled `MeasCat` from the underlying type and the typeclass. -/
52-
abbrev of (α : Type u) [ms : MeasurableSpace α] : MeasCat where
53-
carrier := α
54-
5553
theorem coe_of (X : Type u) [MeasurableSpace X] : (of X : Type u) = X :=
5654
rfl
5755

Mathlib/Order/Category/BoolAlg.lean

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ open CategoryTheory
2121

2222
/-- The category of Boolean algebras. -/
2323
structure BoolAlg where
24+
/-- Construct a bundled `BoolAlg` from the underlying type and typeclass. -/
25+
of ::
2426
/-- The underlying Boolean algebra. -/
2527
carrier : Type*
2628
[str : BooleanAlgebra carrier]
@@ -36,9 +38,6 @@ instance : CoeSort BoolAlg (Type _) :=
3638

3739
attribute [coe] BoolAlg.carrier
3840

39-
/-- Construct a bundled `BoolAlg` from the underlying type and typeclass. -/
40-
abbrev of (X : Type*) [BooleanAlgebra X] : BoolAlg := ⟨X⟩
41-
4241
/-- The type of morphisms in `BoolAlg R`. -/
4342
@[ext]
4443
structure Hom (X Y : BoolAlg.{u}) where

Mathlib/Order/Category/CompleteLat.lean

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ open CategoryTheory
1919

2020
/-- The category of complete lattices. -/
2121
structure CompleteLat where
22+
/-- Construct a bundled `CompleteLat` from the underlying type and typeclass. -/
23+
of ::
2224
/-- The underlying lattice. -/
2325
(carrier : Type*)
2426
[str : CompleteLattice carrier]
@@ -34,9 +36,6 @@ instance : CoeSort CompleteLat (Type _) :=
3436

3537
attribute [coe] CompleteLat.carrier
3638

37-
/-- Construct a bundled `CompleteLat` from the underlying type and typeclass. -/
38-
abbrev of (X : Type*) [CompleteLattice X] : CompleteLat := ⟨X⟩
39-
4039
theorem coe_of (α : Type*) [CompleteLattice α] : ↥(of α) = α :=
4140
rfl
4241

Mathlib/Order/Category/Frm.lean

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ open CategoryTheory Order
2424

2525
/-- The category of frames. -/
2626
structure Frm where
27+
/-- Construct a bundled `Frm` from the underlying type and typeclass. -/
28+
of ::
2729
/-- The underlying frame. -/
2830
(carrier : Type*)
2931
[str : Frame carrier]
@@ -39,9 +41,6 @@ instance : CoeSort Frm (Type _) :=
3941

4042
attribute [coe] Frm.carrier
4143

42-
/-- Construct a bundled `Frm` from the underlying type and typeclass. -/
43-
abbrev of (X : Type*) [Frame X] : Frm := ⟨X⟩
44-
4544
/-- The type of morphisms in `Frm R`. -/
4645
@[ext]
4746
structure Hom (X Y : Frm.{u}) where

0 commit comments

Comments
 (0)