Idempotents in intensional type theory

We study idempotents in intensional Martin-L\"of type theory, and in particular the question of when and whether they split. We show that in the presence of propositional truncation and Voevodsky's univalence axiom, there exist idempotents that do not split; thus in plain MLTT not all idempotents can be proven to split. On the other hand, assuming only function extensionality, an idempotent can be split if and only if its witness of idempotency satisfies one extra coherence condition. Both proofs are inspired by parallel results of Lurie in higher category theory, showing that ideas from higher category theory and homotopy theory can have applications even in ordinary MLTT. Finally, we show that although the witness of idempotency can be recovered from a splitting, the one extra coherence condition cannot in general; and we construct"the type of fully coherent idempotents", by splitting an idempotent on the type of partially coherent ones. Our results have been formally verified in the proof assistant Coq.


Introduction
In December 2014 Martín Escardó asked me whether idempotents split in Martin-Löf type theory (mltt).This paper is a long-winded answer.
Usually, an idempotent means a function (necessarily an endofunction) that is equal to its composite with itself, f • f = f .In mltt, using the propositions-as-types methodology, we might naturally take this to mean a function f : X → X, for some type X, together with a witness of idempotency I : x:X (f (f (x)) = f (x)), where "=" denotes the identity type.(If we assume function extensionality, as we often will, then to give I is equivalent to giving I : f • f = f .) A splitting of an idempotent f on X consists of functions r : X → A and s : A → X such that r • s = id A and s • r = f .In zfc set theory, an idempotent always has a splitting along with proofs that every fully-coherent idempotent splits and every split idempotent is fully-coherent.
Unfortunately, there is a well-known problem with representing such fully-coherent structures in mltt: on the face of it they seem to require a tower of infinitely many terms, each dependent on the previous ones, which is not something that can be defined as a single object in mltt.This is somewhat disheartening for the project of splitting idempotents.However, it's important not to read more into the results of Lurie cited above than they say.They do say that if a function f can be written as s • r where r • s = id, then f admits a "coherent system of idempotence data".They don't say that if f is idempotent with a specified homotopy I, and f splits, then I must itself admit an extension to a coherent system of idempotence data.Therefore: • Even though a split idempotent automatically gives rise to an infinite system of coherence data, it doesn't follow that in order to construct a splitting we would necessarily need to give an infinite system of coherence.• It's not too hard to give examples of homotopies I that are not coherent, but it's rather less obvious how to give an example of an incoherent idempotent for which there doesn't exist some other homotopy that is coherent.Fortunately, Lurie has already addressed these questions as well (still in the ∞-categorical context).In [Lur14, Warning 1.2.4.8] he gave an example of an incoherent idempotent that does not split, and in [Lur14, Lemma 7.3.5.14] he showed that to construct a splitting, one additional coherence datum suffices.Inspired by these results, we will set out to transfer them to mltt, as follows: (1) Assuming propositional truncation and the univalence axiom, we can adapt Lurie's counterexample to show that a single witness of idempotency I : x:X (f (f (x)) = f (x)) is insufficient to construct a splitting.In fact, our construction is slightly simpler than Lurie's, and involves an object familiar to constructive mathematicians: the Cantor space 2 N .(2) However, under the weaker assumption of function extensionality, we can adapt Lurie's construction to show that if we also have J : x:X (ap f (I(x)) = I(f (x))), then we can construct a splitting.(Here ap f denotes the action of f on witnesses of equality; sometimes it is called resp.)Our construction is actually the dual of Lurie's: we use a limit where he uses a colimit.A colimit would probably also work, but would require further assumptions on type theory for its construction and well-behavedness.Note that the latter positive result does not require the univalence axiom.So although inspired by higher category theory, we obtain a result that should be of interest even in pure intensional mltt.
Based on these results, we propose that, as in higher category theory, the unadorned word idempotent should not be used for the "incoherent" notion that includes only a single witness I. Instead we will call the pair (f, I) a pre-idempotent.
One might think that the triple (f, I, J) ought to deserve the name "idempotent", since although it does not include all the higher coherence data, we have seen that it does suffice to construct a splitting.However, this is not the case.It is true, in the ∞-categorical world, that a splitting induces a fully coherent idempotent in Lurie's sense, and hence so does a triple (f, I, J); but nothing guarantees that the resulting coherent idempotent is an extension of (f, I, J) itself.In fact, we will show in mltt that it is an extension of (f, I), but not in general of J: assuming univalence and propositional truncation, there exist choices for J that are not coherentifiable at all.For these reasons, we will instead call a triple (f, I, J) a quasi-idempotent; it is analogous to the "incoherent, but coherentifiable, equivalences" that in [Uni13] are called quasi-inverses.
At this point we may wonder whether there is any way to define the word "idempotent" in mltt in a way that will translate to the correct notion homotopically.There is one answer that is somewhat "cheap": by [Lur09, Corollary 4.4.5.14], in an ∞-category the space of idempotents on an object X is equivalent to the space of retractions of X, meaning quadruples (A, r, s, H) where r : X → A and s : A → X and H is a homotopy r • s ∼ id A .The latter can be defined in mltt (with universes) as Retr(X) :≡ A:Type r:X→A s:A→X a:A (r(s(a)) = a), and if we assume the univalence axiom, it will have the correct homotopy type.Thus, we could define an idempotent on X to be an inhabitant of this type.
Of course, this would be rather unsatisfying: we expect an "idempotent" to consist of a map f : X → X equipped with some kind of structure, and we expect the construction of its splitting to be a nonvacuous operation.Moreover, it has an actual technical drawback as well: since it involves a sum over a universe Type, it lives in a universe one higher than that of X.
Both of these problems can be solved with the following trick.If we define the type of quasi-idempotents in the expected way: then the above splitting construction yields a map split : QIdem(X) → Retr(X).
On the other hand, since every retraction induces a coherent idempotent, we have a map uli : Retr(X) → QIdem(X) and these two maps can be shown to exhibit Retr(X) itself as a retract of QIdem(X).Therefore, the composite uli • split is a quasi-idempotent on QIdem(X), and if we construct its splitting as above, we obtain a type equivalent to Retr(X).This splitting type is what we propose as the definition of (fully coherent) idempotent: it has the correct homotopy type; it is by construction an equipping of an endomap with data (indeed, infinitely many data, encoded internally by way of the natural numbers type); and it lies in the same universe as X.
The plan of the paper is as follows.In §2 we recall some notation and terminology from [Uni13].In §3 we ease into the study of idempotents by considering several hypotheses (due to Martín Escardó) under which pre-idempotents can be split.The next two sections contain the main results: in §4 we give our example of a pre-idempotent that admits no splitting (assuming propositional truncation and the univalence axiom), and in §5 we construct a splitting of any quasi-idempotent (assuming function extensionality).
The remaining sections are concerned with the more technical coherence questions.In §6 we show that split exhibits Retr(X) as a retract of QIdem(X).In §7 we show that this retraction is not an equivalence, and conclude that although the underlying pre-idempotent of a quasi-idempotent can be recovered from its splitting, the coherence datum J cannot in general be.In §8 we complete a proof from §7 that requires a lengthy analysis of some classifying spaces in type theory.Finally, in §9 we define the type of fully-coherent idempotents, and in §10 we conclude with some remaining open problems.
Throughout, we will argue in the informal style of [Uni13], and we will make use of the basic results from Chapters 1-4 thereof.However, all the main results of this paper have also been formally verified in the proof assistant Coq, using the Homotopy Type Theory library [HoT15], and are available as part of that library.As of the date of publication, the correspondence between sections of this paper and files in the library is: Idempotents.vThe idempotents-paper git tag records this version of the library.

