Quotients, inductive types, and quotient inductive types

This paper introduces an expressive class of indexed quotient-inductive types, called QWI types, within the framework of constructive type theory. They are initial algebras for indexed families of equational theories with possibly infinitary operators and equations. We prove that QWI types can be derived from quotient types and inductive types in the type theory of toposes with natural number object and universes, provided those universes satisfy the Weakly Initial Set of Covers (WISC) axiom. We do so by constructing QWI types as colimits of a family of approximations to them defined by well-founded recursion over a suitable notion of size, whose definition involves the WISC axiom. We developed the proof and checked it using the Agda theorem prover.


Introduction
Inductive types are an essential feature of many type theories and the proof assistants and programming languages that are based upon them. Homotopy Type Theory [Uni13] introduces a powerful extension to the notion of inductive type: higher inductive types (HITs). To define an ordinary inductive type one declares the ways in which its elements are constructed, and these constructions may depend inductively on smaller elements. To define a HIT one not only declares element constructors, but also declares equality constructors valued in identity types (possibly iterated ones), specifying how the element constructors (and possibly the equality constructors) are related. In the language of homotopy theory, these correspond to points, paths, surfaces, and so on.
In this paper, rather than using HoTT, we work in the simpler setting of Extensional Type Theory [Mar82], where any propositional equality is reflected as a definitional equality. However, our results also hold for an intensional type theory with the uniqueness of identity proofs axiom (UIP), as demonstrated by our Agda development which can be found at [FPS21]. In either case identity types are trivial in dimensions higher than one, so that any two proofs of identity are equal. Nevertheless, as Altenkirch and Kaposi [AK16] point out, HITs are still useful in such a one-dimensional setting. They introduced the term quotient inductive type (QIT) for this truncated form of HIT.
One specific advantage of QITs over inductive types is that they provide a natural way to study universal algebra in type theory, since general algebraic theories cannot be represented in an equation-free way just using inductive notions [MM16]. As an example, the free commutative monoid on carrier X is given by the quotient inductive type of finite multisets 1 , Bag X, with constructors: This can be seen as the element constructors for lists ([] and ∶∶), along with an equality constructor swap that transposes two elements and thereby allows all reorderings of a list to be identified. Notice that the swap constructor lands in the identity type on Bag X (just written as _=_), making it an equation constructor, compared to the element constructors, [] and _∶∶_, which are familiar from ordinary inductive type definitions. There is no need to include a constructor for the congruence property of _∶∶_ since that is automatic from the congruence properties of identity types.
An alternative presentation of multisets, whose equations may be easier to work with, is: x,y∶X as,bs,cs∶Bag ′ X as = y ∶∶ cs → x ∶∶ cs = bs → x ∶∶ as = y ∶∶ bs (1.2) Notice that the comm equality constructor is conditional on two equations, as = y ∶∶ cs and x ∶∶ cs = bs, in order to deduce the final equation x ∶∶ as = y ∶∶ bs. The QWI-types introduced in this paper are not able to encode such conditional QITs (at least, not obviously so); see the discussion in the Conclusion.
Given the parameter X, the types Bag X and Bag ′ X are single quotient-inductive types, rather than indexed families defined quotient-inductively. As an example of the latter, consider the go-to example of an inductively defined family, the vector type (length-indexed lists). This has a commutative variant, AbVec X n for n ∶ N, which makes it an example of an indexed QIT. It has constructors: Our final example of a QIT is unordered countably-branching trees over X, called ωTree X, with constructors: leaf ∶ ωTree X node ∶ X → (N → ωTree X) → ωTree X where elements of isIso b witness that b is a bijection. (As with AbVec, one could similarly consider a depth-indexed variant of ωTree.) The significance of this example is that the node x _ and perm x b b ′ _ constructors have infinite arity, making this an example of an infinitary QIT. This type is one of the original motivations for considering QITs [AK16], since they can enable constructive versions of structures that classically use non-constructive choice principles, as we explain next. The examples of QITs in (1.1)-(1.3) only involve element constructors of finite arity. For example in (1.1), [] is nullary and for each x, y ∶ X, x ∶∶ _ and swap x y _ are unary. Consequently Bag X is isomorphic to the type obtained from the ordinary inductive type of finite lists over X by quotienting by the congruence generated by swap. By contrast, (1.4) involves element and equality constructors with countably infinite arity. So if one first forms the ordinary inductive type of ordered (or planar) countably-branching trees (by dropping the equality constructor perm from the declaration) and then quotients by a suitable relation to get the equalities specified by perm, one appears to need the axiom of countable choice to be able to lift the node element constructor to the quotient [AK16, Section 2.2].
The construction of the Cauchy reals as a higher inductive-inductive type [Uni13,Section 11.3] provides a similar, but more complicated example where use of countable choice is avoided. So it seems that without some form of choice principle, quotient inductive types are strictly more expressive than the combination of ordinary inductive types with quotient types. Indeed, Lumsdaine and Shulman [LS19, Section 9] turn an infinitary equational theory due to Blass [Bla83, Section 9] into a higher-inductive type that cannot be proved to exist in ZF set theory without the Axiom of Choice. In this paper we show that in fact a much weaker and constructively acceptable form of choice is sufficient for constructing indexed quotient inductive types. This is the Weakly Initial Set of Covers (WISC) axiom, originally called the "Type Theoretic Collection Axiom" TTCA f by Streicher [Str05a] and (in the context of constructive set theory) the "Axiom of Multiple Choice" by van den Berg and Moerdijk [vdBM14]. WISC is constructively acceptable in that it is known to hold in the internal logic of a wide range of toposes [vdBM14] (for example, all Grothendieck and all realizability toposes over the topos of classical sets), including those commonly used in the semantics of Type Theory. Section 4 reviews WISC and our motivation for using it herein.
We make two contributions: • First we define a class of indexed quotient inductive types called QWI-types and give elimination and computation rules for them (Section 3). The usual W-types of Martin-Löf [Mar82] are inductive types giving the algebraic terms over a possibly infinitary signature. One specifies a QWI-type by giving a family of equations between such terms. So such types give initial algebras for (families of) possibly infinitary algebraic theories. They can encode a very wide range of examples of, possibly infinitary, indexed quotient inductive types (Section 7). In classical set theory with the Axiom of Choice, QWI-types can be constructed simply as quotients of the underlying Indexed W-type-hence the name. • Second, our main result (Theorem 6.1) is that with only WISC it is still possible to construct QWI-types from inductive types and quotients in the constructive type theory of toposes, but not simply by quotienting a W-type. Instead, quotienting is interleaved with an inductive construction. To make sense of this and prove that the resulting type has the required universal property, we construct the type as the colimit of a family of approximations to it defined by well-founded recursion over a suitable notion of size (a constructive version of what classically would be accomplished with a sequence

Type theory
The results in this paper are proved in a version of Extensional Type Theory [Mar82] that is an internal language for toposes [Joh02] with natural numbers object and universes [Str05b]. We use this type theory in an informal way, in the style and notation of the HoTT Book [Uni13]. Thus dependent function types are written ∏ x∶A B x and non-dependent ones as either A → B or B A . Dependent product types are written ∑ x∶A B x and non-dependent ones as A × B. Coproduct types are written A + B (with injections ι 1 ∶ A → A + B and ι 2 ∶ B → A + B); and finite types are written 0 (with no elements), 1 (with a single element 0), 2 (with two elements 0, 1), etc. The identity type for x ∶ A and y ∶ A is x = A y, or just x = y when the type A is known from the context. When we need to refer to the judgement that x and y are definitionally equal, we write x ≡ y. Unlike in the HoTT Book [Uni13], the type x = y is an extensional identity type and so it is inhabited iff x ≡ y holds. In particular, proofs of identity are unique when they exist and so it makes sense to use McBride's heterogeneous form of identity type [McB99] wherever possible. Given x ∶ A and y ∶ B, we denote the heterogeneous identity type by x == y; thus this type is inhabited iff A ≡ B and x ≡ y.
The type theory has universes of types, U 0 ∶ U 1 ∶ U 2 , . . . which we write just as U when the universe level is immaterial. We use Russell-style universes (there is no syntactic distinction between an element A ∶ U and the corresponding type of its elements). Influenced by Agda (see below) and unlike the HoTT Book [Uni13], we do not assume universes are cumulative, but instead use Agda-style closure under ∏-types: if A ∶ U i and B ∶ A → U j , then ∏ x∶A B x ∶ U max ij (and similarly for ∑-types). Since we only consider toposes that have a natural numbers object, we can assume the universes are closed under forming not just W-types [MP00, Proposition 3.6], but also all inductively defined indexed families of types [GH04]. Indexed W-types are considered in more detail in the next section.
The lowest universe contains an impredicative universe Prop of propositions, corresponding to the subobject classifier in a topos. Prop contains the identity types, is closed under Vol. 18:2   QUOTIENTS, INDUCTIVE TYPES, AND QUOTIENT INDUCTIVE TYPES  15:5 • Given A ∶ U and R ∶ A → A → Prop, we have: • Quotients of equivalence relations are effective: writing ER R for the proposition that R is reflexive, symmetric and transitive, we have: intuitionistic connectives (∧, ∨, →, ↔, etc.) and quantifiers (∀(x ∶ A).φ(x) and ∃(x ∶ A).φ(x), for A in any universe), and satisfies propositional extensionality: Being an extensional type theory, we also have function extensionality: Note that like the universes U i , Prop is also a Russell-style universe, in that we do not make a notational distinction between a proposition p ∶ Prop and the type of its proofs. Given A ∶ U and φ ∶ A → Prop, we regard the comprehension type {x ∶ A φ x} in U as synonymous with the dependent product ∑ x∶A φ x.
Toposes have coequalizers and effective epimorphisms [Joh02,A2.4]. Correspondingly the type theory contains quotient types, with notation as in Figure 1 (recall that == stands for heterogeneous identity). These can be constructed in the usual way via equivalence classes, using Prop's impredicative quantifiers and the fact that toposes satisfy unique choice: Thus uniquechoice is a function mapping proofs that A has exactly one element to a name for that one element. From uniquechoice it follows that given Agda development. We have developed and checked a version of the results in this paper using the Agda theorem prover [Agd20]. In particular our Agda development gives the full details of the construction of the indexed version of QW-types, whereas in the paper, for readability, we only give the construction in the non-indexed case (Section 6). Being intensional and predicative, the type theory provided by Agda is weaker than the one described above, but can be soundly interpreted in it. One has to work harder to establish the results with Agda, since two expressions that are definitionally equal in Extensional Type Theory may not be so in Agda and hence one has to produce a term in a corresponding identity type to prove them equal. On the other hand, when a candidate term is given, Agda can decide whether or not it is a correct proof, because validity of the judgements of the type theory it implements is decidable 2 , in contrast with the situation for Extensional Type Theory [Hof95]. Our development is also made easier by extensive use of the predicative universes of proof-irrelevant propositions that feature in recent versions of Agda. Not only are any two proofs of such propositions definitionally equal, but inductively defined propositions (such as the well-founded ordering on sizes used in Section 6) can be eliminated in proofs using dependent pattern matching, which is a very great convenience. We still need these propositions to satisfy the extensionality (2.1) and unique choice (2.3) properties, so we add them as postulates in Agda. Also, the impredicative construction of quotient types is not available, so we get quotients as in Figure 1 by postulating them and using a user-declared rewrite to make their computation rule a definitional equality. Although function extensionality (2.2) is not provable in Agda's core type theory, it becomes so once one has such quotient types. Our Agda development is available at [FPS21].

Indexed polynomial functors and equational systems
In this section we introduce a class of indexed quotient inductive types, called QWI-types, which are indexed families of free algebras for possibly infinitary equational theories. To begin with we describe the simpler, non-indexed case (QW-types) and then treat the general, indexed case in Section 3.3.
3.1. W-types. We recall some facts about types of well-founded trees, the W-types of Martin-Löf [Mar82]. We take signatures (also known as containers [AAG05]) to be elements of the dependent product So a signature is given by a pair Σ = (A, B) consisting of a type A ∶ U and a family of types B ∶ A → U. Each such signature determines a polynomial endofunctor [GH04; AAG05] S Σ ∶ U → U whose value at X ∶ U is the following dependent product and whose action on a function An S Σ -algebra is by definition an element of the dependent product S Σ -algebra morphisms (X, α) → (X ′ , α ′ ) are given by functions h ∶ X → X ′ together with an element of the type Then the W-type W Σ determined by a signature Σ is the underlying type of an initial object in the evident category of S Σ -algebras. More generally, Dybjer [Dyb97] shows that the 2 though not always feasibly so initial algebra of any non-nested, strictly positive endofunctor on U is given by a W-type; and Abbott, Altenkirch, and Ghani [AAG05] extend this to the case with nested uses of W-types as part of their work on containers. (These proofs take place in extensional type theory [Mar82], but work just as well in intensional type theory with uniqueness of identity proofs and function extensionality, which is what we use in Agda.) More concretely, given a signature Σ = (A, B), if one thinks of elements a ∶ A as names of operation symbols whose (not necessarily finite) arity is given by the type B a ∶ U, then the elements of the W-type W Σ represent the closed algebraic terms (i.e. well-founded trees) over the signature. From this point of view it is natural to consider not only closed terms solely built up from operations, but also open terms additionally built up with variables drawn from some type V . As well as allowing operators of possibly infinite arity, we also allow terms involving possibly infinitely many variables (example (1.4) involves such terms). Categorically, the type T Σ (V ) of such open terms is the free S Σ -algebra on V and is another W-type, for the signature obtained from Σ by adding the elements of V as nullary operations. Nevertheless, it is convenient to give a direct inductive definition: the value of T Σ ∶ U → U at some some V ∶ U, is the inductively defined type with constructors Given an S Σ -algebra (X, α) ∶ Alg Σ and a function f ∶ V → X, the unique morphism of S Σalgebras from the free S Σ -algebra on V to (X, α) that extends f , _≫=f ∶ (T Σ (V ), σ) → (X, α), has underlying function T Σ (V ) → X mapping each t ∶ T Σ (V ) to the element t ≫= f defined as follows by recursion on the structure of t: As the notation suggests, ≫= is the Kleisli lifting operation ("bind") for a monad structure on T Σ . Indeed, T Σ is the free monad on the endofunctor S Σ and in particular the functorial 3.2. QW-types. The notion of QW-type that we introduce in this section is obtained from that of a W-type by considering not only the algebraic terms over a given structure, but also equations between terms. To code equations we use a type-theoretic rendering of a categorical notion of equational system introduced by Fiore and Hur, referred to as term equational system [FH09, Section 2] and as monadic equational system [Fio13, Section 5], here instantiated to the special case of free monads on signatures.
Definition 3.1. A system of equations over a signature Σ ∶ Sig is specified by: • A type E ∶ U, whose elements e ∶ E can be thought of as names for each equation.
• A function V ∶ E → U. For each equation e ∶ E, the type V e ∶ U represents the variables used in the equation e. • For each equation e ∶ E, two elements called l e and r e of type T Σ (V e), which is the free S Σ -algebra on the variables V e. So l e and r e can be thought of as the abstract syntax trees of terms with some leaves being free variables drawn from V e. So systems of equations are elements of the dependent product The category-theoretic view of QW-types is that they are simply S Σ -algebras that are initial among those satisfying a given system of equations: Definition 3.2 (QW-type). A QW-type for a signature Σ ≡ (A, B) ∶ Sig and a system of equations ε ≡ (E, V, l, r) ∶ Syseq Σ is given by a type QW ∶ U equipped with an S Σ -algebra structure and a proof that it satisfies the equations. Thus there are functions together with functions that witness that it is an initial such algebra: Remark 3.3 (Free algebras). Definition 3.2 defines QW-types as initial algebras for systems of equations ε over signatures Σ. More generally, the free (Σ, ε)-algebra on a type X ∶ U is a type F Σ,ε X ∶ U equipped with an S Σ -algebra structure S Σ (F Σ,ε X) → F Σ,ε X satisfying the system of equations ε and an inclusion of generators η X ∶ X → F Σ,ε X which is universal among such data. Initial algebras are the X = 0 special case of free algebras. But once one has them, one also has free algebras, by change of signature: F Σ,ε X is the QW-type for the signature Σ X and system of equations ε X defined as follows. If Σ = (A, B), And if ε = (E, V, l, r), then ε X = (E, V, l X , r X ) where for each e ∶ E, l X e = (l e ≫= η) and r X e = (r e ≫= η) (using the S Σ -algebra structure s on T Σ (V e) given by s(a, b) = σ(ι 2 a, b)).
The definitions of S Σ in (3.2) and Sat α,ε in (3.10) suggest that QW-types are an instance of the notion of quotient-inductive type [AK16], with qwintro as the element constructor and qwequate as the equality constructor. To show that QW-types are indeed quotientinductive types, they need to have the requisite dependently-typed elimination and computation properties 3 for these elements and equality constructors. We show that these follow from (3.13)-(3.15) and function extensionality. To state this proposition we need a dependent version of the bind operation (3.7). For each "motive" P and induction step p, as well as a type X ∶ U, a substitution ρ ∶ X → ∑ x∶QW P x , and term t ∶ T Σ X, we have an element lift P,X p ρ t ∶ P (t ≫= (π 1 ○ ρ)) defined by recursion on the structure of t: Note that the substitution ρ gives terms in the "dependent telescope" ∑ x∶QW P x, which will be written as P ′ .
Proposition 3.4. For a QWI-type as defined above, given P and p as in (3.16), and a term p resp of type e∶E ρ∶V e→∑ x∶QW P x lift P,X p ρ (l e) == lift P,X p ρ (r e) (Note that (3.18) uses heterogeneous identity ==, because lift P,X p ρ (l e) and lift P,X p ρ (r e) inhabit different types, namely P (l e ≫= (π 1 ○ ρ)) and P (r e ≫= (π 1 ○ ρ)) respectively.) Proof. To define the eliminator, we must first use the algebra map on the more general type P ′ def = ∑ x∶QW P x. The algebra map, qwrec, requires that this type P ′ has an algebra structure β ∶ S Σ (P ′ ) → P ′ , which is given by: Moreover, we must show that the recursor satisfies the equations by giving a proof s ∶ Sat β,ε (P ′ ), which we do pointwise on the two elements of the dependent product P ′ . Taking projections distributes (possibly dependently) over ≫=; so to construct s it suffices that, given any e ∶ E and ρ ∶ V e → P ′ , we have the two terms: qwequate e ρ ∶ l e ≫= (π 1 ○ ρ) = r e ≫= (π 1 ○ ρ) p resp e ρ ∶ lift p ρ (l e) == lift p ρ (r e) (3.21) Then the eliminator is defined by taking the second projection of this recursor. Given an element (a, b) ∶ S Σ (QW), we can prove that applying the eliminator to it computes as expected, that is qwelim (qwintro (a, b)) = p a b (qwelim ○ b), as follows, where we write r ′ for qwrec P ′ β s: In this section we consider indexed quotient inductive types specified by families of (possibly infinitary) equational theories. As for ordinary W-types, the indexed version of QW-types gives convenient expressive power; see Section 7. To describe the indexed case we first introduce some notation for indexed families of types and functions. Given a type I ∶ U, when we map between two I-indexed types, say A ∶ U I to B ∶ U I , we will write for the function type. The composition of f ∶ A ⇁ B and g ∶ B ⇁ C will just be written as We also often need to define an indexed family of types B i a ∶ U I which is dependent on some i ∶ I and element a ∶ A i for A ∶ U I . The type of such families will be written as We take our notion of an indexed signature for a WI-type (indexed W-type) to be a particular case of indexed containers [AAG05], namely an element of the type ∑ I∶U ∑ A∶U I ∏ i∶I (A i → U I ), which with the above notational conventions we write as We only need indexed containers whose source and target indexing types are the same, since we only need to consider endofunctors on the category of I-indexed families in U and their algebras. Thus an indexed signature Σ ≡ (I, A, B) is a triple that can be thought of as a set of indices (or sorts) I, an I-indexed family of operators A i , and a function mapping each operator a ∶ A i to an I-indexed family of arities in U I . For instance, the type of vectors over some type D has an indexed signature as follows (see Example 7.6): • natural numbers as indices; • for index 0 a parameter-less operator for the empty vector, and for index n+1 an operator parametrised by D for cons; and • for the operator indexed by 0, a family of empty types for arities, and for operators indexed by n + 1, a family of arities which is the unit type just in the nth index, and empty otherwise. Each indexed signature Σ ≡ (I, A, B) determines a polynomial endofunctor S Σ ∶ U I → U I , which is defined at a family X ∶ U I by An S Σ -algebra is by definition an element of the dependent product (For example, when Σ is the signature for vectors over some type D, then an algebra are given by an I-indexed family of functions h ∶ X ⇁ X ′ together with a family of elements in the types is the underlying type of an initial S Σ -algebra. The elements of W Σ represent an I-indexed family of closed algebraic terms (i.e. well-founded trees) over the signature Σ. Given a family V ∶ U I , the family Given an S Σ -algebra (X, α) ∶ Alg Σ and an I-indexed family of functions f ∶ V ⇁ X, the unique morphism of S Σ -algebras from the S Σ -algebra (T Σ (V ), σ) to (X, α) that extends f has an underlying family of functions T Σ (V ) ⇁ X mapping each t ∶ (T Σ V ) i to the element t ≫= f defined analogously to (3.7). Given an indexed signature Σ ≡ (I, A, B) ∶ Sig, a system of equations for it is an element of the dependent product Definition 3.5 (QWI-type). A QWI-type for an indexed signature Σ ≡ (I, A, B) ∶ Sig and a system of equations ε ≡ (E, V, l, r) ∶ Syseq Σ is given by an I-indexed family of types QW ∶ U I equipped with an S Σ -algebra structure and a proof that it satisfies the equations together with functions that witness that it is an initial such algebra:

Weakly initial sets of covers
In Section 3 we defined a QWI-type in a topos to be an initial algebra for a given (possibly infinitary) indexed signature and system of equations (Definition 3.5). If one interprets these notions in the topos of sets in classical Zermelo-Fraenkel set theory with the Axiom of Choice (ZFC), one regains the usual notion from universal algebra of initial algebras for equational theories that are multi-sorted [BL70] and infinitary [Lin66]. Thus in ZFC, the QWI-type for a signature Σ = (I, A, B) and system of equations ε = (E, V, l, r) can be constructed by first forming the I-indexed family W Σ of sets of well-founded trees over Σ and then quotienting by the congruence relation ∼ ε on W Σ generated by ε. The I-indexed family of quotient sets (W Σ ) ∼ ε yields the desired initial algebra for (Σ, ε) provided the S Σ -algebra structure on W Σ induces one on the quotient sets. It does so, because for each operator in the signature, using the Axiom of Choice (AC) one can pick representatives of the (possibly infinitely many) equivalence classes that are the arguments of the operator, apply the interpretation of the operator in W Σ and then take the equivalence class of that. So the topos of sets in ZFC has QWI-types. Is this use of AC really necessary? Blass [Bla83, Section 9] shows that if one drops AC and just works in ZF, then provided a certain large cardinal axiom is consistent with ZFC, it is consistent with ZF that there is an infinitary equational theory with no initial algebra. He shows this by first exhibiting a countably presented equational theory whose initial algebra has to be an uncountable regular cardinal; and secondly appealing to the construction of Gitik [Git80] of a model of ZF with no uncountable regular cardinals (assuming a certain large cardinal axiom). Lumsdaine and Shulman [LS19] turn the infinitary equational theory of Blass into a higher-inductive type that cannot be proved to exist in ZF (and hence cannot be constructed in type theory just using pushouts and the natural numbers). We show in Example 7.10 that this higher inductive type can be presented as a QWI-type.
So one cannot hope to construct QWI-types using a type theory which is interpretable in just ZF. However, the type theory in which we work (Section 2) already requires going beyond ZF to be able to give a classical set-theoretic interpretation of its universes (by assuming the existence of enough strongly inaccessible cardinals, for example). So the above considerations about non-existence of initial algebras for infinitary equational theories in ZF do not necessarily rule out the construction of QWI-types in other toposes with natural numbers object and universes. In Section 6, we show that QWI types exist in a topos if it satisfies a weak form of choice principle that we call IWISC and which is known to hold for a wide range of toposes. IWISC is a version for universes in the type theory in which we are working of a property introduced by van den Berg and Moerdijk [vdBM14], who work in constructive set theory CZF and call it the Axiom of Multiple Choice (building upon previous work by Moerdijk and Palmgren [MP02]); it is related to the Type Theoretic Collection Axiom TTCA f of Streicher [Str05a] (see Remark 4.2). wisc for a family (A, B) if it is a wisc for each type B a in the family. We say that the universe U satisfies IWISC if for all families (A, B) in U, there exists a family in U which is a wisc for (A, B).
Following [https://ncatlab.org/nlab/show/WISC], "wisc" stands for "weakly initial set of covers", with the terminology being justified as follows. A cover of Y ∶ U is just a surjective function q ∶ X → Y for some X ∶ U. If (C, E) is a wisc for Y as in the above definition, then the family of all covers of the form E c → Y with c ∶ C is weakly initial, in the sense that for every cover q ∶ X → Y in U, there is a cover in the family that factors through q.
Note that in classical set theory AC implies IWISC; this is because the Axiom of Choice implies that covers split and hence any family (A, B) is a wisc for itself. IWISC is independent of ZF in classical logic [Kar14;Rob15]. The results of van den Berg and Moerdijk [vdBM14] imply that in constructive logic it is preserved by many ways of making new toposes from existing ones, in particular by the formation of sheaf toposes and realizability toposes over a given topos. Thus it holds in all the toposes commonly used for the semantics of Type Theory. It is in this sense that IWISC is a constructively acceptable form of the axiom of choice. (Roberts [Rob15] gives examples of toposes which fail to satisfy it.) Remark 4.2. IWISC is a property of a single universe, in contrast to Streicher's type theoretic formulation of a WISC axiom, TTCA f [Str05a], which uses two universes (and which can be shown to imply IWISC). With a single universe it seems necessary to quantify over indexed families in the universe (hence our choice of terminology), rather than just over types in the universe as in loc. cit.; see Levy [Lev21, Section 5.1]. Note that IWISC asks that a wisc merely exists for each family in U. A stronger requirement on U would be to ask for a function assigning a wisc to each family; and this is equivalent to asking for a function mapping each B ∶ U to a wisc for B. (For note that, given a family (A, B), if we have a function mapping each a ∶ A to a wisc (C a , E a ) for B a, then the single family (C, E) with C = ∑ a∶A C a and E(a, c) = E a c is a wisc for all the B a simultaneously.) Levy [Lev21] calls this property Global WISC. Although the topos of sets in ZFC with Grothendieck universes satisfies Global WISC, it is not known which other toposes do.
The following lemma gives a convenient reformulation of the wisc property from Definition 4.1 that we use in the next section.
Proof. Consider the type Φ def = ∑ x∶A ∑ y∶B x φ x y in U. By assumption π 1 ∶ Φ → A is a surjection, so since (C, E) is a wisc for A, there exist c ∶ C and e ∶ E c → Φ with π 1 ○ e a surjection. So we can take p def = π 1 ○ e and q def = π 1 ○ π 2 ○ e; and then π 2 (π 2 (e z)) is a proof that φ (p z) (q z) holds.

Size
Swan [Swa18] uses IWISC to construct W-types with reductions, which are a simple special case of QWI-types (see Example 7.8). We will see that in fact IWISC implies the existence of all QWI-types, but using a different approach from that of Swan [Swa18]. We show in this section that, starting with a given signature Σ and system of equations ε (Definition 3.1), using IWISC one can construct a well-founded type of "sizes" with the property that colimits of diagrams indexed by such sizes are preserved when taking exponents by the arity types of Σ and ε. This will enable us to construct the QW-type for (Σ, ε) as a colimit in Section 6. We consider the general case of indexed signatures in Remark 5.11; and the construction of QWItypes as a sized-indexed colimit is detailed in the accompanying Agda formalization [FPS21].
Size is here playing a role in the constructive type theory of toposes that in classical set theory would be played by ordinal numbers. The next definition gives the properties of size that we need.
Definition 5.1 (Size). A type Size in a universe U will be called a type of sizes if it comes equipped with and well-founded • a distinguished element 0 s • a binary operation _ ⊔ s _ ∶ Size → Size → Size which gives upper bounds with respect to < for pairs of elements Note that defining i + def = i ⊔ s i we get a form of successor operation satisfying For the examples of types of sizes given in Example 5.4 this successor operation preserves <, but we do not need that property for the results in this paper. 4 Such a type of sizes has many properties of the classic notion of limit ordinal, except that we do not require the order to be total (∀i, j. i < j ∨ i = j ∨ j < i); that would be too strong in a constructive setting and indeed does not hold in the examples below. Nor do we have any need for an extensionality property (∀i, j. In the precursor to this paper [FPS20] we made use of Agda's built in type Size and its version of sized types [Abe12]. This shares only some of the properties of the above definition. In particular, it has a "stationary" size ∞ satisfying ∞ < ∞ and hence the relation < for Agda's notion of size is not well-founded. 5 4 In fact we do not need the distinguished element 0 s either, but it does no harm to require it and then sizes are directed with respect to < in the usual sense of having upper bounds for all finite subsets, including the empty one. 5 Unfortunately in the current version of Agda (2.6.2) it is possible to prove well-foundedness of < for its built in type of sizes Size, and this leads immediately to logical unsoundness; see github.com/agda/ agda/issues/3026. For this reason we avoid the use of Agda's sized types in the current Agda development accompanying this paper.
is the type of sizes below i ∶ Size. Similarly for other binders involving sizes, such as ∀j < i. _ and λ j < i . _.
In the next section we need the fact that well-founded recursion (5.6) can be reduced to wellfounded induction (5.2) by defining the graph of the recursive function and then appealing to unique choice (2.3) and function extensionality (2.2): Proposition 5.3 (Well-founded recursion). For any family of types A ∶ Size → U and The fact that R is least with this property allows one to prove ∀i.
and hence by (5.7) also satisfying ∀i. R i (α i (λ j < i . r j)). Since for each i there is a unique x with R i x, it follows that r i = α i (λ j < i . r j). So we can take rec A α to be r. If r ′ ∶ ∏ i A i also satisfies ∀i. r ′ i = α i (λ j < i . r ′ j), then ∀i. r ′ i = r i follows from another application of (5.2), so that r ′ = r by function extensionality (2.2).
Example 5.4 (Plump order). Let Size ∶ U be the W-type determined by some type Op ∶ U and family Ar ∶ Op → U (see Section 3.1). Thus Size is inductively defined with constructor σ ∶ (∑ a∶Op (Ar a → Size)) → Size. The plump ordering [Tay96] on Size is given by the least relations _ < _, _ ≤ _ ∶ Size → Size → Prop satisfying for all a ∶ Op, b ∶ Ar a → Size and i ∶ Size It is not hard to see that the relation < is transitive (5.1) and well-founded (5.2). Furthermore one can prove that ≤ is reflexive and hence from (5.9) we get So for each operation a ∶ Op, every family b ∶ Ar a → Size of elements of Size indexed by its arity Ar a has an upper bound with respect to <, namely σ a b. In particular, if the signature (Op, Ar ) contains an operation a 2 ∶ Op whose arity is Ar a 2 = 2, then an upper bound for any i, j ∶ Size with respect to < is given by with b ∶ 0 → Size uniquely determined. Therefore, we have: Lemma 5.5. If the signature Op ∶ U, Ar ∶ Op → U contains a nullary operation (a 0 ∶ Op with Ar a 0 = 0) and a binary operation (a 2 ∶ Op with Ar a 2 = 2), then the corresponding W-type Size ∶ U, equipped with the plump order <, is a type of sizes in the sense of Definition 5.1. Furthermore for any a ∶ Op, every (Ar a)-indexed family of sizes b ∶ Ar a → Size has an upper bound with respect to < (namely σ a b).
Given a signature Σ in a universe U satisfying IWISC, the lemma allows us to prove the existence of a type of sizes Size with enough upper bounds to be able to prove a cocontinuity property of the polynomial endofunctor associated with Σ (Corollary 5.10 below); we apply this in Section 6 to construct QW-types for a given signature and system of equations (and QWI-types for indexed signatures and systems of equations as defined in Section 3.3). The cocontinuity property has to do with colimits of Size-indexed diagrams in U. To state it, we first recall some semi-standard 7 category-theoretic notions to do with diagrams and colimits.
5.1. Colimits of size-indexed diagrams. By definition, given a type of sizes Size in a universe U (Definition 5.1), a Size-indexed diagram is given by a family of types As usual, the colimit of such a diagram is a cocone of functions in U with the universal property that for any other cocone Colimits can be constructed using quotient types: we define a binary relation _∼_ on ∑ i D i by: Definition 5.6 (Preservation of colimits by taking a power). Given a Size-indexed diagram (D, δ) in U and a type X ∶ U, we get a power diagram (D X , δ X ) in U with Post-composition with (ν D ) i gives a cocone under the diagram D X with vertex X → colim D and by universality this induces a function One says that taking a power by X ∶ U preserves Size-indexed colimits if for all Size-indexed diagrams (D, δ) in U the function κ D,X is an isomorphism.
Theorem 5.7 (Cocontinuity). Suppose U is a universe satisfying IWISC in a topos with natural numbers object. Given A ∶ U and B ∶ A → U, there exists a type of sizes Size ∶ U with the property that for all a ∶ A, taking a power by the type B a ∶ U preserves Size-indexed colimits.
Proof. The proof is in three parts, (1)-(3). In part (1) we show how to find a suitable type of sizes Size using Lemma 5.5; so Size is a W-type for a suitable signature derived from A ∶ U and B ∶ A → U. The signature contains arities arising from a wisc whose existence is guaranteed by IWISC. In fact we need to consider not only the covers in such a wisc, but also a wisc for the family of (subtypes of) covers in this wisc, for the same reason that Swan uses "2-cover bases" [Swa18, Section 3.2.2]. Next, we have to prove that (5.18) is an isomorphism when X ∶ U is B a, for any a ∶ A; and for this it suffices to prove that it is (2) injective and (3) surjective. For then we can apply unique choice (2.3) to construct a two-sided inverse for κ D,X . By definition of ∼ (5.15), κ D,X is injective iff and surjective iff (1) Construction of Size: Given A ∶ U and B ∶ A → U, using IWISC let (C, F ) be a wisc for the family (A, B). For each c ∶ C, a ∶ A and function f ∶ F c → B a we can form the kernel of f Applying IWISC again, let (C ′ , F ′ ) be a wisc for this family of kernels indexed by (c, a, f ) ∶ ∑ (c,a)∶C×A (F c → B a). Finally, consider the signature with Op = 1+1+A+C+C ′ and Ar ∶ Op → U the function mapping 0 ∶ 1 in the first summand of Op to 0, 0 ∶ 1 in the second summand to 2, a ∶ A in the third summand to B a, c ∶ C in the fourth summand to F c and c ′ ∶ C ′ in the fifth summand to F ′ c ′ . Then as in Lemma 5.5, the W-type for the signature (Op, Ar ) is a type of sizes. Call it Size.
(2) Proof of (5.19): Recall that X ∶ U is of the form B a for some a ∶ A. Suppose we Using the version of the wisc property of (C, F ) from Lemma 4.3, there is c ∶ C, p ∶ F c → X and s ∶ F c → Size with p surjective and satisfying Since F c is one of the arities in the signature of the W-type Size, by Lemma 5.5 we have that s ∶ F c → Size has an upper bound, i.e. there is k ∶ Size with ∀(z ∶ F c). s z < k; and by (5.3) we can assume further that i < k and j < k. Furthermore, from (5.23) and (5.13) we get ∀(z ∶ F c). δ i,k (f (p z)) = δ j,k (f ′ (p z)); but p is surjective, so δ i,k ○ f = δ j,k ○ f ′ , as required for (5.19). (3) Proof of (5.20): Suppose we have f ∶ X → colim D. Since the quotient function [_] ∼ ∶ D i → colim D is surjective, using Lemma 4.3 again, there is c ∶ C, p ∶ F c → X, s ∶ F c → Size and g ∶ ∏ z∶F c D s z with p surjective and satisfying ∀(z ∶ F c). f (p z) = [s z, g z] ∼ . As before, we have that s ∶ F c → Size has an upper bound, i.e. there is j ∶ Size with ∀(z ∶ F c). s z < j. So we get a function g ′ ∶ F c → D j by defining g ′ z def = δ s z,j (g z) and hence Let Y def = Ker p be the kernel of p as in (5.21). Then for any (z, . So we can apply Lemma 4.3 again to deduce the existence of Since F ′ c ′ is one of the arities in the signature of the W-type Size, by Lemma 5.5 we have that the family of sizes s ′ ∶ F ′ c ′ → Size has an upper bound, i say; and by (5.3) we can assume j < i. Let g ′′ ∶ F c → D i be δ j,i ○ g ′ . Thus from (5.24) we have and from (5.25) also g ′′ ○ p ′ 1 = g ′′ ○ p ′ 2 . So altogether we have functions Since ⟨p ′ 1 , p ′ 2 ⟩ is surjective, this implies g ′′ ○ π 1 = g ′′ ○ π 2 . But since Y = Ker p, p is the coequalizer of π 1 and π 2 (since as we noted in Section 2, toposes have effective epimorphisms); therefore there is a unique function f ′ ∶ X → D i satisfying f ′ ○ p = g ′′ . Since (ν D ) i ○ f ′ ○ p = (ν D ) i ○ g ′′ = f ○ p by (5.26) and p is surjective, we have (ν D ) i ○ f ′ = f , completing the proof of (5.20) and hence of Theorem 5.7.
Remark 5.8. Note that the type of sizes constructed in the proof of the theorem has the property that for any a ∶ A, Size has upper bounds (with respect to <) for families of sizes indexed by B a (because by construction B a is one of the arities in the signature of the W-type Size and so Lemma 5.5 applies). Such upper bounds are not needed in the above proof. We included them because they are needed below in the proof of Theorem 6.1 when proving property (6.11).
Definition 5.9 (Preservation of colimits by polynomial endofunctors). If (D, δ) is a Size-indexed diagram in U, then we get another such, (S Σ ○ D, S Σ ○ δ), by composing with the polynominal endofunctor S Σ ∶ U → U associated with the signature Σ as in (3.2): Applying S Σ to (5.14) gives a cocone under (S Σ ○ D, S Σ ○ δ) with vertex S Σ (colim D) and this induces a function in U, One says that the polynomial endofunctor S Σ preserves Size-indexed colimits if κ D,Σ is an isomorphism for all diagrams (D, δ). Corollary 5.10 (Cocontinuity of S Σ ). In a topos with natural numbers object, given a signature Σ = (A ∶ U, B ∶ A → U) in a universe U satisfying IWISC, there exists a type of sizes Size with the property that the associated polynominal endofunctor S Σ ∶ U → U preserves Size-indexed colimits.
Proof. We apply Theorem 5.7 to find a type of sizes, Size for the given A ∶ U and B ∶ A → U. So for each diagram (D, δ) in U, we have properties (5.19) and (5.20) when X is B a, for any a ∶ A. The function (5.29) satisfies for all i ∶ Size, Since κ D,Σ is both injective and surjective, we can apply unique choice (2.3) to conclude that it is an isomorphism.
Remark 5.11 (Cocontinuity for polynomial endofunctors on U I ). There are indexed versions of Theorem 5.7 and Corollary 5.10. To state them for an indexing type I ∶ U, we need to consider Size-indexed diagrams in U I and their colimits. Since the latter are given pointwise by colimits in U, this makes what follows a simple extension of the previous development.
Given a Size-indexed diagram (D, δ) in U I and a family X ∶ U I , the indexed version of (5.17) is a power diagram (D X , δ X ) in U with Post-composition with (ν D ) i gives a cocone under the diagram D X with vertex X ⇁ colim D and this induces a function which is the indexed version of (5.18): One says that taking a power by X ∶ U I preserves Size-indexed colimits if for all Size-indexed diagrams (D, δ) in U I the function κ D,X is an isomorphism. Then we have: If U is a universe satisfying IWISC in a topos with natural numbers object, then given A, I ∶ U and B ∶ A → U I , there exists a type of sizes Size ∶ U with the property that for all a ∶ A, taking a power by a family B a ∶ U I preserves Size-indexed colimits. The proof of this is similar to the proof of Theorem 5.7 and can be found in the Agda development accompanying this paper [FPS21].
Given a Size-indexed diagram (D, δ) in U I , and an I-indexed signature Σ as in (3.27), then we get another Size-indexed diagram, (S Σ ○D, S Σ ○δ), by composing with the polynominal endofunctor S Σ ∶ U I → U I : Applying S Σ to the I-indexed version of (5.14) gives a cocone under (S Σ ○ D, S Σ ○ δ) with vertex S Σ (colim D) and this induces a family of functions in U I One says that the polynomial endofunctor S Σ ∶ U I → U I preserves Size-indexed colimits if κ D,Σ is a family of isomorphisms, for all diagrams (D, δ). Then the indexed generalization of Corollary 5.10 is: In a topos with natural numbers object, given an indexed signature Σ = (I, A, B) in a universe U satisfying IWISC, there exists a type of sizes Size with the property that the associated polynominal endofunctor S Σ ∶ U I → U I preserves Size-indexed colimits. This is proved as a corollary of the indexed version of Theorem 5.7 given above, and can also be found in the accompanying Agda development [FPS21].

Construction of QWI-types
We aim to prove the following theorem about existence of QWI-types (Definition 3.5): Theorem 6.1. Suppose U is a universe satisfying IWISC in a topos with natural numbers object. Then for every indexed signature and system of equations in U, there exists a QWI-type for it.
The proof follows from the cocontinuity results of the previous section (the indexed versions of Theorem 5.7 and Corollary 5.10 given in Remark 5.11). For simplicity, here we only give the proof for QW-types (Section 3.2), that is, for the non-indexed I = 1 case of signatures. The general case is similar, but notationally more involved since there are indexes ranging both over an index type and over sizes. The proof for the general, indexed case can be found in our Agda development [FPS21].
So in this section we fix a signature Σ = (A ∶ U, B ∶ A → U) and system of equations ε = (E ∶ U, V ∶ E → U, l, r ∶ ∏ e∶E T Σ (V e)) over it in some universe U satisfying IWISC in a topos with natural numbers object.
6.1. Motivating the construction. We noted at the start of Section 4 that QW-types can be constructed in the category of ZFC sets as initial algebras for possibly infinitary equational theories by first forming the W-type of terms of the theory and then quotienting that by the congruence relation generated by the equations of the theory. AC is used when constructing the algebra structure of the quotient, because the signature's arities may be infinite. To avoid this use of AC, instead of forming all terms in one go and then quotienting, we consider interleaving quotient formation with the construction of terms of free algebras for equational systems (cf. the categorical construction by Fiore and Hur [FH09]). Figure 2 gives the idea, using the constructors η and σ from (3.6) and Agda-like notation for inductive definitions. We would like to construct the QW-type for (Σ, ε) as a quotient QW def = W ∼, but now the type W ∶ U and the relation _ ∼ _ ∶ W → W → Prop are mutually inductively defined, with constructors as indicated in the figure. Note that whereas the construction in ZFC uses AC to get an S Σ -algebra structure for QW, here we get one trivially from the constructor qτ ∶ T Σ (W ∼) → W :   Figure 2 ensures that the S Σ -algebra W ∼ satisfies the equational system ε. The use of T Σ rather than S Σ in the domain of qτ seems necessary for this method of construction to go through (once we have fixed up the problems mentioned in the next paragraph); but it does mean that as well as qε, we have to impose the conditions qη and qσ to ensure that W ∼ has a S Σ -algebra structure, or equivalently, an algebra structure for the monad T Σ .
Note that the domain of the constructor qτ combines T Σ (_) with _ _. While the first is unproblematic for inductive definitions, the second is not: if one thinks of the semantics of inductively defined types in terms of initial algebras of endofunctors, it is not clear what endofunctor (in some class known to have initial algebras) is involved here, given that both arguments to _ _ are being defined simultaneously. Agda uses a notion of "strict positivity" as a conservative approximation for such a class of functors; and one can instruct Agda to regard quotienting as a strictly positive operation through the use of its POLARITY declarations. If one does so, then a definition like the one in Figure 2 is accepted by Agda. The semantic justification for regarding quotients as strictly positive constructions needs further investigation. We avoid the need for that here and replace the attempt to define W and ∼ inductively by a size-indexed version that uses definition by well-founded recursion over a type of sizes as in the previous section. This also avoids another difficulty with Figure 2: even if one can define W and ∼ inductively, one still has to verify that W ∼ has the universal property (3.13)-(3.15) required of a QW-type. In particular, there is an obvious recursive definition of qwrec following the shape of the inductive definition in Figure 2, but it is not at all clear why this recursive definition is terminating (i.e. gives a well-defined, total function). Well-founded recursion over sizes will solve this problem as well.
6.2. QW-type via sizes. We are given a signature Σ = (A ∶ U, B ∶ A → U) and system of equations ε = (E ∶ U, V ∶ E → U, l, r ∶ ∏ e∶E T Σ (V e)). Let Size ∶ U be the type of sizes whose existence is guaranteed by Theorem 5.7 when in the theorem we take A to be AE def = A + E and B to be the function BV ∶ AE → U mapping a ∶ A to B a and e ∶ E to V e. It follows (as in the proof of Corollary 5.10) that S Σ preserves Size-indexed colimits.
Definition 6.2. A Size-indexed Σ-structure in U is specified by a family of types D ∶ Size → U equipped with functions Similarly, for each i ∶ Size, a (↓ i)-indexed Σ-structure is the same thing, except with D only defined on the subsemicategory ↓ i (5.5) rather than the whole of Size. Clearly, given a Size-indexed Σ-structure (D, τ ), for each i ∶ Size we get a (↓ i)-indexed one (D (↓ i), τ (↓ i)) by restriction.
If i ∶ Size and (D, τ ) is a (↓ i)-indexed Σ-structure, let i D ∶ U be the quotient type (see Figure 1) (The three clauses in the above definition correspond to the three constructors qε, qη and qσ in Figure 2.) We will see that the QW-type for (Σ, ε) can be constructed from Size-indexed Σ-structures (D, τ ) satisfying the following fixed-point property.
and for all j < i and t ∶ T Σ D j τ j,i t = [j, t] R i (6.6) Suppose that (D, τ ) is a -fixed point. Because of (6.5) and (6.6), for i, j ∶ Size with i < j the functions In particular they satisfy composition (5.13) and so (D, δ) is a Size-indexed diagram in U whose colimit we can form as in Section 5.1. We prove that this colimit has the structure (3.11)-(3.15) of a QW-type for the signature (Σ, ε). qwintro: Given how we chose Size at the start of this section, from the (proof of) Corollary 5.10 we have that S Σ ∶ U → U preserves Size-indexed colimits. We claim that the functions form a cocone under the diagram S Σ ○ D and hence induce a function colim(S Σ ○ D) → colim D; then we obtain qwintro ∶ S Σ (colim D) → colim D by composing this with the isomorphism S Σ (colim D) ≅ colim(S Σ ○ D) from Corollary 5.10. That the functions in (6.10) form a cocone for S Σ ○ D follows from the fact that the functions in (6.7) satisfy for all sizes i < j from which it follows that (ν D ) j + ○ τ j,j + ○ T Σ δ i,j = (ν D ) i + ○ τ i,i + and hence also the cocone property. Property (6.11) can be proved by induction on the structure of t ∶ T Σ (D i ), with the t = σ(a, b) case of (3.6) proved using the fact that Size has <-upper bounds for families of sizes indexed by B a (Remark 5.8). qwequate: Given e ∶ E and ρ ∶ V e → colim D, by Theorem 5.7 there exist i ∶ Size and ρ ′ ∶ V e → D i with ρ = (ν D ) i ○ ρ ′ . By standard properties of the bind operation ≫= (3.7) (which depends implicitly on the S Σ -algebra structure qwintro that we have just constructed), we have From the definition of qwintro and (6.6) it follows that for any t ∶ T Σ D i , there is a proof of So from above we have that (l e ≫= ρ) = (ν D ) i + (τ i,i + (T Σ ρ ′ (l e))) and (r e ≫= ρ) = (ν D ) i + (τ i,i + (T Σ ρ ′ (r e))). Since from (6.6) and the first clause in the definition of R i (6.4) we also have τ i,i + (T Σ ρ ′ (l e)) = τ i,i + (T Σ ρ ′ (r e)), it follows that there is a proof of (l e≫=ρ) = (r e ≫= ρ). qwrec: Given an S Σ -algebra (X, α) ∶ ∑ X∶U (S Σ X → X) satisfying the system of equations ε, the function qwrec ∶ colim D → X is induced by a cocone of functions r ∶ ∏ i (D i → X) under the diagram D, defined by well-founded recursion (Proposition 5.3). More precisely, a strengthened "recursion hypothesis" is needed: (The definition uses α implicitly in ≫= and relies on the fact (6.5) that D i = i (D (↓ i)).) For each i ∶ Size, if we have r j ∶ F j for all j < i, then we get a function r i ∶ F i well-defined by (The defining property of F i is needed to see that the right-hand side of this definition respects the relation R i .) Hence by well-founded recursion (Proposition 5.3) we get an element r ∶ ∏ i F i . One can prove ∀i.∀j < i. r j = r i ○ δ j,i by well-founded induction (5.2); so r is a cocone and induces a function qwrec ∶ colim D → X. qwrechom: We noted at the start of this section that by choice of Size, the functor S Σ preserves Size-indexed colimits. So to prove that commutes, by the definitions of qwintro and qwrec, it suffices to prove that σ(a, η○b)] R i + (using the fact that D i + = i + (D (↓ i + ))); and by (6.15), that is mapped by r i + to σ(a, η ○ b) ≫= r i , which is indeed equal to α(S Σ r i (a, b)) by definition of ≫= (3.7) and the action of S Σ on functions (3.3). qwuniq: If h ∶ colim D → X is a morphism of S Σ -algebras, then one can prove by well-founded by (6.13) and (6.6) So by well-founded induction, h ○ (ν D ) i = r i holds for all i ∶ Size, and hence by definition of qwrec and the uniqueness part of the universal property of colimits we have h = qwrec. Thus we have proved: Proposition 6.4. Let Size be the type of sizes defined at the start of this section, whose existence is guaranteed by Theorem 5.7. If the Size-indexed Σ-structure (D, τ ) is a -fixed point, then colim D has the structure of a QW-type for the signature (Σ, ε).

Now we can complete the proof of the main theorem:
Proof of non-indexed version of Theorem 6.1. In view of Proposition 6.4, it suffices to construct a Size-indexed Σ-structure which is a -fixed point in the sense of Definition 6.3.
For each i ∶ Size, say that a (↓ i)-indexed Σ-structure (Definition 6.2) is an upto-i -fixed point if (cf. (6.5) and (6.6)). Note that: (A) Given j < i, any upto-i -fixed point restricts to an upto-j -fixed point.
(B) For all i, any two upto-i -fixed points are equal (proof by well-founded induction (5.2)). Using these two facts, it follows by well-founded recursion (Proposition 5.3) that there is an upto-i -fixed point for all i ∶ Size. For if (D (j) , τ (j) ) is an upto-j -fixed point for all j < i, then we get D (i) ∶ ↓ i → U by defining for each j < i If k < j < i, then by (A) we have that D (j) (↓ k) is an upto-k -fixed point and hence by (B) that D (j) (↓ k) = D (k) . So together with (6.18) this gives: Hence we can define (τ (i) ) k,j ∶ T Σ ((D (i) ) k ) → (D (i) ) j by (τ (i) ) k,j t def = [k, t] R j and this makes (D (i) , τ (i) ) into a (↓ i)-indexed Σ-structure which by construction is an upto-i -fixed point. Thus by well-founded recursion (Proposition 5.3) we have an upto-i -fixed point D (i) for all i ∶ Size.
Let D ∶ Size → U be given by D i def = i (D (i) ). If j < i, then by (A) and (B) we have D (i) (↓ j) = D (j) and together with (6.18) this gives: . This makes (D, τ ) into a Σ-structure which by construction is a -fixed point.

Encoding QITs as QWI-types
The general notion of indexed quotient inductive type (QIT) was discussed by example in the Introduction. We wish to show that a wide variety of QITs can be expressed as QWI-types, namely those which do not use conditional equality constructors (as in the example in (1.2)). We first introduce a schema for such QITs that combines desirable features of ones that occur in the literature. As in the previous section, for simplicity sake we will confine our attention to the non-indexed case of QITs and QW-types. 7.1. General QIT schemas and encodings. Basold, Geuvers, and van der Weide [BGvdW17] present a schema for infinitary QITs that do not support conditional path equations. Constructors are defined by arbitrary polynomial endofunctors built up using (non-dependent) products and sums, which means in particular that parameters and arguments can occur in any order; however, they require constructors to be in uncurried form. They also construct a model of simple 1-cell complexes and other non-recursive QITs.
Dybjer and Moeneclaey [DM18, Sections 3.1 and 3.2] present a schema for finitary QITs that does allow curried constructors (and also supports conditional path equations), but requires all parameters to appear before all arguments. This contrasts with the more convenient schema for regular inductive types in Agda, which allows parameters and arguments in any order.
Kaposi, Kovács, and Altenkirch [KKA19] define an encoding of finitary quotient inductiveinductive (QIIT) types, called the theory of signatures (ToS), which is a restriction of the theory of codes for HIITs [KK18]. In the ToS a QI(I)T is encoded as a context of a small internal type theory. This encoding is not quite as convenient as the schema for regular inductive types in Agda, but, when using named variables, it is much closer to Agda than QWI-types are. They also construct a model for finitary QIITs (and Kovács and Kaposi [KK20] reduce the problem of modelling infinitary QIITs to just one "universal" QIIT -a generalised ToS).
Building on the first two schemas mentioned above, we provide a schema for infinitary, non-conditional QITs combining the arbitrarily ordered parameters and arguments of the first [BGvdW17] with the curried constructors of the second [DM18].
The following definition should be read as an extension of a formalisation of the type theory described in Section 2 in terms of typing contexts (Γ, ∆, . . .) and various judgementsin-context (such as Γ ⊢ a ∶ A, Γ ⊢ a = a ′ ∶ A, etc.); see the HoTT Book [Uni13,Appendix]. In the following we fix the context Γ in which the QIT, Q, (Q ∉ Γ) is defined, whereas ∆, A, B, H, K, a, b, x, y, etc. are metavariables. When deriving an element or equality constructor, ∆ will always be equal to Γ or an extension of it.
A type strictly-positive in Q is made up with ∏-types and ∑-types and can use Q and constants or variables in the context, provided that Q never occurs on the LHS of a ∏-type, and that the RHS of a ∑-type never depends on Q, even if it occurs on the LHS.
Where K ′ is found from K by recursively replacing each sub-term of type 1, A → 1, etc. with the corresponding unique term 0, !, etc.
Note: We can see that these rules give strictly-positive types because: (1) at this point ∆ ⊢ Q ∶ U is not derivable since Q ∉ Γ and no rule for StrPos adds Q to the context, so Q can never appear in the LHS of a ∏-type. Also (2) the Prod rule ensures that abstracting with ∑ cannot result in dependencies of Q in the codomain.
The type of an element constructor is an (iterated) ∏-type with codomain Q, with zero or more strictly-positive arguments.
Where ∆[ 1 Q] is the context that results after replacing occurrences of Q in ∆ by the type 1.
Note: Deriving Γ ⊢ ∏ a∶K ′ Q ElConstr via ElArg for some strictly-positive K does not imply Γ ⊢ ∏ a∶K ′ Q ∶ U since Γ ⊬ Q ∶ U (since Q ∉ Γ), and also Γ ⊬ K ′ ∶ U in general since K ′ may contain Q. This distinction also applies to the following judgements.
The type of an equality constructor is an (iterated) ∏-type with codomain x = Q y, with zero or more strictly-positive arguments. Note that each of the element constructors are added to the context and can be used to derive x ∶ Q and y ∶ Q. Definition 7.1. A (non-conditional ) QIT, Q, in a context Γ, Q ∉ Γ is specified by a list of element constructors c 1 ∶ C 1 , . . . , c m ∶ C m , followed by a list of equality constructors d 1 ∶ D 1 , . . . , d n ∶ D n , where the C i s and D j s are derived as Γ ⊢ C i ElConstr and Γ ⊢ D j EqConstr respectively, according to the rules in Figure 3. Given a list of element and equality constructors built up according to these rules, the newly-defined QIT, Q, has formation rule Γ ⊢ Q ∶ U for the specific context Γ in which it was defined. And it has an introduction rule for each element constructor and each equality constructor: We show how to derive elimination and computation rules for Q from these formation and introduction rules (compare with Basold, Geuvers, and van der Weide [BGvdW17, Definition 10]) after first giving an example of how the schema is instantiated.
Example 7.2. Consider multisets as in example (1.1) with two element constructors [] and _ ∶∶ _, and one equality constructor swap. Given the context containing parameter X ∶ U, we define the QIT ⋅, X ∶ U ⊢ Bag ∶ U 1 by providing those constructors along with their types such that they are derived by the rules in Figure 3:  Elimination and computation). The arguments of a constructor C j , written Arg(C j ), is the list of K ′ for all strictly-positive types K introduced with the rule ElArg. Given a QIT defined by constructors c 1 , . . . , c m , d 1 , . . . , d n as above, the underlying inductive type ⌊Q⌋ is the inductive type defined by only the element constructors c 1 , . . . , c m , ignoring the equalities; then the underlying W-type is the W-type that encodes this inductive type. (Recall that every strictly-positive description of a polynomial endofunctor gives rise to a W-type with the same initial algebra; see Dybjer [Dyb97], and for the more general indexed and nested case see Altenkirch et al. [AGHMM15].) Define leaf application on a strictly-positive term a ∶ A (that is, a term with a strictlypositive type) for a function f ∶ ∏ q∶Q R q into some type R, written f $ a, by induction on the StrPos structure of A: In order to define the elimination and computation rules we must first define the induction step. First, given a "motive" Γ ⊢ P ∶ Q → U, define the type P ′ def = ∑ x∶Q P x. Now given a strictly-positive argument A, define the type A ′ (it will be (one of) the induction hypotheses) by induction on the structure of A, replacing each occurrence of Q (IndArg) with P ′ . Terms a ′ ∶ A ′ are also strictly-positive and admit leaf application for functions of type ∏ p ′ ∶P ′ S p ′ for some type S.
To find the induction step C ĵ for each element constructor c j ∶ C j , replace each of the strictly-positive arguments ∏ a 1 ∶A 1 ⋯ ∏ ap∶Ap with ∏ a 1 ∶A ′ 1 ⋯ ∏ ap∶A ′ p , as defined above, and replace the target Q of the constructor with P (c j (π 1 $ a 1 ) ⋯ (π 1 $ a p )).
The induction cases for each of the element constructors are then h 1 ∶ C 1 , . . . , h m ∶ C m , and these provide an eliminator elim h 1 ⋯ h m for the underlying inductive type ⌊Q⌋.
Given h 1 , . . . , h m , define D k , for each equality constructor d k ∶ D k , in the same way. Replace the homogeneous equality type with a heterogeneous equality type and replace the endpoints l, r of the equality with l, r inductively defined by cases depending on if the abstracted variable is a constructor or not: The elimination rule is then: Finally the computation rules are, for each element constructor c i ∶ C i , same hypotheses as QITelim Γ ⊢ a 1 , . . . , a p ∶ Arg(C i ) QITcomp qitelim h 1 ⋯ h m p 1 ⋯ p n (c i a 1 ⋯ a p ) = P (c i a 1 ⋯ ap) h i (a 1 , (qitelim ⋯) $ a 1 ) ⋯ (a p , (qitelim ⋯) $ a p ) Vol. 18:2   QUOTIENTS, INDUCTIVE TYPES, AND QUOTIENT INDUCTIVE TYPES  15:29 Example 7.4. The elimination rule for X ∶ U ⊢ Bag is: Γ ⊢ resp ∶ ∏ x y∶X ∏ zs ′ ∶ ∑ zs∶Bag P zs cons x (y ∶∶ (π1 zs ′ ), cons y zs ′ ) == cons y (x ∶∶ (π1 zs ′ ), cons x zs ′ ) Bagelim nil cons resp ∶ ∏ x∶Bag P x And it computes: Bagelim nil cons resp (x ∶∶ xs) = P (x∶∶xs) cons x (xs, Bagelim nil cons resp xs) 7.2. From QIT to QWI-type. We claim that any QIT Q in the sense of Definition 7.1 can be constructed as the QW-type for a signature and equational system derived from the declaration of the QIT; and that the same is true for the indexed version of Definition 7.1 and QWI-types. That is, QWI-types are universal for non-conditional QITs in the same sense that W-types are for inductive types in a sufficiently extensional type theory. We saw above that the data c 1 ∶ C 1 , . . . , c m ∶ C m in Definition 7.1 gives rise to an underlying inductive type ⌊Q⌋ and hence to a W-type [AGHMM15], with signature Σ = (A, B). The parameters and arguments of the equality constructors d 1 ∶ D 1 , . . . , d n ∶ D n are also encoded in the same way by a signature (E, V ). Then the endpoints of the equality constructors can be encoded by the l and r arguments of an equational system ε = (E, V, l, r) in the sense of Definition 3.1; the encoding follows the structure of EqType judgements in Figure 3, using the η constructor of T Σ (3.6) for variables and the σ constructor for c 1 , ⋯, c m introduced by EqConstr in Θ. We illustrate the encoding by example, beginning with the three examples from the Introduction.
Example 7.5 (Finite multisets). The element constructors of the QIT, Bag X, of finite multisets over X ∶ U in (1.1) are encoded exactly as the W-type for List over X: we take A ∶ U to be 1 + X, where ι 1 0 corresponds to [] and ι 2 x corresponds to x ∶∶ _ for each x ∶ X. The arity of [] is zero, and the arity of each x ∶∶ _ is one; so we take B ∶ A → U to be the function mapping ι 1 0 to 0 and each ι 2 x to 1. The swap equality constructor is parametrised by elements of E def = X ×X and for each (x, y) ∶ E, swap (x, y) yields an equation involving a single free variable (called zs ∶ Bag X in (1.1)); so we define V def = λ _ . 1 ∶ E → U. Each side of the equation named by swap (x, y) is coded by an element of T Σ (V (x, y)) = T Σ 1. Recalling the definition of T Σ from Section 3.1, the single free variable, zs, corresponds to η 0 ∶ T Σ 1. Then the left-hand side of the equation, x ∶∶ y ∶∶ zs, is encoded as σ (ι 2 x, (λ _ . σ (ι 2 y, (λ _ . η 0)))), and similarly the right-hand side, y ∶∶ x ∶∶ zs, is encoded as σ (ι 2 y, (λ _ . σ (ι 2 x, (λ _ . η 0)))).
So altogether, the encoding of Bag X as a QW-type uses the non-indexed signature Σ = (A, B) and equational system ε = (E, V, l, r), where: l(x, y) def = σ(ι 2 x, (λ _ . σ(ι 2 y, (λ _ . η 0)))) r(x, y) def = σ(ι 2 y, (λ _ . σ(ι 2 x, (λ _ . η 0)))) Example 7.6 (Length-indexed multisets). The QWI-type encoding the QIT AbVec X of length-indexed multisets in (1.3) is an indexed version of the previous example, using the The indexed system of equations ε = (N, E, V, l, r) over Σ has E ∶ U N , V ∶ ∏ i∶N (E i → U N ) and l, r ∶ ∏ i∶N ∏ e∶E i (T Σ (V i e)) i given by: (We have used dependent pattern matching [Coq92] to simplify the formulation of the above definitions; refl ∶ x = x denotes the proof of reflexivity; V 0 , V 1 , l 0 and l 1 are uniquely determined.) Example 7.7 (Unordered countably-branching trees). The parameters of the leaf and node constructors for the QIT in (1.4) look like those for Bag, except that the arity of node is N rather than 1. So we use the non-indexed signature Σ = (A, B) with A ∶ U and B ∶ A → U given by: The perm equality constructor is parameterised by elements of X × ∑ b∶N→N isIso b. For each element (x, b, b ′ ) of that type, perm(x, b, b ′ ) yields an equation involving an N-indexed family of variables (called f ∶ N → ωTree X in (1.4)); so we take V ∶ E → U to be λ _ . N. Each side of the equation named by perm( The N-indexed family of variables is represented by the function η ∶ N → T Σ (N) and its permuted version by η ○ b. Thus the left-and right-hand sides of the equation named by perm(x, b, b ′ ) are coded respectively by the elements σ(ι 2 x, η) and σ(ι 2 x, η ○ b). Finally, the non-indexed system of equations over Σ for the QW-type corresponding to the QIT in (1.4) is ε = (E, V, l, r) with: Example 7.8 (W-suspensions [Soj15]). W-suspensions are also instances of QW-types.
The data for one of them is: a type A ′ ∶ U and a type family B ′ ∶ A ′ → U, (that is, the same data as a W-type), together with a type C ′ ∶ U and functions l ′ , r ′ ∶ C ′ → A ′ that express a restricted subset of equalities. The equivalent QW-type is: Example 7.9 (W-types with reductions [Swa18]). W-types with reductions are further instances of QWI-types. The data for such a type, using our notational conventions, is: together with, for all z ∶ Z a reindexing map R z ∶ ∏ y∶Yz (X z y) z . A reduction identifies a term σ z (y, α) for the signature (Z, Y, X) at index z with the argument that was used to construct that term at the re-indexing map, namely α z (R z y). We claim that the equivalent QWI-type is given by: Example 7.10 (Blass, Lumsdaine and Shulman's HIT [LS19]). As discussed in Section 4, Blass [Bla83, Section 9] shows that, provided a certain large cardinal axiom is consistent with ZFC, then there is an infinitary equational theory with no initial algebra in ZF. Lumsdaine and Shulman [LS19, Section 9] adapt this theory into a higher-inductive type, called F , that cannot be proved to exist in ZF, and hence cannot be constructed in type theory just using pushouts and natural numbers. Nevertheless it can be constructed in the type theory of Section 2 plus WISC, because of Theorem 6.1 and the fact that F can be expressed as a QWI-type. The type F can be thought of as a set of notations for countable ordinals. Its definition requires some setup.

Conclusion
QWI-types are a general form of indexed quotient inductive types that capture many examples, including simple 1-cell complexes and non-recursive QITs [BGvdW17], non-structural QITs [Soj15], W-types with reductions [Swa18] and also infinitary QITs (e.g. unordered infinitely branching trees [AK16] and the type F of Blass [Bla83], Lumsdaine and Shulman [LS19]). We have shown that it is possible to construct any QWI-type, even infinitary ones, in the extensional type theory of toposes with natural numbers object and universes satisfying the WISC Axiom. (Indeed our Agda development shows that the construction is also possible in weaker, more intensional type theories.) We conclude by mentioning related work and some possible directions for future work.
Reduction of QWI to QW. WI-types (indexed W-types) can be constructed from W-types: see [GH04, Theorem 12] and [AGHMM15, Section 7.1]. Our main Theorem 6.1 implies indirectly that in the presence of WISC, QWI-types can be constructed from QW-types (since quotients and W-types are instances of the latter). We do not know whether there is a direct reduction of QWI-types to QW-types without any further axioms, extending the reduction of WI-types to W-types.
Conditional path equations. In Section 7.1 we mentioned the fact that Dybjer and Moeneclaey [DM18] give a schema for finitary 1-HITs (and 2-HITs) in which path constructors are allowed to take arguments involving the identity type of the datatype being declared.
To cover this case, one could consider generalising QWI-types by replacing the role played by infinitary equational theories by theories whose axioms are infinitary Horn clauses, that is, equations conditioned by (possibly infinite) conjunctions of equations. In fact, we have already extended Theorem 6.1 to cover this case, and this will likely appear in the third author's upcoming thesis.
Quotients of monads. Theorem 6.1 gives a construction of initial algebras for equational systems on the free monad T Σ generated by a signature Σ. By a suitable change of signature (see Remark 3.3) this extends to a construction of free algebras, rather than just initial ones. One can show that the construction works not just for free monads, but for more general ones where the underlying endofunctor is well-behaved (satisfies some suitable colimit preservation), such as the quotient monads one obtains from systems of equations over signatures. Given such a construction one gets a quotient monad morphism from the base monad to the quotient monad. This contravariantly induces a forgetful functor from the algebras of the latter to those of the former. Using the adjoint triangle theorem, one should be able to construct a left adjoint. This would then cover examples such as the free group over a monoid, free ring over a group, etc.
Quotient inductive-inductive types. We do not know whether our analysis of QITs using quotients, inductive types and a well-founded notion of size can be extended to cover the notion of quotient inductive-inductive type (QIIT) [ACDKN18; KKA19]. Dijkstra [Dij17] studies such types in depth and in Chapter 6 of his thesis gives a construction for finitary ones in terms of countable colimits, and hence in terms of countable coproducts and quotients. One could hope to pass to the infinitary case by using well-founded sizes as we have done, provided an analogue for QIITs can be found of the construction in Section 6 for our class of QITs, the Pattern matching for QITs and HITs. Our reduction of QITs to quotients and inductive types in the presence of WISC is of foundational interest. For applications, one could wish for direct support in systems like Agda, Coq and Lean for the very useful notion of quotient inductive type, or more generally, for higher inductive types. Even having better support for the special case of quotient types would be welcome. It is not hard to envisage the addition of a general schema for declaring QITs; but when it comes to defining functions on them, having to do that with eliminator forms rapidly becomes cumbersome (for example, for functions of several QIT arguments). Some extension of dependently-typed pattern matching to cover equality constructors as well as element constructors is needed. In this context it is worth mentioning that the cubical features of recent versions of Agda give access to cubical type theory [VMA19]. This allows for easy declaration of HITs (and hence in particular QITs) and a certain amount of pattern matching when it comes to defining functions on them: the value of a function on a path constructor can be specified by using generic elements of the interval type in point-level patterns; but currently the user is given little mechanised assistance to solve the definitional equality constraints on end-points of paths that are generated by this method.