# Impredicative Encodings of (Higher) Inductive Types

Postulating an impredicative universe in dependent type theory allows System F style encodings of finitary inductive types, but these fail to satisfy the relevant η-equalities and consequently do not admit dependent eliminators. To recover η and dependent elimination, we present a method to construct refinements of these impredicative encodings, using ideas from homotopy type theory. We then extend our method to construct impredicative encodings of some higher inductive types, such as 1-truncation and the unit circle S1.

## Authors

• 1 publication
• 2 publications
• 1 publication
• ### Computational Higher Type Theory IV: Inductive Types

This is the fourth in a series of papers extending Martin-Löf's meaning ...
01/04/2018 ∙ by Evan Cavallo, et al. ∙ 0

• ### Construction of the Circle in UniMath

We show that the type TZ of Z-torsors has the dependent universal proper...
10/04/2019 ∙ by Marc Bezem, et al. ∙ 0

• ### An Intuitionistic Set-theoretical Model of Fully Dependent CCω

Werner's set-theoretical model is one of the simplest models of CIC. It ...
10/23/2020 ∙ by Masahiro Sato, et al. ∙ 0

• ### Constructing Infinitary Quotient-Inductive Types

This paper introduces an expressive class of quotient-inductive types, c...
11/15/2019 ∙ by Marcelo Fiore, et al. ∙ 0

• ### Naive cubical type theory

This paper proposes a way of doing type theory informally, assuming a cu...
11/13/2019 ∙ by Bruno Bentzen, et al. ∙ 0

• ### A Weakly Initial Algebra for Higher-Order Abstract Syntax in Cedille

Cedille is a relatively recent tool based on a Curry-style pure type the...
10/24/2019 ∙ by Aaron Stump, et al. ∙ 0

• ### On the Formalization of Higher Inductive Types and Synthetic Homotopy Theory

The goal of this dissertation is to present synthetic homotopy theory in...
08/31/2018 ∙ by Floris van Doorn, et al. ∙ 0

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## 1 Introduction

System F, also known as the ‘Girard-Reynolds polymorphic -calculus’, goes back to [Gir72] and [Rey74]. It extends the simply typed -calculus with universal quantification over types. Under the Curry-Howard correspondence [How80], it is the type-theoretic analog of second-order propositional logic.

One of the remarkable things about System F is that it allows for the encoding of types such as products, sums, natural numbers, and, more generally, finitary inductive types. These encodings are called impredicative, since in defining a specific type they quantify over the totality of all types, which in particular contains the type which is being defined. For example, the type of natural numbers is encoded in System F as

 NF ≡ ∀X.(X→X)→X→X.

A well-known defect of such encodings, however, is that they do not satisfy the appropriate ‘-rules’, which are uniqueness principles stating that for every recursive definition there is only one function realizing it. One way to think about this failure of is that e.g. the type described by the formula is ‘too large’, in that certain models [Rum04] may contain non-standard elements which are not generated from the constructors. On the other hand, one can show using parametricity arguments [Rey83] that all the ‘named’ elements are standard. This discrepancy has led to attempts to refine the models by imposing parametricity, dinaturality [BFSS90], or realizability [CFS88] conditions.

System F-style, impredicative encodings can also be given in dependent type theory with an impredicative universe (such as the calculus of constructions [CH88]), but here a further consequence of the failure of uniqueness of the recursors is that the encoded types do not admit dependent elimination rules, which are necessary for proofs by induction, and thus indispensable for the development of mathematics in type theory.

In this article we present a new technique to restore -rules by refining impredicative encodings in a way that is related to the parametricity and dinaturality techniques mentioned above, but in contrast to them, takes place inside the type theory, so that the -equalities on the refined types become provable, rather than just admissible w.r.t. a model. To be more specific, for our refined encodings we can prove propositional versions of the required -equalities, which – as shown in [AGS12, AGS17] – are sufficient to derive the existence of the corresponding dependent eliminators.

