Skip to content

Commit 4a5073f

Browse files
committed
feat(CategoryTheory/MorphismProperty): generalize to CategoryStructs (#31632)
This generalizes some parts of `MorphismProperty` that only use the data underlying a `Cateogory` (i.e. everything in the file not mentioning isomorphisms or functors, although arguably functors should only use `CategoryStruct`s also...). This will be useful for bicategories and stacks.
1 parent e62bef8 commit 4a5073f

File tree

1 file changed

+38
-10
lines changed

1 file changed

+38
-10
lines changed

Mathlib/CategoryTheory/MorphismProperty/Basic.lean

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,28 +29,30 @@ noncomputable section
2929

3030
namespace CategoryTheory
3131

32-
variable (C : Type u) [Category.{v} C] {D : Type*} [Category D]
33-
3432
/-- A `MorphismProperty C` is a class of morphisms between objects in `C`. -/
35-
def MorphismProperty :=
33+
def MorphismProperty (C : Type u) [CategoryStruct.{v} C] :=
3634
∀ ⦃X Y : C⦄ (_ : X ⟶ Y), Prop
3735

36+
namespace MorphismProperty
37+
38+
section
39+
40+
variable (C : Type u) [CategoryStruct.{v} C]
41+
3842
instance : CompleteBooleanAlgebra (MorphismProperty C) where
3943
le P₁ P₂ := ∀ ⦃X Y : C⦄ (f : X ⟶ Y), P₁ f → P₂ f
4044
__ := inferInstanceAs (CompleteBooleanAlgebra (∀ ⦃X Y : C⦄ (_ : X ⟶ Y), Prop))
4145

42-
lemma MorphismProperty.le_def {P Q : MorphismProperty C} :
46+
lemma le_def {P Q : MorphismProperty C} :
4347
P ≤ Q ↔ ∀ {X Y : C} (f : X ⟶ Y), P f → Q f := Iff.rfl
4448

4549
instance : Inhabited (MorphismProperty C) :=
4650
⟨⊤⟩
4751

48-
lemma MorphismProperty.top_eq : (⊤ : MorphismProperty C) = fun _ _ _ => True := rfl
52+
lemma top_eq : (⊤ : MorphismProperty C) = fun _ _ _ => True := rfl
4953

5054
variable {C}
5155

52-
namespace MorphismProperty
53-
5456
@[ext]
5557
lemma ext (W W' : MorphismProperty C) (h : ∀ ⦃X Y : C⦄ (f : X ⟶ Y), W f ↔ W' f) :
5658
W = W' := by
@@ -98,6 +100,12 @@ theorem unop_op (P : MorphismProperty C) : P.op.unop = P :=
98100
theorem op_unop (P : MorphismProperty Cᵒᵖ) : P.unop.op = P :=
99101
rfl
100102

103+
end
104+
105+
section
106+
107+
variable {C : Type u} [Category.{v} C] {D : Type*} [Category D]
108+
101109
/-- The inverse image of a `MorphismProperty D` by a functor `C ⥤ D` -/
102110
def inverseImage (P : MorphismProperty D) (F : C ⥤ D) : MorphismProperty C := fun _ _ f =>
103111
P (F.map f)
@@ -181,6 +189,12 @@ lemma ofHoms_homFamily (P : MorphismProperty C) : ofHoms P.homFamily = P := by
181189
· intro hf
182190
exact ⟨(⟨f, hf⟩ : P.toSet)⟩
183191

192+
end
193+
194+
section
195+
196+
variable {C : Type u} [CategoryStruct.{v} C]
197+
184198
/-- A morphism property `P` satisfies `P.RespectsRight Q` if it is stable under post-composition
185199
with morphisms satisfying `Q`, i.e. whenever `P` holds for `f` and `Q` holds for `i` then `P`
186200
holds for `f ≫ i`. -/
@@ -213,7 +227,11 @@ instance RespectsRight.inf (P₁ P₂ Q : MorphismProperty C) [P₁.RespectsRigh
213227
[P₂.RespectsRight Q] : (P₁ ⊓ P₂).RespectsRight Q where
214228
postcomp i hi f hf := ⟨postcomp i hi f hf.left, postcomp i hi f hf.right⟩
215229

216-
variable (C)
230+
end
231+
232+
section
233+
234+
variable (C : Type u) [Category.{v} C]
217235

218236
/-- The `MorphismProperty C` satisfied by isomorphisms in `C`. -/
219237
def isomorphisms : MorphismProperty C := fun _ _ f => IsIso f
@@ -330,6 +348,10 @@ lemma isoClosure_le_iff (P Q : MorphismProperty C) [Q.RespectsIso] :
330348
· intro h
331349
exact (monotone_isoClosure h).trans (by rw [Q.isoClosure_eq_self])
332350

351+
section
352+
353+
variable {D : Type*} [Category D]
354+
333355
instance map_respectsIso (P : MorphismProperty C) (F : C ⥤ D) :
334356
(P.map F).RespectsIso := by
335357
apply RespectsIso.of_respects_arrow_iso
@@ -422,6 +444,8 @@ lemma inverseImage_map_eq_of_isEquivalence
422444

423445
end
424446

447+
end
448+
425449
section
426450

427451
variable {C}
@@ -473,9 +497,11 @@ instance RespectsIso.isomorphisms : RespectsIso (isomorphisms C) := by
473497
intro
474498
exact IsIso.comp_isIso
475499

500+
end
501+
476502
/-- If `W₁` and `W₂` are morphism properties on two categories `C₁` and `C₂`,
477503
this is the induced morphism property on `C₁ × C₂`. -/
478-
def prod {C₁ C₂ : Type*} [Category C₁] [Category C₂]
504+
def prod {C₁ C₂ : Type*} [CategoryStruct C₁] [CategoryStruct C₂]
479505
(W₁ : MorphismProperty C₁) (W₂ : MorphismProperty C₂) :
480506
MorphismProperty (C₁ × C₂) :=
481507
fun _ _ f => W₁ f.1 ∧ W₂ f.2
@@ -486,7 +512,7 @@ def pi {J : Type w} {C : J → Type u} [∀ j, Category.{v} (C j)]
486512
(W : ∀ j, MorphismProperty (C j)) : MorphismProperty (∀ j, C j) :=
487513
fun _ _ f => ∀ j, (W j) (f j)
488514

489-
variable {C}
515+
variable {C} [Category.{v} C]
490516

491517
/-- The morphism property on `J ⥤ C` which is defined objectwise
492518
from `W : MorphismProperty C`. -/
@@ -504,6 +530,8 @@ end MorphismProperty
504530

505531
namespace NatTrans
506532

533+
variable {C : Type u} [Category.{v} C] {D : Type*} [Category D]
534+
507535
lemma isIso_app_iff_of_iso {F G : C ⥤ D} (α : F ⟶ G) {X Y : C} (e : X ≅ Y) :
508536
IsIso (α.app X) ↔ IsIso (α.app Y) :=
509537
(MorphismProperty.isomorphisms D).arrow_mk_iso_iff

0 commit comments

Comments
 (0)