Hostname: page-component-8448b6f56d-cfpbc Total loading time: 0 Render date: 2024-04-17T06:22:55.217Z Has data issue: false hasContentIssue false

de Bruijn notation as a nested datatype

Published online by Cambridge University Press:  01 January 1999

RICHARD S. BIRD
Affiliation:
Programming Research Group, Oxford University, Wolfson Building, Parks Road, Oxford OX1 3QD, UK
ROSS PATERSON
Affiliation:
Department of Computer Science, City University, Northampton Square, London EC1V 0HB, UK
Rights & Permissions [Opens in a new window]

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

“I have no data yet. It is a capital mistake to theorise before one has data.” Sir Arthur Conan Doyle The Adventures of Sherlock Holmes

de Bruijn notation is a coding of lambda terms in which each occurrence of a bound variable x is replaced by a natural number, indicating the ‘distance’ from the occurrence to the abstraction that introduced x. One might suppose that in any datatype for representing de Bruijn terms, the distance restriction on numbers would have to be maintained as an explicit datatype invariant. However, by using a nested (or non-regular) datatype, we can define a representation in which all terms are well-formed, so that the invariant is enforced automatically by the type system. Programming with nested types is only a little more difficult than programming with regular types, provided we stick to well-established structuring techniques. These involve expressing inductively defined functions in terms of an appropriate fold function for the type, and using fusion laws to establish their properties. In particular, the definition of lambda abstraction and beta reduction is particularly simple, and the proof of their associated properties is entirely mechanical.

Type
Research Article
Copyright
© 1999 Cambridge University Press
Supplementary material: Link

Bird Supplementary Material

Link
Submit a response

Discussions

No Discussions have been published for this article.