Injective types in univalent mathematics

Abstract We investigate the injective types and the algebraically injective types in univalent mathematics, both in the absence and in the presence of propositional resizing. Injectivity is defined by the surjectivity of the restriction map along any embedding, and algebraic injectivity is defined by a given section of the restriction map along any embedding. Under propositional resizing axioms, the main results are easy to state: (1) Injectivity is equivalent to the propositional truncation of algebraic injectivity. (2) The algebraically injective types are precisely the retracts of exponential powers of universes. (2a) The algebraically injective sets are precisely the retracts of powersets. (2b) The algebraically injective (n+1)-types are precisely the retracts of exponential powers of universes of n-types. (3) The algebraically injective types are also precisely the retracts of algebras of the partial-map classifier. From (2) it follows that any universe is embedded as a retract of any larger universe. In the absence of propositional resizing, we have similar results that have subtler statements which need to keep track of universe levels rather explicitly, and are applied to get the results that require resizing.


Introduction
We investigate the injective types and the algebraically injective types in univalent mathematics, both in the absence and in the presence of propositional resizing axioms. These notions of injectivity are about the extension problem so that we get a designated extension f | j of f along j. Formally, in this definition, f | j can be regarded as a variable, but we instead think of the symbol "|" as a binary operator. For the sake of generality, we work without assuming or rejecting the principle of excluded middle, and hence without assuming the axiom of choice either. Moreover, we show that the principle of excluded middle holds if and only if all pointed types are algebraically injective, and, assuming resizing, if and only if all inhabited types are injective, so that there is nothing interesting to say about (algebraic) injectivity in its presence. That pointness and inhabitedness are needed is seen by considering the embedding 0 → 1.
Under propositional resizing principles (Univalent Foundations Program, 2013) (Definitions 25 and 52 below), the main results are easy to state: 1. Injectivity is equivalent to the propositional truncation of algebraic injectivity.
(This can be seen as a form of choice that just holds, as it moves a propositional truncation inside a -type to outside the -type, and may be related to Kenney 2011.) 2. The algebraically injective types are precisely the retracts of exponential powers of universes.
Here by an exponential power of a type B we mean a type of the form A → B, also written B A .
In particular, (a) The algebraically injective sets are precisely the retracts of powersets.
(b) The algebraically injective (n + 1)-types are precisely retracts of exponential powers of the universes of n-types. Another consequence is that any universe is embedded as a retract of any larger universe. 3. The algebraically injective types are also precisely the underlying objects of the algebras of the partial-map classifier.
In the absence of propositional resizing, we have similar results that have subtler statements that need to keep track of universe levels rather explicitly. Most constructions developed in this paper are in the absence of propositional resizing. We apply them, with the aid of a notion of algebraic flabbiness, which is related to the partial-map classifier, to derive the results that rely on resizing mentioned above.

Underlying Formal System
Our handling of universes has a model in ∞-toposes following Shulman (2019). It differs from that of the HoTT book (Univalent Foundations Program, 2013), and Coq (Coq Development Team), in that we do not assume cumulativity, and it agrees with that of Agda (Agda Community).

Our univalent type theory
Our underlying formal system can be considered to be a subsystem of that used in UniMath (Voevodsky, 2015).
1. We work within an intensional Martin-Löf type theory with types 0 (empty type), 1 (oneelement type with : 1), N (natural numbers), and type formers + (binary sum), (product), (sum) and Id (identity type), and a hierarchy of type universes ranged over by U , V, W, T , closed under them in a suitable sense discussed below.
We take these as required closure properties of our formal system, rather than as an inductive definition. 2. We assume a universe U 0 , and for each universe U we assume a successor universe U + with U : U + , and for any two universes U , V a least upper bound U V. We stipulate that we have U 0 U = U and U U + = U + definitionally, and that the operation (−) (−) is definitionally idempotent, commutative, and associative, and that the successor operation (−) + distributes over (−) (−) definitionally. 3. We do not assume that the universes are cumulative on the nose, in the sense that from X : U we would be able to deduce that X : U V for any V, but we also do not assume that they are not. However, from the assumptions formulated below, it follows that for any two universes U , V there is a map lift U ,V : U → U V, for instance, X → X + 0 V , which is an embedding with lift X X if univalence holds (we cannot write the identity type lift X = X, as the leftand right-hand sides live in the different types U and U V, which are not (definitionally) the same in general). 4. We stipulate that we have copies 0 U and 1 V of the empty and singleton types in each universe U (with the subscripts often elided). 5. We stipulate that if X : U and Y : V, then X + Y : U V. 6. We stipulate that if X : U and A : X → V then X A : U V. We abbreviate this product type as A when X can be inferred from A, and sometimes we write it verbosely as (x : X), A x. In particular, for types X : U and Y : V, we have the function type X → Y : U V. 7. The same type stipulations as for , and the same grammatical conventions apply to the sum type former . In particular, for types X : U and Y : V, we have the cartesian product X × Y : U V. 8. We assume the η rules for and , namely that f = λx, f x holds definitionally for any f in a -type and that z = ( pr 1 z, pr 2 z) holds definitionally for any z in a type, where pr 1 and pr 2 are the projections. 9. For a type X and points x, y : X, the identity type Id X x y is abbreviated as Id x y and often written x = X y or simply x = y. The elements of the identity type x = y are called identifications or paths from x to y.
10. When making definitions, definitional equality is written " def =". When it is invoked, it is written, for example, "x = y definitionally." This is consistent with the fact that any definitional equality x = y gives rise to an element of the identity type x = y and should therefore be unambiguous. 11. When we say that something is the case by construction, this means we are expanding definitional equalities. 12. We tacitly assume univalence (Univalent Foundations Program, 2013), which gives function extensionality (pointwise equal functions are equal) and propositional extensionality (logically equivalent subsingletons are equal). 13. We work with the existence of propositional, or subsingleton, truncations as an assumption, also tacit. The HoTT book (Univalent Foundations Program, 2013), instead, defines type formation rules for propositional truncation as a syntactical construct of the formal system. Here we take propositional truncation as an axiom for any pair of universes U , V:

Terminology and notation
We assume that the readers are already familiar with the notions of univalent mathematics, for example, from the HoTT book (Univalent Foundations Program, 2013). The purpose of this section is to establish terminology and notation only, particularly regarding our modes of expression that diverge from the HoTT book.

1.
A type X is a singleton, or contractible, if there is a designated c : X with x = c for all x : X: 2. A proposition, or subsingleton, or truth value, is a type with at most one element, meaning that any two of its elements are identified: X is a proposition def = (x, y : X), x = y.
3. By an unspecified element of a type X we mean a (specified) element of its propositional truncation X . We say that a type is inhabited if it has an unspecified element. If the type X codifies a mathematical statement, we say that X holds in an unspecified way to mean the assertion X . For example, if we say that the type A is a retract of the type B in an unspecified way, what we mean is that A is a retract of B . 4. Phrases such as "there exists, " "there is, " "there is some, " and "for some" indicate a propositionally truncated , and symbolically we write For emphasis, we may say that there is an unspecified x : X with A x. When the meaning of existence is intended to be (untruncated) , we use phrases such as "there is a designated, " "there is a specified, " "there is a distinguished, " "there is a given, " "there is a chosen, " "for some chosen, " and "we can find." The statement that there is a unique x : X with A x amounts to the assertion that the type (x : X), A x is a singleton: That is, there is a unique pair (x, a) with x : X and a : A x. This does not need to be explicitly propositionally truncated, because singleton types are automatically propositions. The statement that there is at most one x : X with A x amounts to the assertion that the type (x : X), A x is a subsingleton (so we have at most one pair (x, a) with x : X and a : A x). 5. We often express a type of the form (x : X), A x by phrases such as "the type of x : X with A x".
For example, if we define the fiber of a point y : Y under a function f : X → Y to be the type f −1 (y) of points x : X that are mapped by f to a point identified with y, it should be clear from the above conventions that we mean Also, with the above terminological conventions, saying that the fibers of f are singletons (i.e., that f is an equivalence) amounts to the same thing as saying that for every y : Y there is a unique x : X with f (x) = y.
Similarly, we say that such an f is an embedding if for every y : Y there is at most one x : X with f (x) = y. In passing, we remark that, in general, this is stronger than f being leftcancellable, but coincides with left-cancellability if the type Y is a set (its identity types are all subsingletons). 6. We sometimes use the mathematically more familiar "maps to" notation " →" instead of typetheoretical lambda notation "λ" for defining nameless functions. 7. Contrarily to an existing convention among some practitioners, we will not reserve the word is for mathematical statements that are subsingleton types. For example, we say that a type is algebraically injective to mean that it comes equipped with suitable data, or that a type X is a retract of a type Y to mean that there are designated functions s : X → Y and r : Y → X, and a designated pointwise identification r • s ∼ id. 8. Similarly, we do not reserve the words theorem, lemma, corollary, and proof for constructions of elements of subsingleton types, and all our constructions are indicated by the word proof, including the construction of data or structure. Because proposition is a semantical rather than syntactical notion in univalent mathematics, we often have situations when we know that a type is a proposition only much later in the mathematical development. An example of this is univalence. To know that this is a proposition, we first need to state and prove many lemmas, and even if these lemmas are propositions themselves, we will not know this at the time they are stated and proved. For instance, knowing that the notion of being an equivalence is a proposition requires function extensionality, which follows from univalence. Then this is used to prove that univalence is a proposition.

Formal development
A computer-aided formal development of the material of this paper has been performed in Agda (Agda Community), occasionally preceded by pencil and paper scribbles, but mostly directly in the computer with the aid of Agda's interactive features. This paper is an unformalization of that development, which is included as supplementary material. We emphasize that not only numbered statements in this paper have formal counterparts but also the comments in passing, and that the formal version has more information than what we choose to report here.
We have two versions. One of them (Escardó, 2019b) is in blackboard style, with the ideas in the order they have come to our mind over the years, in a fairly disorganized way, and with local assumptions of univalence, function extensionality, propositional extensionality, and propositional truncation. The other one (Escardó, 2019a) is in article style, with univalence and existence of propositional truncations as global assumptions, and functional and propositional extensionality derived from univalence. This second version follows closely this paper (or rather this paper follows closely that version), organized in a way more suitable for dissemination, repeating the blackboard definitions, in a definitionally equal way, and reproducing the proofs and constructions that we consider to be relevant while invoking the blackboard for the routine, unenlightening ones. The blackboard version also has additional information that we have chosen not to include in the article version of the Agda development or this paper.
An advantage of the availability of a formal version is that, whatever steps we have omitted here because we considered them to be obvious or routine, can be found there, in case of doubt.

