## Type-based termination of generic programs (2007)

### Cached

### Download Links

Venue: | Science of Computer Programming |

Citations: | 5 - 1 self |

### BibTeX

@INPROCEEDINGS{Abel07type-basedtermination,

author = {Andreas Abel},

title = {Type-based termination of generic programs},

booktitle = {Science of Computer Programming},

year = {2007}

}

### OpenURL

### Abstract

Instances of a polytypic or generic program for a concrete recursive type often exhibit a recursion scheme that is derived from the recursion scheme of the instantiation type. In practice, the programs obtained from a generic program are usually terminating, but the proof of termination cannot be carried out with traditional methods as term orderings alone, since termination often crucially relies on the program type. In this article, it is demonstrated that type-based termination using sized types handles such programs very well. A framework for sized polytypic programming is developed which ensures (typebased) termination of all instances. 1

### Citations

267 | Compiling polymorphism using intensional type analysis
- HARPER, MORRISETT
- 1995
(Show Context)
Citation Context ...rated programs. Generic programming within an intermediate language of a typed compiler has been studied under the names intensional polymorphism and intensional type analysis by Harper and Morrisett =-=[17]-=- and Crary, Weirich, and Morrisett [14]. The gist of this approach is to have a type case construct on the level of programs, in later developments even also on the level of types. This way, certain c... |

147 | Intensional polymorphism in type-erasure semantics
- CRARY, WEIRICH, et al.
- 1998
(Show Context)
Citation Context ...hin an intermediate language of a typed compiler has been studied under the names intensional polymorphism and intensional type analysis by Harper and Morrisett [17] and Crary, Weirich, and Morrisett =-=[14]-=-. The gist of this approach is to have a type case construct on the level of programs, in later developments even also on the level of types. This way, certain compiler optimizations such as untagging... |

107 | Polytypic values possess polykinded types
- Hinze
- 2002
(Show Context)
Citation Context ...till sloppy in this definition; we assume that we can reuse type variables as special term variables. Here we just want to convey the idea, later we will make the variable handling water proof. Hinze =-=[20]-=- has observed that type-indexed values poly〈F : κ〉 have kind-indexed types Poly〈F, . . . , F : κ〉 : ∗ with possibly several copies of the parameter F , obeying the following laws: Poly〈A1, . . . , An ... |

96 | A new approach to generic functional programming - Hinze - 2000 |

83 | Generic programming - An Introduction
- Backhouse, Jansson, et al.
- 1999
(Show Context)
Citation Context ..., Jeuring, and Löh [19–23]. Another philosophy of generic programming is rooted in the initial algebra semantics for data types (see the introductory text by Backhouse, Jansson, Jeuring, and Meertens =-=[7]-=-). Jansson and Jeuring [26] present PolyP, a polytypic extension for Haskell which gives more control in defining polytypic functions, for instance, “recursion” is a type constructor one can treat in ... |

82 | Nested datatypes
- Bird, Meertens
- 1998
(Show Context)
Citation Context ...is not of kind ∗ + → ∗, but, for instance, of kind (∗ + → ∗) + → (∗ + → ∗). For such an F we get an inductive constructor, or a heterogeneous data type [6], in the literature often called nested type =-=[4,11,18,31]-=-. In general, the least-fixed point constructor µκ can be used on any F : κ + → κ where κ must be a pure kind, i. e., must not mention special kind ord. Examples for heterogeneous types are: PList : o... |

80 | Flexible type analysis
- CRARY, WEIRICH
- 1999
(Show Context)
Citation Context ...evel of programs, in later developments even also on the level of types. This way, certain compiler optimizations such as untagging and unboxing can be performed in a type-safe way. Crary and Weirich =-=[13]-=- even enrich the kind language by inductive kinds and the constructor language by primitive recursion. Saha, Trifonov, and Shao [35] consider intensional analysis of polymorphism. To this end, they in... |

77 | Monadic presentations of lambda terms using generalized inductive types
- Altenkirch, Reus
- 1999
(Show Context)
Citation Context ...types of higher kind, i. e., such µ a F where F is not of kind ∗ + → ∗, but, for instance, of kind (∗ + → ∗) + → (∗ + → ∗). For such an F we get an inductive constructor, or a heterogeneous data type =-=[6]-=-, in the literature often called nested type [4,11,18,31]. In general, the least-fixed point constructor µκ can be used on any F : κ + → κ where κ must be a pure kind, i. e., must not mention special ... |

67 | Generic Haskell: Practice and theory
- Hinze, Jeuring
- 2003
(Show Context)
Citation Context ...ramming is developed which ensures (typebased) termination of all instances. 1 Introduction In the last decade, polytypic or generic programming has been explored for functional programming languages =-=[26,19,22,23]-=-. With polytypic programming, repetitive tasks, like writing a size-function for data structures of type A, can be mechanized by writing a generic size-function which then can be instantiated to all s... |

58 | Automated Termination Proofs with AProVE
- Giesl, Thiemann, et al.
- 2004
(Show Context)
Citation Context ..., as explained in the introduction (mergeList 24sdiverges on ill-typed arguments). Neither can the methods developed for higherorder term rewriting systems, as for instance bundled in the tool AProve =-=[15]-=-, be applied to the generic program, since they disregard typing. (I conducted my experiments in Fall 2005.) Related Work on Generic Programming. We have considered generic programming in the style of... |