Some notation and terminology
For the most part, we adopt the notation and terminology of [Uni13].We write x:A B(x) and x:A B(x) for dependent product and sum as usual in mltt, with their non-dependent special cases A → B and A × B. We write the identity type of two elements x, y : A as x = A y, or usually just x = y; its canonical elements are refl x : x = x.We write x ≡ y for a judgmental equality, and a :≡ b if a is currently being defined to equal b.
A type A is called a mere proposition if we have x,y:A (x = y).In other words, isprop(A) := x,y:A (x = y).It is said to be a set, or to satisfy uip (Uniqueness of Identity Proofs), if x,y:A isprop(x = y), or equivalently x:X p:x=x (p = refl x ).
For functions f, g : A → B, we write f ∼ g for the type x:A (f (x) = g(x)), and call it the type of homotopies from f to g.The function extensionality axiom, which we will almost always have available (either by explicit assumption, or as a consequence of some other assumption), says that this type is equivalent (see below) to the identity type f = A→B g.
For types A and B, we write A B for the type of equivalences from A to B. This is defined as f :A→B isequiv(f ), where isequiv(f ) is any one of a number of well-behaved definitions, the first of which was due to Voevodsky; see [Uni13, Chapter 4] for details.The important properties are that isequiv(f ) if and only if g:B→A (f • g ∼ id) × (g • f ∼ id) (we generally use the "if" direction of this to construct equivalences), and that isequiv(f ) is a mere proposition.There is a canonical map (A = B) → (A B), and Voevodsky's univalence axiom says that this map is itself an equivalence.
The propositional truncation is, when assumed, a rule associating to every type A a type A which is a mere proposition, and a map |−| : A → A , such that any function from A to a mere proposition factors judgmentally through A .In other words, if B is a mere proposition and f : A → B, then there exists g : A → B such that f (a) ≡ g(|a|) for all a : A. We sometimes pronounce A as "merely A", e.g. if we have an element of A B we say that A and B are merely equivalent.Both univalence and propositional truncation imply function extensionality; the former is due to Voevodsky (see e.g.[Uni13, §4.9]) and the latter to [KECA14,Corollary 8.3].
With homotopy-theoretic intuition in mind, elements of identity types (i.e.witnesses of equality) are sometimes called paths.For p : x = A y and q : y = A z, we have p q : x = A z (a witness of transitivity) and p −1 : y = A x (a witness of symmetry), defined using the eliminator of the identity type.Similarly, if f : A → B, we have ap f (p) : f (x) = B f (y), and this operation is functorial (up to propositional equality) in two ways: ap g • ap f = ap g•f , and ap f (p q) = ap f (p) ap f (q).We will frequently use the fact that homotopies between functions satisfy a naturality property [Uni13, Lemma 2.4.3].Specifically, given g, h : B → C and L : g ∼ h, for any b 1 , b 2 : B and p : b 1 = b 2 , we have The other important facts we will use from [Uni13] are the theorems from its Chapter 2 that characterize the identity types of different type formers (sometimes requiring univalence and function extensionality).For instance, the type (a . two ordered pairs are equal just when their components are.In most cases these results are reasonably intuitive.

Some pre-idempotents that split
As suggested in the introduction, we define: Definition 3.1.A pre-idempotent is an endofunction f : X → X equipped with a witness of idempotency I : f • f ∼ f .Definition 3.2.A retract of a type X consists of a type A, functions s : A → X and r : X → A, and a homotopy H : r • s ∼ id A .A splitting of an endofunction f : X → X is a retraction (A, r, s, H) together with a homotopy K : s • r ∼ f .The following is fairly obvious.Lemma 3.3.If f has a splitting, then it is pre-idempotent.
Proof.Clearly anything homotopic to a pre-idempotent is pre-idempotent, so it suffices to show that if we have a retraction (A, r, s, H) then s • r is pre-idempotent.In this case, for any x : X, we can define I(x) :≡ ap s (H(r(x))) : s(r(s(r(x)))) = s(r(x)).
We can also show easily that splittings are essentially unique in at least a weak sense.Lemma 3.4.Suppose f : X → X has two splittings (A, s, r, H, K) and (A , s , r , H , K ).Then A A .
Proof.We have two functions r s : A → A and rs : A → A, and their composites are homotopic to identities: r srs ∼ r f s ∼ r s r s ∼ id A and similarly rs r s ∼ id A .
We expect that a split endofunction is not only pre-idempotent, but fully-coherently idempotent.As remarked in the introduction, it is difficult to define fully-coherent idempotents in type theory, but we can at least define the next step of coherence.Definition 3.5.A quasi-idempotent is a pre-idempotent (f, I) together with a witness of coherence J : x:X (ap f (I(x)) = I(f (x))).
Lemma 3.6.If f has a splitting, then it is quasi-idempotent.
Proof.As in Lemma 3.3, it suffices to show that for any retraction (A, s, r, H), s • r is quasiidempotent.For this case, in Lemma 3.3 we defined I(x) :≡ ap s (H(r(x))) : s(r(s(r(x)))) = s(r(x)).Thus, for x : X the desired type of J(x) is This is equivalent to Peeling off an ap s , and letting a :≡ r(x), it will suffice to show that for any a : A we have At first this seems like a nontrivial property of H.However, in fact it is automatic.For by naturality of the homotopy H applied at the equality H(a), we have Now we can cancel H(a) from both sides to obtain the desired result.
We now give a few conditions under which pre-idempotents can be split.Our first observation is: Theorem 3.7.If X is a set, then any pre-idempotent on X has a splitting.
Proof.Define A :≡ x:X (f (x) = x), and let s and r be defined by s(x, p) = x and r(x) = (f (x), I(x)).Now for x : X, we have s(r(x)) ≡ f (x) by definition; hence we can take K(x) :≡ refl f (x) .On the other hand, for (x, p) : A we have r(s(x, p)) ≡ (f (x), I(x)); thus H(x, p) must inhabit ((f (x), I(x)) = (x, p)).By [Uni13, Theorems 2.7.2 and 2.11.3], to give an element of this type we must give q : f (x) = x and r : ap f (q) −1 I(x) q = p.But we can take q :≡ p, and obtain r from the assumption that X is a set.Now here is our elaboration of Example 1.1, showing that this construction cannot always work.
Example 3.8 (Escardó).Let X be any type and f :≡ id X , with I(x) :≡ refl x .Then with the above-defined A, s, and r, the desired type of H(x, p) is equivalent to q −1 refl x q = p, and hence to refl x = p.If this is true for all x : X and all p : x = x, then X satisfies uip.
Escardó has also observed a couple of other situations in which pre-idempotents can be split.For the first, recall from [KECA14] that a function f : X → Y is weakly constant if we have a witness x,y:X (f (x) = f (y)).
Theorem 3.9 (Escardó).If a pre-idempotent is weakly constant, then it has a splitting.
Proof.We use the same construction as in Theorem 3.7; by following the proof thereof, it remains only to construct H.However, by [KECA14, Lemma 4.1] 1 , when f is weakly constant, our type A :≡ x:X (f (x) = x) (there called fix(f )) is a mere proposition, i.e. we have a,b:A (a = b).This makes the construction of H trivial.
Conversely, it is easy to see that if an endofunction splits through a mere proposition, then it is weakly constant.
For the second, recall from [KECA14] that a type admits a weakly constant endofunction if and only if there is some mere proposition P with functions A → P and P → A (since any function that factors through a mere proposition is weakly constant, while by [KECA14, Lemma 4.1] if f is weakly constant we can take P :≡ fix(f )).Moreover, if we have propositional truncation, this condition is equivalent to the existence of a map A → A, a property which one may call having split support.Finally, recall from [Uni13, Lemma 7.6.2]that a function f : A → B is said to be an embedding if for all b : B the type The following theorem is our first example of a definable splitting in which the splitting type A is not the obvious x:X (f (x) = x).
Theorem 3.10 (Escardó).An endofunction f has a splitting in which the section s is an embedding if and only if it is pre-idempotent and the type f (x) = x admits a weakly constant endofunction for all x.
(It is arguably more natural to formulate this theorem in terms of split support.The advantage of using weakly constant endofunctions instead is that it makes sense even in the absence of propositional truncation.) Proof.First suppose f is pre-idempotent and each f (x) = x has a weakly constant endofunction.Thus, for each x there is a mere proposition P x and maps u x : (f (x) = x) → P x and v x : P x → (f (x) = x).(If we have propositional truncation, we can take P x :≡ f (x) = x , and the reader may find it easier to think about this case.)We define A :≡ x:X P x , with s(x, p) :≡ x and r(x) :≡ (f (x), u f (x) (I(x))), while K(x) :≡ refl f (x) as before.For H, given (x, p) : A where x : X and p : P x , we must show that (f (x), u f (x) (I(x))) = (x, p), which as before amounts to giving q : f (x) = x and an equality q * (u f (x) (I(x))) = p, where q * : P f (x) → P x denotes transport along q.But we can define q :≡ v x (p), while the remaining equality is trivial since P x is a mere proposition.Now conversely, suppose f has a splitting in which s is an embedding; it remains to show that f (x) = x has a weakly constant endofunction for all x : X.Since s is an embedding, the type a:A (s(a) = x) is a mere proposition.Thus, it will suffice to construct maps in both directions relating this type to f (x) = x, or equivalently to the type s(r(x)) = x.In one direction, given p : s(r(x)) = x, we have (r(x), p) : a:A (s(a) = x).In the other, given a : A and p : s(a) = x, we have s(r(x)) = s(r(s(a))) = s(a) = x.
(1) Theorem 3.7 is a special case of Theorem 3.10: if X is a set, then each type f (x) = x is a mere proposition, hence trivially has a weakly constant endofunction.Moreover, by [KECA14, Theorem 3.10], if every type x = X y has a weakly constant endofunction, then X is necessarily a set.However, there do exist functions on non-sets to which Theorem 3.10 applies; a trivial example is X :≡ Y + 1 with f (x) :≡ inr(tt).
(2) On the other hand, there can exist retractions for which the section is not an embedding.
For instance, any map 1 → X exhibits 1 as a retract of X, but to say that all such maps are embeddings is just to say that X is a set.Thus, Theorem 3.10 emphasizes another way in which idempotents in homotopy theory differ from idempotents in set theory, since in set theory the splitting of an idempotent always injects into the original set.(3) When the conditions of Theorem 3.10 fail, it doesn't generally mean there is any particular x : X such that f (x) = x does not have a weakly constant endofunction.
It only means we cannot assert that "f (x) = x has a weakly constant endofunction for all x : X", since such an assertion would imply an impossible "naturality" of the endofunctions.
(4) Perhaps surprisingly, none of the results in this section require even function extensionality.

A pre-idempotent that doesn't split
As mentioned in the introduction, it's easy to give examples of idempotence witnesses I : f • f ∼ f that cannot be extended to a coherent system of idempotence data.
Example 4.1.Let X be any type with a point x 0 : X for which there exists a nontrivial p : x 0 = x 0 , i.e. such that p = refl x 0 .(For instance, in the presence of the univalence axiom, we could let X be the universe, with x 0 a type admitting a nonidentity self-equivalence, such as 2.) Define f : X → X by f (x) :≡ x 0 for all x, and let I(x) :≡ p for all x.Then (f, I) is a pre-idempotent.But ap f (q) = refl x 0 for all q, so the second-level coherence type x:X (ap f (I(x)) = I(f (x))) is equivalent to x:X (refl x 0 = p), which by assumption is not inhabited.
However, it's less clear how to exhibit a pre-idempotent (f, I) for which there cannot exist any other witness I that is coherent.For instance, in the above example, we could simply have taken I (x) :≡ refl x 0 .We will describe an example inspired by that of [Lur14, Warning 1.2.4.8], but not quite identical to it.In Lurie's example, the space X is the classifying space of the group of endpoint-preserving self-homeomorphisms of the unit interval [0, 1].However, the essential feature of this choice, for the purposes of the example, is that two such homeomorphisms can be shrunk by a factor of 2 and glued together to form a new such.This is reminiscent of Freyd's universal characterization of [0, 1] (see e.g.[Joh02, D4.7.17]), but in fact it can be completely divorced from the topology.Thus, we will instead use a type familiar to constructive mathematicians: the Cantor space.
The essential property of C, for our purposes, is the following.Proof.From left to right, given c : N → 2 we define c (n) :≡ c(n + 1), and split into cases based on whether c(0) is 0 or 1.In the former case, we send c to inl(c ), and in the second case we send it to inr(c ).
We now consider the "classifying space of the automorphism group of C", starting by defining it.
Assumption 4.4.For the rest of this section we assume both univalence and propositional truncation.
From this assumption we also get function extensionality.In fact, as noted earlier, both univalence and propositional truncation separately imply it.Our incoherent pre-idempotent will live on the type X :≡ BAut(C), where C is the Cantor space.Thus, we must next construct a particular map f : X → X.If we translated Lurie's construction directly, we would do this by first defining an automorphism F of the group Aut(C), by sending an automorphism h to the automorphism F (h) defined as the composite where the equivalences come from Lemma 4.3.Then we would use the fact that an automorphism of a group induces an automorphism of its classifying space to obtain from F an automorphism of BAut(Y ).
However, although this fact is standard in homotopy theory, it is not obvious from our definition of BAut(Y ) in type theory that any automorphism of the group Aut(Y ) induces an automorphism of the type BAut(Y ).It can be deduced from the alternative construction of classifying spaces in [LF14]; but fortunately in our case there is a better approach.
The univalence axiom has allowed us to define BAut(Y ) in such a way that its elements literally are types that are merely equivalent to Y (or more precisely, equipped with such a mere equivalence).Thus, we can define f to act directly on such types, rather than indirectly on their automorphisms.Specifically, if we define f (Z) :≡ Z + C, then the induced action on automorphisms will automatically have the intended effect as shown above.
All we have to do is verify that this definition indeed defines an endomorphism of BAut(C), i.e. that if Z = C then also Z + C = C .By the induction principle of propositional truncation, it suffices to prove that if Z = C then Z + C = C, and by univalence it suffices to prove that if e : Z C then Z + C C. But for this we have the composite where the first equivalence is e + id and the second is Lemma 4.3.
Next, we have to construct a witness of pre-idempotency for f , i.e. we must show that for any Z : BAut(C) we have (Z + C) + C = Z + C. We again apply univalence and then use the following composite equivalence: consisting of the associativity of coproducts together with Lemma 4.3.
We are now ready for the central theorem of this section.
Theorem 4.6.There exists a pre-idempotent on X :≡ BAut(C) that does not split.
Proof.The construction of the pre-idempotent is as above; it remains to show that f does not split.Lurie's argument is that if it did, then the colimit • would be its splitting, and hence the map from X to that colimit would be surjective on fundamental groups; whereas f itself is certainly not surjective on fundamental groups and so this is impossible.In type theory, colimits are difficult to work with, though homotopy type theory with higher inductive types makes them more tractable than otherwise.However, we can fortunately again give a more direct argument, based on our concrete construction of BAut(C).
Suppose for contradiction that f is split.Then by Lemma 3.6 it is quasi-idempotent, with witnesses I and J.For any Z : BAut(C), we have by univalence and function extensionality, J(Z) may equivalently be regarded as a homotopy between two specified equivalences (Z The first of these equivalences (corresponding to ap f (I(Z))) decomposes the domain and codomain as (Z +C +C)+C and (Z +C)+C, mapping the first summand Z +C +C to Z +C by I(Z) and the second summand C to C by the identity.As for the second equivalence, if I were the witness (4.1) that we gave above, then the equivalence Z + C + C + C → Z + C + C corresponding to I(f (Z)) would bracket the domain instead as (Z + C) + (C + C) and map it to (Z + C) + C by the identity on Z + C and the "fold" equivalence C + C → C. Thus, the two could not possibly be homotopic, since they would send the third summand of Z + C + C + C to different summands of the codomain.
This argument doesn't quite work as stated, since I might not be the same proof of idempotency that we gave above.(Remember that we are supposing only that f is split, hence quasi-idempotent, in some way, since the claim to prove is that f is not split, which makes no reference to any previously existing witness of pre-idempotence.)However, whatever I is, it is defined "for all Z : BAut(C)".This implies that the induced equivalences Z + C + C → Z + C must be natural with respect to equivalences between Zs (this is not exactly the same sort of naturality that we mentioned in §2, but it follows similarly).In other words, for any Z, Z : BAut(C) and equivalence e : Z Z , the following square must commute (up to homotopy): In particular, we can take Z and Z to be both f (C), i.e.C + C, and let e be the "flip" automorphism C + C C + C that interchanges the summands.Then the horizontal maps in (4.3) are both the equivalence (C + C) + C + C → (C + C) + C induced by I(f (C)), and (4.3) itself becomes Consider elements of the third and fourth summands in the upper-left corner, which are fixed by e + id + id on the left.Since the two horizontal maps are both I(f (C)), it must be that the image of any such element under I(f (C)) is fixed by e + id on the right.But the only elements of C + C + C fixed by e + id are those in the third summand.Thus, I(f (C)) must map the last two summands in the domain to the last one summand in the codomain, just as our original witness of pre-idempotency did, so our previous argument to a contradiction kicks in.
Note that we actually showed a bit more: there is a pre-idempotent on BAut(C) that is not even quasi-idempotent.Because univalence and propositional truncation are consistent assumptions, we conclude: Corollary 4.7.It is impossible to prove in mltt that all pre-idempotents split, or even that all pre-idempotents are quasi-idempotent.

All quasi-idempotents split
We now show, in contrast to Theorem 4.6, that any quasi -idempotent can be split, assuming nothing more than function extensionality.There is an obvious naive thing to try: just as J extends I with an additional coherence, we might try to extend the type x:X (f (x) = x) that worked sometimes in §3 with an additional coherence, defining x:X p:f (x)=x (ap f (p) = I(x)). (5.1) However, Kraus has shown that this does not work in general.
Example 5.1 (Kraus).Let X be a type with an element x 0 : X, and define f : X → X by f (x) :≡ x 0 for all x : X.Then f is quasi-idempotent with I(x) :≡ refl x 0 and J(x) :≡ refl reflx 0 for all x.However, the type of (5.1) in this case becomes x:X p:x 0 =x (refl x 0 = refl x 0 ).This is equivalent to q: x:X (x 0 =x) (refl x 0 = refl x 0 ) and thence to simply refl x 0 = refl x 0 , since the type x:X (x 0 = x) is contractible.
On the other hand, f has an evident splitting with A :≡ 1, where s picks out the point x 0 .Thus, if (5.1) were also a splitting of it, then by Lemma 3.4 it would be equivalent to 1, i.e. contractible.
However, assuming univalence, there are pointed types (X, x 0 ) for which refl x 0 = refl x 0 is not contractible.For instance, we can take X to be the universe Type, with x 0 :≡ BAut(2).In this case, a nontrivial element of refl x 0 = refl x 0 is constructed in the proof of [Uni13, Theorem 4.1.3](we will give a slightly different construction of the same element in Remark 8.4).Thus, mltt cannot prove that (5.1) always splits a quasi-idempotent.
Thus thwarted in our naïve attempts, we turn again to ∞-category theory.The proof in [Lur14,Lemma 7.3.5.14] shows that one extra coherence datum suffices to construct a splitting as the colimit of the infinite sequence As observed before, colimits are difficult to handle in type theory.Fortunately, idempotents are completely self-dual, so we might just as well consider the limit of the infinite sequence This is easy to define in type theory: it is a:N→X n:N (f (a n+1 ) = a n ).Here we see the need for function extensionality: this type involves functions, and we need to construct equalities in it to exhibit it as a retract of X.For reference, we record exactly how to construct equalities in this type.
Lemma 5.2.Given (a, α) and (b, β) in a:N→X n:N (f (a n+1 ) = a n ), to show that they are equal (assuming function extensionality) it is necessary and sufficent to (1) Construct for each n : N an equality ξ n : a n = b n , and (2) Show that for each n : N the following diagram of equalities commutes: Proof.A straightforward application of the results of [Uni13, Chapter 2].Now we can prove the main theorem of this section.
(Note that both components of r(x) are actually constant functions, i.e. independent of n.) Now we obviously have s • r = f ; the tricky part is proving r • s = 1.
Let (a, α) : A, so that a : N → X and α : n:N (f (a n+1 ) = a n ).We must show (a, α) = r(s(a, α)).By definition, both components of r(s(a, α)) are constant, the first at f (a 0 ) and the second at I(a 0 ); thus we need a family of equalities a n = f (a 0 ) that satisfy commutativity relations.For convenience, we break this down into two steps, by defining an intermediate element (b, β) : A and showing that (b, β) = (a, α) and also (b, β) = r(s(a, α)).The definition is To show that (b, β) = (a, α), we apply Lemma 5.2 with We thus have to show that which (after cancelling α n ) we can do as follows: Next we have to show that (b, β) = r(s(a, α)).By definition, r(s(a, α)) ≡ (λn.f (a 0 ), λn.I(a 0 )).Invoking Lemma 5.2 again, we need to firstly construct ξ n : f (f (a n+1 )) = f (a 0 ) for all n.
We do this by induction on n.The base case n ≡ 0 is simply ap f (α 0 ) : f (f (a 1 )) = f (a 0 ), while the induction step is the composite of ap f (α n+1 ) and I(a n+1 ) −1 with the induction hypothesis.
It remains to show that ap f •f (α n+1 ) ξ n = ap f (ξ n+1 ) I(a 0 ) for all n, and we do this by induction on n as well.For the base case n ≡ 0, this means to check that Applying functoriality of ap f on the right, canceling a copy of ap f •f (α 1 ) on both sides, and rearranging a little this becomes But using J we can make this into which is an instance of naturality for I.
Finally, for the induction step, our inductive hypothesis is that the following diagram commutes: and our goal is (after applying functoriality of ap f ) to prove that the outer boundary of the following diagram commutes.
The square marked (IH) is just the inductive hypothesis, while what remains can be filled in by naturality and a further application of J.
Remark 5.4.Note that the type A and the section s : A → X involved in the spltting can be defined without knowing either I or J, while the retraction r : X → A and the homotopy K : s • r ∼ f require only I. It is only the other homotopy H : r • s ∼ id A that requires the extra coherence datum J, and likewise only this homotopy that requires function extensionality.

Splitting is a retraction
Assumption 6.1.In this section we assume the univalence axiom.
Proof.Given a retraction s : A → X and r : X → A with H : r • s ∼ 1, the induced I was defined in Lemma 3.3 by I(x) :≡ ap s (H(r(x))).For the splitting from Theorem 5.3 with A :≡ a:N→X x:X (f (a n+1 ) = a n ), we have s(a, b) :≡ a 0 , so the induced I (x) is just the 0-component of the homotopy H : r • s ∼ 1 at r(x) :≡ (λn.f (x), λn.I(x)).By construction, this is the composite where I is the given witness of pre-idempotence.But by the given J, we have ap f (I(x)) = I(f (x)), so this reduces to just I(x).
Thus, if the further coherence witness J were also recovered from the splitting, we would have uli • split = id, and hence (assuming univalence, so that the results of the previous section apply) split and uli would be inverse equivalences between Retr(X) and QIdem(X).By Corollary 6.4 and Corollary 6.5, this would also yield equivalences between Split(X, f ) and QIdem(X, f ), and between Split(X, f, I) and QIdem(X, f, I), for any f and I.We will show that this is impossible in general, beginning with the following observation.
Lemma 7.2.Assuming univalence, if f :≡ id X and I(x) :≡ refl x for all x, then the type Split(X, f, I) is contractible.
Proof.Recall that for any type B and point b 0 : B, the type b:B (b = b 0 ) is contractible.By univalence, it follows that for any type X, the type A:Type (A X) is contractible.Since Split(X, f, I) begins with a A:Type , it will suffice to show that the rest of it is equivalent to (A X).
We will use the "half-adjoint equivalence" definition of (A X) from [Uni13, §4.2].The data r and s are, of course, maps back and forth, while since f ≡ id X the data H and K have the right types to be the homotopies and η.It remains, therefore, to show that the type of the remaining datum: is equivalent to a:A (ap s (H(a)) = K(s(a))).Now since f ≡ id X and I(x) ≡ refl x , we can discard the ap f , move the K(x) −1 to the other side, and then cancel it.If we move K(s(r(x))) to the other side as well, we obtain x:X (ap s (H(r(x))) = K(s(r(x)))).Finally, since s, H, and K suffice to show that r is an equivalence, we can transport along it to obtain the desired type a:A (ap s (H(a)) = K(s(a))).
Therefore, if we had uli•split = id, then QIdem(X, id X , λx.refl x ) would also be contractible for any X.However, QIdem(X, id X , λx.refl x ) reduces to x:X (refl x = refl x ), which we might call the 2-center of X (see §8 for why).Thus, it suffices to construct a type X whose 2-center has nontrivial inhabitants.Of course, such an X cannot be a set or even a 1-type, but it will suffice for it to be a 2-type (i.e. its twice-iterated equality types p = (x= X y) q are sets).
Remark 7.3.As pointed out by a referee, there are many ways to construct such a 2-type using higher inductive types.For instance, if X is the 2-truncation of the 2-sphere, we can define an element of x:X (refl x = refl x ) by truncation-induction (since refl x = refl x is a 0-type) followed by sphere-induction, sending the basepoint to the generating 2-loop and the rest being trivial for truncation reasons.More generally, we could take X to be an Eilenberg-Mac Lane space K(G, 2) for any nontrivial abelian group G (see [LF14]) -the 2-truncation of the 2-sphere is a K(Z, 2).However, if we are willing to work a little harder, Rearranging this with [Uni13, Theorem 2.15.7] (the "type-theoretic axiom of choice"), we obtain f : Z:Type (Z=X)→P (Z) Z:Type p,q:Z=X (f (Z, p) = f (Z, q)).Applying the universal property of identity types [Uni13, (2.15.10)], this becomes f : Z:Type (Z=X)→P (Z) The same property implies that Z:Type (Z = X) → P (Z) is equivalent to P (X), where the inverse equivalence sends e : P (X) to λZ.λq.q * (e).Transferring across this equivalence, we obtain the desired result.
We can use this to characterize types of the form Z:BAut(X) (Z = Z), which are "one level down" from the type Z:BAut(X) (refl Z = refl Z ) considered in Theorem 7.4.
Proof.Since X is a set, Z = Z is a set for any Z : BAut(X).Thus, by Lemma 8.2, Z:BAut(X) (Z = Z) is equivalent to e:X=X g:X=X (g * (e) = e).The result follows by applying [Uni13, Theorem 2.11.5] and the univalence axiom.
Remark 8.4.If X :≡ 2, it is easy to show that X has precisely two automorphisms, the identity and the flip.Since the flip is an involution, it commutes with itself, and of course it commutes with the identity; thus by Lemma 8.3 it yields a nontrivial element of Z:BAut(2) (Z = Z).This gives a slightly different proof of [Uni13, Theorem 4.1.3].In fact, Lemma 8.3 gives the stronger result that Z:BAut(2) (Z = Z) has exactly one nontrivial element (hence in particular our nontrivial element agrees with that of [Uni13, Theorem 4.1.3]).Lemma 8.3 says that Z:BAut(X) (Z = Z) is equivalent to the type of automorphisms of X that commute with all other automorphisms of X, i.e. the center of Aut(X).This explains why when we move up a level to the type appearing in Theorem 7.4, we may reasonably call it the 2-center.
g:X X x:X (ap g (f (x)) = f (g(x))).Proof.Since X is a 1-type, (refl Z = refl Z ) is a set for any Z : BAut(X).Thus, by Lemma 8.2, Z:BAut(X) (refl Z = refl Z ) is equivalent to e:refl X =refl X g:X=X g * (e) = e.Now by univalence and function extensionality, refl X = refl X is equivalent to x:X (x = x), while of course X = X is equivalent to X X.Under this equivalence, g * (e) is identified with λx.ap g (f (g −1 (x))).Finally, since g is an equivalence, we can transfer it to the other side of the equation and obtain the desired result.
We want to apply Lemma 8.5 to X :≡ BAut(2).In that case, we have a nontrivial f : x:BAut(2) (x = x) from Remark 8.4.Therefore, to prove Theorem 7.4 it remains to show that this f satisfies ap g (f (Z)) = f (g(Z)) for all automorphisms g of BAut(2) and all Z : BAut(2).
Of course, this requires knowing something about all automorphisms of BAut(2).In our proof sketch of Theorem 7.4, we claimed that the space of automorphisms of BAut(2) should be equivalent to BAut(2) itself, but our argument involved decomposing an ∞-groupoid into "objects, morphisms, and 2-morphisms" which is not possible in homotopy type theory.Instead, we need to give a more "synthetic" argument, analogous to our construction of the incoherent pre-idempotent on BAut(C) in §4.
The idea is as follows: since 2 is an abelian group (the cyclic group of order 2), BAut(2) should also be an abelian ∞-group.Since multiplication by a fixed element of an ∞-group is an equivalence, this will give us a map BAut(2) → (BAut(2) BAut( 2)), which we can then show to be an equivalence.Now we have to define the group operation on BAut(2) internally.The idea to keep in mind is that the elements of BAut(2) are the "finite sets with two elements".They are merely isomorphic to 2, but to specify such an isomorphism 2 Z is the same as specifying an element of Z (to be the image of 1 : 2).
The "morally-best" definition of the group operation would perhaps be as a "tensor product over the field with two elements".However, since we are not assuming any colimits, we use instead the following: This definition is obviously symmetric, Z * W = W * Z.Moreover, it has 2 itself as a left (hence also right) identity: if W : BAut(2) then an equivalence e : 2 W is uniquely determined by e(1) : W .And Z * Z is equivalent to 2 for any Z, since it has a canonically specified element (namely the identity); thus in particular * has inverses.The trickiest part is showing associativity.We will define σ so that its action on underlying functions simply swaps arguments: σ(e)(z)(y) = e(y)(z).Thus, it will automatically be self-inverse.What remains is to show that σ(e) satisfies (1) and (2) assuming e does.
However, since all of our types are finite sets (that is, they are merely isomorphic to a standard finite type such as k:N (k < n)), a map between them is an equivalence as soon as it is injective.Thus, to show (1) for σ(e) we must show that if e(y)(z) = e(y )(z) for some z : Z, then y = y .But by (2) for e, we have y = e −1 (e(y)) and y = e −1 (e(y )), so it suffices to show that e(y) = e(y ).This follows from e(y)(z) = e(y )(z) since an equivalence between 2-element sets is determined by its action on a single element.
Similarly, to show (2) for σ(e), we must show that if e(y)(z) = e(y)(z ) for all y : Y , then z = z .But this in particular implies that e(y)(z) = e(y)(z ) for some y, and thus z = z by (1) for e.Now we can prove that BAut(2) is equivalent to its own automorphism group.The map from right to left sends e : BAut(2) BAut(2) to e −1 (2).The round-trip composite on the left is the identity since 2 is a unit for * .On the other side, we must show that for any e : BAut(2) BAut(2) and W we have e(W ) = e −1 (2) * W .
In fact, we will show that e −1 (Z) * W = Z * e(W ) for any Z, W ; the desired result then follows by taking Z :≡ 2. However, by univalence, we have (e −1 (Z) * W ) = (e −1 (Z) = W ) and similarly on the other side, and (e −1 (Z) = W ) (Z = e(W )) holds for any equivalence e.
Proof.By Remark 8.4, we have an f : x:BAut(2) (x = x) that is unequal to λx.refl x .Thus, by Lemma 8.5, it remains to show that this f satisfies ap g (f (Z)) = f (g(Z)) for all automorphisms g of BAut(2) and all Z : BAut(2).
Let g and Z be given.By Lemma 8.7, we may assume g is of the form λY.W * Y for some W : BAut(2).And since our goal is a mere proposition, we may assume that Z and W are both 2. Now since g(Y ) ≡ 2 * Y and 2 is a left unit for * , we have a homotopy H : g ∼ id.And by "dependent ap" for f (see [Uni13, Lemma 2.3.4])applied to H 2 : 2 * 2 = 2, we have However, this is just naturality for H.

Coherent idempotents
We have seen that, assuming univalence, Retr(X) is a retract of QIdem(X), and in general a nontrivial one.As remarked in the introduction, in ∞-category theory the "space of retractions of X" is equivalent to the "space of fully-coherent idempotents on X".This follows from [Lur09, Corollary 4.4.5.14].As stated, that corollary says that in an ∞-category where (fully-coherent) idempotents split, the space of all retractions is equivalent to the space of all fully-coherent idempotents; but since this equivalence is fibered over the space of objects of the ∞-category itself, it induces fiberwise equivalences for each object X.

M. SHULMAN
Thus, in homotopy type theory with the univalence axiom, it is reasonable to expect that Retr(X) should be equivalent to "the type of fully-coherent idempotents on X", if we were able to define the latter type.In particular, since Retr(X) is not generally equivalent to QIdem(X), the latter is not a correct definition of the type of fully-coherent idempotents.
As mentioned in the introduction, we could take Retr(X) as a definition of the type of fully-coherent idempotents, but this would suffer from two drawbacks: (1) It would be aesthetically unsatisfying to say that "an idempotent" comes by definition equipped with a splitting.Morally, splitting should be something that is done to an idempotent.
(2) It lives in a higher universe than the type X, since it involves a A:Type .Both of these problems can be solved with the following observation: since Retr(X) is a retract of QIdem(X), the composite uli • split is a quasi-idempotent on QIdem(X).We can therefore split it using the construction of Theorem 5.3.By Lemma 3.4, the resulting type will be equivalent to Retr(X); but it will live (like QIdem(X) itself) in the same universe as X, and its elements do not obviously contain a splitting.Thus, we propose the following definition.
Definition 9.1.A (fully-coherent) idempotent on a type X is an element of the splitting of uli • split.Somewhat more explicitly, this type is Idem(X) :≡ a:N→QIdem(X) n:N (uli(split(a n+1 )) = a n ).
Similarly, an idempotent structure on f : X → X is an element of the splitting of the similarly induced idempotent on QIdem(X, f ).
It is worth thinking a little about what assumptions are necessary for this definition.It may appear at first to require univalence, since uli • split is only a (quasi-)idempotent because of Lemma 6.3, which uses univalence.However, as observed in Remark 5.4, to define the splitting type of an idempotent does not require the witnesses of quasi-idempotency or pre-idempotency.Thus, in order to define the type Idem(X) we really only require function extensionality, since that suffices to define the maps uli and split.
It is possible, of course, to unwind this definition further, but it becomes quite complicated.Nevertheless, it is satisfying that we can give some correct definition of fully-coherent idempotent, since the general problem of representing fully-coherent higher homotopy structures in type theory is unsolved.
There is an interesting analogy to the situation with equivalences.The naïve definition of an equivalence (or isomorphism) between types A and B would be (9.1)However, this gives the wrong homotopy type.We might then think that we need an infinite tower of further coherences, but in fact it suffices to give one additional datum, although there are several choices for what that extra datum might be (see [Uni13, Chapter 4]).Nevertheless, given an element of (9.1), it is possible to alter one of its constituent homotopies to obtain a fully-coherent equivalence.This exhibits the type of equivalences as a retract of (9.1), just as our type of idempotents is a retract of the type of quasi-idempotents.There is a difference, however, in that "f is an equivalence" is a mere proposition, whereas "f is an idempotent" is not.

Conclusions
The main result of this paper is that not all idempotents in Martin-Löf type theory can be proven to split, but if we assume function extensionality then one additional coherence condition suffices to make an idempotent splittable.In addition to its intrinsic interest, this shows how ideas from homotopy theory and higher category theory can be useful even for the study of non-homotopical type theory.
In the homotopical case, however, there is more to say about idempotents, which can be partially or fully coherent.Although fully coherent homotopical structures are often difficult to define in type theory, we have managed to define the type of fully coherent idempotents, by splitting an idempotent on the type of partially coherent ones.
With that said, this paper still leaves a number of interesting open questions about idempotents in type theory.
Open Problem 10.1.Can we split quasi-idempotents in mltt without assuming function extensionality?In particular, is there any more "finite" way to construct such a splitting?Open Problem 10.2.Is the section Idem(X) → QIdem(X) an embedding?Equivalently, by Theorem 3.10, does the type uli(split(f, I, J)) = (f, I, J) admit a weakly constant endofunction for every quasi-idempotent (f, I, J)?I expect the answer is no, but an explicit counterexample would be nice to have.Open Problem 10.3.Similarly, is the induced map from Idem(X) to the type PIdem(X) of pre-idempotents an embedding?Again, I expect the answer is no, but this appears to be an open problem even in ∞-category theory; see [Shu14].
Open Problem 10.4.Can Idem(X) be defined without assuming even function extensionality?More precisely, is there a type we can define without function extensionality that becomes equivalent to Idem(X) if we assume function extensionality?Open Problem 10.5.Are there any other fully-coherent higher-homotopy structures that can be obtained from a finite amount of coherence by splitting an idempotent?
Definition 4.5.For any Y : Type, we define BAut(Y ) :≡ Z:Type Z = Y .M. SHULMAN Because Z = Y is a mere proposition, if we have (Z, e) and (Z , e ) in BAut(Y ), the type (Z, e) = (Z , e ) is equivalent to Z = Z and hence (by univalence) to Z Z .This justifies abusing the notation by identifying an element of BAut(Y ) with its first component, which is a type Z that comes equipped with an element of Z = Y .In particular, we have the canonical element (Y, |refl Y |) : BAut(Y ), and the type (Y, |refl Y |) = (Y, |refl Y |) (the "loop space" of BAut(Y ) at this "basepoint") is equivalent to Y Y , the type of automorphisms of Y .It is in this sense that BAut(Y ) is a classifying space for the automorphism group of Y .(The type BAut(Y ) is also a classifying space in another sense: to give a map A → BAut(Y ) is equivalent to giving a map p : B → A such that every fiber is merely equivalent to Y , i.e. for each a : A we have Y = b:B (p(b) = a) .)

Lemma 8. 6 .
For any Z, W, Y : BAut(2) we have (Z * W ) * Y = Z * (W * Y ).Proof.Since * is symmetric, it suffices to prove Y * (Z * W ) = Z * (Y * W ). We will show that for all Y, Z, W there is a map σ : Y * (Z * W ) → Z * (Y * W ), and that this map is its own inverse (when applied with Y and Z switched).Now, an element of Y * (Z * W ) can be regarded as a function e : Y → (Z → W ) with the additional properties that (1) each function e(y) : Z → W is an equivalence, and (2) e induces an equivalence from Y to Z W . Since being an equivalence is a mere proposition, two elements of Y * (Z * W ) are equal just when their underlying functions e : Y → (Z → W ) are.