Injectivity with Universe Levels
As discussed in the introduction, in the absence of propositional resizing we are forced to keep track of universe levels rather explicitly.
Definition 1. We say that a type D in a universe W is U , V-injective to mean and that it is algebraically U , V-injective to mean Notice that, because we have function extensionality, pointwise equality ∼ of functions is equivalent to equality, and hence equal to equality by univalence. But it is more convenient for the purposes of this paper to work with pointwise equality in these definitions.

The Algebraic Injectivity of Universes
Let U , V, W be universes, X : U and Y : V be types, and f : X → W and j : X → Y be given functions, where j is not necessarily an embedding. We define functions f ↓ j and f ↑ j of type Lemma 2. If j is an embedding, then both f ↓ j and f ↑ j are extensions of f along j up to equivalence, in the sense that and hence extensions up to equality if W is taken to be U V, by univalence.
Notice that if W is kept arbitrary, then univalence cannot be applied because equality is defined only for elements of the same type.
Proof. Because a sum indexed by a subsingleton is equivalent to any of its summands, and similarly a product indexed by a subsingleton is equivalent to any of its factors, and because a map is an embedding precisely when its fibers are all subsingletons.
We record this corollary: And in particular, for example, U is U , U -injective, but of course U does not live in U and does not even have a copy in U . For the following, we say that y : Y is not in the image of j to mean that j x = y for all x : X.
With excluded middle, this would give that the two extensions have the same sum and product as the non-extended map, respectively, but excluded middle is not needed, as it is not hard to see: Notice that the functions f , f ↓ j and f ↑ j, being universe valued, are type families, and hence the notations f , ( f ↓ j), f and ( f ↑ j) are just particular cases of the notations for the sum and product of a type family.
The two extensions are left and right Kan extensions in the following sense, without the need to assume that j is an embedding. First, a map f : X → U , when X is viewed as an ∞-groupoid and hence an ∞-category, and when U is viewed as the ∞-generalization of the category of sets, can be considered as a sort of ∞-presheaf, because its functoriality is automatic: If we define Then we can consider the type of transformations between such ∞-presheaves f : which are automatically natural in the sense that for all τ : f f and p : Id x y, It is easy to check that we have the following canonical transformations: It is also easy to see that, without assuming j to be an embedding, These are particular cases of the following constructions, which are evident and canonical, even if they may be a bit laborious: We also have that the left and right Kan extension operators along an embedding are themselves embeddings, as we now show.
Theorem 8. For any types X, Y : U and any embedding j : X → Y, the left Kan extension operator along j is an embedding of the function type X → U into the function type Y → U .
By function extensionality, we have that r(s f ) = f , because s is a pointwise-extension operator as j is an embedding, and by construction we have that s(r g) x : X, p : j x = y and C : g( j x), so that transport g p C has type g y, and consider the type , the map κ g y : s(r g) y → g y is an equivalence.
Because the notion of being an equivalence is a proposition and because products of propositions are propositions, the first projection is an embedding. To complete the proof, we show that there is an equivalence φ : (X → U ) → M whose composition with this projection is s, so that s, being the composition of two embeddings, is itself an embedding. We construct φ and its inverse γ by where ε f is a proof that the map κ (s f ) y is an equivalence for every y : Y, to be constructed shortly. Before we know this construction, we can see that γ and that φ(γ (g, e)) = (s(rg), ε(rg)). To check that the pairs (s(rg), ε(rg)) and (g, e) are equal and hence φ • γ ∼ id, it suffices to check the equality of the first components, because the second components live in subsingleton types. But e y says that s(r g) y g y for any y : Y, and hence by univalence and function extensionality, s(r g) = g. Thus the functions φ and γ are mutually inverse. Now, pr 1 • φ = s definitionally using the η-rule for , so that indeed s is the composition of two embeddings, as we wanted to show. It remains to show that the map κ (s f ) y : s( f y) → s(r(s f )) y is indeed an equivalence. The domain and codomain of this function amount, by construction, to respectively It is routine to check that the functions κ (s f ) y and δ are mutually inverse, which concludes the proof.
The proof of the theorem below follows the same pattern as the previous one with some portions "dualized" in some sense, and so we are slightly more economic with its formulation this time.
Theorem 9. For any types X, Y : U and any embedding j : X → Y, the right Kan extension operation along j is an embedding of the function type X → U into the function type Y → U .
By function extensionality, we have that r(s f ) = f , and, by construction, for all g : Y → U , y : Y, C : g y, x : X, p : j x = y, so that transport g p −1 C has type g( j x), and consider the type , the map κ g y : g y → s(r g) y is an equivalence.
Then the first projection pr 1 : M → (Y → U ) is an embedding. To complete the proof, we show that there is an equivalence φ : (X → U ) → M whose composition with this projection is s, so that it follows that s is an embedding. We construct φ and its inverse γ by where ε f is a proof that the map κ (sf ) y is an equivalence for every y : Y, so that φ and γ are mutually inverse by the argument of the previous proof.
To prove that the map κ (s f ) y : s(r(s f )) y → s( f y) is an equivalence, notice that its domain and codomain amount, by construction, to respectively We construct an inverse δ : It is routine to check that the functions κ (s f ) y and δ are mutually inverse, which concludes the proof.
The left and right Kan extensions trivially satisfy f ↓ id ∼ f and f ↑ id ∼ f because the identity map is an embedding, by the extension property, and so are contravariantly functorial in view of the following.
Remark 10. For types X : U , Y : V and Z : W, and functions j : Proof. This is a direct consequence of the canonical equivalences for arbitrary universes U , V, W and A : U , B : A → V, and C : B → W.
The above and the following are applied in work on compact ordinals (reported in our repository Escardó 2019c).
Remark 11. For types X : U and Y : V, and functions j : The construction is routine, and presumably can be performed for left Kan extensions too, but we have not paused to check this.

