Universe Polymorphism in Coq
Universes are used in Type Theory to ensure consistency by checking that definitions are well-stratified according to a certain hierarchy. In the case of the Coq proof assistant, based on the predicative Calculus of Inductive Constructions (pCIC), this hierachy is built from an impredicative sort Prop and an infinite number of predicative Type i universes. A cumulativity relation represents the inclusion order of universes in the core theory. Originally, universes were thought to be floating levels, and definitions to implicitely constrain these levels in a consistent manner. This works well for most theories, however the globality of levels and constraints precludes generic constructions on universes that could work at different levels. Universe polymorphism extends this setup by adding local bindings of universes and constraints, supporting generic definitions over universes, reusable at different levels. This provides the same kind of code reuse facilities as ML-style parametric polymorphism. However, the structure and hierarchy of universes is more complex than bare polymorphic type variables. In this paper, we introduce a conservative extension of pCIC supporting universe polymorphism and treating its whole hierarchy. This new design supports typical ambiguity and implicit polymorphic generalization at the same time, keeping it mostly transparent to the user. Benchmarking the implementation as an extension of the Coq proof assistant on real-world examples gives encouraging results.
KeywordsUniverse Variable Typing Judgment Inductive Construction Intermediate Language Existential Variable
Unable to display preview. Download preview PDF.
- 1.Coquand, T.: An analysis of Girard’s Paradox. In: Proceedings of the First Symposium on Logic in Computer Science, HC, vol. 145. IEEE Comp. Soc. Press (June 1986)Google Scholar
- 2.The Univalent Foundations Program: Homotopy Type Theory: Univalent Foundations for Mathematics, Institute for Advanced Study (2013)Google Scholar
- 3.The Coq development team: Coq 8.2 Reference Manual. INRIA (2008)Google Scholar
- 4.Herbelin, H.: Type Inference with Algebraic Universes in the Calculus of Inductive Constructions (2005) (manuscript)Google Scholar
- 5.Chan, T.H.: Appendix D. In: An Introduction to the PL/CV2 Programming Logic. LNCS, vol. 135, pp. 227–264. Springer (1982), http://dx.doi.org/10.1007/3-540-11492-0
- 6.Luo, Z.: An Extended Calculus of Constructions. PhD thesis, Department of Computer Science, University of Edinburgh (June 1990)Google Scholar
- 12.Lee, G., Werner, B.: Proof-irrelevant model of CC with predicative induction and judgmental equality. Logical Methods in Computer Science 7(4) (2011)Google Scholar
- 13.Herbelin, H., Spiwack, A.: The Rooster and the Syntactic Bracket. CoRR abs/1309.5767 (2013)Google Scholar