Initial Algebra Semantics for Cyclic Sharing Tree Structures

Terms are a concise representation of tree structures. Since they can be naturally defined by an inductive type, they offer data structures in functional programming and mechanised reasoning with useful principles such as structural induction and structural recursion. However, for graphs or "tree-like" structures - trees involving cycles and sharing - it remains unclear what kind of inductive structures exists and how we can faithfully assign a term representation of them. In this paper we propose a simple term syntax for cyclic sharing structures that admits structural induction and recursion principles. We show that the obtained syntax is directly usable in the functional language Haskell and the proof assistant Agda, as well as ordinary data structures such as lists and trees. To achieve this goal, we use a categorical approach to initial algebra semantics in a presheaf category. That approach follows the line of Fiore, Plotkin and Turi's models of abstract syntax with variable binding.

[1]  Philippa Gardner,et al.  Context logic and tree update , 2005, POPL '05.

[2]  Mark N. Wegman,et al.  Efficiently computing static single assignment form and the control dependence graph , 1991, TOPL.

[3]  Tarmo Uustalu,et al.  Explicit substitutions and higher-order syntax , 2003, MERLIN '03.

[4]  Robert E. Tarjan,et al.  Depth-First Search and Linear Graph Algorithms , 1972, SIAM J. Comput..

[5]  Patricia Johann,et al.  Initial Algebra Semantics Is Enough! , 2007, TLCA.

[6]  Peter Aczel,et al.  Infinite trees and completely iterative theories: a coalgebraic view , 2003, Theor. Comput. Sci..

[7]  Marko C. J. D. van Eekelen,et al.  Term Graph Rewriting , 1987, PARLE.

[8]  Ryu Hasegawa,et al.  Two applications of analytic functors , 2002, Theor. Comput. Sci..

[9]  Makoto Hamana Universal Algebra for Termination of Higher-Order Rewriting , 2005, RTA.

[10]  Marcelo P. Fiore,et al.  Semantic analysis of normalisation by evaluation for typed lambda calculus , 2002, PPDP '02.

[11]  Conor McBride Faking it: Simulating dependent types in Haskell , 2002, J. Funct. Program..

[12]  U. Norell,et al.  Towards a practical programming language based on dependent type theory , 2007 .

[13]  Neil Ghani,et al.  Representing Cyclic Structures as Nested Datatypes , 2006 .

[14]  James Brotherston,et al.  Cyclic Proofs for First-Order Logic with Inductive Definitions , 2005, TABLEAUX.

[15]  Peter Dybjer,et al.  Inductive families , 2005, Formal Aspects of Computing.

[16]  Bart Jacobs,et al.  Categorical Logic and Type Theory , 2001, Studies in logic and the foundations of mathematics.

[17]  Wouter Swierstra,et al.  The power of Pi , 2008, ICFP.

[18]  Bruno Courcelle,et al.  Algorithmes d'equivalence et de reduction a des expressions minimales dans une classe d'equations recursives simples , 1974, ICALP.

[19]  Makoto Hamana,et al.  Initial Algebra Semantics for Cyclic Sharing Structures , 2009, TLCA.

[20]  Patricia Johann,et al.  Foundations for structured programming with GADTs , 2008, POPL '08.

[21]  Gordon D. Plotkin,et al.  The category-theoretic solution of recursive domain equations , 1977, 18th Annual Symposium on Foundations of Computer Science (sfcs 1977).

[22]  Gordon D. Plotkin,et al.  Complete axioms for categorical fixed-point operators , 2000, Proceedings Fifteenth Annual IEEE Symposium on Logic in Computer Science (Cat. No.99CB36332).

[23]  Makoto Hamana Free S-Monoids: A Higher-Order Syntax with Metavariables , 2004, APLAS.

[24]  Marcelo P. Fiore,et al.  Second-Order and Dependently-Sorted Abstract Syntax , 2008, 2008 23rd Annual IEEE Symposium on Logic in Computer Science.

[25]  Marino Miculan,et al.  A framework for typed HOAS and semantics , 2003, PPDP '03.

[26]  Simon L. Peyton Jones,et al.  Simple unification-based type inference for GADTs , 2006, ICFP '06.

[27]  Bart Jacobs,et al.  Structural Induction and Coinduction in a Fibrational Setting , 1998, Inf. Comput..

[28]  Gordon D. Plotkin,et al.  Abstract syntax and variable binding , 1999, Proceedings. 14th Symposium on Logic in Computer Science (Cat. No. PR00158).

[29]  Zena M. Ariola,et al.  Equational Term Graph Rewriting , 1996, Fundam. Informaticae.

[30]  Edmund Robinson Variations on Algebra: Monadicity and Generalisations of Equational Therories , 2002, Formal Aspects of Computing.

[31]  真人 長谷川 Models of sharing graphs : a categorical semantics of let and letrec , 1999 .