Category Theory in Coq 8.5

Authors Amin Timany, Bart Jacobs

Thumbnail PDF


  • Filesize: 0.53 MB
  • 18 pages

Document Identifiers

Author Details

Amin Timany
Bart Jacobs

Cite AsGet BibTex

Amin Timany and Bart Jacobs. Category Theory in Coq 8.5. In 1st International Conference on Formal Structures for Computation and Deduction (FSCD 2016). Leibniz International Proceedings in Informatics (LIPIcs), Volume 52, pp. 30:1-30:18, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2016)


We report on our experience implementing category theory in Coq 8.5. Our work formalizes most of basic category theory, including concepts not covered by existing formalizations, in a library that is fit to be used as a general-purpose category-theoretical foundation. Our development particularly takes advantage of two features new to Coq 8.5: primitive projections for records and universe polymorphism. Primitive projections allow for well-behaved dualities while universe polymorphism provides a relative notion of largeness and smallness. The latter is one of the main contributions of this paper. It pushes the limits of the new universe polymorphism and constraint inference algorithm of Coq 8.5. In this paper we present in detail smallness and largeness in categories and the foundation they are built on top of. We furthermore explain how we have used the universe polymorphism of Coq 8.5 to represent smallness and largeness arguments by simply ignoring them and entrusting them to the universe inference algorithm of Coq 8.5. We also briefly discuss our experience throughout this implementation, discuss concepts formalized in this development and give a comparison with a few other developments of similar extent.
  • Category Theory
  • Coq 8.5
  • Universe Polymorphism
  • Homotopy Type Theory


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads


  1. Benedikt Ahrens, Krzysztof Kapulkin, and Michael Shulman. Univalent categories and the rezk completion. Mathematical Structures in Computer Science, 25(05):1010-1039, jan 2015. URL:, URL:
  2. Steve Awodey. Category theory. Oxford University Press, 2010. Google Scholar
  3. Bodil Biering, Lars Birkedal, and Noah Torp-Smith. Bi-hyperdoctrines, higher-order separation logic, and abstraction. ACM Trans. Program. Lang. Syst., 29(5), August 2007. URL:
  4. Lars Birkedal, Rasmus Ejlers Mogelberg, Jan Schwinghammer, and Kristian Stovring. First steps in synthetic guarded domain theory: Step-indexing in the topos of trees. In 2011 IEEE 26th Annual Symposium on Logic in Computer Science. Institute of Electrical & Electronics Engineers (IEEE), jun 2011. URL:
  5. Lars Birkedal, Kristian Støvring, and Jacob Thamsborg. The category-theoretic solution of recursive metric-space equations. Theoretical Computer Science, 411(47):4102-4122, oct 2010. URL:
  6. T. Coquand. An analysis of Girard’s paradox. Technical Report RR-0531, INRIA, May 1986. URL:
  7. Jason Gross, Adam Chlipala, and David I. Spivak. Experience Implementing a Performant Category-Theory Library in Coq. In Interactive Theorem Proving - 5th International Conference, ITP 2014. Proceedings, pages 275-291, July 2014. URL:
  8. Jason Gross, Adam Chlipala, and David I. Spivak. Experience implementing a performant category-theory library in coq, 2014. URL:
  9. Gérard P. Huet and Amokrane Saïbi. Constructive category theory. In Proof, Language, and Interaction, Essays in Honour of Robin Milner, pages 239-276, 2000. URL:
  10. Bart Jacobs. Categorical Logic and Type Theory. Number 141 in Studies in Logic and the Foundations of Mathematics. North Holland, Amsterdam, 1999. Google Scholar
  11. Saunders Mac Lane. Categories for the working mathematician, volume 5. Springer Science &Business Media, 1978. Google Scholar
  12. The Coq development team. Coq 8.5 Reference Manual. Inria, 2015. Google Scholar
  13. Colin McLarty. Elementary Categories, Elementary Toposes. Oxford University Press, Oxford, UK, 1996. Google Scholar
  14. Adam Megacz. Category Theory in Coq. URL:
  15. John C. Mitchell. Foundations of Programming Languages. MIT Press, Cambridge, MA, USA, 1996. Google Scholar
  16. Daniel Peebles, James Deikun, Ulf Norell, Dan Doel, Andrea Vezzosi, Darius Jahandarie, and James Cook. copumpkin/categories. URL:
  17. Antonino Salibra. Scott is always simple. In Proceedings of the 37th International Conference on Mathematical Foundations of Computer Science, MFCS'12, pages 31-45, Berlin, Heidelberg, 2012. Springer-Verlag. URL:
  18. Matthieu Sozeau and Nicolas Tabareau. Universe Polymorphism in Coq. In Interactive Theorem Proving, ITP 2014, Proceedings, pages 499-514, July 2014. URL:
  19. The Univalent Foundations Program. HoTT Version of Coq and Library. URL:
  20. The Univalent Foundations Program. Homotopy Type Theory: Univalent Foundations of Mathematics., Institute for Advanced Study, 2013.
  21. Amin Timany. Categories. URL:, URL:
  22. Amin Timany. Categories-HoTT. URL:
  23. Amin Timany and Bart Jacobs. The Category-theoretic Solution of Recursive Ultra-metric Space Equations. Presented at CoqPL'16: The Second International Workshop on Coq for PL. URL:
  24. Amin Timany and Bart Jacobs. First Steps Towards Cumulative Inductive Types in CIC. In 12th International Colloquium on Theoretical Aspects of Computing (ICTAC 2015) 2015. Proceedings, pages 608-617, 2015. URL:
  25. Amin Timany and Bart Jacobs. Category Theory in Coq 8.5: Extended Version. Technical Report CW697, iMinds-Distrinet, KU Leuven, April 2016. URL:
Questions / Remarks / Feedback

Feedback for Dagstuhl Publishing

Thanks for your feedback!

Feedback submitted

Could not send message

Please try again later or send an E-mail