Needle & Knot: Binder Boilerplate Tied Up

To lighten the burden of programming language mechanization, many approaches have been developed that tackle the substantial boilerplate which arises from variable binders. Unfortunately, the existing approaches are limited in scope. They typically do not support complex binding forms such as multi-binders that arise in more advanced languages, or they do not tackle the boilerplate due to mentioning variables and binders in relations. As a consequence, the human mechanizer is still unnecessarily burdened with binder boilerplate and discouraged from taking on richer languages. This paper presents Knot, a new approach that substantially extends the support for binder boilerplate. Knot is a highly expressive language for natural and concise specification of syntax with binders. Its meta-theory constructively guarantees the coverage of a considerable amount of binder boilerplate for well-formed specifications, including that for well-scoping of terms and context lookups. Knot also comes with a code generator, Needle, that specializes the generic boilerplate for convenient embedding in Coq and provides a tactic library for automatically discharging proof obligations that frequently come up in proofs of weakening and substitution lemmas of type-systems. Our evaluation shows, that Needle & Knot significantly reduce the size of language mechanizations by 40i¾?% in our case study. Moreover, as far as we know, Knot enables the most concise mechanization of the POPLmark Challenge 1a + 2a and is two-thirds the size of the next smallest. Finally, Knot allows us to mechanize for instance dependently-typed languages, which is notoriously challenging because of dependent contexts and mutually-recursive sorts with variables.

[1]  Christian Urban,et al.  Nominal Techniques in Isabelle/HOL , 2005, Journal of Automated Reasoning.

[2]  Peter Morris,et al.  Indexed Containers , 2009, 2009 24th Annual IEEE Symposium on Logic In Computer Science.

[3]  Arthur Charguéraud,et al.  Engineering formal metatheory , 2008, POPL '08.

[4]  Eelco Visser,et al.  A Theory of Name Resolution , 2015, ESOP.

[5]  C. Barry Jay,et al.  Monads, shapely functors, and traversals , 1999, CTCS.

[6]  Tom Ridge,et al.  Ott: effective tool support for the working semanticist , 2007, ICFP '07.

[7]  Matthias Felleisen,et al.  A Syntactic Approach to Type Soundness , 1994, Inf. Comput..

[8]  Amy P. Felty,et al.  Two-Level Hybrid: A System for Reasoning Using Higher-Order Abstract Syntax , 2008, Electron. Notes Theor. Comput. Sci..

[9]  Cezary Kaliszyk,et al.  General Bindings and Alpha-Equivalence in Nominal Isabelle , 2012, Log. Methods Comput. Sci..

[10]  Thorsten Altenkirch,et al.  Monads need not be endofunctors , 2010, Log. Methods Comput. Sci..

[11]  Roberto Virga,et al.  Higher-order rewriting with dependent types (lambda calculus) , 1999 .

[12]  Mitchell Wand,et al.  Romeo: A system for more flexible binding-safe programming , 2016, J. Funct. Program..

[13]  Claudio V. Russo,et al.  F-ing modules , 2014, J. Funct. Program..

[14]  Jérôme Vouillon A Solution to the PoplMark Challenge Based on de Bruijn Indices , 2011, Journal of Automated Reasoning.

[15]  M. Felleisen,et al.  Reasoning about programs in continuation-passing style , 1993 .

[16]  Brigitte Pientka,et al.  Programming with proofs and explicit contexts , 2008, PPDP '08.

[17]  David Walker,et al.  A Concurrent Logical Framework: The Propositional Fragment , 2003, TYPES.

[18]  Johan Jeuring,et al.  Generic conversions of abstract syntax representations , 2012, WGP '12.

[19]  Guido Wachsmuth,et al.  A constraint language for static semantic analysis based on scope graphs , 2015, PEPM.

[20]  Claude Kirchner,et al.  An overview of ELAN , 1998, WRLA.

[21]  Mauro Jaskelioff,et al.  An Investigation of the Laws of Traversals , 2012, MSFP.

[22]  Richard Statman,et al.  Higher-Order Rewriting with Dependent Types , 1999 .

[23]  Andrew Gacek The Abella Interactive Theorem Prover (System Description) , 2008, IJCAR.

[24]  Thorsten Altenkirch,et al.  Foundations of Software Science and Computation Structures: 6th International Conference, FOSSACS 2003 Held as Part of the Joint European Conferences on Theory and Practice of Software, ETAPS 2003 Warsaw, Poland, April 7–11, 2003 Proceedings , 2003, Lecture Notes in Computer Science.

[25]  de Ng Dick Bruijn,et al.  Telescopic Mappings in Typed Lambda Calculus , 1991, Inf. Comput..

[26]  Frank Pfenning,et al.  System Description: Twelf - A Meta-Logical Framework for Deductive Systems , 1999, CADE.

[27]  Benjamin C. Pierce,et al.  Advanced Topics In Types And Programming Languages , 2004 .

[28]  Benjamin C. Pierce,et al.  Types and programming languages: the next generation , 2003, 18th Annual IEEE Symposium of Logic in Computer Science, 2003. Proceedings..

[29]  Emmanuel Polonowski,et al.  Automatically Generated Infrastructure for De Bruijn Syntaxes , 2013, ITP.

[30]  Martin Hyland,et al.  Wellfounded Trees and Dependent Polynomial Functors , 2003, TYPES.

[31]  Gert Smolka,et al.  Autosubst: Reasoning with de Bruijn Terms and Parallel Substitutions , 2015, ITP.

[32]  Thorsten Altenkirch,et al.  Monadic Presentations of Lambda Terms Using Generalized Inductive Types , 1999, CSL.

[33]  Stephanie Weirich,et al.  Binders unbound , 2011, ICFP.

[34]  Brigitte Pientka,et al.  Beluga: A Framework for Programming and Reasoning with Deductive Systems (System Description) , 2010, IJCAR.

[35]  Donald E. Knuth,et al.  Semantics of context-free languages , 1968, Mathematical systems theory.

[36]  Bruno C. d. S. Oliveira,et al.  GMeta: A Generic Formal Metatheory Framework for First-Order Representations , 2012, ESOP.

[37]  Karl Crary,et al.  Towards a mechanized metatheory of standard ML , 2007, POPL '07.

[38]  de Ng Dick Bruijn,et al.  Lambda calculus notation with nameless dummies, a tool for automatic formula manipulation, with application to the Church-Rosser theorem , 1972 .

[39]  Thorsten Altenkirch,et al.  Relative Monads Formalised , 2014, J. Formaliz. Reason..

[40]  Stephanie Weirich,et al.  LNgen: Tool Support for Locally Nameless Representations , 2010 .

[41]  Alexander A. Stepanov,et al.  Generic Programming , 1988, ISSAC.