Abstractions for Multi-Sorted Substitutions

Author Hannes Saffrich



PDF
Thumbnail PDF

File

LIPIcs.ITP.2024.32.pdf
  • Filesize: 0.69 MB
  • 19 pages

Document Identifiers

Author Details

Hannes Saffrich
  • University of Freiburg, Germany

Cite AsGet BibTex

Hannes Saffrich. Abstractions for Multi-Sorted Substitutions. In 15th International Conference on Interactive Theorem Proving (ITP 2024). Leibniz International Proceedings in Informatics (LIPIcs), Volume 309, pp. 32:1-32:19, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2024)
https://doi.org/10.4230/LIPIcs.ITP.2024.32

Abstract

Formalizing a typed programming language in a proof assistant requires to choose representations for variables and typing. Variables are often represented as de Bruijn indices, where substitution is usually defined in terms of renamings to allow for proofs by structural induction. Typing can be represented extrinsically by defining untyped terms and a typing relation, or intrinsically by combining syntax and typing into a single definition of well-typed terms. For extrinsic typing, there is again a choice between extrinsic scoping, where terms and the notion of free variables are defined separately, and intrinsic scoping, where terms are indexed by their free variables. This paper describes an Agda framework for formalizing programming languages with extrinsic typing, intrinsic scoping, and de Bruijn Indices for variables. The framework supports object languages with arbitrary many variable sorts and dependencies, making it suitable for polymorphic languages and dependent types. Given an Agda definition of syntax and typing, the framework derives substitution operations and lemmas for untyped terms, and provides an abstraction to prove type preservation of these operations with just a single lemma. The key insights behind the framework are the use of multi-sorted syntax definitions, which enable parallel substitutions that replace all variables of all sorts simultaneously, and abstractions that unify the definitions, compositions, typings, and type preservation lemmas of multi-sorted renamings and substitutions. Case studies have been conducted to prove subject reduction for System F with subtyping, dependently typed lambda calculus, and lambda calculus with pattern matching.

Subject Classification

ACM Subject Classification
  • Theory of computation → Type theory
  • Software and its engineering → Syntax
  • Theory of computation → Logic and verification
Keywords
  • Agda
  • Metatheory
  • Framework

Metrics

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

