A Univalent Formalization of Constructive Affine Schemes

Authors Max Zeuner , Anders Mörtberg

Thumbnail PDF


  • Filesize: 0.93 MB
  • 24 pages

Document Identifiers

Author Details

Max Zeuner
  • Department of Mathematics, Stockholm University, Sweden
Anders Mörtberg
  • Department of Mathematics, Stockholm University, Sweden


We would like to thank Thierry Coquand for his continued feedback and invaluable comments throughout this project. We are also indebted to Felix Cherubini for his comments and his work on the Cubical Agda library, particularly for his ring solver. Furthermore, we thank Martín Hötzel Escardó, Peter Dybjer, Peter LeFanu Lumsdaine, Egbert Rijke and the participants of the "Proof and Computation" autumn school in Fischbachau for our discussions.

Cite AsGet BibTex

Max Zeuner and Anders Mörtberg. A Univalent Formalization of Constructive Affine Schemes. In 28th International Conference on Types for Proofs and Programs (TYPES 2022). Leibniz International Proceedings in Informatics (LIPIcs), Volume 269, pp. 14:1-14:24, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2023)


We present a formalization of constructive affine schemes in the Cubical Agda proof assistant. This development is not only fully constructive and predicative, it also makes crucial use of univalence. By now schemes have been formalized in various proof assistants. However, most existing formalizations follow the inherently non-constructive approach of Hartshorne’s classic "Algebraic Geometry" textbook, for which the construction of the so-called structure sheaf is rather straightforwardly formalizable and works the same with or without univalence. We follow an alternative approach that uses a point-free description of the constructive counterpart of the Zariski spectrum called the Zariski lattice and proceeds by defining the structure sheaf on formal basic opens and then lift it to the whole lattice. This general strategy is used in a plethora of textbooks, but formalizing it has proved tricky. The main result of this paper is that with the help of the univalence principle we can make this "lift from basis" strategy formal and obtain a fully formalized account of constructive affine schemes.

Subject Classification

