imagine image of functors , as lying in sheets.
Then a nautural transformation goes "perpendicular to these sheets. Often,
knowing the natural transformation at one point determines it at every other point, if the
category is rich-in-morphisms (eg. Set is very rich in morphisms). Now if we think of
(category of functors from to ), we have all the Hom functors here, such as ,
, etc. We may have some other functor .
If this functor is isomorphic to some Hom-functor , then the functor is said
to be a representable functor since it is represented by a single object through .
PArametric polymorphism in haskell, that forces us to write one formula for all types makes
these functions automatically natural transformations. So any implementation of a function
such as foo :: Maybe a -> [a] will automatically be a nautral transformation (?)
Let's try and check if the list functor is representable. If I pick foo :: (Integer -> x) -> [x]
this direction can be implemented as foo f = fmap f [0,1..]. On the other hand, the
other way round does not work: foo:: [x] -> (Integer -> x) can't always be implemented. It's
not representable (proof by haskell intuition).
{-# LANGUAGE ExplicitForAll #-}{-# LANGUAGE RankNTypes #-}{-# LANGUAGE TypeFamilies #-}{-# LANGUAGE InstanceSigs #-}type Hom a b = a -> btype Nat f g = forall x. f x -> g xclass Representable f where type Rep f :: * -- the representing object o whose Hom(o, -) ~= f -- tabulate :: Nat (Hom (Rep f)) f -- tabulate :: forall x. Hom (Rep f) x -> f x tabulate :: forall x. ((Rep f -> x)) -> f x -- index :: Nat f (Hom (Rep f)) -- index :: forall x. f x -> (Hom (Rep f) x) index :: forall x. f x -> (Rep f -> x)Stream is representable:
data Stream a = Cons a (Stream a)instance Representable Stream where type Rep Stream = Integer tabulate i2x = go i2x 0 where go :: (Integer -> x) -> Integer -> Stream x go f i = Cons (f i) (go f (i+1)) index :: Stream x -> Integer -> x index (Cons x xs) n = case n of 0 -> x; not0 -> index xs (n-1)In general, things that are products tend to be representable, while things that are sums tend not to.
§ Every presheaf is a colimit of representables
- Roughly, every presheaf can be written by "gluing" (union + equivalence relation/colimit) functors of the form .
- Let be the presheaf. To say that it can be written as a colimit of Hom-sets, this means that we have some (yet unknown) diagram such that is the colimit of such a set.
- Unwrapping what this means, it means that we have a functor such that the image of is always a hom-set. That is, .
- Furthermore, since is a colimit, we have arrows of the form .
- Recall that such an arrow is a natural transformation between and .
- Also recall that by the Yoneda lemma, such natural transformations are in natural bijection with elements in . So at some point, we'll probably need to pick elements . =
- We're not done yet, this is what one part of what it means to be a colimit; we also need all the diagrams to commute!
- (1) the embedding natural transformations arrows commute with image of the arrows in , of the form .
- (2) that is the universal object in such that this rats nest of hom-sets embeds perfectly into .
- Now the problem boils down to designing a which picks out enough hom-sets and relations between the hom-sets such that is the colimit of such a .
- The idea, once, again, goes back to (a) Yoneda, and (b) Grothendeick.
- It appears that to be able to pick out such embedding arrows for the co-cone , we need elements .
- Soo let's build a category that does exactly that; This new category called as a Grothendieck construction .
- Given a category and a presheaf , this new category called has as objects pairs of the form .
- So we have a pair of an abstract object , and an element of its set , as , as is a presheaf, thus has the type .
- The arrows in this category are derived from arrows in the original category . Such an arrow lifts to a set-function thanks to the presheaf, .
- If we now have , we can then build an arrow in which takes .
Picture speaks a thousand words:
C | c -a→ dSet | P(c) -P(a)→ P(d)Set | u ∈ P(c) -P(a)→ d ∋ P(a)(u)el P | (c∈C, u∈P(c))el P | (c∈C, u∈P(c)) -el a→ (d∈C, P(a)(u)∈P(d))- So, this category gives us a way to "locate ourselves" within the set , which will be instrumental in creating the arrows (natural transformations) of the form , as asked of us by the cocone.
- This also hints at why we use colimis and not limits: because the yoneda goes from the to , we can only conjure arrows into via Yoneda, thereby forcing us to use a colimit.
- We claim that we should choose the diagram category as , with the diagram functor given by .
- This embeds where is a way to locate 's view of as a Hom-set .
- To give the natural transformation from the image of the diagram to the apex of the cocone , we use Yoneda: We need an arrow , which we know is in bijection with elements of through yoneda.
- Luckily, we have to invoke yoneda, so we build the arrows from to , given by applying Yoneda to .
- Thus, we can at least form a cocone. Whether the arrows of the "base" of the cocone commute with the apex-pointing arrows, and whether this is universal is to be checked next.
- Given some other cocone , with co-cone morphisms , we need to create a natural transformation . Let's do this pointwise.
- For some , we need to build a map . Since the domain and codomain are pointwise, let's pick some element .
- See that this can be seen as an element which is an element of the category .
- But, recall that this was our index category . Thus, there is going to be an arrow since is a cocone.
- But since , it's an element of . We have thus found a way to map into by "pulling back" into the index category and then "pushing forward" via Yoneda. [What the fuck is actually happening here? ]
§ Simplified construction of
- Recall that consisted of a pair . We know from Yoneda that set elements of are in bijection with natural transformations .
- Thus consists of all natural transformations [for all objects ].
- The arrows in between and are pushforwards of arrow (given by ) which make the diagram commute:
ηHom(-, x) >------->P v ^ |arrow: / | \h -> f.h / μ v /Hom(-, y)>-----*- Consider the functor which sends each natural transformation to just (ie, forget the mapping, just keep the domain of the natural transformation.
- We claim that is the cocone of the functor . So we must have mappings from each into .
- These mappings from into are given by "un-forgetting" the data we forgot when mapping . These commute by the construction of .
- (Are these the only choices of maps? Maybe there are others, not just the ones we "un-forgot"!)
- Next we need to check that is universal. Consider some other . We must show a map (ie, the cocone factorizes through , or is initial cocone.).
- Let's do this pointwise. So we want to define a family .
- Pick some element . This corresponds to some natural transformation . We know that we have a corresponding . this is some element . So we are forced to set when we try to map to .
- This works for arbitrary , so the entire map is determined. This proves that is terminal cocone.
- Reference
- Density theorem proof #Proof)