Lecture 4: Natural Transformations

 

This is the last lecture from NITheCS October 2021 Mini-School.

4.1. The Notion of a Natural Transformation

Consider functors F and G between two categories, denoted by blackboard bold C and blackboard bold D:

A natural transformation from the functor F to the functor G is defined as follows.
Let us unpack this definition. As every other mathematical idea, a natural transformation consists of a "structure" having a certain "property". The structure of a natural transformation is given by a system of arrows in the target category (the target category of functors F and G). This system of arrows is parametrized by objects of the source category. For each object "t" of the source category, there is an associated arrow
in the category (blackboard bold) D. As shown above, the source of that arrow is the object F(t) in D, and the target is G(t). This system of arrows must have the following property in order for it to be called a natural transformation from the functor F to the functor G. The property is given by the equalities
-- one for each arrow 
in the source category (blackboard bold) C. The property states that every such equality must hold true. Drawing all arrows in such equality, we get the following diagram:
The equality states that the left vertical arrow composed with the bottom horizontal arrow (the RHS of the equality) gives the same result as composing the top horizontal arrow with the right vertical arrow (the LHS of the equality): in the language of category theory, this equality states that the displayed rectangle of arrows must commute.

A natural transformation is to be thought of as a "transformation" of functors, just like a functor is thought of as a "transformation" of categories. So a natural transformation is an "arrow between arrows":
In the picture above, the two ovals represent the source and the target categories of the functors F and G. Note that in order for there to be a natural transformation from F to G, the two functors need to have the same source and the same target. The vertical arrow in this picture represents a natural transformation from F to G. In some sense, a natural transformation measures the difference between the values F(t) and G(t), for each object ''t" in the source category. This measure is given by an arrow with source F(t) and target G(t) in the target category (the category represented by the RHS oval in the picture above). There are as many such arrows as there are objects "t" of the source category. More, precisely, for each object "t" one such arrow is specified. In the definition of a natural transformation we represented each of these specified arrows by sigma with subscript "t". By measuring the differences between individual values F(t) vs G(t) of the two functors, we are providing an overall measure of the difference between the functors F and G. However, there is one requirement: this overall measure must be compatible with transition of objects given by arrows of the source category of the two functors. This is the commutativity requirement discussed earlier.
The picture above illustrates the compatibility requirement corresponding to each arrow in the source (LHS) category: for each arrow "a", the diagram in the RHS category must commute, i.e., the two composites from top left corner of the rectangle to the bottom right corner must equal. To get a better intuition for this requirement, we set up an example described in the next two sections.

4.2. Evolving Sets

We will now illustrate how the notion of a functor can be used to formalize the idea of a "set changing over time", or what we call below an "evolving set". First, we describe this notion intuitively. We will then start generating a mathematical notion based on the intuitive one.

An ordinary (static) set is fully described by its members, which are called elements of the set. A set is a raw information of what its elements are. Imagine now that this information depends on at which point in time we examined elements of the set. At time "1" we may find that the set has elements 3, 5, 6, while at time "2" we see that it has, in addition, an element 7. We can write this as follows:
Here "S" represents our "evolving set", and the subscript indicates its state at a given time. Let us assume furthermore that the elements may change their form over time, but that once an element "appeared" it will never disappear, although two elements may merge into one. 

To give a precise mathematical definition of an evolving set, we first need to set up a time category, different from the one we set up in the previous lecture. We will call it the modified time category. Its objects are time instances, which we will represent by positive real numbers. Between any two such real numbers t and t' there is always at most one arrow: there is an arrow from t to t' when 
and there is no such arrow when the above does not hold. It is easy to see that we get a category. There is in fact only one way of defining composition, due to the fact that between any two objects there is at most one arrow. Furthermore, it is possible to define it, since if t is less or equal t', and t' is less or equal to t'', then t will be less or equal to t''. Composition will be forced to be associative again because of the fact that between any two objects there is at most one arrow. The special arrows do exist, since t is always less or equal to itself (to confirm that the unique looping arrows are special, we will need once more to use the fact that between any two objects there is at most one arrow). This completes the description of the modified time category. 

An evolving set can now be formally as a functor from the modified time category to the category of sets. We will use the following illustration to explain why such functor fully captures our intuitive idea of an evolving set.
In this illustration, the top left region is a fragment of the modified time category. It displays three of its objects and all possible arrows between them. The large bottom right region is a fragment of the category of sets. The arrows that connect these two regions indicate how the functor acts on the objects and the arrow from 1 to 2 of the modified time category. This illustration reveals that the functor assigns to each time t the set that we think of as the state of our evolving set at time t. Thus, in general, we have:
Let us write the result of the action of the functor on an arrow in the modified time category as indicated below.
The resulting arrow is an arrow in the category of sets, and so it is a function from the state of the set at time t to the state of the set at time t'. This function encodes the information about change-of-form of individual elements: an element x of the set at time t changes its form into the value of this function at x, when time reaches t'. By the definition of a function, every element in the source must map to some element in the target, but two elements in the source may map to the same element in the target. This corresponds to our requirement on an evolving set that "the elements may change their form over time, but that once an element appeared it will never disappear, although two elements may merge into one". Recall that a functor needs to preserve the special arrows as well as composition. In one of the exercises below you will get convinced that these two requirements should obviously hold, when translated to our intuition on evolving sets, even though we never made these requirements explicit. It is actually one of the features of category theory that using the right categorical notions when formalizing an intuitive idea, we are automatically offered some details of the formal definition, which otherwise would have required some further work to discover. 

4.3. Functions Between Evolving Sets

We will now see that the notion of a natural transformation between functors, when specialized to evolving sets seen as functors as described above, will give us a suitable notion of a function between evolving sets. Let F and G be two evolving sets, seen as functors from the modified time category to the category of sets. Then a natural transformation from F to G is a system of arrows in the category of sets, parametrized by the objects of the modified time category. Thus, for each time instance t (i.e., for each positive real number t), we have an arrow from the state of the evolving set F at time t to the state of the evolving set G at time t. This arrow is in the category of sets, and so it is a function in this category: it maps elements of F at time t, to elements of G at time t. Here is an illustration for one such mapping, where F has four elements at time t and G has six elements at time t:
So we are basically saying that a function from an evolving set F to an evolving set G is a function between the two sets frozen at each given point in time. The sets, however, change over time, and we would probably want the functions to take that into account. This will be guaranteed by the axiom of a natural transformation: the one that requires certain rectangles of arrows to commute. If the Greek symbol sigma denotes the natural transformation (i.e., the function between evolving sets) in question, then recall that according to the natural transformation axiom we want to have the following equality of composites 
where: 
  • the subscripts are time instances (since they are objects of the source category of the two functors, which is the modified time category),
  • so the sigma with the subscript t subscript 1, is the function between F and G at time t subscript 1,
  • while the sigma with the subscript t subscript 2, is the function between F and G at time t subscript 2;
  • "a" is an arrow from time t subscript 1 to time t subscript 2, in the modified time category, and so it represents the fact that 
  • F(a) represents the function which describes how elements of F reform between the two time instance above; G(a) represents a similar function for the evolving set G.
Let us put all of this in one picture -- the same picture we used to define a natural transformation:
This time, the left hand side category is the modified time category and the right hand side category is the category of sets. So what does commutativity of the right hand side square (i.e., the equality of composites given above) mean in terms of our intuition about a function between evolving sets? Pick an element x in the top left corner of that rectangle. It represents an element of the evolving set F, as identified at time instance t subscript 1. Mapping this element along the blue vertical arrow represents applying the function sigma to it in the same time instance when the element was identified. Let y denote the result of this mapping. Then, mapping y further by G(a) we get an element y', which is the reformed element y. Commutativity of the rectangle means that this y' must match with result of mapping the element x reformed in F during the same interval of time that resulted in y reforming to y'. Consider the following particular instance of this rectangle, where all elements we just spoke of (and more) are shown:
In this drawing, y'' represents the result of mapping the reformed version x' of the element x. According to the fact that sigma is a natural transformation (i.e., commutativity of the rectangle, which is now tilted a bit), the elements y' and y'' must actually be equal to each other. So, applying the function to an element and then waiting for the result to reform, we should get the same value as first waiting for the element to reform (during the same time interval) and then applying the function. Thus, intuitively, the natural transformation requirement is a requirement of time-invariance of the function: it says that the values of the function between evolving sets should not depend on the time when those values are computed. 

4.4. Conclusion

As a tool, category theory provides intuitive building blocks for formalizing complex mathematical phenomena. Set theory enables fully rigorous formalization of mathematics. Rigor comes at a cost of heavy technical language, which often hinders simple intuitive ideas as well as possible links between them. The purpose of category theory is to remedy this. The concepts of category, functor and natural transformation are the most basic building blocks in terms of expressing mathematical phenomena using the language of categories. They can be seen as elementary conceptual components of more complex mathematical notions and ideas. The notion of an evolving set discussed in the lecture in itself does not play such a significant role in mathematics. However, it is a good example to illustrate, on the one hand, the process of formalizing intuitive ideas into fully developed mathematical concepts, and on the other hand, getting some intuition behind the notion of a natural transformation.

In the lectures we have tried to limit introduction of technical notation and terminology. In some cases we went overboard with this. To rectify this, we include here the standard technical terminology for those concepts where we used ad-hoc intuitive terms (the exercises below will be formulated in this more correct terminology):
  • An arrow between objects of a category is more typically called a morphism. What we were referring to as vertices in a category are called objects of the category (as it became apparent in later lectures).
  • A special arrow in a category that loops in an object X (i.e., a looping arrow that composed with arrows on either side leaves those arrows unchanged) is called an identity arrow of the object X.
  • A directed graph in the sense that we defined in the first lecture (when multiple arrows are allowed between vertices) is called in category theory simply a graph.
  • Source and target of a function/morphism/functor are called, respectively, domain and codomain of the function/morphism/functor.
Some terminology that we did not introduce, but should have:
  • A category having only one object is called a monoid. Since there is only one object, we can forget about it and then will be left with a set equipped with an associative binary operation admitted an identity element -- a monoid in the classical sense. Our time category is thus an example of a monoid. 
  • A category where between any two objects there is at most one arrow (in either direction) is called a partially ordered set. Our modified time category is such. Also, the category where objects are natural numbers and arrows are given by the divisibility relation is such. 

4.5. Exercises

Exercise 1. Given an intuitive explanation of functoriality of an evolving set (i.e., of preservation of composition and identity morphisms). 

Exercise 2. Come up with a way of composing natural transformations so that functors from one category to another itself forms a category, where morphisms are natural transformations. What are identity morphisms in this category?

Exercise 3. The modified time category introduced in this lecture has a natural functor to the time category introduced in the previous lecture. Recall that the time category has only one object, so the functor in question will map all objects of the modified time category to that unique object of the time category. An arrow from time instance t to times instance t' will be mapped to the arrow t'-t. Show that this indeed defined a functor. What happens when we compose this functor with a dynamical system (recall that a dynamical system is a functor from the time category to the category of sets)? Hint: first, define composition of functors in general and prove that the composite of two functors is also a functor.

Exercise 4. Consider a category where the collection of all arrows forms a set. Construct a functor from this category to the category of sets by mapping each object X to the set of all arrows with codomain X. Is it true that this functor maps different objects to different sets and different morphisms to different functions? The answer is yes, and so this functor enables a representation of any category as a category of sets and functions (not all functions, and not all sets, but with composition being the usual composition of functions and identity morphisms being the usual identity functions). This functor can be found already in the very first paper on category theory -- see the Appendix of General Theory of Natural Equivalences by S. Eilenberg and S. Mac Lane.

Note: for the following exercise, you will need to be familiar with the mathematical notions of a ring and of a group.

Exercise 5. Let n be a natural number. Establish two functors from the category of commutative rings to the category of groups. The first functor must map a ring to the multiplicative group of n-by-n square invertible matrices whose entries are elements of the ring. The second functor must map a ring to the multiplicative group of its invertible elements. Furthermore, describe a natural transformation between these functors, given by mapping each invertible matrix to its determinant.

Comments

Popular posts from this blog

Lecture 1: Categories

Lecture 2: Products