### BibTeX

@MISC{Xi99dependentlytyped,

author = {Hongwei Xi},

title = {Dependently Typed Data Structures },

year = {1999}

}

### OpenURL

### Abstract

The mechanism for declaring datatypes in functional programming languages such as ML and Haskell is of great use in practice. This mechanism, however, often suffers from its imprecision in capturing the invariants inherent in data structures. We remedy the situation with the introduction of dependent datatypes so that we can model data structures with significantly more accuracy. We present a few interesting examples such as implementations of red-black trees and binomial heaps to illustrate the use of dependent datatypes in capturing some sophisticated invariants in data structures. We claim that dependent datatypes can enable the programmer to implement algorithms in a way that is more robust and easier to understand.

### Citations

1626 | The Definition of Standard ML - Milner, Tofte, et al. - 1990 |

320 | Lambda-calculus notation with nameless dummies: a tool for automatic formula manipulation with application to the Church-Rosser theorem - Bruijn - 1972 |

300 | Dependent types in practical programming
- Xi, Pfenning
- 1999
(Show Context)
Citation Context ...evidently a desirable feature in programming if it can be made practical. The need for forming more accurate datatypes partially motivated the development of Dependent ML (DML) (Xi and Pfenning 1999; =-=Xi 1998-=-), which enriches ML with a restricted form of dependent types. More precisely, DML is a language schema. Given a constraint domain C, DML(C) is the language in the schema where all type index express... |

243 | Purely Functional Data Structures
- Okasaki
- 1998
(Show Context)
Citation Context ...e some concrete examples for the reader to judge this claim, including implementations of red-black trees and binomial heaps. Both of these implementations are adopted from the corresponding ones in (=-=Okasaki 1998-=-). The implementations in de Caml have several advantages over the original ones. We have verified more invariants in the de Caml implementations. For instance, it is verified in the type system of de... |

239 | Introduction to Algorithms - Corman - 2001 |

224 | Cayenne - a language with dependent types
- Augustsson
- 1998
(Show Context)
Citation Context ... can only handle (a minor variation) of primitive recursion. On the other hand, the use of sized types in the correctness proofs of reactive systems cannot be achieved in DML at this moment. Cayenne (=-=Augustsson 1998-=-) is a Haskell-like language in which fully dependent types are available, that is, language expressions can be used as type index objects. The type system of Cayenne is (much) more expressive than th... |

215 | PVS: Combining specification, proof checking, and model checking - Owre, Rajan, et al. - 1996 |

182 | Refinement types for ML
- Freeman, Pfenning
- 1991
(Show Context)
Citation Context ...t amenable to checking indexed types than is the case for our system and ML. When compared to traditional type systems for programming languages, perhaps the closest related work is refinement types (=-=Freeman and Pfenning 1991-=-), which also aims at expressing and checking more properties of programs that are already well-typed in ML, rather than admitting more programs as type correct, which is the goal of most other resear... |

174 | Eliminating array bound checking through dependent types
- Xi, Pfenning
- 1998
(Show Context)
Citation Context ...sent a range of values. We can use ([n:nat] int(n)) array to represent the type for the vectors whose elements are natural numbers. This is very useful for eliminating array bound checks at run-time (=-=Xi and Pfenning 1998-=-). In general, we view that the use of existential types in de Caml for handling functions like filter is crucial to the scalability of the type system of de Caml since such functions are abundant in ... |

131 | Proving the Correctness of Reactive Systems Using Sized Types - Hughes, Pareto, et al. - 1996 |

84 | Nested datatypes
- Bird, Meertens
- 1998
(Show Context)
Citation Context ...ml-light intact. It also modifies many library functions in Caml-light, assigning to them more accurate types. 1An alternative approach to forming more accurate datatypes is to use nested datatypes (=-=Bird and Meertens 1998-=-). For instance, a nested datatype can be readily formed to precisely represent red-black trees. However, there exist various significant differences between DML-style dependent types and nested datat... |

72 | De Bruijn notation as a nested datatype - Bird, Paterson - 1999 |

57 | Constable et.al. Implementing Mathematics with the Nuprl Proof Development System - Robert - 1986 |

47 | Functional unparsing
- Danvy
- 1998
(Show Context)
Citation Context ...d. We feel that the design of Cayenne pays greater attention to making more programs typable than assigning programs more accurate types. In Cayenne, the printf in C, which is not typable in ML (see (=-=Danvy 1998-=-) for further details), can be made typable and modules can be replaced with records, but the notion of dependent datatypes does not exist. This clearly separates the design of DML from that of Cayenn... |

46 | The Coq proof assistant user's guide, Rapport Techniques 154 - Dowek, Felty, et al. - 1993 |

30 |
Indexed types
- Zenger
- 1997
(Show Context)
Citation Context ...e chosen. Most closely related to our work is the system of indexed types developed independently by Zenger in his forthcoming Ph.D. Thesis (Zenger 1998) (an earlier version of which is described in (=-=Zenger 1997-=-)). He works in the context of of lazy functional programming. His language is clean and elegant and his applications (which significantly overlap with ours) are compelling. In general, his approach s... |