The system of type theory that we use is similar to the calculus of constructions with a hierarchy of predicative universes (like in older versions of the Coq proof assistant), but in contrast to the calculus of constructions we assume that the lowest, impredicative universe is closed under small sums and identity types.

Some of our arguments make use of the ‘uniqueness of identity proofs’ principle, but instead of postulating it globally we exploit the notion of -types from homotopy type theory to state the relevant results for that level of the definable hierarchy of h-levels. This also allows us to explore the applicability of our techniques to higher inductive types in the later sections.

We emphasize that our main contribution is to give impredicative encodings of inductive types in dependent type theory that satisfy the relevant dependent elimination rules (along with the other rules). This seems to solve a long-standing problem, considered in [Geu01], of giving “2nd-order encodings” satisfying induction. We do this by “refining” the impredicative encodings inside the type theory using identity types. This is in contrast to interpreting the system into a model and having the universal properties hold there, which is the spirit of the “parametric polymorphism” approach set out in [Rey83], where the universal quantification of System F is “cut down” on interpretation.

#### Overview

Section 2 specifies the system of type theory in which our work takes place, recalls the definition of -types in homotopy type theory, and introduces the (pre-)category of small -types. We also include a brief description of how System F can be translated into our setting. In Section 3 we show how to refine the System F encodings of some non-recursive, inductive sets such as the binary sum of two sets to recover appropriate -rules, using an argument based on a type-theoretic version of the Yoneda lemma. Section 4 gives a related technique involving impredicative encodings of initial algebras in order to achieve the same result for genuinely inductive sets such as the type of natural numbers. In Section 5 we show how these techniques generalize from sets (-types) to -types, giving impredicative encodings of some of the recently introduced higher inductive types [Uni13, Ch. 6]. Specifically, we give encodings for the -truncation and the unit circle. We believe that these encodings also illuminate the ones for conventional inductive types. Indeed, our general methodology is very much informed by the HoTT point of view. Finally, Section 6 addresses issues such as limitations of our techniques, open questions, consistency and the existence of models, and future work.

## 2 The System of Type Theory

Although our results are not all “higher dimensional” in nature, our work is best understood in the context of homotopy type theory (HoTT); we refer to [Uni13] as our standard reference for conventions and terminology. We thus work in a system of dependent type theory with products , strong sums , (intensional) identity types , and function extensionality, as in [Uni13]. However, we make no use of the univalence axiom. We usually write simply for , as is now common. We then distinguish notationally between propositional equality and definitional equality .

#### Universes

We augment the hierarchy of predicative universes

 U0:U1:U2:…

assumed in [Uni13] by adding a single impredicative universe at the bottom.

 U:U0:U1:U2:…

This new universe is also closed under dependent sums and identity types, like the , but instead of the usual (predicative) product formation rule

 \inferrule∗Γ⊢A:UiΓ,x:A⊢B:UiΓ⊢∏(x:A)B:Ui

it satisfies the impredicative product formation rule

 \inferrule∗Γ,x:A⊢B:UΓ⊢∏(x:A)B:U

which is stronger since there is no size restriction on the .

Note that in the following, when writing , we always mean the impredicative universe – in this respect we deviate from [Uni13], in that we do not use as a placeholder for an unspecified .

#### n-Types

Recall from [Uni13, 7.1] the hierarchy of n-types (Voevodsky: “h-levels”): is called a (-1)-type, or proposition, if it satisfies ; it is a 0-type, or set, if its identity types are always propositions; and generally, it is an (n+1)-type if its identity types are always n-types. Formally, let

 isProp(X) :≡ ∏(x,y:X)x=y isSet(X) :≡ ∏(x,y:X)isProp(x=y) isType(n+1)(X) :≡ ∏(x,y:X)isTypen(x=y),

and

 Prop :≡ ∑(X:U) isProp(X) Set :≡ ∑(X:U) isSet(X) Typen :≡ ∑(X:U) isTypen(X).

Note that the types , , etc., are themselves propositions [Uni13, Theorem 7.1.10], so that , , etc., are subtypes of , in the sense that the first projection from the respective -type is an embedding.

We normally suppress the coercion and treat expressions of type as if they were themselves types. Thus, in particular if is a -indexed family of types then the expression is a shorthand for

 ∏(X:Typen)A(pr1X),

which in turn is equivalent to

 ∏(X:U)isTypen(X)→A(X).

Moreover, since the -types are closed under arbitrary products [Uni13, Theorem 7.1.9] (and suppressing the unpacking and repacking of dependent pairs), the rule

 \inferrule∗Γ,x:A⊢B:TypenΓ⊢∏(x:A)B:Typen

is admissible for all . Thus, in sum, we can view the types as impredicative subuniverses of .

We exploit the convenience of having an impredicative universe that is closed under most constructions, by working mostly inside – as opposed to the usual methodology of predicative systems, where a hierarchy of universes are used “parametrically”. Accordingly, we adopt the convention that the terms “proposition”, “set”, “n-type”, etc., refer only to types in .

#### The precategory Set of sets in U

The subtype of -types in gives rise to a precategory where

 Set0=Setandhom(A,B)=(A→B)

for ([Uni13, Example 9.1.5]).

As pointed out in [Uni13, Section 10.1.1], this precategory is (small) complete in that it admits equalizers (defined using - and identity-types) and small products (given by type-theoretic products). Since in our setting is an impredicative universe, even admits ‘large’ products – i.e. products indexed by arbitrary types – which we make use of in what follows.

#### Translation of System F

There is an evident syntactic translation from System F (see Appendix A) to our system of dependent type theory. Types of the form in System F are translated to , and types of the form are translated to , where and are the translations of the System F types and . The translation of terms is equally obvious.

Similarly, we can restrict the translation by replacing above with any of the impredicative subuniverses of -types. For example, we may define the translation with:

 (∀X.B)t0\vcentcolon≡∏X:SetBt0.

In this sense, we can speak of System F encodings of inductive types in our system of dependent type theory.

Generally, if is a (family of) propositions, then as above is a subtype of via the first projection. Our impredicative encodings of inductive types will be subtypes of the usual System F encodings in this sense; we say that they “sharpen” or “refine” the usual encodings.

## 3 Basic Set Encodings

As stated in the foregoing section, the impredicative universe allows us to give ‘System F style’ encodings of certain inductive types. In this section we explain how these encodings fall short of the usual inductive types assumed in dependent type theory. We then indicate a way to remedy these shortcomings to a certain extent.

We start with the sum of two types and , whose System F encoding we translate into type theory, as explained above, by replacing the quantification over types by a dependent product over :

 A+FB :≡ ∏X:U(A→X)→(B→X)→X. (3.1)

It is easy to see that this encoding admits injections111We adopt the convention that arguments in braces in types denote implicit arguments, meaning that we may write e.g.  instead of .

 inlF :≡ λABaXfg.fa : ∏{A,B:U}A→(A+FB) (3.2) inrF :≡ λABbXfg.gb : ∏{A,B:U}B→(A+FB)

and a recursor

 recF+ :≡ λABCfgϕ.ϕCfg (3.3) :∏{A,B,C:U}(A→C)→(B→C)→(A+FB)→C

satisfying the definitional -equalities

 recF+fg(inlFa)≡faandrecF+fg(inrFb)≡gb

for all , , , and .

However there are several problems:

1. the recursor only allows us to define functions into types in ,

2. the -rule

 f=recF+(f∘inlF)(f∘inrF),

where , doesn’t hold, even propositionally,

3. the encoding does not admit a dependent eliminator, which would have to have the type

 indF+ : ∏{A,B:U} ∏{C:A+FB→U} ∏(f:∏(a:A)C(inlFa)) ∏(g:∏(b:B)C(inrFb)) ∏(x:A+FB),Cx.

and satisfy the propositional equalities

 indF+fg(inlFa) = faandindF+fg(inrFb) = gb

for all appropriately typed , , , and .

We defer discussion of issue (i) in general to section 6 below. Issues (ii) and (iii) are related by the general theory developed in [AGS12, AGS17]: briefly, in the present setting the dependent elimination rule is equivalent to the -rule. In the following we give a way to restore the propositional -rule for sums of sets by restricting the product in (3.1) to and taking a suitable subtype.

### 3.1 Refining the encoding

Restricting the dependent product in (3.1) to the subuniverse of propositions, we obtain a well-known encoding of logical disjunction:

 A∨B ≃ ∏X:Prop(A→X)→(B→X)→Xfor A,B:Prop

Observe that is a proposition, because is closed under -types.

In a similar vein it seems natural to define a sum operation

 A+∗B :≡ ∏X:Set(A→X)→(B→X)→Xfor A,B∈Set (3.4)

of sets , by restricting the impredicative product to types . This type also admits injections and a recursor

 inl∗ :≡ λABaXfg.fa : ∏{A,B:Set}A→(A+∗B) inr∗ :≡ λABbXfg.gb : ∏{A,B:Set}B→(A+∗B) rec∗+ :≡ λABCfgϕ.ϕCfg :∏{A,B,C:Set}(A→C)→(B→C)→(A+∗B)→C

analogous to those for . The -rule still fails for , but as we shall see, it is now possible to carve out a subtype for which it is satisfied.

As a warm-up exercise, consider first the unary case. For there is an embedding-retraction pair

 A [rr]^-e [rrd]_= && [d]^r ∏_(X:Set)(A→X)→X && A , (3.5)

where and .

Now, a term is a family of maps (switching notation for emphasis),

 αX:XA→X,X:Set.

We can cut down the type to (one equivalent to) the image of in (3.5) by requiring that the family of maps be natural in in the sense that for all sets and all maps , the following square commutes.

 X^A [r]^α_X [d]_f^A & [d]^f X Y^A [r]_α_Y & Y (3.6)

Here, is the action of the functor on .

The sharper encoding of is now:

 A+\vcentcolon≡∑α:A∗N(α), (3.7)
 where A∗ \vcentcolon≡∏X:Set(A→X)→X and N(α) \vcentcolon≡∏X,Y:Set∏f:X→YαY∘fA=f∘αX.

Note that is an embedding since is a proposition for all .

###### Theorem 3.1 (Basic Lemma).

For any set , we have .

###### Proof.

First, we show that factors through . For , the family consists of the evaluations , where . If , then indeed

 (e(a)Y∘fA)(g)=e(a)Y(fA)(g))=e(a)Y(f∘g)=f(g(a))=f(e(a)X(g))=(f∘αX)(g).

Now let be natural in the sense expressed in (3.7), and define We claim that , which suffices since is a set. Indeed, take any and , then we have

 e(a0)X(g)=g(a0)=g(αA(1A))=αX(gA(1A))=αX(g),

using the naturality of in the third step. ∎

###### Remark.

The categorically minded reader will recognize that the previous theorem is an instance of the Yoneda lemma. Indeed, (3.7) is the type of all natural transformations from the (covariant) representable functor to the identity functor , so by Yoneda we indeed have

 Nat((−)A,I)≃I(A)≃A.

But since we do not require this level of generality here, we will not develop the required details.

Taking inspiration from the previous theorem, we return to the preliminary encoding from (3.4), and in order to recover the -rule define a subtype by imposing a suitable naturality condition.

 (A+B)∗ ≡ ∏X:Set((A+B)→X)→X ≃ ∏X:Set(A→X)×(B→X)→X ≃ ∏X:Set(A→X)→(B→X)→X ≡ A+∗B