54 | Generic programming within dependently typed programming
- Altenkirch, McBride
- 2003
(Show Context)
Citation Context ...jer, and Jansson [10] extend the approach of Pfeifer and Rueß to generic definitions over inductive families. They also restrict recursion to iteration and primitive recursion. Altenkirch and McBride =-=[5]-=- pursue a similar direction; they show that generic programming is dependently typed programming with tailored type universes. They construct a generic fold for members of the universe of Haskell type... |

43 | Type-based termination of recursive definitions
- Barthe, Frade, et al.
(Show Context)
Citation Context ...eloped by Hughes, Pareto, and Sabry [24], and independently by Giménez [16] who advanced the pioneering work of Mendler [27]. Since then, type-based termination has been considered by several authors =-=[2,8,9,12]-=-. In this work, we show that type-based termination can be successfully applied to generic programs. We build on previous work, System Fω� [1], which is an extension of type-based termination to highe... |

43 | Universes for generic programs and proofs in dependent type theory
- Benke, Dybjer, et al.
- 2003
(Show Context)
Citation Context ...o the scheme of primitive recursion or paramorphisms. This excludes many interesting generic programs we can treat, like merging of tries, that do not fit into this scheme. Benke, Dybjer, and Jansson =-=[10]-=- extend the approach of Pfeifer and Rueß to generic definitions over inductive families. They also restrict recursion to iteration and primitive recursion. Altenkirch and McBride [5] pursue a similar ... |

35 | Structural recursive definitions in Type Theory
- Giménez
- 1998
(Show Context)
Citation Context ...lishing termination which takes the type of a program into account. Such a method is type-based termination, which has been 2sdeveloped by Hughes, Pareto, and Sabry [24], and independently by Giménez =-=[16]-=- who advanced the pioneering work of Mendler [27]. Since then, type-based termination has been considered by several authors [2,8,9,12]. In this work, we show that type-based termination can be succes... |

34 | Generalizing generalized tries
- Hinze
(Show Context)
Citation Context ...ion to the termination problem of many generic programs. Email address: abel@informatik.uni-muenchen.de (Andreas Abel). Preprint submitted to Elsevier 26 September 2007sAs an example, we take Hinze’s =-=[18]-=- generic definition of finite maps. If instantiated to key type list of A, in Haskell syntax [a], we get the following definition of a finite map: data MapList f v = Leaf | Node (Maybe v) (f (MapList ... |

30 | Generic Haskell: applications
- Hinze, Jeuring
- 2003
(Show Context)
Citation Context ...ion patterns that go far beyond schemes of iteration and primitive recursion stemming from the initial algebra semantics of data types. The recursion patterns of many examples for generic programming =-=[21,22]-=- can be treated in Fω�, and I am still looking for sensible examples that exceed the capabilities of Fω�. It seems promising to pursue this approach further. In this article, we have not addressed the... |

27 |
A Polymorphic Lambda-Calculus with Sized Higher-Order Types
- Abel
- 2006
(Show Context)
Citation Context ...termination has been considered by several authors [2,8,9,12]. In this work, we show that type-based termination can be successfully applied to generic programs. We build on previous work, System Fω� =-=[1]-=-, which is an extension of type-based termination to higher-order data types. Our contribution is an adaptation of Hinze, Jeuring, and Löh’s generic programming framework [23] to sized types, includin... |

10 | Semi-continuous sized types and termination - Abel - 2008 |

7 | Practical inference for type-based termination in a polymorphic setting - Barthe, Grégoire, et al. - 2005 |

5 |
Iteration schemes for higher-order and nested datatypes, Theoretical Computer Science 333
- Abel, Matthes, et al.
- 2005
(Show Context)
Citation Context ...is not of kind ∗ + → ∗, but, for instance, of kind (∗ + → ∗) + → (∗ + → ∗). For such an F we get an inductive constructor, or a heterogeneous data type [6], in the literature often called nested type =-=[4,11,18,31]-=-. In general, the least-fixed point constructor µκ can be used on any F : κ + → κ where κ must be a pure kind, i. e., must not mention special kind ord. Examples for heterogeneous types are: PList : o... |

4 |
Decidability of type-checking in the Calculus of Algebraic Constructions with size annotations
- Blanqui
(Show Context)
Citation Context ...eloped by Hughes, Pareto, and Sabry [24], and independently by Giménez [16] who advanced the pioneering work of Mendler [27]. Since then, type-based termination has been considered by several authors =-=[2,8,9,12]-=-. In this work, we show that type-based termination can be successfully applied to generic programs. We build on previous work, System Fω� [1], which is an extension of type-based termination to highe... |

3 |
Towards generic programming with sized types
- Abel
(Show Context)
Citation Context ...of generic programs are well-typed which entails termination. More related work and directions for future research are discussed in Sect. 5. This article is an extension of my MPC’06 conference paper =-=[3]-=-. 1.1 Preliminaries We assume that the reader is familiar with the higher-order polymorphic lambdacalculus, System F ω (see Pierce’s text book [34]), or the functional programming language Haskell. Ad... |