Cargando…

Beyond Notations: Hygienic Macro Expansion for Theorem Proving Languages

In interactive theorem provers (ITPs), extensible syntax is not only crucial to lower the cognitive burden of manipulating complex mathematical objects, but plays a critical role in developing reusable abstractions in libraries. Most ITPs support such extensions in the form of restrictive “syntax su...

Descripción completa

Detalles Bibliográficos
Autores principales: Ullrich, Sebastian, de Moura, Leonardo
Formato: Online Artículo Texto
Lenguaje:English
Publicado: 2020
Materias:
Acceso en línea:https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7324063/
http://dx.doi.org/10.1007/978-3-030-51054-1_10
_version_ 1783551873430585344
author Ullrich, Sebastian
de Moura, Leonardo
author_facet Ullrich, Sebastian
de Moura, Leonardo
author_sort Ullrich, Sebastian
collection PubMed
description In interactive theorem provers (ITPs), extensible syntax is not only crucial to lower the cognitive burden of manipulating complex mathematical objects, but plays a critical role in developing reusable abstractions in libraries. Most ITPs support such extensions in the form of restrictive “syntax sugar” substitutions and other ad hoc mechanisms, which are too rudimentary to support many desirable abstractions. As a result, libraries are littered with unnecessary redundancy. Tactic languages in these systems are plagued by a seemingly unrelated issue: accidental name capture, which often produces unexpected and counterintuitive behavior. We take ideas from the Scheme family of programming languages and solve these two problems simultaneously by proposing a novel hygienic macro system custom-built for ITPs. We further describe how our approach can be extended to cover type-directed macro expansion resulting in a single, uniform system offering multiple abstraction levels that range from supporting simplest syntax sugars to elaboration of formerly baked-in syntax. We have implemented our new macro system and integrated it into the upcoming version (v4) of the Lean theorem prover. Despite its expressivity, the macro system is simple enough that it can easily be integrated into other systems. ELECTRONIC SUPPLEMENTARY MATERIAL: The online version of this chapter (10.1007/978-3-030-51054-1_10) contains supplementary material, which is available to authorized users.
format Online
Article
Text
id pubmed-7324063
institution National Center for Biotechnology Information
language English
publishDate 2020
record_format MEDLINE/PubMed
spelling pubmed-73240632020-06-30 Beyond Notations: Hygienic Macro Expansion for Theorem Proving Languages Ullrich, Sebastian de Moura, Leonardo Automated Reasoning Article In interactive theorem provers (ITPs), extensible syntax is not only crucial to lower the cognitive burden of manipulating complex mathematical objects, but plays a critical role in developing reusable abstractions in libraries. Most ITPs support such extensions in the form of restrictive “syntax sugar” substitutions and other ad hoc mechanisms, which are too rudimentary to support many desirable abstractions. As a result, libraries are littered with unnecessary redundancy. Tactic languages in these systems are plagued by a seemingly unrelated issue: accidental name capture, which often produces unexpected and counterintuitive behavior. We take ideas from the Scheme family of programming languages and solve these two problems simultaneously by proposing a novel hygienic macro system custom-built for ITPs. We further describe how our approach can be extended to cover type-directed macro expansion resulting in a single, uniform system offering multiple abstraction levels that range from supporting simplest syntax sugars to elaboration of formerly baked-in syntax. We have implemented our new macro system and integrated it into the upcoming version (v4) of the Lean theorem prover. Despite its expressivity, the macro system is simple enough that it can easily be integrated into other systems. ELECTRONIC SUPPLEMENTARY MATERIAL: The online version of this chapter (10.1007/978-3-030-51054-1_10) contains supplementary material, which is available to authorized users. 2020-06-06 /pmc/articles/PMC7324063/ http://dx.doi.org/10.1007/978-3-030-51054-1_10 Text en © Springer Nature Switzerland AG 2020 This article is made available via the PMC Open Access Subset for unrestricted research re-use and secondary analysis in any form or by any means with acknowledgement of the original source. These permissions are granted for the duration of the World Health Organization (WHO) declaration of COVID-19 as a global pandemic.
spellingShingle Article
Ullrich, Sebastian
de Moura, Leonardo
Beyond Notations: Hygienic Macro Expansion for Theorem Proving Languages
title Beyond Notations: Hygienic Macro Expansion for Theorem Proving Languages
title_full Beyond Notations: Hygienic Macro Expansion for Theorem Proving Languages
title_fullStr Beyond Notations: Hygienic Macro Expansion for Theorem Proving Languages
title_full_unstemmed Beyond Notations: Hygienic Macro Expansion for Theorem Proving Languages
title_short Beyond Notations: Hygienic Macro Expansion for Theorem Proving Languages
title_sort beyond notations: hygienic macro expansion for theorem proving languages
topic Article
url https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7324063/
http://dx.doi.org/10.1007/978-3-030-51054-1_10
work_keys_str_mv AT ullrichsebastian beyondnotationshygienicmacroexpansionfortheoremprovinglanguages
AT demouraleonardo beyondnotationshygienicmacroexpansionfortheoremprovinglanguages