Lectures onType Theory
Chapter 74
Chapter 74Core route

Universes and Universe Levels

Boolean elimination cannot define D(tt)N,D(ff)1 as a type family: its branches are terms, while N and 1 have so far appeared only in type judgments. A universe is a type whose terms name types: it makes types available as terms. Boolean recursion may then return N or 1 in a universe, and the result may again be used as a type. The price is a size discipline.

The Russell hierarchy

We extend the theory of chapter 27chapter 28 by an externally indexed sequence U0:U1:U2:. In the Russell presentation, an element of Ui is used directly as a type. The index i is a metatheoretic natural number, not a term of the object theory.

Definition 29.1 — The universe hierarchy, `a la Russell

For external natural numbers i,j, add

Γ ctx
ΓUi type
U-Form
Γ ctxj<i
ΓUj:Ui
U-Hier
ΓA:Ui
ΓA type
U-El
ΓAB:Ui
ΓAB type
U-El-Eq

The hierarchy is closed under precisely the type formers available through chapter 28:

ΓA:UiΓ,x:AB:Ui
Γx:AB:Ui
U-Pi
ΓA:UiΓ,x:AB:Ui
Γx:AB:Ui
U-Sig
ΓA:UiΓ,x:AB:Ui
ΓWx:AB:Ui
U-W
ΓA:UiΓB:Ui
ΓA+B:Ui
U-Sum
Γ ctx
Γ0:Ui
U-Void
Γ ctx
Γ1:Ui
U-Unit
Γ ctx
Γ2:Ui
U-Bool
Γ ctx
ΓN:Ui
U-Nat

Each rule has its classified congruence companion. There is no eliminator for Ui, no rule Ui:Ui, and no closure rule for a type former introduced only in a later chapter.

For later calculations, note the nullary instances explicitly: U-Void, U-Unit, U-Bool, and U-Nat place 0,1,2,N in every Ui. Together with U-Sum, these are the branch elements used by the large eliminations below.

The open-endedness is deliberate. Martin-Löf adopts a reflection principle for the universe of small types but notes that it does not justify the axiom that the universe is one of its own elements, which Girard had shown contradictory [ML75]. His adjacent-level rule is weaker than the all-lower-level instance U-Hier fixed here. The sequence supplies a place for each universe without closing the entire sequence inside one final universe.

Example 29.2 — The polymorphic identity function

The characteristic derivation is λX.λx.x:X:U0x:XX. In the context X:U0, rule U-El makes X a type. The inner lambda is then ordinary Π-introduction. The outer domain is a type by U-Form. No universe eliminator is involved.

Convention 29.3 — Universe levels

A type is Ui-small when it is judgmentally equal as a type to some element of Ui. A type family over A is Ui-small when it is represented by a term AUi. Bare i,j,k in universe judgments range over external naturals. Letters u,v denote external level variables: metatheoretic unknowns that will later be instantiated by external naturals.

Remark 29.4 — Rule schemas

The hierarchy contains one rule instance for each external level. A single derivation uses finitely many instances, and there is no object-language quantifier over levels.

Large elimination

A large elimination is an ordinary elimination whose motive is a universe, so its result may subsequently classify terms.

Construction 29.12 — Large elimination for

For At,Af:Ui and b:2, put Ifi(At,Af,b):=rec2(At,Af,b):Ui. Then Ifi(At,Af,tt)At,Ifi(At,Af,ff)Af at Ui, hence also as types. In the context b:2, however, b:2If0(N,1,b):U0andb:2If0(N,1,b) type are neutral: neither Boolean computation rule applies. Thus λx.x has type If0(N,1,b)If0(N,1,b), but the intended conversion of 0:N to 0:If0(N,1,b) is stuck. After substituting tt for b, the classifier computes to N and that conversion is immediate.

A primitive type-level Boolean conditional could reproduce this example, but would not provide recursion into a universe for N and hence would not define the recursive family below.

Type families as universe maps

Proposition 29.16 — Families are maps into

Let ΓA type and let x be fresh for Γ. The assignments ΓF:AUigivesΓ,x:AF(x):Ui,Γ,x:AB:UigivesΓλx.B:AUi. The assignments are mutually inverse: their composites are identified by Π-β and Π-η.

Proof of Proposition 29.16 — Families are maps into

Proof. Application gives F(x):Ui, and U-El makes it a type. Abstraction gives the reverse assignment. Their composites are (λx.B)(x)B and λx.F(x)F by the Π rules. ◻

For example, if ΓA:U0 and Γ,x:AB:U0, rule U-W gives ΓWx:AB:U0. Thus the W-type former, not merely its ordinary formation rule, is available to universe-valued families.

Construction 29.17 — Finite types

Define the recursive universe map FinLE:=λn.recN(0,λk.λR.R+1,n):NU0. The subscript recalls “large elimination,” not an order relation. The family FinLE(n) has one element for each k<n: external induction uses the cardinal equations |0|=0 and |A+1|=|A|+1. The recursor computes at the universe classifier, so FinLE(0)0:U0,FinLE(suc(n))FinLE(n)+1:U0. After U-El-Eq, the same equations hold as equalities of types. This is a recursively defined family of ordinary types. It is not yet a genuinely indexed inductive declaration: no constructor result constrains an index by unification.

Construction 29.18 — Observational equality of

Recursion into U0 defines EqN(0,0)1,EqN(0,suc(n))0,EqN(suc(m),0)0,EqN(suc(m),suc(n))EqN(m,n). Concretely, first recurse on the first argument to produce a function NU0; in its zero branch recurse on the second argument with branches 1,0, and in its successor branch recurse with branches 0 and the recursively supplied family. These are judgmental equations at U0, hence equations of types by U-El-Eq.

Universe-polymorphic constraints

The calculations in this section use the optional cumulative membership extension

ΓA:Uiij
ΓA:Uj
U-Cumul

Without U-Cumul, every premise of U-Pi must have exactly the rule’s single level, so level inference collapses to unification rather than the inequality problem below. This is an explicit local change of theory, not a silent property of definition 29.1.

An implementation replaces some external indices by level variables. For the fragment used here, level expressions are generated by ::=0u+1max(,), and formation emits inequalities between such expressions. Normalize a level expression as a finite maximum of atoms u+n and a constant n. Then r means that every atom on the left is dominated by an atom with the same parameter on the right or by a known parameter constraint.

Example 74.9 — A complete level calculation

The notation f.{u,v} means that the declaration is generalized metatheoretically over the external level variables u,v; the braces are not object-language binders. For const.{u,v}:X:UuY:UvXYX, let m classify the entire displayed type. The two universe binders emit u+1m and v+1m; the result emits only um and vm. Removing the dominated constraints leaves u+1m,v+1m, with least solution m=max(u,v)+1. At u=0,v=2 this is m=3. By contrast, u+1v and v+1u are inconsistent: transitivity would give u+2u.

Proposition 74.10 — Completeness of the normalized solver

Let P be a satisfiable finite set of constraints involving only external parameters. Suppose every remaining normalized constraint has the one-sided form maxr(ar+nr)x, where x is an unknown and each ar is an external parameter, zero, or an unknown. Collapse zero-weight strongly connected components. If a component contains a positive-weight cycle, the constraints are unsatisfiable. Otherwise, for every assignment of the external parameters satisfying P, topological propagation of maxima terminates and returns the componentwise least solution as a max/successor expression in those parameters.

Proof of Proposition 74.10 — Completeness of the normalized solver

Proof. Fix an assignment of the external parameters satisfying P; those constraints restrict the inputs but add no unknown-bearing edge. Split every maximum into atomic inequalities and draw an edge anx for a+nx. A positive cycle sums to x+nx with n>0, impossible in N. If no such cycle exists, every edge inside a strongly connected component has weight zero; the variables in that component may be identified. The quotient graph is finite and acyclic. Process it in topological order, assigning each node the maximum of the expressions delivered by its incoming edges. This terminates. Every solution dominates every incoming expression, so induction over the topological order proves that it dominates the constructed assignment. The assignment itself satisfies every edge, hence is the least solution. ◻

Remark 74.11

For an external parameter u>0, the constraint umax(x,y) has the two incomparable minimal solutions (x,y)=(u,0) and (0,u). It therefore has no componentwise least solution. A solver admitting an unknown-bearing maximum on the right must preserve that disjunction or use a more general output language.

Universe polymorphism is metatheoretic generalization over level variables followed by solving; it is not object-language quantification over levels. Kovács instead studies level structures and level-indexed families [Kov22]. That more expressive calculus is engineering evidence, not a theorem transferred to ours.

Lifting and cumulativity

The frozen Russell hierarchy is noncumulative. From A:Ui one cannot silently conclude A:Ui+1. The cumulative rule used explicitly in section 74.4 is one repair; the other changes the syntax.

Definition 29.10 — Lifting

An explicit strict lift records a change of universe level in the term. The optional lifting extension has

ΓA:Ui
ΓLiftiA:Ui+1
Lift-U
ΓA:Ui
ΓLiftiAA type
Lift-El

Rule Lift-Cong says that lifting respects universe-element equality. Its commuting rules are Lift-Pi, Lift-Sig, Lift-W, Lift-Sum, Lift-Void, Lift-Unit, Lift-Bool, Lift-Nat, and Lift-Hier. For example, Lifti(x:AB)x:LiftiALiftiB:Ui+1. The codomain is transported along Lift-El when forming the right-hand product.

Cumulative membership changes typing, while explicit lifting changes syntax. We never assume both silently.

Example 74.13

Without lifting or cumulativity, X:U0XX does not receive the uniform closure derivation at level 1: the domain U0 lies in U1, but the fibre is obtained in U0. Explicit lifting uses X:U0Lift0(XX):U1. Cumulative membership instead raises XX by U-Cumul. The resulting surface types may look alike, but their derivations record different theories.

The fuss-free design replaces a proliferating family of lift naturality equations with a smallness calculus and proves its own equivalence and injectivity results [SS26]. Those results depend on that paper’s syntax and equations. Mugen implements displacement-algebra universe polymorphism and reports separate Agda and OCaml artifacts [FAM23]. We borrow neither metatheorem for the calculus fixed here.

A semantic boundary

Lemma 74.14 — Set interpretation of the universe rules

Assume ZFC with an increasing sequence of strongly inaccessible cardinals κ0<κ1<. Extend the raw-syntax interpretation of definition 28.12, definition 73.39 by [[Ui]]=Vκi and interpret every strict lift by the same set as its argument. Then every rule of definition 29.1 and the optional strict-lifting rules is sound. The same interpretation separately validates U-Cumul.

Proof of Lemma 74.14 — Set interpretation of the universe rules

Proof. The ordinary final rules are sound by lemma 28.14; it remains to inspect the universe-specific final rules. For every environment ρ, U-Form is valid because Vκi is a set. If j<i, then rank(Vκj)=κj<κi,VκjVκi, which is the U-Hier case. If [[A]]ρΓVκi, then that denotation is a set; transitivity of Vκi also keeps all its elements inside the stage. This proves U-El, while equality of two universe elements gives equality of the same two sets and proves U-El-Eq.

For the representative dependent-closure case, assume Aρ:=[[A]]ρΓVκi,Bρ,a:=[[B]](ρ,a)Γ,x:AVκi(aAρ). Strong inaccessibility makes Vκi closed under the indexed product, so [[x:AB]]ρΓ=aAρBρ,aVκi. This is U-Pi. The Σ-, W-, coproduct-, and nullary cases use the corresponding closure operation already defined in definition 73.39 (one line each).

A lift and its argument have literally the same set denotation. This proves Lift-El; closure at the next stage proves Lift-U, and applying the same set operation to equal denotations proves the congruence and commuting rules (one line for each constructor). Finally, the case i=j of U-Cumul is immediate. If i<j and AVκi, then rank(A)<κi<κj, hence AVκj. Because the interpretation is defined on raw expressions, the denotation of A is the same set whether a derivation uses it as a universe element or, by U-El, as a type. These cases extend the simultaneous induction of lemma 28.14. ◻

Theorem 74.15 — Relative consistency and separation

Under the hypotheses of lemma 74.14, the Russell hierarchy with the optional strict lifts has no closed term of 0 and does not derive ttff:2.

Proof of Theorem 74.15 — Relative consistency and separation

Proof. Soundness is lemma 74.14. A closed term of 0 would denote an element of the empty set, while the displayed Boolean equality would identify the distinct denotations 1 and 0. ◻

Theorem 29.14 — Disjointness of the booleans

If ttff:2 is derivable in the empty context, then there is a closed term of 0. Under the set-theoretic hypothesis of theorem 74.15, that equality judgment is not derivable.

Proof of Theorem 29.14 — Disjointness of the booleans

Proof. Define P(b):=If0(1,0,b):U0. Congruence sends an assumed equality of booleans to P(tt)P(ff):U0. Computation and U-El-Eq give 10 as types, so conversion sends :1 to a term of 0. The second assertion is the Boolean-separation clause of theorem 74.15. ◻

This is a relative model theorem under a strong set-theoretic hypothesis. It proves neither normalization nor decidability, and it does not assert that inaccessible cardinals are necessary for every finite fragment.

Exercise 29.1

★★☆ Derive X:U0U0:U1 and identify the level of every universe rule.

Exercise 29.2

★☆☆ Write and type the composition function polymorphic in three U0-small types. No level polymorphism is requested.

Exercise 29.4

★☆☆ Recover every context and type-formation presupposition of U-Pi from its two displayed universe-element premises.

Exercise 29.3

★★★ Let ΓA:Ui be derived in an arbitrary well-formed context using only U-Hier and the closure rules of definition 29.1. By induction on that derivation, construct A with ΓA:Ui+1andΓAA type, using explicit lifts. Mark every context conversion in a dependent rule.

Exercise 29.8

★★☆ Check that both sides of the strict Π-lifting equation inhabit Ui+1 in the same context.

Exercise 29.10

★★☆ Use explicit lifting to show that the polymorphic-identity type is U1-small.

Exercise 29.11

★☆☆ Define nonrecursive large case analysis on N by discarding the recursor’s recursive argument. Derive its zero and successor equations.

Exercise 29.12

★☆☆ Use a universe-valued discriminator to show that an equality between a closed left injection and a closed right injection entails a term of 0.

Exercise 29.9

★★★ Suppose i<j, ΓA:Ui, and Γ,x:AB:Ui. Define Liftij and prove ΓLiftijA:Uj,ΓLiftijAA type, and, after transporting the codomain to the lifted binder context, ΓLiftij(x:AB)x:LiftijALiftijB:Uj.

Exercise 29.13

★☆☆ Define Vec:U0NU0 by recursion into the universe and derive its zero and successor equations.

Exercise 29.14

★★☆ Construct r:n:NEqN(n,n) by induction.

Exercise 29.15

★★☆ Continue exercise 29.14. If suc(m)suc(n):N, convert the term r(m):EqN(m,m) constructed there to a term of EqN(m,n).

Exercise 74.13

★☆☆ Define G(0)N and G(suc(n))G(n)N by recursion into U0, then show n:NG(n):U0.

Exercise 74.14

★★☆ In the cumulative extension of section 74.4, take P={vu+1} as a constraint on external parameters. Normalize and solve u+1m, max(v+2,u)m, and vu+1. State whether the solution is principal and which hypothesis of proposition 74.10 you used.

Suggested first pass.

Begin with exercise 74.16: its paper calculation fixes the expected constraint graph. Then complete exercise 74.15 and compare the executable counterexample with that calculation.

Exercise 74.15

★★★ Practical project.universe-level-solver Run this chapter’s Kappa artifact on the satisfiable declaration from example 74.9 and the strict-cycle rejection. Add a case with three level variables and two maxima. Then replay the mutation that treats a strict edge as weak. Explain which mathematical obligation is tested and which part of proposition 74.10 remains a paper proof.

Exercise 74.16

★★☆ In the cumulative extension used by example 74.9, suppose Ai:Ui, Bj(a):Uj for a:Ai, and, for x:a:AiBj(a), suppose Ck(x):Uk and Dl(x,c):Ul for c:Ck(x). Calculate the least level of x:a:AiBj(a)c:Ck(x)Dl(x,c). Then add the constraint i+1i and exhibit the strict cycle.

Bibliographic notes

The universe pages of Martin-Löf’s predicative paper give the historical closure and hierarchy boundary [ML75]. Generalized level structures are developed by Kovács [Kov22]. The implementation comparison above is deliberately bounded to the displayed interfaces of the fuss-free and Mugen artifacts [SS26, FAM23]; their normalization or elaboration theorems are not imported into this chapter.

Search the book

Type to search the local edition.