Skip to main content

Graded Rings in Lean’s Dependent Type Theory

  • Conference paper
  • First Online:
Intelligent Computer Mathematics (CICM 2022)

Abstract

In principle, dependent type theory should provide an ideal foundation for formalizing graded rings, where each grade can be of a different type. However, the power of these foundations leaves a plethora of choices for how to proceed with such a formalization. This paper explores various different approaches to how formalization could proceed, and then demonstrates precisely how the authors formalized graded algebras in Lean’s mathlib. Notably, we show how this formalization was used as an API; allowing us to formalize various graded structures such as those on tuples, free monoids, tensor algebras, and Clifford algebras.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    Or “a graded algebra of type \(\mathbb {N}\) over the ring R with graduation A” in the language of [6, III, §3, 1.].

  2. 2.

    Where \(\mathcal {C}\ell (V, Q)\) is notation to specify the quadratic form Q and vector space V.

  3. 3.

    At least, when \(Q\ne 0\). If \(Q = 0\) then \(\mathcal {C}\ell (V, Q) = \mathcal {\bigwedge }(V)\) and we can proceed as above.

  4. 4.

    Note that literature referring to an \(\mathbb {N}\)-grading is referring to the grading on \(\mathcal {\bigwedge }(V)\) via the canonical module equivalence.

  5. 5.

    https://en.wikipedia.org/wiki/Centipede_mathematics.

  6. 6.

    Some sources use a more general definition of graded R-modules and R-algebras, where R is itself a graded ring such that \(R_iM_j \subseteq M_{i+j}\). For brevity we will not discuss these here (in essence considering only the special case when R has the trivial graduation), but our approach would extends to this straightforwardly .

  7. 7.

    In the absence of our work a proof via convexity was used instead.

  8. 8.

    Chosen for brevity due to having the fewest axioms, not because they are interesting.

  9. 9.

    Lean 4 lifts this notation restriction, but the algebraic typeclasses provided by mathlib would need reworking.

  10. 10.

    The syntax in Lean for an incomplete proof.

  11. 11.

    After enabling the appropriate by-default-disabled instances.

  12. 12.

    Thus resolving the further work in [14, §8.1].

  13. 13.

    source lines of code.

  14. 14.

    Tracked in https://github.com/leanprover-community/mathlib/projects/12.

  15. 15.

    In geometric algebra and algebraic geometry, respectively!.

References

  1. Affeldt, R., Cohen, C., Kerjean, M., Mahboubi, A., Rouhling, D., Sakaguchi, K.: Competing inheritance paths in dependent type theory: a case study in functional analysis. In: Peltier, N., Sofronie-Stokkermans, V. (eds.) IJCAR 2020. LNCS (LNAI), vol. 12167, pp. 3–20. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-51054-1_1

    Chapter  Google Scholar 

  2. Avigad, J., et al.: Spectral Sequences in Homotopy Type Theory, November 2015. https://github.com/cmu-phil/Spectral

  3. Baanen, A.: Leanprover-community/mathlib#11750: define subobject classes from submonoid up to subfield, April 2022. https://github.com/leanprover-community/mathlib/pull/11750

  4. Baanen, A.: Use and abuse of instance parameters in the Lean mathematical library. In: ITP 2022, Haifa, Israel, May 2022. http://arxiv.org/abs/2202.01629

  5. Barton, R., Commelin, J., Buzzard, K., Lau, K., Carneiro, M.: #maths \(>\) CDGAs, June 2019. https://leanprover-community.github.io/archive/stream/116395-maths/topic/CDGAs.html

  6. Bourbaki, N.: Algebra I, Chapters 1–3. Elements of Mathematics. Springer, Heidelberg (1989). https://doi.org/10.1007/978-3-642-59312-3

    Book  MATH  Google Scholar 

  7. Brunerie, G., Ljungström, A., Mörtberg, A.: Synthetic integral cohomology in cubical agda. In: Manea, F., Simpson, A. (eds.) 30th EACSL Annual Conference on Computer Science Logic (CSL 2022). Leibniz International Proceedings in Informatics (LIPIcs), vol. 216, pp. 11:1–11:19. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, Dagstuhl, Germany (2022). https://doi.org/10.4230/LIPIcs.CSL.2022.11. ISSN: 1868-8969

  8. Castelvecchi, D.: Mathematicians welcome computer-assisted proof in ‘grand unification’ theory. Nature 595(7865), 18–19 (2021). https://doi.org/10.1038/d41586-021-01627-2

    Article  Google Scholar 

  9. Domínguez, C., Rubio, J.: Effective homology of bicomplexes, formalized in Coq. Theoret. Comput. Sci. 412(11), 962–970 (2011). https://doi.org/10.1016/j.tcs.2010.11.016

    Article  MathSciNet  MATH  Google Scholar 

  10. de Moura, L., Kong, S., Avigad, J., van Doorn, F., von Raumer, J.: The lean theorem prover (system description). In: Felty, A.P., Middeldorp, A. (eds.) CADE 2015. LNCS (LNAI), vol. 9195, pp. 378–388. Springer, Cham (2015). https://doi.org/10.1007/978-3-319-21401-6_26

    Chapter  Google Scholar 

  11. The mathlib Community: The lean mathematical library. In: Proceedings of the 9th ACM SIGPLAN International Conference on Certified Programs and Proofs, pp. 367–381. ACM, New Orleans, January 2020. https://doi.org/10.1145/3372885.3373824

  12. The Stacks project authors: The Stacks project (2022). https://stacks.math.columbia.edu

  13. Wieser, E.: Scalar actions in Lean’s mathlib. In: CICM 2021. Timisoara, Romania, August 2021. http://arxiv.org/abs/2108.10700

  14. Wieser, E., Song, U.: Formalizing geometric algebra in lean. Adv. Appl. Clifford Algebras 32(3), 28 (2022). https://doi.org/10.1007/s00006-021-01164-1

    Article  MathSciNet  MATH  Google Scholar 

Download references

Acknowledgments

The authors would like to thank Kevin Buzzard for his justified insistence on needing an interface to talk about internal gradings, Anne Baanen for picking up the mantle dropped by the first author on the rest of the set_like refactor, and the rest of the mathlib community for the extraordinarily collaborative work providing the context for this paper. The first author is funded by a scholarship from the Cambridge Trust. The second author is funded by the Schrödinger Scholarship Scheme from Imperial College London.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Eric Wieser .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2022 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Wieser, E., Zhang, J. (2022). Graded Rings in Lean’s Dependent Type Theory. In: Buzzard, K., Kutsia, T. (eds) Intelligent Computer Mathematics. CICM 2022. Lecture Notes in Computer Science(), vol 13467. Springer, Cham. https://doi.org/10.1007/978-3-031-16681-5_8

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-16681-5_8

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-16680-8

  • Online ISBN: 978-3-031-16681-5

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics