Injective types in constructive HoTT/UF.
This is a very long thread, written in the style of a blog post, but split into chunks so that people can ask questions or make remarks about specific things I say or ask. I will unlist all but this initial post to avoid clutter in your timeline.
Motivation. Very often we want to extend functions to larger domains of definition. This may or may not possible.
The notion of injectivity is about the possibility of extensions, as we shall see when I eventually give the definition of injective type.
(I don't know where the terminology "injective", for mathematical objects rather than functions, comes from. Who were the first people to use and define it? I am sure this was used before the notion was defined explicitly, as is often the case.)
1/
For example, consider the function ℚ⁺ → ℝ that sends a positive rational number to its square root.
This function can be extended to a function ℝ⁺ → ℝ that generalizes square roots of rationals to square roots of positive reals.
In this particular case, the function ℚ⁺ → ℝ is continuous, and the function ℝ⁺ → ℝ is its unique continuous extension.
2/
Another example is Euler's Γ function that generalizes factorials from positive integers to the complex numbers, excluding the non-positive integers.
In this particular case, there are many other such extensions.
Here one wants extensions that are continuous and satisfy the factorial equation (n+1)! = n! × (n+1), with n generalized from natural numbers to reals or complex numbers.
3/
In some cases, it is impossible to extend functions so that they have desirable properties. For example, the continuous function ℝ\{ 0 } → ℝ that sends x to 1/x is continuous, but there is no continuous extension ℝ → ℝ that would make sense of 1/0.
4/
However, we can add a point at infinity to ℝ, as a topological space, to get the projective real line ℝ∞, its one-point compactification, so that we can define 1/0 = ∞, to get a continuous extension.
5/
The function 1/(-) : ℝ\{0} → ℝ *can* be extended to a function ℝ → ℝ, e.g by stipulating that 1/0 is π, or any other arbitrary real number.
But no such an extension can be continuous, no matter what we choose the value of 1/0 to be.
6/
In constructive mathematics, it may be that all functions are continuous.
What do we mean by this? There *are* models in which all functions are continuous.
7/
The mother of discontinuity is the principle of excluded middle.
Without it, we cannot define a discontinuous function.
We used excluded middle above to define the function that defines the value of the function at 1/0 to be π.
Given the input x of 1/x, we check wether x is zero or not, using excluded middle. If it iis zero, we define 1/x to be π, and, otherwise, we define 1/x in the usual way.
8/
Why do we care about constructive mathematics? There are zillions of reasons, depending on the constructive mathematician we speak to. The purpose of this thread is not to discuss that.
But here I want to mention two reasons that matter to me and to lots of people working on HoTT/UF.
(9.1) HoTT/UF can be interpreted in any ∞-topos, so that any statement in HoTT/UF means something in that topos.
A definition, or construction or proof in HoTT/UF makes sense in any ∞-topos.
Except if we go non-constructive and assume excluded middle and choice.
Proofs and constructions that use excluded middle, in HoTT/UF, apply only to so-called *boolean* ∞-toposes. Very few ∞-toposes are boolean.
So a main reason to be "constructive" (that is, avoid excluded middle and choice) is to be more general, in the sense of accounting for all ∞-toposes, not just the boolean ones.
(9.2) HoTT/UF can be used to compute. For example, we can compute in HoTT/UF using cubical Agda.
Not everybody, in the mathematical community, is interested in ∞-toposes (but for example Peter Scholze is, among many other people).
Not everybody is interested in computing (but a lot of us here are).
If you are not interested in (9.1) or (9.2), you will probably wish to stop reading this thread, unless you are curious to see what is going on.
9/
Having motivated the extension problem and constructivity in HoTT/UF, we move to the subject matter of this thread.
The general situation is that we have a function X → Y, and we want to extend it to a function X' → Y, where X' enlarges X.
If we did have excluded middle available, in general, the extension problem would always be solvable for non-empty Y. Given f : X → Y, we can define f' : X' → Y by f'(x) = f (x) if x in in X, and f'(x) = some arbitrarily chosen point of Y otherwise.
(You may need some additional amount of choice for this, if the assumption is simply that Y is non-empty, but I don't want to discuss this now.)
10/
Definition. A type D is injective if for every embedding j : X → X' and any function f : X → D, we can find a function f' : X' → D that extends f along j, in the sense that f' ∘ j = f.
Discussion. In HoTT/UF we have two choices. We may merely require that f' exists, or that it be explicitly given. Depending on the choice, we arrive at the notions of "injective" and "algebraically injective" type respectively.
I have studied both. Here I will restrict myself to "algebraically injective" types, for simplicity, which I will refer to as "injective" for the sake of brevity. I hope this will cause no confusion.
I developed a lot of results for (algebraically) injective types in my github repository TypeTopology [1] and then published them in the article [2]
[1] https://www.cs.bham.ac.uk/~mhe/TypeTopology/InjectiveTypes.index.html
[2] https://doi.org/10.1017/S0960129520000225
What I want to do in this thread is to quickly review what I did in that paper and then list some new results about injectivity that I have developed in TypeTopology that haven't been published yet.
(This was a longer introduction than I intended!)
11/
In some sense, the main examples of injective types are universes.
Every universe 𝓤 is injective.
Products Πᵢ Dᵢ of injective types are injective.
In particular, for any type I, if D is injective then the "exponential power" (I → D) of D is injective.
Injective types are closed under retracts.
And any injective type is a retract of an exponential power of some universe.
So the injective types are precisely the retracts of exponential powers of universes.
Another source of examples is the "lifting monad" also known as the partial-map-classifier monad.
Given any type X, we can consider the type 𝓛 X of partial elements of X, which consists of triples (P , i , f) such that P is a type, i witnesses the fact that P is a subsingleton (type with at most one element), and f is a function P → X.
The injective spaces are precisely the types that can be equipped with an Eilenberg-Moore 𝓛-algebra structure.
I deliberately omitted universe levels in this discussion, for simplicity. For full details, see the Agda code or the published paper, where the above discussion is conducted much more carefully than I want to do here.
However, for people who care about (9.1) (∞-toposes) but not about (9.2) (computation), this doesn't make any difference. The reason is that ∞-toposes satisfy "propositional resizing", and under this assumption injectivity is universe-level independent. This is also discussed in the Agda code and the paper.
(At present, there is no known computational realization of propositional resizing in HoTT/UF.)
12/
I now move to the new, unpublished results that have been collected in TypeTopology, and refereed by Agda (for correctness, but not for originality or relevance or whatever else peer reviewing in mathematics requires).
The main results are about new examples of injective types.
I list them here:
(13.1) The type of ordinals is injective.
This is the original motivation for this work. I wanted to construct plenty of "searchable" or "compact" types, which I discussed in other threads. Injectivity is a main tool for that purpose.
But this wasn't included in the above publication.
(13.2) The types of iterative multisets and of iterative sets (in the sense of Aczel with its incarnation à la Gylterud) are injective.
(13.3) The following are also injective:
* The type of pointed types.
* The type of ∞-magmas.
* The type of pointed magmas.
* The type of monoids.
(13.4) And, moreover, I proved (13.3) by developing a couple of general injectivity theorems, that are a bit technical to discuss here, but that basically say that mathematical structures that are closed under products of the underlying sets, with the underlying operations defined pointwise, form injective types. The true theorems are a bit more general than that.
They imply (although I haven't formalized this conclusion in Agda) that e.g. the type groups, the type of posets, and many more things like that, are all injective.
13/
I suspect that the type of (univalent) 1-categories is also injective, although I only have sketches of ideas of why this would be so in my mind at this stage.
These facts and ideas, as I said, are unpublished, but they are available at TypeTopology with English prose discussions and Agda code.
https://www.cs.bham.ac.uk/~mhe/TypeTopology/InjectiveTypes.index.html
14/
Here is another application of injectivity. People wondered whether the type of ordinals satisfies desirable decidability conditions.
Can you decide, constructively, whether an ordinal is zero? Or a limit ordinal? Etc.
I proved in TypeTopology, in August 2022, that the type of ordinals has some non-trivial decidable property if and only if De Morgan Law (= the negation of every proposition is decidable) [1].
So the type of ordinals is indecomposable, like the type of Dedekind real numbers and other types of real numbers.
But this actually follows from the fact that the type of ordinals is injective [1].
If a type is injective, then the existence of a non-trivial decidable property implies that De Morgan Law holds.
There are very few De Morgan toposes in the current mathematical zoo of toposes.
And De Morgan Law is certainly not "computational".
By the above, also the types of magmas, monoids, groups, posets, etc. don't have non-trivial decidable properties unless De Morgan Law holds.
[1] https://www.cs.bham.ac.uk/~mhe/TypeTopology/Taboos.Decomposability.html
End for now, but I may include further discussion if anything comes to my mind.
15/
If any of you would like to make a pull request to answer any of the above questions or "TODO"s in the files, you are most welcome!
16/
Oh, and I forgot to say explicitly that "there are enough injectives".
Every type can be embedded into an injective type.
This is similar, but not the same, as what we did when we made sense of 1/0 by passing from the topological reals to their one-point compactification that adds a point at infinity.
Then main difference is that in the above example we add one new point to make sense of the extension of a particular function.
When we want to be able to extend *all* functions, we have to add lots of new points.
There are two sort-of-canonical ways to embed any type into an injective type:
(17.1) Given X, we can embed it into the injective type X → 𝓤.
This embedding is nothing but Martin-Löf's identity type former, which has type X → (X → 𝓤).
Of course, we have to prove that this is an embedding, which it is.
(@egbertrijke and I proved this independently.)
(17.2) Given X, we can embed it into the type 𝓛 X of partial elements of X, where 𝓛 is the lifting (or partial-map classifier) monad mentioned above, using its unit X → 𝓛 X, which is an embedding.
So although not every (non-empty) type is injective without excluded middle, every type can be embedded into an injective type.
We sort of "add lots of points at infinity", so that extensions are always possible.
17/
Something amusing is that we don't seem to be able to prove that the identity type former X → (X → 𝓤) is an embedding in pure Martin-Löf Type Theory.
We can show this using the K axiom (which says that all types have homotopy level 0, or are "sets") or using the univalence axiom.
This is all the more interesting because the univalence axiom in MLTT implies the negation of K.
But a deeper look at this shows that this only says that the proof that this map X → (X → 𝓤) is an embedding doesn't need univalence when X is a set. It only needs univalence for types that are more general than sets, which is less surprising.
Addendum to 17/
I have now added a few counter-examples to injectivity in TypeTopogy.
(18.1) The two-point type 1+1 is injective if and only De Morgan Law holds.
(18.2) If any so-called simple type is injective, then De Morgan Law holds. These are the types formed by starting with ℕ and closing under function types. We can also add the type 𝟚 to the base case of the definition to get the same conclusion.
(18.3) If the type ℝ of Dedekind reals is injective then there are discontinuous functions ℝ → ℝ, e.g. the Heaviside function, but not all toposes admit discontinuous functions ℝ → ℝ.
But we can say more than that: If ℝ is injective then De Morgan Law holds (which implies WLPO).
(18.4) The injectivity of ℕ∞, the conatural numbers, or generic convergent sequence, gives WLPO, which also doesn't hold in all toposes.
https://www.cs.bham.ac.uk/~mhe/TypeTopology/InjectiveTypes.CounterExamples.html
18/
In the last few days Tom de Jong (@de_Jong_Tom ) and I showed a few more things about injective types.
In particular, our main result answers a question one of you asked in this thread: can there be an injective type in the first universe?
Not if the injective type has at least two distinct points.
More precisely, we are working in HoTT/UF without Voevodsky's resizing axioms, which are an incarnation of a notion of impredicativity for HoTT/UF. We show that from the assumption of an injective type with two distinct points, we get a weak (but still not provable) version of impredicativity.
But we do more than just that. We prove that the universe bounds for injectivity of all the previously given examples of injective types are tight, again by reduction to weak impredicativity as above.
You can learn more details by reading the (code and) the English prose of this file:
https://www.cs.bham.ac.uk/~mhe/TypeTopology/InjectiveTypes.Resizing.html
19/
And then Tom and I have a question for you.
Can S¹, the circle up to homotopy, be a (small) injective type without assuming classical logic or impredicativity?
Notice that in HoTT/UF, the type S¹ doesn't have two distinct elements. This would amount to saying that it is disconnected.
"Distinct" behaves as you are used only for sets (aka 0-types, aka 0-groupoids), but not for more general types, in particular connected types such as S¹. So the results of (19) don't apply to S¹.
A second question is this. If the answer to the above question is negative, or if the question resists to be answered, can you come up with a small, injective, connected type in the first universe (possibly/probably defined by a higher-induction)?
20/
@MartinEscardo Nice thread! I'm in the "curious to know what's going on" camp, but I have heard the term "injective" used for modules (dual to projective). Checking here
https://en.m.wikipedia.org/wiki/Injective_module
it looks like at least one of the defining conditions is the same as that of injective types. Injectivity for modules gets some use in ring theory and (I think) some related algebraic geometry. Injective resolutions of modules are one crucial part of homological algebra, for example.
@nilesjohnson Yes, I know! What I was wondering is what the first use of injectivity, and the terminology "injective" for objets is. Are injective modules the first appearence? In the early 1970's Dana Scott characterized the continuous lattices as the injectiveT0 topological spaces over subspace embeddings. Injectivity, in one way or another, also makes appearences in homotopy theory.
@MartinEscardo oh, haha, I completely misunderstood what you meant about not knowing the source of the terminology!
Your chart is ready, and can be found here:
https://www.solipsys.co.uk/Chartodon/110913121411139867.svg
Things may have changed since I started compiling that, and some things may have been inaccessible.
In particular, the very nature of the fediverse means some toots may never have made it to my instance, in which case I can't see them, and can't include them.
The chart will eventually be deleted, so if you'd like to keep it, make sure you download a copy.
@MartinEscardo It seems like all the examples you've given are 'large' things. When I hear 'HoTT' I think about its model in ∞-groupoids and in particular those representing topological spaces.
Is the sphere injective? The torus?
@OscarCunningham @MartinEscardo - those spaces aren't injective if we use this modified definition:
"A space D is injective if for every embedding j : X → X' and any continuous map f : X → D, we can find a continuous map f' : X' → D that extends f along j, in the sense that f' ∘ j = f."
For example, let D = X be the sphere and j: X → X' be the usual embedding of the sphere in the ball. Let f : X → D be the identity map from the sphere to itself. Then there's no way to extend this to a continuous map from the ball to the sphere. This is a famous result of Brouwer, now a textbook application of homology groups.
But I'm not sure what definition of "embedding" Martin is using, and how it differs from the usual definition in topology. The usual definition in topology is not homotopy-invariant! And I doubt that any homotopy-invariant definition of "embedding" will let us embed the sphere in a ball, since the ball is homotopy equivalent to a point.
@johncarlosbaez @MartinEscardo @OscarCunningham "But I'm not sure what definition of 'embedding' Martin is using". I think it must be just the ∞-categorical notion of monomorphism, which in the ∞-category of spaces boils down to this: a map j : X → Y is a monomorphism if X is the disjoint union of some of the path components of Y and j is the inclusion. And I think a space is injective if and only if it has a point:
- If D is injective then considering ∅ → pt, you see D has a point.
- And if D has a point p, then every map X → D can be extended along an arbitrary monomorphism X → X' by sending the path components of X' outside X to p.
So, I think this notion of injective is not interesting for spaces. In fact, what I said goes through as soon as you have the law of excluded middle, so this notion of injective type is really only interesting constructively. If you want to think about it in some specific ∞-topos, try sheaves of spaces on S¹.
EDIT: Apparently I can't read: Martin already explained in the thread that under excluded middle injective = inhabited. Sorry for the repetition.
@johncarlosbaez @OscarCunningham
I am using the notion of embedding of the HoTT book.
j is an embedding if the canonical map x=x' -> j(x)=j(x') that sends paths in X to paths in Y is an equivalence.
Equivalently, the fibers of j are all propositions (= types that are contractible whenever they are inhabited).
This is not the topological notion of embedding.
For example, the discrete rationals are embedded into the real numbers, but this is not a topological embedding.
@MartinEscardo @johncarlosbaez @OscarCunningham Nor is it an embedding (= (-1)-truncated map), right? (The homotopy fiber over any point of 𝐑≃1 is all of 𝐐, which is not a proposition — or are you thinking of something else than topological spaces up to weak homotopy equivalence?)
@at @johncarlosbaez @OscarCunningham
Oh. OK. This needs to be clarified (again and again) and is a fair question.
When you define the Dedekind reals in HoTT/UF, you don't get the homotopy type of the real line (which is contractible).
You get a non-contractible 0-truncated type.
There is a long and interesting mathematical story to be told here, but I will save this for another thread in the future.
In connection with this, it is perhaps worth mentioning Mike Shulman's cohesive homotopy type theory.
@OscarCunningham Some things that are small classically become large in constructive HoTT/UF.
Two examples are the type of propositions and the lifting of any small type.
These two examples are injective.
The booleans are injective if and only if De Morgan Law holds. (This is an old result by Johnstone for 1-topos theory that also holds for HoTT/UF with the "same" proof.) Hence any type that has the boolean as a retract is injective if and only De Morgan Law holds. This includes lots of types.
@MartinEscardo A possible typo on line one of post 11? Shouldn't it be "we can find a function f' : X' --> Y", instead of "we can find a function f : X --> Y"?
@isAdisplayName Thanks for paying attention. I think I've fixed it now. If not then complain again please.
@MartinEscardo probably Cartan Eilenberg, in their Homological Algebra book, around 1950.