Skip to main content

A Fresh Look at Commutativity: Free Algebraic Structures via Fresh Lists

  • Conference paper
  • First Online:
Programming Languages and Systems (APLAS 2023)

Abstract

We show how types of free idempotent commutative monoids and free commutative monoids can be constructed in ordinary dependent type theory, without the need for quotient types or setoids, and prove that these constructions realise finite sets and multisets, respectively. Both constructions arise as generalisations of C. Coquand’s data type of fresh lists. We also show how many other free structures also can be realised by other instantiations. All of our results have been formalised in Agda.

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 49.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 64.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

References

  1. Abbott, M., Altenkirch, T., Ghani, N.: Categories of containers. In: Gordon, A.D. (ed.) FoSSaCS 2003. LNCS, vol. 2620, pp. 23–38. Springer, Heidelberg (2003). https://doi.org/10.1007/3-540-36576-1_2

    Chapter  MATH  Google Scholar 

  2. The Agda Community: Agda standard library (2023). https://github.com/agda/agda-stdlib

  3. Appel, A.W., Leroy, X.: Efficient extensional binary tries. J. Autom. Reason. 67(1), 8 (2023). https://doi.org/10.1007/s10817-022-09655-x

    Article  MathSciNet  MATH  Google Scholar 

  4. Barthe, G., Capretta, V., Pons, O.: Setoids in type theory. J. Funct. Program. 13(2), 261–293 (2003). https://doi.org/10.1017/S0956796802004501

    Article  MathSciNet  MATH  Google Scholar 

  5. Bessis, D.: The dual braid monoid. Annales scientifiques de l’Ecole normale supérieure 36(5), 647–683 (2003). https://doi.org/10.1016/j.ansens.2003.01.001

    Article  MathSciNet  MATH  Google Scholar 

  6. Blizard, W.D.: The development of multiset theory. Modern Logic 1(4), 319–352 (1991)

    MathSciNet  MATH  Google Scholar 

  7. Brown, K.S.: Semigroups, rings, and Markov chains. J. Theor. Probab. 13(3), 871–938 (2000). https://doi.org/10.1023/a:1007822931408

    Article  MathSciNet  MATH  Google Scholar 

  8. Bunkenburg, A.: The Boom hierarchy. In: O’Donnell, J.T., Hammond, K. (eds.) Proceedings of the 1993 Glasgow Workshop on Functional Programming, pp. 1–8. Springer (1994). https://doi.org/10.1007/978-1-4471-3236-3_1

  9. Choudhury, V., Fiore, M.: Free commutative monoids in Homotopy Type Theory. In: Hsu, J., Tasson, C. (eds.) Mathematical Foundations of Programming Semantics (MFPS ’22). Electronic Notes in Theoretical Informatics and Computer Science, vol. 1 (2023). https://doi.org/10.46298/entics.10492

  10. Choudhury, V., Karwowski, J., Sabry, A.: Symmetries in reversible programming: From symmetric rig groupoids to reversible programming languages. In: Proceedings of the ACM on Programming Languages 6(POPL), pp. 1–32 (2022). https://doi.org/10.1145/3498667

  11. Coquand, C.: A formalised proof of the soundness and completeness of a simply typed lambda-calculus with explicit substitutions. Higher Order Symbol. Comput. 15(1), 57–90 (2002). https://doi.org/10.1023/A:1019964114625

    Article  MATH  Google Scholar 

  12. Dybjer, P.: A general formulation of simultaneous inductive-recursive definitions in type theory. J. Symb. Log. 65(2), 525–549 (2000). https://doi.org/10.2307/2586554

    Article  MathSciNet  MATH  Google Scholar 

  13. Frumin, D., Geuvers, H., Gondelman, L., Weide, N.v.d.: Finite sets in homotopy type theory. In: International Conference on Certified Programs and Proofs (CPP ’18), pp. 201–214. Association for Computing Machinery (2018). https://doi.org/10.1145/3167085

  14. Gylterud, H.R.: Multisets in type theory. Math. Proc. Cambridge Philos. Soc. 169(1), 1–18 (2020). https://doi.org/10.1017/S0305004119000045

    Article  MathSciNet  MATH  Google Scholar 

  15. Hedberg, M.: A coherence theorem for Martin-Löf’s type theory. J. Funct. Program. 8(4), 413–436 (1998). https://doi.org/10.1017/s0956796898003153

    Article  MathSciNet  MATH  Google Scholar 

  16. Hinze, R.: Generalizing generalized tries. J. Funct. Program. 10(4), 327–351 (2000). https://doi.org/10.1017/S0956796800003713

    Article  MathSciNet  MATH  Google Scholar 

  17. Hutton, G.: A tutorial on the universality and expressiveness of fold. J. Funct. Program. 9(4), 355–372 (1999). https://doi.org/10.1017/s0956796899003500

    Article  MATH  Google Scholar 

  18. Jech, T.: The Axiom of Choice. North-Holland (1973)

    Google Scholar 

  19. Joram, P., Veltri, N.: Constructive final semantics of finite bags. In: Naumowicz, A., Thiemann, R. (eds.) Interactive Theorem Proving (ITP ’23). Leibniz International Proceedings in Informatics (LIPIcs), vol. 268, pp. 20:1–20:19. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, Dagstuhl, Germany (2023). https://doi.org/10.4230/LIPIcs.ITP.2023.20

  20. Lawvere, F.W.: Display of graphics and their applications, as exemplified by 2-categories and the Hegelian “taco". In: Proceedings of the First International Conference on Algebraic Methodology and Software Technology, pp. 51–74 (1989)

    Google Scholar 

  21. McBride, C.: How to keep your neighbours in order. In: Jeuring, J., Chakravarty, M.M.T. (eds.) International conference on Functional programming (ICFP ’14), pp. 297–309. Association for Computing Machinery (2014). https://doi.org/10.1145/2628136.2628163

  22. Nordvall Forsberg, F.: Inductive-inductive definitions. Ph.D. thesis, Swansea University (2013)

    Google Scholar 

  23. Norell, U.: Towards a practical programming language based on dependent type theory. Ph.D. thesis, Chalmers University of Technology (2007)

    Google Scholar 

  24. Piceghello, S.: Coherence for Monoidal and Symmetric Monoidal Groupoids in Homotopy Type Theory. Ph.D. thesis, The University of Bergen (2021)

    Google Scholar 

  25. Pincus, D.: The dense linear ordering principle. J. Symb. Log. 62(2), 438–456 (1997). https://doi.org/10.2307/2275540

    Article  MathSciNet  MATH  Google Scholar 

  26. Poinsot, L., Duchamp, G., Tollu, C.: Partial monoids: associativity and confluence. J. Pure Appl. Math. Adv. Appl. 3(2), 265–285 (2010)

    MathSciNet  MATH  Google Scholar 

  27. Streicher, T.: Investigations into intensional type theory. Habilitation thesis (1993)

    Google Scholar 

  28. Swan, A.: If every set has some irreflexive, extensional order, then excluded middle follows. Agda formalisation by Tom De Jong available at https://www.cs.bham.ac.uk/~mhe/TypeTopology/Ordinals.WellOrderingTaboo.html

  29. Ulmer, F.: Properties of dense and relative adjoint functors. J. Algebra 8(1), 77–95 (1968). https://doi.org/10.1016/0021-8693(68)90036-7

    Article  MathSciNet  MATH  Google Scholar 

  30. The Univalent Foundations Program: Homotopy Type Theory: Univalent Foundations of Mathematics. Institute for Advanced Study (2013). https://homotopytypetheory.org/book/

  31. Watters, S., Nordvall Forsberg, F., Kupke, C.: Agda formalisation of “A Fresh Look at Commutativity: Free Algebraic Structures via Fresh Lists”. https://doi.org/10.5281/zenodo.8357335 (2023)

Download references

Acknowledgements

We thank Guillaume Allais for interesting suggestions, Ezra Schoen for the idea to consider reflexive partial monoids in Sect. 6.4, and the referees for insightful comments and improvements. This work was supported by the Engineering and Physical Sciences Research Council [EP/W52394X/1]; the National Physical Laboratory; and the Leverhulme Trust [RPG-2020-232].

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Sean Watters .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2023 The Author(s), under exclusive license to Springer Nature Singapore Pte Ltd.

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Kupke, C., Forsberg, F.N., Watters, S. (2023). A Fresh Look at Commutativity: Free Algebraic Structures via Fresh Lists. In: Hur, CK. (eds) Programming Languages and Systems. APLAS 2023. Lecture Notes in Computer Science, vol 14405. Springer, Singapore. https://doi.org/10.1007/978-981-99-8311-7_7

Download citation

  • DOI: https://doi.org/10.1007/978-981-99-8311-7_7

  • Published:

  • Publisher Name: Springer, Singapore

  • Print ISBN: 978-981-99-8310-0

  • Online ISBN: 978-981-99-8311-7

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics