Advertisement

Needle & Knot: Binder Boilerplate Tied Up

  • Steven KeuchelEmail author
  • Stephanie Weirich
  • Tom Schrijvers
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9632)

Abstract

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 40 % 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.

Keywords

Specification Language Abstract Syntax Variable Binding Type Soundness Variable Constructor 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Notes

Acknowledgements

Thanks to the anonymous reviewers for helping to improve the presentation. This work has been funded by the Transatlantic partnership for Excellence in Engineering (TEE) and by the Flemish Fund for Scientific Research (FWO).

References

  1. 1.
    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)CrossRefGoogle Scholar
  2. 2.
    Altenkirch, T., Morris, P.: Indexed containers. In: LICS 2009, pp. 277–285 (2009)Google Scholar
  3. 3.
    Altenkirch, T., Chapman, J., Uustalu, T.: Monads need not be endofunctors. In: Ong, L. (ed.) FOSSACS 2010. LNCS, vol. 6014, pp. 297–311. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  4. 4.
    Altenkirch, T., Chapman, J., Uustalu, T.: Relative monads formalised. J. Formalized Reasoning 7(1), 1–43 (2014). http://jfr.unibo.it/article/view/4389. ISSN: 1972-5787MathSciNetGoogle Scholar
  5. 5.
    Altenkirch, T., Reus, B.: Monadic presentations of lambda terms using generalized inductive types. In: Flum, J., Rodríguez-Artalejo, M. (eds.) CSL 1999. LNCS, vol. 1683, pp. 453–468. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  6. 6.
    Aydemir, B., Charguéraud, A., Pierce, B.C., Pollack, R., Weirich, S.: Engineering formal metatheory. In: POPL 2008. ACM (2008)Google Scholar
  7. 7.
    Aydemir, B., Weirich, S.: LNgen: Tool support for locally nameless representations. Technical report, UPenn (2010)Google Scholar
  8. 8.
    Backhouse, R., Jansson, P., Jeuring, J., Meertens, L.: Generic programming. In: Swierstra, S.D., Oliveira, J.N. (eds.) AFP 1998. LNCS, vol. 1608, pp. 28–115. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  9. 9.
    de Bruijn, N.: Lambda calculus notation with nameless dummies, a tool for automatic formula manipulation, with application to the church-rosser theorem. Indagationes Math. (Proc.) 75(5), 381–392 (1972)MathSciNetCrossRefzbMATHGoogle Scholar
  10. 10.
    de Bruijn, N.G.: Telescopic mappings in typed lambda calculus. Inf. Comput. 91(2), 189–204 (1991). doi: 10.1016/0890-5401(91)90066-B. http://www.sciencedirect.com/science/article/pii/089054019190066B MathSciNetCrossRefzbMATHGoogle Scholar
  11. 11.
    Charguéraud, A.: http://www.chargueraud.org/softs/ln/ (Accessed 02 July 2015)
  12. 12.
    Gacek, A.: The abella interactive theorem prover (system description). In: Armando, A., Baumgartner, P., Dowek, G. (eds.) IJCAR 2008. LNCS (LNAI), vol. 5195, pp. 154–161. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  13. 13.
    Gambino, N., Hyland, M.: Wellfounded trees and dependent polynomial functors. In: Berardi, S., Coppo, M., Damiani, F. (eds.) TYPES 2003. LNCS, vol. 3085, pp. 210–225. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  14. 14.
    Jaskelioff, M., Rypacek, O.: An investigation of the laws of traversals. In: MSFP 2012, pp. 40–49 (2012)Google Scholar
  15. 15.
    Keuchel, S., Jeuring, J.T.: Generic conversions of abstract syntax representations. In: WGP 2012. ACM (2012)Google Scholar
  16. 16.
    Knuth, D.E.: Semantics of context-free languages. Math. Syst. Theor. 2(2), 127–145 (1968)MathSciNetCrossRefzbMATHGoogle Scholar
  17. 17.
    Lee, D.K., Crary, K., Harper, R.: Towards a mechanized metatheory of standard ml, pp. 173–184. POPL 2007. ACM (2007)Google Scholar
  18. 18.
    Lee, G., Oliveira, B.C.D.S., Cho, S., Yi, K.: GMeta: a generic formal metatheory framework for first-order representations. In: Seidl, H. (ed.) Programming Languages and Systems. LNCS, vol. 7211, pp. 436–455. Springer, Heidelberg (2012)CrossRefGoogle Scholar
  19. 19.
    Moggi, E., Bell, G., Jay, C.: Monads, shapely functors and traversals. ENTCS 29, CTCS 1999, pp. 187–208 (1999)Google Scholar
  20. 20.
    Momigliano, A., Martin, A.J., Felty, A.P.: Two-level hybrid: a system for reasoning using higher-order abstract syntax. In: ENTCS (2008)Google Scholar
  21. 21.
    Neron, P., Tolmach, A., Visser, E., Wachsmuth, G.: A theory of name resolution. In: Vitek, J. (ed.) ESOP 2015. LNCS, vol. 9032, pp. 205–231. Springer, Heidelberg (2015)CrossRefGoogle Scholar
  22. 22.
    Pfenning, F., Schürmann, C.: System description: twelf - a meta-logical framework for deductive systems. In: Ganzinger, H. (ed.) CADE 1999. LNCS (LNAI), vol. 1632, pp. 202–206. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  23. 23.
    Pientka, B., Dunfield, J.: Programming with proofs and explicit contexts, pp. 163–173. PPDP 2008. ACM (2008)Google Scholar
  24. 24.
    Pientka, B., Dunfield, J.: Beluga: a framework for programming and reasoning with deductive systems (system description). In: Giesl, J., Hähnle, R. (eds.) IJCAR 2010. LNCS, vol. 6173, pp. 15–21. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  25. 25.
    Pierce, B.C.: Types and Programming Languages. MIT Press, Cambridge (2002)zbMATHGoogle Scholar
  26. 26.
    Pierce, B.C.: Advanced Topics in Types and Programming Languages. MIT Press, Cambridge (2005)zbMATHGoogle Scholar
  27. 27.
    Polonowski, E.: Automatically generated infrastructure for de bruijn syntaxes. In: Blazy, S., Paulin-Mohring, C., Pichardie, D. (eds.) ITP 2013. LNCS, vol. 7998, pp. 402–417. Springer, Heidelberg (2013)CrossRefGoogle Scholar
  28. 28.
    Pottier, F.: An overview of C\(\upalpha \)ml. Electron. Notes Theoret. Comput. Sci. 148(2), 27–52 (2006). doi: 10.1016/j.entcs.2005.11.039. http://www.sciencedirect.com/science/article/pii/S1571066106001253. ISSN: 1571-0661CrossRefGoogle Scholar
  29. 29.
    The Twelf Project: The Twelf Wiki. http://twelf.org/wiki (Accessed: 14 October 2015)
  30. 30.
    Rossberg, A., Russo, C.V., Dreyer, D.: F-ing modules. In: TLDI 2010. ACM (2010)Google Scholar
  31. 31.
    Sabry, A., Felleisen, M.: Reasoning about programs in continuation-passing style. LSC 6(3–4), 289–360 (1993)Google Scholar
  32. 32.
    Schäfer, S., Tebbi, T., Smolka, G.: Autosubst: reasoning with de bruijn terms and parallel substitutions. In: Zhang, X., Urban, C. (eds.) ITP 2015. Lecture Notes in Computer Science, vol. 9236, pp. 359–374. Springer, Heidelberg (2015)Google Scholar
  33. 33.
    Sewell, P., Nardelli, F.Z., Owens, S., Peskine, G., Ridge, T., Sarkar, S., Strniša, R.: Ott: effective tool support for the working semanticist. JFP 20(1), 71–122 (2010)zbMATHGoogle Scholar
  34. 34.
    Stansifer, P., Wand, M.: Romeo: a system for more flexible binding-safe programming. In: ICFP 2014, pp. 53–65. ACM (2014)Google Scholar
  35. 35.
    Urban, C., Kaliszyk, C.: General bindings and alpha-equivalence in nominal Isabelle. In: Barthe, G. (ed.) ESOP 2011. LNCS, vol. 6602, pp. 480–500. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  36. 36.
    Urban, C., Tasson, C.: Nominal techniques in Isabelle/HOL. In: Nieuwenhuis, R. (ed.) CADE 2005. LNCS (LNAI), vol. 3632, pp. 38–53. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  37. 37.
    Van Antwerpen, H., Néron, P., Tolmach, A., Visser, E., Wachsmuth, G.: A Constraint Language for Static Semantic Analysis based on Scope Graphs. Technical report, TU Delft (2015)Google Scholar
  38. 38.
    Virga, R.: Higher-order rewriting with dependent types. Ph.D. thesis, Carnegie Mellon University Pittsburgh, PA (1999)Google Scholar
  39. 39.
    Vouillon, J.: A solution to the poplmark challenge based on de bruijn indices. JAR 49(3), 327–362 (2012)MathSciNetCrossRefzbMATHGoogle Scholar
  40. 40.
    Watkins, K., Cervesato, I., Pfenning, F., Walker, D.W.: A concurrent logical framework: the propositional fragment. In: Berardi, S., Coppo, M., Damiani, F. (eds.) TYPES 2003. LNCS, vol. 3085, pp. 355–377. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  41. 41.
    Weirich, S., Yorgey, B.A., Sheard, T.: Binders unbound. In: ICFP 2011. ACM (2011)Google Scholar
  42. 42.
    Wright, A., Felleisen, M.: A syntactic approach to type soundness. Inf. Comput. 115(1), 38–94 (1994)MathSciNetCrossRefzbMATHGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2016

Authors and Affiliations

  • Steven Keuchel
    • 1
    Email author
  • Stephanie Weirich
    • 2
  • Tom Schrijvers
    • 3
  1. 1.Ghent UniversityGhentBelgium
  2. 2.University of PennsylvaniaPhiladelphiaUSA
  3. 3.KU LeuvenLeuvenBelgium

Personalised recommendations