Appendix D
Proof of Consistency
Chapter 14 states that the core system is consistent: no closed term has type (Theorem 14.5). This appendix gives the full proof, including the standard facts about typing and conversion that the argument uses. It concerns the core system: the rules of Figure 3.1 with the universes of Chapter 13, without the constants of Part II.
The idea
The proof combines a deep theorem with an elementary argument. The deep theorem is strong normalization: every well-typed term reduces to a normal form. Together with subject reduction, it means that if any closed term had type , a normal closed term would too. The elementary argument is a case analysis showing that no normal closed term can have that type.
The case analysis runs in two rounds. First, the normal form must be a , because nothing else closed and normal can have a type. Second, its body must be a term of type in the context , and no normal term can be, because the only variable in scope has type , which is neither nor a function type.
To make the case analysis rigorous, we need to know what the type of a term of each shape looks like (the generation lemma), and that terms of different shapes are never convertible (a consequence of confluence). Those facts are collected first.
Facts about the type system
Besides subject reduction and strong normalization from Chapter 14, the proof uses the following standard properties of Pure Type Systems [Barendregt 1992]. Subject reduction extends from one step to any number of steps by induction on the number of steps.
Lemma D.1 (Standard properties).
(a) Generation. If , then, depending on the shape of :
- if , then and for some ;
- if , then ;
- if , then for some ;
- if , then and for some ;
- if , then and for some , , and .
(b) Confluence. If , then and reduce to a common term. Consequently: implies and for a fresh ; and no two of a variable, a universe, and a are convertible.
(c) Substitution. If , then .
Generation is the typing rules read backwards: it says that the only way to type a term of a given shape is the rule for that shape, possibly followed by uses of T-Conv. That is why each case says "" rather than "".
The consequences in (b) hold because a variable and a universe do not reduce at all, a reduces only to a (reduction happens inside its annotation or body, never at its root), and two terms with a common reduct must therefore have the same outermost shape.
Shapes of normal terms
Recall from Chapter 12 that every term is a spine whose head is not an application. The next lemma classifies normal terms by their head. Its role is to leave only four possibilities for the normal form in the main proof, each of which can then be ruled out.
Lemma D.2 (Normal forms). Let be a normal term with . Then is a universe, a , a , or a neutral term with whose head is a variable in . And if , then for some that is convertible to a .
Write with not an application.
If , then is a universe, a , a , or a variable, since those are the only shapes other than application. A variable is in by generation.
Let . Applying the generation lemma for application times, from the outside in, shows that every prefix is typable, and in particular, from the innermost application , that for some , , and . Now consider the shape of . It is not a , since would then be a -redex inside the normal term . It is not a universe or a either: by generation, its type would be convertible to a universe, and by confluence a universe is not convertible to . So is a variable , which is in by generation, and , which is the required .
Proof of Theorem 14.5
Theorem 14.5 (Consistency). There is no closed term with .
Suppose that . By strong normalization, reduces to a normal term , and by subject reduction, . We show that no such exists, using Lemma D.2 twice.
The normal form is a . By Lemma D.2, is a universe, a , a , or a neutral term.
- It is not neutral, because its head would be a variable in the empty context, and there is none.
- It is not a universe or a , because generation would make convertible to a universe, which confluence rules out.
So . By generation, and for some . By confluence, and for a fresh , that is, . Substituting for on both sides, which preserves convertibility by part (c) of Lemma D.1, gives . The body is normal, because it is a subterm of the normal term . In short: with and .
The body cannot exist. Let . By Lemma D.2, is a universe, a , a , or a neutral term.
- If is a universe or a , generation makes convertible to a universe; if is a , it makes convertible to a . But , and by confluence a variable is convertible to neither.
- If is neutral, its head is a variable in , so . If , then , and generation gives . Then , but a variable is not convertible to a universe. If , Lemma D.2 gives with convertible to a , and generation for the variable gives . Then a is convertible to a universe, which confluence rules out.
Every case leads to a contradiction, so no closed term has type .
In words: the only variable available inside the is , whose type is . It can neither be returned, since is not , nor be applied to anything, since is not a function type. Every other normal term has a universe or a as its type, and is neither. The argument relies on strong normalization to reduce the question to normal terms; that step is where all the difficulty lies.
What to remember
- Consistency is proved by combining strong normalization and subject reduction (to pass to a normal form) with a case analysis on the shape of normal terms.
- The case analysis uses two standard facts: generation (the typing rules read backwards) and confluence (terms of different outermost shapes are never convertible).
- A normal closed term of type would have to be a whose body has type in the context , and no normal term does.
- The hard part is strong normalization; the shape analysis alone also applies to , and shows that Hurkens' term has no normal form.