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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
References
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
The Agda Community: Agda standard library (2023). https://github.com/agda/agda-stdlib
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
Barthe, G., Capretta, V., Pons, O.: Setoids in type theory. J. Funct. Program. 13(2), 261–293 (2003). https://doi.org/10.1017/S0956796802004501
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
Blizard, W.D.: The development of multiset theory. Modern Logic 1(4), 319–352 (1991)
Brown, K.S.: Semigroups, rings, and Markov chains. J. Theor. Probab. 13(3), 871–938 (2000). https://doi.org/10.1023/a:1007822931408
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
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
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
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
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
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
Gylterud, H.R.: Multisets in type theory. Math. Proc. Cambridge Philos. Soc. 169(1), 1–18 (2020). https://doi.org/10.1017/S0305004119000045
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
Hinze, R.: Generalizing generalized tries. J. Funct. Program. 10(4), 327–351 (2000). https://doi.org/10.1017/S0956796800003713
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
Jech, T.: The Axiom of Choice. North-Holland (1973)
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
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)
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
Nordvall Forsberg, F.: Inductive-inductive definitions. Ph.D. thesis, Swansea University (2013)
Norell, U.: Towards a practical programming language based on dependent type theory. Ph.D. thesis, Chalmers University of Technology (2007)
Piceghello, S.: Coherence for Monoidal and Symmetric Monoidal Groupoids in Homotopy Type Theory. Ph.D. thesis, The University of Bergen (2021)
Pincus, D.: The dense linear ordering principle. J. Symb. Log. 62(2), 438–456 (1997). https://doi.org/10.2307/2275540
Poinsot, L., Duchamp, G., Tollu, C.: Partial monoids: associativity and confluence. J. Pure Appl. Math. Adv. Appl. 3(2), 265–285 (2010)
Streicher, T.: Investigations into intensional type theory. Habilitation thesis (1993)
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
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
The Univalent Foundations Program: Homotopy Type Theory: Univalent Foundations of Mathematics. Institute for Advanced Study (2013). https://homotopytypetheory.org/book/
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)
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
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2023 The Author(s), under exclusive license to Springer Nature Singapore Pte Ltd.
About this paper
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)