(This was written in inadvertent parallel with Mike’s latest post at the Café, so there’s a little overlap — Mike’s discusses the homotopy-theoretic aspects more, this post the type-theoretic nitty-gritty.)

Higher inductive types have been mentioned now in severalotherposts, so it’s probably time to bring the full troupe out into the sunshine and show them off a bit.

If we’re aiming to do homotopy theory axiomatically within type theory — if our types are homotopy types — then in particular, we should hope to have types around representing the most fundamental spaces of topology: the circle, the interval, the 2-sphere… So, how should we construct these types?

Well, most types in dependent type theory (in CIC/Coq, all apart from function spaces) are constructed as inductive types, or the slightly more general inductive families. In Coq syntax, for instance, one defines the natural numbers as the type freely generated by an element O and an endomorphism suc:

Inductive (Nat : type) :=
| O : Nat
| suc : Nat -> Nat.

From this definition, Coq automatically generates a recursor (aka an eliminator) for nat — an axiom giving the normal induction/recursion principles for , in a strong constructive form.

So it’s natural to ask if we can define the circle similarly, as the free type generated by a basepoint, and a path from that point to itself:

Of course, Coq doesn’t accept this inductive definition — in normal inductive types, the constructors have to output elements of the type itself. So we have to axiomatise the type by hand. The type and its constructors are easy:

together with computation axioms stating that circle_rec1 X a l sends base to a and loop to l.

This is fine as far as it goes, and lets one prove a few things; but it corresponds only to, say, simple recursion on . To prove anything much about the circle, one needs something corresponding to full induction on — we need to be able to eliminate into a type dependent over Circle itself. So a second attempt might be:

This was the first thing I tried originally… but a little thought shows it’s wrong! Why? Well, think topologically: we have a dependent type, so a fibration over the circle, for which we’re trying to give a section. A section doesn’t correspond to a loop in a fiber — which is what circle_rec2 asked for. A section corresponds to a loop lying over the whole circle down below — equivalently, to a point x, and a path in the fiber, to x, from the result of transporting x once around the circle.

(My TikZ skills are sadly not quite up to drawing tori yet!) So the actual recursor we want is:

So, now that we’ve got the circle, what can we prove about it, or with it? Well, some simple first exercises:

The circle is contractible if and only if UIP holds — that is, exactly if all types are discrete. (This holds in for instance the set-theoretic model: when all paths are trivial, the unit type satisfies the axioms of Circle.)

Assuming Univalence, there is no path in Paths base base from loop to refl.

Less simply, but more interestingly, Mike Shulman has managed to prove:

Assuming Univalence, Paths base base is equivalent to int. In other words, .

So, this seems to be a reasonable proposal for how to axiomatise the circle type-theoretically. But beyond that, the same idea which we used for the circle also gives us lots of other homotopy-theoretic constructions, in quite convenient and (it seems) type-theoretically natural forms. So I’ll end for now with a quick parade of these, giving just their imagined definitions as Coq inductive types, the explicit types of their recursors, and some notes on what one can do with them.

And, of course, you can pull down the Coq code and play with them yourself — the definitions below appear in full in Menagerie.v, in my fork of Andrej’s Homotopy repository.

Since one can prove that Interval is contractible, one might think there’s nothing interesting one can do with it. However, as Mike showed (and Chris Kapulkin noticed too), this implies functional extensionality, since it shows that paths are (in a weak sense) representable.

(That proof needs the computation rules to hold up to definitional equality, though; the version one can easily axiomatise in Coq, with the “computation” rules holding only up to homotopy, doesn’t imply this, since these axioms are all satisfied by the unit type. However, as Dan’s last post shows, there may be ways of getting around this.)

This gives the mapping cylinder of any map of types. Intuitively, this gives the factorisation of any map into a cofibration followed by a trivial fibration.

(Triviality is the fact that for each y:Y, the type Cyl f y is contractible; proving this in Coq is again a nice exercise.)

In fact one can make this intuition precise — if a type theory admits “mapping cylinder types”, then its types carry classes of maps behaving just like the fibrations, cofibrations, and weak equivalences of a model structure. The fibrations are (generated by) dependent families of types; trivial fibrations, families of contractible types; cofibrations, constructos of (possibly higher) inductive types; trivial cofibrations, constructors of inductive types with a single constructor; and weak equivalences are exactly maps which are equivalences as defined in the type theory. (So the trivial cofibrations and fibrations of this “pre-model-structure” are exactly the Gambino-Garner weak factorisation system.)

Similarly, with proper recursion, we can construct the 0-truncation, , aka , of any type; and this idea extends to give higher truncations as well. Here I’ve used a constructor whose arity is Circle; alternatively, one could also relax the restrictions on input types of constructors, to allow them to take paths directly as inputs:

(A little bit of attribution: the basic idea of higher inductive types came from questions that were a lot in the air at Oberwolfach, and most immediately from discussions on the hike between Mike Shulman, Andrej Bauer, Michael Warren and myself. Since then, we and Chris Kapulkin have been playing with them further, and Dan Licata and Steve Awodey have independently been working on some closely related ideas, which I believe Dan is planning to post about soon…)

(I tend to think of the target type here as “paths from f(x) to f(y) lying over p”.) Now that it’s stated in enough generality, you can just induct on p to finish the job. I won’t elaborate more here — it’s a good exercise — but if you want the full codes, it’s near the beginning of Menagerie.v on my Github.

No, not quite! (The iota-rule is the CoC name for what the M-L tradition calls computation rules, is that right?) As far as I can see there are two main choices to make.

First, for the “0-constructors”, one can ask the computation rule to hold either definitionally or propositionally. It seems quite natural to ask for it definitionally, just like for ordinary inductive types; and it’s definitely stronger to ask for it definitionally, as the proof of functional extensionality from the interval shows. (The propositional-computation version of the interval rules is satisfied by a unit type, so certainly can’t prove functional extensionality.)

Second, there’s the same choice for higher constructors. Here, I’m not at all sure whether one should ask for it definitionally or just propositionally. On the one hand, seeing them as inductive types, it seems reasonable to look at it as a computation rule, an actual reduction. On the other, since the “redex” now involves somewhat non-canonical auxiliary terms, like what I’ve called here dependent_map_on_paths (aka cong etc.), whose own behaviour under composition etc. is typically only well-behaved up to homotopy, in practice there’s not much gain from it; and perhaps it isn’t so natural after all…?

For the moment, propositional computation rules have the advantage that we can assert them as axioms in Coq, so that’s what we’re using. Dan Licata’s trick gives us definitional computation rules for the 0-constructors in Agda, but not for the higher constructors, and its applicability in Coq is questionable.

On the other hand, apart from the definitional/propositional choice, there should definitely be an algorithmic way to extract the computation rule from the “inductive specs” that Peter gave above. But making this precise in generality (and, indeed, making precise what sort of “inductive specs” are allowed) is work in progress. I think the key is likely to be the idea that Peter alluded to above: that the type transport p z ~~> w, for points z : P x and w : P y in two different fibers of a fibration, should be regarded as the type of paths in the total space lying over the path p : x ~~> y in the base space.