Lean4
/-- Given two presheaves `F` and `G` on a category `C` with values in a category `A`,
this `presheafHom F G` is the presheaf of types which sends an object `X : C`
to the type of morphisms between the "restrictions" of `F` and `G` to the category `Over X`. -/
@[simps! obj]
def presheafHom : Cᵒᵖ ⥤ Type _
where
obj X := (Over.forget X.unop).op ⋙ F ⟶ (Over.forget X.unop).op ⋙ G
map f := Functor.whiskerLeft (Over.map f.unop).op
map_id := by
rintro ⟨X⟩
ext φ ⟨Y⟩
simpa [Over.mapId] using φ.naturality ((Over.mapId X).hom.app Y).op
map_comp := by
rintro ⟨X⟩ ⟨Y⟩ ⟨Z⟩ ⟨f : Y ⟶ X⟩ ⟨g : Z ⟶ Y⟩
ext φ ⟨W⟩
simpa [Over.mapComp] using φ.naturality ((Over.mapComp g f).hom.app W).op