natural deduction metalanguage, practical foundations
type theory (dependent, intensional, observational type theory, homotopy type theory)
computational trinitarianism =
propositions as types +programs as proofs +relation type theory/category theory
Traditionally, there are two different ways to present dependent type theory:
One can present dependent type theory with a hierarchy of type universes such that every type is a term of a universe of the hierarchy. Examples of such dependent type theories include the one found in the HoTT book and the proof assistants Agda, Coq, Lean, and its variants like Cubical Agda.
Alternatively, one can present dependent type theory with a separate type judgment and no type universes at all. Examples of such dependent type theories include the one found in Egbert Rijke‘s Introduction to Homotopy Type Theory.
In the first presentation of dependent type theory, the concept of a “type variable” exists: since types are terms of universes, type variables are term variables where the context is extended by a free variable of a universe.
In the second presentation of dependent type theory, the theory does not come with the concept of a type variable, since the context can only be extended by term judgments, and not type judgments. While this is sufficient to define univalent universes and higher inductive types in the type theory, there are a few reasons why one might want to extend dependent type theory with type variables:
One wants a polymorphic dependent type theory.
Large recursion principles of inductive types and higher inductive types are principles where given some existing data one can construct a type family indexed by the inductive type . (In the other formulation, large recursion principles are just the usual recursion principles for functions into a type universe .) While the large recursion principles of certain non-recursive inductive types and higher inductive types, such as the boolean domain, the circle type, and graph quotients, can be defined without type variables, the large recursion principles of recursive inductive types and higher inductive types, such as the natural numbers type and W-types, require type variables in the theory.
With type variables, one can define identity types between types and . This has a few benefits:
With identity types between types, it is possible to define the univalence axiom and thus make the type theory a univalent type theory without requiring universes in the type theory. This is important since the univalence axiom implies the large recursion principles discussed in the previous point.
In a dependent type theory without judgmental equality, such as objective type theory, it is cumbersome to define or explicitly convert types in terms of other types, since one has to equip each definition or explicit conversion with the structure of an equivalence of types. With identity types between types, one can simply make use of an identification between types to represent definitional equality or explicit conversion.
The same goes with the weak large recursion principles: in the absence of either judgmental equality or identity types between types, the computation rules associated with large recursion principles state that one can construct an equivalence of types between certain types given in the elimination rules of the large recursion principles. With identity types between types, one can simply make use of an identification between types.
The concept of impredicative polymorphism can be implemented as applying to the entire type theory, rather than to a single universe.
Dependent type theory with type variables is thus similar to System F, which is a non-dependent polymorphic lambda calculus with type variables.
We assume dependent type theory with context judgments , type judgments , and term judgments and the usual context-creating rules and structural rules for the dependent type theory.
To extend the above theory with type variables, we add the following rule
which states that it is possible to extend the context by a type judgment, and the following rule
which states that we may derive a type judgment if the type judgment is already in the context.
It is conjectured in the Category Theory Zulip that the substitution rules and weakening rules for type variables are admissible rules.
If the type theory has additional judgments and for judgmental equality of terms and judgmental equality of types respectively and the associated structural rules for judgmental equality, then the corresponding rules for judgmental equality involving type variables (i.e. substitution is a congruence, variable conversion, etc) should also be admissible rules.
In the presentation of dependent type theory using a hierarchy of universes, impredicative polymorphism is a resizing axiom which says that for all endofunctions on the first type universe , the dependent product type is (essentially) -small.
In the presentation of dependent type theory without universes but with a separate type judgment, while there is no universe to quantify over for the dependent product type, using the type variable we can add an untyped version of the dependent product type to the type theory. This type is similar to universal quantification in untyped first-order logic, and plays the same role in this presentation of dependent type theory that the type does for the other presentation of dependnet type theory. The rules for are as follows:
Formation rule:
Introduction rule:
Elimination rule:
Computation rules:
Uniqueness rules:
Type variables allow for the formation of identity types between types.
If the dependent type theory has impredicative polymorphism, then the contexts can be removed from the elimination and computation rules of the identity types between types, simplifying the rules down to the following:
There are many consequences of having identity types between types in the dependent type theory, such as the univalence axiom, a version of large recursion principles for inductive types and higher inductive types which uses identity types between types instead of equivalence types, and a new kind of Tarski universes.
The univalence axiom states that the function
inductively defined by
is an equivalence of types for all types and ,
where is the identity function on the type . In impredicative polymorphism, this is given by the following axiom:
Unlike the other presentation of dependent type theory in terms of universes, in this presentation of dependent type theory with a type judgment and type variables, it is consistent to assume both the univalence axiom and an axiom of set truncation like UIP or axiom K, since here there is no universe.
In the usual dependent type theory without type variables, large recursion of inductive types and higher inductive types is usually expressed in terms of equivalences and transport. For example, the strict large recursion principle of the circle type usually states that given a type and an autoequivalence , one can form the type family such that
However, with type variables, instead of using equivalences and transport, one can instead use identity types between types and the action on identifications for type families. For example, an alternative strict large recursion principle of the circle type states that given a type and an identification , one can form the type family such that
In addition, traditionally without type variables, there are strict and weak versions of large recursion principles: the strict large recursion principles use judgmental equality between types for the computation and uniqueness rules, while the weak large recursion principles use equivalences of types for the computation and uniqueness rules. For example, the strict large recursion principle for the boolean domain says that given types and , one can construct a type family such that
and the weak large recursion principle for the boolean domain says that the type family above comes with equivalences of types
However, with type variables and identity types between types, one can also use identifications of types instead of equivalences of types to express weak large recursion of the boolean domain:
This third notion of weak large recursion in dependent type theory with a single type judgment and type variables parallels the usual notion of weak large recursion in the other formulation of dependent type theory involving a hierarchy of universes, where large recursion simply means the usual recursion principle into one of the predefined universes in the hierarchy.
Similarly to the case for the large recursion principles, there are now three different notions of Tarski universes in dependent type theory with type variables and identity types between types.
There is the usual notion of strict Tarski universe which states that, for example,
the Tarski universe is strictly closed under dependent sum types if for and there is with a judgmental equality
the Tarski universe is strictly closed under dependent product types if for and there is with a judgmental equality
There is the usual notion of weak Tarski universe which states that, for example,
the Tarski universe is weakly closed under dependent sum types if for and there is with an equivalence
the Tarski universe is weakly closed under dependent product types if for and there is with an equivalence
Then there is a stronger notion of weak Tarski universe which is only possible if there are identity types between types, which states that
the Tarski universe is weakly closed under dependent sum types if for and there is with an identification
the Tarski universe is weakly closed under dependent product types if for and there is with an identification
This is similar to the case for Tarski universes in the presentation of dependent type theory with a hierarchy of universes, which also has three different kinds of Tarski universes involving judgmental equality, identity types between types, and equivalences of types respectively.
Independently of the consequences of having identity types between types, having type variables allows for the formulation of certain large recursion principles which are not possible in the dependent type theory with a single type judgment but no type variables. These include large recursion for recursive inductive types and recursive higher inductive types such as the natural numbers type, W-types, and localizations of a type.
For example, the usual recursion principle for the natural numbers type is given by the following: given
a type
an element
a family of elements
one can construct a family of elements
such that
and
In the other formulation of dependent type theory in terms of a hierarchy of universes and no type judgment, large recursion of the natural numbers is simply the recursion principle for a universe in the hierarchy: given
a universe
an type
a family of elements
one can construct a family of elements
such that
and
However, in dependent type theory with a single type judgment, the universe is not needed and in fact non-existent. Translating the large recursion principle into type judgments, we get the following: given
a type
a family of types
one can construct a family of types
such that
and
It is clear that type variables are needed, since otherwise the second requirement in the large recursion principle that we have a family of types will not be possible.
Similar requirements of type variables apply to the large recursion principles of more general recursive inductive types like W-types.
So far we have described in this article the various things we can do in dependent type theory with a single judgment if we extend the theory with type variables. However, there are still a few limitations if we do not have universes in the type theory.
The first limitation comes from structured types and the structure identity principle. Traditionally this was said to be a consequence of the univalence axiom, but we can add the univalence axiom to the type theory but still not be able to formulate the structure identity principle for various structured types. Traditionally, the type of structured types is a dependent sum type, over a type family of structures indeed by a type universe . The issue is twofold: first of all, we don’t have universes, so the usual dependent sum type is not able to be defined.
The lack of universes can be circumvented by attempting to define an untyped version of the dependent sum type, in the same way that impredicative polymorphism is defined using an untyped version of the dependent product type . However, this runs into the second issue: having an untyped version of the dependent sum type which is a dependent sum type for type variables leads to Girard's paradox. To see this is the case, take each to be a contractible type family. Then is a type of all types, since the dependent sum of a contractible family of types is always equivalent to the index type, and the index type of the untyped is the type which contains all types. As a result, it is impossible to construct for arbitrary in the first place due to Girard’s paradox.
The structure identity principle is specifically about characterising the identity type of the type of structured types in terms of structure-preserving equivalences. Since cannot be formed without trivialising the theory, the structure identity principle cannot be formulated without universes , where we are then talking about only -small structured types.
Another limitation is in proving the typal congruence rules. Traditionally, with universes, the typal congruence rules for dependent product types or dependent sum types state that given an identification between types and a heterogeneous identification , one can construct an identification
or
via the action on identifications.
However, without universes and function types into universes, we cannot compare type families by equality. As a result, the various typal congruence rules involving identity types between types cannot be directly stated using identifications and heterogeneous identifications, even when using identity types between types. Instead, we have to use transport or the inductively defined function to convert the identification to an equivalence , and then we can state that given a homotopy , one can construct an identification
or
Since homotopies are not identifications, we cannot use the action on identifications, and the proof of the typal congruence rule becomes a lot more complicated.
Some discussion about extending dependent type theory with type variables occurs in:
Last revised on December 17, 2024 at 17:28:45. See the history of this page for a list of all contributions to it.