29 | From fast exponentiation to square matrices: an adventure in types
- Okasaki
- 1999
(Show Context)
Citation Context ...atatypes (Bird and Meertens 1998) in constructing (sophisticated) datatypes to capture more invariants in data structures. For instance, a variety of examples can be found in (Bird and Paterson pear; =-=Okasaki 1999-=-; Hinze 1998; Hinze 1999b; Hinze 1999a). We feel that the advantage of this approach is that it requires relatively minor language extensions, which may include polymorphic recursion, higher-order kin... |

27 | et al. Haskell 98: A non-strict, purely functional language - Jones, Hughes - 1999 |

24 | Manufacturing datatypes
- Hinze
- 2001
(Show Context)
Citation Context ...s 1998) in constructing (sophisticated) datatypes to capture more invariants in data structures. For instance, a variety of examples can be found in (Bird and Paterson pear; Okasaki 1999; Hinze 1998; =-=Hinze 1999-=-b; Hinze 1999a). We feel that the advantage of this approach is that it requires relatively minor language extensions, which may include polymorphic recursion, higher-order kinds, rank-2 polymorphism,... |

23 | Indizierte Typen - Zenger - 1998 |

18 | Introduction to algorithms - H, E, et al. - 1999 |

9 | Constructing Red-Black Trees
- Hinze
- 1999
(Show Context)
Citation Context ...s 1998) in constructing (sophisticated) datatypes to capture more invariants in data structures. For instance, a variety of examples can be found in (Bird and Paterson pear; Okasaki 1999; Hinze 1998; =-=Hinze 1999-=-b; Hinze 1999a). We feel that the advantage of this approach is that it requires relatively minor language extensions, which may include polymorphic recursion, higher-order kinds, rank-2 polymorphism,... |

6 | Practical refinement-type checking. Thesis Proposal - Davies - 1997 |

5 |
An excercise in dependent types: A well-typed interpreter. Available at http://www.cs.chalmers.se/~augustss/cayenne/interp.ps
- Augustsson, Carlsson
- 1999
(Show Context)
Citation Context ... dependent datatypes does not exist. This clearly separates the design of DML from that of Cayenne. We point out that an interpreter example in Cayenne that uses dependent types can also be found in (=-=Augustsson and Carlsson 1999-=-). There have been many recent studies on the use of nested datatypes (Bird and Meertens 1998) in constructing (sophisticated) datatypes to capture more invariants in data structures. For instance, a ... |

5 | Some Practical Aspects of Dependent Datatypes. Available as http://www.ececs.uc.edu/~hwxi/academic/papers/PADD.ps
- Xi
- 1999
(Show Context)
Citation Context ...ode in Figure 6 must be thus expanded in order to pass typechecking in de Caml. Though this can be fixed straightforwardly, it is currently unclear what method can solve the problem best. Please see (=-=Xi 1999-=-a) for a proposed approach, which is already available in a prototype implementation in DML. The complete implementation of the insertion operation follows immediately. Notice that the type of functio... |

2 |
A logarithmic implementation of fexible arrays
- Braun, Rem
- 1983
(Show Context)
Citation Context ...im we make is that dependent datatypes can enable the programmer to implement algorithms in a way that is more robust and easier to understand. 4.1 Braun Trees A Braun tree is a balanced binary tree (=-=Braun and Rem 1983-=-) such that for every branch node in the tree, its left subtree is either the same size as its right subtree, or contains one more element. Braun trees can be used to give neat implementations for fle... |

2 |
Numerical Representations as Higher-Order Nested Types
- Hinze
- 1998
(Show Context)
Citation Context ... and Meertens 1998) in constructing (sophisticated) datatypes to capture more invariants in data structures. For instance, a variety of examples can be found in (Bird and Paterson pear; Okasaki 1999; =-=Hinze 1998-=-; Hinze 1999b; Hinze 1999a). We feel that the advantage of this approach is that it requires relatively minor language extensions, which may include polymorphic recursion, higher-order kinds, rank-2 p... |

2 |
Three Algorithms on Braun Trees by Chris Okasaki
- Okasaki
- 1997
(Show Context)
Citation Context ...he tree, its left subtree is either the same size as its right subtree, or contains one more element. Braun trees can be used to give neat implementations for flexible arrays and priority queues. In (=-=Okasaki 1997-=-), there is an algorithm which computes the size of a Braun tree in O(log 2 n) time, where n is the size of the Braun tree. We implement this algorithm in Figure 2. We first declare a dependent dataty... |

1 |
Some programming examples in de Caml. Available at http://www.ececs.uc.edu/~hwxi/DML/deCaml/examples
- Xi
- 1999
(Show Context)
Citation Context ...ode in Figure 6 must be thus expanded in order to pass typechecking in de Caml. Though this can be fixed straightforwardly, it is currently unclear what method can solve the problem best. Please see (=-=Xi 1999-=-a) for a proposed approach, which is already available in a prototype implementation in DML. The complete implementation of the insertion operation follows immediately. Notice that the type of functio... |