Abstract
A wide range of computer programs, including compilers and theorem provers, manipulate data structures that involve names and binding. However, the design of programming idioms which allow performing these manipulations in a safe and natural style has, to a large extent, remained elusive.
In this paper, we present a novel approach to the problem. Our proposal can be viewed either as a programming language design or as a library: in fact, it is currently implemented within Agda. It provides a safe and expressive means of programming with names and binders. It is abstract enough to support multiple concrete implementations: we present one in nominal style and one in de Bruijn style. We use logical relations to prove that "well-typed programs do not mix names with different scope". We exhibit an adequate encoding of Pitts-style nominal terms into our system.
Supplemental Material
- }}Thorsten Altenkirch and Bernhard Reus. Monadic presentations of lambda terms using generalized inductive types. In Computer Science Logic, volume 1683 of Lecture Notes in Computer Science, pages 453--468. Springer, 1999. Google Scholar
Digital Library
- }}Robert Atkey. Syntax for free: representing syntax with binding using parametricity. In International Conference on Typed Lambda Calculi and Applications (TLCA), volume 5608 of Lecture Notes in Computer Science, pages 35--49. Springer, July 2009. Google Scholar
Digital Library
- }}Robert Atkey, Sam Lindley, and Jeremy Yallop. Unembedding domain-specific languages. In Haskell symposium, pages 37--48, September 2009. Google Scholar
Digital Library
- }}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 \textscPoplMark challenge. In International Conference on Theorem Proving in Higher Order Logics (TPHOLs), Lecture Notes in Computer Science. Springer, August 2005. Google Scholar
Digital Library
- }}Richard Bird and Ross Paterson. de Bruijn notation as a nested datatype. Journal of Functional Programming, 9(1):77--91, January 1999. Google Scholar
Digital Library
- }}Chiyan Chen and Hongwei Xi. Implementing typeful program transformations. In ACM Workshop on Evaluation and Semantics-Based Program Manipulation (PEPM), pages 20--28, June 2003. Google Scholar
Digital Library
- }}Adam Chlipala. A certified type-preserving compiler from lambda calculus to assembly language. In ACM Conference on Programming Language Design and Implementation (PLDI), pages 54--65, June 2007. Google Scholar
Digital Library
- }}Kevin Donnelly and Hongwei Xi. Combining higher-order abstract syntax with first-order abstract syntax in ATS. In ACM Workshop on Mechanized Reasoning about Languages with Variable Binding, pages 58--63, 2005. Google Scholar
Digital Library
- }}Louis-Julien Guillemette and Stefan Monnier. A type-preserving compiler in Haskell. In ACM International Conference on Functional Programming (ICFP), 2008. Google Scholar
Digital Library
- }}Daniel R. Licata and Robert Harper. A universe of binding and computation. In ACM International Conference on Functional Programming (ICFP), pages 123--134, September 2009. Google Scholar
Digital Library
- }}Conor McBride and Ross Paterson. Applicative programming with effects. Journal of Functional Programming, 18(1):1--13, 2008. Google Scholar
Digital Library
- }}Brigitte Pientka. A type-theoretic foundation for programming with higher-order abstract syntax and first-class substitutions. In ACM Symposium on Principles of Programming Languages (POPL), pages 371--382, January 2008. Google Scholar
Digital Library
- }}Andrew M. Pitts. Parametric polymorphism and operational equivalence. Mathematical Structures in Computer Science, 10:321--359, 2000. Google Scholar
Digital Library
- }}Andrew M. Pitts. Alpha-structural recursion and induction. Journal of the ACM, 53:459--506, 2006. Google Scholar
Digital Library
- }}Andrew M. Pitts. Nominal System T. In ACM Symposium on Principles of Programming Languages (POPL), pages 159--170, January 2010. Google Scholar
Digital Library
- }}Adam Poswolsky and Carsten Schurmann. Practical programming with higher-order encodings and dependent types. In European Symposium on Programming (ESOP), volume 4960 of Lecture Notes in Computer Science, pages 93--107. Springer, March 2008. Google Scholar
Digital Library
- }}Adam Poswolsky and Carsten Schurmann. System description: Delphin - A functional programming language for deductive systems. Electronic Notes in Theoretical Computer Science, 228:113--120, 2009. Google Scholar
Digital Library
- }}François Pottier. Static name control for FreshML. In IEEE Symposium on Logic in Computer Science (LICS), pages 356--365, July 2007. Google Scholar
Digital Library
- }}Nicolas Pouillard and François Pottier. A fresh look at programming with names and binders (Agda code), March 2010. http://tiny.nicolaspouillard.fr/FreshLookAgda. Google Scholar
Digital Library
- }}Nicolas Pouillard and François Pottier. A fresh look at programming with names and binders (extended version). http://tiny.nicolaspouillard.fr/FreshLookExt, March 2010. Google Scholar
Digital Library
- }}Carsten Schüurmann, Adam Poswolsky, and Jeffrey Sarnat. The ∇-calculus: Functional programming with higher-order encodings. In International Conference on Typed Lambda Calculi and Applications (TLCA), volume 3461 of Lecture Notes in Computer Science, pages 339--353. Springer, April 2005. Google Scholar
Digital Library
- }}Mark R. Shinwell, Andrew M. Pitts, and Murdoch J. Gabbay. FreshML: Programming with binders made simple. In ACM International Conference on Functional Programming (ICFP), pages 263--274, August 2003. Google Scholar
Digital Library
Index Terms
A fresh look at programming with names and binders
Recommendations
A fresh look at programming with names and binders
ICFP '10: Proceedings of the 15th ACM SIGPLAN international conference on Functional programmingA wide range of computer programs, including compilers and theorem provers, manipulate data structures that involve names and binding. However, the design of programming idioms which allow performing these manipulations in a safe and natural style has, ...
Programming with binders and indexed data-types
POPL '12: Proceedings of the 39th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languagesWe show how to combine a general purpose type system for an existing language with support for programming with binders and contexts by refining the type system of ML with a restricted form of dependent types where index objects are drawn from ...
Generative unbinding of names
POPL '07: Proceedings of the 34th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languagesThis paper is concerned with a programming language construct for typed name binding that enforces αequivalence. It proves a new result about what operations on names can co-exist with this construct. The particular form of typed name binding studied is ...







Comments