## A Semantic Account of Type-Directed Partial Evaluation (1999)

Venue: | In Gopalan Nadathur, editor, International Conference on Principles and Practice of Declarative Programming, number 1702 in Lecture |

Citations: | 25 - 2 self |

### BibTeX

@INPROCEEDINGS{Filinski99asemantic,

author = {Andrzej Filinski},

title = {A Semantic Account of Type-Directed Partial Evaluation},

booktitle = {In Gopalan Nadathur, editor, International Conference on Principles and Practice of Declarative Programming, number 1702 in Lecture},

year = {1999},

pages = {378--395},

publisher = {Springer-Verlag}

}

### Years of Citing Articles

### OpenURL

### Abstract

We formally characterize partial evaluation of functional programs as a normalization problem in an equational theory, and derive a type-based normalization-by-evaluation algorithm for computing normal forms in this setting. We then establish the correctness of this algorithm using a semantic argument based on Kripke logical relations. For simplicity, the results are stated for a nonstrict, purely functional language; but the methods are directly applicable to stating and proving correctness of type-directed partial evaluation in ML-like languages as well.

### Citations

652 |
Partial Evaluation and Automatic Program Generation
- Jones, Gomard, et al.
- 1993
(Show Context)
Citation Context ...nction as defined should still diverge for negative values of n.) To facilitate automation of the task, partial evaluation is often expressed as a two-phase process, usually referred to as o#-line PE =-=[14]-=-: 1. A binding-time annotation phase, which identifies all the operations that can be performed using just the static input. This can be done either mechanically by a binding-time analysis (often base... |

450 | Computational lambda-calculus and monads
- Moggi
- 1989
(Show Context)
Citation Context ...any dynamic e#ect. That is, instead of computing normal forms based on the strong ##-lambda-calculus, we now need a normalizationby -evaluation algorithm for Moggi's computational lambda-calculus # c =-=[15]-=-. Fortunately, much as a single residualizing interpretation of dynamic type and term constants su#ces to compute call-by-name static normal forms sound for any dynamic interpretation, it turns out th... |

401 |
LCF considered as a programming language
- Plotkin
- 1977
(Show Context)
Citation Context ...we define the partial function Eval I by Eval I (E) = n if [[E]] I # = val # n and undefined otherwise. Definition 1 (standard static language) We define a simple functional language (essentially PCF =-=[17]-=-) by taking the signature # s as follows. The base types are int and bool; the literals, #(int) = {. . . , -1, 0, 1, 2, . . . } and #(bool) = {true, false}; and the constants, +, -,s: int # int # int ... |

208 | Type-directed partial evaluation
- Danvy
(Show Context)
Citation Context ... simplicity, TDPE has been successfully used for several non-trivial examples; see Danvy's tutorial for an overview [6]. Many of these actually use the slightly more complicated call-by-value version =-=[4]-=- (see Section 5.4). Because it exploits the highly-optimized evaluation mechanism of a functional language, such a partial evaluator is typically much faster than one representing and manipulating the... |

194 | A modal analysis of staged computation
- Davies, Pfenning
- 2001
(Show Context)
Citation Context ...ontext of TDPE. Second, it would be interesting to investigate how TDPE relates to more general work on linguistic support for staged computation, especially recent developments based on modal logics =-=[9, 16]-=-. For example, it might be possible to generalize the notion of static normalization to such settings, and consider normalization-by-evaluation algorithms for type systems more expressive than simple ... |

132 | Representing monads
- Filinski
(Show Context)
Citation Context ...lation in Section 4.2. Moreover, we can still construct the corresponding residualizing realization # r , as long as our programming language contains Scheme-style first-class continuations and state =-=[10]-=-. Incidentally, this construction also allows disjoint-union types (sums) to be naturally added to the language. The details are still under investigation, however, and will be reported in a forthcomi... |

62 | Program extraction from normalization proofs
- Berger
- 1993
(Show Context)
Citation Context ...r the case without static constants, essentially the same algorithm can actually be extracted directly from the standard (syntactic) proof of strong normalization for the simply typed lambda-calculus =-=[1]-=-; but it is not clear if this approach can be extended to a richer programming-language setting. Instead, our proof uses the technique of semantic logical relations, structured similarly to Gomard and... |