Now by transporting the naturality condition of the lemma along the equivalence, we can define as a subtype of , where the defining condition can again be read as a naturality property, but now one that does not assume the existence of . Specifically, we define

 A+B\vcentcolon≡∑α:A+∗BN(α)whereN(α)\vcentcolon≡∏X,Y:Set∏f:X→Y∏h:A→Xk:B→Xf(αXhk)=αY(f∘h)(f∘k). (3.8)

If we substitute or for in , the two sides of the identity type become definitionally equal, whence we can refine the injections defined in (3.2) to get the following.

 inl: ∏{A,B:Set}A→A+Binr:∏{A,B:Set}B→A+Binla\vcentcolon≡(inl∗a,λXYfhk.refl)inrb\vcentcolon≡(inr∗b,λXYfhk.refl)

The recursor (3.3) gets replaced by

 rec+ :∏{A,B,C:Set}(A→C)→(B→C)→A+B→C rec+\vcentcolon≡λABCfgξ.(pr1ξ)Cfg

With these definitions we can now prove the following.

###### Theorem 3.2.

For all sets and , the encoding (3.8) of the sum , along with the structure , , and just defined, satisfy

1. the definitional -rules

 rec+fg(inla)≡faandrec+fg(inrb)≡gb

for all , , , ,  ,

2. the propositional -rule

 rec+(f∘inl)(f∘inr)=f

for all and .

###### Proof.

The rules follow mechanically by unfolding definitions.

For the rule, we first prove a special case, namely

 rec+inlinr=idA+B:A+B→A+B. (3.9)

By function extensionality and -induction it is sufficient to show that for all and . Since is an embedding, this reduces to , and again by function extensionality this follows from

 pr1(αA+Binlinr)Xfg=αXfg

for , and . This is shown by

 pr1(αA+Binlinr)Xfg ≡rec+fg(αA+Binlinr) =αX(rec+fg∘inl)(rec+fg∘inr) =αXfg,

where the second equality is given by and the third one follows from and function extensionality.

For the general case, let again and . We have:

 rec+(f∘inl)(f∘inr)(α,p) ≡αC(f∘inl)(f∘inr) =f(αC(inl)(inr)) (by p) ≡f(rec+inlinr(α,p)) =f(α,p) (by (???)),

which proves the claim. ∎

We emphasize that it is crucial to the proof that the encoding (3.8) of is itself a set, so that is in the range of the variable – and of course, so that the sum of two sets is again a 0-type. This is ensured by the fact that the n-types are closed under -, -, and identity-types, and of course, the impredicativity of . In more detail, in (3.4), the ranges over sets, and thus the type is a 0-types. But then by impredicativity of , the entire type is a set. In , the identity type is a proposition, since it is over the type of functions , which is a 0-type. Thus is itself a proposition, whence is a set.

Finally, as mentioned in Section 3, the induction principle below follows from recursion together with the uniqueness of the recursor (the -rule) [AGS12, AGS17]:

 ind+ : ∏{A,B:Set} ∏{C:A+B→Set} ∏(f:∏(a:A)C(inla)) ∏(g:∏(b:B)C(inrb)) ∏(x:A+B),Cx,

with propositional equalities

 ind+fg(inla) = faandind+fg(inrb) = gb

for all appropriately typed , , , and .

Having done the unary and binary case of sums of sets, we might as well do the nullary one, too. The System F style encoding of the empty type in , given by

 0\vcentcolon≡∏(X:U)X,

 rec0:≡λXc.cX:∏{X:U}0→X,

and it turns out that in this case we don’t need any refinement, since we can already derive that is a proposition and that satisfies an equality – indeed, we have

 λcd.c(c=d):∏c,d:0(c=d) ≡isProp(0),

and the eliminator is unique, by

 funext(λc.c(cX=fc)):rec0X=f

for any and .

#### Other non-recursive 0-types

Unlike , the terminal set does not have the System F form (uniqueness of the maps fails), but instead can be encoded as a (-1)-type via the familiar

 1:≡∏p:Propp→p. (3.10)

Indeed, this is easily seen to be terminal for all .