References

  1. Andreas Abel, Guillaume Allais, Aliya Hameer, Brigitte Pientka, Alberto Momigliano, Steven Schäfer, and Kathrin Stark. Poplmark reloaded: Mechanizing proofs by logical relations. J. Funct. Program., 29:e19, 2019. URL: https://doi.org/10.1017/S0956796819000170.
  2. Guillaume Allais, Robert Atkey, James Chapman, Conor McBride, and James McKinna. A type and scope safe universe of syntaxes with binding: their semantics and proofs. Proc. ACM Program. Lang., 2(ICFP):90:1-90:30, 2018. URL: https://doi.org/10.1145/3236785.
  3. Guillaume Allais, James Chapman, Conor McBride, and James McKinna. Type-and-scope safe programs and their proofs. In Yves Bertot and Viktor Vafeiadis, editors, Proceedings of the 6th ACM SIGPLAN Conference on Certified Programs and Proofs, CPP 2017, Paris, France, January 16-17, 2017, pages 195-207. ACM, 2017. URL: https://doi.org/10.1145/3018610.3018613.
  4. Brian E. Aydemir, Aaron Bohannon, Matthew Fairbairn, J. Nathan Foster, Benjamin C. Pierce, Peter Sewell, Dimitrios Vytiniotis, Geoffrey Washburn, Stephanie Weirich, and Steve Zdancewic. Mechanized metatheory for the masses: The poplmark challenge. In Joe Hurd and Thomas F. Melham, editors, Theorem Proving in Higher Order Logics, 18th International Conference, TPHOLs 2005, Oxford, UK, August 22-25, 2005, Proceedings, volume 3603 of Lecture Notes in Computer Science, pages 50-65. Springer, 2005. URL: https://doi.org/10.1007/11541868_4.
  5. Henk Barendregt and Kees Hemerik. Types in lambda calculi and programming languages. In Neil D. Jones, editor, ESOP'90, 3rd European Symposium on Programming, Copenhagen, Denmark, May 15-18, 1990, Proceedings, volume 432 of Lecture Notes in Computer Science, pages 1-35. Springer, 1990. URL: https://doi.org/10.1007/3-540-52592-0_53.
  6. Nick Benton, Chung-Kil Hur, Andrew Kennedy, and Conor McBride. Strongly typed term representations in coq. J. Autom. Reason., 49(2):141-159, 2012. URL: https://doi.org/10.1007/s10817-011-9219-0.
  7. S Berardi. Towards a mathematical analysis of the coquand-huet calculus of constructions and the other systems in barendregt’s cube. dept. Computer Science, Carnegie-Mellon University and Dipartimento Matematica, Universita di Torino, Italy, 1988. Google Scholar
  8. Arthur Charguéraud. The locally nameless representation. J. Autom. Reason., 49(3):363-408, 2012. URL: https://doi.org/10.1007/S10817-011-9225-2.
  9. Adam Chlipala. Parametric higher-order abstract syntax for mechanized semantics. In James Hook and Peter Thiemann, editors, Proceeding of the 13th ACM SIGPLAN international conference on Functional programming, ICFP 2008, Victoria, BC, Canada, September 20-28, 2008, pages 143-156. ACM, 2008. URL: https://doi.org/10.1145/1411204.1411226.
  10. Nicolaas Govert De Bruijn. Lambda calculus notation with nameless dummies, a tool for automatic formula manipulation, with application to the church-rosser theorem. In Indagationes Mathematicae (Proceedings), volume 75, pages 381-392. Elsevier, 1972. Google Scholar
  11. Stephen Dolan and Leo White. Syntax with shifted names. In TyDe Workshop, 2019. URL: http://tydeworkshop.org/2019-abstracts/paper16.pdf.
  12. Mark P. Jones. Type classes with functional dependencies. In Gert Smolka, editor, Programming Languages and Systems, 9th European Symposium on Programming, ESOP 2000, Held as Part of the European Joint Conferences on the Theory and Practice of Software, ETAPS 2000, Berlin, Germany, March 25 - April 2, 2000, Proceedings, volume 1782 of Lecture Notes in Computer Science, pages 230-244. Springer, 2000. URL: https://doi.org/10.1007/3-540-46425-5_15.
  13. Steven Keuchel, Stephanie Weirich, and Tom Schrijvers. Needle & knot: Binder boilerplate tied up. In Peter Thiemann, editor, 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, volume 9632 of Lecture Notes in Computer Science, pages 419-445. Springer, 2016. URL: https://doi.org/10.1007/978-3-662-49498-1_17.
  14. Daniel R. Licata, Michael Shulman, and Mitchell Riley. A fibrational framework for substructural and modal logics. In Dale Miller, editor, 2nd International Conference on Formal Structures for Computation and Deduction, FSCD 2017, September 3-9, 2017, Oxford, UK, volume 84 of LIPIcs, pages 25:1-25:22. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2017. URL: https://doi.org/10.4230/LIPICS.FSCD.2017.25.
  15. Conor McBride. Type-preserving renaming and substitution. Unpublished manuscript, 2005. URL: http://strictlypositive.org/ren-sub.pdf.
  16. Conor McBride. Everybody’s got to be somewhere. In Robert Atkey and Sam Lindley, editors, Proceedings of the 7th Workshop on Mathematically Structured Functional Programming, MSFP@FSCD 2018, Oxford, UK, 8th July 2018, volume 275 of EPTCS, pages 53-69, 2018. URL: https://doi.org/10.4204/EPTCS.275.6.
  17. James McKinna and Robert Pollack. Pure type systems formalized. In Marc Bezem and Jan Friso Groote, editors, Typed Lambda Calculi and Applications, International Conference on Typed Lambda Calculi and Applications, TLCA '93, Utrecht, The Netherlands, March 16-18, 1993, Proceedings, volume 664 of Lecture Notes in Computer Science, pages 289-305. Springer, 1993. URL: https://doi.org/10.1007/BFB0037113.
  18. Frank Pfenning and Conal Elliott. Higher-order abstract syntax. In Richard L. Wexelblat, editor, Proceedings of the ACM SIGPLAN'88 Conference on Programming Language Design and Implementation (PLDI), Atlanta, Georgia, USA, June 22-24, 1988, pages 199-208. ACM, 1988. URL: https://doi.org/10.1145/53990.54010.
  19. Nicolas Pouillard. Nameless, painless. In Manuel M. T. Chakravarty, Zhenjiang Hu, and Olivier Danvy, editors, Proceeding of the 16th ACM SIGPLAN international conference on Functional Programming, ICFP 2011, Tokyo, Japan, September 19-21, 2011, pages 320-332. ACM, 2011. URL: https://doi.org/10.1145/2034773.2034817.
  20. Steven Schäfer, Tobias Tebbi, and Gert Smolka. Autosubst: Reasoning with de bruijn terms and parallel substitutions. In Christian Urban and Xingyuan Zhang, editors, Interactive Theorem Proving - 6th International Conference, ITP 2015, Nanjing, China, August 24-27, 2015, Proceedings, volume 9236 of Lecture Notes in Computer Science, pages 359-374. Springer, 2015. URL: https://doi.org/10.1007/978-3-319-22102-1_24.
  21. Kathrin Stark, Steven Schäfer, and Jonas Kaiser. Autosubst 2: reasoning with multi-sorted de bruijn terms and vector substitutions. In Assia Mahboubi and Magnus O. Myreen, editors, Proceedings of the 8th ACM SIGPLAN International Conference on Certified Programs and Proofs, CPP 2019, Cascais, Portugal, January 14-15, 2019, pages 166-180. ACM, 2019. URL: https://doi.org/10.1145/3293880.3294101.
  22. Jan Terlouw. Een nadere bewijstheoretische analyse van gstt’s. Manuscript (in Dutch), 1989. Google Scholar
  23. Christian Urban, Andrew M. Pitts, and Murdoch Gabbay. Nominal unification. Theor. Comput. Sci., 323(1-3):473-497, 2004. URL: https://doi.org/10.1016/J.TCS.2004.06.016.
  24. Hendrik van Antwerpen, Casper Bach Poulsen, Arjen Rouvoet, and Eelco Visser. Scopes as types. Proc. ACM Program. Lang., 2(OOPSLA):114:1-114:30, 2018. URL: https://doi.org/10.1145/3276484.
  25. James Wood and Robert Atkey. A linear algebra approach to linear metatheory. In Ugo Dal Lago and Valeria de Paiva, editors, Proceedings Second Joint International Workshop on Linearity & Trends in Linear Logic and Applications, Linearity&TLLA@IJCAR-FSCD 2020, Online, 29-30 June 2020, volume 353 of EPTCS, pages 195-212, 2020. URL: https://doi.org/10.4204/EPTCS.353.10.
Questions / Remarks / Feedback
X

Feedback for Dagstuhl Publishing


Thanks for your feedback!

Feedback submitted

Could not send message

Please try again later or send an E-mail