In this post I will argue that, improving on previous work of Awodey-Frey-Speight, (higher) inductive types can be defined using impredicative encodings with their full dependent induction principles — in particular, eliminating into all type families without any truncation hypotheses — in ordinary (impredicative) Book HoTT without any further bells or whistles. But before explaining that and what it means, let me review the state of the art.
Categorically, a (higher) inductive type is an initial object in some category. For instance, the coproduct of Image may be NSFW.
Clik here to view. and Image may be NSFW.
Clik here to view. is the initial object of the category of types Image may be NSFW.
Clik here to view. equipped with maps Image may be NSFW.
Clik here to view. and Image may be NSFW.
Clik here to view.; and the circle Image may be NSFW.
Clik here to view. is the initial object of the category of types Image may be NSFW.
Clik here to view. equipped with a point Image may be NSFW.
Clik here to view. and an equality Image may be NSFW.
Clik here to view.. A (H)IT is therefore a kind of “colimity” thing, while an “impredicative encoding” of it is a way to construct it (or an approximation thereof) using limits instead — specifically, large limits, which requires a universe closed under impredicative quantification (i.e. Image may be NSFW.
Clik here to view.-types whose domain is not necessarily an element of the universe).
The most basic such encodings (usually associated with System F) approximate the initial object of a category by the product of all objects of that category. For instance, the System F coproduct Image may be NSFW.
Clik here to view. is the product of all types Image may be NSFW.
Clik here to view. equipped with maps Image may be NSFW.
Clik here to view. and Image may be NSFW.
Clik here to view., which in type-theoretic syntax becomes
Image may be NSFW.
Clik here to view.
Such impredicative encodings of ordinary inductive types are well-known in type theory, and back when we were first discovering HITs I blogged here about the fact that they can also be encoded impredicatively. However, these basic encodings have the problem that they don’t satisfy the “uniqueness principle” or Image may be NSFW.
Clik here to view.-conversion, and (equivalently) they don’t support a “dependent eliminator” or “induction principle”, only the non-dependent “recursion principle”. In categorical language, the product of all objects of a category, even if it exists, is only a weak initial object.
Last year, Sam Speight blogged here about a way to fix this problem (paper here with Awodey and Frey), by defining a (higher) inductive type to be the limit of the identity functor of the category in question, and appealing to this theorem. Such a limit, if constructed out of products and equalizers, appears as a subobject of the product of all objects; and if we “compile out” this definition in type theory, it adds additional assertions that System F encoding data is natural. For instance, the coproduct becomes
Image may be NSFW.
Clik here to view.
This approach is very nice, but unfortunately it only works for h-sets, i.e. 0-types. That is, given two sets Image may be NSFW.
Clik here to view., it produces a coproduct set Image may be NSFW.
Clik here to view., which has a dependent induction principle that can only eliminate into other sets. Categorically, the point is that the construction of limits out of products and equalizers works in a 1-category, but not in a higher category. We can boost up the dimension one at a time by adding additional coherence conditions — the paper ends with an example of Image may be NSFW.
Clik here to view. constructed as a 1-type with a dependent induction principle that can eliminate into other 1-types (but not higher types) — but this approach offers no hope of an induction principle into types that are not Image may be NSFW.
Clik here to view.-truncated for any Image may be NSFW.
Clik here to view.. If we could solve the “problem of infinite objects” (perhaps by working in a context like two-level type theory) maybe we could add “all the coherence conditions at once”, although the path algebra would probably get quite hairy.
Surprisingly (to me), it turns out that there is a different solution, which works in (impredicative) Book HoTT without any bells or whistles. Recall that theorem about initial objects as limits of identity functors, and note that it’s proven using this lemma, which says that if Image may be NSFW.
Clik here to view. is an object of a category equipped with a natural transformation from the constant functor Image may be NSFW.
Clik here to view. to the identity functor, i.e. a cone consisting of maps Image may be NSFW.
Clik here to view. for all objects Image may be NSFW.
Clik here to view. such that Image may be NSFW.
Clik here to view. for all morphisms Image may be NSFW.
Clik here to view., and moreover Image may be NSFW.
Clik here to view. is the identity morphism, then Image may be NSFW.
Clik here to view. is initial. Can we use this lemma directly?
You might think this is no better, since even obtaining a fully-coherent Image may be NSFW.
Clik here to view.-natural transformation Image may be NSFW.
Clik here to view. already involves infinitely many coherence conditions. However, inspecting the proof of this lemma, we see that it will work in HoTT even for an “incoherent” natural transformation, essentially because the definition of contractibility is a propositions-as-types translation of being a singleton set. That is, to show that Image may be NSFW.
Clik here to view. is initial in Image may be NSFW.
Clik here to view., we want to show that Image may be NSFW.
Clik here to view. is contractible. We take its center to be Image may be NSFW.
Clik here to view., and then we must show that any Image may be NSFW.
Clik here to view. is equal to Image may be NSFW.
Clik here to view.. But by incoherent naturality, we have Image may be NSFW.
Clik here to view., which is equal to Image may be NSFW.
Clik here to view. since Image may be NSFW.
Clik here to view..
This is great, because the 0-type version of the Awodey-Frey-Speight construction, if written down with the full universe Image may be NSFW.
Clik here to view. in place of Image may be NSFW.
Clik here to view., already comes with an incoherent cone over the identity functor. So “all” we need to do is ensure Image may be NSFW.
Clik here to view.. (Note that this is a version of Image may be NSFW.
Clik here to view. for an inductive type.)
Here’s the trick. Note that the proof of the lemma shows Image may be NSFW.
Clik here to view. is initial by applying the naturality property in a case where one of the objects is Image may be NSFW.
Clik here to view. itself. Let’s try to prove Image may be NSFW.
Clik here to view. is the identity by applying that same naturality property in the case where the morphism is Image may be NSFW.
Clik here to view. itself. This gives us Image may be NSFW.
Clik here to view.. In other words, although Image may be NSFW.
Clik here to view. may not (yet) be the identity, it’s already the next best thing: an idempotent. And in the words of Robinson and Rosolini,
No category theorist can see an idempotent without feeling the urge to split it.
This is especially true when we were hoping that that idempotent would turn out to be an identity, since splitting it is a way to “make” it an identity. And in fact it’s not hard to show with categorical algebra that if Image may be NSFW.
Clik here to view. and Image may be NSFW.
Clik here to view. are a splitting of Image may be NSFW.
Clik here to view. (so that Image may be NSFW.
Clik here to view. and Image may be NSFW.
Clik here to view.), where Image may be NSFW.
Clik here to view. is a cone over the identity functor, then Image may be NSFW.
Clik here to view. is initial. For we have another cone Image may be NSFW.
Clik here to view., whose Image may be NSFW.
Clik here to view.-component is Image may be NSFW.
Clik here to view.. And we have Image may be NSFW.
Clik here to view., using naturality Image may be NSFW.
Clik here to view. and the splitting equations, so Image may be NSFW.
Clik here to view., so the lemma applies. Note that this argument also uses no higher coherence, and so should work just fine for an incoherent natural transformation.
What’s left is to split the idempotent Image may be NSFW.
Clik here to view. in type theory. Fortunately, I wrote a paper a few years ago (original blog posts here and here) about precisely this problem, inspired by analogous results of Lurie in higher category theory. It turns out that an arbitrary “incoherent idempotent” (a map Image may be NSFW.
Clik here to view. equipped with an equality Image may be NSFW.
Clik here to view.) may not be splittable, but as soon as the “witness of idempotency” Image may be NSFW.
Clik here to view. satisfies one additional coherence condition (not the infinite tower of such one might expect), the map Image may be NSFW.
Clik here to view. can be split. And in our situation, we can obtain this one additional coherence condition for the naturality triangle Image may be NSFW.
Clik here to view. by using the 1-type version of the Awodey-Frey-Speight construction. (Actually, we can even omit their unit condition; all we need is the composition coherence for pseudonaturality.)
I’ve verified in Coq that this works for coproducts, using type-in-type for impredicativity. (I don’t think Coq’s built-in impredicative-set option is compatible with the HoTT library, which has tried to excise Coq’s built-in smallest universe Set as much as possible.) Most of the proof is quite easy; the longest part (40 lines of path algebra) is deducing the idempotence coherence condition from the naturality coherence condition. As expected, we only get typal computation rules for the induction principle — although we do have definitional computation rules for the recursion principle (i.e. the non-dependent eliminator). More precisely, there is a non-dependent eliminator (a special one, not just the dependent eliminator specialized to a non-dependent motive) that satisfies a definitional computation rule.
I’m working on coding it up for higher inductive types as well, but the path algebra gets quite annoying. Further bulletins as events warrant.
To conclude, let me point out that I find this a very satisfying answer to the question with which I ended my second idempotents post:
… [For equivalences] we also have a “fully coherent” notion Image may be NSFW.
Clik here to view.… that is a retract of a type Image may be NSFW.
Clik here to view.of “partially coherent” objects…. Are there any other structures that behave like this? Are there any other “fully coherent” gadgets that we can obtain by splitting an idempotent on a type of partially-coherent ones?
The answer is yes: a fully-coherent impredicative encoding can be obtained by splitting an idempotent on a partially-coherent one.