Skip to content

Commit 3bddb2a

Browse files
committed
chore: replace CategoryTheory.FreeGroupoid with Quiver.FreeGroupoid (#30115)
As suggested by Riou in #29279, when we build the free groupoid on a category the name `CategoryTheory.FreeGroupoid` will be inappropriate and confusing. We put definitions in the file `CategoryTheory.FreeGroupoid` in the namespace `Quiver.FreeGroupoid` instead. Co-authored-by: jlh18 <josephhua73@yahoo.com>
1 parent f962fa3 commit 3bddb2a

File tree

1 file changed

+24
-20
lines changed

1 file changed

+24
-20
lines changed

Mathlib/CategoryTheory/Groupoid/FreeGroupoid.lean

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,34 +32,38 @@ and finally quotienting by the reducibility relation.
3232

3333
open Set Function
3434

35-
namespace CategoryTheory
35+
namespace Quiver
3636

37-
namespace Groupoid
38-
39-
namespace Free
37+
open CategoryTheory
4038

4139
universe u v u' v' u'' v''
4240

4341
variable {V : Type u} [Quiver.{v + 1} V]
4442

4543
/-- Shorthand for the "forward" arrow corresponding to `f` in `paths <| symmetrify V` -/
46-
abbrev _root_.Quiver.Hom.toPosPath {X Y : V} (f : X ⟶ Y) :
44+
abbrev Hom.toPosPath {X Y : V} (f : X ⟶ Y) :
4745
(CategoryTheory.Paths.categoryPaths <| Quiver.Symmetrify V).Hom X Y :=
4846
f.toPos.toPath
4947

5048
/-- Shorthand for the "forward" arrow corresponding to `f` in `paths <| symmetrify V` -/
51-
abbrev _root_.Quiver.Hom.toNegPath {X Y : V} (f : X ⟶ Y) :
49+
abbrev Hom.toNegPath {X Y : V} (f : X ⟶ Y) :
5250
(CategoryTheory.Paths.categoryPaths <| Quiver.Symmetrify V).Hom Y X :=
5351
f.toNeg.toPath
5452

5553
/-- The "reduction" relation -/
56-
inductive redStep : HomRel (Paths (Quiver.Symmetrify V))
54+
inductive FreeGroupoid.redStep : HomRel (Paths (Quiver.Symmetrify V))
5755
| step (X Z : Quiver.Symmetrify V) (f : X ⟶ Z) :
5856
redStep (𝟙 ((Paths.of (Quiver.Symmetrify V)).obj X)) (f.toPath ≫ (Quiver.reverse f).toPath)
5957

6058
/-- The underlying vertices of the free groupoid -/
61-
def _root_.CategoryTheory.FreeGroupoid (V) [Q : Quiver V] :=
62-
Quotient (@redStep V Q)
59+
def FreeGroupoid (V) [Q : Quiver V] :=
60+
CategoryTheory.Quotient (@FreeGroupoid.redStep V Q)
61+
62+
@[deprecated (since := "2025-10-02")] alias _root_.CategoryTheory.FreeGroupoid := FreeGroupoid
63+
64+
namespace FreeGroupoid
65+
66+
open Quiver
6367

6468
instance {V} [Quiver V] [Nonempty V] : Nonempty (FreeGroupoid V) := by
6569
inhabit V; exact ⟨⟨@default V _⟩⟩
@@ -117,7 +121,7 @@ def quotInv {X Y : FreeGroupoid V} (f : X ⟶ Y) : Y ⟶ X :=
117121
Quot.liftOn f (fun pp => Quot.mk _ <| pp.reverse) fun pp qq con =>
118122
Quot.sound <| congr_reverse pp qq con
119123

120-
instance _root_.CategoryTheory.FreeGroupoid.instGroupoid : Groupoid (FreeGroupoid V) where
124+
instance instGroupoid : Groupoid (FreeGroupoid V) where
121125
inv := quotInv
122126
inv_comp p := Quot.inductionOn p fun pp => congr_reverse_comp pp
123127
comp_inv p := Quot.inductionOn p fun pp => congr_comp_reverse pp
@@ -137,7 +141,7 @@ variable {V' : Type u'} [Groupoid V']
137141

138142
/-- The lift of a prefunctor to a groupoid, to a functor from `FreeGroupoid V` -/
139143
def lift (φ : V ⥤q V') : FreeGroupoid V ⥤ V' :=
140-
Quotient.lift _ (Paths.lift <| Quiver.Symmetrify.lift φ) <| by
144+
CategoryTheory.Quotient.lift _ (Paths.lift <| Quiver.Symmetrify.lift φ) <| by
141145
rintro _ _ _ _ ⟨X, Y, f⟩
142146
-- Porting note: `simp` does not work, so manually `rewrite`
143147
erw [Paths.lift_nil, Paths.lift_cons, Quiver.Path.comp_nil, Paths.lift_toPath,
@@ -159,19 +163,23 @@ theorem lift_unique (φ : V ⥤q V') (Φ : FreeGroupoid V ⥤ V') (hΦ : of V
159163
exact hΦ
160164
· rintro X Y f
161165
simp only [← Functor.toPrefunctor_comp, Prefunctor.comp_map, Paths.of_map]
162-
change Φ.map (inv ((Quotient.functor redStep).toPrefunctor.map f.toPath)) =
163-
inv (Φ.map ((Quotient.functor redStep).toPrefunctor.map f.toPath))
166+
change Φ.map (Groupoid.inv ((Quotient.functor redStep).toPrefunctor.map f.toPath)) =
167+
Groupoid.inv (Φ.map ((Quotient.functor redStep).toPrefunctor.map f.toPath))
164168
have := Functor.map_inv Φ ((Quotient.functor redStep).toPrefunctor.map f.toPath)
165-
convert this <;> simp only [inv_eq_inv]
169+
convert this <;> simp only [Groupoid.inv_eq_inv]
166170

167171
end UniversalProperty
168172

173+
end FreeGroupoid
174+
169175
section Functoriality
170176

177+
open FreeGroupoid
178+
171179
variable {V' : Type u'} [Quiver.{v' + 1} V'] {V'' : Type u''} [Quiver.{v'' + 1} V'']
172180

173181
/-- The functor of free groupoid induced by a prefunctor of quivers -/
174-
def _root_.CategoryTheory.freeGroupoidFunctor (φ : V ⥤q V') : FreeGroupoid V ⥤ FreeGroupoid V' :=
182+
def freeGroupoidFunctor (φ : V ⥤q V') : FreeGroupoid V ⥤ FreeGroupoid V' :=
175183
lift (φ ⋙q of V')
176184

177185
theorem freeGroupoidFunctor_id :
@@ -186,8 +194,4 @@ theorem freeGroupoidFunctor_comp (φ : V ⥤q V') (φ' : V' ⥤q V'') :
186194

187195
end Functoriality
188196

189-
end Free
190-
191-
end Groupoid
192-
193-
end CategoryTheory
197+
end Quiver

0 commit comments

Comments
 (0)