Exploring the Regular Tree Types
Abstract
In this paper we use the Epigram language to define the universe of regular tree types—closed under empty, unit, sum, product and least fixpoint. We then present a generic decision procedure for Epigram’s in-built equality at each type, taking a complementary approach to that of Benke, Dybjer and Jansson [7]. We also give a generic definition of map, taking our inspiration from Jansson and Jeuring [21]. Finally, we equip the regular universe with the partial derivative which can be interpreted functionally as Huet’s notion of ‘zipper’, as suggested by McBride in [27] and implemented (without the fixpoint case) in Generic Haskell by Hinze, Jeuring and Löh [18]. We aim to show through these examples that generic programming can be ordinary programming in a dependently typed language.
Keywords
Type Theory Functional Programming Type Constructor Functional Programming Language International Summer SchoolPreview
Unable to display preview. Download preview PDF.
References
- 1.Abbott, M.: Categories of Containers. PhD thesis, University of Leicester (2003)Google Scholar
- 2.Abbott, M., Altenkirch, T., Ghani, N.: Categories of containers. In: Proceedings of Foundations of Software Science and Computation Structures (2003)Google Scholar
- 3.Abbott, M., Altenkirch, T., Ghani, N., McBride, C.: \(\partial\) for data: derivatives of data structures. Fundamenta Informaticae 65(1,2), 1–128 (2005)zbMATHMathSciNetGoogle Scholar
- 4.Altenkirch, T., McBride, C.: Generic programming within dependently typed programming. In: Generic Programming, Proceedings of the IFIP TC2 Working Conference on Generic Programming, Schloss Dagstuhl, July 2002 (2003)Google Scholar
- 5.Altenkirch, T., Reus, B.: Monadic presentations of lambda-terms using generalized inductive types. In: Flum, J., Rodríguez-Artalejo, M. (eds.) CSL 1999. LNCS, vol. 1683, pp. 453–468. Springer, Heidelberg (1999)CrossRefGoogle Scholar
- 6.Backhouse, R., Jansson, P., Jeuring, J., Meertens, L.: Generic Programming—An Introduction. In: Doaitse Sweierstra, S., Henriques, P.R., Oliveira, J.N. (eds.) AFP 1998. LNCS, vol. 1608, pp. 28–115. Springer, Heidelberg (1999)CrossRefGoogle Scholar
- 7.Benke, M., Dybjer, P., Jansson, P.: Universes for generic programs and proofs in dependent type theory. Nordic Journal of Computing 10, 265–269 (2003)zbMATHMathSciNetGoogle Scholar
- 8.Brady, E.: Practical Implementation of a Dependently Typed Functional Programming Language. PhD thesis, University of Durham (2005)Google Scholar
- 9.Brady, E., McBride, C., McKinna, J.: Inductive families need not store their indices. In: Berardi, S., Coppo, M., Damiani, F. (eds.) TYPES 2003. LNCS, vol. 3085, pp. 115–129. Springer, Heidelberg (2004)CrossRefGoogle Scholar
- 10.Clarke, D., Hinze, R., Jeuring, J., Löh, A., de Wit, J.: The Generic Haskell user’s guide. Technical Report UU-CS-2001-26, Utrecht University (2001)Google Scholar
- 11.L’Équipe Coq. The Coq Proof Assistant Reference Manual (2001), http://pauillac.inria.fr/coq/doc/main.html
- 12.Coquand, C., Coquand, T.: Structured Type Theory. In: Workshop on Logical Frameworks and Metalanguages (1999)Google Scholar
- 13.Coquand, T.: Pattern Matching with Dependent Types. In: Nordström, B., Petersson, K., Plotkin, G. (eds.) Electronic Proceedings of the Third Annual BRA Workshop on Logical Frameworks, Båstad, Sweden (1992)Google Scholar
- 14.de Bruijn, N.G.: Lambda Calculus notation with nameless dummies: a tool for automatic formula manipulation. Indagationes Mathematicæ 34, 381–392 (1972)CrossRefGoogle Scholar
- 15.de Bruijn, N.G.: Telescopic Mappings in Typed Lambda-Calculus. Information and Computation 91, 189–204 (1991)zbMATHCrossRefMathSciNetGoogle Scholar
- 16.Dybjer, P.: Inductive Sets and Families in Martin-Löf’s Type Theory. In: Huet, G., Plotkin, G. (eds.) Logical Frameworks, CUP (1991)Google Scholar
- 17.Dybjer, P., Setzer, A.: Indexed induction-recursion. In: Kahle, R., Schroeder-Heister, P., Stärk, R.F. (eds.) PTCS 2001. LNCS, vol. 2183, pp. 93–113. Springer, Heidelberg (2001)CrossRefGoogle Scholar
- 18.Hinze, R., Jeuring, J., Löh, A.: Type-indexed data types. Science of Computer Programmming 51, 117–151 (2004)zbMATHCrossRefGoogle Scholar
- 19.Hosoya, H., Vouillon, J., Pierce, B.C.: Regular Expression Types for XML. In: Proceedings of the International Conference on Functional Programming (2000)Google Scholar
- 20.Huet, G.: The Zipper. Journal of Functional Programming 7(5), 549–554 (1997)zbMATHCrossRefMathSciNetGoogle Scholar
- 21.Jansson, P., Jeuring, J.: PolyP—a polytypic programming language extension. In: Proceedings of POPL 1997, pp. 470–482. ACM, New York (1997)CrossRefGoogle Scholar
- 22.Leibniz, G.: Nova methodus pro maximis et minimis, itemque tangentibus, qua nec irrationals quantitates moratur. Acta Eruditorum (1684)Google Scholar
- 23.Luo, Z.: Computation and Reasoning: A Type Theory for Computer Science. Oxford University Press, Oxford (1994)zbMATHGoogle Scholar
- 24.Luo, Z., Pollack, R.: LEGO Proof Development System: User’s Manual. Technical Report ECS-LFCS-92-211, Laboratory for Foundations of Computer Science, University of Edinburgh (1992)Google Scholar
- 25.Magnusson, L., Nordström, B.: The ALF proof editor and its proof engine. In: Barendregt, H., Nipkow, T. (eds.) TYPES 1993. LNCS, vol. 806. Springer, Heidelberg (1994)Google Scholar
- 26.Martin-Löf, P.: Intuitionistic Type Theory. Bibliopolis, Napoli (1984)zbMATHGoogle Scholar
- 27.McBride, C.: The Derivative of a Regular Type is its Type of One-Hole Contexts (2001), Available at: http://www.dur.ac.uk/c.t.mcbride/diff.ps
- 28.McBride, C.: Elimination with a Motive. In: Callaghan, P., Luo, Z., McKinna, J., Pollack, R. (eds.) TYPES 2000. LNCS, vol. 2277, p. 197. Springer, Heidelberg (2002)CrossRefGoogle Scholar
- 29.McBride, C.: Epigram: Practical programming with dependent types. In: Vene, V., Uustalu, T. (eds.) AFP 2004. LNCS, vol. 3622, pp. 130–170. Springer, Heidelberg (2005)CrossRefGoogle Scholar
- 30.McBride, C., McKinna, J.: The view from the left. Journal of Functional Programming 14(1) (2004)Google Scholar
- 31.McBride, F.: Computer Aided Manipulation of Symbols. PhD thesis, Queen’s University of Belfast (1970)Google Scholar
- 32.Milner, R., Tofte, M., Harper, R., MacQueen, D.: The Definition of Standard ML, revised edition. MIT Press, Cambridge (1997)Google Scholar
- 33.Pfeifer, H., Rueß, H.: Polytypic Proof Construction. In: Bertot, Y., Dowek, G., Hirschowitz, A., Paulin, C., Théry, L. (eds.) TPHOLs 1999. LNCS, vol. 1690, pp. 55–72. Springer, Heidelberg (1999)CrossRefGoogle Scholar
- 34.Nordström, B., Petersson, K., Smith, J.: Programming in Martin-Löf’s type theory: an introduction. Oxford University Press, Oxford (1990)zbMATHGoogle Scholar