Word count: 5196
Throughout this post I’ll use the ice cube emoji, 🧊, to stand for the category of cubes, which is more traditionally written □ (a blank square). The reason for this is that I have a really convenient emoji picker, so when I write about cubes on Twitter, it’s a lot easier to call the category 🧊 (maybe 4 keystrokes to select) rather than looking up the proper symbol on Google.
If you can’t see this symbol - 🧊 - then you should probably download an emoji font.
In which I try to write about semantics. This is not gonna go well, but I’m gonna try my best. I’ve heard it on good authority that the best way to learn something is to explain it to someone else, so in this post I’m going to use you, dear reader, as my rubber duck while I try to understand cubical sets. These are important (to me) because they provide a semantic model of cubical type theory (which I have written about previously), and since we have a semantic model, that theory is (semantically) consistent.
Personally, I like to think of a cubical set as.. a set that has opinions about cubes. You can ask some cubical set (the letter is meant to be indicative of its nature, as we will see) about its opinion on the 0-cube, and it’ll give us a set of points. We could ask it about the line, and it’ll give us a set of lines, and so on and so forth. There are also, as we shall see, maps between cubes, and asking about these will give us maps between what it thinks those cubes are.
A disclaimer (which I won’t put in one of the big red warning boxes like above) is that I am not a category theorist! Most of this stuff I absorbed from reading various papers about the semantics of cubical type theory. This post is not really what I would call “a good reference”.
The Category of Cubes 🧊
The category of cubes has a concise description in category-theoretic terms but I would rather describe it like this: It’s the category in which the objects are all powers of the set of booleans, , which we abbreviate to . To describe the maps in the category of cubes, I’m going to upset category theorists and describe them concretely, as functions of sets, written in a “pattern matching” notation similar to Haskell. However, we will only “pattern match” on products.
The faces, which exhibit a cube as a face of a larger cube. Concretely, a face map inserts either a 0 or a 1 somewhere along the tuple, taking an -cube to an -cube. The two most basic face maps take the 0-cube (a point) to either endpoint of the 1-cube (a line), defined by and .
As further examples, we have functions (for ) which map the 1-cube (a line) into the 2-cube (a square), as any of its 4 faces. These are, explicitly, , , , and .
These also compose. For instance, the map exhibits the point
()
as(0, 1)
-th corner of a square. If we take the first coordinate to be the left-right direction (0 = left) and the second coordinate to be the up-down (0 = up) direction, then this composite map can be pictured as follows:The actual, concrete effect of can be seen by evaluating the composite at the unique inhabitant of , which is (the empty tuple). We have .
The degeneracies, which “collapse” an -cube to an -cube by deleting a dimension. The most basic degeneracy is given by the unique map . There are two degeneracies , mapping a square to a line, by deleting either coordinate. These… don’t have very nice pictoral representations, at least in the category of cubes. We’ll see that when it comes to a cubical set, though, they are quite easy to diagram.
We also have the trivial map which returns its argument -tuple (cube) unchanged. It’s easy to see that this is the identity for composition, which is as in . Since 🧊 is a category, we can consider standard category-theoretical operations on 🧊, like taking its opposite category, . The category has as its objects the same cubes as before, but all of the maps are backwards, so that the face maps in project a face and the degeneracies expand a cube, by inserting trivial faces.
We can also consider functors which map out of — and its opposite category! — and that’s what we’re interested in today. The functors we will talk about, those , are called cubical sets, and we’ll talk about them shortly, but first, a note:
Crucially, the category of cubes does not have any maps other than the faces and degeneracies (and identities), and importantly, any map factors as a series of degeneracies followed by a series of faces. This means we can specify a cubical set entirely by how it acts on the faces and the degeneracies.
Cubical Sets
To each object in 🧊, a set . Since the objects of 🧊 are all , these are alternatively notated .
To each map in 🧊, an arrow . Specifically, these are all composites of the faces and the degeneracies .
Hold up - aren’t those backwards? Yes, they are! Remember, a cubical set is not a functor out of the category 🧊, it’s a functor out of , so all of the arrows are backwards. To work more conveniently with cubical sets (and, in fact, more concretely) we need to take a very abstract detour through even more category theory.
The Unit Interval
Being functors , we can also form maps between cubical sets, which are natural transformations . Specifically, a map between cubical sets assigns to each cube a map , such that for any morphism , the equation holds. This condition is captured by the following diagram:
A standard construction in category theory is the Yoneda embedding functor, written (the hiragana character for “yo”), which maps an object of (in our case) into the category of cubical sets. It maps objects to the hom-set functor , which takes each object to the set of morphisms in 🧊. It takes the morphism to the natural transformation .
Let’s look at some more. It’s a natural transformation between and , so we can read that as a set of maps indexed by some . Since , we can understand that the value takes for is .
The functor gives us, for an object in the category of cubes, an object.. well, in the category of cubical sets. We’ll abbreviate as for time, since, as we’ll see, this object is very special indeed. Let’s consider, for simplicity, the unit interval cubical set, . We know it’s a functor from to — and more, we know exactly what it maps each cube to. The set of all maps from other cubes to . Turns out, above this set only contains trivial cubes, so let’s look at what and are:
For we have to consider all ways of mapping the -cube to the -cube. These are the two “base” face maps and .
For , we have to consider all ways of mapping the -cube to itself. You might think that this set is trivial, but think again (if you do): Yes, we do have the identity map , but we also have the compositions and . Since we know what the objects in the category of cubes look like, you can think of these as the constant function
f(x) = 0
andg(x) = 1
respectively, since that’s what they work out to:
- For we only have degeneracies (and compositions of degeneracies) mapping .
Now, the standard cubes don’t look very interesting. But you see, this is where I pulled a sneaky on you! Because of a result about — the Yoneda lemma. Specialised to our case, it says that for any n and any X, the sets and correspond exactly: we can probe the structure of a cubical set by examining the classes of maps to .
The Yoneda lemma
The Yoneda lemma is a result about an arbitrary category , its category of presheaves , and the functor we just defined. Its statement is as follows:
In our case, it’s interesting particularly because it says that we can explore the structure of a cubical set — a presheaf on — by analysing the maps from the standard -cube into . Furthermore, it implies the Yoneda embedding is fully faithful, by the following calculation:
It thus realises as a full subcategory of - in our case, the category as a subcategory of the category of cubical sets. This is useful because is a category with a lot of structure (as we shall see), even when doesn’t have any structure.
This also means that we can study maps between cubes by studying maps of standard cubical sets, which is good, because degeneracies in the category of cubes confuse me to death!
Cubes in Sets
Let’s look at what the maps impart on , shall we? But first, let’s reason a bit to identify how we can represent diagramatically the cubical set , by extrapolating our knowledge about the unit interval cubical set. For that case, was the set containing both “endpoints” of the unit interval, and the set contained two degenerate lines (for either endpoint — we’ll see how to think about these in the next section) and one non-degenerate line, which we think of as “the” unit interval.
So, in general, we think of as consisting of the set of vertices of X, the set of lines of X, the set of squares of X, the set of cubes of X (cube in the sense of high school geometry), etc, all the way up to the set of -cubes of X, and all are degenerate. We can represent these using.. diagrams! Diagrams of points, lines, squares, cubes, etc. Let’s look at the first few:
Now we can investigate a particular -cube in as being a diagram in with the same shape as one of the diagrams above!
A -cube in X is just a point in X.
A -cube in X can be parsed to mean an arrow . The points and are understood to be the cubes and , which we call the endpoints of . By composing with the image of a face map under , we can project a lower-dimensional cube from a higher dimensional cube, by the action of on morphisms.
A -cube in X is a square like
In this diagram too we can understand the lower-dimensional cubes contained in to be compositions for some composition of face maps . As an example (the same example as in the section on 🧊), the arrow is the map , and the point is the map . By functoriality of , that composite is the same thing as .
A -cube in X is a map , which could be visualized as the proper cube below, and has 6 2-faces (squares), 12 1-faces (edges) and 8 0-faces (vertices). As an exercise, work out which sequence of face maps in the underlying cube category leads leads to each of the possible 24 faces you can project. Honestly, the drawing of the -cube isn’t even that enlightening, I just wanted to be fancy.
Like, check out this absolute flex of a diagram, it’s god damn useless. Wow.
As an a quick aside, can we talk about how god damn confusing this projection is? I can never tell whether I’m looking top-down at a truncated square pyramid ( is the top face) or if I’m looking through a normal solid 3-cube whose front face is transparent ( is the back face).
In case it’s not clear (it’s not clear, I know), the 2-cubes present in the 3-cube – yes, , that’s how hard I’m running out of letters over here – are these:
- is the square spanned by .
- is the square spanned by .
- is the square spanned by .
- is the square spanned by .
- is the square spanned by .
- There is one more square, obscured by , which is spanned by .
Yeah, this item is padding. Fight me.
Now that we know we can represent particular cubes in a cubical set X by diagrams, I can also finally show you what a degeneracy actually looks like! For instance, we know maps from the set of points of to the set of lines of (since is contravariant, it inverts the direction of – remember that).
If is a particular point in , its image under is a degenerate line connecting . Connections on lines turn them into degenerate squares where two opposing faces are and the other two faces are degenerate, and so on.
In both diagrams above, the dashed arrow from the -cube to the inside of -cube is meant to be understood as , where is a map . is the map which collapses a square to a point by first removing the first coordinate, which is understood to be left-right; Thus, the cells in the up-down direction in are thin, and the left-right cells are full.
More examples of Cubical Sets
The simplest way of making a cubical set is by taking a normal set, say , and ignoring the cubes, thus making the discrete cubical set , which has for every ; and .
It’s easy to see that is a functor, since:
- , and .
And thus is a cubical set. It doesn’t have a lot of interesting structure, but some discrete cubical sets will have important roles to play when discussing the category of cubical sets. For instance, plays the same role in as it does in !
If and are cubical sets, we can form their product , which is also a cubical set. Every is , and maps are taken to products of morphisms .1
Describing individual constructions on cubical sets (like their product) isn’t very enlightening, though, and it’s a lot more fruitful to describe most of them in one go. So, with that goal, I’ll describe..
The Category of Cubical Sets,
Cubical sets are, of course, objects of a category, like all good things. We call a functor a presheaf on , and we denote the category of presheaves on by . Thus, since a cubical set is a functor , we can also call it a presheaf on 🧊, and thus, an object of . To reduce the number of ice cube emoji on the screen, we’ll denote this category by .
The word “presheaf”, rigorously, only means “contravariant functor into .” However, it’s what the nLab calls a “concept with an attitude”: If you call something a “presheaf category” instead of a “functor category”, it’s likely that you’re interested in the properties of as a presheaf topos, and, indeed, that’s what we’re interested in.
A topos is a “particularly nice category to do mathematics”, in which “nice” means “has a lot of structure”. Let’s look at some of the structure (and, indeed, any ) has for “free”:
Completeness Every small limit exists in , and is computed pointwise as a limit in . This is an extension of the product of cubical sets mentioned above: a product is just a small, discrete limit. In particular, this also includes a terminal object in cubical sets, which is the discrete cubical set .
Cocompleteness Every small colimit exists in . In particular, if is a category, is often referred to as the “free cocompletion” of — C plus all small colimits thrown in. These are also computed pointwise as colimits in . Don’t know what a colimit is? One particularly important example is the coproduct . In , this is the disjoint union.
Another important colimit is the initial object in cubical sets, which is the discrete cubical set .
Cartesian closure This one merits a little more explanation than a paragraph. Fix a cubical set . To say is Cartesian closed is to say the functor (“product with X”, called “tensor”) has a right adjoint functor , called “hom” (also read “function from X”, at least by me) - That is, .
We can try to imagine what a would-be would be like by fixing a third cubical set and seeing that if exists, then it must satisfy the equation
This equation holds when and , so by the Yoneda lemma we have
By defining an “evaluation” map, , and showing that for every there is a , we can prove that is the counit of the tensor-hom adjunction we want in , and thus that the definition posed above is indeed the correct definition of for cubical sets. For the details of this construction, check out the nLab.
And a wealth of other properties, like local cartesian closure (“has dependent products”), having a subobject classifier (a “type of propositions”), having power objects (a generalisation of power sets), among many others.
Kan Cubical Sets
The category of cubical sets is pretty neat by itself, but.. it’s kinda useless. I’m sure there exist applications of cubical sets by themselves, but I can’t think of any. The cubical sets, just like the simplicial sets, come into their own when we consider the subcategory of (resp. ) consisting of the Kan complexes. Since the term Kan complex is generally used to mean “Kan simplicial set”, we’re generally left to use either “Kan cubical set” or “Cubical complex” for the objects of our subcategory. Let’s go with the former.
Fix a cubical set throughout. We define the boundary of an -cube , , to be the union of all of its faces. This can be pictured diagramatically as below: The faces of are all of the points and arrows spanning it, and the union of these is .
We still have the same 0-cubes and 1-cubes spanning , but the 2-cube itself is no longer under consideration. We are principally interested in the boundaries of the standard -cubes, which will be denoted . Considering that boundary, we can define a box open in as being the subset of with one (the face in the image of ) of its faces removed. This we denote by .
Just like in the case of an -cube in , we understand the phrase “-open box in ” to mean a map . Here are diagrams of all the open boxes in the same as before.
A cubical set satisfies the Kan condition if every open box in X can be extended to a cube, or, more formally, if there exists a dotted arrow which factors the map through the inclusion from into .
The Cubical Nerve
First, recall the definition of a groupoid. A groupoid is a category in which for every arrow there exists an arrow , such that . That is: a groupoid is a category in which every arrow is invertible. There is a (2-)category of groupoids, , in which the objects are groupoids and the morphisms are functors (and the 2-morphisms are natural isos).
We specify a functor , the truncated nerve functor, which assigns to every groupoid a cubical set in which every -cube is degenerate, as follows:
The points in are the objects in ,
The lines in are the arrows in ; The lines induced by degeneracy maps are the identity arrows.
The squares in are the squares with corners spanned by , , , , such that - that is, the commutative squares with that boundary.
The degenerate squares in are the squares as below, and they exist for every , and in :
I claim: If is a groupoid, then its nerve is always Kan. I will not show this with a lot of rigour, but to convince yourself of this fact, deliberate on what it means to fill boundaries of our non-degenerate cubes: the lines and squares.
In the case of lines, an open box is just a point ; We can extend this to a line , as desired.
In the case of squares, an open box is a diagram like the one below, in which all of the corners are objects of and the lines are maps in . The maps in are invertible, so if we have , we also have (for instance).
We’re looking for the map . The strategy to use here is to try to “follow” the source of the missing arrow “around” the edges of the cube, and, if you get stuck, invert the arrow you got stuck on. We take to through , then to through , and now we’re stuck. A priori, there’s no arrow we can follow, but since is a groupoid, we can invert to get . Thus the composite connects and , like we wanted.
Moreover, this diagram must commute, i.e., we must check that . But this is automatic from the axioms of a category (which say we can ignore the parentheses), and the axioms for a groupoid, which imply that (for any f).
We have established that the truncated nerve of a groupoid is Kan. Why truncated? Because we only consider 1-categories in the construction of , and, as the superscript implies, only have non degenerate cubes for levels 2 and below. We could consider an untruncated functor from -categories to cubical sets; In that case, the nerve of an -groupoid is Kan, just like in the 1-categorical case.
More surprising, the converse implication is also true! If the nerve of a category is Kan, then is a groupoid. Adapting the analogous argument from Kerodon about Kan complexes to our Kan cubical sets, we’re given an , and we build left and right inverses to .
This can be done by defining a pair of partial squares in , in which the missing faces represent left and right inverses to our map . Here they are:
By assumption, is Kan, which means these open boxes do have fillers, and thus the equations and hold in . We calculate: , leaving implicit the applications of associativity of , thus concluding that is an inverse to .
In either case, we’re considering a globular construction (a groupoid) as a cubical construction. This consideration can be interpreted for any “level” of higher structure which you might want: above, we only had 1-cells in our groupoid, but, for example, here’s what a two-cell in a globular -category might look like interpreted cubically:
Similarly, if we take our good old square , we can interpret that as a globular 2-cell, by “stretching” the diagram vertically, inserting degenerate cells where appropriate.
For more details on the connection between thin cubes and globes, in the particular case of double categories and 2-categories, the paper Double categories, 2-categories, thin structures and connections by Brown and Mosa is excellent. It also contains pictorial represntations of the equations which have to hold between faces, degeneracies and connections, which I have entirely neglected!
The discrete cubical set is Kan
This follows from the name, it’s a complex, duh!
That was a joke, but it was a bad one. As a quick reminder, every is taken to be the set , and all of the restrictions (faces and degeneracies) are the identity on . We want to show that every open box in has a unique filler. But consider (by way of handwaving) what an open box is: A cube with “one of its faces removed”.
Any cube is an element of (by the Yoneda lemma), which is the set , by definition. The cube has however many -dimensional faces, which we can compute by applying the appropriate face maps. Since the face maps in are all the identity function, we learn that all of ’s faces have to be the same element , regarded as -dimensional cubes.
By this argument, every open box of dimension in is made up of the same element in all of its faces. We can extend this box to an -cube which is just the element : It is a complete -cube of , and it has all of the same faces as where both are defined.
We can consider the category made up of only those cubical sets which are Kan complexes. This turns out to be a very interesting category! Specifically, I’m talking about the full subcategory of on the Kan complexes, which turns out to be equivalent to the -topos of of -groupoids. A recent result by Shulman shows that this category, which I guess can be called , models… Homotopy Type Theory.
Cubical Types
Aha! That paragraph was a twist, but it wouldn’t be a post on this blog if I didn’t manage to write in type theory somehow! However, if you went back to the first paragraph, you’d have seen this coming. My interest in Kan cubical sets is entirely due to, well, these two papers, in which a model of MLTT + the univalence axiom (modulo the computation rule for J only holding up to a path):
A Model of Type Theory in Cubical Sets by Bezem, Coquand and Huber in which they exhibit a model, which was later refined to
Cubical Type Theory: a Constructive Interpretation of the Univalence Axiom by Cohen, Coquand, Huber and Mörtberg.
By definition, a type in these theories is a Kan cubical set. A type in a context like is roughly like the set , if you ignore that their cube category is completely different from the one presented here! They’re (roughly) equivalent, though, except for the cube category of CCHM having operations called reversals (which invert one dimension) and special kinds of degeneracies called connections. A connection is a degeneracy like in the diagram below, which I am stealing from my own post about CCHM:
Ahem, please forgive past-me’s type theoretic accent. These are, like the normal degeneracies, 2-cubes in which 2 faces are thin (these are the faces in the diagram), and the two other faces are the 1-cube we degenerated (the line ). Connections are a very natural extension to the theory of Kan cubical sets, since in a sense they say that an -cube is regarded as a degenerate -cube in all of the possible ways.
This extra structure of connections turns out to be very important when considering a category of cubical sets as an alternative to the category of simplicial sets, , when doing homotopy theory. This is because cubes without connection are not a strict test category, a property which is… complicated to describe. But very roughly, it says that the canonical way of mapping between cubical sets and homotopy types does not preserve products.
The perspective we can get that from this particular application of (Kan) cubical sets is that they provide a systematic way to represent the elements of a type (), the equalities between elements of that type (), the homotopies between equalities in that type (), and so forth. In that sense it’s not surprising that Kan cubical sets can be used to (almost) model HoTT!
Conclusion
I don’t know why I write conclusions; These aren’t high school essays. However, in this case I do feel compelled to apologise for how technical and disjointed this post was, and how it seems like I needlessly elaborated on things which (to some) might be trivial while not going into enough detail about highly non-trivial things.
Like I said in the first paragraph, I was writing this to learn more about cubical sets. So, unlike my other posts, which are explaining concepts I already had an understanding of — for instance, my last proper post was talking about my implementation of cubical type theory, not cubical type theory in general — this post is explaining something I had a fuzzy understanding of, and touches on some category-theoretical concepts I didn’t have the faintest clue about, like the Yoneda embedding.
Several people had tried to explain the Yoneda embedding to me before, but it had never stuck. It was only when I actually wrote out the definition, worked through its effect on objects and maps, and explored a bit of the structure of the unit interval cubical set. I guess explaining something really is the best way to learn it!
This was my shortest interval between blog posts maybe.. ever. Don’t get used to it! This is the blog post I should’ve written instead of whatever filler about Axiom J I wrote about last time, but motivation works in mysterious ways when you struggle with depression. In reality, it’s not that mysterious — I’m writing this on the last week of the first academic semester of 2021, which means the deadline anxiety has finally been lifted. God damn, I hate university.
References
Since this post is a lot more technical than my others, and it’s about something I don’t know a lot about, I figured I should cite my sources so you can know I’m not spewing complete baloney. I don’t know how people cite things in English-speaking countries, and, to be perfectly honest, I’ve done a terrible job of keeping track of where I got all this stuff, but here are the papers and pages and textbooks I consulted along the way:
The nLab. Seriously. So many nLab pages. I think these three are the ones I visited most often while writing this post, though:
- closed monoidal structure on presheaves - Definition of
- fundamental groupoid of a cubical set and the cubical nerve of a groupoid - Direct definition of
- cubical set - guess :)
The following papers:
- A Model of Type Theory in Cubical Sets
- Cubical Type Theory: a Constructive Interpretation of the Univalence Axiom
- An Elementary Illustrated Introduction to Simplicial Sets
- Varieties of Cubical Sets
- All -toposes have strict univalent universes
The following pages from Kerodon:
Where in .↩︎