Strong Categorical Datatypes II: A Term Logic for Categorical Programming

Abstract This paper lifts earlier category-theoretic results on datatypes to the level of an abstract language suitable for categorical programming language implementation. The earlier work built a strongly normalizing categorical combinator reduction system based entirely on functorial strength which allows the distribution of context to the interior of datatypes. Here we declare inductive (initial) and coinductive (final) datatypes in a Hagino-Wraith style to provide an expressive computing environment. An inductive (resp. coinductive) datatype consists of a strong type-forming functor accompanied by (1) a collection of constructors (resp. destructors) and (2) a fold (resp. unfold) which is parametrized by state transformations to realize the appropriate universal property. The high complexity of programming exclusively in categorical notation (combinators) warrants the development of a friendlier language isomorphic to the distributive categorical setting. In this paper such a term logic, which is also the programming language of the charity programming system, is described. This logic is first-order and is dictated directly by the underlying categorical semantics. It embodies primitive inductive and coinductive principles which reflect the uniqueness properties of the fold and unfold combinators. Several basic progam equivalences are demonstrated to illustrate how these inductive and coinductive principles can be used.

[1]  Ryu Hasegawa,et al.  Categorical data types in parametric polymorphism , 1994, Mathematical Structures in Computer Science.

[2]  Charles Wells A Generalization of the Concept of Sketch , 1990, Theor. Comput. Sci..

[3]  Ryu Hasegawa Parametricity of Extensionally Collapsed Term Models of Polymorphism and Their Categorical Properties , 1991, TACS.

[4]  John C. Reynolds,et al.  Types, Abstraction and Parametric Polymorphism , 1983, IFIP Congress.

[5]  J. R.B. Cockett Distributive Logic , 1989 .

[6]  R. E. A. Mason,et al.  Information Processing 83 , 1984 .

[7]  Harry G. Mairson Outline of a Proof Theory of Parametricity , 1991, FPCA.

[8]  Grant Malcolm,et al.  Algebraic Data Types and Program Transformation , 1990 .

[9]  R. Cockett,et al.  Strong categorical datatypes I , 1991 .

[10]  Tatsuya Hagino,et al.  Codatatypes in ML , 1989, J. Symb. Comput..

[11]  John Greiner,et al.  Programming with Inductive and Co-Inductive Types , 1992 .

[12]  Michael Barr,et al.  The Formal Description of Data Types Using Sketches , 1987, MFPS.

[13]  G. C. Wraith A Note on Categorical Datatypes , 1989, Category Theory and Computer Science.

[14]  Lawrence C. Paulson,et al.  Co-induction and co-recursion in higher-order logic , 1993 .

[15]  Philip Wadler,et al.  Theorems for free! , 1989, FPCA.

[16]  Tim Sheard,et al.  A fold for all seasons , 1993, FPCA '93.

[17]  John Hughes,et al.  Why Functional Programming Matters , 1989, Comput. J..

[18]  Maarten M. Fokkinga,et al.  Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire , 1991, FPCA.

[19]  A. Kock Strong functors and monoidal monads , 1972 .

[20]  Andrew M. Pitts,et al.  A co-Induction Principle for Recursively Defined Domains , 1994, Theor. Comput. Sci..

[21]  Alley Stoughton,et al.  Substitution Revisited , 1988, Theor. Comput. Sci..