definition example theorem

In a (locally small) Category the assignment is a Functor

the hom-functor — a Profunctor. On arrows and it sends to (pre-compose with , post-compose with ; Haskell dimap f g h = g . h . f). Fixing one variable:

  • covariant , with (post-composition): “the world according to ” — all arrows out of organized coherently; an oracle answering “is connected to me?”;
  • contravariant , with (pre-composition): “the picture of as seen by the world”; “am I connected to ?“.

Sources: DaoFP §8.4 (“The Hom-Functor”), §9.1, §9.7, §17.4 (“Continuity of the Hom-Functor”), §20.2 (enriched hom-functor); Kittenlab Lecture 8, 10 (the covariant representable , “the shape of the information about all morphisms out of an object is a -set”); 7 Sketches §3.4.2 (naturality of adjunctions is naturality of maps between hom-functors ), Exercise 1.66.

Properties.

  • The profunctor is a proof-relevant relation: each element is a proof that is connected to ; empty means unrelated (DaoFP). For preorders, is the truth value of (upper sets , Yoneda Lemma for Preorders).
  • Isomorphisms. If then and ; conversely a natural family of such isomorphisms gives (Isomorphism, Yoneda Lemma).
  • Continuity (DaoFP §10.7, §17.4): preserves limits, , and turns colimits into limits, (“the hom-functor preserves colimits”) — because a cone in with apex over is exactly a cone over with apex . This is the engine behind Right Adjoints Preserve Limits.
  • Currying the hom-functor gives the Yoneda Embedding and the co-Yoneda . In a Monoidal Closed Category the hom-functor is enriched, (DaoFP §20.2), and internal homs represent it: .

Docs: C-set morphisms · ACSets API · Graphs — Kittenlab Lecture 8

# Kittenlab Lecture 8/10: the representable Hom(x, -) on a finitely presented category as a C-set;
# for graphs, Hom(V,-) is the one-vertex graph and Hom(E,-) the one-edge graph.
using Catlab
yV = @acset Graph begin V = 1 end
yE = @acset Graph begin V = 2; E = 1; src = [1]; tgt = [2] end
G = path_graph(Graph, 3)
length(homomorphisms(yV, G)), length(homomorphisms(yE, G))   # (3, 2) = (#vertices, #edges)
#check CategoryTheory.Functor.hom     -- Cᵒᵖ × C ⥤ Type v, the hom-functor as a profunctor
#check CategoryTheory.coyoneda        -- Cᵒᵖ ⥤ (C ⥤ Type): a ↦ Hom(a, -)
#check CategoryTheory.yoneda          -- C ⥤ (Cᵒᵖ ⥤ Type): b ↦ Hom(-, b)
-- the hom-functor of Hask is the function type, a profunctor
class Profunctor p where
  dimap :: (a' -> a) -> (b -> b') -> (p a b -> p a' b')
 
instance Profunctor (->) where
  dimap f g h = g . h . f       -- pre-compose with f, post-compose with g
 
-- fixing the source: the covariant hom-functor (a -> -), i.e. the Reader functor
newtype Reader a x = Reader (a -> x)
instance Functor (Reader a) where fmap g (Reader h) = Reader (g . h)   -- post-composition