Skip to content

Commit fe6ff4a

Browse files
committed
feat(CategoryTheory): IsDiscrete implies IsGroupoid (#25136)
Show the `Prop`-class version of the fact that any discrete categories is a groupoid.
1 parent 30ae5ad commit fe6ff4a

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

Mathlib/CategoryTheory/Discrete/Basic.lean

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,16 +302,24 @@ class IsDiscrete (C : Type*) [Category C] : Prop where
302302

303303
attribute [instance] IsDiscrete.subsingleton
304304

305-
lemma obj_ext_of_isDiscrete {C : Type*} [Category C] [IsDiscrete C]
306-
{X Y : C} (f : X ⟶ Y) : X = Y := IsDiscrete.eq_of_hom f
307-
308305
instance Discrete.isDiscrete (C : Type*) : IsDiscrete (Discrete C) where
309306
eq_of_hom := by rintro ⟨_⟩ ⟨_⟩ ⟨⟨rfl⟩⟩; rfl
310307

311-
instance (C : Type*) [Category C] [IsDiscrete C] : IsDiscrete Cᵒᵖ where
308+
section
309+
310+
variable {C : Type*} [Category C] [IsDiscrete C]
311+
312+
lemma obj_ext_of_isDiscrete {X Y : C} (f : X ⟶ Y) : X = Y := IsDiscrete.eq_of_hom f
313+
314+
instance isIso_of_isDiscrete {X Y : C} (f : X ⟶ Y) : IsIso f :=
315+
⟨eqToHom (IsDiscrete.eq_of_hom f).symm, by aesop_cat⟩
316+
317+
instance : IsDiscrete Cᵒᵖ where
312318
eq_of_hom := by
313319
rintro ⟨_⟩ ⟨_⟩ ⟨f⟩
314320
obtain rfl := obj_ext_of_isDiscrete f
315321
rfl
316322

323+
end
324+
317325
end CategoryTheory

Mathlib/CategoryTheory/Groupoid/Discrete.lean

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,6 @@ variable {C : Type*}
1616

1717
instance : Groupoid (Discrete C) := { inv := fun h ↦ ⟨⟨h.1.1.symm⟩⟩ }
1818

19+
instance [Category C] [IsDiscrete C] : IsGroupoid C where
20+
1921
end CategoryTheory

0 commit comments

Comments
 (0)