# Type checking, universe polymorphism, and typical ambiguity in the calculus of constructions draft

## Abstract

The Generalized Calculus of Constructions (CC^{ω}) of Coquand and Huet is a system for formalizing constructive mathematics. CC^{ω} includes a cumulative hierarchy of universes, with each universe closed under the type forming operations. Universe hierarchies are tedious to use in practice. Russell and Whitehead introduced a convention for dealing with stratification, called “typical ambiguity”, in which universe levels are not explicitly mentioned, but it is tactily asserted that some correctly stratified level assignment exists. Using an “operational semantics” for type synthesis, we study type checking and typical ambiguity for CC^{ω}. We show type synthesis is effective in CC^{ω}. Even if explicit universe levels are erased from a term it is possible to compute a “schematic type” for that term, and a set of constraints, that characterize all types of all well-typed instances of the term. We also consider the extension with δ-reductions, which introduces a form of “universe polymorphism” induced by the failure of type unicity in CC^{ω}.

## Keywords

Operational Semantic Type Synthesis Concrete Syntax Schematic Term Valid Context## References

- [Bar84]H. P. Barendregt.
*The Lambda Calculus: Its Syntax and Semantics*, volume 103 of*Studies in Logic and the Foundations of Mathematics*. North-Holland, Amsterdam, revised edition, 1984.Google Scholar - [BL84]R. Burstall and Butler Lampson. A kernel language for abstract data types and modules. In G. Kahn, D. MacQueen, and G. Plotkin, editors,
*Semantics of Data Types*, volume 173 of*Lecture Notes in Computer Science*, pages 1–50. Springer-Verlag, 1984.Google Scholar - [Car]Luca Cardelli. Phase distinctions in type theory. unpublished manuscript.Google Scholar
- [Car86]Luca Cardelli. A polymorphic λ-calculus with Type:Type. Technical report, DEC SRC, 1986.Google Scholar
- [CDD+85]D. Clément, J. Despeyroux, T. Despeyroux, L. Hascoet, and G. Kahn. Natural semantics on the computer. Technical Report RR 416, INRIA, Sophia-Antipolis, France, June 1985.Google Scholar
- [CDDK86]D. Clément, J. Despeyroux, T. Despeyroux, and G. Kahn. A simple applicative language: Mini-ML. In
*Proceedings of the Conference on Lisp and Functional Programming*, 1986.Google Scholar - [CH85]Thierry Coquand and Gérard Huet. Constructions: a higher-order proof system for mechanizing mathematics. In B. Buchberger, editor,
*EUROCAL '85: European Conference on Computer Algebra*, volume 203 of*Lecture Notes in Computer Science*, pages 151–184. Springer-Verlag, 1985.Google Scholar - [Cha77]Tat-Hung Chan. An algorithm for checking PL/CV arithmetical inferences. Technical Report 77-236, Computer Science Department, University, Ithaca, New York, 1977.Google Scholar
- [Chu40]Alonzo Church. A formulation of the simple theory of types.
*Journal of Symbolic Logic*, 5:56–68, 1940.Google Scholar - [Con86]Robert L. Constable,
*et al. Implementing Mathematics with the NuPRL Proof Development System*. Prentice-Hall, Englewood Cliffs, NJ, 1986.Google Scholar - [Coq85]Thierry Coquand.
*Une théorie des constructions*. PhD thesis, Université Paris VII, January 1985.Google Scholar - [Coq86]Thierry Coquand. An analysis of Girard's paradox. In
*Proc. of the Symposium on Logic in Computer Science*, pages 227–236, Boston, June 1986.Google Scholar - [Coq88]Thierry Coquand. Private communication.Google Scholar
- [CZ82]Robert L. Constable and Daniel R. Zlatin. Report on the type theory (V3) of the programming logic PL/CV3. In
*Logics of Programs*, volume 131 of*Lecture Notes in Computer Science*. Springer-Verlag, 1982.Google Scholar - [CZ84]Robert L. Constable and Daniel R. Zlatin. The type theory of PL/CV3.
*ACM Transactions on Programming Languages and Systems*, 7(1):72–93, January 1984.Google Scholar - [Des84]T. Despeyroux. Executable specifications of static semantics. In G. Kahn, D. MacQueen, and G. Plotkin, editors,
*Semantics of Data Types*, volume 173 of*Lecture Notes in Computer Science*. Springer-Verlag, June 1984.Google Scholar - [DM82]Luis Damas and Robin Milner. Principal type schemes for functional programs. In
*Proceedings of the 9th ACM Symposium on the Principles of Programming Languages*, pages 207–212, 1982.Google Scholar - [Erh88]Thomas Erhard. A categorical semantics of Constructions. In
*Proceedings of the Third Annual Symposium on Logic in Computer Science*, pages 264–273, Edinburgh, July 1988.Google Scholar - [GdR88]Paola Giannini and Simona Ronchi della Rocca. Characterization of typings in polymorphic type discipline. In
*Proceedings of the Third Annual Symposium on Logic in Computer Science*, pages 61–71, July 1988.Google Scholar - [HH86]James G. Hook and Douglas Howe. Impredicative strong existential equivalent to Type:Type. Technical Report TR 86–760, Cornell University, Ithaca, New York, 1986.Google Scholar
- [HMT87]Robert Harper, Robin Milner, and Mads Tofte. A type discipline for program modules. In
*TAPSOFT '87*, volume 250 of*Lecture Notes in Computer Science*. Springer-Verlag, March 1987.Google Scholar - [HMT88]Robert Harper, Robin Milner, and Mads Tofte. The definition of Standard ML (version 2). Technical Report ECS-LFCS-88-62, Laboratory for the Foundations of Computer Science, Edinburgh University, August 1988.Google Scholar
- [How87]Douglas Howe. The computational behavior of Girard's paradox. In
*Proceedings of the Second Symposium on Logic in Computer Science*, pages 205–214, Ithaca, New York, June 1987.Google Scholar - [HP88]J. Martin E. Hyland and Andrew M. Pitts. The Theory of Constructions: categorical semantics and topos-theoretic models. In
*Proceedings of the Boulder Conference on Categories in Computer Science*, 1988. To appear.Google Scholar - [Hue87]Gérard Huet. Extending the Calculus of Constructions with Type:Type. unpublished manuscript, April 1987.Google Scholar
- [Luo88a]Zhaolui Luo. A higher-order calculus and theory abstraction. Technical Report ECS-LFCS-88-57, Laboratory for the Foundations of Computer Science, Edinburgh University, July 1988.Google Scholar
- [Luo88b]Zhaolui Luo.
_{∞}^{⊂}and its metatheory. Technical Report ECS-LFCS-88-58, Laboratory for the Foundations of Computer Science, Edinburgh University, July 1988.Google Scholar - [Mac86]David MacQueen. Using dependent types to express modular structure. In
*Proceedings of the 13th ACM Symposium on the Principles of Programming Languages*, 1986.Google Scholar - [Mar]Per Martin-Löf. A theory of types. Unpublished manuscript.Google Scholar
- [Mar73]Per Martin-Löf. An intuitionistic theory of types: predicative part. In H. E. Rose and J. C. Shepherdson, editors,
*Logic Colloquium, '73*, pages 73–118, Amsterdam, 1973. North-Holland.Google Scholar - [Mar82]Per Martin-Löf. Constructive mathematics and computer programming. In
*Sixth International Congress for Logic, Methodology, and Philosophy of Science*, pages 153–175, Amsterdam, 1982. North-Holland.Google Scholar - [Mar84]Per Martin-Löf.
*Intuitionistic Type Theory*, volume 1 of*Studies in Proof Theory*. Bibliopolis, Naples, 1984.Google Scholar - [MH88]John Mitchell and Robert Harper. The essence of ML. In
*Proceedings of the Fifteenth ACM Symposium on Principles of Programming Languages*, San Diego, California, January 1988.Google Scholar - [Mit84]John C. Mitchell. Type inference and type containment. In G. Kahn, D. MacQueen, and G. Plotkin, editors,
*Semantics of Data Types*, volume 173 of*Lecture Notes in Computer Science*, pages 257–278. Springer-Verlag, 1984.Google Scholar - [MP85]John C. Mitchell and Gordon Plotkin. Abstract types have existential type. In
*Proceedings of the 12th ACM Symposium on the Principles of Programming Languages*, 1985.Google Scholar - [MR86]Albert Meyer and Mark Reinhold. ‘Type’ is not a type: preliminary report. In
*Proceedings of the 13th ACM Symposium on the Principles of Programming Languages*, 1986.Google Scholar - [Pol88]Robert Pollack. The theory of lego. Technical report, Laboratory for the Foundations of Computer Science, Edinburgh University, 1988. To appear.Google Scholar
- [Rus08]Bertrand Russell. Mathematical logic as based on a theory of types.
*American Journal of Mathematics*, 30:222–262, 1908.Google Scholar - [vD80]Diedrik T. van Daalen.
*The Language Theory of AUTOMATH*. PhD thesis, Technical University of Eindhoven, Eindhoven, Netherlands, 1980.Google Scholar - [WR25]Alfred North Whitehead and Bertrand Russell.
*Principia Mathematica, Volume 1*. Cambridge University Press, Cambridge, 1925.Google Scholar