definition example

Let and be -categories. A -functor consists of a function such that

Sources: 7 Sketches Definition 2.69, Examples 2.70, 2.72, Exercise 2.73; DaoFP §20.2; the ordinary case is Functor.

The analogy: preorder is to -category as Monotone Map is to -functor (Example 2.70). Likewise a Cost-functor between Lawvere metric spaces is a function with : a 1-Lipschitz (distance non-increasing) map (Example 2.72) — “a friend from the theory of metric spaces”. A dagger -category is one where the identity is a -functor (7S Exercise 2.73).

In a monoidal category (DaoFP §20.2)

When is a Monoidal Category, a -functor maps objects to objects and hom-objects to hom-objects via -morphisms that commute with composition and identity (diagrams in ). Both categories must be enriched over the same . Examples:

  • The Hom Functor of a category enriched in a closed (treating as self-enriched); its action on hom-objects is built by currying and composing twice. Lifting a global element gives as , then , then .
  • Enriched co-presheaves with ; enriched profunctors .
  • is a -functor when is closed (DaoFP Exercise 20.2.2).
  • A Haskell Functor is an enriched endofunctor of (self-enriched): fmap :: (a -> b) -> (f a -> f b) maps internal homs. In a self-enriched category, enriched endofunctors are exactly strong endofunctors: strength gives , and conversely enrichment gives strength via the coevaluation — in Haskell strength (a, bs) = fmap (a,) bs.

Docs: Vignette: monoidal preorders & SMCs

Builds on: Enriched Category (VCategory) — run that note’s Julia code first.

# check a V-functor between finite V-categories given as an object map (Dict)
function is_vfunctor(X::VCategory, Y::VCategory, F::Dict)
  ix = Dict(o => i for (i, o) in enumerate(X.objects)); iy = Dict(o => i for (i, o) in enumerate(Y.objects))
  all(leq(X.base, X.hom[ix[a], ix[b]], Y.hom[iy[F[a]], iy[F[b]]]) for a in X.objects, b in X.objects)
end
#check CategoryTheory.EnrichedFunctor      -- EnrichedFunctor V C D
-- Mathlib: `Monotone.functor` is the Bool-enriched case; `LipschitzWith 1` the Cost case
#check LipschitzWith
-- a V-functor on finite V-categories: an object map satisfying hom x y <= hom (F x) (F y)
isVFunctor :: (MonoidalPreorder v, Eq o, Eq o') => VCat v o -> VCat v o' -> (o -> o') -> Bool
isVFunctor (VCat os h) (VCat _ h') f = and [ leq (h x y) (h' (f x) (f y)) | x <- os, y <- os ]
 
-- Hask-enriched endofunctor = Functor; enrichment gives strength for free
strength :: Functor f => (a, f b) -> f (a, b)
strength (a, bs) = fmap (\b -> (a, b)) bs