OXFORD UNIVERSITY COMPUTING LABORATORY No longer updated! This page hasn't been updated since 2008; it's only here for historical reasons. My publication list is now generated automatically from our database; the up-to-date list is at http://www.cs.ox.ac.uk/people/publications/date/Jeremy.Gibbons.html. If you came here from a bookmark, please update it!











Jeremy Gibbons' Publications Most of my more recent publications are accessible through this page. All of these publications are copyrighted, some by me and some by publishing companies. It is a publisher's requirement to display the following notice: The documents distributed by this server have been provided by the contributing authors as a means to ensure timely dissemination of scholarly and technical work on a noncommercial basis. Copyright and all rights therein are maintained by the authors or by other copyright holders, notwithstanding that they have offered their works here electronically. It is understood that all persons copying this information will adhere to the terms and constraints invoked by each author's copyright. These works may not be reposted without the explicit permission of the copyright holder. Shortcuts: wsrfmodeling adt icegov cufp2007 cgmda parametric compatibility iterator bpmn-csp uto ifm2007 dgp ssdgp gip workflow metamorphisms-scp crosstrial hodgp iterator-msfp fission fast+loose spigot rationals hodgp-oopsla hodgp-ecoop corecursive typecase metamorphisms-mpc efolds patterns arith ssgp origami fop softeng-projects wcgp superposition acmmpc-calcfp acmmpc-optimization acmmpc semantics approx kernels pointwise naturally genda bridging radix unfold polyda spjava calculating merging conditionals thirdht dmtcs drawing quickly tracing dashed damgs nzfpdc-squiggol efficient nzfpdc-drawing linear formal accumulations ata balanced kmp unique interesting newview Or look me up on DBLP, Google Scholar or Scientific Commons! [wsrfmodeling] Tianyi Zang, Radu Calinescu, Steve Harris, Andrew Tsui, Marta Kwiatkowska, Jeremy Gibbons, Jim Davies, Peter Maccallum, and Carlos Caldas. WSRF-based modeling of clinical trial information for collaborative cancer research. In 8th IEEE International Symposium on Cluster Computing and the Grid (CCGrid08), May 2008. To appear. [ bib | .pdf ] The CancerGrid consortium is developing open-standards cancer informatics to address the challenges posed by the modern cancer clinical trials. This paper presents a service-oriented software paradigm implemented in CancerGrid to derive clinical trial information management systems for collaborative cancer research across multiple institutions. Our proposal is founded on a combination of a clinical trial (meta)model and WSRF (Web Services Resource Framework),and is currently being evaluated for use in early phase trials. Although primarily targeted at cancer research, our approach is readily applicable to other areas for which a similar information model is available. [adt] Jeremy Gibbons. Unfolding abstract datatypes. Submitted for publication, January 2008. [ bib | .pdf ] One of the most fundamental tools in the programmer's toolbox is the abstract datatype. However, abstract datatypes are not widely used in functional programming, perhaps because they are not subject to familiar proof methods such as equational reasoning and induction - in essence, because they are a form of codata rather than a form of data. We show that proof methods for corecursive programs are the appropriate techniques to use. In particular, building on established work on final coalgebra semantics for object-oriented programs, we show that the reasoning principles of unfold operators are perfectly suited for the task. We illustrate with solutions to two recent problems in the literature. [icegov] Charles Crichton, Jim Davies, Jeremy Gibbons, Steve Harris, and Aadya Shukla. Semantics frameworks for e-government. In Tomasz Janowski and Theresa Pardo, editors, First International Conference on Theory and Practice of Electronic Governance, Macau, December 2007. International Institute for Software Technology, United Nations University. [ bib | .pdf ] This paper explains how semantic frameworks can be used to support successful e-Government initiatives by connecting system design to a shared understanding of interactions and processes. It shows how metadata standards and repositories can be used to establish and maintain such an understanding, and how they can be used in the automatic generation and instantiation of components and services. It includes an account of a successful implementation at an international level, and a brief review of related approaches. [cufp2007] Jeremy Gibbons. Report on Fourth Workshop on “Commercial Users of Functional Programming”. Oxford University Computing Laboratory, December 2007. [ bib | .pdf ] The goal of the Commercial Users of Functional Programming series of workshops is “to build a community for users of functional programming languages and technology”. The fourth workshop in the series took place in Freiburg, Germany on 4th October 2007, colocated as usual with the International Conference on Functional Programming. The workshop is flourishing, having grown from an intimate gathering of 25 people in Snowbird in 2004, through 40 in Tallinn in 2005 and 57 in Portland in 2006, to 104 registered participants (and more than a handful of casual observers) this time. For the first time this year, the organisers had the encouraging dilemma of receiving more offers of presentations than would fit in the available time. The eventual schedule included an invited talk by Xavier Leroy, eleven contributed presentations, and an energetic concluding discussion. Brief summaries of each appear below. [cgmda] Radu Calinescu, Steve Harris, Jeremy Gibbons, Jim Davies, Igor Toujilov, and Sylvia Nagl. Model-driven architecture for cancer research. In Software Engineering and Formal Methods, September 2007. [ bib | .pdf ] It is a common phenomenon for research projects to collect and analyse valuable data using ad-hoc information systems. These costly-to-build systems are often composed of incompatible variants of the same modules, and record data in ways that prevent any meaningful result analysis across similar projects. We present a framework that uses a combination of formal methods, model-driven development and service-oriented architecture (SOA) technologies to automate the generation of data management systems for cancer clinical trial research, an area particularly affected by these problems. The SOA solution generated by the framework is based on an information model of a cancer clinical trial, and comprises components for both the collection and analysis of cancer research data, within and across clinical trial boundaries. While primarily targeted at cancer research, our approach is readily applicable to other areas for which a similar information model is available. [parametric] Jeremy Gibbons and Ross Paterson. Parametric datatype-genericity. Submitted for publication, July 2007. [ bib | .pdf ] Datatype-generic programs are programs that are parametrized by a datatype or type functor. There are two main styles of datatype-generic programming: the Algebra of Programming approach, characterized by structured recursion operators parametrized by a shape functor, and the Generic Haskell approach, characterized by case analysis over the structure of a datatype. We show that the former enjoys a kind of parametricity, relating the behaviours of generic functions at different types; in contrast, the latter is more ad hoc, with no coherence required or provided between the various clauses of a definition. [compatibility] Peter Y. H. Wong and Jeremy Gibbons. Verifying business process compatibility. In 3rd International Workshop on Methods and Tools for Coordinating Concurrent, Distributed and Mobile Systems (MTCoord'07), Paphos, Cyprus, June 2007. A shorter version of this paper was presented at the 2nd European Young Researchers Workshop on Service Oriented Computing, Leicester, United Kingdom, June 1997. [ bib ] Business Process Modelling Notation (BPMN), developed by the Business Process Management Initiative (BPMI), intends to bridge the gap between business process design and implementation. In this paper we describe a process-algebraic approach to verifying process interactions for business collaboration described in BPMN. We first describe briefly a process semantics for BPMN in Communicating Sequential Processes; we then use a simple example of business collaboration to demonstrate how our semantic model may be used to verify compatibility between business participants in a collaboration. [iterator] Jeremy Gibbons and Bruno C. d. S. Oliveira. The essence of the Iterator pattern. Submitted for publication, 2007. Revised (December 2007) version of [iterator-msfp]. [ bib | .pdf ] The Iterator pattern gives a clean interface for element-by-element access to a collection. Imperative iterations using the pattern have two simultaneous aspects: mapping and accumulating. Various existing functional iterations model one or other of these, but not both simultaneously. We argue that McBride and Paterson's applicative functors, and in particular the corresponding traverse operator, do exactly this, and therefore capture the essence of the Iterator pattern. We present some axioms for traversal, and illustrate with a simple example, the wordcount problem. [bpmn-csp] Peter Y.H. Wong and Jeremy Gibbons. A process semantics for BPMN. Draft, 2007. [ bib | .pdf ] Business Process Modelling Notation (BPMN), developed by the Business Process Management Initiative (BPMI), intends to bridge the gap between business process design and implementation. However, the specification of the notation does not include a formal semantics. This paper shows how a subset of the BPMN can be given a process semantics in Communicating Sequential Processes. Such a semantics allows developers to formally analyse and compare BPMN diagrams. A realistic example of a complex business process is included. [uto] Michael Anthony Smith and Jeremy Gibbons. Unifying theories of objects. In Davies and Gibbons [ifm2007], pages 599-618. [ bib | .pdf ] We present an approach to modelling Abadi-Cardelli-style object calculi as UTP designs. Here we provide a core object calculus with an operational small-step evaluation rule semantics, and a corresponding UTP model with a denotational relational predicate semantics. For clarity, the UTP model is defined in terms of an operand stack, which is used to store the results of subprograms. Models of a less operational nature are briefly discussed. The consistency of the UTP model is demonstrated by a structural induction proof over the operations of the core object calculus. Overall, our UTP model is intended to provide facilities for encoding both object-based and class-based languages. [ifm2007] Jim Davies and Jeremy Gibbons, editors. Integrated Formal Methods, volume 4591 of Lecture Notes in Computer Science. Springer-Verlag, 2007. [ bib | | .pdf ] The design and analysis of computing systems presents a significant challenge: systems need to be understood at many different levels of abstraction, and examined from many different perspectives. Formal methods-languages, tools, and techniques with a sound, mathematical basis-can be used to develop a thorough understanding, and to support rigorous examination. Further research into effective integration is required if these methods are to have a significant impact outside academia. The Integrated Formal Methods (IFM) series of conferences seeks to promote that research, to bring together the researchers carrying it out, and to disseminate the results of that research among the wider academic and industrial community. Earlier meetings in the series were held at: York (1999); Dagstuhl (2000); Turku (2002); Kent (2004); Eindhoven (2005). IFM 2007 is the largest to date, with 32 technical papers (from 85 submissions), 3 invited talks, 3 workshops, and a tutorial. The success of the series reflects the enthusiasm and efforts of the IFM community, and the organisers would like to thank the speakers, the committee, and the reviewers for their contributions. [dgp] Jeremy Gibbons. Datatype-generic programming. In Backhouse et al. [ssdgp]. [ bib | .pdf ] Generic programming aims to increase the flexibility of programming languages, by expanding the possibilities for parametrization - ideally, without also expanding the possibilities for uncaught errors. The term means different things to different people: parametric polymorphism, data abstraction, meta-programming, and so on. We use it to mean polytypism, that is, parametrization by the shape of data structures rather than their contents. To avoid confusion with other uses, we have coined the qualified term datatype-generic programming for this purpose. In these lecture notes, we expand on the definition of datatype-generic programming, and present some examples of datatype-generic programs. We also explore the connection with design patterns in object-oriented programming; in particular, we argue that certain design patterns are just higher-order datatype-generic programs. [ssdgp] Roland Backhouse, Jeremy Gibbons, Ralf Hinze, and Johan Jeuring, editors. Spring School on Datatype-Generic Programming, volume 4719 of Lecture Notes in Computer Science. Springer-Verlag, 2007. [ bib | DOI | | .pdf ] A leitmotif in the evolution of programming paradigms has been the level and extent of parametrisation that is facilitated - the so-called genericity of the paradigm. The sorts of parameters that can be envisaged in a programming language range from simple values, like integers and floating-point numbers,through structured values, types and classes, to kinds (the type of types and/or classes). Datatype-generic programming is about parametrising programs by the structure of the data that they manipulate, exploiting that structure when it is relevant and ignoring it when it is not. Programming languages most commonly used at the present time do not provide effective mechanisms for documenting and implementing datatype genericity. This volume is a contribution towards improving the state of the art. [gip] Jeremy Gibbons, Meng Wang, and Bruno C. d. S. Oliveira. Generic and indexed programming. In Marco Morazan, editor, Trends in Functional Programming, 2007. [ bib | .pdf ] The EPSRC-funded Generic and Indexed Programming project will explore the interaction between datatype-generic programming (DGP) - programs parametrized by the shape of their data - and indexed programming (IP) - lightweight dependently-typed programming, with programs indexed by type-level representations of properties. Integrating these two notions will provide new ways for programmers to capture abstractions. [workflow] Peter Y. H. Wong and Jeremy Gibbons. A process-algebraic approach to workflow specification and refinement. In Software Composition, 2007. [ bib | .pdf ] This paper describes a process algebraic approach to specification and refinement of workflow processes. In particular, we model both specification and implementation of workflows as CSP processes. CSP's behavioural models and their respective refinement relations not only enable us to prove correctness properties of an individual workflow process against its behavioural specification, but also allows us to design and develop workflow processes compositionally. Moreover, coupled with CSP is an industrial strength automated model checker FDR, which allows behavioural properties of workflow models to be proved automatically. This paper details some CSP models of van der Aalst et al.'s control flow workflow patterns, and illustrates behavioural specification and refinement of workflow systems with a business process scenario. [metamorphisms-scp] Jeremy Gibbons. Metamorphisms: Streaming representation-changers. Science of Computer Programming, 65:108-139, 2007. Revised version of [metamorphisms-mpc]. [ bib | .pdf ] Unfolds generate data structures, and folds consume them. A hylomorphism is a fold after an unfold, generating then consuming a virtual data structure. A metamorphism is the opposite composition, an unfold after a fold; typically, it will convert from one data representation to another. In general, metamorphisms are less interesting than hylomorphisms: there is no automatic fusion to deforest the intermediate virtual data structure. However, under certain conditions fusion is possible: some of the work of the unfold can be done before all of the work of the fold is complete. This permits streaming metamorphisms, and among other things allows conversion of infinite data representations. We present the theory of metamorphisms and outline some examples. [crosstrial] Radu Calinescu, Steve Harris, Jeremy Gibbons, and Jim Davies. Cross-trial query system for cancer clinical trials. In International Joint Conferences on Computer, Information and Systems Sciences and Engineering (CISSE), December 2006. [ bib | .pdf ] Data sharing represents one of the key objectives and major challenges of today's cancer research. CancerGrid, a consortium of clinicians, cancer researchers, computational biologists and software engineers from leading UK institutions, is developing open-standards cancer informatics addressing this challenge. The CancerGrid solution involves the representation of a widely accepted clinical trials model in controlled vocabulary and common data elements (CDEs) as the enabling factor for cancer data sharing. This paper describes a cancer data query system that supports data sharing across CancerGrid-compliant clinical trial boundaries. The formal specification of the query system allows the model-driven development of a flexible, web-based interface that cancer researchers with limited IT experience can use to identify and query common data across multiple clinical trials. [hodgp] Jeremy Gibbons. Design patterns as higher-order datatype-generic programs. In Ralf Hinze, editor, Workshop on Generic Programming, September 2006. [ bib | .pdf ] Design patterns are reusable abstractions in object-oriented software. However, using current programming languages, these elements can only be expressed extra-linguistically: as prose, pictures, and prototypes. We believe that this is not inherent in the patterns themselves, but evidence of a lack of expressivity in the languages of today. We expect that, in the languages of the future, the code part of design patterns will be expressible as reusable library components. Indeed, we claim that the languages of tomorrow will suffice; the future is not far away. The necessary features are higher-order and datatype-generic constructs; these features are already or nearly available now. We argue the case by presenting higher-order datatype-generic programs capturing Origami, a small suite of patterns for recursive data structures. [iterator-msfp] Jeremy Gibbons and Bruno C. d. S. Oliveira. The essence of the Iterator pattern. In Conor McBride and Tarmo Uustalu, editors, Mathematically-Structured Functional Programming, 2006. Superseded by [iterator]. [ bib | .pdf ] The Iterator pattern gives a clean interface for element-by-element access to a collection. Imperative iterations using the pattern have two simultaneous aspects: mapping and accumulating. Various functional iterations model one or other of these, but not both simultaneously. We argue that McBride and Paterson's idioms, and in particular the corresponding traverse operator, do exactly this, and therefore capture the essence of the Iterator pattern. We present some axioms for traversal, and illustrate with a simple example, the repmin problem. [fission] Jeremy Gibbons. Fission for program comprehension. In Tarmo Uustalu, editor, Mathematics of Program Construction, volume 4014 of Lecture Notes in Computer Science, pages 162-179. Springer-Verlag, 2006. [ bib | .pdf ] Fusion is a program transformation that combines adjacent computations, flattening structure and improving efficiency at the cost of clarity. Fission is the same transformation, in reverse: creating structure, ex nihilo. We explore the use of fission for program comprehension, that is, for reconstructing the design of a program from its implementation. We illustrate through rational reconstructions of the designs for three different C programs that count the words in a text file. [fast+loose] Nils Anders Danielsson, Jeremy Gibbons, John Hughes, and Patrik Jansson. Fast and loose reasoning is morally correct. In Principles of Programming Languages, pages 206-217, January 2006. Accompanying proofs at http://www.cs.chalmers.se/~nad/repos/fast-and-loose-proofs/. [ bib | .pdf ] We justify reasoning about non-total (partial) functional languages using methods seemingly only valid for total ones; this permits `fast and loose' reasoning without actually being loose. Two languages are defined, one total and one partial, with identical syntax. The semantics of the partial language includes partial and infinite values and lifted types, including lifted function spaces. A partial equivalence relation is then defined, the domain of which is the total subset of the partial language. It is proved that if two closed terms have the same semantics in the total language, then they have related semantics in the partial language. It is also shown that the partial equivalence relation gives rise to a bicartesian closed category, which can be used to reason about values in the domain of the relation. [spigot] Jeremy Gibbons. An unbounded spigot algorithm for the digits of π. American Mathematical Monthly, 113(4):318-328, 2006. One of the algorithms described in this paper won a prize for most useful submission at the Succ Zeroth International Obfuscated Haskell Code Contest! [ bib | .pdf ] Rabinowitz and Wagon (American Mathematical Monthly 102(3):195-203, 1995) present a spigot algorithm for computing the digits of π. A spigot algorithm yields its outputs incrementally, and does not reuse them after producing them. Their algorithm is inherently bounded; it requires a commitment in advance to the number of digits to be computed, and in fact might still produce an incorrect last few digits. We propose two streaming algorithms based on the same characterization of π, with the same incremental characteristics but without requiring the prior bound. [rationals] Jeremy Gibbons, David Lester, and Richard Bird. Enumerating the rationals. Journal of Functional Programming, 16(4), 2006. [ bib | .pdf ] We present a series of programs for enumerating the rational numbers without duplication, drawing on some elegant results of Neil Calkin, Herbert Wilf and Moshe Newman. [hodgp-oopsla] Jeremy Gibbons. Design patterns as higher-order datatype-generic programs. In Object-Oriented Programming: Systems, Languages, Applications, San Diego, October 2005. Tutorial. A revision of [hodgp-ecoop]. [ bib | http ] The purpose of this tutorial is to draw together ideas from the Design Patterns community (the Gang of Four: Gamma, Helm, Johnson, Vlissides) and the Functional Programming world (eg Bird, Meertens, Hughes). In particular, the thesis is that whereas design patterns must be expressed extra-linguistically (as prose, diagrams, examples) in object-oriented languages, they may be captured directly as abstractions using higher-order operators in functional programming languages. Therefore, they may be reasoned about, type-checked, applied and reused, just as any other abstractions may be. We argue this case by developing the idea of higher-order operators, specifically for capturing patterns of computation in programs. We then build on this to show how the intentions behind a number of the Gang of Four patterns-such as Composite, Visitor, Iterator, and Builder-have higher-order operators as their analogues in functional languages. Specifically, the structure of these patterns is determined essentially by the structure of the data involved, and they can be captured as generic programs parametrized by that datatype. The aim is to give greater insight into and understanding of already-familiar patterns. [hodgp-ecoop] Jeremy Gibbons. Design patterns as higher-order datatype-generic programs. In European Conference on Object-Oriented Programming, Glasgow, July 2005. Tutorial. Later version appears as [hodgp-oopsla]. [ bib | .html ] The aim of this tutorial is to draw together ideas from the Design Patterns community (the Gang of Four: Gamma, Helm, Johnson, Vlissides) and the Functional Programming world (eg Bird, Meertens, Hughes). In particular, the thesis is that whereas design patterns must be expressed extra-linguistically (as prose, diagrams, examples) in object-oriented languages, they may be captured directly as abstractions using higher-order operators in functional programming languages. Therefore, they may be reasoned about, type-checked, applied and reused, just as any other abstractions may be. We argue this case by developing the idea of higher-order operators, specifically for capturing patterns of computation in programs. We then bring this around to show how the intentions behind a number of the Gang of Four patterns-such as Composite, Visitor, Iterator, and Builder-have higher-order operators as their analogues in functional languages. [corecursive] Jeremy Gibbons and Graham Hutton. Proof methods for corecursive programs. Fundamenta Informatica, 66(4):353-366, April/May 2005. [ bib | .pdf ] Recursion is a well-known and powerful programming technique, with a wide variety of applications. The dual technique of corecursion is less well-known, but is increasingly proving to be just as useful. This article is a tutorial on the four main methods for proving properties of corecursive programs: fixpoint induction, the approximation (or take) lemma, coinduction, and fusion. [typecase] Bruno César dos Santos Oliveira and Jeremy Gibbons. TypeCase: A design pattern for type-indexed functions. In Daan Leijen, editor, Haskell Workshop, 2005. [ bib | .pdf ] A type-indexed function is a function that is defined for each member of some family of types. Haskell's type class mechanism provides collections of open type-indexed functions, in which the indexing family can be extended by defining a new type class instance but the collection of functions is fixed. The purpose of this paper is to present TypeCase: a design pattern that allows the definition of closed type-indexed functions, in which the index family is fixed but the collection of functions is extensible. It is inspired by Cheney and Hinze's work on lightweight approaches to generic programming. We generalise their techniques as a design pattern. Furthermore, we show that type-indexed functions with type-indexed types, and consequently generic functions with generic types, can also be encoded in a lightweight manner, thereby overcoming one of the main limitations of the lightweight approaches. [metamorphisms-mpc] Jeremy Gibbons. Streaming representation-changers. In Dexter Kozen, editor, Mathematics of Program Construction, volume 3125 of Lecture Notes in Computer Science, pages 142-168, July 2004. Superseded by [metamorphisms-scp]. [ bib | .pdf ] Unfolds generate data structures, and folds consume them. A hylomorphism is a fold after an unfold, generating then consuming a virtual data structure. A metamorphism is the opposite composition, an unfold after a fold; typically, it will convert from one data representation to another. In general, metamorphisms are less interesting than hylomorphisms: there is no automatic fusion to deforest the intermediate virtual data structure. However, under certain conditions fusion is possible: some of the work of the unfold can be done before all of the work of the fold is complete. This permits streaming metamorphisms, and among other things allows conversion of infinite data representations. We present the theory of metamorphisms and outline some examples. [efolds] Clare Martin, Jeremy Gibbons, and Ian Bayley. Disciplined, efficient, generalised folds for nested datatypes. Formal Aspects of Computing, 16(1):19-35, 2004. [ bib | .pdf ] Nested (or non-uniform, or non-regular) datatypes have recursive definitions in which the type parameter changes. Their folds are restricted in power due to type constraints. Bird and Paterson introduced generalised folds for extra power, but at the cost of a loss of efficiency: folds may take more than linear time to evaluate. Hinze introduced efficient generalised folds to counter this inefficiency, but did so in a pragmatic way, at the cost of a loss of reasoning power: without categorical or equivalent underpinnings, there are no universal properties for manipulating folds. We combine the efficiency of Hinze's construction with the powerful reasoning tools of Bird and Paterson's. [patterns] Jeremy Gibbons. Patterns in datatype-generic programming. In Jörg Striegnitz and Kei Davis, editors, Multiparadigm Programming, volume 27, pages 277-289. John von Neumann Institute for Computing (NIC), 2003. First International Workshop on Declarative Programming in the Context of Object-Oriented Languages (DPCOOL). [ bib | .pdf ] Generic programming consists of increasing the expressiveness of programs by allowing a wider variety of kinds of parameter than is usual. The most popular instance of this scheme is the C++ Standard Template Library. Datatype-generic programming is another instance, in which the parameters take the form of datatypes. We argue that datatype-generic programming is sufficient to express essentially all the genericity found in the Standard Template Library. Moreover, datatype-generic programming is a precisely-defined notion with a rigorous mathematical foundation, in contrast to generic programming in general and the C++ template mechanism in particular, and thereby offers the prospect of better static checking and a greater ability to reason about generic programs. This paper describes work in progress. [arith] Richard Bird and Jeremy Gibbons. Arithmetic coding with folds and unfolds. In Johan Jeuring and Simon Peyton Jones, editors, Advanced Functional Programming 4, volume 2638 of Lecture Notes in Computer Science, pages 1-26. Springer-Verlag, 2003. Code available at http://www.comlab.ox.ac.uk/oucl/work/jeremy.gibbons/publications/arith.zip. [ bib | .pdf ] Arithmetic coding is a method for data compression. It produces a theoretically optimal compression under much weaker assumptions than Huffman and Shannon-Fano, and can compress within one bit of the limit imposed by Shannon's Noiseless Coding Theorem. Earlier presentations provided little in the way of proof of why the various steps in the encoding process were correct, particularly when it came to the specification of precisely what problem the implementation solved, and the details of why the inverse operation of decoding was correct. Our aim in these lectures is to provide a formal derivation of basic algorithms for coding and decoding. Our development makes heavy use of the algebraic laws of folds and unfolds. One novel result concerns a new pattern of computation, which we call streaming, whereby elements of an output list are produced as soon as they are determined (and which has nothing to do with lazy evaluation). [ssgp] Roland Backhouse and Jeremy Gibbons, editors. Summer School on Generic Programming, volume 2793 of Lecture Notes in Computer Science. Springer-Verlag, 2003. [ bib | | .pdf ] Generic programming is about making programming more effective by making it more general. This volume is about a novel form of genericity in programs, based on parameterizing programs by the structure of the data they manipulate. The material is based on lectures presented at a summer school on Generic Programming held at the University of Oxford in August 2002. [origami] Jeremy Gibbons. Origami programming. In Gibbons and de Moor [fop], pages 41-60. [ bib | .pdf ] One style of functional programming is based purely on recursive equations. Such equations are easy to explain, and adequate for any computational purpose, but hard to use well as programs get bigger and more complicated. In a sense, recursive equations are the `assembly language' of functional programming, and direct recursion the goto. As computer scientists discovered in the 1960s with structured programming, it is better to identify common patterns of use of such too-powerful tools, and capture these patterns as new constructions and abstractions. In functional programming, in contrast to imperative programming, we can often express the new constructions as higher-order operations within the language, whereas the move from unstructured to structured programming entailed the development of new languages. In this chapter we will look at folds and unfolds as abstractions. In a precise technical sense, folds and unfolds are the natural patterns of computation over recursive datatypes; unfolds generate data structures and folds consume them. Functional programmers are very familiar with the foldr function on lists, and its directional dual foldl; they are gradually coming to terms with the generalisation to folds on other datatypes. The computational duals, unfolds, are still rather unfamiliar; we hope to show here that they are no more complicated than, and just as useful as, folds, and to promote a style of programming based on these and similar recursion patterns. [fop] Jeremy Gibbons and Oege de Moor, editors. The Fun of Programming. Cornerstones in Computing. Palgrave, 2003. ISBN 0333992857 in paperback (http://www.palgrave.com/catalogue/catalogue.asp?Title_Id=0333992857, http://www.amazon.co.uk/exec/obidos/ASIN/0333992857/), 1403907722 in hardback (http://www.palgrave.com/catalogue/catalogue.asp?Title_Id=1403907722, http://www.amazon.co.uk/exec/obidos/ASIN/1403907722/). [ bib | | .pdf ] Functional programming has come of age: it is now a standard course in any computer science curriculum. Ideas that were first developed in the laboratory environment of functional programming have proved their values in wider settings, such as generic Java and XML. The time is ripe, therefore, to teach a second course on functional programming, delving deeper into the subject. This book is the text for such a course. The emphasis is on the fun of programming in a modern, well designed programming language such as Haskell. There are chapters that focus on applications, in particular pretty printing, musical composition, hardware description, and graphical design. These applications are interspersed with chapters on techniques, such as the design of efficient data structures, interpreters for other languages, program testing and optimisation. These topics are of interest to every aspiring programmer, not just to those who choose to work in a functional language. Haskell just happens to be a very convenient vehicle for expressing the ideas, and the theme of functional programming as a lingua franca to communicate ideas runs throughout the book. [softeng-projects] Andrew Simpson, Andrew Martin, Jeremy Gibbons, Jim Davies, and Steve McKeever. On the supervision and assessment of part-time postgraduate software engineering projects. In International Conference on Software Engineering, 2003. [ bib | .pdf ] This paper describes existing practices in the supervision and assessment of projects undertaken by part-time, postgraduate students in Software Engineering. It considers this aspect of the learning experience, and the educational issues raised, in the context of existing literature-much of which is focussed upon the experience of full-time, undergraduate students. The importance of these issues will increase with the popularity of part-time study at a postgraduate level; the paper presents a set of guidelines for project supervision and assessment. [wcgp] Jeremy Gibbons and Johan Jeuring, editors. Generic Programming. Kluwer Academic Publishers, 2003. Proceedings of the IFIP TC2 Working Conference on Generic Programming, Schloß Dagstuhl, July 2002. [ bib | | .pdf ] Generic programming techniques have always been of interest, both to practitioners and to theoreticians, but only recently have generic programming techniques become a specific focus of research in the functional and ob ject-oriented programming language communities. The IFIP TC2 Working Conference on Generic Programming, held at Schloß Dagstuhl,Germany, on 11th and 12th July 2002, brought together leading researchers in generic programming from around the world, and featured papers capturing the state of the art in this important emerging area. The conference was sponsored by IFIP Technical Committee 2, and organized in cooperation with Working Group 2.1 on Algorithmic Languages and Calculi. This book contains revised versions of the papers that were presented at the conference. [superposition] Jeremy Gibbons. Towards a colimit-based semantics for visual programming. In Coordination Models and Languages, volume 2315 of Lecture Notes in Computer Science, pages 166-173, April 2002. [ bib | .pdf ] Software architects such as Garlan and Katz promote the separation of computation from coordination. They encourage the study of connectors as first-class entities, and superposition of connectors onto components as a paradigm for component-oriented programming. We demonstrate that this is a good model for what visual programming tools like IBM's VisualAge actually do. Moreover, Fiadeiro and Maibaum's categorical semantics of parallel programs is applicable to this model, so we can make progress towards a formal semantics of visual programming. [acmmpc-calcfp] Jeremy Gibbons. Calculating functional programs. In Backhouse et al. [acmmpc], pages 148-203. [ bib | .pdf ] Functional programs are merely equations; they may be manipulated by straightforward equational reasoning. In particular, one can use this style of reasoning to calculate programs, in the same way that one calculates numeric values in arithmetic. Many useful theorems for such reasoning derive from an algebraic view of programs, built around datatypes and their operations. Traditional algebraic methods concentrate on initial algebras, constructors, and values; dual co-algebraic methods concentrate on final co-algebras, destructors, and processes. Both methods are elegant and powerful; they deserve to be combined. [acmmpc-optimization] Richard Bird, Jeremy Gibbons, and Shin Cheng Mu. Algebraic methods for optimization problems. In Backhouse et al. [acmmpc], pages 281-307. [ bib | .pdf ] We argue for the benefits of relations over functions for modelling programs, and even more so for modelling specifications. To support this argument, we present an extended case study for a class of optimization problems, deriving efficient functional programs from concise relational specifications. [acmmpc] Roland Backhouse, Roy Crole, and Jeremy Gibbons, editors. Algebraic and Coalgebraic Methods in the Mathematics of Program Construction, volume 2297 of Lecture Notes in Computer Science. Springer-Verlag, 2002. [ bib | | .pdf ] Program construction is about turning specifications of computer software into implementations. Doing so in a way that guarantees correctness is an undertaking requiring deep understanding of the languages and tools being used, as well as of the application domain. Recent research aimed at improving the process of program construction exploits insights from abstract algebraic tools such as lattice theory, fixpoint calculus, universal algebra, category theory and allegory theory. This book provides an introduction to these mathematical theories and how they are applied to practical problems. [semantics] Clare Martin and Jeremy Gibbons. On the semantics of nested datatypes. Information Processing Letters, 80(5):233-238, December 2001. [ bib | .ps.gz ] Nested (or non-regular or non-uniform) datatypes are recursively defined parameterised datatypes in which the parameter of the datatype changes in the recursive call. The standard semantic definition of recursively defined datatypes is as initial algebras in the category Set of sets and total functions. Bird and Meertens have shown that this theory is inadequate to describe nested datatypes. Instead, one solution proposed there was to define them as initial algebras in the functor category Nat(Set), with objects all endofunctors on Set and arrows all natural transformations between them. We show here that initial algebras are not guaranteed to exist in the functor category itself, but that they do exist in one of its subcategories: the category of all cocontinuous endofunctors and natural transformations. This category is then a suitable semantic domain for nested datatypes, both first order and higher-order. [approx] Graham Hutton and Jeremy Gibbons. The generic approximation lemma. Information Processing Letters, 79(4):197-201, August 2001. [ bib | .ps.gz ] The approximation lemma was recently introduced as a simplification of the well-known take lemma, and is used to prove properties of programs that produce lists of values. We show how the approximation lemma, unlike the take lemma, can naturally be generalised from lists to a large class of datatypes, and present a generic approximation lemma that is parametric in the datatype to which it applies. As a useful by-product, we find that generalising the approximation lemma in this way also simplifies its proof. [kernels] Jeremy Gibbons, Graham Hutton, and Thorsten Altenkirch. When is a function a fold or an unfold? entcs, 44(1), April 2001. Proceedings of Coalgebraic Methods in Computer Science. [ bib | .ps.gz ] We give a necessary and sufficient condition for when a set-theoretic function can be written using the recursion operator fold, and a dual condition for the recursion operator unfold. The conditions are simple, practically useful, and generic in the underlying datatype. [pointwise] Oege de Moor and Jeremy Gibbons. Pointwise relational programming. In Algebraic Methodology and Software Technology, volume 1816 of Lecture Notes in Computer Science, pages 371-390, May 2000. [ bib | .ps.gz ] The point-free relational calculus has been very successful as a language for discussing general programming principles. However, when it comes to specific applications, the calculus can be rather awkward to use: some things are more clearly and simply expressed using variables. The combination of variables and relational combinators such as converse and choice yields a kind of nondeterministic functional programming language. We give a semantics for such a language, and illustrate with an example application. [naturally] Richard Bird, Jeremy Gibbons, and Geraint Jones. Program optimisation, naturally. In J. W. Davies, A. W. Roscoe, and J. C. P. Woodcock, editors, Millenial Perspectives in Computer Science. Palgrave, 2000. [ bib | .ps.gz ] It is well-known that each polymorphic function satisfies a certain equational law, called a naturality condition. Such laws are part and parcel of the basic toolkit for improving the efficiency of functional programs. More rarely, some polymorphic functions also possess a higher-order naturality property. One example is the operation unzip that takes lists of pairs to pairs of lists. Surprisingly, this property can be invoked to improve the asymptotic efficiency of some divide-and-conquer algorithms from O(n log n) to O(n). The improved algorithms make use of polymorphic recursion, and can be expressed neatly using nested datatypes, so they also serve as evidence of the practical utility of these two concepts. [genda] Jeremy Gibbons. Generic downwards accumulations. Science of Computer Programming, 37:37-65, 2000. [ bib | .ps.gz ] A downwards accumulation is a higher-order operation that distributes information downwards through a data structure, from the root towards the leaves. The concept was originally introduced in an ad hoc way for just a couple of kinds of tree. We generalize the concept to an arbitrary regular datatype; the resulting definition is co-inductive. [bridging] Oege de Moor and Jeremy Gibbons. Bridging the algorithm gap: A linear-time functional program for paragraph formatting. Science of Computer Programming, 35(1), 1999. [ bib | .ps.gz ] In the constructive programming community it is commonplace to see formal developments of textbook algorithms. In the algorithm design community, on the other hand, it may be well known that the textbook solution to a problem is not the most efficient possible. However, in presenting the more efficient solution, the algorithm designer will usually omit some of the implementation details, thus creating an algorithm gap between the abstract algorithm and its concrete implementation. This is in contrast to the formal development, which usually proceeds all the way to the complete concrete implementation of the less efficient solution. We claim that the algorithm designer is forced to omit some of the details by the relative expressive poverty of the Pascal-like languages typically used to present the solution. The greater expressiveness provided by a functional language would allow the whole story to be told in a reasonable amount of space. In this paper we use a functional language to present the development of a sophisticated algorithm all the way to the final code. We hope to bridge the algorithm gap between abstract and concrete implementations, and thereby facilitate communication between the constructive programming and algorithm design communities. [radix] Jeremy Gibbons. A pointless derivation of radixsort. Journal of Functional Programming, 9(3):339-346, 1999. [ bib | .ps.gz ] This paper is about point-free (or `pointless') calculations - calculations performed at the level of function composition instead of that of function application. We address this topic with the help of an example, namely calculating the radix-sort algorithm from a more obvious specification of sorting. The message that we hope to send is that point-free calculations are sometimes surprisingly simpler than the corresponding point-wise calculations. [unfold] Jeremy Gibbons and Geraint Jones. The under-appreciated unfold. In Proceedings of the Third ACM SIGPLAN International Conference on Functional Programming, pages 273-279, Baltimore, Maryland, September 1998. [ bib | .ps.gz ] Folds are appreciated by functional programmers. Their dual, unfolds, are not new, but they are not nearly as well appreciated. We believe they deserve better. To illustrate, we present (indeed, we calculate) a number of algorithms for computing the breadth-first traversal of a tree. We specify breadth-first traversal in terms of level-order traversal, which we characterize first as a fold. The presentation as a fold is simple, but it is inefficient, and removing the inefficiency makes it no longer a fold. We calculate a characterization as an unfold from the characterization as a fold; this unfold is equally clear, but more efficient. We also calculate a characterization of breadth-first traversal directly as an unfold; this turns out to be the `standard' queue-based algorithm. [polyda] Jeremy Gibbons. Polytypic downwards accumulations. In Johan Jeuring, editor, Proceedings of Mathematics of Program Construction, volume 1422 of Lecture Notes in Computer Science, Marstrand, Sweden, June 1998. Springer-Verlag. [ bib | .ps.gz ] A downwards accumulation is a higher-order operation that distributes information downwards through a data structure, from the root towards the leaves. The concept was originally introduced in an ad hoc way for just a couple of kinds of tree. We generalize the concept to an arbitrary polynomial datatype; our generalization proceeds via the notion of a path in such a datatype. [spjava] Jeremy Gibbons. Structured programming in Java. SIGPLAN Notices, 33(4):40-43, April 1998. Also in Proceedings of Second Conference on Java in the Computing Curriculum, South Bank University, London, ed Fintan Culwin. [ bib | .ps.gz ] We argue that for computing majors, it is better to use a `why' approach to teaching programming than a `how' approach; this involves (among other things) teaching structured programming before progressing to higher-level styles such as object-oriented programming. We also argue that, once it has been decided to teach structured programming, Java is a reasonable language to choose for doing so. [calculating] Jeremy Gibbons. Calculating functional programs. In Keiichi Nakata, editor, Proceedings of ISRG/SERG Research Colloquium. School of Computing and Mathematical Sciences, Oxford Brookes University, November 1997. Technical Report CMS-TR-98-01. [ bib | .ps.gz ] A good way of developing a correct program is to calculate it from its specification. Functional programming languages are especially suitable for this, because their referential transparency greatly helps calculation. We discuss the ideas behind program calculation, and illustrate with an example (the maximum segment sum problem). We show that calculations are driven by promotion, and that promotion properties arise from universal properties of the data types involved. [merging] Jeremy Gibbons. More on merging and selection. Technical Report CMS-TR-97-08, School of Computing and Mathematical Sciences, Oxford Brookes University, October 1997. [ bib | .ps.gz ] In his paper On Merging and Selection (Journal of Functional Programming 7(3), 1997), Bird considers the problem of computing the nth element of the list resulting from merging the two sorted lists x and y. Representing x and y by trees, Bird derives an algorithm for the problem taking time proportional to the sum of their depths. Bird's derivation is more complicated than necessary. By the simple tactic of delaying a design decision (in this case, the decision to represent the lists as trees) as long as possible, we obtain a much simpler solution. [conditionals] Jeremy Gibbons. Conditionals in distributive categories. Technical Report CMS-TR-97-01, School of Computing and Mathematical Sciences, Oxford Brookes University, 1997. [ bib | .ps.gz ] In a distributive category (a category in which the product distributes over the coproduct), coproducts can be used to model conditional expressions. We develop such a theory of conditionals. [thirdht] Jeremy Gibbons. The Third Homomorphism Theorem. Journal of Functional Programming, 6(4), 1996. Earlier version appeared in C.B.Jay, editor, Computing: The Australian Theory Seminar, Sydney, December 1994, p.62-69. [ bib | .ps.gz ] The Third Homomorphism Theorem is a folk theorem of the constructive algorithmics community. It states that a function on lists that can be computed both from left to right and from right to left is necessarily a list homomorphism-it can be computed according to any parenthesization of the list. We formalize and prove the theorem, and describe two practical applications: to fast parallel algorithms for language recognition problems and for downwards accumulations on trees. [dmtcs] Douglas Bridges, Cris Calude, Jeremy Gibbons, Steve Reeves, and Ian Witten, editors. Combinatorics, Complexity and Logic: Proceedings of Discrete Mathematics and Theoretical Computer Science, Singapore, 1996. Springer-Verlag. [ bib | ] DMTCS'96 is the first of a planned series of conferences organized by the Centre for Discrete Mathematics and Theoretical Computer Science, and is the first joint venture of the Computer Science and Mathematics departments of the University of Auckland and Waikato, New Zealand. These proceedings contain original papers which had been solicited in all areas of discrete mathematics and theoretical computer science, in particular in the areas of combinatorics, complexity, computability, constructivity, and logic. [drawing] Jeremy Gibbons. Deriving tidy drawings of trees. Journal of Functional Programming, 6(3):535-562, 1996. Earlier version appears as Technical Report No.82, Department of Computer Science, University of Auckland. [ bib | .ps.gz ] The tree-drawing problem is to produce a `tidy' mapping of elements of a tree to points in the plane. In this paper, we derive an efficient algorithm for producing tidy drawings of trees. The specification, the starting point for the derivations, consists of a collection of intuitively appealing criteria satisfied by tidy drawings. The derivation shows constructively that these criteria completely determine the drawing. Indeed, there is essentially only one reasonable drawing algorithm satisfying the criteria; its development is almost mechanical. The algorithm consists of an upwards accumulation followed by a downwards accumulation on the tree, and is further evidence of the utility of these two higher-order tree operations. [quickly] Jeremy Gibbons. Computing downwards accumulations on trees quickly. Theoretical Computer Science, 169(1):67-80, 1996. Earlier version appeared in Proceedings of the 16th Australian Computer Science Conference, Brisbane, 1993. [ bib | .ps.gz ] Downwards passes on binary trees are essentially functions which pass information down a tree, from the root towards the leaves. Under certain conditions, a downwards pass is both `efficient' (computable in a functional style in parallel time proportional to the depth of the tree) and `manipulable' (enjoying a number of distributivity properties useful in program construction); we call a downwards pass satisfying these conditions a downwards accumulation. In this paper, we show that these conditions do in fact yield a stronger conclusion: the accumulation can be computed in parallel time proportional to the logarithm of the depth of the tree, on a CREW PRAM machine. [tracing] Jeremy Gibbons and Keith Wansbrough. Tracing lazy functional languages. In Michael E. Houle and Peter Eades, editors, Computing: The Australasian Theory Seminar, pages 11-20, Melbourne, January 1996. [ bib | .ps.gz ] We argue that Ariola and Felleisen's and Maraist, Odersky and Wadler's axiomatization of the call-by-need lambda calculus forms a suitable formal basis for tracing evaluation in lazy functional languages. In particular, it allows a one-dimensional textual representation of terms, rather than requiring a two-dimensional graphical representation using arrows. We describe a program LetTrace, implemented in Gofer and tracing lazy evaluation of a subset of Gofer. [dashed] Jeremy Gibbons. Dotted and dashed lines in Metafont. In Robin Fairbairns, editor, Proceedings of the 1995 Annual Meeting. T E X Users' Group, 1995. [ bib | .ps.gz ] We show how to draw evenly dotted and dashed curved lines in Metafont, using recursive refinement of paths. Metapost provides extra primitives that can be used for this task, but the method presented here can be used for both Metafont and Metapost. [damgs] Jeremy Gibbons. An initial-algebra approach to directed acyclic graphs. In Bernhard Möller, editor, Mathematics of Program Construction, volume 947 of Lecture Notes in Computer Science, pages 282-303. Springer-Verlag, 1995. [ bib | .ps.gz ] The initial-algebra approach to modelling datatypes consists of giving constructors for building larger objects of that type from smaller ones, and laws identifying different ways of constructing the same object. The recursive decomposition of objects of the datatype leads directly to a recursive pattern of computation on those objects, which is very helpful for both functional and parallel programming. We show how to model a particular kind of directed acyclic graph using this initial-algebra approach. [nzfpdc-squiggol] Jeremy Gibbons. An introduction to the Bird-Meertens Formalism. Presented at `New Zealand Formal Program Development Colloquium', Hamilton, November 1994, November 1994. [ bib | .ps.gz ] The Bird-Meertens Formalism, or `Squiggol', is a calculus for the construction of programs from their specifications by a process of equational reasoning. Developments are directed by considerations of data, as opposed to program, structure. This paper presents a brief introduction to the philosophy and notation of the calculus, in the guise of the (well-known) derivation of a linear-time solution to the `maximum segment sum' problem. [efficient] Jeremy Gibbons, Wentong Cai, and David Skillicorn. Efficient parallel algorithms for tree accumulations. Science of Computer Programming, 23:1-18, 1994. [ bib | .ps.gz ] Accumulations are higher-order operations on structured objects; they leave the shape of an object unchanged, but replace elements of that object with accumulated information about other elements. Upwards and downwards accumulations on trees are two such operations; they form the basis of many tree algorithms. We present two EREW PRAM algorithms for computing accumulations on trees taking O(logn) time on O(n/logn) processors, which is optimal. [nzfpdc-drawing] Jeremy Gibbons. How to derive tidy drawings of trees. In C. Calude, M. J. J. Lennon, and H. Maurer, editors, Proceedings of Salodays in Auckland, pages 53-73, Department of Computer Science, University of Auckland, 1994. Also presented at `New Zealand Formal Program Development Colloquium', Hamilton, November 1994. [ bib | .ps.gz ] The tree-drawing problem is to produce a `tidy' mapping of elements of a tree to points in the plane. In this paper, we derive an efficient algorithm for producing tidy drawings of trees. The specification, the starting point for the derivations, consists of a collection of intuitively appealing criteria satisfied by tidy drawings. The derivation shows constructively that these criteria completely determine the drawing. Indeed, there is essentially only one reasonable drawing algorithm satisfying the criteria; its development is almost mechanical. The algorithm consists of an upwards accumulation followed by a downwards accumulation on the tree, and is further evidence of the utility of these two higher-order tree operations. [linear] Geraint Jones and Jeremy Gibbons. Linear-time breadth-first tree algorithms: An exercise in the arithmetic of folds and zips. Technical Report Computer Science Report No.71, University of Auckland, Programming Research Group, University of Oxford, and Department of Computer Science, University of Auckland, May 1993. IFIP Working Group 2.1 working paper 705 WIN-2. [ bib | .ps.gz ] This paper is about an application of the mathematics of the zip, reduce (fold) and accumulate (scan) operations on lists. It gives an account of the derivation of a linear-time breadth-first tree traversal algorithm, and of a subtle and efficient breadth-first tree labelling algorithm. [formal] Jeremy Gibbons. Formal methods: Why should I care? the development of the T800 Transputer floating-point unit. In John Hosking, editor, Proceedings of the 13th New Zealand Computer Society Conference, pages 207-217, 1993. [ bib | .ps.gz ] The term `formal methods' is a general term for precise mathematically-based techniques used in the development of computer systems, both hardware and software. This paper discusses formal methods in general, and in particular describes their successful role in specifying, constructing and proving correct the floating-point unit of the Inmos T800 transputer chip. [accumulations] Jeremy Gibbons. Upwards and downwards accumulations on trees. In R. S. Bird, C. C. Morgan, and J. C. P. Woodcock, editors, Mathematics of Program Construction, volume 669 of Lecture Notes in Computer Science. Springer-Verlag, 1993. This revised version appeared in Proceedings of the Massey Functional Programming Workshop (ed E. Ireland and N. Perry, 1992). [ bib | .ps.gz ] An accumulation is a higher-order operation over structured objects of some type; it leaves the shape of an object unchanged, but replaces each element of that object with some accumulated information about the other elements. Upwards and downwards accumulations on trees are two instances of this scheme; they replace each element of a tree with some function-in fact, some homomorphism-of that element's descendants and of its ancestors, respectively. These two operations can be thought of as passing information up and down the tree. We introduce these two accumulations, and show how together they solve the so-called prefix sums problem. [ata] Jeremy Gibbons. Algebras for Tree Algorithms. D.Phil. thesis, Programming Research Group, Oxford University, 1991. Available as Technical Monograph PRG-94. ISBN 0-902928-72-4. [ bib ] This thesis presents an investigation into the properties of various algebras of trees. In particular, we study the influence that the structure of a tree algebra has on the solution of algorithmic problems about trees in that algebra. The investigation is conducted within the framework provided by the Bird-Meertens formalism, a calculus for the construction of programs by equational reasoning from their specifications. We present three different tree algebras: two kinds of binary tree and a kind of general tree. One of the binary tree algebras, called `hip trees', is new. Instead of being built with a single ternary operator, hip trees are built with two binary operators which respectively add left and right children to trees which do not already have them; these operators enjoy a kind of associativity property. Each of these algebras brings with it with a class of `structure-respecting' functions called catamorphisms; the definition of a catamorphism and a number of its properties come for free from the definition of the algebra, because the algebra is chosen to be initial in a class of algebras induced by a (cocontinuous) functor. Each algebra also brings with it, but not for free, classes of `structure-preserving' functions called accumulations. An accumulation is a function that preserves the shape of a structured object such as a tree, but replaces each element of that object with some catamorphism applied to some of the other elements. The two classes of accumulation that we study are the `upwards' and `downwards' accumulations, which pass information from the leaves of a tree towards the root and from the root towards the leaves, respectively. Upwards and downwards accumulations turn out to be the key to the solution of many problems about trees. We derive accumulation-based algorithms for a number of problems; these include the parallel prefix algorithm for the prefix sums problem, algorithms for bracket matching and for drawing binary and general trees, and evaluators for decorating parse trees according to an attribute grammar. [balanced] Jeremy Gibbons. Balanced binary trees as a partial free algebra. The Squiggolist, 1(4), 1990. [ bib ] You don't need `subset' types to construct balanced trees, if you allow yourself partial constructors or a countable infinity of constructors. [kmp] Richard S. Bird, Jeremy Gibbons, and Geraint Jones. Formal derivation of a pattern matching algorithm. Science of Computer Programming, 12(2):93-104, July 1989. [ bib | http ] This paper is devoted to the synthesis of a functional version of the Knuth-Morris-Pratt algorithm for pattern matching. This algorithm was first discussed by Knuth; since then formal developments have been given by Dijkstra and Dromey, among many others. The novel aspects of the present treatment are: (i) the result is expressed as a (very short) functional program; and (ii) the derivation makes use of the calculus of lists described by Bird. [unique] Jeremy Gibbons. The unique derivative of a prefix-closed predicate. The Squiggolist, 1(2), 1989. [ bib ] Talking about `the' derivative of a prefix-closed function makes no sense, but talking about the strongest and the weakest derivative does. [interesting] Jeremy Gibbons. An interesting characterisation of prefix-closure. The Squiggolist, 1(2), 1989. [ bib ] A predicate is prefix-closed iff it holds of all initial segments of a list precisely when it holds of the whole list. [newview] Jeremy Gibbons. A new view of binary trees. Transferral dissertation, Programming Research Group, Oxford University, 1988. Abstract appears in the Bulletin of the EATCS, number 39, p. 214. [ bib ] We present a new formalism of labelled binary trees, using two partial binary constructors instead of the usual total ternary constructor. This formalism is complemented by some higher-order operators, encapsulating common patterns of computation on trees. We explore their use by deriving solutions to a couple of algorithmic problems on trees. The work proceeds in the Bird-Meertens style. This is a calculus for programs, closely related to applicative programming languages. Expressions are written at the function level, avoiding the use of unnecessary names and being as concise as possible. Derivations are performed by program transformation - the application of correctness-preserving transformations to an initial specification, with the intention of improving its efficiency without changing its meaning. This file has been generated by bibtex2html 1.85. Jeremy Gibbons (Jeremy.Gibbons@comlab.ox.ac.uk)