Module docstring
{"# The category of arrows
The category of arrows, with morphisms commutative squares.
We set this up as a specialization of the comma category Comma L R,
where L and R are both the identity functor.
Tags
comma, arrow "}
{"# The category of arrows
The category of arrows, with morphisms commutative squares.
We set this up as a specialization of the comma category Comma L R,
where L and R are both the identity functor.
comma, arrow "}
CategoryTheory.Arrow
definition
CategoryTheory.instCategoryArrow
instance
: Category (Arrow T)
instance : Category (Arrow T) := commaCategory
CategoryTheory.Arrow.inhabited
instance
[Inhabited T] : Inhabited (Arrow T)
CategoryTheory.Arrow.hom_ext
theorem
{X Y : Arrow T} (f g : X ⟶ Y) (h₁ : f.left = g.left) (h₂ : f.right = g.right) : f = g
CategoryTheory.Arrow.id_left
theorem
(f : Arrow T) : CommaMorphism.left (𝟙 f) = 𝟙 f.left
CategoryTheory.Arrow.id_right
theorem
(f : Arrow T) : CommaMorphism.right (𝟙 f) = 𝟙 f.right
CategoryTheory.Arrow.comp_left
theorem
{X Y Z : Arrow T} (f : X ⟶ Y) (g : Y ⟶ Z) : (f ≫ g).left = f.left ≫ g.left
CategoryTheory.Arrow.comp_right
theorem
{X Y Z : Arrow T} (f : X ⟶ Y) (g : Y ⟶ Z) : (f ≫ g).right = f.right ≫ g.right
@[simp, reassoc]
theorem comp_right {X Y Z : Arrow T} (f : X ⟶ Y) (g : Y ⟶ Z) :
(f ≫ g).right = f.right ≫ g.right := rfl
CategoryTheory.Arrow.mk
definition
{X Y : T} (f : X ⟶ Y) : Arrow T
CategoryTheory.Arrow.mk_eq
theorem
(f : Arrow T) : Arrow.mk f.hom = f
CategoryTheory.Arrow.mk_injective
theorem
(A B : T) : Function.Injective (Arrow.mk : (A ⟶ B) → Arrow T)
theorem mk_injective (A B : T) :
Function.Injective (Arrow.mk : (A ⟶ B) → Arrow T) := fun f g h => by
cases h
rfl
CategoryTheory.Arrow.mk_inj
theorem
(A B : T) {f g : A ⟶ B} : Arrow.mk f = Arrow.mk g ↔ f = g
theorem mk_inj (A B : T) {f g : A ⟶ B} : Arrow.mkArrow.mk f = Arrow.mk g ↔ f = g :=
(mk_injective A B).eq_iff
CategoryTheory.Arrow.instCoeOutHom
instance
{X Y : T} : CoeOut (X ⟶ Y) (Arrow T)
CategoryTheory.Arrow.mk_eq_mk_iff
theorem
{X Y X' Y' : T} (f : X ⟶ Y) (f' : X' ⟶ Y') :
Arrow.mk f = Arrow.mk f' ↔ ∃ (hX : X = X') (hY : Y = Y'), f = eqToHom hX ≫ f' ≫ eqToHom hY.symm
lemma mk_eq_mk_iff {X Y X' Y' : T} (f : X ⟶ Y) (f' : X' ⟶ Y') :
Arrow.mkArrow.mk f = Arrow.mk f' ↔
∃ (hX : X = X') (hY : Y = Y'), f = eqToHom hX ≫ f' ≫ eqToHom hY.symm := by
constructor
· intro h
refine ⟨congr_arg Comma.left h, congr_arg Comma.right h, ?_⟩
have := (eqToIso h).hom.w
dsimp at this
rw [Comma.eqToHom_left, Comma.eqToHom_right] at this
rw [reassoc_of% this, eqToHom_trans, eqToHom_refl, Category.comp_id]
· rintro ⟨rfl, rfl, h⟩
simp only [eqToHom_refl, Category.comp_id, Category.id_comp] at h
rw [h]
CategoryTheory.Arrow.ext
theorem
{f g : Arrow T} (h₁ : f.left = g.left) (h₂ : f.right = g.right) (h₃ : f.hom = eqToHom h₁ ≫ g.hom ≫ eqToHom h₂.symm) :
f = g
CategoryTheory.Arrow.arrow_mk_comp_eqToHom
theorem
{X Y Y' : T} (f : X ⟶ Y) (h : Y = Y') : Arrow.mk (f ≫ eqToHom h) = Arrow.mk f
@[simp]
lemma arrow_mk_comp_eqToHom {X Y Y' : T} (f : X ⟶ Y) (h : Y = Y') :
Arrow.mk (f ≫ eqToHom h) = Arrow.mk f :=
ext rfl h.symm (by simp)
CategoryTheory.Arrow.arrow_mk_eqToHom_comp
theorem
{X' X Y : T} (f : X ⟶ Y) (h : X' = X) : Arrow.mk (eqToHom h ≫ f) = Arrow.mk f
@[simp]
lemma arrow_mk_eqToHom_comp {X' X Y : T} (f : X ⟶ Y) (h : X' = X) :
Arrow.mk (eqToHomeqToHom h ≫ f) = Arrow.mk f :=
ext h rfl (by simp)
CategoryTheory.Arrow.w_mk_right
theorem
{f : Arrow T} {X Y : T} {g : X ⟶ Y} (sq : f ⟶ mk g) : sq.left ≫ g = f.hom ≫ sq.right
@[reassoc (attr := simp)]
theorem w_mk_right {f : Arrow T} {X Y : T} {g : X ⟶ Y} (sq : f ⟶ mk g) :
sq.left ≫ g = f.hom ≫ sq.right :=
sq.w
CategoryTheory.Arrow.w
theorem
{f g : Arrow T} (sq : f ⟶ g) : sq.left ≫ g.hom = f.hom ≫ sq.right
@[reassoc]
theorem w {f g : Arrow T} (sq : f ⟶ g) : sq.left ≫ g.hom = f.hom ≫ sq.right := by
simp
CategoryTheory.Arrow.isIso_of_isIso_left_of_isIso_right
theorem
{f g : Arrow T} (ff : f ⟶ g) [IsIso ff.left] [IsIso ff.right] : IsIso ff
theorem isIso_of_isIso_left_of_isIso_right {f g : Arrow T} (ff : f ⟶ g) [IsIso ff.left]
[IsIso ff.right] : IsIso ff where
out := by
let inverse : g ⟶ f := ⟨inv ff.left, inv ff.right, (by simp)⟩
apply Exists.intro inverse
aesop_cat
CategoryTheory.Arrow.hom.congr_left
theorem
{f g : Arrow T} {φ₁ φ₂ : f ⟶ g} (h : φ₁ = φ₂) : φ₁.left = φ₂.left
theorem hom.congr_left {f g : Arrow T} {φ₁ φ₂ : f ⟶ g} (h : φ₁ = φ₂) : φ₁.left = φ₂.left := by
rw [h]
CategoryTheory.Arrow.hom.congr_right
theorem
{f g : Arrow T} {φ₁ φ₂ : f ⟶ g} (h : φ₁ = φ₂) : φ₁.right = φ₂.right
@[simp]
theorem hom.congr_right {f g : Arrow T} {φ₁ φ₂ : f ⟶ g} (h : φ₁ = φ₂) : φ₁.right = φ₂.right := by
rw [h]
CategoryTheory.Arrow.iso_w
theorem
{f g : Arrow T} (e : f ≅ g) : g.hom = e.inv.left ≫ f.hom ≫ e.hom.right
theorem iso_w {f g : Arrow T} (e : f ≅ g) : g.hom = e.inv.left ≫ f.hom ≫ e.hom.right := by
have eq := Arrow.hom.congr_right e.inv_hom_id
rw [Arrow.comp_right, Arrow.id_right] at eq
rw [Arrow.w_assoc, eq, Category.comp_id]
CategoryTheory.Arrow.iso_w'
theorem
{W X Y Z : T} {f : W ⟶ X} {g : Y ⟶ Z} (e : Arrow.mk f ≅ Arrow.mk g) : g = e.inv.left ≫ f ≫ e.hom.right
theorem iso_w' {W X Y Z : T} {f : W ⟶ X} {g : Y ⟶ Z} (e : Arrow.mkArrow.mk f ≅ Arrow.mk g) :
g = e.inv.left ≫ f ≫ e.hom.right :=
iso_w e
CategoryTheory.Arrow.isIso_left
instance
[IsIso sq] : IsIso sq.left
instance isIso_left [IsIso sq] : IsIso sq.left where
out := by
apply Exists.intro (inv sq).left
simp only [← Comma.comp_left, IsIso.hom_inv_id, IsIso.inv_hom_id, Arrow.id_left,
eq_self_iff_true, and_self_iff]
simp
CategoryTheory.Arrow.isIso_right
instance
[IsIso sq] : IsIso sq.right
instance isIso_right [IsIso sq] : IsIso sq.right where
out := by
apply Exists.intro (inv sq).right
simp only [← Comma.comp_right, IsIso.hom_inv_id, IsIso.inv_hom_id, Arrow.id_right,
eq_self_iff_true, and_self_iff]
simp
CategoryTheory.Arrow.isIso_of_isIso
theorem
{X Y : T} {f : X ⟶ Y} {g : Arrow T} (sq : mk f ⟶ g) [IsIso sq] [IsIso f] : IsIso g.hom
CategoryTheory.Arrow.isIso_hom_iff_isIso_hom_of_isIso
theorem
{f g : Arrow T} (sq : f ⟶ g) [IsIso sq] : IsIso f.hom ↔ IsIso g.hom
lemma isIso_hom_iff_isIso_hom_of_isIso {f g : Arrow T} (sq : f ⟶ g) [IsIso sq] :
IsIsoIsIso f.hom ↔ IsIso g.hom :=
⟨fun _ => isIso_of_isIso sq, fun _ => isIso_of_isIso (inv sq)⟩
CategoryTheory.Arrow.isIso_iff_isIso_of_isIso
theorem
{W X Y Z : T} {f : W ⟶ X} {g : Y ⟶ Z} (sq : mk f ⟶ mk g) [IsIso sq] : IsIso f ↔ IsIso g
lemma isIso_iff_isIso_of_isIso {W X Y Z : T} {f : W ⟶ X} {g : Y ⟶ Z} (sq : mkmk f ⟶ mk g) [IsIso sq] :
IsIsoIsIso f ↔ IsIso g :=
isIso_hom_iff_isIso_hom_of_isIso sq
CategoryTheory.Arrow.isIso_hom_iff_isIso_of_isIso
theorem
{Y Z : T} {f : Arrow T} {g : Y ⟶ Z} (sq : f ⟶ mk g) [IsIso sq] : IsIso f.hom ↔ IsIso g
lemma isIso_hom_iff_isIso_of_isIso {Y Z : T} {f : Arrow T} {g : Y ⟶ Z} (sq : f ⟶ mk g) [IsIso sq] :
IsIsoIsIso f.hom ↔ IsIso g :=
isIso_hom_iff_isIso_hom_of_isIso sq
CategoryTheory.Arrow.inv_left
theorem
[IsIso sq] : (inv sq).left = inv sq.left
@[simp]
theorem inv_left [IsIso sq] : (inv sq).left = inv sq.left :=
IsIso.eq_inv_of_hom_inv_id <| by rw [← Comma.comp_left, IsIso.hom_inv_id, id_left]
CategoryTheory.Arrow.inv_right
theorem
[IsIso sq] : (inv sq).right = inv sq.right
@[simp]
theorem inv_right [IsIso sq] : (inv sq).right = inv sq.right :=
IsIso.eq_inv_of_hom_inv_id <| by rw [← Comma.comp_right, IsIso.hom_inv_id, id_right]
CategoryTheory.Arrow.left_hom_inv_right
theorem
[IsIso sq] : sq.left ≫ g.hom ≫ inv sq.right = f.hom
theorem left_hom_inv_right [IsIso sq] : sq.left ≫ g.hom ≫ inv sq.right = f.hom := by
simp only [← Category.assoc, IsIso.comp_inv_eq, w]
CategoryTheory.Arrow.inv_left_hom_right
theorem
[IsIso sq] : inv sq.left ≫ f.hom ≫ sq.right = g.hom
theorem inv_left_hom_right [IsIso sq] : invinv sq.left ≫ f.hom ≫ sq.right = g.hom := by
simp only [w, IsIso.inv_comp_eq]
CategoryTheory.Arrow.mono_left
instance
[Mono sq] : Mono sq.left
instance mono_left [Mono sq] : Mono sq.left where
right_cancellation {Z} φ ψ h := by
let aux : (Z ⟶ f.left) → (Arrow.mkArrow.mk (𝟙 Z) ⟶ f) := fun φ =>
{ left := φ
right := φ ≫ f.hom }
have : ∀ g, (aux g).right = g ≫ f.hom := fun g => by dsimp
show (aux φ).left = (aux ψ).left
congr 1
rw [← cancel_mono sq]
apply CommaMorphism.ext
· exact h
· rw [Comma.comp_right, Comma.comp_right, this, this, Category.assoc, Category.assoc]
rw [← Arrow.w]
simp only [← Category.assoc, h]
CategoryTheory.Arrow.epi_right
instance
[Epi sq] : Epi sq.right
instance epi_right [Epi sq] : Epi sq.right where
left_cancellation {Z} φ ψ h := by
let aux : (g.right ⟶ Z) → (g ⟶ Arrow.mk (𝟙 Z)) := fun φ =>
{ right := φ
left := g.hom ≫ φ }
show (aux φ).right = (aux ψ).right
congr 1
rw [← cancel_epi sq]
apply CommaMorphism.ext
· rw [Comma.comp_left, Comma.comp_left, Arrow.w_assoc, Arrow.w_assoc, h]
· exact h
CategoryTheory.Arrow.hom_inv_id_left
theorem
(e : f ≅ g) : e.hom.left ≫ e.inv.left = 𝟙 _
@[reassoc (attr := simp)]
lemma hom_inv_id_left (e : f ≅ g) : e.hom.left ≫ e.inv.left = 𝟙 _ := by
rw [← comp_left, e.hom_inv_id, id_left]
CategoryTheory.Arrow.inv_hom_id_left
theorem
(e : f ≅ g) : e.inv.left ≫ e.hom.left = 𝟙 _
@[reassoc (attr := simp)]
lemma inv_hom_id_left (e : f ≅ g) : e.inv.left ≫ e.hom.left = 𝟙 _ := by
rw [← comp_left, e.inv_hom_id, id_left]
CategoryTheory.Arrow.hom_inv_id_right
theorem
(e : f ≅ g) : e.hom.right ≫ e.inv.right = 𝟙 _
@[reassoc (attr := simp)]
lemma hom_inv_id_right (e : f ≅ g) : e.hom.right ≫ e.inv.right = 𝟙 _ := by
rw [← comp_right, e.hom_inv_id, id_right]
CategoryTheory.Arrow.inv_hom_id_right
theorem
(e : f ≅ g) : e.inv.right ≫ e.hom.right = 𝟙 _
@[reassoc (attr := simp)]
lemma inv_hom_id_right (e : f ≅ g) : e.inv.right ≫ e.hom.right = 𝟙 _ := by
rw [← comp_right, e.inv_hom_id, id_right]
CategoryTheory.Arrow.square_to_iso_invert
theorem
(i : Arrow T) {X Y : T} (p : X ≅ Y) (sq : i ⟶ Arrow.mk p.hom) : i.hom ≫ sq.right ≫ p.inv = sq.left
/-- Given a square from an arrow `i` to an isomorphism `p`, express the source part of `sq`
in terms of the inverse of `p`. -/
@[simp]
theorem square_to_iso_invert (i : Arrow T) {X Y : T} (p : X ≅ Y) (sq : i ⟶ Arrow.mk p.hom) :
i.hom ≫ sq.right ≫ p.inv = sq.left := by
simpa only [Category.assoc] using (Iso.comp_inv_eq p).mpr (Arrow.w_mk_right sq).symm
CategoryTheory.Arrow.square_from_iso_invert
theorem
{X Y : T} (i : X ≅ Y) (p : Arrow T) (sq : Arrow.mk i.hom ⟶ p) : i.inv ≫ sq.left ≫ p.hom = sq.right
/-- Given a square from an isomorphism `i` to an arrow `p`, express the target part of `sq`
in terms of the inverse of `i`. -/
theorem square_from_iso_invert {X Y : T} (i : X ≅ Y) (p : Arrow T) (sq : Arrow.mkArrow.mk i.hom ⟶ p) :
i.inv ≫ sq.left ≫ p.hom = sq.right := by simp only [Iso.inv_hom_id_assoc, Arrow.w, Arrow.mk_hom]
CategoryTheory.Arrow.squareToSnd
definition
{X Y Z : C} {i : Arrow C} {f : X ⟶ Y} {g : Y ⟶ Z} (sq : i ⟶ Arrow.mk (f ≫ g)) : i ⟶ Arrow.mk g
/-- A helper construction: given a square between `i` and `f ≫ g`, produce a square between
`i` and `g`, whose top leg uses `f`:
A → X
↓f
↓i Y --> A → Y
↓g ↓i ↓g
B → Z B → Z
-/
@[simps]
def squareToSnd {X Y Z : C} {i : Arrow C} {f : X ⟶ Y} {g : Y ⟶ Z} (sq : i ⟶ Arrow.mk (f ≫ g)) :
i ⟶ Arrow.mk g where
left := sq.left ≫ f
right := sq.right
CategoryTheory.Arrow.leftFunc
definition
: Arrow C ⥤ C
/-- The functor sending an arrow to its source. -/
@[simps!]
def leftFunc : ArrowArrow C ⥤ C :=
Comma.fst _ _
CategoryTheory.Arrow.rightFunc
definition
: Arrow C ⥤ C
/-- The functor sending an arrow to its target. -/
@[simps!]
def rightFunc : ArrowArrow C ⥤ C :=
Comma.snd _ _
CategoryTheory.Arrow.leftToRight
definition
: (leftFunc : Arrow C ⥤ C) ⟶ rightFunc
/-- The natural transformation from `leftFunc` to `rightFunc`, given by the arrow itself. -/
@[simps]
def leftToRight : (leftFunc : Arrow C ⥤ C) ⟶ rightFunc where app f := f.hom
CategoryTheory.Functor.mapArrow
definition
(F : C ⥤ D) : Arrow C ⥤ Arrow D
/-- A functor `C ⥤ D` induces a functor between the corresponding arrow categories. -/
@[simps]
def mapArrow (F : C ⥤ D) : ArrowArrow C ⥤ Arrow D where
obj a := Arrow.mk (F.map a.hom)
map f :=
{ left := F.map f.left
right := F.map f.right
w := by
let w := f.w
simp only [id_map] at w
dsimp
simp only [← F.map_comp, w] }
CategoryTheory.Functor.mapArrowFunctor
definition
: (C ⥤ D) ⥤ (Arrow C ⥤ Arrow D)
/-- The functor `(C ⥤ D) ⥤ (Arrow C ⥤ Arrow D)` which sends
a functor `F : C ⥤ D` to `F.mapArrow`. -/
@[simps]
def mapArrowFunctor : (C ⥤ D) ⥤ (Arrow C ⥤ Arrow D) where
obj F := F.mapArrow
map τ :=
{ app := fun f =>
{ left := τ.app _
right := τ.app _ } }
CategoryTheory.Functor.mapArrowEquivalence
definition
(e : C ≌ D) : Arrow C ≌ Arrow D
/-- The equivalence of categories `Arrow C ≌ Arrow D` induced by an equivalence `C ≌ D`. -/
def mapArrowEquivalence (e : C ≌ D) : ArrowArrow C ≌ Arrow D where
functor := e.functor.mapArrow
inverse := e.inverse.mapArrow
unitIso := Functor.mapIso (mapArrowFunctor C C) e.unitIso
counitIso := Functor.mapIso (mapArrowFunctor D D) e.counitIso
CategoryTheory.Functor.isEquivalence_mapArrow
instance
(F : C ⥤ D) [IsEquivalence F] : IsEquivalence F.mapArrow
instance isEquivalence_mapArrow (F : C ⥤ D) [IsEquivalence F] :
IsEquivalence F.mapArrow :=
(mapArrowEquivalence (asEquivalence F)).isEquivalence_functor
CategoryTheory.Arrow.isoOfNatIso
definition
{F G : C ⥤ D} (e : F ≅ G) (f : Arrow C) : F.mapArrow.obj f ≅ G.mapArrow.obj f
/-- The images of `f : Arrow C` by two isomorphic functors `F : C ⥤ D` are
isomorphic arrows in `D`. -/
def Arrow.isoOfNatIso {F G : C ⥤ D} (e : F ≅ G)
(f : Arrow C) : F.mapArrow.obj f ≅ G.mapArrow.obj f :=
Arrow.isoMk (e.app f.left) (e.app f.right)
CategoryTheory.Arrow.equivSigma
definition
: Arrow T ≃ Σ (X Y : T), X ⟶ Y
/-- `Arrow T` is equivalent to a sigma type. -/
@[simps!]
def Arrow.equivSigma :
ArrowArrow T ≃ Σ (X Y : T), X ⟶ Y where
toFun f := ⟨_, _, f.hom⟩
invFun x := Arrow.mk x.2.2
left_inv _ := rfl
right_inv _ := rfl
CategoryTheory.Arrow.discreteEquiv
definition
(S : Type u) : Arrow (Discrete S) ≃ S
/-- The equivalence `Arrow (Discrete S) ≃ S`. -/
def Arrow.discreteEquiv (S : Type u) : ArrowArrow (Discrete S) ≃ S where
toFun f := f.left.as
invFun s := Arrow.mk (𝟙 (Discrete.mk s))
left_inv := by
rintro ⟨⟨_⟩, ⟨_⟩, f⟩
obtain rfl := Discrete.eq_of_hom f
rfl
right_inv _ := rfl
CategoryTheory.Arrow.functor_ext
theorem
{F G : C ⥤ D} (h : ∀ ⦃X Y : C⦄ (f : X ⟶ Y), F.mapArrow.obj (Arrow.mk f) = G.mapArrow.obj (Arrow.mk f)) : F = G
/-- Extensionality lemma for functors `C ⥤ D` which uses as an assumption
that the induced maps `Arrow C → Arrow D` coincide. -/
lemma Arrow.functor_ext {F G : C ⥤ D} (h : ∀ ⦃X Y : C⦄ (f : X ⟶ Y),
F.mapArrow.obj (Arrow.mk f) = G.mapArrow.obj (Arrow.mk f)) :
F = G :=
Functor.ext (fun X ↦ congr_arg Comma.left (h (𝟙 X))) (fun X Y f ↦ by
have := h f
simp only [Functor.mapArrow_obj, mk_eq_mk_iff] at this
tauto)