Skip to main content Accessibility help
×
Home

Type classes for mathematics in type theory

  • BAS SPITTERS (a1) and EELIS VAN DER WEEGEN (a1)

Abstract

The introduction of first-class type classes in the Coq system calls for a re-examination of the basic interfaces used for mathematical formalisation in type theory. We present a new set of type classes for mathematics and take full advantage of their unique features to make practical a particularly flexible approach that was formerly thought to be unfeasible. Thus, we address traditional proof engineering challenges as well as new ones resulting from our ambition to build upon this development a library of constructive analysis in which any abstraction penalties inhibiting efficient computation are reduced to a minimum.

The basis of our development consists of type classes representing a standard algebraic hierarchy, as well as portions of category theory and universal algebra. On this foundation, we build a set of mathematically sound abstract interfaces for different kinds of numbers, succinctly expressed using categorical language and universal algebra constructions. Strategic use of type classes lets us support these high-level theory-friendly definitions, while still enabling efficient implementations unhindered by gratuitous indirection, conversion or projection.

Algebra thrives on the interplay between syntax and semantics. The Prolog-like abilities of type class instance resolution allow us to conveniently define a quote function, thus facilitating the use of reflective techniques.

Copyright

References

Hide All
Armand, M., Grégoire, B., Spiwack, A. and Théry, L. (2010) Extending Coq with imperative features and its application to SAT verification. In: Kaufmann, M. and Paulson, L. (eds.) Proceedings, Interactive Theorem Proving, ITP 2010. Springer-Verlag Lecture Notes in Computer Science 61728398.
Asperti, A., Ricciotti, W., Sacerdoti Coen, C. and Tassi, E. (2009) Hints in unification. In: Berghofer, S., Nipkow, T., Urban, C. and Wenzel, M. (eds.) Theorem Proving in Higher Order Logics, 22nd International Conference (TPHOLs 2009). Springer-Verlag Lecture Notes in Computer Science 56748498.
Asperti, A., Sacerdoti Coen, C., Tassi, E. and Zacchiroli, S. (2007) User interaction with the Matita proof assistant. Journal of Automated Reasoning 39 (2)109139.
Barthe, G., Capretta, V. and Pons, O. (2003) Setoids in type theory. Journal of Functional Programming 13 (2)261293. (Special issue on ‘Logical frameworks and metalanguages’.)
Bertot, Y. and Castéran, P. (2004) Interactive Theorem Proving and Program Development. Coq'Art: The Calculus of Inductive Constructions, Texts in Theoretical Computer Science, Springer-Verlag.
Bishop, E. A. (1967) Foundations of constructive analysis, McGraw-Hill.
Boldo, S., Filliâtre, J. and Melquiond, G. (2009) Combining Coq and Gappa for Certifying Floating-Point Programs. In: Carette, J., Dixon, L., Coen, C. and Watt, S. (eds.) Intelligent Computer Mathematics: Proceedings of the 16th Symposium, Calculemus 2009, held as Part of CICM 2009. Springer-Verlag Lecture Notes in Computer Science 56255974.
Brus, T. H., van Eekelen, C. J. D., van Leer, M. O. and Plasmeijer, M. J. (1987) Clean – A language for functional graph rewriting. In: Kahn, G. (ed.) Functional programming languages and computer architecture. Springer-Verlag Lecture Notes in Computer Science 274364384.
Capretta, V. (1999) Universal algebra in type theory. In: Bertot, Y., Dowek, G., Hirschowitz, A., Paulin, C. and Théry, L. (eds.) Theorem Proving in Higher Order Logics (TPHOLs 1999) Springer-Verlag Lecture Notes in Computer Science 1690131148.
Cartmell, J. (1978) Generalized algebraic theories and contextual categories, Ph.D. thesis, University of Oxford.
Coq Development Team (2008) The Coq Proof Assistant Reference Manual, INRIA-Rocquencourt.
Coquand, T. and Huet, G. (1988) The calculus of constructions. Information and Computation 76 (2–3)95120.
Coquand, T. and Paulin, C. (1990) Inductively defined types. In: Martin-Löf, P. and Mints, G. (eds.) COLOG-88. Springer-Verlag Lecture Notes in Computer Science 4175066.
Cruz-Filipe, L., Geuvers, H. and Wiedijk, F. (2004) C-CoRN, the Constructive Coq Repository at Nijmegen. In: Asperti, A., Bancerek, G. and Trybulec, A. (eds.) Proceedings of MKM2004. Springer-Verlag Lecture Notes in Computer Science 311988103.
Domınguez, C. (2008) Formalizing in Coq Hidden Algebras to Specify Symbolic Computation Systems. In: Autexier, S. et al. . (eds.) Intelligent Computer Mathematics: Proceedings 9th International Conference, AISC 2008. Springer-Verlag Lecture Notes in Computer Science 5144270284.
Garillot, F., Gonthier, G., Mahboubi, A. and Rideau, L. (2009) Packaging mathematical structures. In: Berghofer, S., Nipkow, T., Urban, C. and Wenzel, M. (eds.) Theorem Proving in Higher Order Logics, 22nd International Conference (TPHOLs 2009). Springer-Verlag Lecture Notes in Computer Science 5674327342.
Geuvers, H., Pollack, R., Wiedijk, F. and Zwanenburg, J. (2002) A constructive algebraic hierarchy in Coq. Journal of Symbolic Computation 34 (4)271286.
Haftmann, F. and Wenzel, M. (2008) Local theory specifications in Isabelle/Isar. In: Berardi, S., Damiani, F. and de'Liguoro, U. (eds.) Types for Proofs and Programs International Conference, TYPES 2008. Springer-Verlag Lecture Notes in Computer Science 5497153168.
Hofmann, M. (1997) Extensional constructs in intensional type theory, CPHC/BCS Distinguished Dissertations, Springer-Verlag.
Huet, G. and Saibi, A. (1995) Constructive category theory. In: Proceedings of the Joint CLICS-TYPES Workshop on Categories and Type Theory, Göteborg.
Jenks, R., Sutor, R. and Morrison, S. (1992) AXIOM: the scientific computation system, Springer-Verlag.
Mac Lane, S. (1998) Categories for the working mathematician, Springer-Verlag.
Martin-Löf, P. (1982) Constructive mathematics and computer programming. In: Cohen, L. J., Los, J., Pfeiffer, H. and Podewski, K.-P. (eds.) Logic, methodology and philosophy of science, VI, Studies in Logic and the Foundations of Mathematics, North-Holland 104 153175.
Martin-Löf, P. (1998) An intuitionistic theory of types. In: Twenty-five years of constructive type theory, Oxford Logic Guides 36, Oxford University Press 127172.
Meinke, K. and Tucker, J. (1993) Universal algebra. In: Abramsky, S., Gabbay, D. and Maibaum, T. (eds.) Handbook of logic in computer science (volume 1), Oxford University Press 189411.
O'Connor, R. (2008) Certified exact transcendental real number computation in Coq. Mohamed, O. A., Muñoz, C. and Tahar, S. (eds.) Proceedings of the 21st International Conference on Theorem Proving in Higher Order Logics (TPHOLs 2008). Springer-Verlag Lecture Notes in Computer Science 5170246261.
O'Connor, R. and Spitters, B. (2010) A computer verified, monadic, functional implementation of the integral. Theoretical Computer Science 411 (37)33863402.
Palmgren, E. (2009) Constructivist and Structuralist Foundations: Bishops and Lawveres Theories of Sets. Technical Report 4.
Palmgren, E. and Vickers, S. (2007) Partial Horn logic and cartesian categories. Annals of Pure and Applied Logic 145 (3)314353.
Pitts, A. (2001) Categorical logic. Handbook of Logic in Computer Science: Logic and algebraic methods (volume 5), Oxford University Press 39123.
Pollack, R. (2002) Dependently typed records in type theory. Formal Aspects of Computing 13 386402.
Sacerdoti Coen, C. and Tassi, E. (2008) Working with mathematical structures in type theory. In: Miculan, M., Scagnetto, I. and Honsell, F. (eds.) Types for Proofs and Programs. Springer-Verlag Lecture Notes in Computer Science 4941157172.
Santas, P. (1995) A type system for computer algebra. Journal of Symbolic Computation 19 (1–3)79109.
Sozeau, M. (2009) A new look at generalized rewriting in type theory. Journal of Formalized Reasoning 2 (1)4162.
Sozeau, M. and Oury, N. (2008) First-class type classes. In: Mohamed, O. A., Muñoz, C. and Tahar, S. (eds.) Proceedings of the 21st International Conference on Theorem Proving in Higher Order Logics (TPHOLs 2008). Springer-Verlag Lecture Notes in Computer Science 5170278293.
Wadler, P. and Blott, S. (1989) How to make ad-hoc polymorphism less ad hoc. In: Proceedings of the 16th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, ACM 6076.
Weber, A. and Klaeren, H. (1993) Type systems for computer algebra. Relation 10 (1.54) 2615.
Zumkeller, R. (2008) Global Optimization in Type Theory, Ph.D. thesis, École Polytechnique, Paris.

Related content

Powered by UNSILO

Type classes for mathematics in type theory

  • BAS SPITTERS (a1) and EELIS VAN DER WEEGEN (a1)

Metrics

Full text views

Total number of HTML views: 0
Total number of PDF views: 0 *
Loading metrics...

Abstract views

Total abstract views: 0 *
Loading metrics...

* Views captured on Cambridge Core between <date>. This data will be updated every 24 hours.

Usage data cannot currently be displayed.