50 |
An inverse of the evaluation functional for typed -calculus
- Berger, Schwichtenberg
- 1991
(Show Context)
Citation Context ...ons as their inputs become known. What makes this approach attractive is the technique of "reduction-free normalization" or "normalization by evaluation", already known from logic =-=and category theory [2, 3, 7]-=-. A few challenges arise, however, with extending these results to a programming-language setting. Most notably: . Interpreted base types and their associated static operations. These need to be prope... |

45 | Intuitionistic model constructions and normalization proofs
- Coquand, Dybjer
- 1997
(Show Context)
Citation Context ...ons as their inputs become known. What makes this approach attractive is the technique of "reduction-free normalization" or "normalization by evaluation", already known from logic =-=and category theory [2, 3, 7]-=-. A few challenges arise, however, with extending these results to a programming-language setting. Most notably: . Interpreted base types and their associated static operations. These need to be prope... |

42 | Encoding types in ML-Like languages
- Yang
(Show Context)
Citation Context ...ypable terms base : tdpe(int #exp) arrow : ##, #. tdpe(#)tdpe(#)#tdpe(###) , 12 with which we can then systematically construct the required value. The technique is explained in more detail elsewhere =-=[18]-=-. Finally, the dynamic polymorphic constants (e.g., fix) now take explicit representations of the types at which they are being instantiated as extra arguments. In the evaluating realization, these ex... |

33 | T.: An idealized MetaML: Simpler, and more expressive
- Moggi, Taha, et al.
- 1999
(Show Context)
Citation Context ...ontext of TDPE. Second, it would be interesting to investigate how TDPE relates to more general work on linguistic support for staged computation, especially recent developments based on modal logics =-=[9, 16]-=-. For example, it might be possible to generalize the notion of static normalization to such settings, and consider normalization-by-evaluation algorithms for type systems more expressive than simple ... |

30 |
Handwriting cogen to avoid problems with static typing
- Holst, Launchbury
- 1991
(Show Context)
Citation Context ... #sE # . This TDPE is clearly computable; we will show in Section 4 that it is indeed a complete static-normalization function. Note that we can view TDPE an instance of "cogen-based specializati=-=on " [13], in which-=- a "compiler generator" is used to syntactically transform a (binding-time annotated) program # p : S D#R into its generating extension # p + : S #exp, with the property that for any s : S, ... |

24 | Semantics-based compiling: A case study in typedirected partial evaluation
- Danvy, Vestergaard
- 1996
(Show Context)
Citation Context ... (including conditionals, fixed points, etc.), we can instantiate this signature with either the runtime realization, yielding an interpreter, or with the residualizing signature, yielding a compiler =-=[8, 11]-=-. Amusingly, the specializer does not even need the actual text of the specification, only its representation as an already compiled module. 4 Showing Correctness In this section, we sketch a correctn... |

20 | Modular Compilers Based on Monad Transformers
- Harrison, Kamin
- 1998
(Show Context)
Citation Context ... (including conditionals, fixed points, etc.), we can instantiate this signature with either the runtime realization, yielding an interpreter, or with the residualizing signature, yielding a compiler =-=[8, 11]-=-. Amusingly, the specializer does not even need the actual text of the specification, only its representation as an already compiled module. 4 Showing Correctness In this section, we sketch a correctn... |

5 |
Type-directed partial evaluation. Lecture Notes BRICS
- Danvy
- 1998
(Show Context)
Citation Context ... corresponding triples for # 1 , . . . , # n . 3.4 Applications Despite its apparent simplicity, TDPE has been successfully used for several non-trivial examples; see Danvy's tutorial for an overview =-=[6]-=-. Many of these actually use the slightly more complicated call-by-value version [4] (see Section 5.4). Because it exploits the highly-optimized evaluation mechanism of a functional language, such a p... |

2 |
Two flavors of o#ine partial evaluation
- Helsen, Thiemann
- 1998
(Show Context)
Citation Context ...ith the property that for any s : S, Eval(p + s) = # p s # . That is, we e#ectively take p + = #s S . reify D#R (#d D{# r } . p{# r }(s, d))0 . TDPE shares the general high e#ciency of cogen-based PE =-=[12]-=-. Formulating the task in terms of static normalization over a binding-time separated signature, however, permits a very precise yet concise syntactic characterization of the specialized program p s .... |