Constructions with Algebraically Injective Types
Algebraic injectives are closed under retracts: Lemma 12. If a type D in a universe W is algebraically U , V-injective, then so is any retract D : W of D in any universe W .
In particular, any type equivalent to an algebraically injective type is itself algebraically injective, without the need to invoke univalence. Proof.
For a given section-retraction pair (s, r), the construction of the extension operator for D from Lemma 13. The product of any family D a of algebraically U , V-injective types in a universe W, with indices a in a type A of any universe T , is itself algebraically U , V-injective.
In particular, if a type D in a universe W is algebraically U , V-injective, then so is any exponential power A → D : T W for any type A in any universe T . The following is a sort of ∞-Yoneda embedding: Lemma 15. The identity type former Id X of any type X : U is an embedding of the type X into the type X → U .
Proof. To show that the Id-fiber of a given A : X → U is a subsingleton, it suffices to show that if it is pointed then it is a singleton. So let (x, p) : (x : X), Id x = A be a point of the fiber. Applying the operator , seen as a map of type (X → U ) → U , to the identification p : Id x = A, we get an identification ap p : (Id x) = A, and hence, being equal to the singleton type (Id x), the type A is itself a singleton. Hence we have So by a second application of univalence we get A x = (Id x = A). Hence, applying on both sides, we get A = ( (x : X), Id x = A). Therefore, because the type A is a singleton, so is the fiber (x : X), Id x = A of A.
Lemma 16. If a type D in a universe U is algebraically U , U + -injective, then D is a retract of the exponential power D → U of U .
Proof. id -This is obtained by combining the previous two constructions, using the fact that D → U lives in the successor universe U + .

Algebraic Flabbiness and Resizing Constructions
We now discuss resizing constructions that do not assume resizing axioms. The above results, when combined together in the obvious way, almost give directly that the algebraically injective types are precisely the retracts of exponential powers of universes, but there is a universe mismatch. Keeping track of the universes to avoid the mismatch, what we get instead is a resizing construction without the need for resizing axioms: Lemma 17. Algebraically U , U + -injective types D : U are algebraically U , U -injective too.
Proof. By the above constructions, we first get that D, being algebraically U , U + -injective, is a retract of D → U . But then U is algebraically U , U -injective, and, being a power of U , so is D → U . Finally, being a retract of D → U , we have that D is algebraically U , U -injective. This is resizing down and so is not surprising. Of course, such a construction can be performed directly by considering an embedding U → U + , but the idea is to generalize it to obtain further resizing-for-free constructions, and, later, resizing-for-a-price constructions. We achieve this by considering a notion of flabbiness as data, rather than as property as in the 1-topos literature (see, e.g., Blechschmidt 2018). The notion of flabbiness considered in topos theory is defined with truncated , that is, the existential quantifier ∃ with values in the subobject classifier . We refer to the notion defined with untruncated as algebraic flabbiness.
Definition 18. We say that a type D : W is algebraically U -flabby if This terminology is more than a mere analogy with algebraic injectivity: notice that flabbiness and algebraic flabbiness amount to simply injectivity and algebraic injectivity with respect to the class of embeddings P → 1 with P ranging over subsingletons: The interesting thing about this is that the universe V is forgotten, and then we can put any other universe below U back, as follows.
Lemma 20. If a type D in the universe W is algebraically U V-flabby, then it is also algebraically U , V-injective.
Proof. Given an embedding j : X → Y of types X : U and Y : V, a map f : X → D and a point y : Y, in order to construct ( f | j) y we consider the map f y : j −1 (y) → D defined by (x, p) → f x. Because the fiber j −1 (y) : U V is a subsingleton as j is an embedding, we can apply algebraic flabbiness to get d y : D with d y = f y (x, p) for all (x, p) : j −1 (y). By the construction of f y and the definition of fiber, this amounts to saying that for any x : X and p : j x = y, we have d y = f x. Therefore we can take for any x : X, as required.
We then get the following resizing construction by composing the above two conversions between algebraic flabbiness and injectivity: Lemma 21. If a type D in the universe W is algebraically (U T ), V-injective, then it is also algebraically U , T -injective.
In particular, algebraic U , V-injectivity gives algebraic U , U -and U 0 , U -injectivity. So this is no longer necessarily resizing down, by taking V to be, for example, the first universe U 0 .

Injectivity of Subuniverses
We now apply algebraic flabbiness to show that any subuniverse closed under subsingletons and under sums, or alternatively under products, is also algebraically injective.

Definition 22. By a subuniverse of U we mean a projection
A → U with A : U → T subsingleton-valued and the universe T arbitrary. By a customary abuse of language, we also sometimes refer to the domain of the projection as the subuniverse. Closure under subsingletons means that A P holds for any subsingleton P : U . Closure under sums amounts to saying that if X : U satisfies A and every Y x satisfies A for a family Y : X → U , then so does Y. Closure under products is defined in the same way with in place of .
Notice that A being subsingleton-valued is precisely what is needed for the projection to be an embedding, and that all embeddings are of this form up to equivalence (more precisely, every embedding of any two types is the composition of an equivalence into a sum type followed by the first projection).

Lemma 23. Any subuniverse of U which is closed under subsingletons and sums, or alternatively under subsingletons and products, is algebraically U -flabby and hence algebraically
Proof. Let A be a subuniverse of U , let P : U be a subsingleton and f : P → A be given. Then define according to whether we have closure under sums or products. Because P being a subsingleton satisfies A and because the values of the map pr 1 • f : P → U satisfy A by definition of subuniverse, we have a : A X by the sum or product closure property, and d def = (X, a) has type A. To conclude the proof, we need to show that d = f p for any p : P. Because the second component a lives in a subsingleton by definition of subuniverse, it suffices to show that the first components are equal, that is, that X = pr 1 ( f p). But this follows by univalence, because a sum indexed by a subsingleton is equivalent to any of summands, and a product indexed by a subsingleton is equivalent to any of its factors.
We index n-types from n = −2 as in the HoTT book, where the −2-types are the singletons. We have the following as a corollary.
Theorem 24. The subuniverse of n-types in a universe U is algebraically U -flabby, in at least two ways, and hence algebraically U , U -injective.
Proof. We have a subuniverse because the notion of being an n-type is a proposition. For n = −2, the subuniverse of singletons is itself a singleton, and hence trivially injective. For n > −2, the n-types are known to be closed under subsingletons and both sums and products.
In particular: 1. The type U of subsingletons in a universe U is algebraically U , U -injective.
(Another way to see that U is algebraically injective is that it is a retract of the universe by propositional truncation. The same would be the case for n-types if we were assuming n-truncations, which we are not.) 2. Powersets, being exponential powers of U , are algebraically U , U -injective.
An anonymous referee suggested the following additional examples: (i) The subuniverse of subfinite types, that is, subtypes of types for which there is an unspecified equivalence with Fin (n) for some n. This subuniverse is closed under both and . (ii) Reflective subuniverses, as they are closed under . (iii) Any universe U seen as a subuniverse of U V.

Algebraic Flabbiness with Resizing Axioms
Returning to size issues, we now apply algebraic flabbiness to show that propositional resizing gives unrestricted algebraic injective resizing.
Definition 25. The propositional resizing principle, from U to V, that we consider here says that every proposition in the universe U has an equivalent copy in the universe V. By propositional resizing without qualification, we mean propositional resizing between any of the universes involved in the discussion. This is consistent because it is implied by excluded middle, but, as far as we are aware, there is no known computational interpretation of this axiom. A model in which excluded middle fails but propositional resizing holds is given by Shulman (2015).
We begin with the following construction, which says that algebraic flabbiness is universe independent in the presence of propositional resizing: Lemma 26. If propositional resizing holds, then the algebraic V-flabbiness of a type in any universe gives its algebraic U -flabbiness.
Proof. Let D : W be a type in any universe W, let P : U be a proposition and f : P → D. By resizing, we have an equivalence β : Q → P for a suitable proposition Q : V. Then the algebraic V-flabbiness of D gives a point d : D with d = ( f • β) q for all q : Q, and hence with d = f p for all p : P, because we have p = β q for q = α p where α is a quasi-inverse of β, which establishes the algebraic Uflabbiness of D.
And from this it follows that algebraic injectivity is also universe independent in the presence of propositional resizing: we convert back-and-forth between algebraic injectivity and algebraic flabbiness.
Lemma 27. If propositional resizing holds, then for any type D in any universe W, the algebraic U , V-injectivity of D gives its algebraic U , V -injectivity for any universes U and V .
Proof. We first get the U -flabbiness of D by Lemma 19, and then its U V -flabbiness by Lemma 27, and finally its algebraic U , V -injectivity by Lemma 20.
As an application of this and of the algebraic injectivity of universes, we get that any universe is a retract of any larger universe. We remark that for types that are not sets, sections are not automatically embeddings (Shulman, 2016). But we can choose the retraction so that the section is an embedding in our situation.

Lemma 28.
We have an embedding of any universe U into any larger universe U V.
Proof. For example, we have the embedding given by X → X + 0 V . We do not consider an argument that this is indeed an embedding to be entirely routine without a significant amount of experience in univalent mathematics, even if this may seem obvious. Nevertheless, it is certainly safe to leave it as a challenge to the reader, and a proof can be found in Escardó (2019a) in case of doubt.
Theorem 29. If propositional resizing holds, then any universe U is a retract of any larger universe U V with a section that is an embedding.
Proof. The universe U is algebraically U , U -injective by Lemma 3, and hence it is algebraically U + , (U V) + -injective by Lemma 27, which has the right universe assignments to apply the construction Lemma 16 that gives a retraction from an embedding of an injective type into a larger type, in this case the embedding of the universe U into the larger universe U V constructed in Lemma 28.
As mentioned above, we almost have that the algebraically injective types are precisely the retracts of exponential powers of universes, up to a universe mismatch. This mismatch is sidestepped by propositional resizing. The following is one of the main results of this paper:

Theorem 30 (First characterization of algebraic injectives). If propositional resizing holds, then a type D in a universe U is algebraically U , U -injective if and only if D is a retract of an exponential power of U with exponent in U .
We emphasize that this is a logical equivalence "if and only if " rather than an ∞-groupoid equivalence " ". More precisely, the theorem gives two constructions in opposite directions. So this characterizes the types that can be equipped with algebraic-injective structure.
Proof. ( ⇒ ): Because D is algebraically U , U -injective, it is algebraically U , U + -injective by resizing, and hence it is a retract of D → U because it is embedded into it by the identity type former, by taking the extension of the identity function along this embedding.
( ⇐ ): If D is a retract of X → U for some given X : U , then, because X → U , being an exponential power of the algebraically U , U -injective type U , is algebraically U , U -injective, and hence so is D because it is a retract of this power.
We also have that any algebraically injective (n + 1)-type is a retract of an exponential power of the universe of n-types. We establish something more general first.
Lemma 31. Under propositional resizing, for any subuniverse A of a universe U closed under subsingletons, we have that any algebraically U , U -injective type X : U whose identity types x = X x all satisfy the property A is a retract of the type X → A.
Proof. Because the first projection j : A → U is an embedding by the assumption, so is the map by a general property of embeddings. Now consider the map l : X → (X → A) defined by x → (x → (x = x , p x x )), where p x x : A(x = x ) is given by the assumption. We have that k • l = Id X by construction. Hence l is an embedding because l and Id X are, where we are using the general fact that if g • f and g are embeddings then so is the factor f . But X, being algebraically U , U -injective by assumption, is algebraically U , (U + T )-injective by resizing, and hence so is the exponential power X → A, and therefore we get the desired retraction by extending its identity map along l.
Using this, we get the following as an immediate consequence.

Theorem 32 (Characterization of algebraic injective (n + 1)-types). If propositional resizing holds, then an (n + 1)-type D in U is algebraically U , U -injective if and only if D is a retract of an exponential power of the universe of n-types in U , with exponent in U .
Corollary 33. The algebraically injective sets in U are the retracts of powersets of (arbitrary) types in U , assuming propositional resizing.
Notice that the powerset of any type is a set, because U is a set and because sets (and more generally n-types) form an exponential ideal.

Injectivity in Terms of Algebraic Injectivity in the Absence of Resizing
We now compare injectivity with algebraic injectivity. The following observation follows from the fact that retractions are surjections:

Lemma 34. If a type D in a universe
The following observation follows from the fact that propositions are closed under products.

Lemma 35. Injectivity is a proposition.
But of course algebraic injectivity is not. From this we immediately get the following by the universal property of propositional truncation: Lemma 36. For any type D in a universe W, the truncation of the algebraic U , V-injectivity of D gives its U , V-injectivity.
In order to relate injectivity to the propositional truncation of algebraic injectivity in the other direction, we first establish some facts about injectivity that we already proved for algebraic injectivity. These facts cannot be obtained by reduction (in particular, products of injectives are not necessarily injective, in the absence of choice, but exponential powers are).
Lemma 37. Any W, V-injective type D in a universe W is a retract of any type in V it is embedded into, in an unspecified way.
Proof. Given Y : V with an embedding j : D → Y, by the W, V-injectivity of D there is an unspecified r : Y → D with r • j ∼ id. Now, if there is a specified r : Y → D with r • j ∼ id then there is a specified retraction. Therefore, by the functoriality of propositional truncation on objects applied to the previous statement, there is an unspecified retraction.
Lemma 38. If a type D : U is a retract of a type D : U , then the W, T -injectivity of D implies that of D .
Proof. Let r : D → D and s : D → D be the given section retraction pair, and, to show that D is W, T -injective, let an embedding j : X → Y and a function f : X → D be given. By the injectivity of D, we have some unspecified extension f : Y → D of s • f : X → D. If such a designated extension is given, then we get the designated extension r • f of f . By the functoriality of propositional truncation on objects and the previous two statements, we get the required, unspecified extension.
The universe assignments in the following are probably not very friendly, but we are aiming for maximum generality.
Lemma 39. If a type D : W is (U T ), (V T )-injective, then the exponential power A → D is U , V-injective for any A : T .
Proof. For a given embedding j : X → Y and a given map f : X → (A → D), take the exponential transpose g : X × A → D of f , then extend it along the embedding j × id : X × A → Y × A to get g : Y × A → D and then back-transpose to get f : Y → (A → D), and check that this construction of f does give an extension of f along j. For this, we need to know that if j is an embedding then so is j × id, but this is not hard to check. The result then follows by the functoriality-on-objects of the propositional truncation.
Lemma 40. If a type D : U is U , U + injective, then it is a retract of D → U in an unspecified way.
Proof. This is an immediate consequence of Lemma 37 and the fact that the identity type former Id X : X → (X → U ) is an embedding.
With this we get an almost converse to the fact that truncated algebraic injectivity implies injectivity -the universe levels are different in the converse: So, in summary, regarding the relationship between injectivity and truncated algebraic injectivity, so far we know that if D is algebraically U , V-injective in an unspecified way, then it is U , V-injective, and, not quite conversely, if D is U , U + -injective, then it is algebraically U , U -injective in an unspecified way. Therefore, using propositional resizing, we get the following characterization of a particular case of injectivity in terms of algebraic injectivity.

