Skip to content

Commit 8b62164

Browse files
committed
chore(CategoryTheory/Limits/Shapes/StrongEpi): use to_dual (leanprover-community#40959)
This PR generates declarations about `StrongMono` from those about `StrongEpi`.
1 parent abeb53a commit 8b62164

1 file changed

Lines changed: 31 additions & 83 deletions

File tree

Mathlib/CategoryTheory/Limits/Shapes/StrongEpi.lean

Lines changed: 31 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ namespace CategoryTheory
4545
variable {C : Type u} [Category.{v} C]
4646
variable {P Q : C}
4747

48+
to_dual_name_hint Epi Mono
49+
4850
/-- A strong epimorphism `f` is an epimorphism which has the left lifting property
4951
with respect to monomorphisms. -/
5052
class StrongEpi (f : P ⟶ Q) : Prop where
@@ -53,57 +55,41 @@ class StrongEpi (f : P ⟶ Q) : Prop where
5355
/-- The left lifting property with respect to all monomorphisms -/
5456
llp : ∀ ⦃X Y : C⦄ (z : X ⟶ Y) [Mono z], HasLiftingProperty f z
5557

56-
57-
theorem StrongEpi.mk' {f : P ⟶ Q} [Epi f]
58-
(hf : ∀ (X Y : C) (z : X ⟶ Y)
59-
(_ : Mono z) (u : P ⟶ X) (v : Q ⟶ Y) (sq : CommSq u f z v), sq.HasLift) :
60-
StrongEpi f :=
61-
{ epi := inferInstance
62-
llp := fun {X Y} z hz => ⟨fun {u v} sq => hf X Y z hz u v sq⟩ }
63-
6458
/-- A strong monomorphism `f` is a monomorphism which has the right lifting property
6559
with respect to epimorphisms. -/
60+
@[to_dual]
6661
class StrongMono (f : P ⟶ Q) : Prop where
6762
/-- The monomorphism condition on `f` -/
6863
mono : Mono f
6964
/-- The right lifting property with respect to all epimorphisms -/
7065
rlp : ∀ ⦃X Y : C⦄ (z : X ⟶ Y) [Epi z], HasLiftingProperty z f
7166

72-
theorem StrongMono.mk' {f : P ⟶ Q} [Mono f]
73-
(hf : ∀ (X Y : C) (z : X ⟶ Y) (_ : Epi z) (u : X ⟶ P)
74-
(v : Y ⟶ Q) (sq : CommSq u z f v), sq.HasLift) : StrongMono f where
75-
mono := inferInstance
76-
rlp := fun {X Y} z hz => ⟨fun {u v} sq => hf X Y z hz u v sq⟩
67+
attribute [to_dual existing] StrongEpi.llp StrongEpi.mk
7768

78-
attribute [instance 100] StrongEpi.llp
79-
80-
attribute [instance 100] StrongMono.rlp
81-
82-
instance (priority := 100) epi_of_strongEpi (f : P ⟶ Q) [StrongEpi f] : Epi f :=
83-
StrongEpi.epi
69+
@[to_dual (reorder := hf (X Y, u v))]
70+
theorem StrongEpi.mk' {f : P ⟶ Q} [Epi f]
71+
(hf : ∀ (X Y : C) (z : X ⟶ Y) (_ : Mono z) (u : P ⟶ X)
72+
(v : Q ⟶ Y) (sq : CommSq u f z v), sq.HasLift) : StrongEpi f where
73+
epi := inferInstance
74+
llp {X Y} z hz := ⟨fun {u v} sq => hf X Y z hz u v sq⟩
8475

85-
instance (priority := 100) mono_of_strongMono (f : P ⟶ Q) [StrongMono f] : Mono f :=
86-
StrongMono.mono
76+
attribute [instance 100] StrongEpi.epi StrongEpi.llp StrongMono.mono StrongMono.rlp
8777

8878
section
8979

9080
variable {R : C} (f : P ⟶ Q) (g : Q ⟶ R)
9181

9282
/-- The composition of two strong epimorphisms is a strong epimorphism. -/
83+
@[to_dual /-- The composition of two strong monomorphisms is a strong monomorphism. -/]
9384
instance strongEpi_comp [StrongEpi f] [StrongEpi g] : StrongEpi (f ≫ g) :=
9485
{ epi := epi_comp _ _
9586
llp := by
9687
intros
9788
infer_instance }
9889

99-
/-- The composition of two strong monomorphisms is a strong monomorphism. -/
100-
instance strongMono_comp [StrongMono f] [StrongMono g] : StrongMono (f ≫ g) :=
101-
{ mono := mono_comp _ _
102-
rlp := by
103-
intros
104-
infer_instance }
105-
10690
/-- If `f ≫ g` is a strong epimorphism, then so is `g`. -/
91+
@[to_dual (reorder := f g) (rename := f ↔ g, P ↔ R)
92+
/-- If `f ≫ g` is a strong monomorphism, then so is `f`. -/]
10793
theorem strongEpi_of_strongEpi [StrongEpi (f ≫ g)] : StrongEpi g :=
10894
{ epi := epi_of_epi f g
10995
llp := fun {X Y} z _ => by
@@ -115,67 +101,36 @@ theorem strongEpi_of_strongEpi [StrongEpi (f ≫ g)] : StrongEpi g :=
115101
⟨(CommSq.mk h₀).lift, by
116102
simp only [← cancel_mono z, Category.assoc, CommSq.fac_right, sq.w], by simp⟩ }
117103

118-
/-- If `f ≫ g` is a strong monomorphism, then so is `f`. -/
119-
theorem strongMono_of_strongMono [StrongMono (f ≫ g)] : StrongMono f :=
120-
{ mono := mono_of_mono f g
121-
rlp := fun {X Y} z => by
122-
intros
123-
constructor
124-
intro u v sq
125-
have h₀ : u ≫ f ≫ g = z ≫ v ≫ g := by
126-
rw [← Category.assoc, eq_whisker sq.w, Category.assoc]
127-
exact CommSq.HasLift.mk' ⟨(CommSq.mk h₀).lift, by simp, by simp [← cancel_epi z, sq.w]⟩ }
128-
129104
/-- An isomorphism is in particular a strong epimorphism. -/
105+
@[to_dual /-- An isomorphism is in particular a strong monomorphism. -/]
130106
instance (priority := 100) strongEpi_of_isIso [IsIso f] : StrongEpi f where
131107
epi := by infer_instance
132108
llp {_ _} _ := HasLiftingProperty.of_left_iso _ _
133109

134-
/-- An isomorphism is in particular a strong monomorphism. -/
135-
instance (priority := 100) strongMono_of_isIso [IsIso f] : StrongMono f where
136-
mono := by infer_instance
137-
rlp {_ _} _ := HasLiftingProperty.of_right_iso _ _
138-
139110
set_option backward.isDefEq.respectTransparency false in
111+
@[to_dual]
140112
theorem StrongEpi.of_arrow_iso {A B A' B' : C} {f : A ⟶ B} {g : A' ⟶ B'}
141-
(e : Arrow.mk f ≅ Arrow.mk g) [h : StrongEpi f] : StrongEpi g :=
142-
{ epi := by
143-
rw [Arrow.iso_w' e]
144-
infer_instance
145-
llp := fun {X Y} z => by
146-
intro
147-
apply HasLiftingProperty.of_arrow_iso_left e z }
148-
149-
set_option backward.isDefEq.respectTransparency false in
150-
theorem StrongMono.of_arrow_iso {A B A' B' : C} {f : A ⟶ B} {g : A' ⟶ B'}
151-
(e : Arrow.mk f ≅ Arrow.mk g) [h : StrongMono f] : StrongMono g :=
152-
{ mono := by
153-
rw [Arrow.iso_w' e]
154-
infer_instance
155-
rlp := fun {X Y} z => by
156-
intro
157-
apply HasLiftingProperty.of_arrow_iso_right z e }
158-
113+
(e : Arrow.mk f ≅ Arrow.mk g) [h : StrongEpi f] : StrongEpi g where
114+
epi := by
115+
rw [Arrow.iso_w' e]
116+
infer_instance
117+
llp := fun {X Y} z => by
118+
intro
119+
apply HasLiftingProperty.of_arrow_iso_left e z
120+
121+
@[to_dual]
159122
theorem StrongEpi.iff_of_arrow_iso {A B A' B' : C} {f : A ⟶ B} {g : A' ⟶ B'}
160123
(e : Arrow.mk f ≅ Arrow.mk g) : StrongEpi f ↔ StrongEpi g := by
161124
constructor <;> intro
162125
exacts [StrongEpi.of_arrow_iso e, StrongEpi.of_arrow_iso e.symm]
163126

164-
theorem StrongMono.iff_of_arrow_iso {A B A' B' : C} {f : A ⟶ B} {g : A' ⟶ B'}
165-
(e : Arrow.mk f ≅ Arrow.mk g) : StrongMono f ↔ StrongMono g := by
166-
constructor <;> intro
167-
exacts [StrongMono.of_arrow_iso e, StrongMono.of_arrow_iso e.symm]
168-
169127
end
170128

171129
/-- A strong epimorphism that is a monomorphism is an isomorphism. -/
130+
@[to_dual /-- A strong monomorphism that is an epimorphism is an isomorphism. -/]
172131
theorem isIso_of_mono_of_strongEpi (f : P ⟶ Q) [Mono f] [StrongEpi f] : IsIso f :=
173132
⟨⟨(CommSq.mk (show 𝟙 P ≫ f = f ≫ 𝟙 Q by simp)).lift, by simp⟩⟩
174133

175-
/-- A strong monomorphism that is an epimorphism is an isomorphism. -/
176-
theorem isIso_of_epi_of_strongMono (f : P ⟶ Q) [Epi f] [StrongMono f] : IsIso f :=
177-
⟨⟨(CommSq.mk (show 𝟙 P ≫ f = f ≫ 𝟙 Q by simp)).lift, by simp⟩⟩
178-
179134
section
180135

181136
variable (C)
@@ -186,34 +141,27 @@ class StrongEpiCategory : Prop where
186141
strongEpi_of_epi : ∀ {X Y : C} (f : X ⟶ Y) [Epi f], StrongEpi f
187142

188143
/-- A strong mono category is a category in which every monomorphism is strong. -/
144+
@[to_dual]
189145
class StrongMonoCategory : Prop where
190146
/-- A strong mono category is a category in which every monomorphism is strong. -/
191147
strongMono_of_mono : ∀ {X Y : C} (f : X ⟶ Y) [Mono f], StrongMono f
192148

149+
attribute [to_dual existing] StrongEpiCategory.strongEpi_of_epi StrongEpiCategory.mk
150+
193151
end
194152

153+
@[to_dual]
195154
theorem strongEpi_of_epi [StrongEpiCategory C] (f : P ⟶ Q) [Epi f] : StrongEpi f :=
196155
StrongEpiCategory.strongEpi_of_epi _
197156

198-
theorem strongMono_of_mono [StrongMonoCategory C] (f : P ⟶ Q) [Mono f] : StrongMono f :=
199-
StrongMonoCategory.strongMono_of_mono _
200-
201157
section
202158

203159
attribute [local instance] strongEpi_of_epi
204160

161+
@[to_dual]
205162
instance (priority := 100) balanced_of_strongEpiCategory [StrongEpiCategory C] : Balanced C where
206163
isIso_of_mono_of_epi _ _ _ := isIso_of_mono_of_strongEpi _
207164

208165
end
209166

210-
section
211-
212-
attribute [local instance] strongMono_of_mono
213-
214-
instance (priority := 100) balanced_of_strongMonoCategory [StrongMonoCategory C] : Balanced C where
215-
isIso_of_mono_of_epi _ _ _ := isIso_of_epi_of_strongMono _
216-
217-
end
218-
219167
end CategoryTheory

0 commit comments

Comments
 (0)