The method of adding a naturality condition can be used to encode the set-truncation of an arbitrary type . Indeed, we can simply take

 ||A||0:≡∑α:A∗∏X,Y:Set∏f:X→YαY∘fA=f∘αX,whereA∗:≡∏X:Set(A→X)→X, (3.11)

as in the Basic Lemma 3.1, since is a set even when is not one.

Observe how this generalizes the well-known [Hof95, AB04] [Uni13, Exercise 3.15] propositional truncation of a type ,

 ||A||= ∏X:Prop(A→X)→X.

We only mention that it is also possible to give correct impredicative encodings of set-quotients [Uni13, 6.10], as well as general coequalizers of sets, by related methods.

## 4 General inductive sets

While sums and truncations are viewed as inductive types in modern terminology, the classical idea of an inductive type involves generation from constants by repeated application of constructors. A well understood class of inductive types in type theory and category theory are W-types [ML84, pg. 43], which are generated from a family of constructors of specified – possibly infinite – arities.

Inductive types of this kind with only finitely many constructors, each of finite arity, can be encoded in System F [GTL89, Section 11.5], and translating these encodings into type theory by quantifying over the impredicative universe leads again to types which admit the correct constructors and recursors but fail to satisfy the appropriate -rules.

On the other hand, it is known from category theory that W-types can be understood as initial algebras of so called polynomial functors [MP02, GH03]. In the following we show how a categorical construction of initial algebras relying on the impredicativity of gives rise to subtypes of the System F style encodings satisfying . We elaborate this idea using as running example the inductive type of natural numbers, but the method is easily seen to generalize.

### 4.1 Initial algebras of endofunctors

As pointed out in Section 2, the precategory is complete in the very strong sense that it has all equalizers (constructed using - and identity-types) as well as products of families of objects indexed by arbitrary types. It is an old observation by Hyland [Hyl88, Section 3.1] that this implies the existence of initial algebras for arbitrary endofunctors, at least in the related semantical setting of certain kinds of internal categories. In the following we give explicit type-theoretic descriptions of the required limits and initial algebras by unwinding the categorical definitions.

First, observe that limits over arbitrary (pre)category-indexed diagrams can be expressed using products and equalizers, as usual. Specifically, let be a precategory: an arbitrary type of objects and a family of sets of arrows , equipped with the usual composition and unit structure, and satisfying the usual equations on these, which are propositional, because the are sets for all . A -indexed ‘diagram’ is just a functor , which can also be defined as usual, since the values are all sets. The limit of is the equalizer of the two maps

 p,q: ∏i:J0Di⇉∏(i,j:J0)∏(u:hom(i,j))Dj pϕiju :≡D(u)(ϕi) qϕiju :≡ϕj,

which is given explicitly by the type

 lim←−iDi\vcentcolon≡∑(ϕ:D∗)∑(ϕ:D∗)∏(i,j:J0)∏(u:hom(i,j))Du(ϕi)=ϕj,whereD∗\vcentcolon≡∏i:J0Di, (4.1)

together with projections

 πj\vcentcolon≡λξ.(pr1ξ)j:lim←−iDi→Djfor j:J0.

Crucially for proving the rule in Section 4.2, observe that is a set, since all the are sets, is impredicative, and is therefore a sum of a family of propositions over a set.

Now recall that, given an endofunctor , the category of -algebras has as objects pairs , and as morphisms from to the functions satisfying . Thus, type-theoretically, we have the precategory:

 (F-Alg)0 \vcentcolon≡∑X:SetFX→X, hom((X,α),(Y,β)) \vcentcolon≡∑f:X→Yf∘α=β∘Ff.

The forgetful functor is just the first projection, that is:

 U(X,α) \vcentcolon≡ X for(X,α):(F-Alg)0, U(f,p) \vcentcolon≡ f for(f,p):hom((X,α),(Y,β)).

