Question: Does the sum of all types contain itself? Tricky question. In most (simpler) type theories sum types need to be finite, therefore the sum of all types, meaning a T T ∈Type simply does not exist, but assuming for a second, it does exist. One observation one can make up front is, that the sum of all types is isomorph to the type of all types. T ∼ a = Type T ∈Type What does contain mean? One useful view of type theory is interpreting types as sets of inhabitants. A type T contains another type T 0 , iff T 0 ⊆ T in the simplified set view, so if every term t with type T 0 is does also have type T 0 . This correlates nicely to the notion of subtyping. The question could now be stated as: Type ⊆ Type This is trivially true. Another interpretation of contain can be, Is the sum of all types an inhabitant of the sum of all types?. So in the set view that would be: Type ∈ Type In ZFCSet theory this can not happen (to avoid Russell’s Paradox ). Moving over to type theory. If this would be true, it would imply that a type would have a type itself. This is actually possible in more advanced type theories, like for example the type theory of Coq. Here there exists the type Type. It’s inhabitants are (almost) all types1 . For example the following is true: True has the type Bool and Bool has the type Type. So we can assign Types to Types. So the question boils down to: Is Type : Type. This would indeed lead to a situation very close to Russell’s Paradox, named Girad’s Paradox. Coq solves the problem by having a hirachy of Types. Meaning True : Bool : Type : Type1 : Type2 : . . .. In this case Type does not contain itself, and so does the sum of all types. Note: Sharp readers could argue, that in the presence of Type2 etc. , the type Type does not contain all types. And that is true, because it cannot without drifting into Girad’s Paradox. Note: Even more sharp readers could argue, that paradoxes are no problem, since type systems in the presence of unbounded recursion are not consistent. This is true. No further comment. 1 This is not completely correct, there is a difference between Set, Prop and Type, but that is not relevant at this point 1
Enter the password to open this PDF file:











