Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/3437992.3439922acmconferencesArticle/Chapter ViewAbstractPublication PagespoplConference Proceedingsconference-collections
research-article

Formalizing category theory in Agda

Published: 20 January 2021 Publication History

Abstract

The generality and pervasiveness of category theory in modern mathematics makes it a frequent and useful target of formalization. It is however quite challenging to formalize, for a variety of reasons. Agda currently (i.e. in 2020) does not have a standard, working formalization of category theory. We document our work on solving this dilemma. The formalization revealed a number of potential design choices, and we present, motivate and explain the ones we picked. In particular, we find that alternative definitions or alternative proofs from those found in standard textbooks can be advantageous, as well as "fit" Agda's type theory more smoothly. Some definitions regarded as equivalent in standard textbooks turn out to make different "universe level" assumptions, with some being more polymorphic than others. We also pay close attention to engineering issues so that the library integrates well with Agda's own standard library, as well as being compatible with as many of supported type theories in Agda as possible.

References

[1]
Andreas Abel and Gabriel Scherer. 2012. On Irrelevance and Algorithmic Equality in Predicative Type Theory. Logical Methods in Computer Science 8, 1 ( 2012 ). htps://doi.org/10.2168/LMCS-8( 1 :29) 2012
[2]
Peter Aczel. 1993. Galois: a theory development project. manuscript, University of Manchester ( 1993 ).
[3]
Agda Team. 2019. Agda 2.6.0.1.
[4]
Benedikt Ahrens, Krzysztof Kapulkin, and Michael Shulman. 2015. Univalent categories and the Rezk completion. Mathematical Structures in Computer Science 25, 5 ( 2015 ), 1010-1039. htps://doi.org/10.1017/ S0960129514000486
[5]
Benedikt Ahrens and Paige Randall North. 2019. Univalent Foundations and the Equivalence Principle. Springer International Publishing, Cham, 137-150. htps://doi.org/10.1007/978-3-030-15655-8_6
[6]
Musa Al-hassy, Jacques Carette, and Wolfram Kahl. 2019. A language feature to unbundle data at will (short paper). In Proceedings of the 18th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences, GPCE 2019, Athens, Greece, October 21-22, 2019, Ina Schaefer, Christoph Reichenbach, and Tijs van der Storm (Eds.). ACM, 14-19. htps://doi.org/10.1145/3357765.3359523
[7]
Steve Awodey. 2010. Category Theory (2nd ed.). Oxford University Press, Inc., New York, NY, USA.
[8]
Edwin Brady. 2013. Idris, a general-purpose dependently typed programming language: Design and implementation. J. Funct. Program. 23, 5 ( 2013 ), 552-593. htps://doi.org/10.1017/S095679681300018X
[9]
Jacques Carette and Amr Sabry. 2016. Computing with Semirings and Weak Rig Groupoids. In Programming Languages and Systems-25th European Symposium on Programming, ESOP 2016, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2016, Eindhoven, The Netherlands, April 2-8, 2016, Proceedings (Lecture Notes in Computer Science, Vol. 9632 ), Peter Thiemann (Ed.). Springer, 123-148. htps://doi.org/10.1007/978-3-662-49498-1_6
[10]
Jesper Cockx, Dominique Devriese, and Frank Piessens. 2014. Pattern matching without K. In Proceedings of the 19th ACM SIGPLAN international conference on Functional programming, Gothenburg, Sweden, September 1-3, 2014, Johan Jeuring and Manuel M. T. Chakravarty (Eds.). ACM, 257-268. htps://doi.org/10.1145/2628136.2628139
[11]
Robert L. Constable, Stuart F. Allen, Mark Bromley, Rance Cleaveland, J. F. Cremer, R. W. Harper, Douglas J. Howe, Todd B. Knoblock, N. P. Mendler, Prakash Panangaden, James T. Sasaki, and Scott F. Smith. 1986. Implementing mathematics with the Nuprl proof development system. Prentice Hall. htp://dl.acm.org/citation.cfm?id= 10510
[12]
Nils Anders Danielsson, Ulf Norell, Shin-Cheng Mu, Bradley Hardy, Samuel Bronson, Dan Doel, Patrik Jansson, Liang-Ting Chen, JeanPhilippe Bernardy, Andrés Sicard-Ramírez, Nicolas Pouillard, Darin Morrison, Peter Berry, Daniel Brown, Simon Foster, Dominique Devriese, Andreas Abel, Alcatel-Lucent, Eric Mertens, Joachim Breitner, Liyang Hu, Noam Zeilberger, Érdi Gerg?, Stevan Andjelkovic, Helmut Grohne, Guilhem Moulin, Noriyuki Ohkawa, Evgeny Kotelnikov, James Chapman, Wen Kokke, Matthew Daggitt, Jason Hu, Sandro Stucki, Milo Turner, Zack Grannan, and Lex van der Stoep. 2019. agdastdlib: The Agda standard library. htps://github.com/agda/agdastdlib
[13]
Leonardo Mendonça de Moura, Soonho Kong, Jeremy Avigad, Floris van Doorn, and Jakob von Raumer. 2015. The Lean Theorem Prover (System Description). In Automated Deduction-CADE-25-25th International Conference on Automated Deduction, Berlin, Germany, August 1-7, 2015, Proceedings (Lecture Notes in Computer Science, Vol. 9195 ), Amy P. Felty and Aart Middeldorp (Eds.). Springer, 378-388. htps: //doi.org/10.1007/978-3-319-21401-6_26
[14]
François Garillot, Georges Gonthier, Assia Mahboubi, and Laurence Rideau. 2009. Packaging Mathematical Structures. In Theorem Proving in Higher Order Logics, 22nd International Conference, TPHOLs 2009, Munich, Germany, August 17-20, 2009. Proceedings. 327-342. htps: //doi.org/10.1007/978-3-642-03359-9_23
[15]
Herman Geuvers, Randy Pollack, Freek Wiedijk, and Jan Zwanenburg. 2002. A Constructive Algebraic Hierarchy in Coq. J. Symb. Comput. 34, 4 ( 2002 ), 271-286. htps://doi.org/10.1006/jsco. 2002.0552
[16]
Jason Gross, Adam Chlipala, and David I. Spivak. 2014. Experience Implementing a Performant Category-Theory Library in Coq. In Interactive Theorem Proving-5th International Conference, ITP 2014, Held as Part of the Vienna Summer of Logic, VSL 2014, Vienna, Austria, July 14-17, 2014. Proceedings (Lecture Notes in Computer Science, Vol. 8558 ), Gerwin Klein and Ruben Gamboa (Eds.). Springer, 275-291. htps://doi.org/10.1007/978-3-319-08970-6_18
[17]
Martin Hofmann and Thomas Streicher. 1996. The Groupoid Interpretation of Type Theory. In In Venice Festschrift. Oxford University Press, 83-111.
[18]
Gérard P. Huet and Amokrane Saïbi. 2000. Constructive category theory. In Proof, Language, and Interaction, Essays in Honour of Robin Milner, Gordon D. Plotkin, Colin Stirling, and Mads Tofte (Eds.). The MIT Press, 239-276.
[19]
G.M Kelly. 1964. On MacLane's conditions for coherence of natural associativities, commutativities, etc. Journal of Algebra 1, 4 ( 1964 ), 397-402. htps://doi.org/10.1016/ 0021-8693 ( 64 ) 90018-3
[20]
F. William Lawvere. 1964. An Elementary Theory of the Category of Sets. Proceedings of the National Academy of Sciences of the United States of America 52, 6 ( 1964 ), 1506-1511. htp://www.jstor.org/stable/72513
[21]
Saunders MacLane. 1971. Categories for the Working Mathematician. Springer-Verlag, New York. ix+ 262 pages. Graduate Texts in Mathematics, Vol. 5.
[22]
M. Makkai. 2017. Towards a Categorical Foundation of Mathematics. Cambridge University Press, 153-190. htps://doi.org/10.1017/ 9781316716830.014
[23]
Per Martin-Löf. 1984. Intuitionistic type theory. Studies in proof theory, Vol. 1. Bibliopolis.
[24]
The mathlib Community. 2020. The lean mathematical library. In Proceedings of the 9th ACM SIGPLAN International Conference on Certified Programs and Proofs, CPP 2020, New Orleans, LA, USA, January 20-21, 2020, Jasmin Blanchette and Catalin Hritcu (Eds.). ACM, 367-381. htps://doi.org/10.1145/3372885.3373824
[25]
Tobias Nipkow, Lawrence C. Paulson, and Markus Wenzel. 2002. Isabelle/HOL-A Proof Assistant for Higher-Order Logic. Lecture Notes in Computer Science, Vol. 2283. Springer. htps://doi.org/10.1007/3-540-45949-9
[26]
Daniel Peebles, James Deikun, Ulf Norell, Dan Doel, Darius Jahandarie, and James Cook. 2018. categories: Categories parametrized by morphism equality in Agda. htps://github.com/copumpkin/categories
[27]
Bas Spitters and Eelis van der Weegen. 2011. Type classes for mathematics in type theory. Math. Struct. Comput. Sci. 21, 4 ( 2011 ), 795-825. htps://doi.org/10.1017/S0960129511000119
[28]
Eugene W. Stark. 2016. Category Theory with Adjunctions and Limits. Archive of Formal Proofs ( June 2016 ). htp://isa-afp.org/entries/ Category3.html, Formal proof development.
[29]
Eugene W. Stark. 2017. Monoidal Categories. Archive of Formal Proofs (May 2017 ). htp://isa-afp.org/entries/MonoidalCategory.html, Formal proof development.
[30]
Eugene W. Stark. 2020. Bicategories. Archive of Formal Proofs (Jan. 2020 ). htp://isa-afp.org/entries/Bicategory.html, Formal proof development.
[31]
Thomas Streicher. 1993. Investigations into intensional type theory. Habilitiation Thesis, Ludwig Maximilian Universität ( 1993 ).
[32]
Amin Timany and Bart Jacobs. 2016. Category Theory in Coq 8.5. In 1st International Conference on Formal Structures for Computation and Deduction, FSCD 2016, June 22-26, 2016, Porto, Portugal (LIPIcs, Vol. 52 ), Delia Kesner and Brigitte Pientka (Eds.). Schloss Dagstuhl-Leibniz-Zentrum für Informatik, 30 : 1-30 : 18. htps://doi.org/10.4230/ LIPIcs.FSCD. 2016.30
[33]
The Univalent Foundations Program. 2013. Homotopy Type Theory: Univalent Foundations of Mathematics. htps://homotopytypetheory. org/book, Institute for Advanced Study.
[34]
Andrea Vezzosi, Anders Mörtberg, and Andreas Abel. 2019. Cubical agda: a dependently typed programming language with univalence and higher inductive types. PACMPL 3, ICFP ( 2019 ), 87 : 1-87 : 29. htps: //doi.org/10.1145/3341691
[35]
Vladimir Voevodsky, Benedikt Ahrens, Daniel Grayson, et al. [n.d.]. UniMath-a computer-checked library of univalent mathematics. available at htps://github.com/UniMath/UniMath. htps://github. com/UniMath/UniMath
[36]
Michael A Warren. 2008. Homotopy theoretic aspects of constructive type theory. Ph.D. Dissertation. Carnegie Mellon University.
[37]
John Wiegley. 2019. category-theory: Category Theory in Coq. htps: //github.com/jwiegley/category-theory
[38]
Brent Yorgey. 2014. Combinatorial species and labelled structures. Ph.D. Dissertation. University of Pennsylvania.

Cited By

View all
  • (2024)Initial Algebras Unchained - A Novel Initial Algebra Construction Formalized in AgdaProceedings of the 39th Annual ACM/IEEE Symposium on Logic in Computer Science10.1145/3661814.3662105(1-14)Online publication date: 8-Jul-2024
  • (2024)Thirty-Three Years of Mathematicians and Software Engineers: A Case Study of Domain Expertise and Participation in Proof Assistant EcosystemsProceedings of the 21st International Conference on Mining Software Repositories10.1145/3643991.3644908(1-13)Online publication date: 15-Apr-2024
  • (2024)Displayed Monoidal Categories for the Semantics of Linear LogicProceedings of the 13th ACM SIGPLAN International Conference on Certified Programs and Proofs10.1145/3636501.3636956(260-273)Online publication date: 9-Jan-2024
  • Show More Cited By

Index Terms

  1. Formalizing category theory in Agda

      Recommendations

      Comments

      Information & Contributors

      Information

      Published In

      cover image ACM Conferences
      CPP 2021: Proceedings of the 10th ACM SIGPLAN International Conference on Certified Programs and Proofs
      January 2021
      342 pages
      ISBN:9781450382991
      DOI:10.1145/3437992
      Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

      Sponsors

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      Published: 20 January 2021

      Permissions

      Request permissions for this article.

      Check for updates

      Badges

      Author Tags

      1. Agda
      2. category theory
      3. formal mathematics

      Qualifiers

      • Research-article

      Conference

      CPP '21
      Sponsor:

      Acceptance Rates

      Overall Acceptance Rate 18 of 26 submissions, 69%

      Upcoming Conference

      POPL '25

      Contributors

      Other Metrics

      Bibliometrics & Citations

      Bibliometrics

      Article Metrics

      • Downloads (Last 12 months)33
      • Downloads (Last 6 weeks)2
      Reflects downloads up to 05 Jan 2025

      Other Metrics

      Citations

      Cited By

      View all
      • (2024)Initial Algebras Unchained - A Novel Initial Algebra Construction Formalized in AgdaProceedings of the 39th Annual ACM/IEEE Symposium on Logic in Computer Science10.1145/3661814.3662105(1-14)Online publication date: 8-Jul-2024
      • (2024)Thirty-Three Years of Mathematicians and Software Engineers: A Case Study of Domain Expertise and Participation in Proof Assistant EcosystemsProceedings of the 21st International Conference on Mining Software Repositories10.1145/3643991.3644908(1-13)Online publication date: 15-Apr-2024
      • (2024)Displayed Monoidal Categories for the Semantics of Linear LogicProceedings of the 13th ACM SIGPLAN International Conference on Certified Programs and Proofs10.1145/3636501.3636956(260-273)Online publication date: 9-Jan-2024
      • (2024)Univalent Double CategoriesProceedings of the 13th ACM SIGPLAN International Conference on Certified Programs and Proofs10.1145/3636501.3636955(246-259)Online publication date: 9-Jan-2024
      • (2024)Formalizing the ∞-Categorical Yoneda LemmaProceedings of the 13th ACM SIGPLAN International Conference on Certified Programs and Proofs10.1145/3636501.3636945(274-290)Online publication date: 9-Jan-2024
      • (2024)With a Few Square Roots, Quantum Computing Is as Easy as PiProceedings of the ACM on Programming Languages10.1145/36328618:POPL(546-574)Online publication date: 5-Jan-2024
      • (2023)Curiously Empty Intersection of Proof Engineering and Computational SciencesImpact of Scientific Computing on Science and Society10.1007/978-3-031-29082-4_3(45-73)Online publication date: 8-Jul-2023
      • (2022)Formal metatheory of second-order abstract syntaxProceedings of the ACM on Programming Languages10.1145/34987156:POPL(1-29)Online publication date: 12-Jan-2022
      • (2022)Bicategories in univalent foundationsMathematical Structures in Computer Science10.1017/S096012952200003231:10(1232-1269)Online publication date: 9-Mar-2022
      • (2021)Extensional equality preservation and verified generic programmingJournal of Functional Programming10.1017/S095679682100020431Online publication date: 21-Oct-2021

      View Options

      Login options

      View options

      PDF

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader

      Media

      Figures

      Other

      Tables

      Share

      Share

      Share this Publication link

      Share on social media