It is well-known, and easy to prove, that the precategory inherits arbitrary limits from , and these can be computed pointwise. Thus has an initial object, which is just the limit of the identity functor. Since limits in are computed pointwise, they are preserved by , which means that the initial algebra has as its underlying set the limit of the functor , which using (4.1) we can write explicitly as

 I\vcentcolon≡ ∑ϕ:U∗∑(ϕ:U∗)Lim(ϕ) (4.2)
 whereU∗\vcentcolon≡ ∏A:F-AlgUA, andLim(ϕ)\vcentcolon≡ ∏(A,B:F-Alg)∏(f,p):hom(A,B)f(ϕA)=ϕB.

Summarizing the foregoing discussion, we have the following.

###### Theorem 4.1.

For any functor , the category of -algebras has an initial object

 i:FI→I,

where:

1. the set is given by the type (4.2) and is the limit of the forgetful functor , and

2. the map is given by

 i(x)\vcentcolon≡(λA.(pr2A)(F(πA)x),q(x)),

where is constructed from functoriality of and naturality of the limit cone.

We emphasize that the foregoing theorem is not merely semantically true in a certain model, but is provable in our system of type theory. In the following we use this construction of initial algebras to obtain an encoding of the type of natural numbers which refines the System F encoding.

### 4.2 Natural numbers

The inductive type of natural numbers is generated by the constructors

 0:Nsucc:N→N.

From this specification we can derive the set-level System F style encoding

 (4.3)

 0∗ \vcentcolon≡λXhx.x:N∗ succ∗ \vcentcolon≡λnXhx.h(nXhx):N∗→N∗

and a recursor

 rec∗N\vcentcolon≡ λXhxn.nXhx:∏(X:Set)(X→X)→X→N∗→X.

These satisfy the -rules

 rec∗Nhx0∗≡xandrec∗Nhx(succ∗n)≡h(rec∗Nhx)

for , and , but not the -rule, which states that is uniquely determined in the sense that

 (f(0∗)=x∧f∘succ∗=h∘f)→(f=rec∗Nhx)

for all (and writing in place of for propositions).

On the other hand, can be categorically characterized as the initial algebra of the functor functor given by

 T(X)\vcentcolon≡X+1,T(f)\vcentcolon≡rec+(inl∘f)inrfor f:X→Y.

Here is the unit type from (3.10).

Instantiating the type in Theorem 4.1 we get the type

 ∑(ϕ:∏(A:∑(X:Set)X+1→X)pr1A)Lim(ϕ)

for the underlying set of the initial algebra, and it turns out that the index type of the sum is equivalent to :

 ∏A:∑X:SetX+1→Xpr1A ≃∏X:Set(X+1→X)→X ≃∏X:Set(X→X)×X→X ≃N∗

We compose the predicate with this equivalence to get a description of the initial algebra directly as a subtype of the System F encoding:

 N\vcentcolon≡ ∑(ν:N∗)Lim′(ν)with Lim′(ν)\vcentcolon≡ ∏X:SetY:Set∏x:Xy:Y∏h:X→Xk:Y→Yf:X→Y(f(x)=y∧f∘h=k∘f)→f(νXhx)=νYky (4.4)

Observe that the triples and in the definition of can be coerced into -algebras and . Leaving this coercion implicit (as we shall do from now on), can be read as saying that we have

 f(νXhx)=νYky

for every -algebra morphism

 f:(X,h,x)→(Y,k,y).

It is easy to see that the predicate satisfies

 Lim′(0∗)and∏(ν:N∗)Lim′(ν)→Lim′(succ∗ν),

whence the System F constructors and can be restricted to operations

 0:Nandsucc:N→N

about which it is sufficient to know that they behave like and on the first components of dependent pairs. The recursor also restricts to in a straightforward manner

 recN\vcentcolon≡λXhxn. pr1(n)Xhx :∏{X:Set}(X→X)→X→N→X,

and we have the following theorem.

###### Theorem 4.2.

The encodings of , , and given above satisfy

1. definitional -rules saying that

 recNhx0≡xandrecNh