ACM Subject Classification
  • Theory of computation → Logic and verification
  • Theory of computation → Constructive mathematics
  • Theory of computation → Type theory
  • Affine Schemes
  • Homotopy Type Theory and Univalent Foundations
  • Cubical Agda
  • Constructive Mathematics


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


  1. Carlo Angiuli, Evan Cavallo, Anders Mörtberg, and Max Zeuner. Internalizing representation independence with univalence. Proc. ACM Program. Lang., 5(POPL), January 2021. URL: https://doi.org/10.1145/3434293.
  2. Michael Francis Atiyah and Ian Grant MacDonald. Introduction to Commutative Algebra. Addison-Wesley-Longman, 1969. Google Scholar
  3. Anthony Bordg, Lawrence Paulson, and Wenda Li. Simple Type Theory is not too Simple: Grothendieck’s Schemes Without Dependent Types. Experimental Mathematics, 0(0):1-19, 2022. URL: https://doi.org/10.1080/10586458.2022.2062073.
  4. Kevin Buzzard, Chris Hughes, Kenny Lau, Amelia Livingston, Ramon Fernández Mir, and Scott Morrison. Schemes in lean. Experimental Mathematics, 0(0):1-9, 2021. URL: https://doi.org/10.1080/10586458.2021.1983489.
  5. Tim Cherganov. Sheaf of rings on Spec R, 2022. URL: https://github.com/UniMath/UniMath/blob/0df0949b951e198c461e16866107a239c8bc0a1e/UniMath/AlgebraicGeometry/Spec.v.
  6. Laurent Chicli. Une formalisation des faisceaux et des schémas affines en théorie des types avec Coq. Technical Report RR-4216, INRIA, June 2001. URL: https://hal.inria.fr/inria-00072403.
  7. Cyril Cohen, Thierry Coquand, Simon Huber, and Anders Mörtberg. Cubical Type Theory: A Constructive Interpretation of the Univalence Axiom. In Tarmo Uustalu, editor, 21st International Conference on Types for Proofs and Programs (TYPES 2015), volume 69 of Leibniz International Proceedings in Informatics (LIPIcs), pages 5:1-5:34, Dagstuhl, Germany, 2018. Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik. URL: https://doi.org/10.4230/LIPIcs.TYPES.2015.5.
  8. Thierry Coquand, Simon Huber, and Anders Mörtberg. On Higher Inductive Types in Cubical Type Theory. In Proceedings of the 33rd Annual ACM/IEEE Symposium on Logic in Computer Science, LICS 2018, pages 255-264, New York, NY, USA, 2018. ACM. URL: https://doi.org/10.1145/3209108.3209197.
  9. Thierry Coquand, Henri Lombardi, and Peter Schuster. The projective spectrum as a distributive lattice. Cahiers de Topologie et Géométrie différentielle catégoriques, 48(3):220-228, 2007. Google Scholar
  10. Thierry Coquand, Henri Lombardi, and Peter Schuster. Spectral schemes as ringed lattices. Annals of Mathematics and Artificial Intelligence, 56(3):339-360, 2009. Google Scholar
  11. Tom de Jong and Martín Hötzel Escardó. On Small Types in Univalent Foundations. Logical Methods in Computer Science, Volume 19, Issue 2, May 2023. URL: https://doi.org/10.46298/lmcs-19(2:8)2023.
  12. Pierre Deligne and Jean-François Boutot. Cohomologie étale: les points de départ. In Cohomologie Etale, pages 4-75, Berlin, Heidelberg, 1977. Springer Berlin Heidelberg. Google Scholar
  13. Jean Dieudonné and Alexandre Grothendieck. Éléments de géométrie algébrique, volume 1. Springer Berlin Heidelberg New York, 1971. Google Scholar
  14. Luis Español. Le spectre d'un anneau dans l'algèbre constructive et applications à la dimension. Cahiers de Topologie et Géométrie Différentielle Catégoriques, 24(2):133-144, 1983. URL: http://www.numdam.org/item/CTGDC_1983__24_2_133_0/.
  15. Ulrich Görtz and Torsten Wedhorn. Algebraic geometry. Springer, 2010. Google Scholar
  16. Robin Hartshorne. Algebraic geometry, volume 52. Springer Science & Business Media, 2013. Google Scholar
  17. Melvin Hochster. Prime ideal structure in commutative rings. Transactions of the American Mathematical Society, 142:43-60, 1969. Google Scholar
  18. Peter T. Johnstone. Stone spaces, volume 3. Cambridge university press, 1982. Google Scholar
  19. André Joyal. Les théoremes de chevalley-tarski et remarques sur l’algèbre constructive. Cahiers Topologie Géom. Différentielle, 16:256-258, 1976. Google Scholar
  20. Nicolai Kraus. The general universal property of the propositional truncation. In Hugo Herbelin, Pierre Letouzey, and Matthieu Sozeau, editors, 20th International Conference on Types for Proofs and Programs (TYPES 2014), volume 39 of Leibniz International Proceedings in Informatics (LIPIcs), pages 111-145, Dagstuhl, Germany, 2015. Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik. URL: https://doi.org/10.4230/LIPIcs.TYPES.2014.111.
  21. Nicolai Kraus and Jakob von Raumer. Coherence via well-foundedness: Taming set-quotients in homotopy type theory. In Proceedings of the 35th Annual ACM/IEEE Symposium on Logic in Computer Science, LICS '20, pages 662-675, New York, NY, USA, 2020. Association for Computing Machinery. URL: https://doi.org/10.1145/3373718.3394800.
  22. Henri Lombardi and Claude Quitté. Commutative Algebra: Constructive Methods: Finite Projective Modules, volume 20. Springer, 2015. Google Scholar
  23. Saunders Mac Lane. Categories for the working mathematician, volume 5. Springer Science & Business Media, 2013. Google Scholar
  24. Saunders Mac Lane and Ieke Moerdijk. Sheaves in geometry and logic: A first introduction to topos theory. Springer Science & Business Media, 2012. Google Scholar
  25. Per Martin-Löf. An Intuitionistic Theory of Types: Predicative Part. In H. E. Rose and J. C. Shepherdson, editors, Logic Colloquium '73, volume 80 of Studies in Logic and the Foundations of Mathematics, pages 73-118. North-Holland, 1975. URL: https://doi.org/10.1016/S0049-237X(08)71945-1.
  26. The mathlib Community. The lean mathematical library. In Proceedings of the 9th ACM SIGPLAN International Conference on Certified Programs and Proofs, CPP 2020, pages 367-381, New York, NY, USA, 2020. Association for Computing Machinery. URL: https://doi.org/10.1145/3372885.3373824.
  27. Ray Mines, Fred Richman, and Wim Ruitenburg. A course in constructive algebra. Springer Science & Business Media, 2012. Google Scholar
  28. Peter Schuster. The zariski spectrum as a formal geometry. Theoretical Computer Science, 405(1):101-115, 2008. Computational Structures for Modelling Space, Time and Causality. URL: https://doi.org/10.1016/j.tcs.2008.06.030.
  29. Marshall Harvey Stone. Topological representations of distributive lattices and brouwerian logics. Časopis pro pěstování matematiky a fysiky, 67(1):1-25, 1938. Google Scholar
  30. Thomas Streicher. Investigations Into Intensional Type Theory. Habilitation thesis, Ludwig-Maximilians-Universität München, 1993. URL: https://www2.mathematik.tu-darmstadt.de/~streicher/HabilStreicher.pdf.
  31. The Agda Development Team. The Agda programming language. URL: http://wiki.portal.chalmers.se/agda/pmwiki.php.
  32. Ayberk Tosun and Martín Hötzel Escardó. Patch locale of a spectral locale in univalent type theory, 2023. URL: https://arxiv.org/abs/2301.04728.
  33. The Univalent Foundations Program. Homotopy Type Theory: Univalent Foundations of Mathematics. https://homotopytypetheory.org/book, Institute for Advanced Study, 2013.
  34. Ravi Vakil. The rising sea: Foundations of algebraic geometry, 2017. draft. URL: https://math.stanford.edu/~vakil/216blog/FOAGnov1817public.pdf.
  35. Andrea Vezzosi, Anders Mörtberg, and Andreas Abel. Cubical agda: A dependently typed programming language with univalence and higher inductive types. Journal of Functional Programming, 31:e8, 2021. URL: https://doi.org/10.1017/S0956796821000034.
  36. V. Voevodsky, B. Ahrens, D. Grayson, et al. UniMath: Univalent Mathematics. Available at URL: https://github.com/UniMath.
  37. Vladimir Voevodsky. Univalent foundations, September 2010. Notes from a talk in Bonn. URL: https://www.math.ias.edu/vladimir/sites/math.ias.edu.vladimir/files/Bonn_talk.pdf.
  38. Vladimir Voevodsky. Resizing rules - their use and semantic justification. slides from a talk at types, bergen, 11 september, 2011. Google Scholar
  39. Vladimir Voevodsky. An experimental library of formalized mathematics based on the univalent foundations. Mathematical Structures in Computer Science, 25(5):1278-1294, 2015. URL: https://doi.org/10.1017/S0960129514000577.
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