skip to main content
10.1145/2643135.2643146acmconferencesArticle/Chapter ViewAbstractPublication PagesppdpConference Proceedingsconference-collections
tutorial

A Type Theoretic Specification of Partial Evaluation

Published: 08 September 2014 Publication History

Abstract

We develop a type theoretic specification of offline partial evaluation for the simply-typed lambda calculus in the dependently-typed programming language Agda. We establish the correctness of the specification by proving termination, typing preservation, and semantics preservation using logical relations. Typing preservation is achieved by relying on a typed syntax representation based on De Bruijn indices for the source and the target language. The full calculus contains primitive recursion on natural numbers and higher-order lifting for function, product, and sum types.

References

[1]
M. S. Ager, O. Danvy, and H. K. Rohde. Fast partial evaluation of pattern matching in strings. ACM TOPLAS, 28(4):696--714, 2006.
[2]
K. Asai. Logical relations for call-by-value delimited continuations. In M. C. J. D. van Eekelen, editor, TFP 2005, volume 6 of Trends in Functional Programming, pages 63--78, Tallinn, Estonia, 2005. Intellect. ISBN 978-1-84150-176-5.
[3]
A. Bove, P. Dybjer, and U. Norell. A brief overview of Agda - a functional language with dependent types. In S. Berghofer, T. Nipkow, C. Urban, and M. Wenzel, editors, TPHOLs, volume 5674 of LNCS, pages 73--78, Munich, Germany, 2009. Springer. ISBN 978-3-642-03358-2.
[4]
C. Coquand. A formalised proof of the soundness and completeness of a simply typed lambda-calculus with explicit substitutions. Higher-Order and Symbolic Computation, 15(1):57--90, 2002.
[5]
O. Danvy. Type-directed partial evaluation. In POPL 1996 {27}, pages 242--257. ISBN 0-89791-769-3.
[6]
O. Danvy. Online type-directed partial evaluation. In M. Sato and Y. Toyama, editors, Proc. Third Fuji International Symposium on Functional and Logic Programming, Kyoto, Japan, Apr. 1998. World Scientific Press, Singapore.
[7]
O. Danvy and A. Filinski. Representing control: A study of the CPS transformation. Mathematical Structures in Computer Science, 2:361--391, 1992.
[8]
O. Danvy, K. Malmkjær, and J. Palsberg. The essence of eta-expansion in partial evaluation. Lisp and Symbolic Computation, 8(3):209--227, July 1995.
[9]
R. Davies. A temporal-logic approach to binding-time analysis. In Proc. 1996 IEEE Symp. on Logic in Computer Science, pages 184--195, New Brunswick, New Jersey, July 1996. IEEE Computer Society Press.
[10]
R. Davies and F. Pfenning. A modal analysis of staged computation. In POPL 1996 {27}, pages 258--270. ISBN 0-89791-769-3.
[11]
N. G. de Bruijn. Lambda calculus notation with nameless dummies, a tool for automatic formula manipulation, with application to the Church-Rosser theorem. Indag Math., 34(5):381--392, 1972.
[12]
D. Dussart, F. Henglein, and C. Mossin. Polymorphic recursion and subtype qualifications: Polymorphic binding-time analysis in polynomial time. In A. Mycroft, editor, Proc. 1995 International Static Analysis Symposium, volume 983 of LNCS, pages 118--136, Glasgow, Scotland, Sept. 1995. Springer. URL ftp://ftp.diku.dk/diku/semantics/papers/D-243.dvi.gz.
[13]
A. Filinski. A semantic account of type-directed partial evaluation. In G. Nadathur, editor, PPDP, volume 1702 of Lecture Notes in Computer Science, pages 378--395, Paris, France, Sept. 1999. Springer. ISBN 3-540-66540-4.
[14]
C. K. Gomard and N. D. Jones. A partial evaluator for the untyped lambda-calculus. J. Funct. Program., 1(1):21--70, Jan. 1991.
[15]
J. Hatcliff. Mechanically verifying the correctness of an offline partial evaluator. In S. D. Swierstra and M. Hermenegildo, editors, PLILP '95, volume 982 of LNCS, pages 279--298, Utrecht, The Netherlands, Sept. 1995. Springer. ISBN 3-540-60359-X.
[16]
J. Hatcliff, T. Æ. Mogensen, and P. Thiemann, editors. Partial Evaluation---Practice and Theory. Proceedings of the 1998 DIKU International Summerschool, volume 1706 of LNCS, Copenhagen, Denmark, 1999. Springer.
[17]
F. Henglein and C. Mossin. Polymorphic binding-time analysis. In D. Sannella, editor, Proc. 5th ESOP, volume 788 of LNCS, pages 287--301, Edinburgh, UK, Apr. 1994. Springer. ISBN 3-540-57880-3.
[18]
N. Jones, C. Gomard, and P. Sestoft. Partial Evaluation and Automatic Program Generation. Prentice-Hall, 1993. ISBN 0-13-020249-5. URL http://www.dina.kvl.dk/~sestoft/pebook/pebook.html.
[19]
J. Jørgensen. Compiler generation by partial evaluation. Master's thesis, DIKU, University of Copenhagen, 1991.
[20]
K. Kojima and A. Igarashi. Constructive linear-time temporal logic: Proof systems and Kripke semantics. Information and Computation, 209(12):1491--1503, 2011.
[21]
P. Martin-Löf. Intuitionistic Type Theory. Bibliopolis, Napoli, 1984.
[22]
J. C. Mitchell and E. Moggi. Kripke-style models for typed lambda calculus. Ann. Pure Appl. Logic, 51(1-2):99--124, 1991.
[23]
F. Nielson and H. R. Nielson. Two-Level Functional Languages, volume 34 of Cambridge Tracts in Theoretical Computer Science. Cambridge University Press, 1992.
[24]
U. Norell. Dependently typed programming in Agda. In P. W. M. Koopman, R. Plasmeijer, and S. D. Swierstra, editors, Advanced Functional Programming, volume 5832 of LNCS, pages 230--266, Heijen, The Netherlands, 2008. Springer. ISBN 978-3-642-04651-3.
[25]
F. Pfenning. Logic programming in the LF logical framework. In G. Huet and G. Plotkin, editors, Logical Frameworks, pages 149--181. Cambridge University Press, 1991.
[26]
B. C. Pierce et al. Software foundations. http://www.cis.upenn.edu/~bcpierce/sf/, July 2013.
[27]
POPL 1996. Proc. 1996 ACM Symp. POPL, St. Petersburg, FL, USA, Jan. 1996. ACM Press. ISBN 0-89791-769-3.
[28]
W. Taha. Multi-Stage Programming: Its Theory and Applications. PhD thesis, Oregon Graduate Institute of Science and Technology, Portland, Oregon, USA, July 1999.
[29]
W. Taha and M. F. Nielsen. Environment classifiers. In G. Morrisett, editor, Proc. 30th ACM Symp. POPL, pages 26--37, New Orleans, LA, USA, Jan. 2003. ACM Press. ISBN 1-58113-628-5.
[30]
M. Wand. Specifying the correctness of binding-time analysis. J. Funct. Program., 3(3):365--387, July 1993.

Cited By

View all
  • (2017)Jones-optimal partial evaluation by specialization-safe normalizationProceedings of the ACM on Programming Languages10.1145/31581022:POPL(1-28)Online publication date: 27-Dec-2017

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
PPDP '14: Proceedings of the 16th International Symposium on Principles and Practice of Declarative Programming
September 2014
288 pages
ISBN:9781450329477
DOI:10.1145/2643135
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 08 September 2014

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. dependently-typed programming
  2. partial evaluation
  3. typed metaprogramming

Qualifiers

  • Tutorial
  • Research
  • Refereed limited

Conference

PPDP '14
Sponsor:

Acceptance Rates

Overall Acceptance Rate 208 of 443 submissions, 47%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)9
  • Downloads (Last 6 weeks)1
Reflects downloads up to 27 Feb 2025

Other Metrics

Citations

Cited By

View all
  • (2017)Jones-optimal partial evaluation by specialization-safe normalizationProceedings of the ACM on Programming Languages10.1145/31581022:POPL(1-28)Online publication date: 27-Dec-2017

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media