Proposition 42 (Injectivity in terms of algebraic injectivity). If propositional resizing holds, then a type D : U is U , U + -injective if and only if it is algebraically U , U + -injective in an unspecified way.
We would like to do better than this. For that purpose, we consider the partial-map classifier in conjunction with flabbiness and resizing.

Algebraic Flabbiness via the Partial-Map Classifier
We begin with a generalization (Escardó and Knapp, 2017) of a familiar construction in 1-topos theory (Kock, 1991).
Definition 43. The lifting L T X : T + U of a type X : U with respect to a universe T is defined by When the universes T and U are the same and the last component of the triple is omitted, we have the familiar canonical correspondence (X → T ) ( (P : T ), P → X) that maps A : X → T to P def = A and the projection A → X. If the universe U is not necessarily the same as T , then the equivalence becomes This says that although the total space A does not live in the universe T , it must have a copy in T .
What the third component of the triple does is to restrict the above equivalences to the subtype of those A whose total spaces A are subsingletons. If we define the type of partial maps by where A → X is the type of embeddings, then for any X, Y : T , we have an equivalence so that L T is the partial-map classifier for the universe T . When the universe U is not necessarily the same as T , the lifting classifies partial maps in U whose embeddings have fibers with copies in T . This is a sort of an ∞-monad "across universes" (Escardó, 2019c), and modulo providing coherence data, which we have not done at the time of writing, but which is not needed for our purposes. We could call this a "wild monad, " but we will refer to it as simply a monad with this warning.
In order to discuss the lifting in more detail, we first characterize its equality types. We denote the projections from L T X by The unit η : X → L T X is given by where i is a proof that 1 is a proposition.
Lemma 45. The unit η X : X → L T X is an embedding.
Proof. This is easily proved using the above characterization of equality.
Lemma 46. The unit satisfies the unit equations for a monad.
Proof. Using the above characterization of equality, the left and right unit laws amount to the fact that the type 1 is the left and right unit for the operation (−) × (−) on types.
Next, L T is functorial by mapping a function f : This commutes with identities and composition definitionally. We define the multiplication μ X : = because subsingletons are closed under sums.

Lemma 47. The multiplication satisfies the associativity equation for a monad.
Proof. Using the above characterization of equality, we see that this amounts to the associativity of , which says that for P : T , Q : X → T , R : Q → T we have ( (t : Q), R t) ( (p : P) (q : Q p), R(p, q)).
The naturality conditions for the unit and multiplication are even easier to check, and we omit the verification. We now turn to algebras. We omit the direct verification of the following.
Lemma 48. Let X : U be any type.

1.
A function α : L T X → X, that is, a functor algebra, amounts to a family of functions P : (P → X) → X with P : T ranging over subsingletons.
We will write P φ as p:P φ p. 2. The unit law for monad algebras amounts to, for any x : X, which is equivalent to, for all subsingletons P, functions φ : P → X and points p 0 : P, Therefore a functor algebra satisfying the unit law amounts to the same thing as algebraic flabbiness data. In other words, the algebraically T -flabby types are the algebras of the pointed functor (L T , η). In particular, monad algebras are algebraically flabby. 3. The associativity law for monad algebras amounts to, for any subsingleton P : T and family Q : P → T of subsingletons, and any φ : So the associativity law for algebras plays no role in flabbiness. But of course we can have algebraic flabbiness data that is associative, such as not only the free algebra L T X but also the following two examples that connect to the opening development of this paper on the injectivity of universes, in particular the construction Lemma 10: Lemma 49. The universe T is a monad algebra of L T in at least two ways, with = and = .
We now apply these ideas to injectivity.
Lemma 50. Any algebraically T , T + -injective type D : T is a retract of L T D.
Proof. Because the unit is an embedding, and so we can extend the identity of D along it. Definition 52. Now, instead of propositional resizing, we consider the propositional impredicativity of the universe U , which says that the type U of propositions in U , which lives in the next universe U + , has an equivalent copy in U . We refer to this kind of impredicativity as -resizing.
It is not hard to see that propositional resizing implies -resizing for all universes other than the first one (Escardó, 2019c), and so all the assumption of -resizing does is to account for the first universe too.
Lemma 53. Under -resizing, for any type X : T , the type L T X : T + has an equivalent copy in the universe T .
We apply this lifting machinery to get the following, which does not mention lifting in its formulation.

