Appendix C
Hurkens' Paradox
Chapter 13 claimed that a single universe containing itself makes the type theory inconsistent: there is a closed term of type , a proof of everything. This appendix gives that term in full, explains the idea behind it, and shows exactly where the rule is used, so that you can see why the universe hierarchy blocks it.
The setting
Throughout this appendix the universes of the kernel are replaced by one universe with the two rules
in place of T-Sort and T-Pi. Everything else, including T-Lam, T-App, T-Conv, substitution, and -reduction, is unchanged. The goal is a closed term with
Such a term proves every proposition , because .
The construction is due to Girard, who adapted the Burali-Forti paradox of set theory to the type theory with [Girard 1972]. The term below is Hurkens' simplification [Hurkens 1995], which fits on one page and uses nothing beyond , , and application.
Power sets in type theory
Read a function as a predicate on , or equivalently as a subset of : the elements for which has a proof are the members. The type of all such predicates is the power set of :
Applying this twice, is the type of families of subsets of .
In set theory, Cantor's theorem says that no set contains a copy of its own power set, let alone of its double power set: is always strictly larger than . The paradox is built on a type that violates this. It contains a copy of , with a function that packs a family of subsets of into a single element of , and a function that unpacks it again. The type
achieves this by quantifying over all of . For to be a member of while quantifying over is exactly what permits and the hierarchy of Chapter 13 forbids.
The term
The following abbreviations are expanded in place; the kernel sees only , , variables, and application. We write for .
With these abbreviations, the term of type is
The shape is an application: a binding , applied (on the last line) to an argument of the type that expects. Inside, is applied to two arguments, and a proof about , and the result is applied to one more argument. Everything is explained below.
How the term works
Packing and unpacking. The two functions and are inverse enough for the argument. Unfolding the definitions and -reducing gives, for every and ,
This equation is used by the kernel through T-Conv at several points in ; it is a computation, not an axiom.
An ordering on . Read as "the predicate holds of everything below ". This gives something like an order, and lets us say two things about predicates and elements.
- A predicate is inductive if whenever it holds of everything below , it holds of : that is, .
- An element is well-founded if every inductive predicate holds of : that is, .
The element is built to play the part of "the collection of all well-founded elements": it packs the family consisting of all inductive predicates. In Burali-Forti's paradox this is the set of all ordinals, which is itself an ordinal, hence a member of itself, hence not well-founded although all ordinals are.
The three ingredients. Reading from the bottom up:
- The last line, , proves that is well-founded. Its type is , which is the type of . So stands for " is well-founded".
- The predicate says " is not below itself" (strictly, it speaks of , which behaves like by the equation above). The second argument of , the long beginning , proves that is inductive. Hence , that is, is not below itself.
- The remaining argument, , proves that is below itself, by applying the well-foundedness of to a predicate transformed through the packing equation.
Since is the negation of " is below itself", applying the result of step 2 to the result of step 3 yields a term of type .
Where Type : Type is used
Every typing step in is ordinary except one. In , the variable is applied to the type itself. The type of begins , so T-App requires . But is a type that quantifies over , and in a system with a universe hierarchy such a type lives one level above the universe it quantifies over:
With the T-Pi rule of Chapter 13, is in at best, never in , so is ill typed and cannot be written. The whole construction collapses at this one application. Impredicativity of does not reopen the door: has body , whose result is a function type into a universe and therefore is not a proposition, so does not place in . Coquand showed that one impredicative universe at the bottom is consistent [Coquand 1988]; Hurkens' term shows that two impredicative levels are already too many [Hurkens 1995].
Reproducing it with the kernel
You can watch the kernel accept and reject this term. The only rule to change is T-Sort, implemented by the Term::Sort(u) case of infer in src/typecheck.rs:
// T-Sort, as shipped: every universe lives in the next one.
Term::Sort(u) => Ok(Term::Sort(u.checked_add(1).ok_or("universe overflow")?)),
Replace the right-hand side by Ok(Term::Sort(*u)), so that , and use as throughout. Nothing else needs to change: with every type in , the T-Pi rule with already assigns to every type, which is the second rule of this appendix. With that one-line change, infer returns exactly for . The unmodified kernel rejects the term with a type mismatch at the application inside , as predicted above.
Why there is no normal form
Chapter 14 proves consistency of the real system by showing that no normal closed term has type . The part of that proof that analyses the shapes of normal terms does not use strong normalization and goes through unchanged for . So if had a normal form, that normal form would be a closed normal term of type , which cannot exist. Subject reduction still holds, so reduction cannot escape the type either. The only remaining possibility is that reduces forever: strong normalization fails, and with it the termination of the type checker. Girard's paradox is therefore not only a logical defect but a computational one, and it is the reason the design of universes in Chapter 13 matters for the algorithm as much as for the logic.
What to remember
- With , the type quantifies over all types while being one of them, so it contains a copy of its own double power set, which no set can do.
- Hurkens' term turns this into Burali-Forti's paradox: , the packed family of all inductive predicates, is both well-founded and below itself.
- The rule is used in exactly one place, the application in ; a universe hierarchy makes that application ill typed.
- The term has no normal form, so the paradox breaks termination of the kernel as well as consistency.