Beyond Notations: Hygienic Macro Expansion for Theorem Proving Languages

01/28/2020
by   Sebastian Ullrich, et al.
0

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.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
02/14/2020

Implementing a Language for Distributed Systems: Choices and Experiences with Type Level and Macro Programming in Scala

Multitier programming languages reduce the complexity of developing dist...
research
01/13/2020

Tabled Typeclass Resolution

Typeclasses provide an elegant and effective way of managing ad-hoc poly...
research
08/03/2020

GPP, the Generic Preprocessor

In computer science, a preprocessor (or macro processor) is a tool that ...
research
11/12/2019

Aplib: Tactical Programming of Intelligent Agents

This paper presents aplib, a Java library for programming intelligent ag...
research
10/23/2020

Adding Interactive Visual Syntax to Textual Code

Many programming problems call for turning geometrical thoughts into cod...
research
04/08/2021

A Proposal for an Interactive Shell Based on a Typed Lambda Calculus

This paper presents Favalon, a functional programming language built on ...
research
07/22/2021

MPIs Language Bindings are Holding MPI Back

Over the past two decades, C++ has been adopted as a major HPC language ...

Please sign up or login with your details

Forgot password? Click here to reset