Experience Implementing a Performant Category-Theory Library in Coq

  • Jason Gross
  • Adam Chlipala
  • David I. Spivak
Part of the Lecture Notes in Computer Science book series (LNCS, volume 8558)

Abstract

We describe our experience implementing a broad category-theory library in Coq. Category theory and computational performance are not usually mentioned in the same breath, but we have needed substantial engineering effort to teach Coq to cope with large categorical constructions without slowing proof script processing unacceptably. In this paper, we share the lessons we have learned about how to represent very abstract mathematical objects and arguments in Coq and how future proof assistants might be designed to better support such reasoning. One particular encoding trick to which we draw attention allows category-theoretic arguments involving duality to be internalized in Coq’s logic with definitional equality. Ours may be the largest Coq development to date that uses the relatively new Coq version developed by homotopy type theorists, and we reflect on which new features were especially helpful.

Keywords

Coq category theory homotopy type theory duality performance 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Ahrens, B., Kapulkin, C., Shulman, M.: Univalent categories and the Rezk completion. In: ArXiv e-prints (March 2013)Google Scholar
  2. 2.
    Awodey, S.: Category theory, 2nd edn. Oxford University PressGoogle Scholar
  3. 3.
    Barras, B., Bernardo, B.: The implicit calculus of constructions as a programming language with dependent types. In: Amadio, R.M. (ed.) FOSSACS 2008. LNCS, vol. 4962, pp. 365–379. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  4. 4.
    Bertot, Y.: Private Inductive Types: Proposing a language extension (April 2013), http://coq.inria.fr/files/coq5_submission_3.pdf
  5. 5.
    Bishop, E.: Foundations of Constructive Analysis. McGraw-Hill series in higher mathematics. McGraw-Hill (1967)Google Scholar
  6. 6.
    Formalizations of category theory in proof assistants. MathOverflow, http://mathoverflow.net/questions/152497/formalizations-of-category-theory-in-proof-assistants
  7. 7.
    Garillot, F., Gonthier, G., Mahboubi, A., Rideau, L.: Packaging Mathematical Structures. In: Berghofer, S., Nipkow, T., Urban, C., Wenzel, M. (eds.) TPHOLs 2009. LNCS, vol. 5674, pp. 327–342. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  8. 8.
    Harper, R., Pollack, R.: Type checking with universes. Theoretical Computer Science 89(1), 107–136 (1991), ISSN: 0304-3975Google Scholar
  9. 9.
    Harrison, J.: Formalized mathematics. TUCS technical report. Turku Centre for Computer Science (1996) ISBN: 9789516508132Google Scholar
  10. 10.
  11. 11.
    Huet, G., Saïbi, A.: Constructive category theory. In: Proof, Language, and Interaction, pp. 239–275. MIT Press (2000)Google Scholar
  12. 12.
    Krebbers, R., Spitters, B., van der Weegen, E.: Math ClassesGoogle Scholar
  13. 13.
    Leinster, T.: Higher Operads, Higher Categories. Cambridge Univ. PressGoogle Scholar
  14. 14.
    Mac Lane, S.: Categories for the working mathematicianGoogle Scholar
  15. 15.
    Megacz, A.: Category Theory Library for Coq. Coq, http://www.cs.berkeley.edu/~megacz/coq-categories/
  16. 16.
    Miquel, A.: The Implicit Calculus of Constructions. In: Abramsky, S. (ed.) TLCA 2001. LNCS, vol. 2044, pp. 344–359. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  17. 17.
    O’Keefe, G.: Towards a readable formalisation of category theory. Electronic Notes in Theoretical Computer Science 91, 212–228 (2004)CrossRefMathSciNetGoogle Scholar
  18. 18.
    Peebles, D., Vezzosi, A., Cook, J.: copumpkin/categories, https://github.com/copumpkin/categories
  19. 19.
    Pierce, B.: A taste of category theory for computer scientists. Tech. rep.Google Scholar
  20. 20.
    Saïbi, A.: Constructive Category Theory, http://coq.inria.fr/pylons/pylons/contribs/view/ConCaT/v8.4
  21. 21.
    Shulman, M.: An Interval Type Implies Function Extensionality, http://homotopytypetheory.org/2011/04/04
  22. 22.
    Sozeau, M., et al.: HoTT/coq, https://github.com/HoTT/coq
  23. 23.
    Spitters, B., van der Weegen, E.: Developing the algebraic hierarchy with type classes in Coq. In: Kaufmann, M., Paulson, L.C. (eds.) ITP 2010. LNCS, vol. 6172, pp. 490–493. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  24. 24.
    The Coq Proof Assistant. INRIA, http://coq.inria.fr
  25. 25.
    The Univalent Foundations Program. Homotopy Type Theory: Univalent Foundations of Mathematics (2013)Google Scholar

Copyright information

© Springer International Publishing Switzerland 2014

Authors and Affiliations

  • Jason Gross
    • 1
  • Adam Chlipala
    • 1
  • David I. Spivak
    • 1
  1. 1.Massachusetts Institute of TechnologyCambridgeUSA

Personalised recommendations