Theorem 54 (Characterization of injectivity in terms of algebraic injectivity).
In the presence of -resizing, the T , T -injectivity of a type D in a universe T is equivalent to the propositional truncation of its algebraic T , T -injectivity.
Proof. We already know that the truncation of algebraic injectivity (trivially) gives injectivity. For the other direction, let L be a resized copy of L T D in the universe T . Composing the unit with the equivalence given by resizing, we get an embedding D → L, because embeddings are closed under composition and equivalences are embeddings. Hence D is a retract of L in an unspecified way by the injectivity of D, by extending its identity. But L, being equivalent to a free algebra, is algebraically injective, and hence D, being a retract of L, is algebraically injective in an unspecified way, because retracts of algebraically injectives are algebraically injective, by the functoriality of truncation on objects.
As an immediate consequence, by reduction to the above results about algebraic injectivity, we have the following corollary.
Theorem 55. Under -resizing and propositional resizing, if a type D in a universe T is T , Tinjective , then it is also U , V-injective for any universes U and V.
Proof. The type D is algebraically T , T -injective in an unspecified way, and so by functoriality of truncation on objects and algebraic injective resizing, it is algebraically U , V-injective in an unspecified way, and hence it is U , V-injective.
At the time of writing, we are not able to establish the converse. In particular, we do not have the analogue of Lemma 27.

The Equivalence of Excluded Middle with the (Algebraic) Injectivity of all Pointed
Types Algebraic flabbiness can also be applied to show that all pointed types are (algebraically) injective if and only if excluded middle holds, where for injectivity resizing is needed as an assumption, but for algebraic injectivity it is not.
The decidability of a type X is defined to be the assertion X + (X → 0), which says that we can exhibit a point of X or else tell that X is empty. The principle of excluded middle in univalent mathematics, for the universe U , is taken to mean that all subsingleton types in U are decidable: EM U def = (P : U ), P is a subsingleton → P + (P → 0).
As discussed in the introduction, we are not assuming or rejecting this principle, which is independent of the other axioms. Notice that, in the presence of function extensionality, this principle is a subsingleton, because products of subsingletons are subsingletons and because P + (P → 0) is a subsingleton for any subsingleton P. So in the following we get data out of a proposition.
Lemma 56. If excluded middle holds in the universe U , then every pointed type D in any universe W is algebraically U -flabby.
Proof. Let d be the given point of D and f : P → D be a function with subsingleton domain. If we have a point p : P, then we can take f p as the flabbiness witness. Otherwise, if P → 0, we can take d as the flabbiness witness.
For the converse, we use the following.
Lemma 57. If the type P + (P → 0) + 1 is algebraically W-flabby for a given subsingleton P in a universe W, then P is decidable.
Proof. Denote by D the type P + (P → 0) + 1 and let f : P + (P → 0) → D be the inclusion. Because P + (P → 0) is a subsingleton, the algebraic flabbiness of D gives d : D with d = f z for all z : P + (P → 0). Now, by definition of binary sum, d must be in one of the three components of the sum that defines D. If it were in the third component, namely 1, then P could not hold, because if it did we would have p : P and hence, omitting the inclusions into sums, and considering z = p, we would have d = f p = p, because f is the inclusion, which is not in the 1 component. But also P → 0 could not hold, because if it did we would have φ : P → 0 and hence, again omitting the inclusion, and considering z = φ, we would have d = f φ = φ, which again is not in the 1 component. But it is impossible for both P and P → 0 to fail, because this would mean that we would have functions P → 0 (the failure of P) and (P → 0) → 0 (the failure of P → 0), and so we could apply the second function to the first to get a point of the empty type, which is not available. Therefore d cannot be in the third component, and so it must be in the first or the second, which means that P is decidable.
From this we immediately conclude the following: Lemma 58. If all pointed types in a universe W are algebraically W-flabby, then excluded middle holds in W.
And then we have the same situation for algebraically injective types, by reduction to algebraic flabbiness: Lemma 59. If excluded middle holds in the universe U V, then any pointed type D in any universe W is algebraically U , V-injective.
Putting this together with some universe specializations, we have the following construction.
Theorem 60. All pointed types in a universe U are algebraically U , U -injective if and only if excluded middle holds in U .
And we have a similar situation with injective types.
Lemma 61. If excluded middle holds, then every inhabited type of any universe is injective with respect to any two universes.
Proof. Because excluded middle gives algebraic injectivity, which in turn gives injectivity.
Without resizing, we have the following.
Lemma 62. If every inhabited type D : W is W, W + -injective, then excluded middle holds in the universe W.
Proof. Given a proposition P, we have that the type D def = P + (P → 0) + 1 W is injective by the assumption. Hence it is algebraically injective in an unspecified way by Proposition 42. And so it is algebraically flabby in an unspecified way. By the lemma, P is decidable in an unspecified way, but then it is decidable because the decidability of a proposition is a proposition.
With resizing we can do better: Lemma 63. Under -resizing, if every inhabited type in a universe U is U , U -injective, then excluded middle holds in U .
Proof. Given a proposition P, we have that the type D def = P + (P → 0) + 1 U is injective by the assumption. Hence it is injective in an unspecified way by Theorem 54. And so it is algebraically flabby in an unspecified way. By the lemma, P is decidable in an unspecified way, and hence decidable.
Theorem 64. Under -resizing, all inhabited types in a universe U are U , U -injective if and only if excluded middles holds in U .
It would be interesting to get rid of the resizing assumption, which, as we have seen, is not needed for the equivalence of the algebraic injectivity of all pointed types with excluded middle.