Inductive Data Types for Predicate Transformers

Modern functional programming languages 5, 6] and speciication formalisms 3] are built around the notion of inductive data types and homomorphisms on these data types. Such homomorphisms, which correspond to the familiar fold or reduce operators in functional programming, are called catamorphisms. In this note, it is shown how catamorphisms can be generalised from functions to relations, and from relations to predicate transformers. The rst step of this generalisation (from functions to relations) was already achieved in a slightly diierent setting by Backhouse et al. 2]; the generalisation to predicate transformers is new. In practical terms, the main result presented here says that a calculus based on predicate transformers (like the reenement calculus studied by Back, Morgan and others 1, 14]) can be enriched with program constructors for iterating over inductive data types. The reenement calculus did already allow a notion of inductive data types, but until now it lacked the program constructors that are associated with such data types, namely catamorphisms. It will be assumed that the reader is acquainted with the categorical treatment of data types as algebras for an endofunctor. A readily accessible introduction to this subject, with many applications to program derivation, is Malcolm's paper 12]. It is also useful if the reader has some familiarity with the connection between relations and predicate transformers; see e.g. 9].