# Dinatural transformations

To kick off my first blog post I thought I’d write a short technical post about a specific category theory topic I’ve recently learned about. Namely, I’ll tell you about *dinatural transformations* and how you could have arrived at the definition found on Wikipedia yourself! I’ll assume you understand categories, functors, natural transformations, commutative diagrams, and notions of covariance/contravariance. This isn’t meant to highlight any uses or convince you to start thinking about dinatural transformations. The goal of this short post is merely to paint an intuitive picture of why the definition is the way it is. So let’s dive right in!

This is the plan: we will start with a natural transformation and then slowly tweak it until we arrive at a dinatural transformation. Sounds simple, right?

Recall what a natural transformation is. Given two functors that have the same domain and codomain, a natural transformation is a map between them:

The domain and codomain of these functors can be any categories we want. A special case is when the domain of both functors and is the product category (you can think of and as profunctors, but that won’t be the center of the story here).

This lays the groundwork to start talking about a *dinatural* transformation. Just as a natural transformation is a special map between functors whose domain and codomain are *any* two categories, a *dinatural* transformation is a also map between two functors , with one key difference. The domain of these functors can’t be *any* category – but rather the product category , for any . The codomain can still be any category.

This is an important difference that will enable us to actually define a dinatural transformation as a generalization of a natural transformation. That is, every natural transformation is also a dinatural transformation, but not vice-versa. Again, note that this statement only makes sense when the functors are of the type - you can’t generalize a natural transformation to a dinatural one when the functors are of a different type.

To actually understand what’s going on and what a dinatural transformation is, we need to understand the functors it maps between. To understand those functors, we need to understand the categories at hand. So let’s take a step back and let’s first understand the product category .

Given any morphism in the *original* category , the following square in the *product category* has to commute:

Note that each morphism is actually a pair of morphisms and that every drawn morphism always has one component of the pair set to identity. This allows us to actually draw them as arrows - inverting them in the case of the morphisms in . Another way to say this diagram commutes is to say that, starting at the top-left corner, using just (and identity maps) there are three ways to arrive at the bottom-right corner. We can first go in one direction and then in the other direction, vice-versa, or going both direction at the same time (this arrow isn’t drawn). It does not matter which of these we choose.

Now we can move on to a functor . Since every functor has to preserve commutative diagrams, that means that, given any morphism in and a functor , the following square has to commute in :

Simple enough! Moving on further to a natural transformation, we’ll have two such functors and a way to link them. A natural transformation to every object in assigns a morphism such that the following square commutes:

In our case, we have commutative squares for the two of our functors (since their domain is a product category), let’s draw out in detail the entire commutative diagram. This diagram will turn out to be a cube! That is, given a morphism in , the following cube has to commute:

We are getting quite close! A dinatural transformation is a mere one step away, but we first need to understand what we have done so far. We’ve taken two ingredients 1) two functors whose domain is and 2) a natural transformation - and combined them into the commutative cube above. To define a *dinatural* transformation, however, we can’t change either of these things separately and *then* combine them, we have to work with the commutative cube itself. This is why the definition of the dinatural transformation on Wikipedia or nLab looks a bit strange - you can think of the coherence condition of a dinatural transformation as the *commutative cube with some pieces removed*. Which ones? The non-diagonal naturality morphisms! I’ll show the new diagram and then explain what’s going on.

What happened here is two things. First, we removed all non-diagonal naturality morphisms. That is, the only morphisms we have are those of type , for any object in . Second, since we only have the diagonal morphisms, we lost the second index in and call the dinaturality morphisms just .

The story is almost complete. A *dinatural* transformation between two functors is a map which to every object in associates a map such that… what commutes? This new naturality condition now has some loose ends. Let’s see what is going on. Naturality condition is supposed to equate different path choices in a graph that *contain the naturality morphisms*. Observe that some morphisms (colored blue) are not part of any new paths that contain the new naturality morphisms (that is, you can’t find a path that contains both red and blue morphisms).

This means that we can safely remove the blue morphisms, since they do not play any role in our dinatural transformation.

After doing so, we end up with a new, hexagonal diagram. But that is just the usual the usual hexagon diagram found as found on Wikipedia! If you look closely you will see it is just a rotated version of the one I’ve drawn here.

And this is it, we have defined a dinatural transformation! A *dinatural* transformation between two functors is a map which to every object in associates a map such that the diagram above commutes. The main takeaway from this post should be that the hexagonal diagram is just a diagram of the commutative cube with some morphisms removed.