Abstract
The third list-homomorphism theorem says that a function is a list homomorphism if it can be described as an instance of both a foldr and a foldl. We prove a dual theorem for unfolds and generalise both theorems to trees: if a function generating a list can be described both as an unfoldr and an unfoldl, the list can be generated from the middle, and a function that processes or builds a tree both upwards and downwards may independently process/build a subtree and its one-hole context. The point-free, relational formalism helps to reveal the beautiful symmetry hidden in the theorem.
Supplemental Material
- R. S. Bird. An introduction to the theory of lists. In M. Broy, editor, Logic of Programming and Calculi of Discrete Design, volume 36 of NATO ASI Series F, pages 3--42. Springer-Verlag, New York, NY, USA, 1987. Technical Monograph PRG-56. Google Scholar
Digital Library
- G. E. Blelloch. Prefix sums and their applications. In J. E. Reif, editor, Synthesis of Parallel Algorithms. Morgan Kaufmann Publishers Inc., San Francisco, CA, USA, 1993.Google Scholar
- M. I. Cole. Algorithmic Skeletons: Structural Management of Parallel Computation. MIT Press, 1989. Google Scholar
Digital Library
- E. W. Dijkstra. A Discipline of Programming. Prentice Hall PTR, 1976. Google Scholar
Digital Library
- A. Geser and S. Gorlatch. Parallelizing functional programs by generalization. Journal of Functional Programming, 9 (6): 649--673, 1999. Google Scholar
Digital Library
- J. Gibbons. The third homomorphism theorem. Journal of Functional Programming, 6 (4): 657--665, 1996.Google Scholar
Cross Ref
- J. Gibbons, G. Hutton, and T. Altenkirch. When is a function a fold or an unfold? Electr. Notes Theor. Comput. Sci., 44 (1), 2001.Google Scholar
- G. P. Huet. The zipper. Journal of Functional Programming, 7 (5): 549--554, 1997. Google Scholar
Digital Library
- A. Morihata, K. Matsuzaki, Z. Hu, and M. Takeichi. Program parallelization by candidate generation and conformity testing. IPSJ Transaction on Programming, 2 (2): 132--143, 2009. (In Japanese).Google Scholar
- A. Morihata, K. Matsuzaki, Z. Hu, and M. Takeichi. The third homomorphism theorem on trees: Downward & upward lead to divide-and-conquer. In Proceedings of the 36th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2009, Savannah, Georgia, USA, January 21--23, 2009, pages 177--185. ACM, 2009. Google Scholar
Digital Library
- K. Morita, A. Morihata, K. Matsuzaki, Z. Hu, and M. Takeichi. Automatic inversion generates divide-and-conquer parallel programs. In J. Ferrante and K. S. McKinley, editors, Proceedings of the ACM SIGPLAN 2007 Conference on Programming Language Design and Implementation, San Diego, California, USA, June 10--13, 2007, pages 146--155. ACM, 2007. Google Scholar
Digital Library
Index Terms
Generalising and dualising the third list-homomorphism theorem: functional pearl
Recommendations
Generalising and dualising the third list-homomorphism theorem: functional pearl
ICFP '11: Proceedings of the 16th ACM SIGPLAN international conference on Functional programmingThe third list-homomorphism theorem says that a function is a list homomorphism if it can be described as an instance of both a foldr and a foldl. We prove a dual theorem for unfolds and generalise both theorems to trees: if a function generating a list ...
The third homomorphism theorem on trees: downward & upward lead to divide-and-conquer
POPL '09Parallel programs on lists have been intensively studied. It is well known that associativity provides a good characterization for divide-and-conquer parallel programs. In particular, the third homomorphism theorem is not only useful for systematic ...
Dualising initial algebras
Whilst the relationship between initial algebras and monads is well understood, the relationship between final coalgebras and comonads is less well explored. This paper shows that the problem is more subtle than might appear at first glance: final ...







Comments